repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
molgenis/molgenis
molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java
MappingServiceController.deleteMappingProject
@PostMapping("/removeMappingProject") public String deleteMappingProject(@RequestParam() String mappingProjectId) { MappingProject project = mappingService.getMappingProject(mappingProjectId); LOG.info("Deleting mappingProject {}", project.getName()); mappingService.deleteMappingProject(mappingProjectId);...
java
@PostMapping("/removeMappingProject") public String deleteMappingProject(@RequestParam() String mappingProjectId) { MappingProject project = mappingService.getMappingProject(mappingProjectId); LOG.info("Deleting mappingProject {}", project.getName()); mappingService.deleteMappingProject(mappingProjectId);...
[ "@", "PostMapping", "(", "\"/removeMappingProject\"", ")", "public", "String", "deleteMappingProject", "(", "@", "RequestParam", "(", ")", "String", "mappingProjectId", ")", "{", "MappingProject", "project", "=", "mappingService", ".", "getMappingProject", "(", "mappi...
Removes a mapping project @param mappingProjectId the ID of the mapping project @return redirect url to the same page to force a refresh
[ "Removes", "a", "mapping", "project" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java#L190-L196
train
molgenis/molgenis
molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java
MappingServiceController.removeAttributeMapping
@PostMapping("/removeAttributeMapping") public String removeAttributeMapping( @RequestParam() String mappingProjectId, @RequestParam() String target, @RequestParam() String source, @RequestParam() String attribute) { MappingProject project = mappingService.getMappingProject(mappingProjectI...
java
@PostMapping("/removeAttributeMapping") public String removeAttributeMapping( @RequestParam() String mappingProjectId, @RequestParam() String target, @RequestParam() String source, @RequestParam() String attribute) { MappingProject project = mappingService.getMappingProject(mappingProjectI...
[ "@", "PostMapping", "(", "\"/removeAttributeMapping\"", ")", "public", "String", "removeAttributeMapping", "(", "@", "RequestParam", "(", ")", "String", "mappingProjectId", ",", "@", "RequestParam", "(", ")", "String", "target", ",", "@", "RequestParam", "(", ")",...
Removes a attribute mapping @param mappingProjectId the ID of the mapping project @param target the target entity @param source the source entity @param attribute the attribute that is mapped
[ "Removes", "a", "attribute", "mapping" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java#L206-L216
train
molgenis/molgenis
molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java
MappingServiceController.viewMappingProject
@GetMapping("/mappingproject/{id}") public String viewMappingProject(@PathVariable("id") String identifier, Model model) { MappingProject project = mappingService.getMappingProject(identifier); MappingTarget mappingTarget = project.getMappingTargets().get(0); String target = mappingTarget.getName(); m...
java
@GetMapping("/mappingproject/{id}") public String viewMappingProject(@PathVariable("id") String identifier, Model model) { MappingProject project = mappingService.getMappingProject(identifier); MappingTarget mappingTarget = project.getMappingTargets().get(0); String target = mappingTarget.getName(); m...
[ "@", "GetMapping", "(", "\"/mappingproject/{id}\"", ")", "public", "String", "viewMappingProject", "(", "@", "PathVariable", "(", "\"id\"", ")", "String", "identifier", ",", "Model", "model", ")", "{", "MappingProject", "project", "=", "mappingService", ".", "getM...
Displays a mapping project. @param identifier identifier of the {@link MappingProject} @param model the model @return View name for a single mapping project
[ "Displays", "a", "mapping", "project", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java#L427-L448
train
molgenis/molgenis
molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java
MappingServiceController.autoGenerateAlgorithms
void autoGenerateAlgorithms( EntityMapping mapping, EntityType sourceEntityType, EntityType targetEntityType, MappingProject project) { algorithmService.autoGenerateAlgorithm(sourceEntityType, targetEntityType, mapping); mappingService.updateMappingProject(project); }
java
void autoGenerateAlgorithms( EntityMapping mapping, EntityType sourceEntityType, EntityType targetEntityType, MappingProject project) { algorithmService.autoGenerateAlgorithm(sourceEntityType, targetEntityType, mapping); mappingService.updateMappingProject(project); }
[ "void", "autoGenerateAlgorithms", "(", "EntityMapping", "mapping", ",", "EntityType", "sourceEntityType", ",", "EntityType", "targetEntityType", ",", "MappingProject", "project", ")", "{", "algorithmService", ".", "autoGenerateAlgorithm", "(", "sourceEntityType", ",", "ta...
Generate algorithms based on semantic matches between attribute tags and descriptions <p>package-private for testablity
[ "Generate", "algorithms", "based", "on", "semantic", "matches", "between", "attribute", "tags", "and", "descriptions" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java#L1009-L1016
train
molgenis/molgenis
molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java
MappingServiceController.getNewSources
private List<EntityType> getNewSources(MappingTarget target) { return dataService .getEntityTypeIds() .filter(name -> isValidSource(target, name)) .map(dataService::getEntityType) .collect(toList()); }
java
private List<EntityType> getNewSources(MappingTarget target) { return dataService .getEntityTypeIds() .filter(name -> isValidSource(target, name)) .map(dataService::getEntityType) .collect(toList()); }
[ "private", "List", "<", "EntityType", ">", "getNewSources", "(", "MappingTarget", "target", ")", "{", "return", "dataService", ".", "getEntityTypeIds", "(", ")", ".", "filter", "(", "name", "->", "isValidSource", "(", "target", ",", "name", ")", ")", ".", ...
Lists the entities that may be added as new sources to this mapping project's selected target @param target the selected target
[ "Lists", "the", "entities", "that", "may", "be", "added", "as", "new", "sources", "to", "this", "mapping", "project", "s", "selected", "target" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java#L1023-L1029
train
molgenis/molgenis
molgenis-swagger/src/main/java/org/molgenis/swagger/controller/SwaggerController.java
SwaggerController.init
@GetMapping public String init(Model model) { final UriComponents uriComponents = ServletUriComponentsBuilder.fromCurrentContextPath().build(); model.addAttribute("molgenisUrl", uriComponents.toUriString() + URI + "/swagger.yml"); model.addAttribute("baseUrl", uriComponents.toUriString()); f...
java
@GetMapping public String init(Model model) { final UriComponents uriComponents = ServletUriComponentsBuilder.fromCurrentContextPath().build(); model.addAttribute("molgenisUrl", uriComponents.toUriString() + URI + "/swagger.yml"); model.addAttribute("baseUrl", uriComponents.toUriString()); f...
[ "@", "GetMapping", "public", "String", "init", "(", "Model", "model", ")", "{", "final", "UriComponents", "uriComponents", "=", "ServletUriComponentsBuilder", ".", "fromCurrentContextPath", "(", ")", ".", "build", "(", ")", ";", "model", ".", "addAttribute", "("...
Serves the Swagger UI which allows you to try out the documented endpoints. Sets the url parameter to the swagger yaml that describes the REST API. Creates an apiKey token for the current user.
[ "Serves", "the", "Swagger", "UI", "which", "allows", "you", "to", "try", "out", "the", "documented", "endpoints", ".", "Sets", "the", "url", "parameter", "to", "the", "swagger", "yaml", "that", "describes", "the", "REST", "API", ".", "Creates", "an", "apiK...
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-swagger/src/main/java/org/molgenis/swagger/controller/SwaggerController.java#L47-L61
train
molgenis/molgenis
molgenis-swagger/src/main/java/org/molgenis/swagger/controller/SwaggerController.java
SwaggerController.swagger
@GetMapping(value = "/swagger.yml", produces = "text/yaml") public String swagger(Model model, HttpServletResponse response) { response.setContentType("text/yaml"); response.setCharacterEncoding("UTF-8"); final UriComponents uriComponents = ServletUriComponentsBuilder.fromCurrentContextPath().buil...
java
@GetMapping(value = "/swagger.yml", produces = "text/yaml") public String swagger(Model model, HttpServletResponse response) { response.setContentType("text/yaml"); response.setCharacterEncoding("UTF-8"); final UriComponents uriComponents = ServletUriComponentsBuilder.fromCurrentContextPath().buil...
[ "@", "GetMapping", "(", "value", "=", "\"/swagger.yml\"", ",", "produces", "=", "\"text/yaml\"", ")", "public", "String", "swagger", "(", "Model", "model", ",", "HttpServletResponse", "response", ")", "{", "response", ".", "setContentType", "(", "\"text/yaml\"", ...
Serves the Swagger description of the REST API. As host, fills in the host where the controller lives. As options for the entity names, contains only those entity names that the user can actually see.
[ "Serves", "the", "Swagger", "description", "of", "the", "REST", "API", ".", "As", "host", "fills", "in", "the", "host", "where", "the", "controller", "lives", ".", "As", "options", "for", "the", "entity", "names", "contains", "only", "those", "entity", "na...
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-swagger/src/main/java/org/molgenis/swagger/controller/SwaggerController.java#L68-L91
train
molgenis/molgenis
molgenis-i18n/src/main/java/org/molgenis/i18n/I18nUtils.java
I18nUtils.getLanguageCode
public static String getLanguageCode(String name) { if (!isI18n(name)) return null; return name.substring(name.indexOf('-') + 1, name.length()); }
java
public static String getLanguageCode(String name) { if (!isI18n(name)) return null; return name.substring(name.indexOf('-') + 1, name.length()); }
[ "public", "static", "String", "getLanguageCode", "(", "String", "name", ")", "{", "if", "(", "!", "isI18n", "(", "name", ")", ")", "return", "null", ";", "return", "name", ".", "substring", "(", "name", ".", "indexOf", "(", "'", "'", ")", "+", "1", ...
Get the language code of a new with language suffix. <p>Returns null if not suffixed with language code
[ "Get", "the", "language", "code", "of", "a", "new", "with", "language", "suffix", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-i18n/src/main/java/org/molgenis/i18n/I18nUtils.java#L16-L19
train
molgenis/molgenis
molgenis-python/src/main/java/org/molgenis/python/PythonScriptExecutor.java
PythonScriptExecutor.executeScript
public void executeScript(String pythonScript, PythonOutputHandler outputHandler) { // Check if Python is installed File file = new File(pythonScriptExecutable); if (!file.exists()) { throw new MolgenisPythonException("File [" + pythonScriptExecutable + "] does not exist"); } // Check if Pyth...
java
public void executeScript(String pythonScript, PythonOutputHandler outputHandler) { // Check if Python is installed File file = new File(pythonScriptExecutable); if (!file.exists()) { throw new MolgenisPythonException("File [" + pythonScriptExecutable + "] does not exist"); } // Check if Pyth...
[ "public", "void", "executeScript", "(", "String", "pythonScript", ",", "PythonOutputHandler", "outputHandler", ")", "{", "// Check if Python is installed", "File", "file", "=", "new", "File", "(", "pythonScriptExecutable", ")", ";", "if", "(", "!", "file", ".", "e...
Execute a python script and wait for it to finish
[ "Execute", "a", "python", "script", "and", "wait", "for", "it", "to", "finish" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-python/src/main/java/org/molgenis/python/PythonScriptExecutor.java#L33-L95
train
molgenis/molgenis
molgenis-api-data/src/main/java/org/molgenis/api/data/RestService.java
RestService.toEntity
public Entity toEntity(final EntityType meta, final Map<String, Object> request) { final Entity entity = entityManager.create(meta, POPULATE); for (Attribute attr : meta.getAtomicAttributes()) { if (attr.getExpression() == null) { String paramName = attr.getName(); if (request.containsKey...
java
public Entity toEntity(final EntityType meta, final Map<String, Object> request) { final Entity entity = entityManager.create(meta, POPULATE); for (Attribute attr : meta.getAtomicAttributes()) { if (attr.getExpression() == null) { String paramName = attr.getName(); if (request.containsKey...
[ "public", "Entity", "toEntity", "(", "final", "EntityType", "meta", ",", "final", "Map", "<", "String", ",", "Object", ">", "request", ")", "{", "final", "Entity", "entity", "=", "entityManager", ".", "create", "(", "meta", ",", "POPULATE", ")", ";", "fo...
Creates a new entity based from a HttpServletRequest. For file attributes persists the file in the file store and persist a file meta data entity. @param meta entity meta data @param request HTTP request parameters @return entity created from HTTP request parameters
[ "Creates", "a", "new", "entity", "based", "from", "a", "HttpServletRequest", ".", "For", "file", "attributes", "persists", "the", "file", "in", "the", "file", "store", "and", "persist", "a", "file", "meta", "data", "entity", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/RestService.java#L85-L102
train
molgenis/molgenis
molgenis-api-data/src/main/java/org/molgenis/api/data/RestService.java
RestService.toEntityValue
public Object toEntityValue(Attribute attr, Object paramValue, Object id) { // Treat empty strings as null if ((paramValue instanceof String) && ((String) paramValue).isEmpty()) { paramValue = null; } Object value; AttributeType attrType = attr.getDataType(); switch (attrType) { cas...
java
public Object toEntityValue(Attribute attr, Object paramValue, Object id) { // Treat empty strings as null if ((paramValue instanceof String) && ((String) paramValue).isEmpty()) { paramValue = null; } Object value; AttributeType attrType = attr.getDataType(); switch (attrType) { cas...
[ "public", "Object", "toEntityValue", "(", "Attribute", "attr", ",", "Object", "paramValue", ",", "Object", "id", ")", "{", "// Treat empty strings as null", "if", "(", "(", "paramValue", "instanceof", "String", ")", "&&", "(", "(", "String", ")", "paramValue", ...
Converts a HTTP request parameter to a entity value of which the type is defined by the attribute. For file attributes persists the file in the file store and persist a file meta data entity. @param attr attribute @param paramValue HTTP parameter value @return Object
[ "Converts", "a", "HTTP", "request", "parameter", "to", "a", "entity", "value", "of", "which", "the", "type", "is", "defined", "by", "the", "attribute", ".", "For", "file", "attributes", "persists", "the", "file", "in", "the", "file", "store", "and", "persi...
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/RestService.java#L113-L167
train
molgenis/molgenis
molgenis-validation/src/main/java/org/molgenis/validation/JsonValidator.java
JsonValidator.loadSchema
public Schema loadSchema(String schema) { try { JSONObject rawSchema = new JSONObject(new JSONTokener(schema)); return SchemaLoader.load(rawSchema); } catch (JSONException | SchemaException e) { throw new InvalidJsonSchemaException(e); } }
java
public Schema loadSchema(String schema) { try { JSONObject rawSchema = new JSONObject(new JSONTokener(schema)); return SchemaLoader.load(rawSchema); } catch (JSONException | SchemaException e) { throw new InvalidJsonSchemaException(e); } }
[ "public", "Schema", "loadSchema", "(", "String", "schema", ")", "{", "try", "{", "JSONObject", "rawSchema", "=", "new", "JSONObject", "(", "new", "JSONTokener", "(", "schema", ")", ")", ";", "return", "SchemaLoader", ".", "load", "(", "rawSchema", ")", ";"...
Loads JSON schema. The schema may contain remote references. @param schema String containing the JSON schema to load @return loaded {@link Schema} @throws InvalidJsonSchemaException if the schema fails to load
[ "Loads", "JSON", "schema", ".", "The", "schema", "may", "contain", "remote", "references", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-validation/src/main/java/org/molgenis/validation/JsonValidator.java#L23-L30
train
molgenis/molgenis
molgenis-validation/src/main/java/org/molgenis/validation/JsonValidator.java
JsonValidator.validate
public void validate(String json, String schemaJson) { Schema schema = loadSchema(schemaJson); validate(json, schema); }
java
public void validate(String json, String schemaJson) { Schema schema = loadSchema(schemaJson); validate(json, schema); }
[ "public", "void", "validate", "(", "String", "json", ",", "String", "schemaJson", ")", "{", "Schema", "schema", "=", "loadSchema", "(", "schemaJson", ")", ";", "validate", "(", "json", ",", "schema", ")", ";", "}" ]
Validates that a JSON string conforms to a JSON schema. @param json the JSON string to check @param schemaJson the JSON string for the schema @throws InvalidJsonSchemaException if the JSON schema cannot be loaded @throws JsonValidationException if the JSON string doesn't conform to the schema
[ "Validates", "that", "a", "JSON", "string", "conforms", "to", "a", "JSON", "schema", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-validation/src/main/java/org/molgenis/validation/JsonValidator.java#L61-L64
train
molgenis/molgenis
molgenis-data-elasticsearch/src/main/java/org/molgenis/data/elasticsearch/generator/QueryGenerator.java
QueryGenerator.nestedQueryBuilder
private QueryBuilder nestedQueryBuilder( List<Attribute> attributePath, QueryBuilder queryBuilder) { if (attributePath.size() == 1) { return queryBuilder; } else if (attributePath.size() == 2) { return QueryBuilders.nestedQuery( getQueryFieldName(attributePath.get(0)), queryBuilder, ...
java
private QueryBuilder nestedQueryBuilder( List<Attribute> attributePath, QueryBuilder queryBuilder) { if (attributePath.size() == 1) { return queryBuilder; } else if (attributePath.size() == 2) { return QueryBuilders.nestedQuery( getQueryFieldName(attributePath.get(0)), queryBuilder, ...
[ "private", "QueryBuilder", "nestedQueryBuilder", "(", "List", "<", "Attribute", ">", "attributePath", ",", "QueryBuilder", "queryBuilder", ")", "{", "if", "(", "attributePath", ".", "size", "(", ")", "==", "1", ")", "{", "return", "queryBuilder", ";", "}", "...
Wraps the query in a nested query when a query is done on a reference entity. Returns the original query when it is applied to the current entity.
[ "Wraps", "the", "query", "in", "a", "nested", "query", "when", "a", "query", "is", "done", "on", "a", "reference", "entity", ".", "Returns", "the", "original", "query", "when", "it", "is", "applied", "to", "the", "current", "entity", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-elasticsearch/src/main/java/org/molgenis/data/elasticsearch/generator/QueryGenerator.java#L757-L767
train
molgenis/molgenis
molgenis-ontology/src/main/java/org/molgenis/ontology/sorta/controller/Href.java
Href.concatAttributeHref
public static String concatAttributeHref( String baseUri, String qualifiedEntityName, Object entityIdValue, String attributeName) { return String.format( "%s/%s/%s/%s", baseUri, encodePathSegment(qualifiedEntityName), encodePathSegment(DataConverter.toString(entityIdValue)), ...
java
public static String concatAttributeHref( String baseUri, String qualifiedEntityName, Object entityIdValue, String attributeName) { return String.format( "%s/%s/%s/%s", baseUri, encodePathSegment(qualifiedEntityName), encodePathSegment(DataConverter.toString(entityIdValue)), ...
[ "public", "static", "String", "concatAttributeHref", "(", "String", "baseUri", ",", "String", "qualifiedEntityName", ",", "Object", "entityIdValue", ",", "String", "attributeName", ")", "{", "return", "String", ".", "format", "(", "\"%s/%s/%s/%s\"", ",", "baseUri", ...
Create an encoded href for an attribute
[ "Create", "an", "encoded", "href", "for", "an", "attribute" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-ontology/src/main/java/org/molgenis/ontology/sorta/controller/Href.java#L29-L37
train
molgenis/molgenis
molgenis-ontology/src/main/java/org/molgenis/ontology/sorta/controller/Href.java
Href.concatMetaAttributeHref
public static String concatMetaAttributeHref( String baseUri, String entityParentName, String attributeName) { return String.format( "%s/%s/meta/%s", baseUri, encodePathSegment(entityParentName), encodePathSegment(attributeName)); }
java
public static String concatMetaAttributeHref( String baseUri, String entityParentName, String attributeName) { return String.format( "%s/%s/meta/%s", baseUri, encodePathSegment(entityParentName), encodePathSegment(attributeName)); }
[ "public", "static", "String", "concatMetaAttributeHref", "(", "String", "baseUri", ",", "String", "entityParentName", ",", "String", "attributeName", ")", "{", "return", "String", ".", "format", "(", "\"%s/%s/meta/%s\"", ",", "baseUri", ",", "encodePathSegment", "("...
Create an encoded href for an attribute meta
[ "Create", "an", "encoded", "href", "for", "an", "attribute", "meta" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-ontology/src/main/java/org/molgenis/ontology/sorta/controller/Href.java#L40-L45
train
molgenis/molgenis
molgenis-ontology/src/main/java/org/molgenis/ontology/sorta/controller/Href.java
Href.concatEntityHref
public static String concatEntityHref( String baseUri, String qualifiedEntityName, Object entityIdValue) { if (null == qualifiedEntityName) { qualifiedEntityName = ""; } return String.format( "%s/%s/%s", baseUri, encodePathSegment(qualifiedEntityName), encodePath...
java
public static String concatEntityHref( String baseUri, String qualifiedEntityName, Object entityIdValue) { if (null == qualifiedEntityName) { qualifiedEntityName = ""; } return String.format( "%s/%s/%s", baseUri, encodePathSegment(qualifiedEntityName), encodePath...
[ "public", "static", "String", "concatEntityHref", "(", "String", "baseUri", ",", "String", "qualifiedEntityName", ",", "Object", "entityIdValue", ")", "{", "if", "(", "null", "==", "qualifiedEntityName", ")", "{", "qualifiedEntityName", "=", "\"\"", ";", "}", "r...
Create an encoded href for an entity
[ "Create", "an", "encoded", "href", "for", "an", "entity" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-ontology/src/main/java/org/molgenis/ontology/sorta/controller/Href.java#L52-L63
train
molgenis/molgenis
molgenis-ontology/src/main/java/org/molgenis/ontology/sorta/controller/Href.java
Href.concatMetaEntityHref
public static String concatMetaEntityHref(String baseUri, String qualifiedEntityName) { return String.format("%s/%s/meta", baseUri, encodePathSegment(qualifiedEntityName)); }
java
public static String concatMetaEntityHref(String baseUri, String qualifiedEntityName) { return String.format("%s/%s/meta", baseUri, encodePathSegment(qualifiedEntityName)); }
[ "public", "static", "String", "concatMetaEntityHref", "(", "String", "baseUri", ",", "String", "qualifiedEntityName", ")", "{", "return", "String", ".", "format", "(", "\"%s/%s/meta\"", ",", "baseUri", ",", "encodePathSegment", "(", "qualifiedEntityName", ")", ")", ...
Create an encoded href for an entity meta
[ "Create", "an", "encoded", "href", "for", "an", "entity", "meta" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-ontology/src/main/java/org/molgenis/ontology/sorta/controller/Href.java#L66-L68
train
molgenis/molgenis
molgenis-ontology/src/main/java/org/molgenis/ontology/sorta/controller/Href.java
Href.concatEntityCollectionHref
public static String concatEntityCollectionHref( String baseUri, String qualifiedEntityName, String qualifiedIdAttributeName, List<String> entitiesIds) { String ids; ids = entitiesIds.stream().map(Href::encodeIdToRSQL).collect(Collectors.joining(",")); return String.format( "...
java
public static String concatEntityCollectionHref( String baseUri, String qualifiedEntityName, String qualifiedIdAttributeName, List<String> entitiesIds) { String ids; ids = entitiesIds.stream().map(Href::encodeIdToRSQL).collect(Collectors.joining(",")); return String.format( "...
[ "public", "static", "String", "concatEntityCollectionHref", "(", "String", "baseUri", ",", "String", "qualifiedEntityName", ",", "String", "qualifiedIdAttributeName", ",", "List", "<", "String", ">", "entitiesIds", ")", "{", "String", "ids", ";", "ids", "=", "enti...
Create an encoded href for an entity collection
[ "Create", "an", "encoded", "href", "for", "an", "entity", "collection" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-ontology/src/main/java/org/molgenis/ontology/sorta/controller/Href.java#L75-L88
train
molgenis/molgenis
molgenis-data-import/src/main/java/org/molgenis/data/export/EmxExportServiceImpl.java
EmxExportServiceImpl.export
@Override @Transactional(readOnly = true, isolation = Isolation.SERIALIZABLE) public void export( List<EntityType> entityTypes, List<Package> packages, Path downloadFilePath, Progress progress) { requireNonNull(progress); if (!(entityTypes.isEmpty() && packages.isEmpty())) { tr...
java
@Override @Transactional(readOnly = true, isolation = Isolation.SERIALIZABLE) public void export( List<EntityType> entityTypes, List<Package> packages, Path downloadFilePath, Progress progress) { requireNonNull(progress); if (!(entityTypes.isEmpty() && packages.isEmpty())) { tr...
[ "@", "Override", "@", "Transactional", "(", "readOnly", "=", "true", ",", "isolation", "=", "Isolation", ".", "SERIALIZABLE", ")", "public", "void", "export", "(", "List", "<", "EntityType", ">", "entityTypes", ",", "List", "<", "Package", ">", "packages", ...
Isolation level needs to be 'SERIALIZABLE' in case IndexActions are being downloaded. The entities have their own transaction and can change during the download when executed with a default isolation level. @param entityTypes entityTypes to be exported to EMX. @param packages packages to be exported to EMX. @param dow...
[ "Isolation", "level", "needs", "to", "be", "SERIALIZABLE", "in", "case", "IndexActions", "are", "being", "downloaded", ".", "The", "entities", "have", "their", "own", "transaction", "and", "can", "change", "during", "the", "download", "when", "executed", "with",...
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/export/EmxExportServiceImpl.java#L73-L93
train
molgenis/molgenis
molgenis-data-import/src/main/java/org/molgenis/data/export/EmxExportServiceImpl.java
EmxExportServiceImpl.writeEntityTypes
void writeEntityTypes(Collection<EntityType> entityTypes, XlsxWriter writer) { LinkedList<EntityType> sortedEntityTypes = sortEntityTypesAbstractFirst(entityTypes); if (!writer.hasSheet(EMX_ENTITIES)) { writer.createSheet(EMX_ENTITIES, newArrayList(ENTITIES_ATTRS.keySet())); } writer.writeRows(sor...
java
void writeEntityTypes(Collection<EntityType> entityTypes, XlsxWriter writer) { LinkedList<EntityType> sortedEntityTypes = sortEntityTypesAbstractFirst(entityTypes); if (!writer.hasSheet(EMX_ENTITIES)) { writer.createSheet(EMX_ENTITIES, newArrayList(ENTITIES_ATTRS.keySet())); } writer.writeRows(sor...
[ "void", "writeEntityTypes", "(", "Collection", "<", "EntityType", ">", "entityTypes", ",", "XlsxWriter", "writer", ")", "{", "LinkedList", "<", "EntityType", ">", "sortedEntityTypes", "=", "sortEntityTypesAbstractFirst", "(", "entityTypes", ")", ";", "if", "(", "!...
package private for test
[ "package", "private", "for", "test" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/export/EmxExportServiceImpl.java#L189-L195
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/QueryUtils.java
QueryUtils.getQueryRuleAttribute
public static Attribute getQueryRuleAttribute(QueryRule queryRule, EntityType entityType) { String queryRuleField = queryRule.getField(); if (queryRuleField == null) { return null; } Attribute attr = null; String[] queryRuleFieldTokens = StringUtils.split(queryRuleField, NESTED_ATTRIBUTE_SEPA...
java
public static Attribute getQueryRuleAttribute(QueryRule queryRule, EntityType entityType) { String queryRuleField = queryRule.getField(); if (queryRuleField == null) { return null; } Attribute attr = null; String[] queryRuleFieldTokens = StringUtils.split(queryRuleField, NESTED_ATTRIBUTE_SEPA...
[ "public", "static", "Attribute", "getQueryRuleAttribute", "(", "QueryRule", "queryRule", ",", "EntityType", "entityType", ")", "{", "String", "queryRuleField", "=", "queryRule", ".", "getField", "(", ")", ";", "if", "(", "queryRuleField", "==", "null", ")", "{",...
Returns the attribute for a query rule field. @param queryRule query rule @param entityType entity type @return an attribute or {@code null} if the query rule field is {@code null} @throws UnknownAttributeException if the query rule field does not refer to an attribute
[ "Returns", "the", "attribute", "for", "a", "query", "rule", "field", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/QueryUtils.java#L102-L122
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/meta/EntityTypeDependencyResolver.java
EntityTypeDependencyResolver.getDependencies
private static Function<EntityTypeNode, Set<EntityTypeNode>> getDependencies() { return entityTypeNode -> { // get referenced entities excluding entities of mappedBy attributes EntityType entityType = entityTypeNode.getEntityType(); Set<EntityTypeNode> refEntityMetaSet = stream(entityTyp...
java
private static Function<EntityTypeNode, Set<EntityTypeNode>> getDependencies() { return entityTypeNode -> { // get referenced entities excluding entities of mappedBy attributes EntityType entityType = entityTypeNode.getEntityType(); Set<EntityTypeNode> refEntityMetaSet = stream(entityTyp...
[ "private", "static", "Function", "<", "EntityTypeNode", ",", "Set", "<", "EntityTypeNode", ">", ">", "getDependencies", "(", ")", "{", "return", "entityTypeNode", "->", "{", "// get referenced entities excluding entities of mappedBy attributes", "EntityType", "entityType", ...
Returns dependencies of the given entity meta data. @return dependencies of the entity meta data node
[ "Returns", "dependencies", "of", "the", "given", "entity", "meta", "data", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/EntityTypeDependencyResolver.java#L86-L102
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/meta/EntityTypeDependencyResolver.java
EntityTypeDependencyResolver.expandEntityTypeDependencies
private static Set<EntityTypeNode> expandEntityTypeDependencies(EntityTypeNode entityTypeNode) { if (LOG.isTraceEnabled()) { LOG.trace( "expandEntityTypeDependencies(EntityTypeNode entityTypeNode) --- entity: [{}], skip: [{}]", entityTypeNode.getEntityType().getId(), entityTypeNo...
java
private static Set<EntityTypeNode> expandEntityTypeDependencies(EntityTypeNode entityTypeNode) { if (LOG.isTraceEnabled()) { LOG.trace( "expandEntityTypeDependencies(EntityTypeNode entityTypeNode) --- entity: [{}], skip: [{}]", entityTypeNode.getEntityType().getId(), entityTypeNo...
[ "private", "static", "Set", "<", "EntityTypeNode", ">", "expandEntityTypeDependencies", "(", "EntityTypeNode", "entityTypeNode", ")", "{", "if", "(", "LOG", ".", "isTraceEnabled", "(", ")", ")", "{", "LOG", ".", "trace", "(", "\"expandEntityTypeDependencies(EntityTy...
Returns whole tree dependencies of the given entity meta data. @param entityTypeNode entity meta data node @return dependencies of the entity meta data node
[ "Returns", "whole", "tree", "dependencies", "of", "the", "given", "entity", "meta", "data", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/EntityTypeDependencyResolver.java#L110-L149
train
molgenis/molgenis
molgenis-security/src/main/java/org/molgenis/security/twofactor/auth/TwoFactorAuthenticationFilter.java
TwoFactorAuthenticationFilter.hasAuthenticatedMolgenisToken
private boolean hasAuthenticatedMolgenisToken() { boolean hasAuthenticatedMolgenisToken = false; Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication instanceof RestAuthenticationToken) { hasAuthenticatedMolgenisToken = authentication.isAuthenticat...
java
private boolean hasAuthenticatedMolgenisToken() { boolean hasAuthenticatedMolgenisToken = false; Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication instanceof RestAuthenticationToken) { hasAuthenticatedMolgenisToken = authentication.isAuthenticat...
[ "private", "boolean", "hasAuthenticatedMolgenisToken", "(", ")", "{", "boolean", "hasAuthenticatedMolgenisToken", "=", "false", ";", "Authentication", "authentication", "=", "SecurityContextHolder", ".", "getContext", "(", ")", ".", "getAuthentication", "(", ")", ";", ...
Check on authenticated RestAuthenticationToken @return authenticated {@link RestAuthenticationToken}
[ "Check", "on", "authenticated", "RestAuthenticationToken" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-security/src/main/java/org/molgenis/security/twofactor/auth/TwoFactorAuthenticationFilter.java#L118-L125
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/meta/model/EntityType.java
EntityType.deepCopyAttributes
public static Map<String, Attribute> deepCopyAttributes( EntityType entityType, EntityType entityTypeCopy, AttributeFactory attrFactory) { Map<String, Attribute> copiedAttributes = new LinkedHashMap<>(); // step #1: deep copy attributes Map<String, Attribute> ownAttrMap = stream(entityType.ge...
java
public static Map<String, Attribute> deepCopyAttributes( EntityType entityType, EntityType entityTypeCopy, AttributeFactory attrFactory) { Map<String, Attribute> copiedAttributes = new LinkedHashMap<>(); // step #1: deep copy attributes Map<String, Attribute> ownAttrMap = stream(entityType.ge...
[ "public", "static", "Map", "<", "String", ",", "Attribute", ">", "deepCopyAttributes", "(", "EntityType", "entityType", ",", "EntityType", "entityTypeCopy", ",", "AttributeFactory", "attrFactory", ")", "{", "Map", "<", "String", ",", "Attribute", ">", "copiedAttri...
Deep copy all attributes of an EntityType to its copy. Returns a LinkedMap of the old attribute IDs to the newly copied Attributes. @param entityType original entity meta data @param entityTypeCopy copy of entity meta data @param attrFactory attribute factory used to create new attributes in deep-copy mode @return map...
[ "Deep", "copy", "all", "attributes", "of", "an", "EntityType", "to", "its", "copy", ".", "Returns", "a", "LinkedMap", "of", "the", "old", "attribute", "IDs", "to", "the", "newly", "copied", "Attributes", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/model/EntityType.java#L141-L168
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/meta/model/EntityType.java
EntityType.getLabel
public String getLabel(String languageCode) { String i18nLabel = getString(getI18nAttributeName(LABEL, languageCode)); return i18nLabel != null ? i18nLabel : getLabel(); }
java
public String getLabel(String languageCode) { String i18nLabel = getString(getI18nAttributeName(LABEL, languageCode)); return i18nLabel != null ? i18nLabel : getLabel(); }
[ "public", "String", "getLabel", "(", "String", "languageCode", ")", "{", "String", "i18nLabel", "=", "getString", "(", "getI18nAttributeName", "(", "LABEL", ",", "languageCode", ")", ")", ";", "return", "i18nLabel", "!=", "null", "?", "i18nLabel", ":", "getLab...
Label of the entity in the requested language @return entity label
[ "Label", "of", "the", "entity", "in", "the", "requested", "language" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/model/EntityType.java#L198-L201
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/meta/model/EntityType.java
EntityType.getDescription
@Nullable @CheckForNull public String getDescription(String languageCode) { String i18nDescription = getString(getI18nAttributeName(DESCRIPTION, languageCode)); return i18nDescription != null ? i18nDescription : getDescription(); }
java
@Nullable @CheckForNull public String getDescription(String languageCode) { String i18nDescription = getString(getI18nAttributeName(DESCRIPTION, languageCode)); return i18nDescription != null ? i18nDescription : getDescription(); }
[ "@", "Nullable", "@", "CheckForNull", "public", "String", "getDescription", "(", "String", "languageCode", ")", "{", "String", "i18nDescription", "=", "getString", "(", "getI18nAttributeName", "(", "DESCRIPTION", ",", "languageCode", ")", ")", ";", "return", "i18n...
Description of the entity in the requested language @return entity description
[ "Description", "of", "the", "entity", "in", "the", "requested", "language" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/model/EntityType.java#L229-L234
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/meta/model/EntityType.java
EntityType.getIdAttribute
public Attribute getIdAttribute() { Attribute idAttr = getOwnIdAttribute(); if (idAttr == null) { EntityType extend = getExtends(); if (extend != null) { idAttr = extend.getIdAttribute(); } } return idAttr; }
java
public Attribute getIdAttribute() { Attribute idAttr = getOwnIdAttribute(); if (idAttr == null) { EntityType extend = getExtends(); if (extend != null) { idAttr = extend.getIdAttribute(); } } return idAttr; }
[ "public", "Attribute", "getIdAttribute", "(", ")", "{", "Attribute", "idAttr", "=", "getOwnIdAttribute", "(", ")", ";", "if", "(", "idAttr", "==", "null", ")", "{", "EntityType", "extend", "=", "getExtends", "(", ")", ";", "if", "(", "extend", "!=", "nul...
Attribute that is used as unique Id. Id attribute should always be provided. @return id attribute
[ "Attribute", "that", "is", "used", "as", "unique", "Id", ".", "Id", "attribute", "should", "always", "be", "provided", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/model/EntityType.java#L281-L290
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/meta/model/EntityType.java
EntityType.getLabelAttribute
public Attribute getLabelAttribute() { Attribute labelAttr = getOwnLabelAttribute(); if (labelAttr == null) { EntityType extend = getExtends(); if (extend != null) { labelAttr = extend.getLabelAttribute(); } } return labelAttr; }
java
public Attribute getLabelAttribute() { Attribute labelAttr = getOwnLabelAttribute(); if (labelAttr == null) { EntityType extend = getExtends(); if (extend != null) { labelAttr = extend.getLabelAttribute(); } } return labelAttr; }
[ "public", "Attribute", "getLabelAttribute", "(", ")", "{", "Attribute", "labelAttr", "=", "getOwnLabelAttribute", "(", ")", ";", "if", "(", "labelAttr", "==", "null", ")", "{", "EntityType", "extend", "=", "getExtends", "(", ")", ";", "if", "(", "extend", ...
Attribute that is used as unique label. If no label exist, returns null. @return label attribute
[ "Attribute", "that", "is", "used", "as", "unique", "label", ".", "If", "no", "label", "exist", "returns", "null", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/model/EntityType.java#L312-L321
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/meta/model/EntityType.java
EntityType.getLabelAttribute
public Attribute getLabelAttribute(String langCode) { Attribute labelAttr = getLabelAttribute(); Attribute i18nLabelAttr = labelAttr != null ? getAttribute(labelAttr.getName() + '-' + langCode) : null; return i18nLabelAttr != null ? i18nLabelAttr : labelAttr; }
java
public Attribute getLabelAttribute(String langCode) { Attribute labelAttr = getLabelAttribute(); Attribute i18nLabelAttr = labelAttr != null ? getAttribute(labelAttr.getName() + '-' + langCode) : null; return i18nLabelAttr != null ? i18nLabelAttr : labelAttr; }
[ "public", "Attribute", "getLabelAttribute", "(", "String", "langCode", ")", "{", "Attribute", "labelAttr", "=", "getLabelAttribute", "(", ")", ";", "Attribute", "i18nLabelAttr", "=", "labelAttr", "!=", "null", "?", "getAttribute", "(", "labelAttr", ".", "getName",...
Gets the correct label attribute for the given language, or the default if not found @param langCode language code @return label attribute
[ "Gets", "the", "correct", "label", "attribute", "for", "the", "given", "language", "or", "the", "default", "if", "not", "found" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/model/EntityType.java#L329-L334
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/meta/model/EntityType.java
EntityType.getAttribute
public Attribute getAttribute(String attrName) { Attribute attr = getCachedOwnAttrs().get(attrName); if (attr == null) { // look up attribute in parent entity EntityType extendsEntityType = getExtends(); if (extendsEntityType != null) { attr = extendsEntityType.getAttribute(attrName); ...
java
public Attribute getAttribute(String attrName) { Attribute attr = getCachedOwnAttrs().get(attrName); if (attr == null) { // look up attribute in parent entity EntityType extendsEntityType = getExtends(); if (extendsEntityType != null) { attr = extendsEntityType.getAttribute(attrName); ...
[ "public", "Attribute", "getAttribute", "(", "String", "attrName", ")", "{", "Attribute", "attr", "=", "getCachedOwnAttrs", "(", ")", ".", "get", "(", "attrName", ")", ";", "if", "(", "attr", "==", "null", ")", "{", "// look up attribute in parent entity", "Ent...
Get attribute by name @return attribute or <tt>null</tt>
[ "Get", "attribute", "by", "name" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/model/EntityType.java#L511-L521
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/meta/model/EntityType.java
EntityType.addSequenceNumber
static void addSequenceNumber(Attribute attr, Iterable<Attribute> attrs) { Integer sequenceNumber = attr.getSequenceNumber(); if (null == sequenceNumber) { int i = stream(attrs) .filter(a -> null != a.getSequenceNumber()) .mapToInt(Attribute::getSequenceNumber) ...
java
static void addSequenceNumber(Attribute attr, Iterable<Attribute> attrs) { Integer sequenceNumber = attr.getSequenceNumber(); if (null == sequenceNumber) { int i = stream(attrs) .filter(a -> null != a.getSequenceNumber()) .mapToInt(Attribute::getSequenceNumber) ...
[ "static", "void", "addSequenceNumber", "(", "Attribute", "attr", ",", "Iterable", "<", "Attribute", ">", "attrs", ")", "{", "Integer", "sequenceNumber", "=", "attr", ".", "getSequenceNumber", "(", ")", ";", "if", "(", "null", "==", "sequenceNumber", ")", "{"...
Add a sequence number to the attribute. If the sequence number exists add it ot the attribute. If the sequence number does not exists then find the highest sequence number. If Entity has not attributes with sequence numbers put 0. @param attr the attribute to add @param attrs existing attributes
[ "Add", "a", "sequence", "number", "to", "the", "attribute", ".", "If", "the", "sequence", "number", "exists", "add", "it", "ot", "the", "attribute", ".", "If", "the", "sequence", "number", "does", "not", "exists", "then", "find", "the", "highest", "sequenc...
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/model/EntityType.java#L554-L566
train
molgenis/molgenis
molgenis-data-i18n/src/main/java/org/molgenis/data/i18n/SystemEntityTypeI18nInitializer.java
SystemEntityTypeI18nInitializer.initialize
public void initialize(ContextRefreshedEvent event) { ApplicationContext ctx = event.getApplicationContext(); Stream<String> languageCodes = LanguageService.getLanguageCodes(); EntityTypeMetadata entityTypeMeta = ctx.getBean(EntityTypeMetadata.class); AttributeMetadata attrMetaMeta = ctx.getBean(Attrib...
java
public void initialize(ContextRefreshedEvent event) { ApplicationContext ctx = event.getApplicationContext(); Stream<String> languageCodes = LanguageService.getLanguageCodes(); EntityTypeMetadata entityTypeMeta = ctx.getBean(EntityTypeMetadata.class); AttributeMetadata attrMetaMeta = ctx.getBean(Attrib...
[ "public", "void", "initialize", "(", "ContextRefreshedEvent", "event", ")", "{", "ApplicationContext", "ctx", "=", "event", ".", "getApplicationContext", "(", ")", ";", "Stream", "<", "String", ">", "languageCodes", "=", "LanguageService", ".", "getLanguageCodes", ...
Initialize internationalization attributes @param event application event
[ "Initialize", "internationalization", "attributes" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-i18n/src/main/java/org/molgenis/data/i18n/SystemEntityTypeI18nInitializer.java#L28-L58
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/populate/AutoValuePopulator.java
AutoValuePopulator.populate
public void populate(Entity entity) { // auto date generateAutoDateOrDateTime(singletonList(entity), entity.getEntityType().getAttributes()); // auto id Attribute idAttr = entity.getEntityType().getIdAttribute(); if (idAttr != null && idAttr.isAuto() && entity.getIdValue() == null ...
java
public void populate(Entity entity) { // auto date generateAutoDateOrDateTime(singletonList(entity), entity.getEntityType().getAttributes()); // auto id Attribute idAttr = entity.getEntityType().getIdAttribute(); if (idAttr != null && idAttr.isAuto() && entity.getIdValue() == null ...
[ "public", "void", "populate", "(", "Entity", "entity", ")", "{", "// auto date", "generateAutoDateOrDateTime", "(", "singletonList", "(", "entity", ")", ",", "entity", ".", "getEntityType", "(", ")", ".", "getAttributes", "(", ")", ")", ";", "// auto id", "Att...
Populates an entity with auto values @param entity populated entity
[ "Populates", "an", "entity", "with", "auto", "values" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/populate/AutoValuePopulator.java#L34-L46
train
molgenis/molgenis
molgenis-data-i18n/src/main/java/org/molgenis/data/i18n/I18nPopulator.java
I18nPopulator.populateL10nStrings
public void populateL10nStrings() { AllPropertiesMessageSource allPropertiesMessageSource = new AllPropertiesMessageSource(); String[] namespaces = localizationMessageSources .stream() .map(PropertiesMessageSource::getNamespace) .toArray(String[]::new); allPropert...
java
public void populateL10nStrings() { AllPropertiesMessageSource allPropertiesMessageSource = new AllPropertiesMessageSource(); String[] namespaces = localizationMessageSources .stream() .map(PropertiesMessageSource::getNamespace) .toArray(String[]::new); allPropert...
[ "public", "void", "populateL10nStrings", "(", ")", "{", "AllPropertiesMessageSource", "allPropertiesMessageSource", "=", "new", "AllPropertiesMessageSource", "(", ")", ";", "String", "[", "]", "namespaces", "=", "localizationMessageSources", ".", "stream", "(", ")", "...
Populates dataService with localization strings from property files on the classpath. <p>N.B. If you want to add a namespace with a localization resourcebundle, you need to add a PropertiesMessageSource bean to the spring context for that namespace.
[ "Populates", "dataService", "with", "localization", "strings", "from", "property", "files", "on", "the", "classpath", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-i18n/src/main/java/org/molgenis/data/i18n/I18nPopulator.java#L45-L54
train
molgenis/molgenis
molgenis-data-i18n/src/main/java/org/molgenis/data/i18n/I18nPopulator.java
I18nPopulator.populateLanguages
public void populateLanguages() { dataService.add( LANGUAGE, languageFactory.create( LanguageService.DEFAULT_LANGUAGE_CODE, LanguageService.DEFAULT_LANGUAGE_NAME, true)); dataService.add( LANGUAGE, languageFactory.create("nl", new Locale("nl").getDisplayName(new Local...
java
public void populateLanguages() { dataService.add( LANGUAGE, languageFactory.create( LanguageService.DEFAULT_LANGUAGE_CODE, LanguageService.DEFAULT_LANGUAGE_NAME, true)); dataService.add( LANGUAGE, languageFactory.create("nl", new Locale("nl").getDisplayName(new Local...
[ "public", "void", "populateLanguages", "(", ")", "{", "dataService", ".", "add", "(", "LANGUAGE", ",", "languageFactory", ".", "create", "(", "LanguageService", ".", "DEFAULT_LANGUAGE_CODE", ",", "LanguageService", ".", "DEFAULT_LANGUAGE_NAME", ",", "true", ")", "...
Populate data store with default languages
[ "Populate", "data", "store", "with", "default", "languages" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-i18n/src/main/java/org/molgenis/data/i18n/I18nPopulator.java#L57-L81
train
molgenis/molgenis
molgenis-data-validation/src/main/java/org/molgenis/data/validation/ExpressionValidator.java
ExpressionValidator.resolveBooleanExpressions
List<Boolean> resolveBooleanExpressions(List<String> expressions, Entity entity) { if (expressions.isEmpty()) { return Collections.emptyList(); } return jsMagmaScriptEvaluator .eval(expressions, entity) .stream() .map(this::convertToBoolean) .collect(toList()); }
java
List<Boolean> resolveBooleanExpressions(List<String> expressions, Entity entity) { if (expressions.isEmpty()) { return Collections.emptyList(); } return jsMagmaScriptEvaluator .eval(expressions, entity) .stream() .map(this::convertToBoolean) .collect(toList()); }
[ "List", "<", "Boolean", ">", "resolveBooleanExpressions", "(", "List", "<", "String", ">", "expressions", ",", "Entity", "entity", ")", "{", "if", "(", "expressions", ".", "isEmpty", "(", ")", ")", "{", "return", "Collections", ".", "emptyList", "(", ")", ...
Resolved boolean expressions @param expressions JavaScript expressions @param entity entity used during expression evaluations @return for each expression: <code>true</code> or <code>false</code>
[ "Resolved", "boolean", "expressions" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/ExpressionValidator.java#L48-L58
train
molgenis/molgenis
molgenis-core-ui/src/main/java/org/molgenis/core/ui/thememanager/ThemeManagerController.java
ThemeManagerController.addBootstrapTheme
@PreAuthorize("hasAnyRole('ROLE_SU')") @PostMapping(value = "/add-bootstrap-theme") public @ResponseBody Style addBootstrapTheme( @RequestParam(value = "bootstrap3-style") MultipartFile bootstrap3Style, @RequestParam(value = "bootstrap4-style", required = false) MultipartFile bootstrap4Style) thro...
java
@PreAuthorize("hasAnyRole('ROLE_SU')") @PostMapping(value = "/add-bootstrap-theme") public @ResponseBody Style addBootstrapTheme( @RequestParam(value = "bootstrap3-style") MultipartFile bootstrap3Style, @RequestParam(value = "bootstrap4-style", required = false) MultipartFile bootstrap4Style) thro...
[ "@", "PreAuthorize", "(", "\"hasAnyRole('ROLE_SU')\"", ")", "@", "PostMapping", "(", "value", "=", "\"/add-bootstrap-theme\"", ")", "public", "@", "ResponseBody", "Style", "addBootstrapTheme", "(", "@", "RequestParam", "(", "value", "=", "\"bootstrap3-style\"", ")", ...
Add a new bootstrap theme, theme is passed as a bootstrap css file. It is mandatory to pass a bootstrap3 style file but optional to pass a bootstrap 4 style file
[ "Add", "a", "new", "bootstrap", "theme", "theme", "is", "passed", "as", "a", "bootstrap", "css", "file", ".", "It", "is", "mandatory", "to", "pass", "a", "bootstrap3", "style", "file", "but", "optional", "to", "pass", "a", "bootstrap", "4", "style", "fil...
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/thememanager/ThemeManagerController.java#L65-L99
train
molgenis/molgenis
molgenis-util/src/main/java/org/molgenis/util/file/ZipFileUtil.java
ZipFileUtil.unzip
private static List<File> unzip(File file, NameMapper nameMapper) { try { File parentFile = file.getParentFile(); TrackingNameMapper trackingNameMapper = new TrackingNameMapper(parentFile, nameMapper); ZipUtil.unpack(file, parentFile, trackingNameMapper); return trackingNameMapper.getFiles()...
java
private static List<File> unzip(File file, NameMapper nameMapper) { try { File parentFile = file.getParentFile(); TrackingNameMapper trackingNameMapper = new TrackingNameMapper(parentFile, nameMapper); ZipUtil.unpack(file, parentFile, trackingNameMapper); return trackingNameMapper.getFiles()...
[ "private", "static", "List", "<", "File", ">", "unzip", "(", "File", "file", ",", "NameMapper", "nameMapper", ")", "{", "try", "{", "File", "parentFile", "=", "file", ".", "getParentFile", "(", ")", ";", "TrackingNameMapper", "trackingNameMapper", "=", "new"...
Unzips a zipfile into the directory it resides in. @param file the zipfile to unzip @param nameMapper the {@link NameMapper} to use when unzipping @return List of Files that got extracted @throws UnzipException if something went wrong
[ "Unzips", "a", "zipfile", "into", "the", "directory", "it", "resides", "in", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-util/src/main/java/org/molgenis/util/file/ZipFileUtil.java#L45-L54
train
molgenis/molgenis
molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/string/NGramDistanceAlgorithm.java
NGramDistanceAlgorithm.createNGrams
public static Map<String, Integer> createNGrams(String inputQuery, boolean removeStopWords) { List<String> wordsInString = Lists.newArrayList(Stemmer.replaceIllegalCharacter(inputQuery).split(" ")); if (removeStopWords) wordsInString.removeAll(STOPWORDSLIST); List<String> stemmedWordsInString = ...
java
public static Map<String, Integer> createNGrams(String inputQuery, boolean removeStopWords) { List<String> wordsInString = Lists.newArrayList(Stemmer.replaceIllegalCharacter(inputQuery).split(" ")); if (removeStopWords) wordsInString.removeAll(STOPWORDSLIST); List<String> stemmedWordsInString = ...
[ "public", "static", "Map", "<", "String", ",", "Integer", ">", "createNGrams", "(", "String", "inputQuery", ",", "boolean", "removeStopWords", ")", "{", "List", "<", "String", ">", "wordsInString", "=", "Lists", ".", "newArrayList", "(", "Stemmer", ".", "rep...
create n-grams tokens of the string. @return a map of ngram tokens with the corresponding frequency
[ "create", "n", "-", "grams", "tokens", "of", "the", "string", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/string/NGramDistanceAlgorithm.java#L240-L273
train
molgenis/molgenis
molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/string/NGramDistanceAlgorithm.java
NGramDistanceAlgorithm.calculateScore
private static double calculateScore( Map<String, Integer> inputStringTokens, Map<String, Integer> ontologyTermTokens) { if (inputStringTokens.size() == 0 || ontologyTermTokens.size() == 0) return (double) 0; int totalToken = getTotalNumTokens(inputStringTokens) + getTotalNumTokens(ontologyTermTokens); ...
java
private static double calculateScore( Map<String, Integer> inputStringTokens, Map<String, Integer> ontologyTermTokens) { if (inputStringTokens.size() == 0 || ontologyTermTokens.size() == 0) return (double) 0; int totalToken = getTotalNumTokens(inputStringTokens) + getTotalNumTokens(ontologyTermTokens); ...
[ "private", "static", "double", "calculateScore", "(", "Map", "<", "String", ",", "Integer", ">", "inputStringTokens", ",", "Map", "<", "String", ",", "Integer", ">", "ontologyTermTokens", ")", "{", "if", "(", "inputStringTokens", ".", "size", "(", ")", "==",...
Calculate the ngram distance
[ "Calculate", "the", "ngram", "distance" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/string/NGramDistanceAlgorithm.java#L276-L293
train
molgenis/molgenis
molgenis-settings/src/main/java/org/molgenis/settings/DefaultSettingsEntity.java
DefaultSettingsEntity.addListener
public void addListener(SettingsEntityListener settingsEntityListener) { RunAsSystemAspect.runAsSystem( () -> entityListenersService.addEntityListener( entityTypeId, new EntityListener() { @Override public void postUpdate(Entity...
java
public void addListener(SettingsEntityListener settingsEntityListener) { RunAsSystemAspect.runAsSystem( () -> entityListenersService.addEntityListener( entityTypeId, new EntityListener() { @Override public void postUpdate(Entity...
[ "public", "void", "addListener", "(", "SettingsEntityListener", "settingsEntityListener", ")", "{", "RunAsSystemAspect", ".", "runAsSystem", "(", "(", ")", "->", "entityListenersService", ".", "addEntityListener", "(", "entityTypeId", ",", "new", "EntityListener", "(", ...
Adds a listener for this settings entity that fires on entity updates @param settingsEntityListener listener for this settings entity
[ "Adds", "a", "listener", "for", "this", "settings", "entity", "that", "fires", "on", "entity", "updates" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-settings/src/main/java/org/molgenis/settings/DefaultSettingsEntity.java#L147-L163
train
molgenis/molgenis
molgenis-settings/src/main/java/org/molgenis/settings/DefaultSettingsEntity.java
DefaultSettingsEntity.removeListener
public void removeListener(SettingsEntityListener settingsEntityListener) { RunAsSystemAspect.runAsSystem( () -> entityListenersService.removeEntityListener( entityTypeId, new EntityListener() { @Override public void postUpdate...
java
public void removeListener(SettingsEntityListener settingsEntityListener) { RunAsSystemAspect.runAsSystem( () -> entityListenersService.removeEntityListener( entityTypeId, new EntityListener() { @Override public void postUpdate...
[ "public", "void", "removeListener", "(", "SettingsEntityListener", "settingsEntityListener", ")", "{", "RunAsSystemAspect", ".", "runAsSystem", "(", "(", ")", "->", "entityListenersService", ".", "removeEntityListener", "(", "entityTypeId", ",", "new", "EntityListener", ...
Removes a listener for this settings entity that fires on entity updates @param settingsEntityListener listener for this settings entity
[ "Removes", "a", "listener", "for", "this", "settings", "entity", "that", "fires", "on", "entity", "updates" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-settings/src/main/java/org/molgenis/settings/DefaultSettingsEntity.java#L170-L187
train
molgenis/molgenis
molgenis-data-excel/src/main/java/org/molgenis/data/excel/ExcelSheetWriter.java
ExcelSheetWriter.add
@Override public void add(Entity entity) { if (entity == null) throw new IllegalArgumentException("Entity cannot be null"); if (cachedAttributes == null) throw new MolgenisDataException( "The attribute names are not defined, call writeAttributeNames first"); int i = 0; Row poiRow = sh...
java
@Override public void add(Entity entity) { if (entity == null) throw new IllegalArgumentException("Entity cannot be null"); if (cachedAttributes == null) throw new MolgenisDataException( "The attribute names are not defined, call writeAttributeNames first"); int i = 0; Row poiRow = sh...
[ "@", "Override", "public", "void", "add", "(", "Entity", "entity", ")", "{", "if", "(", "entity", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Entity cannot be null\"", ")", ";", "if", "(", "cachedAttributes", "==", "null", ")", "th...
Add a new row to the sheet
[ "Add", "a", "new", "row", "to", "the", "sheet" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-excel/src/main/java/org/molgenis/data/excel/ExcelSheetWriter.java#L44-L59
train
molgenis/molgenis
molgenis-data-excel/src/main/java/org/molgenis/data/excel/ExcelSheetWriter.java
ExcelSheetWriter.writeAttributeHeaders
public void writeAttributeHeaders( Iterable<Attribute> attributes, AttributeWriteMode attributeWriteMode) { if (attributes == null) throw new IllegalArgumentException("Attributes cannot be null"); if (attributeWriteMode == null) throw new IllegalArgumentException("AttributeWriteMode cannot be null")...
java
public void writeAttributeHeaders( Iterable<Attribute> attributes, AttributeWriteMode attributeWriteMode) { if (attributes == null) throw new IllegalArgumentException("Attributes cannot be null"); if (attributeWriteMode == null) throw new IllegalArgumentException("AttributeWriteMode cannot be null")...
[ "public", "void", "writeAttributeHeaders", "(", "Iterable", "<", "Attribute", ">", "attributes", ",", "AttributeWriteMode", "attributeWriteMode", ")", "{", "if", "(", "attributes", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Attributes canno...
Write sheet column headers
[ "Write", "sheet", "column", "headers" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-excel/src/main/java/org/molgenis/data/excel/ExcelSheetWriter.java#L62-L93
train
molgenis/molgenis
molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/repository/TagRepository.java
TagRepository.getTagEntity
public Tag getTagEntity(String objectIRI, String label, Relation relation, String codeSystemIRI) { Tag tag = dataService .query(TAG, Tag.class) .eq(OBJECT_IRI, objectIRI) .and() .eq(RELATION_IRI, relation.getIRI()) .and() .eq(CODE_SYSTE...
java
public Tag getTagEntity(String objectIRI, String label, Relation relation, String codeSystemIRI) { Tag tag = dataService .query(TAG, Tag.class) .eq(OBJECT_IRI, objectIRI) .and() .eq(RELATION_IRI, relation.getIRI()) .and() .eq(CODE_SYSTE...
[ "public", "Tag", "getTagEntity", "(", "String", "objectIRI", ",", "String", "label", ",", "Relation", "relation", ",", "String", "codeSystemIRI", ")", "{", "Tag", "tag", "=", "dataService", ".", "query", "(", "TAG", ",", "Tag", ".", "class", ")", ".", "e...
Fetches a tag from the repository. Creates a new one if it does not yet exist. @param objectIRI IRI of the object @param label label of the object @param relation {@link Relation} of the tag @param codeSystemIRI the IRI of the code system of the tag @return {@link Tag} of type {@link TagMetadata}
[ "Fetches", "a", "tag", "from", "the", "repository", ".", "Creates", "a", "new", "one", "if", "it", "does", "not", "yet", "exist", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/repository/TagRepository.java#L41-L62
train
molgenis/molgenis
molgenis-bootstrap/src/main/java/org/molgenis/bootstrap/populate/RepositoryPopulator.java
RepositoryPopulator.populate
public boolean populate(ContextRefreshedEvent event) { boolean databasePopulated = isDatabasePopulated(); if (!databasePopulated) { LOG.trace("Populating database with I18N strings ..."); i18nPopulator.populateLanguages(); LOG.trace("Populated database with I18N strings"); } LOG.trace...
java
public boolean populate(ContextRefreshedEvent event) { boolean databasePopulated = isDatabasePopulated(); if (!databasePopulated) { LOG.trace("Populating database with I18N strings ..."); i18nPopulator.populateLanguages(); LOG.trace("Populated database with I18N strings"); } LOG.trace...
[ "public", "boolean", "populate", "(", "ContextRefreshedEvent", "event", ")", "{", "boolean", "databasePopulated", "=", "isDatabasePopulated", "(", ")", ";", "if", "(", "!", "databasePopulated", ")", "{", "LOG", ".", "trace", "(", "\"Populating database with I18N str...
Returns whether the database was populated previously.
[ "Returns", "whether", "the", "database", "was", "populated", "previously", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-bootstrap/src/main/java/org/molgenis/bootstrap/populate/RepositoryPopulator.java#L54-L98
train
molgenis/molgenis
molgenis-data-validation/src/main/java/org/molgenis/data/validation/QueryValidator.java
QueryValidator.validate
public void validate(Query<? extends Entity> query, EntityType entityType) { query.getRules().forEach(queryRule -> validateQueryRule(queryRule, entityType)); }
java
public void validate(Query<? extends Entity> query, EntityType entityType) { query.getRules().forEach(queryRule -> validateQueryRule(queryRule, entityType)); }
[ "public", "void", "validate", "(", "Query", "<", "?", "extends", "Entity", ">", "query", ",", "EntityType", "entityType", ")", "{", "query", ".", "getRules", "(", ")", ".", "forEach", "(", "queryRule", "->", "validateQueryRule", "(", "queryRule", ",", "ent...
Validates query based on the given entity type, converts query values to the expected type if necessary. @param query query @param entityType entity type @throws MolgenisValidationException if query is invalid
[ "Validates", "query", "based", "on", "the", "given", "entity", "type", "converts", "query", "values", "to", "the", "expected", "type", "if", "necessary", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/QueryValidator.java#L58-L60
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/QueryRule.java
QueryRule.setValue
public void setValue(Object value) { if (value instanceof Iterable<?>) { this.value = stream((Iterable<?>) value).map(this::toValue).collect(toList()); } else { this.value = toValue(value); } }
java
public void setValue(Object value) { if (value instanceof Iterable<?>) { this.value = stream((Iterable<?>) value).map(this::toValue).collect(toList()); } else { this.value = toValue(value); } }
[ "public", "void", "setValue", "(", "Object", "value", ")", "{", "if", "(", "value", "instanceof", "Iterable", "<", "?", ">", ")", "{", "this", ".", "value", "=", "stream", "(", "(", "Iterable", "<", "?", ">", ")", "value", ")", ".", "map", "(", "...
Sets a new value for this rule. @param value The new value.
[ "Sets", "a", "new", "value", "for", "this", "rule", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/QueryRule.java#L259-L265
train
molgenis/molgenis
molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/explain/service/ExplainServiceHelper.java
ExplainServiceHelper.findMatchedWords
Set<String> findMatchedWords(Explanation explanation) { Set<String> words = new HashSet<>(); String description = explanation.getDescription(); if (description.startsWith(Options.SUM_OF.toString()) || description.startsWith(Options.PRODUCT_OF.toString())) { if (newArrayList(explanation.getDeta...
java
Set<String> findMatchedWords(Explanation explanation) { Set<String> words = new HashSet<>(); String description = explanation.getDescription(); if (description.startsWith(Options.SUM_OF.toString()) || description.startsWith(Options.PRODUCT_OF.toString())) { if (newArrayList(explanation.getDeta...
[ "Set", "<", "String", ">", "findMatchedWords", "(", "Explanation", "explanation", ")", "{", "Set", "<", "String", ">", "words", "=", "new", "HashSet", "<>", "(", ")", ";", "String", "description", "=", "explanation", ".", "getDescription", "(", ")", ";", ...
This method is able to recursively collect all the matched words from Elasticsearch Explanation document @return a set of matched words that are matched to different ontology terms
[ "This", "method", "is", "able", "to", "recursively", "collect", "all", "the", "matched", "words", "from", "Elasticsearch", "Explanation", "document" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/explain/service/ExplainServiceHelper.java#L55-L83
train
molgenis/molgenis
molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/explain/service/ExplainServiceHelper.java
ExplainServiceHelper.findMatchQueries
Map<String, Double> findMatchQueries( String matchedWordsString, Map<String, String> collectExpandedQueryMap) { Map<String, Double> qualifiedQueries = new HashMap<>(); Set<String> matchedWords = splitIntoTerms(matchedWordsString); for (Entry<String, String> entry : collectExpandedQueryMap.entrySet()) ...
java
Map<String, Double> findMatchQueries( String matchedWordsString, Map<String, String> collectExpandedQueryMap) { Map<String, Double> qualifiedQueries = new HashMap<>(); Set<String> matchedWords = splitIntoTerms(matchedWordsString); for (Entry<String, String> entry : collectExpandedQueryMap.entrySet()) ...
[ "Map", "<", "String", ",", "Double", ">", "findMatchQueries", "(", "String", "matchedWordsString", ",", "Map", "<", "String", ",", "String", ">", "collectExpandedQueryMap", ")", "{", "Map", "<", "String", ",", "Double", ">", "qualifiedQueries", "=", "new", "...
This method is able to find the queries that are used in the matching. Only queries that contain all matched words are potential queries. @return a map of potential queries and their matching scores
[ "This", "method", "is", "able", "to", "find", "the", "queries", "that", "are", "used", "in", "the", "matching", ".", "Only", "queries", "that", "contain", "all", "matched", "words", "are", "potential", "queries", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/explain/service/ExplainServiceHelper.java#L104-L117
train
molgenis/molgenis
molgenis-core-ui/src/main/java/org/molgenis/core/ui/controller/FeedbackController.java
FeedbackController.init
@Override @GetMapping public String init(final Model model) { super.init(model); model.addAttribute("adminEmails", userService.getSuEmailAddresses()); if (SecurityUtils.currentUserIsAuthenticated()) { User currentUser = userService.getUser(SecurityUtils.getCurrentUsername()); if (currentUser...
java
@Override @GetMapping public String init(final Model model) { super.init(model); model.addAttribute("adminEmails", userService.getSuEmailAddresses()); if (SecurityUtils.currentUserIsAuthenticated()) { User currentUser = userService.getUser(SecurityUtils.getCurrentUsername()); if (currentUser...
[ "@", "Override", "@", "GetMapping", "public", "String", "init", "(", "final", "Model", "model", ")", "{", "super", ".", "init", "(", "model", ")", ";", "model", ".", "addAttribute", "(", "\"adminEmails\"", ",", "userService", ".", "getSuEmailAddresses", "(",...
Serves feedback form.
[ "Serves", "feedback", "form", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/controller/FeedbackController.java#L65-L80
train
molgenis/molgenis
molgenis-core-ui/src/main/java/org/molgenis/core/ui/controller/FeedbackController.java
FeedbackController.createFeedbackMessage
@SuppressWarnings("squid:S3457") // do not use platform specific line ending private SimpleMailMessage createFeedbackMessage(FeedbackForm form) { SimpleMailMessage message = new SimpleMailMessage(); message.setTo(userService.getSuEmailAddresses().toArray(new String[] {})); if (form.hasEmail()) { mes...
java
@SuppressWarnings("squid:S3457") // do not use platform specific line ending private SimpleMailMessage createFeedbackMessage(FeedbackForm form) { SimpleMailMessage message = new SimpleMailMessage(); message.setTo(userService.getSuEmailAddresses().toArray(new String[] {})); if (form.hasEmail()) { mes...
[ "@", "SuppressWarnings", "(", "\"squid:S3457\"", ")", "// do not use platform specific line ending", "private", "SimpleMailMessage", "createFeedbackMessage", "(", "FeedbackForm", "form", ")", "{", "SimpleMailMessage", "message", "=", "new", "SimpleMailMessage", "(", ")", ";...
Creates a MimeMessage based on a FeedbackForm.
[ "Creates", "a", "MimeMessage", "based", "on", "a", "FeedbackForm", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/controller/FeedbackController.java#L108-L122
train
molgenis/molgenis
molgenis-core-ui/src/main/java/org/molgenis/core/ui/controller/FeedbackController.java
FeedbackController.getFormattedName
private static String getFormattedName(User user) { List<String> parts = new ArrayList<>(); if (user.getTitle() != null) { parts.add(user.getTitle()); } if (user.getFirstName() != null) { parts.add(user.getFirstName()); } if (user.getMiddleNames() != null) { parts.add(user.getM...
java
private static String getFormattedName(User user) { List<String> parts = new ArrayList<>(); if (user.getTitle() != null) { parts.add(user.getTitle()); } if (user.getFirstName() != null) { parts.add(user.getFirstName()); } if (user.getMiddleNames() != null) { parts.add(user.getM...
[ "private", "static", "String", "getFormattedName", "(", "User", "user", ")", "{", "List", "<", "String", ">", "parts", "=", "new", "ArrayList", "<>", "(", ")", ";", "if", "(", "user", ".", "getTitle", "(", ")", "!=", "null", ")", "{", "parts", ".", ...
Formats a MolgenisUser's name. @return String containing the user's first name, middle names and last name.
[ "Formats", "a", "MolgenisUser", "s", "name", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/controller/FeedbackController.java#L129-L149
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/populate/IdGeneratorImpl.java
IdGeneratorImpl.generateRandomBytes
private byte[] generateRandomBytes(int nBytes, Random random) { byte[] randomBytes = new byte[nBytes]; random.nextBytes(randomBytes); return randomBytes; }
java
private byte[] generateRandomBytes(int nBytes, Random random) { byte[] randomBytes = new byte[nBytes]; random.nextBytes(randomBytes); return randomBytes; }
[ "private", "byte", "[", "]", "generateRandomBytes", "(", "int", "nBytes", ",", "Random", "random", ")", "{", "byte", "[", "]", "randomBytes", "=", "new", "byte", "[", "nBytes", "]", ";", "random", ".", "nextBytes", "(", "randomBytes", ")", ";", "return",...
Generates a number of random bytes. <p>The chance of collisions of k IDs taken from a population of N possibilities is <code> 1 - Math.exp(-0.5 * k * (k - 1) / N)</code> <p>A couple collision chances for 5 bytes <code>N = 256^5</code>: <table> <tr><td> 1 </td><td> 0.0 </td></tr> <tr><td> 10 </td><td> 4.0927261579781...
[ "Generates", "a", "number", "of", "random", "bytes", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/populate/IdGeneratorImpl.java#L70-L74
train
molgenis/molgenis
molgenis-jobs/src/main/java/org/molgenis/jobs/schedule/JobScheduler.java
JobScheduler.unschedule
synchronized void unschedule(String scheduledJobId) { try { quartzScheduler.deleteJob(new JobKey(scheduledJobId, SCHEDULED_JOB_GROUP)); } catch (SchedulerException e) { String message = format("Error deleting ScheduledJob ''{0}''", scheduledJobId); LOG.error(message, e); throw new Schedu...
java
synchronized void unschedule(String scheduledJobId) { try { quartzScheduler.deleteJob(new JobKey(scheduledJobId, SCHEDULED_JOB_GROUP)); } catch (SchedulerException e) { String message = format("Error deleting ScheduledJob ''{0}''", scheduledJobId); LOG.error(message, e); throw new Schedu...
[ "synchronized", "void", "unschedule", "(", "String", "scheduledJobId", ")", "{", "try", "{", "quartzScheduler", ".", "deleteJob", "(", "new", "JobKey", "(", "scheduledJobId", ",", "SCHEDULED_JOB_GROUP", ")", ")", ";", "}", "catch", "(", "SchedulerException", "e"...
Remove a job from the quartzScheduler @param scheduledJobId ID of the ScheduledJob to unschedule
[ "Remove", "a", "job", "from", "the", "quartzScheduler" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-jobs/src/main/java/org/molgenis/jobs/schedule/JobScheduler.java#L133-L141
train
molgenis/molgenis
molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/AttributeValidator.java
AttributeValidator.validateMappedBy
private static void validateMappedBy(Attribute attr, Attribute mappedByAttr) { if (mappedByAttr != null) { if (!isSingleReferenceType(mappedByAttr)) { throw new MolgenisDataException( format( "Invalid mappedBy attribute [%s] data type [%s].", mappedByAttr.ge...
java
private static void validateMappedBy(Attribute attr, Attribute mappedByAttr) { if (mappedByAttr != null) { if (!isSingleReferenceType(mappedByAttr)) { throw new MolgenisDataException( format( "Invalid mappedBy attribute [%s] data type [%s].", mappedByAttr.ge...
[ "private", "static", "void", "validateMappedBy", "(", "Attribute", "attr", ",", "Attribute", "mappedByAttr", ")", "{", "if", "(", "mappedByAttr", "!=", "null", ")", "{", "if", "(", "!", "isSingleReferenceType", "(", "mappedByAttr", ")", ")", "{", "throw", "n...
Validate whether the mappedBy attribute is part of the referenced entity. @param attr attribute @param mappedByAttr mappedBy attribute @throws MolgenisDataException if mappedBy is an attribute that is not part of the referenced entity
[ "Validate", "whether", "the", "mappedBy", "attribute", "is", "part", "of", "the", "referenced", "entity", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/AttributeValidator.java#L296-L313
train
molgenis/molgenis
molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/AttributeValidator.java
AttributeValidator.validateOrderBy
private static void validateOrderBy(Attribute attr, Sort orderBy) { if (orderBy != null) { EntityType refEntity = attr.getRefEntity(); if (refEntity != null) { for (Sort.Order orderClause : orderBy) { String refAttrName = orderClause.getAttr(); if (refEntity.getAttribute(refA...
java
private static void validateOrderBy(Attribute attr, Sort orderBy) { if (orderBy != null) { EntityType refEntity = attr.getRefEntity(); if (refEntity != null) { for (Sort.Order orderClause : orderBy) { String refAttrName = orderClause.getAttr(); if (refEntity.getAttribute(refA...
[ "private", "static", "void", "validateOrderBy", "(", "Attribute", "attr", ",", "Sort", "orderBy", ")", "{", "if", "(", "orderBy", "!=", "null", ")", "{", "EntityType", "refEntity", "=", "attr", ".", "getRefEntity", "(", ")", ";", "if", "(", "refEntity", ...
Validate whether the attribute names defined by the orderBy attribute point to existing attributes in the referenced entity. @param attr attribute @param orderBy orderBy of attribute @throws MolgenisDataException if orderBy contains attribute names that do not exist in the referenced entity.
[ "Validate", "whether", "the", "attribute", "names", "defined", "by", "the", "orderBy", "attribute", "point", "to", "existing", "attributes", "in", "the", "referenced", "entity", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/AttributeValidator.java#L324-L343
train
molgenis/molgenis
molgenis-data-import/src/main/java/org/molgenis/data/importer/ImportServiceFactory.java
ImportServiceFactory.getImportService
public ImportService getImportService(File file, RepositoryCollection source) { final Map<String, ImportService> importServicesMappedToExtensions = Maps.newHashMap(); importServices .stream() .filter(importService -> importService.canImport(file, source)) .forEach( importServ...
java
public ImportService getImportService(File file, RepositoryCollection source) { final Map<String, ImportService> importServicesMappedToExtensions = Maps.newHashMap(); importServices .stream() .filter(importService -> importService.canImport(file, source)) .forEach( importServ...
[ "public", "ImportService", "getImportService", "(", "File", "file", ",", "RepositoryCollection", "source", ")", "{", "final", "Map", "<", "String", ",", "ImportService", ">", "importServicesMappedToExtensions", "=", "Maps", ".", "newHashMap", "(", ")", ";", "impor...
Finds a suitable ImportService for a FileRepositoryCollection. <p>Import of mixed backend types in one FileRepositoryCollection isn't supported. @return ImportService @throws MolgenisDataException if no suitable ImportService is found for the FileRepositoryCollection
[ "Finds", "a", "suitable", "ImportService", "for", "a", "FileRepositoryCollection", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/ImportServiceFactory.java#L35-L57
train
molgenis/molgenis
molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/string/Stemmer.java
Stemmer.cleanStemPhrase
public static String cleanStemPhrase(String phrase) { StringBuilder stringBuilder = new StringBuilder(); for (String word : replaceIllegalCharacter(phrase).split(" ")) { String stemmedWord = stem(word); if (StringUtils.isNotEmpty(stemmedWord)) { if (stringBuilder.length() > 0) { st...
java
public static String cleanStemPhrase(String phrase) { StringBuilder stringBuilder = new StringBuilder(); for (String word : replaceIllegalCharacter(phrase).split(" ")) { String stemmedWord = stem(word); if (StringUtils.isNotEmpty(stemmedWord)) { if (stringBuilder.length() > 0) { st...
[ "public", "static", "String", "cleanStemPhrase", "(", "String", "phrase", ")", "{", "StringBuilder", "stringBuilder", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "String", "word", ":", "replaceIllegalCharacter", "(", "phrase", ")", ".", "split", "(...
Remove illegal characters from the string and stem each single word @return a string that consists of stemmed words
[ "Remove", "illegal", "characters", "from", "the", "string", "and", "stem", "each", "single", "word" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/string/Stemmer.java#L18-L31
train
molgenis/molgenis
molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/importer/repository/OntologyRepositoryCollection.java
OntologyRepositoryCollection.constructNodePath
private String constructNodePath(String parentNodePath, int currentPosition) { StringBuilder nodePathStringBuilder = new StringBuilder(); if (!StringUtils.isEmpty(parentNodePath)) nodePathStringBuilder.append(parentNodePath).append('.'); nodePathStringBuilder .append(currentPosition) ....
java
private String constructNodePath(String parentNodePath, int currentPosition) { StringBuilder nodePathStringBuilder = new StringBuilder(); if (!StringUtils.isEmpty(parentNodePath)) nodePathStringBuilder.append(parentNodePath).append('.'); nodePathStringBuilder .append(currentPosition) ....
[ "private", "String", "constructNodePath", "(", "String", "parentNodePath", ",", "int", "currentPosition", ")", "{", "StringBuilder", "nodePathStringBuilder", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "!", "StringUtils", ".", "isEmpty", "(", "parentNod...
Constructs the node path string for a child node @param parentNodePath node path string of the node's parent @param currentPosition position of the node in the parent's child list @return node path string
[ "Constructs", "the", "node", "path", "string", "for", "a", "child", "node" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/importer/repository/OntologyRepositoryCollection.java#L294-L304
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/util/EntityUtils.java
EntityUtils.getTypedValue
public static Object getTypedValue(String valueStr, Attribute attr) { // Reference types cannot be processed because we lack an entityManager in this route. if (EntityTypeUtils.isReferenceType(attr)) { throw new MolgenisDataException( "getTypedValue(String, AttributeMetadata) can't be used for a...
java
public static Object getTypedValue(String valueStr, Attribute attr) { // Reference types cannot be processed because we lack an entityManager in this route. if (EntityTypeUtils.isReferenceType(attr)) { throw new MolgenisDataException( "getTypedValue(String, AttributeMetadata) can't be used for a...
[ "public", "static", "Object", "getTypedValue", "(", "String", "valueStr", ",", "Attribute", "attr", ")", "{", "// Reference types cannot be processed because we lack an entityManager in this route.", "if", "(", "EntityTypeUtils", ".", "isReferenceType", "(", "attr", ")", ")...
Convert a string value to a typed value based on a non-entity-referencing attribute data type. @param valueStr string value @param attr non-entity-referencing attribute @return typed value @throws MolgenisDataException if attribute references another entity
[ "Convert", "a", "string", "value", "to", "a", "typed", "value", "based", "on", "a", "non", "-", "entity", "-", "referencing", "attribute", "data", "type", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/util/EntityUtils.java#L38-L45
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/util/EntityUtils.java
EntityUtils.getTypedValue
public static Object getTypedValue(String valueStr, Attribute attr, EntityManager entityManager) { if (valueStr == null) return null; switch (attr.getDataType()) { case BOOL: return Boolean.valueOf(valueStr); case CATEGORICAL: case FILE: case XREF: EntityType xrefEntity =...
java
public static Object getTypedValue(String valueStr, Attribute attr, EntityManager entityManager) { if (valueStr == null) return null; switch (attr.getDataType()) { case BOOL: return Boolean.valueOf(valueStr); case CATEGORICAL: case FILE: case XREF: EntityType xrefEntity =...
[ "public", "static", "Object", "getTypedValue", "(", "String", "valueStr", ",", "Attribute", "attr", ",", "EntityManager", "entityManager", ")", "{", "if", "(", "valueStr", "==", "null", ")", "return", "null", ";", "switch", "(", "attr", ".", "getDataType", "...
Convert a string value to a typed value based on the attribute data type. @param valueStr string value @param attr attribute @param entityManager entity manager used to convert referenced entity values @return typed value
[ "Convert", "a", "string", "value", "to", "a", "typed", "value", "based", "on", "the", "attribute", "data", "type", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/util/EntityUtils.java#L55-L111
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/util/EntityUtils.java
EntityUtils.equalsEntities
public static boolean equalsEntities( Iterable<Entity> entityIterable, Iterable<Entity> otherEntityIterable) { List<Entity> attrs = newArrayList(entityIterable); List<Entity> otherAttrs = newArrayList(otherEntityIterable); if (attrs.size() != otherAttrs.size()) return false; for (int i = 0; i < a...
java
public static boolean equalsEntities( Iterable<Entity> entityIterable, Iterable<Entity> otherEntityIterable) { List<Entity> attrs = newArrayList(entityIterable); List<Entity> otherAttrs = newArrayList(otherEntityIterable); if (attrs.size() != otherAttrs.size()) return false; for (int i = 0; i < a...
[ "public", "static", "boolean", "equalsEntities", "(", "Iterable", "<", "Entity", ">", "entityIterable", ",", "Iterable", "<", "Entity", ">", "otherEntityIterable", ")", "{", "List", "<", "Entity", ">", "attrs", "=", "newArrayList", "(", "entityIterable", ")", ...
Returns true if an Iterable equals another Iterable.
[ "Returns", "true", "if", "an", "Iterable", "equals", "another", "Iterable", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/util/EntityUtils.java#L226-L236
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/meta/model/Attribute.java
Attribute.getEnumOptions
public List<String> getEnumOptions() { String enumOptionsStr = getString(ENUM_OPTIONS); return enumOptionsStr != null ? asList(enumOptionsStr.split(",")) : emptyList(); }
java
public List<String> getEnumOptions() { String enumOptionsStr = getString(ENUM_OPTIONS); return enumOptionsStr != null ? asList(enumOptionsStr.split(",")) : emptyList(); }
[ "public", "List", "<", "String", ">", "getEnumOptions", "(", ")", "{", "String", "enumOptionsStr", "=", "getString", "(", "ENUM_OPTIONS", ")", ";", "return", "enumOptionsStr", "!=", "null", "?", "asList", "(", "enumOptionsStr", ".", "split", "(", "\",\"", ")...
For enum fields returns the possible enum values @return enum values
[ "For", "enum", "fields", "returns", "the", "possible", "enum", "values" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/model/Attribute.java#L475-L478
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/meta/model/Attribute.java
Attribute.getInversedBy
public Attribute getInversedBy() { // FIXME besides checking mappedBy attr name also check // attr.getRefEntity().getFullyQualifiedName if (hasRefEntity()) { return Streams.stream(getRefEntity().getAtomicAttributes()) .filter(Attribute::isMappedBy) .filter(attr -> getName().equals(...
java
public Attribute getInversedBy() { // FIXME besides checking mappedBy attr name also check // attr.getRefEntity().getFullyQualifiedName if (hasRefEntity()) { return Streams.stream(getRefEntity().getAtomicAttributes()) .filter(Attribute::isMappedBy) .filter(attr -> getName().equals(...
[ "public", "Attribute", "getInversedBy", "(", ")", "{", "// FIXME besides checking mappedBy attr name also check", "// attr.getRefEntity().getFullyQualifiedName", "if", "(", "hasRefEntity", "(", ")", ")", "{", "return", "Streams", ".", "stream", "(", "getRefEntity", "(", "...
For a reference type attribute, searches the referenced entity for its inversed attribute. This is the one-to-many attribute that has "mappedBy" set to this attribute. Returns null if this is not a reference type attribute, or no inverse attribute exists.
[ "For", "a", "reference", "type", "attribute", "searches", "the", "referenced", "entity", "for", "its", "inversed", "attribute", ".", "This", "is", "the", "one", "-", "to", "-", "many", "attribute", "that", "has", "mappedBy", "set", "to", "this", "attribute",...
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/model/Attribute.java#L744-L756
train
molgenis/molgenis
molgenis-data-security/src/main/java/org/molgenis/data/security/auth/GroupPermissionService.java
GroupPermissionService.grantDefaultPermissions
public void grantDefaultPermissions(GroupValue groupValue) { PackageIdentity packageIdentity = new PackageIdentity(groupValue.getRootPackage().getName()); GroupIdentity groupIdentity = new GroupIdentity(groupValue.getName()); aclService.createAcl(groupIdentity); groupValue .getRoles() .f...
java
public void grantDefaultPermissions(GroupValue groupValue) { PackageIdentity packageIdentity = new PackageIdentity(groupValue.getRootPackage().getName()); GroupIdentity groupIdentity = new GroupIdentity(groupValue.getName()); aclService.createAcl(groupIdentity); groupValue .getRoles() .f...
[ "public", "void", "grantDefaultPermissions", "(", "GroupValue", "groupValue", ")", "{", "PackageIdentity", "packageIdentity", "=", "new", "PackageIdentity", "(", "groupValue", ".", "getRootPackage", "(", ")", ".", "getName", "(", ")", ")", ";", "GroupIdentity", "g...
Grants default permissions on the root package and group to the roles of the group @param groupValue details of the group for which the permissions will be granted
[ "Grants", "default", "permissions", "on", "the", "root", "package", "and", "group", "to", "the", "roles", "of", "the", "group" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-security/src/main/java/org/molgenis/data/security/auth/GroupPermissionService.java#L43-L59
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/Fetch.java
Fetch.field
public Fetch field(String field, Fetch fetch) { attrFetchMap.put(field, fetch); return this; }
java
public Fetch field(String field, Fetch fetch) { attrFetchMap.put(field, fetch); return this; }
[ "public", "Fetch", "field", "(", "String", "field", ",", "Fetch", "fetch", ")", "{", "attrFetchMap", ".", "put", "(", "field", ",", "fetch", ")", ";", "return", "this", ";", "}" ]
Updates this fetch, adding a single field. If the field is a reference, the reference will be fetched with the Fetch that is provided. @param field the name of the field to fetch @param fetch the fetch to use for this field, if the field is a reference @return this Fetch, updated
[ "Updates", "this", "fetch", "adding", "a", "single", "field", ".", "If", "the", "field", "is", "a", "reference", "the", "reference", "will", "be", "fetched", "with", "the", "Fetch", "that", "is", "provided", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/Fetch.java#L47-L50
train
molgenis/molgenis
molgenis-genomebrowser/src/main/java/org/molgenis/genomebrowser/service/GenomeBrowserService.java
GenomeBrowserService.getTracksString
public List<String> getTracksString(Map<String, GenomeBrowserTrack> entityTracks) { List<String> results = new ArrayList<>(); if (hasPermission()) { Map<String, GenomeBrowserTrack> allTracks = new HashMap<>(entityTracks); for (GenomeBrowserTrack track : entityTracks.values()) { allTracks.put...
java
public List<String> getTracksString(Map<String, GenomeBrowserTrack> entityTracks) { List<String> results = new ArrayList<>(); if (hasPermission()) { Map<String, GenomeBrowserTrack> allTracks = new HashMap<>(entityTracks); for (GenomeBrowserTrack track : entityTracks.values()) { allTracks.put...
[ "public", "List", "<", "String", ">", "getTracksString", "(", "Map", "<", "String", ",", "GenomeBrowserTrack", ">", "entityTracks", ")", "{", "List", "<", "String", ">", "results", "=", "new", "ArrayList", "<>", "(", ")", ";", "if", "(", "hasPermission", ...
Get readable genome entities
[ "Get", "readable", "genome", "entities" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-genomebrowser/src/main/java/org/molgenis/genomebrowser/service/GenomeBrowserService.java#L65-L80
train
molgenis/molgenis
molgenis-data-cache/src/main/java/org/molgenis/data/cache/l2/L2Cache.java
L2Cache.get
public Entity get(Repository<Entity> repository, Object id) { LoadingCache<Object, Optional<Map<String, Object>>> cache = getEntityCache(repository); EntityType entityType = repository.getEntityType(); return cache.getUnchecked(id).map(e -> entityHydration.hydrate(e, entityType)).orElse(null); }
java
public Entity get(Repository<Entity> repository, Object id) { LoadingCache<Object, Optional<Map<String, Object>>> cache = getEntityCache(repository); EntityType entityType = repository.getEntityType(); return cache.getUnchecked(id).map(e -> entityHydration.hydrate(e, entityType)).orElse(null); }
[ "public", "Entity", "get", "(", "Repository", "<", "Entity", ">", "repository", ",", "Object", "id", ")", "{", "LoadingCache", "<", "Object", ",", "Optional", "<", "Map", "<", "String", ",", "Object", ">", ">", ">", "cache", "=", "getEntityCache", "(", ...
Retrieves an entity from the cache or the underlying repository. @param repository the underlying repository @param id the ID of the entity to retrieve @return the retrieved Entity, or null if the entity is not present. @throws com.google.common.util.concurrent.UncheckedExecutionException if the repository throws an e...
[ "Retrieves", "an", "entity", "from", "the", "cache", "or", "the", "underlying", "repository", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-cache/src/main/java/org/molgenis/data/cache/l2/L2Cache.java#L87-L91
train
molgenis/molgenis
molgenis-data-cache/src/main/java/org/molgenis/data/cache/l2/L2Cache.java
L2Cache.getBatch
public List<Entity> getBatch(Repository<Entity> repository, Iterable<Object> ids) { try { return getEntityCache(repository) .getAll(ids) .values() .stream() .filter(Optional::isPresent) .map(Optional::get) .map(e -> entityHydration.hydrate(e, reposit...
java
public List<Entity> getBatch(Repository<Entity> repository, Iterable<Object> ids) { try { return getEntityCache(repository) .getAll(ids) .values() .stream() .filter(Optional::isPresent) .map(Optional::get) .map(e -> entityHydration.hydrate(e, reposit...
[ "public", "List", "<", "Entity", ">", "getBatch", "(", "Repository", "<", "Entity", ">", "repository", ",", "Iterable", "<", "Object", ">", "ids", ")", "{", "try", "{", "return", "getEntityCache", "(", "repository", ")", ".", "getAll", "(", "ids", ")", ...
Retrieves a list of entities from the cache. If the cache doesn't yet exist, will create the cache. @param repository the underlying repository, used to create the cache loader or to retrieve the existing cache @param ids {@link Iterable} of the ids of the entities to retrieve @return List containing the retrieved ent...
[ "Retrieves", "a", "list", "of", "entities", "from", "the", "cache", ".", "If", "the", "cache", "doesn", "t", "yet", "exist", "will", "create", "the", "cache", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-cache/src/main/java/org/molgenis/data/cache/l2/L2Cache.java#L103-L120
train
molgenis/molgenis
molgenis-data-cache/src/main/java/org/molgenis/data/cache/l2/L2Cache.java
L2Cache.createEntityCache
private LoadingCache<Object, Optional<Map<String, Object>>> createEntityCache( Repository<Entity> repository) { Caffeine<Object, Object> cacheBuilder = Caffeine.newBuilder().recordStats().expireAfterAccess(10, MINUTES); if (!MetaDataService.isMetaEntityType(repository.getEntityType())) { cac...
java
private LoadingCache<Object, Optional<Map<String, Object>>> createEntityCache( Repository<Entity> repository) { Caffeine<Object, Object> cacheBuilder = Caffeine.newBuilder().recordStats().expireAfterAccess(10, MINUTES); if (!MetaDataService.isMetaEntityType(repository.getEntityType())) { cac...
[ "private", "LoadingCache", "<", "Object", ",", "Optional", "<", "Map", "<", "String", ",", "Object", ">", ">", ">", "createEntityCache", "(", "Repository", "<", "Entity", ">", "repository", ")", "{", "Caffeine", "<", "Object", ",", "Object", ">", "cacheBui...
Creates a new Entity cache @param repository the {@link Repository} to load the entities from @return newly created LoadingCache
[ "Creates", "a", "new", "Entity", "cache" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-cache/src/main/java/org/molgenis/data/cache/l2/L2Cache.java#L159-L170
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/meta/EntityTypeRepositoryDecorator.java
EntityTypeRepositoryDecorator.removeMappedByAttributes
private void removeMappedByAttributes(Map<String, EntityType> resolvedEntityTypes) { resolvedEntityTypes .values() .stream() .flatMap(EntityType::getMappedByAttributes) .filter(attribute -> resolvedEntityTypes.containsKey(attribute.getEntity().getId())) .forEach(attribute -> ...
java
private void removeMappedByAttributes(Map<String, EntityType> resolvedEntityTypes) { resolvedEntityTypes .values() .stream() .flatMap(EntityType::getMappedByAttributes) .filter(attribute -> resolvedEntityTypes.containsKey(attribute.getEntity().getId())) .forEach(attribute -> ...
[ "private", "void", "removeMappedByAttributes", "(", "Map", "<", "String", ",", "EntityType", ">", "resolvedEntityTypes", ")", "{", "resolvedEntityTypes", ".", "values", "(", ")", ".", "stream", "(", ")", ".", "flatMap", "(", "EntityType", "::", "getMappedByAttri...
Removes the mappedBy attributes of each OneToMany pair in the supplied map of EntityTypes
[ "Removes", "the", "mappedBy", "attributes", "of", "each", "OneToMany", "pair", "in", "the", "supplied", "map", "of", "EntityTypes" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/EntityTypeRepositoryDecorator.java#L210-L217
train
molgenis/molgenis
molgenis-jobs/src/main/java/org/molgenis/jobs/JobExecutionTemplate.java
JobExecutionTemplate.call
<T> T call(Job<T> job, Progress progress, JobExecutionContext jobExecutionContext) { return runWithContext(jobExecutionContext, () -> tryCall(job, progress)); }
java
<T> T call(Job<T> job, Progress progress, JobExecutionContext jobExecutionContext) { return runWithContext(jobExecutionContext, () -> tryCall(job, progress)); }
[ "<", "T", ">", "T", "call", "(", "Job", "<", "T", ">", "job", ",", "Progress", "progress", ",", "JobExecutionContext", "jobExecutionContext", ")", "{", "return", "runWithContext", "(", "jobExecutionContext", ",", "(", ")", "->", "tryCall", "(", "job", ",",...
Executes a job in the calling thread. @param <T> Job result type @param job the {@link Job} to execute @param progress {@link Progress} to report progress to @param jobExecutionContext {@link Authentication} to run the job with @return the result of the job execution @throws JobExecutionException if job execution thro...
[ "Executes", "a", "job", "in", "the", "calling", "thread", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-jobs/src/main/java/org/molgenis/jobs/JobExecutionTemplate.java#L28-L30
train
molgenis/molgenis
molgenis-ontology/src/main/java/org/molgenis/ontology/sorta/service/impl/SortaServiceImpl.java
SortaServiceImpl.findSynonymWithHighestNgramScore
private Entity findSynonymWithHighestNgramScore( String ontologyIri, String queryString, Entity ontologyTermEntity) { Iterable<Entity> entities = ontologyTermEntity.getEntities(OntologyTermMetadata.ONTOLOGY_TERM_SYNONYM); if (Iterables.size(entities) > 0) { String cleanedQueryString = remove...
java
private Entity findSynonymWithHighestNgramScore( String ontologyIri, String queryString, Entity ontologyTermEntity) { Iterable<Entity> entities = ontologyTermEntity.getEntities(OntologyTermMetadata.ONTOLOGY_TERM_SYNONYM); if (Iterables.size(entities) > 0) { String cleanedQueryString = remove...
[ "private", "Entity", "findSynonymWithHighestNgramScore", "(", "String", "ontologyIri", ",", "String", "queryString", ",", "Entity", "ontologyTermEntity", ")", "{", "Iterable", "<", "Entity", ">", "entities", "=", "ontologyTermEntity", ".", "getEntities", "(", "Ontolog...
A helper function to calculate the best NGram score from a list ontologyTerm synonyms
[ "A", "helper", "function", "to", "calculate", "the", "best", "NGram", "score", "from", "a", "list", "ontologyTerm", "synonyms" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-ontology/src/main/java/org/molgenis/ontology/sorta/service/impl/SortaServiceImpl.java#L320-L435
train
molgenis/molgenis
molgenis-dataexplorer/src/main/java/org/molgenis/dataexplorer/negotiator/NegotiatorController.java
NegotiatorController.generateBase64Authentication
private static String generateBase64Authentication(String username, String password) { requireNonNull(username, password); String userPass = username + ":" + password; String userPassBase64 = Base64.getEncoder().encodeToString(userPass.getBytes(UTF_8)); return "Basic " + userPassBase64; }
java
private static String generateBase64Authentication(String username, String password) { requireNonNull(username, password); String userPass = username + ":" + password; String userPassBase64 = Base64.getEncoder().encodeToString(userPass.getBytes(UTF_8)); return "Basic " + userPassBase64; }
[ "private", "static", "String", "generateBase64Authentication", "(", "String", "username", ",", "String", "password", ")", "{", "requireNonNull", "(", "username", ",", "password", ")", ";", "String", "userPass", "=", "username", "+", "\":\"", "+", "password", ";"...
Generate base64 authentication based on username and password. @return Authentication header value.
[ "Generate", "base64", "authentication", "based", "on", "username", "and", "password", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-dataexplorer/src/main/java/org/molgenis/dataexplorer/negotiator/NegotiatorController.java#L270-L275
train
molgenis/molgenis
molgenis-r/src/main/java/org/molgenis/r/RScriptExecutor.java
RScriptExecutor.executeScriptExecuteRequest
private String executeScriptExecuteRequest(String rScript) throws IOException { URI uri = getScriptExecutionUri(); HttpPost httpPost = new HttpPost(uri); NameValuePair nameValuePair = new BasicNameValuePair("x", rScript); httpPost.setEntity(new UrlEncodedFormEntity(singletonList(nameValuePair))); S...
java
private String executeScriptExecuteRequest(String rScript) throws IOException { URI uri = getScriptExecutionUri(); HttpPost httpPost = new HttpPost(uri); NameValuePair nameValuePair = new BasicNameValuePair("x", rScript); httpPost.setEntity(new UrlEncodedFormEntity(singletonList(nameValuePair))); S...
[ "private", "String", "executeScriptExecuteRequest", "(", "String", "rScript", ")", "throws", "IOException", "{", "URI", "uri", "=", "getScriptExecutionUri", "(", ")", ";", "HttpPost", "httpPost", "=", "new", "HttpPost", "(", "uri", ")", ";", "NameValuePair", "na...
Execute R script using OpenCPU @param rScript R script @return OpenCPU session key @throws IOException if error occured during script execution request
[ "Execute", "R", "script", "using", "OpenCPU" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-r/src/main/java/org/molgenis/r/RScriptExecutor.java#L79-L105
train
molgenis/molgenis
molgenis-r/src/main/java/org/molgenis/r/RScriptExecutor.java
RScriptExecutor.executeScriptGetResponseRequest
private String executeScriptGetResponseRequest( String openCpuSessionKey, String scriptOutputFilename, String outputPathname) throws IOException { String responseValue; if (scriptOutputFilename != null) { executeScriptGetFileRequest(openCpuSessionKey, scriptOutputFilename, outputPathname); ...
java
private String executeScriptGetResponseRequest( String openCpuSessionKey, String scriptOutputFilename, String outputPathname) throws IOException { String responseValue; if (scriptOutputFilename != null) { executeScriptGetFileRequest(openCpuSessionKey, scriptOutputFilename, outputPathname); ...
[ "private", "String", "executeScriptGetResponseRequest", "(", "String", "openCpuSessionKey", ",", "String", "scriptOutputFilename", ",", "String", "outputPathname", ")", "throws", "IOException", "{", "String", "responseValue", ";", "if", "(", "scriptOutputFilename", "!=", ...
Retrieve R script response using OpenCPU @param openCpuSessionKey OpenCPU session key @param scriptOutputFilename R script output filename (can be null) @param outputPathname output pathname (can be null) @return response value or null if scriptOutputFilename is not null @throws IOException if error occured during scr...
[ "Retrieve", "R", "script", "response", "using", "OpenCPU" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-r/src/main/java/org/molgenis/r/RScriptExecutor.java#L116-L127
train
molgenis/molgenis
molgenis-r/src/main/java/org/molgenis/r/RScriptExecutor.java
RScriptExecutor.executeScriptGetFileRequest
private void executeScriptGetFileRequest( String openCpuSessionKey, String scriptOutputFilename, String outputPathname) throws IOException { URI scriptGetValueResponseUri = getScriptGetFileResponseUri(openCpuSessionKey, scriptOutputFilename); HttpGet httpGet = new HttpGet(scriptGetValueRespo...
java
private void executeScriptGetFileRequest( String openCpuSessionKey, String scriptOutputFilename, String outputPathname) throws IOException { URI scriptGetValueResponseUri = getScriptGetFileResponseUri(openCpuSessionKey, scriptOutputFilename); HttpGet httpGet = new HttpGet(scriptGetValueRespo...
[ "private", "void", "executeScriptGetFileRequest", "(", "String", "openCpuSessionKey", ",", "String", "scriptOutputFilename", ",", "String", "outputPathname", ")", "throws", "IOException", "{", "URI", "scriptGetValueResponseUri", "=", "getScriptGetFileResponseUri", "(", "ope...
Retrieve R script file response using OpenCPU and write to file @param openCpuSessionKey OpenCPU session key @param scriptOutputFilename R script output filename @param outputPathname Output pathname @throws IOException if error occured during script response retrieval
[ "Retrieve", "R", "script", "file", "response", "using", "OpenCPU", "and", "write", "to", "file" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-r/src/main/java/org/molgenis/r/RScriptExecutor.java#L137-L153
train
molgenis/molgenis
molgenis-r/src/main/java/org/molgenis/r/RScriptExecutor.java
RScriptExecutor.executeScriptGetValueRequest
private String executeScriptGetValueRequest(String openCpuSessionKey) throws IOException { URI scriptGetValueResponseUri = getScriptGetValueResponseUri(openCpuSessionKey); HttpGet httpGet = new HttpGet(scriptGetValueResponseUri); String responseValue; try (CloseableHttpResponse response = httpClient.exe...
java
private String executeScriptGetValueRequest(String openCpuSessionKey) throws IOException { URI scriptGetValueResponseUri = getScriptGetValueResponseUri(openCpuSessionKey); HttpGet httpGet = new HttpGet(scriptGetValueResponseUri); String responseValue; try (CloseableHttpResponse response = httpClient.exe...
[ "private", "String", "executeScriptGetValueRequest", "(", "String", "openCpuSessionKey", ")", "throws", "IOException", "{", "URI", "scriptGetValueResponseUri", "=", "getScriptGetValueResponseUri", "(", "openCpuSessionKey", ")", ";", "HttpGet", "httpGet", "=", "new", "Http...
Retrieve and return R script STDOUT response using OpenCPU @param openCpuSessionKey OpenCPU session key @return R script STDOUT @throws IOException if error occured during script response retrieval
[ "Retrieve", "and", "return", "R", "script", "STDOUT", "response", "using", "OpenCPU" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-r/src/main/java/org/molgenis/r/RScriptExecutor.java#L162-L177
train
molgenis/molgenis
molgenis-core-ui/src/main/java/org/molgenis/core/ui/MolgenisWebAppConfig.java
MolgenisWebAppConfig.viewResolver
@Bean public ViewResolver viewResolver() { FreeMarkerViewResolver resolver = new FreeMarkerViewResolver(); resolver.setCache(true); resolver.setSuffix(".ftl"); resolver.setContentType("text/html;charset=UTF-8"); return resolver; }
java
@Bean public ViewResolver viewResolver() { FreeMarkerViewResolver resolver = new FreeMarkerViewResolver(); resolver.setCache(true); resolver.setSuffix(".ftl"); resolver.setContentType("text/html;charset=UTF-8"); return resolver; }
[ "@", "Bean", "public", "ViewResolver", "viewResolver", "(", ")", "{", "FreeMarkerViewResolver", "resolver", "=", "new", "FreeMarkerViewResolver", "(", ")", ";", "resolver", ".", "setCache", "(", "true", ")", ";", "resolver", ".", "setSuffix", "(", "\".ftl\"", ...
Enable spring freemarker viewresolver. All freemarker template names should end with '.ftl'
[ "Enable", "spring", "freemarker", "viewresolver", ".", "All", "freemarker", "template", "names", "should", "end", "with", ".", "ftl" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/MolgenisWebAppConfig.java#L290-L297
train
molgenis/molgenis
molgenis-core-ui/src/main/java/org/molgenis/core/ui/MolgenisWebAppConfig.java
MolgenisWebAppConfig.freeMarkerConfigurer
@Bean public FreeMarkerConfigurer freeMarkerConfigurer() { FreeMarkerConfigurer result = new FreeMarkerConfigurer() { @Override protected void postProcessConfiguration(Configuration config) { config.setObjectWrapper(new MolgenisFreemarkerObjectWrapper(VERSION_2_3_23)); ...
java
@Bean public FreeMarkerConfigurer freeMarkerConfigurer() { FreeMarkerConfigurer result = new FreeMarkerConfigurer() { @Override protected void postProcessConfiguration(Configuration config) { config.setObjectWrapper(new MolgenisFreemarkerObjectWrapper(VERSION_2_3_23)); ...
[ "@", "Bean", "public", "FreeMarkerConfigurer", "freeMarkerConfigurer", "(", ")", "{", "FreeMarkerConfigurer", "result", "=", "new", "FreeMarkerConfigurer", "(", ")", "{", "@", "Override", "protected", "void", "postProcessConfiguration", "(", "Configuration", "config", ...
Configure freemarker. All freemarker templates should be on the classpath in a package called 'freemarker'
[ "Configure", "freemarker", ".", "All", "freemarker", "templates", "should", "be", "on", "the", "classpath", "in", "a", "package", "called", "freemarker" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/MolgenisWebAppConfig.java#L303-L332
train
molgenis/molgenis
molgenis-data-vcf/src/main/java/org/molgenis/data/vcf/format/VcfToEntity.java
VcfToEntity.toAttributeName
private String toAttributeName(String vcfInfoFieldKey) { String attrName = infoFieldKeyToAttrNameMap.get(vcfInfoFieldKey); if (attrName == null) { throw new RuntimeException( format("Missing attribute for VCF info field [%s]", vcfInfoFieldKey)); } return attrName; }
java
private String toAttributeName(String vcfInfoFieldKey) { String attrName = infoFieldKeyToAttrNameMap.get(vcfInfoFieldKey); if (attrName == null) { throw new RuntimeException( format("Missing attribute for VCF info field [%s]", vcfInfoFieldKey)); } return attrName; }
[ "private", "String", "toAttributeName", "(", "String", "vcfInfoFieldKey", ")", "{", "String", "attrName", "=", "infoFieldKeyToAttrNameMap", ".", "get", "(", "vcfInfoFieldKey", ")", ";", "if", "(", "attrName", "==", "null", ")", "{", "throw", "new", "RuntimeExcep...
Returns the corresponding attribute name for a VCF info field key @param vcfInfoFieldKey VCF info field key @return MOLGENIS attribute name @throws RuntimeException if no attribute could be found for a VCF info field key
[ "Returns", "the", "corresponding", "attribute", "name", "for", "a", "VCF", "info", "field", "key" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-vcf/src/main/java/org/molgenis/data/vcf/format/VcfToEntity.java#L418-L425
train
molgenis/molgenis
molgenis-data-vcf/src/main/java/org/molgenis/data/vcf/format/VcfToEntity.java
VcfToEntity.determineVcfInfoFlagFields
private static Set<String> determineVcfInfoFlagFields(VcfMeta vcfMeta) { return stream(vcfMeta.getInfoMeta()) .filter(vcfInfoMeta -> vcfInfoMeta.getType().equals(VcfMetaInfo.Type.FLAG)) .map(VcfMetaInfo::getId) .collect(toSet()); }
java
private static Set<String> determineVcfInfoFlagFields(VcfMeta vcfMeta) { return stream(vcfMeta.getInfoMeta()) .filter(vcfInfoMeta -> vcfInfoMeta.getType().equals(VcfMetaInfo.Type.FLAG)) .map(VcfMetaInfo::getId) .collect(toSet()); }
[ "private", "static", "Set", "<", "String", ">", "determineVcfInfoFlagFields", "(", "VcfMeta", "vcfMeta", ")", "{", "return", "stream", "(", "vcfMeta", ".", "getInfoMeta", "(", ")", ")", ".", "filter", "(", "vcfInfoMeta", "->", "vcfInfoMeta", ".", "getType", ...
Returns a set of all possible VCF info fields of type 'Flag' @param vcfMeta VCF metadata @return Set of VCF info fields of type 'Flag'
[ "Returns", "a", "set", "of", "all", "possible", "VCF", "info", "fields", "of", "type", "Flag" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-vcf/src/main/java/org/molgenis/data/vcf/format/VcfToEntity.java#L433-L438
train
molgenis/molgenis
molgenis-data-vcf/src/main/java/org/molgenis/data/vcf/format/VcfToEntity.java
VcfToEntity.createInfoFieldKeyToAttrNameMap
private static Map<String, String> createInfoFieldKeyToAttrNameMap( VcfMeta vcfMeta, String entityTypeId) { Map<String, String> infoFieldIdToAttrNameMap = newHashMapWithExpectedSize(size(vcfMeta.getInfoMeta())); for (VcfMetaInfo info : vcfMeta.getInfoMeta()) { // according to the VCF standar...
java
private static Map<String, String> createInfoFieldKeyToAttrNameMap( VcfMeta vcfMeta, String entityTypeId) { Map<String, String> infoFieldIdToAttrNameMap = newHashMapWithExpectedSize(size(vcfMeta.getInfoMeta())); for (VcfMetaInfo info : vcfMeta.getInfoMeta()) { // according to the VCF standar...
[ "private", "static", "Map", "<", "String", ",", "String", ">", "createInfoFieldKeyToAttrNameMap", "(", "VcfMeta", "vcfMeta", ",", "String", "entityTypeId", ")", "{", "Map", "<", "String", ",", "String", ">", "infoFieldIdToAttrNameMap", "=", "newHashMapWithExpectedSi...
Returns a mapping of VCF info field keys to MOLGENIS attribute names @param vcfMeta VCF metadata @param entityTypeId entity name (that could be used to create a MOLGENIS attribute name) @return map of VCF info field keys to MOLGENIS attribute names
[ "Returns", "a", "mapping", "of", "VCF", "info", "field", "keys", "to", "MOLGENIS", "attribute", "names" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-vcf/src/main/java/org/molgenis/data/vcf/format/VcfToEntity.java#L447-L479
train
molgenis/molgenis
molgenis-data-cache/src/main/java/org/molgenis/data/cache/l1/L1Cache.java
L1Cache.get
public Optional<CacheHit<Entity>> get(String entityTypeId, Object id, EntityType entityType) { CombinedEntityCache cache = caches.get(); if (cache == null) { return Optional.empty(); } Optional<CacheHit<Entity>> result = cache.getIfPresent(entityType, id); if (result.isPresent()) { LOG.d...
java
public Optional<CacheHit<Entity>> get(String entityTypeId, Object id, EntityType entityType) { CombinedEntityCache cache = caches.get(); if (cache == null) { return Optional.empty(); } Optional<CacheHit<Entity>> result = cache.getIfPresent(entityType, id); if (result.isPresent()) { LOG.d...
[ "public", "Optional", "<", "CacheHit", "<", "Entity", ">", ">", "get", "(", "String", "entityTypeId", ",", "Object", "id", ",", "EntityType", "entityType", ")", "{", "CombinedEntityCache", "cache", "=", "caches", ".", "get", "(", ")", ";", "if", "(", "ca...
Retrieves an entity from the L1 cache based on a combination of entity name and entity id. @param entityTypeId name of the entity to retrieve @param id id value of the entity to retrieve @return an {@link Optional<CacheHit>} of which the CacheHit contains an {@link Entity} or is empty if deletion of this entity is sto...
[ "Retrieves", "an", "entity", "from", "the", "L1", "cache", "based", "on", "a", "combination", "of", "entity", "name", "and", "entity", "id", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-cache/src/main/java/org/molgenis/data/cache/l1/L1Cache.java#L94-L106
train
molgenis/molgenis
molgenis-data-cache/src/main/java/org/molgenis/data/cache/l1/L1Cache.java
L1Cache.put
public void put(String entityTypeId, Entity entity) { CombinedEntityCache entityCache = caches.get(); if (entityCache != null) { entityCache.put(entity); LOG.trace( "Added dehydrated row [{}] from entity {} to the L1 cache", entity.getIdValue(), entityTypeId); } }
java
public void put(String entityTypeId, Entity entity) { CombinedEntityCache entityCache = caches.get(); if (entityCache != null) { entityCache.put(entity); LOG.trace( "Added dehydrated row [{}] from entity {} to the L1 cache", entity.getIdValue(), entityTypeId); } }
[ "public", "void", "put", "(", "String", "entityTypeId", ",", "Entity", "entity", ")", "{", "CombinedEntityCache", "entityCache", "=", "caches", ".", "get", "(", ")", ";", "if", "(", "entityCache", "!=", "null", ")", "{", "entityCache", ".", "put", "(", "...
Puts an entity into the L1 cache, if the cache exists for the current thread. @param entityTypeId name of the entity to put into the cache @param entity the entity to put into the cache
[ "Puts", "an", "entity", "into", "the", "L1", "cache", "if", "the", "cache", "exists", "for", "the", "current", "thread", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-cache/src/main/java/org/molgenis/data/cache/l1/L1Cache.java#L114-L123
train
molgenis/molgenis
molgenis-data-cache/src/main/java/org/molgenis/data/cache/l1/L1CacheRepositoryDecorator.java
L1CacheRepositoryDecorator.findAllBatch
private List<Entity> findAllBatch(List<Object> batch) { String entityId = getEntityType().getId(); EntityType entityType = getEntityType(); List<Object> missingIds = batch .stream() .filter(id -> !l1Cache.get(entityId, id, entityType).isPresent()) .collect(toList(...
java
private List<Entity> findAllBatch(List<Object> batch) { String entityId = getEntityType().getId(); EntityType entityType = getEntityType(); List<Object> missingIds = batch .stream() .filter(id -> !l1Cache.get(entityId, id, entityType).isPresent()) .collect(toList(...
[ "private", "List", "<", "Entity", ">", "findAllBatch", "(", "List", "<", "Object", ">", "batch", ")", "{", "String", "entityId", "=", "getEntityType", "(", ")", ".", "getId", "(", ")", ";", "EntityType", "entityType", "=", "getEntityType", "(", ")", ";",...
Looks up the Entities for a List of entity IDs. Those present in the cache are returned from cache. The missing ones are retrieved from the decoratedRepository. @param batch list of entity IDs to look up @return List of {@link Entity}s
[ "Looks", "up", "the", "Entities", "for", "a", "List", "of", "entity", "IDs", ".", "Those", "present", "in", "the", "cache", "are", "returned", "from", "cache", ".", "The", "missing", "ones", "are", "retrieved", "from", "the", "decoratedRepository", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-cache/src/main/java/org/molgenis/data/cache/l1/L1CacheRepositoryDecorator.java#L99-L120
train
molgenis/molgenis
molgenis-data-cache/src/main/java/org/molgenis/data/cache/l1/L1CacheRepositoryDecorator.java
L1CacheRepositoryDecorator.evictBiDiReferencedEntityTypes
private void evictBiDiReferencedEntityTypes() { getEntityType().getMappedByAttributes().map(Attribute::getRefEntity).forEach(l1Cache::evictAll); getEntityType() .getInversedByAttributes() .map(Attribute::getRefEntity) .forEach(l1Cache::evictAll); }
java
private void evictBiDiReferencedEntityTypes() { getEntityType().getMappedByAttributes().map(Attribute::getRefEntity).forEach(l1Cache::evictAll); getEntityType() .getInversedByAttributes() .map(Attribute::getRefEntity) .forEach(l1Cache::evictAll); }
[ "private", "void", "evictBiDiReferencedEntityTypes", "(", ")", "{", "getEntityType", "(", ")", ".", "getMappedByAttributes", "(", ")", ".", "map", "(", "Attribute", "::", "getRefEntity", ")", ".", "forEach", "(", "l1Cache", "::", "evictAll", ")", ";", "getEnti...
Evict all entries for entity types referred to by this entity type through a bidirectional relation.
[ "Evict", "all", "entries", "for", "entity", "types", "referred", "to", "by", "this", "entity", "type", "through", "a", "bidirectional", "relation", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-cache/src/main/java/org/molgenis/data/cache/l1/L1CacheRepositoryDecorator.java#L186-L192
train
molgenis/molgenis
molgenis-data-cache/src/main/java/org/molgenis/data/cache/l1/L1CacheRepositoryDecorator.java
L1CacheRepositoryDecorator.evictBiDiReferencedEntities
private void evictBiDiReferencedEntities(Entity entity) { Stream<EntityKey> backreffingEntities = getEntityType() .getMappedByAttributes() .flatMap(mappedByAttr -> Streams.stream(entity.getEntities(mappedByAttr.getName()))) .map(EntityKey::create); Stream<EntityKey> m...
java
private void evictBiDiReferencedEntities(Entity entity) { Stream<EntityKey> backreffingEntities = getEntityType() .getMappedByAttributes() .flatMap(mappedByAttr -> Streams.stream(entity.getEntities(mappedByAttr.getName()))) .map(EntityKey::create); Stream<EntityKey> m...
[ "private", "void", "evictBiDiReferencedEntities", "(", "Entity", "entity", ")", "{", "Stream", "<", "EntityKey", ">", "backreffingEntities", "=", "getEntityType", "(", ")", ".", "getMappedByAttributes", "(", ")", ".", "flatMap", "(", "mappedByAttr", "->", "Streams...
Evict all entity instances referenced by this entity instance through a bidirectional relation. @param entity the entity whose references need to be evicted
[ "Evict", "all", "entity", "instances", "referenced", "by", "this", "entity", "instance", "through", "a", "bidirectional", "relation", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-cache/src/main/java/org/molgenis/data/cache/l1/L1CacheRepositoryDecorator.java#L199-L213
train
molgenis/molgenis
molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceImpl.java
SemanticSearchServiceImpl.findAttributes
public Hits<ExplainedAttribute> findAttributes( EntityType sourceEntityType, Set<String> queryTerms, Collection<OntologyTerm> ontologyTerms) { Iterable<String> attributeIdentifiers = semanticSearchServiceHelper.getAttributeIdentifiers(sourceEntityType); QueryRule disMaxQueryRule = semanti...
java
public Hits<ExplainedAttribute> findAttributes( EntityType sourceEntityType, Set<String> queryTerms, Collection<OntologyTerm> ontologyTerms) { Iterable<String> attributeIdentifiers = semanticSearchServiceHelper.getAttributeIdentifiers(sourceEntityType); QueryRule disMaxQueryRule = semanti...
[ "public", "Hits", "<", "ExplainedAttribute", ">", "findAttributes", "(", "EntityType", "sourceEntityType", ",", "Set", "<", "String", ">", "queryTerms", ",", "Collection", "<", "OntologyTerm", ">", "ontologyTerms", ")", "{", "Iterable", "<", "String", ">", "attr...
public for testability
[ "public", "for", "testability" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceImpl.java#L92-L147
train
molgenis/molgenis
molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceImpl.java
SemanticSearchServiceImpl.createLexicalSearchQueryTerms
public Set<String> createLexicalSearchQueryTerms( Attribute targetAttribute, Set<String> searchTerms) { Set<String> queryTerms = new HashSet<>(); if (searchTerms != null && !searchTerms.isEmpty()) { queryTerms.addAll(searchTerms); } if (queryTerms.isEmpty()) { if (StringUtils.isNotBl...
java
public Set<String> createLexicalSearchQueryTerms( Attribute targetAttribute, Set<String> searchTerms) { Set<String> queryTerms = new HashSet<>(); if (searchTerms != null && !searchTerms.isEmpty()) { queryTerms.addAll(searchTerms); } if (queryTerms.isEmpty()) { if (StringUtils.isNotBl...
[ "public", "Set", "<", "String", ">", "createLexicalSearchQueryTerms", "(", "Attribute", "targetAttribute", ",", "Set", "<", "String", ">", "searchTerms", ")", "{", "Set", "<", "String", ">", "queryTerms", "=", "new", "HashSet", "<>", "(", ")", ";", "if", "...
A helper function to create a list of queryTerms based on the information from the targetAttribute as well as user defined searchTerms. If the user defined searchTerms exist, the targetAttribute information will not be used. @return list of queryTerms
[ "A", "helper", "function", "to", "create", "a", "list", "of", "queryTerms", "based", "on", "the", "information", "from", "the", "targetAttribute", "as", "well", "as", "user", "defined", "searchTerms", ".", "If", "the", "user", "defined", "searchTerms", "exist"...
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceImpl.java#L241-L260
train
molgenis/molgenis
molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceImpl.java
SemanticSearchServiceImpl.convertAttributeToExplainedAttribute
public Set<ExplainedQueryString> convertAttributeToExplainedAttribute( Attribute attribute, Map<String, String> collectExpandedQueryMap, Query<Entity> query) { EntityType attributeMetaData = dataService.getEntityType(ATTRIBUTE_META_DATA); String attributeID = attribute.getIdentifier(); Explanation exp...
java
public Set<ExplainedQueryString> convertAttributeToExplainedAttribute( Attribute attribute, Map<String, String> collectExpandedQueryMap, Query<Entity> query) { EntityType attributeMetaData = dataService.getEntityType(ATTRIBUTE_META_DATA); String attributeID = attribute.getIdentifier(); Explanation exp...
[ "public", "Set", "<", "ExplainedQueryString", ">", "convertAttributeToExplainedAttribute", "(", "Attribute", "attribute", ",", "Map", "<", "String", ",", "String", ">", "collectExpandedQueryMap", ",", "Query", "<", "Entity", ">", "query", ")", "{", "EntityType", "...
A helper function to explain each of the matched attributes returned by the explain-API @param attribute The attribute found @param collectExpandedQueryMap ? @param query the query used to find the attribute @return Set of explained query strings
[ "A", "helper", "function", "to", "explain", "each", "of", "the", "matched", "attributes", "returned", "by", "the", "explain", "-", "API" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceImpl.java#L270-L278
train
molgenis/molgenis
molgenis-data-import/src/main/java/org/molgenis/data/importer/PackageResolver.java
PackageResolver.resolvePackages
public static List<Entity> resolvePackages(Iterable<Entity> packageRepo) { List<Entity> resolved = new LinkedList<>(); if ((packageRepo == null) || Iterables.isEmpty(packageRepo)) return resolved; List<Entity> unresolved = new ArrayList<>(); Map<String, Entity> resolvedByName = new HashMap<>(); fo...
java
public static List<Entity> resolvePackages(Iterable<Entity> packageRepo) { List<Entity> resolved = new LinkedList<>(); if ((packageRepo == null) || Iterables.isEmpty(packageRepo)) return resolved; List<Entity> unresolved = new ArrayList<>(); Map<String, Entity> resolvedByName = new HashMap<>(); fo...
[ "public", "static", "List", "<", "Entity", ">", "resolvePackages", "(", "Iterable", "<", "Entity", ">", "packageRepo", ")", "{", "List", "<", "Entity", ">", "resolved", "=", "new", "LinkedList", "<>", "(", ")", ";", "if", "(", "(", "packageRepo", "==", ...
Resolves package fullNames by looping through all the packages and their parents
[ "Resolves", "package", "fullNames", "by", "looping", "through", "all", "the", "packages", "and", "their", "parents" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/PackageResolver.java#L22-L65
train
molgenis/molgenis
molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/repository/OntologyTermRepository.java
OntologyTermRepository.getOntologyTermDistance
public int getOntologyTermDistance(OntologyTerm ontologyTerm1, OntologyTerm ontologyTerm2) { String nodePath1 = getOntologyTermNodePath(ontologyTerm1); String nodePath2 = getOntologyTermNodePath(ontologyTerm2); if (StringUtils.isEmpty(nodePath1)) { throw new MolgenisDataAccessException( "Th...
java
public int getOntologyTermDistance(OntologyTerm ontologyTerm1, OntologyTerm ontologyTerm2) { String nodePath1 = getOntologyTermNodePath(ontologyTerm1); String nodePath2 = getOntologyTermNodePath(ontologyTerm2); if (StringUtils.isEmpty(nodePath1)) { throw new MolgenisDataAccessException( "Th...
[ "public", "int", "getOntologyTermDistance", "(", "OntologyTerm", "ontologyTerm1", ",", "OntologyTerm", "ontologyTerm2", ")", "{", "String", "nodePath1", "=", "getOntologyTermNodePath", "(", "ontologyTerm1", ")", ";", "String", "nodePath2", "=", "getOntologyTermNodePath", ...
Calculate the distance between any two ontology terms in the ontology tree structure by calculating the difference in nodePaths. @return the distance between two ontology terms
[ "Calculate", "the", "distance", "between", "any", "two", "ontology", "terms", "in", "the", "ontology", "tree", "structure", "by", "calculating", "the", "difference", "in", "nodePaths", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/repository/OntologyTermRepository.java#L175-L190
train
molgenis/molgenis
molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/repository/OntologyTermRepository.java
OntologyTermRepository.getChildren
public List<OntologyTerm> getChildren(OntologyTerm ontologyTerm) { Iterable<org.molgenis.ontology.core.meta.OntologyTerm> ontologyTermEntities = () -> dataService .query(ONTOLOGY_TERM, org.molgenis.ontology.core.meta.OntologyTerm.class) .eq(ONTOLOGY_TERM_IRI, onto...
java
public List<OntologyTerm> getChildren(OntologyTerm ontologyTerm) { Iterable<org.molgenis.ontology.core.meta.OntologyTerm> ontologyTermEntities = () -> dataService .query(ONTOLOGY_TERM, org.molgenis.ontology.core.meta.OntologyTerm.class) .eq(ONTOLOGY_TERM_IRI, onto...
[ "public", "List", "<", "OntologyTerm", ">", "getChildren", "(", "OntologyTerm", "ontologyTerm", ")", "{", "Iterable", "<", "org", ".", "molgenis", ".", "ontology", ".", "core", ".", "meta", ".", "OntologyTerm", ">", "ontologyTermEntities", "=", "(", ")", "->...
Retrieve all descendant ontology terms @return a list of {@link OntologyTerm}
[ "Retrieve", "all", "descendant", "ontology", "terms" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/repository/OntologyTermRepository.java#L233-L253
train
molgenis/molgenis
molgenis-data-excel/src/main/java/org/molgenis/data/excel/ExcelUtils.java
ExcelUtils.toValue
static String toValue(Cell cell, List<CellProcessor> cellProcessors) { String value; switch (cell.getCellTypeEnum()) { case BLANK: value = null; break; case STRING: value = cell.getStringCellValue(); break; case NUMERIC: if (DateUtil.isCellDateFormatted(...
java
static String toValue(Cell cell, List<CellProcessor> cellProcessors) { String value; switch (cell.getCellTypeEnum()) { case BLANK: value = null; break; case STRING: value = cell.getStringCellValue(); break; case NUMERIC: if (DateUtil.isCellDateFormatted(...
[ "static", "String", "toValue", "(", "Cell", "cell", ",", "List", "<", "CellProcessor", ">", "cellProcessors", ")", "{", "String", "value", ";", "switch", "(", "cell", ".", "getCellTypeEnum", "(", ")", ")", "{", "case", "BLANK", ":", "value", "=", "null",...
Gets a cell value as String and process the value with the given cellProcessors
[ "Gets", "a", "cell", "value", "as", "String", "and", "process", "the", "value", "with", "the", "given", "cellProcessors" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-excel/src/main/java/org/molgenis/data/excel/ExcelUtils.java#L35-L124
train
molgenis/molgenis
molgenis-data-excel/src/main/java/org/molgenis/data/excel/ExcelUtils.java
ExcelUtils.formatUTCDateAsLocalDateTime
private static String formatUTCDateAsLocalDateTime(Date javaDate) { // Now back from start of day in UTC to LocalDateTime to express that we don't know the // timezone. LocalDateTime localDateTime = javaDate.toInstant().atZone(UTC).toLocalDateTime(); // And format to string return localDateTime.toSt...
java
private static String formatUTCDateAsLocalDateTime(Date javaDate) { // Now back from start of day in UTC to LocalDateTime to express that we don't know the // timezone. LocalDateTime localDateTime = javaDate.toInstant().atZone(UTC).toLocalDateTime(); // And format to string return localDateTime.toSt...
[ "private", "static", "String", "formatUTCDateAsLocalDateTime", "(", "Date", "javaDate", ")", "{", "// Now back from start of day in UTC to LocalDateTime to express that we don't know the", "// timezone.", "LocalDateTime", "localDateTime", "=", "javaDate", ".", "toInstant", "(", "...
Formats parsed Date as LocalDateTime string at zone UTC to express that we don't know the timezone. @param javaDate Parsed Date representing start of day in UTC @return Formatted {@link LocalDateTime} string of the java.util.Date
[ "Formats", "parsed", "Date", "as", "LocalDateTime", "string", "at", "zone", "UTC", "to", "express", "that", "we", "don", "t", "know", "the", "timezone", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-excel/src/main/java/org/molgenis/data/excel/ExcelUtils.java#L159-L165
train
molgenis/molgenis
molgenis-core-ui/src/main/java/org/molgenis/core/ui/MolgenisUiUtils.java
MolgenisUiUtils.getCurrentUri
public static String getCurrentUri() { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(); StringBuilder uri = new StringBuilder(); uri.append(request.getAttribute("javax.servlet.forward.request_uri")); if (StringUtils.isNotBl...
java
public static String getCurrentUri() { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(); StringBuilder uri = new StringBuilder(); uri.append(request.getAttribute("javax.servlet.forward.request_uri")); if (StringUtils.isNotBl...
[ "public", "static", "String", "getCurrentUri", "(", ")", "{", "HttpServletRequest", "request", "=", "(", "(", "ServletRequestAttributes", ")", "RequestContextHolder", ".", "currentRequestAttributes", "(", ")", ")", ".", "getRequest", "(", ")", ";", "StringBuilder", ...
Gets the uri which is currently visible in the browser. <p>Must be used in a Spring environment
[ "Gets", "the", "uri", "which", "is", "currently", "visible", "in", "the", "browser", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/MolgenisUiUtils.java#L16-L28
train