idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
41,200
@ GetMapping ( value = "/{entityTypeId}/{id}" , produces = APPLICATION_JSON_VALUE ) public Map < String , Object > retrieveEntity ( @ PathVariable ( "entityTypeId" ) String entityTypeId , @ PathVariable ( "id" ) String untypedId , @ RequestParam ( value = "attributes" , required = false ) String [ ] attributes , @ Requ...
Get s an entity by it s id
241
8
41,201
@ Transactional @ DeleteMapping ( "/{entityTypeId}/{id}" ) @ ResponseStatus ( NO_CONTENT ) public void deleteDelete ( @ PathVariable ( "entityTypeId" ) String entityTypeId , @ PathVariable ( "id" ) String untypedId ) { delete ( entityTypeId , untypedId ) ; }
Deletes an entity by it s id
77
8
41,202
@ PostMapping ( value = "/{entityTypeId}/{id}" , params = "_method=DELETE" ) @ ResponseStatus ( NO_CONTENT ) public void deletePost ( @ PathVariable ( "entityTypeId" ) String entityTypeId , @ PathVariable ( "id" ) String untypedId ) { delete ( entityTypeId , untypedId ) ; }
Deletes an entity by it s id but tunnels DELETE through POST
85
15
41,203
@ DeleteMapping ( "/{entityTypeId}" ) @ ResponseStatus ( NO_CONTENT ) public void deleteAll ( @ PathVariable ( "entityTypeId" ) String entityTypeId ) { dataService . deleteAll ( entityTypeId ) ; }
Deletes all entities for the given entity name
54
9
41,204
@ PostMapping ( value = "/{entityTypeId}" , params = "_method=DELETE" ) @ ResponseStatus ( NO_CONTENT ) public void deleteAllPost ( @ PathVariable ( "entityTypeId" ) String entityTypeId ) { dataService . deleteAll ( entityTypeId ) ; }
Deletes all entities for the given entity name but tunnels DELETE through POST
67
16
41,205
@ DeleteMapping ( value = "/{entityTypeId}/meta" ) @ ResponseStatus ( NO_CONTENT ) public void deleteMeta ( @ PathVariable ( "entityTypeId" ) String entityTypeId ) { deleteMetaInternal ( entityTypeId ) ; }
Deletes all entities and entity meta data for the given entity name
57
13
41,206
@ PostMapping ( value = "/{entityTypeId}/meta" , params = "_method=DELETE" ) @ ResponseStatus ( NO_CONTENT ) public void deleteMetaPost ( @ PathVariable ( "entityTypeId" ) String entityTypeId ) { deleteMetaInternal ( entityTypeId ) ; }
Deletes all entities and entity meta data for the given entity name but tunnels DELETE through POST
68
20
41,207
@ SuppressWarnings ( "deprecation" ) private EntityCollectionResponse retrieveEntityCollectionInternal ( String entityTypeId , EntityCollectionRequest request , Set < String > attributesSet , Map < String , Set < String > > attributeExpandsSet ) { EntityType meta = dataService . getEntityType ( entityTypeId ) ; Reposit...
Handles a Query
447
4
41,208
@ Bean public JobFactory < FileIngestJobExecution > fileIngestJobFactory ( ) { return new JobFactory < FileIngestJobExecution > ( ) { @ Override public Job createJob ( FileIngestJobExecution fileIngestJobExecution ) { final String targetEntityId = fileIngestJobExecution . getTargetEntityId ( ) ; final String url = file...
The FileIngestJob Factory bean .
202
8
41,209
public static Iterable < String > getAttributeNames ( Iterable < Attribute > attrs ) { return ( ) -> stream ( attrs ) . map ( Attribute :: getName ) . iterator ( ) ; }
Returns attribute names for the given attributes
45
7
41,210
public static String buildFullName ( Package aPackage , String simpleName ) { String fullName ; if ( aPackage != null ) { fullName = aPackage . getId ( ) + PACKAGE_SEPARATOR + simpleName ; } else { fullName = simpleName ; } return fullName ; }
Builds and returns an entity full name based on a package and a simpleName
64
16
41,211
private static void checkForKeyword ( String name ) { if ( KEYWORDS . contains ( name ) || KEYWORDS . contains ( name . toUpperCase ( ) ) ) { throw new MolgenisDataException ( "Name [" + name + "] is not allowed because it is a reserved keyword." ) ; } }
Checks if a name is a reserved keyword .
70
10
41,212
< E extends Entity > void registerStaticEntityFactory ( EntityFactory < E , ? > staticEntityFactory ) { String entityTypeId = staticEntityFactory . getEntityTypeId ( ) ; staticEntityFactoryMap . put ( entityTypeId , staticEntityFactory ) ; }
Registers a static entity factory
56
6
41,213
private void validateCsvFile ( List < String [ ] > content , String fileName ) { if ( content . isEmpty ( ) ) { throw new MolgenisDataException ( format ( "CSV-file: [{0}] is empty" , fileName ) ) ; } if ( content . size ( ) == 1 ) { throw new MolgenisDataException ( format ( "Header was found, but no data is present i...
Validates CSV file content .
175
6
41,214
public Object eval ( String expression , Entity entity , int depth ) { return eval ( createBindings ( entity , depth ) , expression ) ; }
Evaluate a expression for a given entity .
30
10
41,215
private Object eval ( Bindings bindings , String expression ) { try { return jsScriptEngine . eval ( bindings , expression ) ; } catch ( javax . script . ScriptException t ) { return new ScriptException ( t . getCause ( ) . getMessage ( ) , t . getCause ( ) ) ; } catch ( Exception t ) { return new ScriptException ( t )...
Evaluates an expression with the given bindings .
82
10
41,216
private Bindings createBindings ( Entity entity , int depth ) { Bindings bindings = new SimpleBindings ( ) ; JSObject global = ( JSObject ) magmaBindings . get ( "nashorn.global" ) ; JSObject magmaScript = ( JSObject ) global . getMember ( KEY_MAGMA_SCRIPT ) ; JSObject dollarFunction = ( JSObject ) magmaScript . getMem...
Creates magmascript bindings for a given Entity .
209
11
41,217
private Object toScriptEngineValueMap ( Entity entity , int depth ) { if ( entity != null ) { Object idValue = toScriptEngineValue ( entity , entity . getEntityType ( ) . getIdAttribute ( ) , 0 ) ; if ( depth == 0 ) { return idValue ; } else { Map < String , Object > map = Maps . newHashMap ( ) ; entity . getEntityType...
Convert entity to a JavaScript object . Adds _idValue as a special key to every level for quick access to the id value of an entity .
154
30
41,218
private boolean isBroader ( AttributeType enrichedTypeGuess , AttributeType columnTypeGuess ) { if ( columnTypeGuess == null && enrichedTypeGuess != null || columnTypeGuess == null ) { return true ; } switch ( columnTypeGuess ) { case INT : return enrichedTypeGuess . equals ( INT ) || enrichedTypeGuess . equals ( LONG ...
Check if the new enriched type is broader the the previously found type
363
13
41,219
private AttributeType getEnrichedType ( AttributeType guess , Object value ) { if ( guess == null || value == null ) { return guess ; } if ( guess . equals ( STRING ) ) { String stringValue = value . toString ( ) ; if ( stringValue . length ( ) > MAX_STRING_LENGTH ) { return TEXT ; } if ( canValueBeUsedAsDate ( value )...
Returns an enriched AttributeType for when the value meets certain criteria i . e . if a string value is longer dan 255 characters the type should be TEXT
258
31
41,220
private AttributeType getCommonType ( AttributeType existingGuess , AttributeType newGuess ) { if ( existingGuess == null && newGuess == null ) { return null ; } if ( existingGuess == null ) { return newGuess ; } if ( newGuess == null ) { return existingGuess ; } if ( existingGuess . equals ( newGuess ) ) { return exis...
Returns the AttributeType shared by both types
252
9
41,221
private AttributeType getBasicAttributeType ( Object value ) { if ( value == null ) { return null ; } if ( value instanceof Integer ) { return INT ; } else if ( value instanceof Double || value instanceof Float ) { return DECIMAL ; } else if ( value instanceof Long ) { return LONG ; } else if ( value instanceof Boolean...
Sets the basic type based on instance of the value Object
91
12
41,222
private void validateDeleteAllowed ( Attribute attr ) { String attrIdentifier = attr . getIdentifier ( ) ; if ( systemEntityTypeRegistry . hasSystemAttribute ( attrIdentifier ) ) { throw new SystemMetadataModificationException ( ) ; } }
Deleting attribute meta data is allowed for non - system attributes .
60
14
41,223
@ GetMapping public String init ( @ RequestParam ( value = "entity" , required = false ) String selectedEntityName , @ RequestParam ( value = "entityId" , required = false ) String selectedEntityId , Model model ) { StringBuilder message = new StringBuilder ( "" ) ; final boolean currentUserIsSu = SecurityUtils . curre...
Show the explorer page
487
4
41,224
private EntityType assignUniqueLabel ( EntityType entityType , CopyState state ) { Set < String > existingLabels ; Package targetPackage = state . targetPackage ( ) ; if ( targetPackage != null ) { existingLabels = stream ( targetPackage . getEntityTypes ( ) ) . map ( EntityType :: getLabel ) . collect ( toSet ( ) ) ; ...
Checks if there s an EntityType in the target location with the same label . If so keeps adding a postfix until the label is unique .
174
30
41,225
public static String getJunctionTableName ( EntityType entityType , Attribute attr , boolean quotedIdentifier ) { int nrAdditionalChars = 1 ; String entityPart = generateId ( entityType , ( MAX_IDENTIFIER_BYTE_LENGTH - nrAdditionalChars ) / 2 ) ; String attrPart = generateId ( attr , ( MAX_IDENTIFIER_BYTE_LENGTH - nrAd...
Returns the junction table name for the given attribute of the given entity
134
13
41,226
static String getJunctionTableIndexName ( EntityType entityType , Attribute attr , Attribute idxAttr ) { String indexNamePostfix = "_idx" ; int nrAdditionalChars = 1 + indexNamePostfix . length ( ) ; String entityPart = generateId ( entityType , ( MAX_IDENTIFIER_BYTE_LENGTH - nrAdditionalChars ) / 3 ) ; String attrPart...
Returns the junction table index name for the given indexed attribute in a junction table
194
15
41,227
@ GetMapping public String viewTagWizard ( @ RequestParam ( required = false , value = "selectedTarget" ) String target , Model model ) { List < String > entityTypeIds = dataService . findAll ( ENTITY_TYPE_META_DATA , EntityType . class ) . filter ( entityType -> ! EntityTypeUtils . isSystemEntity ( entityType ) ) . ma...
Displays on tag wizard button press
399
7
41,228
public Language create ( String code , String name , boolean active ) { Language language = super . create ( code ) ; language . setName ( name ) ; language . setActive ( active ) ; return language ; }
Creates a language with the given code and name
44
10
41,229
static String getSqlAddColumn ( EntityType entityType , Attribute attr , ColumnMode columnMode ) { StringBuilder sql = new StringBuilder ( "ALTER TABLE " ) ; String columnSql = getSqlColumn ( entityType , attr , columnMode ) ; sql . append ( getTableName ( entityType ) ) . append ( " ADD " ) . append ( columnSql ) ; Li...
Returns SQL string to add a column to an existing table .
170
12
41,230
static String getSqlDropColumnDefault ( EntityType entityType , Attribute attr ) { return "ALTER TABLE " + getTableName ( entityType ) + " ALTER COLUMN " + getColumnName ( attr ) + " DROP DEFAULT" ; }
Returns SQL string to remove the default value from an existing column .
59
13
41,231
private static boolean isPersistedInOtherTable ( Attribute attr ) { boolean bidirectionalOneToMany = attr . getDataType ( ) == ONE_TO_MANY && attr . isMappedBy ( ) ; return isMultipleReferenceType ( attr ) || bidirectionalOneToMany ; }
Returns whether this attribute is stored in the entity table or another table such as a junction table or referenced entity table .
68
23
41,232
private static < E extends Entity > boolean isDistinctSelectRequired ( EntityType entityType , Query < E > q ) { return isDistinctSelectRequiredRec ( entityType , q . getRules ( ) ) ; }
Determines whether a distinct select is required based on a given query .
46
15
41,233
static < E extends Entity > String getSqlCount ( EntityType entityType , Query < E > q , List < Object > parameters ) { StringBuilder sqlBuilder = new StringBuilder ( "SELECT COUNT" ) ; String idAttribute = getColumnName ( entityType . getIdAttribute ( ) ) ; List < QueryRule > queryRules = q . getRules ( ) ; if ( query...
Produces SQL to count the number of entities that match the given query . Ignores query offset and pagesize .
268
23
41,234
@ RunAsSystem public Group getGroup ( String groupName ) { Fetch roleFetch = new Fetch ( ) . field ( RoleMetadata . NAME ) . field ( RoleMetadata . LABEL ) ; Fetch fetch = new Fetch ( ) . field ( GroupMetadata . ROLES , roleFetch ) . field ( GroupMetadata . NAME ) . field ( GroupMetadata . LABEL ) . field ( GroupMetada...
Get the group entity by its unique name .
214
9
41,235
@ RunAsSystem public void addMember ( final Group group , final User user , final Role role ) { ArrayList < Role > groupRoles = newArrayList ( group . getRoles ( ) ) ; Collection < RoleMembership > memberships = roleMembershipService . getMemberships ( groupRoles ) ; boolean isGroupRole = groupRoles . stream ( ) . anyM...
Add member to group . User can only be added to a role that belongs to the group . The user can only have a single role within the group
194
30
41,236
@ GetMapping ( "/logo/{name}.{extension}" ) public void getLogo ( OutputStream out , @ PathVariable ( "name" ) String name , @ PathVariable ( "extension" ) String extension , HttpServletResponse response ) throws IOException { File f = fileStore . getFileUnchecked ( "/logo/" + name + "." + extension ) ; if ( ! f . exis...
Get a file from the logo subdirectory of the filestore
184
13
41,237
static boolean isPersistedInPostgreSql ( EntityType entityType ) { String backend = entityType . getBackend ( ) ; if ( backend == null ) { // TODO remove this check after getBackend always returns the backend if ( null != getApplicationContext ( ) ) { DataService dataService = getApplicationContext ( ) . getBean ( Data...
Returns whether the given entity is persisted in PostgreSQL
148
10
41,238
@ Override public String generateId ( Attribute attribute ) { String idPart = generateHashcode ( attribute . getEntity ( ) . getId ( ) + attribute . getIdentifier ( ) ) ; String namePart = truncateName ( cleanName ( attribute . getName ( ) ) ) ; return namePart + SEPARATOR + idPart ; }
Generates a field name for the given entity type
74
10
41,239
@ SuppressWarnings ( "WeakerAccess" ) public Entity getPluginSettings ( ) { String entityTypeId = DefaultSettingsEntityType . getSettingsEntityName ( getId ( ) ) ; return RunAsSystemAspect . runAsSystem ( ( ) -> getPluginSettings ( entityTypeId ) ) ; }
Returns an entity containing settings for a plugin or null if no settings exist .
67
15
41,240
DecoratorConfiguration removeReferencesOrDeleteIfEmpty ( List < Object > decoratorParametersToRemove , DecoratorConfiguration configuration ) { List < DecoratorParameters > decoratorParameters = stream ( configuration . getEntities ( PARAMETERS , DecoratorParameters . class ) . spliterator ( ) , false ) . filter ( para...
Removes references to DecoratorParameters that will be deleted . If this results in a DecoratorConfiguration without any parameters then the row is deleted .
162
31
41,241
@ Scheduled ( fixedRate = 60000 ) public void logStatistics ( ) { // TODO: do we want to log diff with last log instead? if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Cache stats:" ) ; for ( Map . Entry < String , LoadingCache < Query < Entity > , List < Object > > > cacheEntry : caches . entrySet ( ) ) { LOG . debu...
Logs cumulative cache statistics for all known caches .
119
10
41,242
static Object getPostgreSqlValue ( Entity entity , Attribute attr ) { String attrName = attr . getName ( ) ; AttributeType attrType = attr . getDataType ( ) ; switch ( attrType ) { case BOOL : return entity . getBoolean ( attrName ) ; case CATEGORICAL : case XREF : Entity xrefEntity = entity . getEntity ( attrName ) ; ...
Returns the PostgreSQL value for the given entity attribute
473
10
41,243
private void performIndexActions ( Progress progress , String transactionId ) { List < IndexAction > indexActions = dataService . findAll ( INDEX_ACTION , createQueryGetAllIndexActions ( transactionId ) , IndexAction . class ) . collect ( toList ( ) ) ; try { boolean success = true ; int count = 0 ; for ( IndexAction i...
Performs the IndexActions .
239
7
41,244
private boolean performAction ( Progress progress , int progressCount , IndexAction indexAction ) { requireNonNull ( indexAction ) ; String entityTypeId = indexAction . getEntityTypeId ( ) ; updateIndexActionStatus ( indexAction , IndexActionMetadata . IndexStatus . STARTED ) ; try { if ( dataService . hasEntityType ( ...
Performs a single IndexAction
435
6
41,245
private void rebuildIndexOneEntity ( String entityTypeId , String untypedEntityId ) { LOG . trace ( "Indexing [{}].[{}]... " , entityTypeId , untypedEntityId ) ; // convert entity id string to typed entity id EntityType entityType = dataService . getEntityType ( entityTypeId ) ; if ( null != entityType ) { Object entit...
Indexes one single entity instance .
322
7
41,246
static Query < IndexAction > createQueryGetAllIndexActions ( String transactionId ) { QueryRule rule = new QueryRule ( INDEX_ACTION_GROUP_ATTR , EQUALS , transactionId ) ; QueryImpl < IndexAction > q = new QueryImpl <> ( rule ) ; q . setSort ( new Sort ( ACTION_ORDER ) ) ; return q ; }
Retrieves the query to get all index actions sorted
80
11
41,247
private IntermediateParseResults getEntityTypeFromSource ( RepositoryCollection source ) { IntermediateParseResults intermediateResults = parseTagsSheet ( source . getRepository ( EMX_TAGS ) ) ; parsePackagesSheet ( source . getRepository ( EMX_PACKAGES ) , intermediateResults ) ; parseEntitiesSheet ( source . getRepos...
Parses metadata from a collection of repositories .
249
10
41,248
IntermediateParseResults parseTagsSheet ( Repository < Entity > tagRepository ) { IntermediateParseResults intermediateParseResults = new IntermediateParseResults ( entityTypeFactory ) ; if ( tagRepository != null ) { for ( Entity tagEntity : tagRepository ) { String id = tagEntity . getString ( EMX_TAG_IDENTIFIER ) ; ...
Parses all tags defined in the tags repository .
117
11
41,249
private void parsePackagesSheet ( Repository < Entity > repo , IntermediateParseResults intermediateResults ) { if ( repo == null ) return ; // Collect packages int rowIndex = 1 ; for ( Entity packageEntity : resolvePackages ( repo ) ) { rowIndex ++ ; parseSinglePackage ( intermediateResults , rowIndex , packageEntity ...
Parses the packages sheet
74
6
41,250
private static List < Tag > toTags ( IntermediateParseResults intermediateResults , List < String > tagIdentifiers ) { if ( tagIdentifiers . isEmpty ( ) ) { return emptyList ( ) ; } List < Tag > tags = new ArrayList <> ( tagIdentifiers . size ( ) ) ; for ( String tagIdentifier : tagIdentifiers ) { Tag tag = intermediat...
Convert tag identifiers to tags
122
6
41,251
List < EntityType > putEntitiesInDefaultPackage ( IntermediateParseResults intermediateResults , String defaultPackageId ) { Package p = getPackage ( intermediateResults , defaultPackageId ) ; if ( p == null ) { throw new UnknownPackageException ( defaultPackageId ) ; } List < EntityType > entities = newArrayList ( ) ;...
Put the entities that are not in a package in the selected package
150
13
41,252
static boolean parseBoolean ( String booleanString , int rowIndex , String columnName ) { if ( booleanString . equalsIgnoreCase ( TRUE . toString ( ) ) ) return true ; else if ( booleanString . equalsIgnoreCase ( FALSE . toString ( ) ) ) return false ; else throw new InvalidValueException ( booleanString , columnName ,...
Validates whether an EMX value for a boolean attribute is valid and returns the parsed boolean value .
96
20
41,253
private Language toLanguage ( Entity emxLanguageEntity ) { Language language = languageFactory . create ( ) ; language . setCode ( emxLanguageEntity . getString ( EMX_LANGUAGE_CODE ) ) ; language . setName ( emxLanguageEntity . getString ( EMX_LANGUAGE_NAME ) ) ; return language ; }
Creates a language entity from a EMX entity describing a language
77
13
41,254
public < A > Set < A > getAllDependants ( A item , Function < A , Integer > getDepth , Function < A , Set < A > > getDependants ) { Set < A > currentGeneration = singleton ( item ) ; Set < A > result = newHashSet ( ) ; Set < A > visited = newHashSet ( ) ; for ( int depth = 0 ; ! currentGeneration . isEmpty ( ) ; depth ...
Retrieves all items that depend on a given item .
179
12
41,255
private Integer getLookupAttributeIndex ( EditorAttribute editorAttribute , EditorEntityType editorEntityType ) { String editorAttributeId = editorAttribute . getId ( ) ; int index = editorEntityType . getLookupAttributes ( ) . stream ( ) . map ( EditorAttributeIdentifier :: getId ) . collect ( toList ( ) ) . indexOf (...
Find index of editorAttribute in editorEntityType lookupAttributes or return null
90
14
41,256
public AttributeMapping addAttributeMapping ( String targetAttributeName ) { if ( attributeMappings . containsKey ( targetAttributeName ) ) { throw new IllegalStateException ( "AttributeMapping already exists for target attribute " + targetAttributeName ) ; } Attribute targetAttribute = targetEntityType . getAttribute ...
Adds a new empty attribute mapping to a target attribute
110
10
41,257
Object getDataValuesForType ( Entity entity , Attribute attribute ) { String attributeName = attribute . getName ( ) ; switch ( attribute . getDataType ( ) ) { case DATE : return entity . getLocalDate ( attributeName ) ; case DATE_TIME : return entity . getInstant ( attributeName ) ; case BOOL : return entity . getBool...
Package - private for testability .
309
7
41,258
private void validate ( Entity entity ) { MailSettingsImpl mailSettings = new MailSettingsImpl ( entity ) ; if ( mailSettings . isTestConnection ( ) && mailSettings . getUsername ( ) != null && mailSettings . getPassword ( ) != null ) { mailSenderFactory . validateConnection ( mailSettings ) ; } }
Validates MailSettings .
69
5
41,259
@ Override public boolean upgrade ( ) { int schemaVersion = versionService . getSchemaVersion ( ) ; if ( schemaVersion < 31 ) { throw new UnsupportedOperationException ( "Upgrading from schema version below 31 is not supported" ) ; } if ( schemaVersion < versionService . getAppVersion ( ) ) { LOG . info ( "Metadata ver...
Executes MOLGENIS MetaData version upgrades .
203
11
41,260
protected void onStartup ( ServletContext servletContext , Class < ? > appConfig , int maxFileSize ) { // Create the 'root' Spring application context AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext ( ) ; rootContext . setAllowBeanDefinitionOverriding ( false ) ; rootContex...
A Molgenis common web application initializer
538
9
41,261
Document createDocument ( Entity entity ) { int maxIndexingDepth = entity . getEntityType ( ) . getIndexingDepth ( ) ; XContentBuilder contentBuilder ; try { contentBuilder = XContentFactory . contentBuilder ( JSON ) ; XContentGenerator generator = contentBuilder . generator ( ) ; generator . writeStartObject ( ) ; cre...
Create Elasticsearch document source content from entity
143
8
41,262
@ GetMapping ( "/**" ) public String initView ( Model model ) { super . init ( model , ID ) ; model . addAttribute ( "username" , super . userAccountService . getCurrentUser ( ) . getUsername ( ) ) ; return QUESTIONNAIRE_VIEW ; }
Loads the questionnaire view
64
5
41,263
@ SuppressWarnings ( "squid:S2259" ) // potential multi-threading NPE public Package getRootPackage ( ) { Package aPackage = this ; while ( aPackage . getParent ( ) != null ) { aPackage = aPackage . getParent ( ) ; } return aPackage ; }
Get the root of this package or itself if this is a root package
68
14
41,264
public void renumberViolationRowIndices ( List < Integer > actualIndices ) { violations . forEach ( v -> v . renumberRowIndex ( actualIndices ) ) ; }
renumber the violation row indices with the actual row numbers
40
11
41,265
public static Style createLocal ( String location ) { String name = location . replaceFirst ( "bootstrap-" , "" ) ; name = name . replaceFirst ( ".min" , "" ) ; name = name . replaceFirst ( ".css" , "" ) ; return new AutoValue_Style ( name , false , location ) ; }
Create new style . The name of the style is based off of the location string the optional boostrap - prefix and . min and . css affixes are removed from the name .
69
38
41,266
public void populate ( ) { PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver ( ) ; try { Resource [ ] bootstrap3Themes = resolver . getResources ( LOCAL_CSS_BOOTSTRAP_3_THEME_LOCATION ) ; Resource [ ] bootstrap4Themes = resolver . getResources ( LOCAL_CSS_BOOTSTRAP_4_THEME_LOCATION ...
Populate the database with the available bootstrap themes found in the jar . This enables the release of the application with a set of predefined bootstrap themes .
261
32
41,267
public static Fetch createDefaultEntityFetch ( EntityType entityType , String languageCode ) { boolean hasRefAttr = false ; Fetch fetch = new Fetch ( ) ; for ( Attribute attr : entityType . getAtomicAttributes ( ) ) { Fetch subFetch = createDefaultAttributeFetch ( attr , languageCode ) ; if ( subFetch != null ) { hasRe...
Create default entity fetch that fetches all attributes .
121
10
41,268
public static Fetch createDefaultAttributeFetch ( Attribute attr , String languageCode ) { Fetch fetch ; if ( isReferenceType ( attr ) ) { fetch = new Fetch ( ) ; EntityType refEntityType = attr . getRefEntity ( ) ; String idAttrName = refEntityType . getIdAttribute ( ) . getName ( ) ; fetch . field ( idAttrName ) ; St...
Create default fetch for the given attribute . For attributes referencing entities the id and label value are fetched . Additionally for file entities the URL is fetched . For other attributes the default fetch is null ;
179
40
41,269
public void renumberRowIndex ( List < Integer > indices ) { this . rowNr = this . rowNr != null ? Long . valueOf ( indices . get ( toIntExact ( this . rowNr - 1 ) ) ) : null ; }
Renumber the violation row number from a list of actual row numbers The list of indices is 0 - indexed and the rownnr are 1 - indexed
56
30
41,270
public static String generateScript ( Script script , Map < String , Object > parameterValues ) { StringWriter stringWriter = new StringWriter ( ) ; try { Template template = new Template ( null , new StringReader ( script . getContent ( ) ) , new Configuration ( VERSION ) ) ; template . process ( parameterValues , str...
Render a script using the given parameter values
127
8
41,271
@ Override @ Transactional ( readOnly = true ) @ RunAsSystem public UserDetails findUserByToken ( String token ) { Token molgenisToken = getMolgenisToken ( token ) ; return userDetailsService . loadUserByUsername ( molgenisToken . getUser ( ) . getUsername ( ) ) ; }
Find a user by a security token
74
7
41,272
@ Override @ Transactional @ RunAsSystem public String generateAndStoreToken ( String username , String description ) { User user = dataService . query ( USER , User . class ) . eq ( USERNAME , username ) . findOne ( ) ; if ( user == null ) { throw new IllegalArgumentException ( format ( "Unknown username [%s]" , usern...
Generates a token and associates it with a user .
183
11
41,273
static String generateUniqueLabel ( String label , Set < String > existingLabels ) { StringBuilder newLabel = new StringBuilder ( label ) ; while ( existingLabels . contains ( newLabel . toString ( ) ) ) { newLabel . append ( POSTFIX ) ; } return newLabel . toString ( ) ; }
Makes sure that a given label will be unique amongst a set of other labels .
68
17
41,274
@ Override @ RunAsSystem public String resolveCodeWithoutArguments ( String code , Locale locale ) { return Optional . ofNullable ( dataService . query ( L10N_STRING , L10nString . class ) . eq ( MSGID , code ) . findOne ( ) ) . map ( l10nString -> l10nString . getString ( locale ) ) . orElse ( null ) ; }
Looks up a single localized message .
90
7
41,275
@ RunAsSystem public Map < String , String > getMessages ( String namespace , Locale locale ) { return getL10nStrings ( namespace ) . stream ( ) . filter ( e -> e . getString ( locale ) != null ) . collect ( toMap ( L10nString :: getMessageID , e -> e . getString ( locale ) ) ) ; }
Gets all messages for a certain namespace and languageCode . Returns exactly those messages that are explicitly specified for this namespace and languageCode . Does not fall back to the default language .
80
36
41,276
@ Transactional public void deleteNamespace ( String namespace ) { List < L10nString > namespaceEntities = getL10nStrings ( namespace ) ; dataService . delete ( L10N_STRING , namespaceEntities . stream ( ) ) ; }
Deletes all localization strings for a given namespace
57
9
41,277
@ SuppressWarnings ( "WeakerAccess" ) public final < R > Optional < R > apply ( Timeout timeout , Function < T , R > function ) throws InterruptedException { T obj = claim ( timeout ) ; if ( obj == null ) { return Optional . empty ( ) ; } try { return Optional . ofNullable ( function . apply ( obj ) ) ; } finally { obj...
Claim an object from the pool and apply the given function to it returning the result and releasing the object back to the pool .
92
25
41,278
@ SuppressWarnings ( "WeakerAccess" ) public final boolean supply ( Timeout timeout , Consumer < T > consumer ) throws InterruptedException { T obj = claim ( timeout ) ; if ( obj == null ) { return false ; } try { consumer . accept ( obj ) ; return true ; } finally { obj . release ( ) ; } }
Claim an object from the pool and supply it to the given consumer and then release it back to the pool .
75
22
41,279
Reallocator < T > getAdaptedReallocator ( ) { if ( allocator == null ) { return null ; } if ( metricsRecorder == null ) { if ( allocator instanceof Reallocator ) { return ( Reallocator < T > ) allocator ; } return new ReallocatingAdaptor <> ( ( Allocator < T > ) allocator ) ; } else { if ( allocator instanceof Realloca...
Returns null if no allocator has been configured . Otherwise returns a Reallocator possibly by adapting the configured Allocator if need be . If a MetricsRecorder has been configured the return Reallocator will automatically record allocation reallocation and deallocation latencies .
155
56
41,280
public void setFunctionName ( String functionName ) { String oldFunctionName = functionName ; this . functionName = functionName ; firePropertyChange ( "FunctionName" , oldFunctionName , functionName ) ; }
Sets the functionName
45
5
41,281
public static String getSpringBootMavenPluginClassifier ( MavenProject project , Log log ) { String classifier = null ; try { classifier = MavenProjectUtil . getPluginGoalConfigurationString ( project , "org.springframework.boot:spring-boot-maven-plugin" , "repackage" , "classifier" ) ; } catch ( PluginScenarioExceptio...
Read the value of the classifier configuration parameter from the spring - boot - maven - plugin
113
19
41,282
public static File getSpringBootUberJAR ( MavenProject project , Log log ) { File fatArchive = getSpringBootUberJARLocation ( project , log ) ; if ( net . wasdev . wlp . common . plugins . util . SpringBootUtil . isSpringBootUberJar ( fatArchive ) ) { log . info ( "Found Spring Boot Uber JAR: " + fatArchive . getAbsolu...
Get the Spring Boot Uber JAR in its expected location validating the JAR contents and handling spring - boot - maven - plugin classifier configuration as well . If the JAR was not found in its expected location then return null .
137
48
41,283
public static File getSpringBootUberJARLocation ( MavenProject project , Log log ) { String classifier = getSpringBootMavenPluginClassifier ( project , log ) ; if ( classifier == null ) { classifier = "" ; } if ( ! classifier . isEmpty ( ) && ! classifier . startsWith ( "-" ) ) { classifier = "-" + classifier ; } retur...
Get the Spring Boot Uber JAR in its expected location taking into account the spring - boot - maven - plugin classifier configuration as well . No validation is done that is there is no guarantee the JAR file actually exists at the returned location .
143
50
41,284
protected void installServerAssembly ( ) throws Exception { if ( installType == InstallType . ALREADY_EXISTS ) { log . info ( MessageFormat . format ( messages . getString ( "info.install.type.preexisting" ) , "" ) ) ; } else { if ( installType == InstallType . FROM_ARCHIVE ) { installFromArchive ( ) ; } else { install...
Performs assembly installation unless the install type is pre - existing .
100
13
41,285
protected String stripVersionFromName ( String name , String version ) { int versionBeginIndex = name . lastIndexOf ( "-" + version ) ; if ( versionBeginIndex != - 1 ) { return name . substring ( 0 , versionBeginIndex ) + name . substring ( versionBeginIndex + version . length ( ) + 1 ) ; } else { return name ; } }
Strip version string from name
80
6
41,286
private String getWlpOutputDir ( ) throws IOException { Properties envvars = new Properties ( ) ; File serverEnvFile = new File ( installDirectory , "etc/server.env" ) ; if ( serverEnvFile . exists ( ) ) { envvars . load ( new FileInputStream ( serverEnvFile ) ) ; } serverEnvFile = new File ( configDirectory , "server....
exist or variable is not in server . env
182
9
41,287
@ Override protected Artifact createArtifact ( final ArtifactItem item ) throws MojoExecutionException { assert item != null ; if ( item . getVersion ( ) == null ) { throw new MojoExecutionException ( "Unable to find artifact without version specified: " + item . getGroupId ( ) + ":" + item . getArtifactId ( ) + ":" + ...
Create a new artifact .
250
5
41,288
public void addFeature ( String feature ) { if ( feature == null ) { throw new IllegalArgumentException ( "Invalid null argument passed for addFeature" ) ; } feature = feature . trim ( ) ; if ( ! feature . isEmpty ( ) ) { Feature newFeature = new Feature ( ) ; newFeature . addText ( feature ) ; featureList . add ( newF...
Add a feature into a list .
83
7
41,289
public static String getPluginConfiguration ( MavenProject proj , String pluginGroupId , String pluginArtifactId , String key ) { Xpp3Dom dom = proj . getGoalConfiguration ( pluginGroupId , pluginArtifactId , null , null ) ; if ( dom != null ) { Xpp3Dom val = dom . getChild ( key ) ; if ( val != null ) { return val . g...
Get a configuration value from a plugin
97
7
41,290
public static String getPluginGoalConfigurationString ( MavenProject project , String pluginKey , String goal , String configName ) throws PluginScenarioException { PluginExecution execution = getPluginGoalExecution ( project , pluginKey , goal ) ; final Xpp3Dom config = ( Xpp3Dom ) execution . getConfiguration ( ) ; i...
Get a configuration value from a goal from a plugin
156
10
41,291
public static File getManifestFile ( MavenProject proj , String pluginArtifactId ) { Xpp3Dom dom = proj . getGoalConfiguration ( "org.apache.maven.plugins" , pluginArtifactId , null , null ) ; if ( dom != null ) { Xpp3Dom archive = dom . getChild ( "archive" ) ; if ( archive != null ) { Xpp3Dom val = archive . getChild...
Get manifest file from plugin configuration
148
6
41,292
protected void installLooseConfigWar ( MavenProject proj , LooseConfigData config ) throws Exception { // return error if webapp contains java source but it is not compiled yet. File dir = new File ( proj . getBuild ( ) . getOutputDirectory ( ) ) ; if ( ! dir . exists ( ) && containsJavaSource ( proj ) ) { throw new Mo...
install war project artifact using loose application configuration file
277
9
41,293
protected void installLooseConfigEar ( MavenProject proj , LooseConfigData config ) throws Exception { LooseEarApplication looseEar = new LooseEarApplication ( proj , config ) ; looseEar . addSourceDir ( ) ; looseEar . addApplicationXmlFile ( ) ; Set < Artifact > artifacts = proj . getArtifacts ( ) ; log . debug ( "Num...
install ear project artifact using loose application configuration file
587
9
41,294
private String getAppFileName ( MavenProject project ) { String name = project . getBuild ( ) . getFinalName ( ) + "." + project . getPackaging ( ) ; if ( project . getPackaging ( ) . equals ( "liberty-assembly" ) ) { name = project . getBuild ( ) . getFinalName ( ) + ".war" ; } if ( stripVersion ) { name = stripVersio...
get loose application configuration file name for project artifact
109
9
41,295
protected void invokeSpringBootUtilCommand ( File installDirectory , String fatArchiveSrcLocation , String thinArchiveTargetLocation , String libIndexCacheTargetLocation ) throws Exception { SpringBootUtilTask springBootUtilTask = ( SpringBootUtilTask ) ant . createTask ( "antlib:net/wasdev/wlp/ant:springBootUtil" ) ; ...
Executes the SpringBootUtilTask to thin the Spring Boot application executable archive and place the thin archive and lib . index . cache in the specified location .
284
32
41,296
public void onCreate ( Activity activity , Bundle savedInstanceState ) { this . activity = activity ; container = ( ScreenContainer ) activity . findViewById ( R . id . magellan_container ) ; checkState ( container != null , "There must be a ScreenContainer whose id is R.id.magellan_container in the view hierarchy" ) ;...
Initializes the Navigator with Activity instance and Bundle for saved instance state .
113
15
41,297
public void onSaveInstanceState ( Bundle outState ) { for ( Screen screen : backStack ) { screen . save ( outState ) ; screen . onSave ( outState ) ; } }
Notifies all screens to save instance state in input Bundle .
40
12
41,298
public void resetWithRoot ( Activity activity , final Screen root ) { checkOnCreateNotYetCalled ( activity , "resetWithRoot() must be called before onCreate()" ) ; backStack . clear ( ) ; backStack . push ( root ) ; }
Clears the back stack of this Navigator and adds the input Screen as the new root of the back stack .
55
23
41,299
public void goBackToRoot ( NavigationType navigationType ) { navigate ( new HistoryRewriter ( ) { @ Override public void rewriteHistory ( Deque < Screen > history ) { while ( history . size ( ) > 1 ) { history . pop ( ) ; } } } , navigationType , BACKWARD ) ; }
Navigates from current screen all the way to the root screen in this Navigator s back stack removing all intermediate screen in this Navigator s back stack along the way . The current screen animates out of the view according to the animation specified by the NavigationType parameter .
67
55