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-data-platform/src/main/java/org/molgenis/data/meta/system/SystemEntityTypePersister.java | SystemEntityTypePersister.injectExistingEntityTypeAttributeIdentifiers | private void injectExistingEntityTypeAttributeIdentifiers(
List<? extends EntityType> entityTypes) {
Map<String, EntityType> existingEntityTypeMap =
dataService
.findAll(ENTITY_TYPE_META_DATA, EntityType.class)
.collect(toMap(EntityType::getId, entityType -> entityType));
... | java | private void injectExistingEntityTypeAttributeIdentifiers(
List<? extends EntityType> entityTypes) {
Map<String, EntityType> existingEntityTypeMap =
dataService
.findAll(ENTITY_TYPE_META_DATA, EntityType.class)
.collect(toMap(EntityType::getId, entityType -> entityType));
... | [
"private",
"void",
"injectExistingEntityTypeAttributeIdentifiers",
"(",
"List",
"<",
"?",
"extends",
"EntityType",
">",
"entityTypes",
")",
"{",
"Map",
"<",
"String",
",",
"EntityType",
">",
"existingEntityTypeMap",
"=",
"dataService",
".",
"findAll",
"(",
"ENTITY_T... | Inject existing attribute identifiers in system entity types
@param entityTypes system entity types | [
"Inject",
"existing",
"attribute",
"identifiers",
"in",
"system",
"entity",
"types"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-platform/src/main/java/org/molgenis/data/meta/system/SystemEntityTypePersister.java#L159-L188 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java | PostgreSqlRepositoryCollection.addAttributeInternal | private void addAttributeInternal(EntityType entityType, Attribute attr) {
if (!isPersisted(attr)) {
return;
}
if (isMultipleReferenceType(attr)) {
createJunctionTable(entityType, attr);
if (attr.getDefaultValue() != null && !attr.isNillable()) {
@SuppressWarnings("unchecked")
... | java | private void addAttributeInternal(EntityType entityType, Attribute attr) {
if (!isPersisted(attr)) {
return;
}
if (isMultipleReferenceType(attr)) {
createJunctionTable(entityType, attr);
if (attr.getDefaultValue() != null && !attr.isNillable()) {
@SuppressWarnings("unchecked")
... | [
"private",
"void",
"addAttributeInternal",
"(",
"EntityType",
"entityType",
",",
"Attribute",
"attr",
")",
"{",
"if",
"(",
"!",
"isPersisted",
"(",
"attr",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"isMultipleReferenceType",
"(",
"attr",
")",
")",
"{",... | Add attribute to entityType.
@param entityType the {@link EntityType} to add attribute to
@param attr attribute to add | [
"Add",
"attribute",
"to",
"entityType",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java#L287-L306 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java | PostgreSqlRepositoryCollection.isPersisted | private static boolean isPersisted(Attribute attr) {
return !attr.hasExpression()
&& attr.getDataType() != COMPOUND
&& !(attr.getDataType() == ONE_TO_MANY && attr.isMappedBy());
} | java | private static boolean isPersisted(Attribute attr) {
return !attr.hasExpression()
&& attr.getDataType() != COMPOUND
&& !(attr.getDataType() == ONE_TO_MANY && attr.isMappedBy());
} | [
"private",
"static",
"boolean",
"isPersisted",
"(",
"Attribute",
"attr",
")",
"{",
"return",
"!",
"attr",
".",
"hasExpression",
"(",
")",
"&&",
"attr",
".",
"getDataType",
"(",
")",
"!=",
"COMPOUND",
"&&",
"!",
"(",
"attr",
".",
"getDataType",
"(",
")",
... | Indicates if the attribute is persisted in the database. Compound attributes, computed
attributes with an expression and one-to-many mappedBy attributes are not persisted.
@param attr the attribute to check
@return boolean indicating if the entity is persisted in the database. | [
"Indicates",
"if",
"the",
"attribute",
"is",
"persisted",
"in",
"the",
"database",
".",
"Compound",
"attributes",
"computed",
"attributes",
"with",
"an",
"expression",
"and",
"one",
"-",
"to",
"-",
"many",
"mappedBy",
"attributes",
"are",
"not",
"persisted",
"... | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java#L345-L349 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java | PostgreSqlRepositoryCollection.updateColumn | private void updateColumn(EntityType entityType, Attribute attr, Attribute updatedAttr) {
// nullable changes
if (!Objects.equals(attr.isNillable(), updatedAttr.isNillable())) {
updateNillable(entityType, attr, updatedAttr);
}
// unique changes
if (!Objects.equals(attr.isUnique(), updatedAttr... | java | private void updateColumn(EntityType entityType, Attribute attr, Attribute updatedAttr) {
// nullable changes
if (!Objects.equals(attr.isNillable(), updatedAttr.isNillable())) {
updateNillable(entityType, attr, updatedAttr);
}
// unique changes
if (!Objects.equals(attr.isUnique(), updatedAttr... | [
"private",
"void",
"updateColumn",
"(",
"EntityType",
"entityType",
",",
"Attribute",
"attr",
",",
"Attribute",
"updatedAttr",
")",
"{",
"// nullable changes",
"if",
"(",
"!",
"Objects",
".",
"equals",
"(",
"attr",
".",
"isNillable",
"(",
")",
",",
"updatedAtt... | Updates database column based on attribute changes.
@param entityType entity meta data
@param attr current attribute
@param updatedAttr updated attribute | [
"Updates",
"database",
"column",
"based",
"on",
"attribute",
"changes",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java#L358-L396 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java | PostgreSqlRepositoryCollection.updateRefEntity | private void updateRefEntity(EntityType entityType, Attribute attr, Attribute updatedAttr) {
if (isSingleReferenceType(attr) && isSingleReferenceType(updatedAttr)) {
dropForeignKey(entityType, attr);
if (attr.getRefEntity().getIdAttribute().getDataType()
!= updatedAttr.getRefEntity().getIdAtt... | java | private void updateRefEntity(EntityType entityType, Attribute attr, Attribute updatedAttr) {
if (isSingleReferenceType(attr) && isSingleReferenceType(updatedAttr)) {
dropForeignKey(entityType, attr);
if (attr.getRefEntity().getIdAttribute().getDataType()
!= updatedAttr.getRefEntity().getIdAtt... | [
"private",
"void",
"updateRefEntity",
"(",
"EntityType",
"entityType",
",",
"Attribute",
"attr",
",",
"Attribute",
"updatedAttr",
")",
"{",
"if",
"(",
"isSingleReferenceType",
"(",
"attr",
")",
"&&",
"isSingleReferenceType",
"(",
"updatedAttr",
")",
")",
"{",
"d... | Updates foreign keys based on referenced entity changes.
@param entityType entity meta data
@param attr current attribute
@param updatedAttr updated attribute | [
"Updates",
"foreign",
"keys",
"based",
"on",
"referenced",
"entity",
"changes",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java#L405-L425 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java | PostgreSqlRepositoryCollection.updateEnumOptions | private void updateEnumOptions(EntityType entityType, Attribute attr, Attribute updatedAttr) {
if (attr.getDataType() == ENUM) {
if (updatedAttr.getDataType() == ENUM) {
// update check constraint
dropCheckConstraint(entityType, attr);
createCheckConstraint(entityType, updatedAttr);
... | java | private void updateEnumOptions(EntityType entityType, Attribute attr, Attribute updatedAttr) {
if (attr.getDataType() == ENUM) {
if (updatedAttr.getDataType() == ENUM) {
// update check constraint
dropCheckConstraint(entityType, attr);
createCheckConstraint(entityType, updatedAttr);
... | [
"private",
"void",
"updateEnumOptions",
"(",
"EntityType",
"entityType",
",",
"Attribute",
"attr",
",",
"Attribute",
"updatedAttr",
")",
"{",
"if",
"(",
"attr",
".",
"getDataType",
"(",
")",
"==",
"ENUM",
")",
"{",
"if",
"(",
"updatedAttr",
".",
"getDataType... | Updates check constraint based on enum value changes.
@param entityType entity meta data
@param attr current attribute
@param updatedAttr updated attribute | [
"Updates",
"check",
"constraint",
"based",
"on",
"enum",
"value",
"changes",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java#L434-L449 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java | PostgreSqlRepositoryCollection.updateDataType | private void updateDataType(EntityType entityType, Attribute attr, Attribute updatedAttr) {
Attribute idAttr = entityType.getIdAttribute();
if (idAttr != null && idAttr.getName().equals(attr.getName())) {
throw new MolgenisDataException(
format(
"Data type of entity [%s] attribute ... | java | private void updateDataType(EntityType entityType, Attribute attr, Attribute updatedAttr) {
Attribute idAttr = entityType.getIdAttribute();
if (idAttr != null && idAttr.getName().equals(attr.getName())) {
throw new MolgenisDataException(
format(
"Data type of entity [%s] attribute ... | [
"private",
"void",
"updateDataType",
"(",
"EntityType",
"entityType",
",",
"Attribute",
"attr",
",",
"Attribute",
"updatedAttr",
")",
"{",
"Attribute",
"idAttr",
"=",
"entityType",
".",
"getIdAttribute",
"(",
")",
";",
"if",
"(",
"idAttr",
"!=",
"null",
"&&",
... | Updates column data type and foreign key constraints based on data type update.
@param entityType entity meta data
@param attr current attribute
@param updatedAttr updated attribute | [
"Updates",
"column",
"data",
"type",
"and",
"foreign",
"key",
"constraints",
"based",
"on",
"data",
"type",
"update",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java#L472-L508 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java | PostgreSqlRepositoryCollection.updateUnique | private void updateUnique(EntityType entityType, Attribute attr, Attribute updatedAttr) {
if (attr.isUnique() && !updatedAttr.isUnique()) {
Attribute idAttr = entityType.getIdAttribute();
if (idAttr != null && idAttr.getName().equals(attr.getName())) {
throw new MolgenisDataException(
... | java | private void updateUnique(EntityType entityType, Attribute attr, Attribute updatedAttr) {
if (attr.isUnique() && !updatedAttr.isUnique()) {
Attribute idAttr = entityType.getIdAttribute();
if (idAttr != null && idAttr.getName().equals(attr.getName())) {
throw new MolgenisDataException(
... | [
"private",
"void",
"updateUnique",
"(",
"EntityType",
"entityType",
",",
"Attribute",
"attr",
",",
"Attribute",
"updatedAttr",
")",
"{",
"if",
"(",
"attr",
".",
"isUnique",
"(",
")",
"&&",
"!",
"updatedAttr",
".",
"isUnique",
"(",
")",
")",
"{",
"Attribute... | Updates unique constraint based on attribute unique changes.
@param entityType entity meta data
@param attr current attribute
@param updatedAttr updated attribute | [
"Updates",
"unique",
"constraint",
"based",
"on",
"attribute",
"unique",
"changes",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java#L658-L672 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java | PostgreSqlRepositoryCollection.updateReadonly | private void updateReadonly(EntityType entityType, Attribute attr, Attribute updatedAttr) {
Map<String, Attribute> readonlyTableAttrs =
getTableAttributesReadonly(entityType)
.collect(toLinkedMap(Attribute::getName, Function.identity()));
if (!readonlyTableAttrs.isEmpty()) {
dropTableT... | java | private void updateReadonly(EntityType entityType, Attribute attr, Attribute updatedAttr) {
Map<String, Attribute> readonlyTableAttrs =
getTableAttributesReadonly(entityType)
.collect(toLinkedMap(Attribute::getName, Function.identity()));
if (!readonlyTableAttrs.isEmpty()) {
dropTableT... | [
"private",
"void",
"updateReadonly",
"(",
"EntityType",
"entityType",
",",
"Attribute",
"attr",
",",
"Attribute",
"updatedAttr",
")",
"{",
"Map",
"<",
"String",
",",
"Attribute",
">",
"readonlyTableAttrs",
"=",
"getTableAttributesReadonly",
"(",
"entityType",
")",
... | Updates triggers and functions based on attribute readonly changes.
@param entityType entity meta data
@param attr current attribute
@param updatedAttr updated attribute | [
"Updates",
"triggers",
"and",
"functions",
"based",
"on",
"attribute",
"readonly",
"changes",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java#L681-L698 | train |
molgenis/molgenis | molgenis-data-index/src/main/java/org/molgenis/data/index/IndexActionRepositoryDecorator.java | IndexActionRepositoryDecorator.registerRefEntityIndexActions | private void registerRefEntityIndexActions() {
// bidirectional attribute: register indexing actions for other side
getEntityType()
.getMappedByAttributes()
.forEach(
mappedByAttr -> {
EntityType refEntity = mappedByAttr.getRefEntity();
indexActionRegister... | java | private void registerRefEntityIndexActions() {
// bidirectional attribute: register indexing actions for other side
getEntityType()
.getMappedByAttributes()
.forEach(
mappedByAttr -> {
EntityType refEntity = mappedByAttr.getRefEntity();
indexActionRegister... | [
"private",
"void",
"registerRefEntityIndexActions",
"(",
")",
"{",
"// bidirectional attribute: register indexing actions for other side",
"getEntityType",
"(",
")",
".",
"getMappedByAttributes",
"(",
")",
".",
"forEach",
"(",
"mappedByAttr",
"->",
"{",
"EntityType",
"refEn... | Register index actions for entity types with bidirectional attribute values. | [
"Register",
"index",
"actions",
"for",
"entity",
"types",
"with",
"bidirectional",
"attribute",
"values",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-index/src/main/java/org/molgenis/data/index/IndexActionRepositoryDecorator.java#L100-L117 | train |
molgenis/molgenis | molgenis-data-index/src/main/java/org/molgenis/data/index/IndexActionRepositoryDecorator.java | IndexActionRepositoryDecorator.registerRefEntityIndexActions | private void registerRefEntityIndexActions(Entity entity) {
// bidirectional attribute: register indexing actions for other side
getEntityType()
.getMappedByAttributes()
.forEach(
mappedByAttr -> {
EntityType mappedByAttrRefEntity = mappedByAttr.getRefEntity();
... | java | private void registerRefEntityIndexActions(Entity entity) {
// bidirectional attribute: register indexing actions for other side
getEntityType()
.getMappedByAttributes()
.forEach(
mappedByAttr -> {
EntityType mappedByAttrRefEntity = mappedByAttr.getRefEntity();
... | [
"private",
"void",
"registerRefEntityIndexActions",
"(",
"Entity",
"entity",
")",
"{",
"// bidirectional attribute: register indexing actions for other side",
"getEntityType",
"(",
")",
".",
"getMappedByAttributes",
"(",
")",
".",
"forEach",
"(",
"mappedByAttr",
"->",
"{",
... | Register index actions for the given entity for entity types with bidirectional attribute
values.
@param entity entity to add or delete | [
"Register",
"index",
"actions",
"for",
"the",
"given",
"entity",
"for",
"entity",
"types",
"with",
"bidirectional",
"attribute",
"values",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-index/src/main/java/org/molgenis/data/index/IndexActionRepositoryDecorator.java#L125-L151 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepository.java | PostgreSqlRepository.selectMrefIDsForAttribute | private Multimap<Object, Object> selectMrefIDsForAttribute(
EntityType entityType,
AttributeType idAttributeDataType,
Attribute mrefAttr,
Set<Object> ids,
AttributeType refIdDataType) {
Stopwatch stopwatch = null;
if (LOG.isTraceEnabled()) stopwatch = createStarted();
String j... | java | private Multimap<Object, Object> selectMrefIDsForAttribute(
EntityType entityType,
AttributeType idAttributeDataType,
Attribute mrefAttr,
Set<Object> ids,
AttributeType refIdDataType) {
Stopwatch stopwatch = null;
if (LOG.isTraceEnabled()) stopwatch = createStarted();
String j... | [
"private",
"Multimap",
"<",
"Object",
",",
"Object",
">",
"selectMrefIDsForAttribute",
"(",
"EntityType",
"entityType",
",",
"AttributeType",
"idAttributeDataType",
",",
"Attribute",
"mrefAttr",
",",
"Set",
"<",
"Object",
">",
"ids",
",",
"AttributeType",
"refIdData... | Selects MREF IDs for an MREF attribute from the junction table, in the order of the MREF
attribute value.
@param entityType EntityType for the entities
@param idAttributeDataType {@link AttributeType} of the ID attribute of the entity
@param mrefAttr Attribute of the MREF attribute to select the values for
@param ids ... | [
"Selects",
"MREF",
"IDs",
"for",
"an",
"MREF",
"attribute",
"from",
"the",
"junction",
"table",
"in",
"the",
"order",
"of",
"the",
"MREF",
"attribute",
"value",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepository.java#L381-L406 | train |
molgenis/molgenis | molgenis-jobs/src/main/java/org/molgenis/jobs/model/JobExecution.java | JobExecution.appendLog | void appendLog(String formattedMessage) {
if (logTruncated) return;
String combined = join(getLog(), formattedMessage);
if (combined.length() > MAX_LOG_LENGTH) {
String truncated = abbreviate(combined, MAX_LOG_LENGTH - TRUNCATION_BANNER.length() * 2 - 2);
combined = join(new String[] {TRUNCATION... | java | void appendLog(String formattedMessage) {
if (logTruncated) return;
String combined = join(getLog(), formattedMessage);
if (combined.length() > MAX_LOG_LENGTH) {
String truncated = abbreviate(combined, MAX_LOG_LENGTH - TRUNCATION_BANNER.length() * 2 - 2);
combined = join(new String[] {TRUNCATION... | [
"void",
"appendLog",
"(",
"String",
"formattedMessage",
")",
"{",
"if",
"(",
"logTruncated",
")",
"return",
";",
"String",
"combined",
"=",
"join",
"(",
"getLog",
"(",
")",
",",
"formattedMessage",
")",
";",
"if",
"(",
"combined",
".",
"length",
"(",
")"... | Appends a log message to the execution log. The first time the log exceeds MAX_LOG_LENGTH, it
gets truncated and the TRUNCATION_BANNER gets added. Subsequent calls to appendLog will be
ignored.
@param formattedMessage The formatted message to append to the log. | [
"Appends",
"a",
"log",
"message",
"to",
"the",
"execution",
"log",
".",
"The",
"first",
"time",
"the",
"log",
"exceeds",
"MAX_LOG_LENGTH",
"it",
"gets",
"truncated",
"and",
"the",
"TRUNCATION_BANNER",
"gets",
"added",
".",
"Subsequent",
"calls",
"to",
"appendL... | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-jobs/src/main/java/org/molgenis/jobs/model/JobExecution.java#L215-L224 | train |
molgenis/molgenis | molgenis-scripts/src/main/java/org/molgenis/script/SavedScriptRunner.java | SavedScriptRunner.runScript | public ScriptResult runScript(String scriptName, Map<String, Object> parameters) {
Script script =
dataService.query(SCRIPT, Script.class).eq(ScriptMetadata.NAME, scriptName).findOne();
if (script == null) {
throw new UnknownEntityException(SCRIPT, scriptName);
}
if (script.getParameters(... | java | public ScriptResult runScript(String scriptName, Map<String, Object> parameters) {
Script script =
dataService.query(SCRIPT, Script.class).eq(ScriptMetadata.NAME, scriptName).findOne();
if (script == null) {
throw new UnknownEntityException(SCRIPT, scriptName);
}
if (script.getParameters(... | [
"public",
"ScriptResult",
"runScript",
"(",
"String",
"scriptName",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
")",
"{",
"Script",
"script",
"=",
"dataService",
".",
"query",
"(",
"SCRIPT",
",",
"Script",
".",
"class",
")",
".",
"eq",
"... | Run a script with parameters.
@param scriptName name of the script to run
@param parameters parameters for the script
@return ScriptResult
@throws UnknownScriptException if scriptName is unknown
@throws GenerateScriptException , if parameter is missing | [
"Run",
"a",
"script",
"with",
"parameters",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-scripts/src/main/java/org/molgenis/script/SavedScriptRunner.java#L71-L112 | train |
molgenis/molgenis | molgenis-data-elasticsearch/src/main/java/org/molgenis/data/elasticsearch/AggregateResponseParser.java | AggregateResponseParser.convertIdtoLabelLabels | private void convertIdtoLabelLabels(
List<Object> idLabels, EntityType entityType, DataService dataService) {
final int nrLabels = idLabels.size();
if (nrLabels > 0) {
// Get entities for ids
// Use Iterables.transform to work around List<String> to Iterable<Object> cast error
Stream<Obj... | java | private void convertIdtoLabelLabels(
List<Object> idLabels, EntityType entityType, DataService dataService) {
final int nrLabels = idLabels.size();
if (nrLabels > 0) {
// Get entities for ids
// Use Iterables.transform to work around List<String> to Iterable<Object> cast error
Stream<Obj... | [
"private",
"void",
"convertIdtoLabelLabels",
"(",
"List",
"<",
"Object",
">",
"idLabels",
",",
"EntityType",
"entityType",
",",
"DataService",
"dataService",
")",
"{",
"final",
"int",
"nrLabels",
"=",
"idLabels",
".",
"size",
"(",
")",
";",
"if",
"(",
"nrLab... | Convert matrix labels that contain ids to label attribute values. Keeps in mind that the last
label on a axis is "Total". | [
"Convert",
"matrix",
"labels",
"that",
"contain",
"ids",
"to",
"label",
"attribute",
"values",
".",
"Keeps",
"in",
"mind",
"that",
"the",
"last",
"label",
"on",
"a",
"axis",
"is",
"Total",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-elasticsearch/src/main/java/org/molgenis/data/elasticsearch/AggregateResponseParser.java#L307-L336 | train |
molgenis/molgenis | molgenis-security-core/src/main/java/org/molgenis/security/core/utils/SecurityUtils.java | SecurityUtils.getCurrentUsername | public static @Nullable @CheckForNull String getCurrentUsername() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication == null) {
return null;
}
return getUsername(authentication);
} | java | public static @Nullable @CheckForNull String getCurrentUsername() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication == null) {
return null;
}
return getUsername(authentication);
} | [
"public",
"static",
"@",
"Nullable",
"@",
"CheckForNull",
"String",
"getCurrentUsername",
"(",
")",
"{",
"Authentication",
"authentication",
"=",
"SecurityContextHolder",
".",
"getContext",
"(",
")",
".",
"getAuthentication",
"(",
")",
";",
"if",
"(",
"authenticat... | Returns the username of the current authentication.
@return username or <tt>null</tt> if 1) the current authentication is null or 2) the currently
authenticated principal is the system. | [
"Returns",
"the",
"username",
"of",
"the",
"current",
"authentication",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-security-core/src/main/java/org/molgenis/security/core/utils/SecurityUtils.java#L33-L39 | train |
molgenis/molgenis | molgenis-security-core/src/main/java/org/molgenis/security/core/utils/SecurityUtils.java | SecurityUtils.currentUserHasRole | public static boolean currentUserHasRole(String... roles) {
if (roles == null || roles.length == 0) return false;
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null) {
Collection<? extends GrantedAuthority> authorities = authentication.g... | java | public static boolean currentUserHasRole(String... roles) {
if (roles == null || roles.length == 0) return false;
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null) {
Collection<? extends GrantedAuthority> authorities = authentication.g... | [
"public",
"static",
"boolean",
"currentUserHasRole",
"(",
"String",
"...",
"roles",
")",
"{",
"if",
"(",
"roles",
"==",
"null",
"||",
"roles",
".",
"length",
"==",
"0",
")",
"return",
"false",
";",
"Authentication",
"authentication",
"=",
"SecurityContextHolde... | Returns whether the current user has at least one of the given roles | [
"Returns",
"whether",
"the",
"current",
"user",
"has",
"at",
"least",
"one",
"of",
"the",
"given",
"roles"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-security-core/src/main/java/org/molgenis/security/core/utils/SecurityUtils.java#L59-L74 | train |
molgenis/molgenis | molgenis-security-core/src/main/java/org/molgenis/security/core/utils/SecurityUtils.java | SecurityUtils.currentUserIsAuthenticated | public static boolean currentUserIsAuthenticated() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
return authentication != null && authentication.isAuthenticated() && !currentUserIsAnonymous();
} | java | public static boolean currentUserIsAuthenticated() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
return authentication != null && authentication.isAuthenticated() && !currentUserIsAnonymous();
} | [
"public",
"static",
"boolean",
"currentUserIsAuthenticated",
"(",
")",
"{",
"Authentication",
"authentication",
"=",
"SecurityContextHolder",
".",
"getContext",
"(",
")",
".",
"getAuthentication",
"(",
")",
";",
"return",
"authentication",
"!=",
"null",
"&&",
"authe... | Returns whether the current user is authenticated and not the anonymous user | [
"Returns",
"whether",
"the",
"current",
"user",
"is",
"authenticated",
"and",
"not",
"the",
"anonymous",
"user"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-security-core/src/main/java/org/molgenis/security/core/utils/SecurityUtils.java#L92-L95 | train |
molgenis/molgenis | molgenis-data-cache/src/main/java/org/molgenis/data/cache/l2/L2CacheRepositoryDecorator.java | L2CacheRepositoryDecorator.findOneById | @Override
public Entity findOneById(Object id) {
if (cacheable
&& !transactionInformation.isEntireRepositoryDirty(getEntityType())
&& !transactionInformation.isEntityDirty(EntityKey.create(getEntityType(), id))) {
return l2Cache.get(delegate(), id);
}
return delegate().findOneById(id... | java | @Override
public Entity findOneById(Object id) {
if (cacheable
&& !transactionInformation.isEntireRepositoryDirty(getEntityType())
&& !transactionInformation.isEntityDirty(EntityKey.create(getEntityType(), id))) {
return l2Cache.get(delegate(), id);
}
return delegate().findOneById(id... | [
"@",
"Override",
"public",
"Entity",
"findOneById",
"(",
"Object",
"id",
")",
"{",
"if",
"(",
"cacheable",
"&&",
"!",
"transactionInformation",
".",
"isEntireRepositoryDirty",
"(",
"getEntityType",
"(",
")",
")",
"&&",
"!",
"transactionInformation",
".",
"isEnti... | Retrieves a single entity by id.
@param id the entity's ID value
@return the retrieved Entity, or null if not present. | [
"Retrieves",
"a",
"single",
"entity",
"by",
"id",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-cache/src/main/java/org/molgenis/data/cache/l2/L2CacheRepositoryDecorator.java#L64-L72 | train |
molgenis/molgenis | molgenis-data-cache/src/main/java/org/molgenis/data/cache/l2/L2CacheRepositoryDecorator.java | L2CacheRepositoryDecorator.findAllBatch | private List<Entity> findAllBatch(List<Object> ids) {
String entityTypeId = getEntityType().getId();
Multimap<Boolean, Object> partitionedIds =
Multimaps.index(
ids, id -> transactionInformation.isEntityDirty(EntityKey.create(entityTypeId, id)));
Collection<Object> cleanIds = partitioned... | java | private List<Entity> findAllBatch(List<Object> ids) {
String entityTypeId = getEntityType().getId();
Multimap<Boolean, Object> partitionedIds =
Multimaps.index(
ids, id -> transactionInformation.isEntityDirty(EntityKey.create(entityTypeId, id)));
Collection<Object> cleanIds = partitioned... | [
"private",
"List",
"<",
"Entity",
">",
"findAllBatch",
"(",
"List",
"<",
"Object",
">",
"ids",
")",
"{",
"String",
"entityTypeId",
"=",
"getEntityType",
"(",
")",
".",
"getId",
"(",
")",
";",
"Multimap",
"<",
"Boolean",
",",
"Object",
">",
"partitionedId... | Retrieves a batch of Entity IDs.
<p>If currently in transaction, splits the ids into those that have been dirtied in the current
transaction and those that have been left untouched. The untouched ids are loaded through the
cache, the dirtied ids are loaded from the decorated repository directly.
@param ids list of en... | [
"Retrieves",
"a",
"batch",
"of",
"Entity",
"IDs",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-cache/src/main/java/org/molgenis/data/cache/l2/L2CacheRepositoryDecorator.java#L116-L129 | train |
molgenis/molgenis | molgenis-data-cache/src/main/java/org/molgenis/data/cache/utils/CombinedEntityCache.java | CombinedEntityCache.evictAll | public void evictAll(EntityType entityType) {
cache
.asMap()
.keySet()
.stream()
.filter(e -> e.getEntityTypeId().equals(entityType.getId()))
.forEach(cache::invalidate);
} | java | public void evictAll(EntityType entityType) {
cache
.asMap()
.keySet()
.stream()
.filter(e -> e.getEntityTypeId().equals(entityType.getId()))
.forEach(cache::invalidate);
} | [
"public",
"void",
"evictAll",
"(",
"EntityType",
"entityType",
")",
"{",
"cache",
".",
"asMap",
"(",
")",
".",
"keySet",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"e",
"->",
"e",
".",
"getEntityTypeId",
"(",
")",
".",
"equals",
"(",
"e... | Evicts all entries from the cache that belong to a certain entityType.
@param entityType the id of the entity whose entries are to be evicted | [
"Evicts",
"all",
"entries",
"from",
"the",
"cache",
"that",
"belong",
"to",
"a",
"certain",
"entityType",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-cache/src/main/java/org/molgenis/data/cache/utils/CombinedEntityCache.java#L48-L55 | train |
molgenis/molgenis | molgenis-data-cache/src/main/java/org/molgenis/data/cache/utils/CombinedEntityCache.java | CombinedEntityCache.getIfPresent | public Optional<CacheHit<Entity>> getIfPresent(EntityType entityType, Object id) {
EntityKey key = EntityKey.create(entityType, id);
return Optional.ofNullable(cache.getIfPresent(key))
.map(cacheHit -> hydrate(cacheHit, entityType));
} | java | public Optional<CacheHit<Entity>> getIfPresent(EntityType entityType, Object id) {
EntityKey key = EntityKey.create(entityType, id);
return Optional.ofNullable(cache.getIfPresent(key))
.map(cacheHit -> hydrate(cacheHit, entityType));
} | [
"public",
"Optional",
"<",
"CacheHit",
"<",
"Entity",
">",
">",
"getIfPresent",
"(",
"EntityType",
"entityType",
",",
"Object",
"id",
")",
"{",
"EntityKey",
"key",
"=",
"EntityKey",
".",
"create",
"(",
"entityType",
",",
"id",
")",
";",
"return",
"Optional... | Retrieves an entity from the cache if present.
@param entityType EntityType of the entity to retrieve
@param id id value of the entity to retrieve
@return Optional {@link CacheHit<Entity>} with the result from the cache, empty if no record of
the entity is present in the cache | [
"Retrieves",
"an",
"entity",
"from",
"the",
"cache",
"if",
"present",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-cache/src/main/java/org/molgenis/data/cache/utils/CombinedEntityCache.java#L65-L69 | train |
molgenis/molgenis | molgenis-data-cache/src/main/java/org/molgenis/data/cache/utils/CombinedEntityCache.java | CombinedEntityCache.put | public void put(Entity entity) {
EntityType entityType = entity.getEntityType();
cache.put(
EntityKey.create(entityType, entity.getIdValue()),
CacheHit.of(entityHydration.dehydrate(entity)));
} | java | public void put(Entity entity) {
EntityType entityType = entity.getEntityType();
cache.put(
EntityKey.create(entityType, entity.getIdValue()),
CacheHit.of(entityHydration.dehydrate(entity)));
} | [
"public",
"void",
"put",
"(",
"Entity",
"entity",
")",
"{",
"EntityType",
"entityType",
"=",
"entity",
".",
"getEntityType",
"(",
")",
";",
"cache",
".",
"put",
"(",
"EntityKey",
".",
"create",
"(",
"entityType",
",",
"entity",
".",
"getIdValue",
"(",
")... | Inserts an entity into the cache.
@param entity the entity to insert into the cache | [
"Inserts",
"an",
"entity",
"into",
"the",
"cache",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-cache/src/main/java/org/molgenis/data/cache/utils/CombinedEntityCache.java#L76-L81 | train |
molgenis/molgenis | molgenis-core/src/main/java/org/molgenis/core/util/FileUploadUtils.java | FileUploadUtils.saveToTempFile | public static File saveToTempFile(Part part) throws IOException {
String filename = getOriginalFileName(part);
if (filename == null) {
return null;
}
File file = File.createTempFile("molgenis-", "." + StringUtils.getFilenameExtension(filename));
FileCopyUtils.copy(part.getInputStream(), new F... | java | public static File saveToTempFile(Part part) throws IOException {
String filename = getOriginalFileName(part);
if (filename == null) {
return null;
}
File file = File.createTempFile("molgenis-", "." + StringUtils.getFilenameExtension(filename));
FileCopyUtils.copy(part.getInputStream(), new F... | [
"public",
"static",
"File",
"saveToTempFile",
"(",
"Part",
"part",
")",
"throws",
"IOException",
"{",
"String",
"filename",
"=",
"getOriginalFileName",
"(",
"part",
")",
";",
"if",
"(",
"filename",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"File"... | Saves an uploaded file to a tempfile with prefix 'molgenis-', keeps the original file extension
@return the saved temp file or null is no file selected | [
"Saves",
"an",
"uploaded",
"file",
"to",
"a",
"tempfile",
"with",
"prefix",
"molgenis",
"-",
"keeps",
"the",
"original",
"file",
"extension"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core/src/main/java/org/molgenis/core/util/FileUploadUtils.java#L21-L31 | train |
molgenis/molgenis | molgenis-core/src/main/java/org/molgenis/core/util/FileUploadUtils.java | FileUploadUtils.saveToTempFolder | public static File saveToTempFolder(Part part) throws IOException {
String filename = getOriginalFileName(part);
if (filename == null) {
return null;
}
File file = new File(FileUtils.getTempDirectory(), filename);
FileCopyUtils.copy(part.getInputStream(), new FileOutputStream(file));
ret... | java | public static File saveToTempFolder(Part part) throws IOException {
String filename = getOriginalFileName(part);
if (filename == null) {
return null;
}
File file = new File(FileUtils.getTempDirectory(), filename);
FileCopyUtils.copy(part.getInputStream(), new FileOutputStream(file));
ret... | [
"public",
"static",
"File",
"saveToTempFolder",
"(",
"Part",
"part",
")",
"throws",
"IOException",
"{",
"String",
"filename",
"=",
"getOriginalFileName",
"(",
"part",
")",
";",
"if",
"(",
"filename",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Fil... | Save an Uploaded file to the temp folder keeping it original name | [
"Save",
"an",
"Uploaded",
"file",
"to",
"the",
"temp",
"folder",
"keeping",
"it",
"original",
"name"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core/src/main/java/org/molgenis/core/util/FileUploadUtils.java#L34-L44 | train |
molgenis/molgenis | molgenis-core/src/main/java/org/molgenis/core/util/FileUploadUtils.java | FileUploadUtils.getOriginalFileName | public static String getOriginalFileName(Part part) {
String contentDisposition = part.getHeader("content-disposition");
if (contentDisposition != null) {
for (String cd : contentDisposition.split(";")) {
if (cd.trim().startsWith("filename")) {
String path = cd.substring(cd.indexOf('=')... | java | public static String getOriginalFileName(Part part) {
String contentDisposition = part.getHeader("content-disposition");
if (contentDisposition != null) {
for (String cd : contentDisposition.split(";")) {
if (cd.trim().startsWith("filename")) {
String path = cd.substring(cd.indexOf('=')... | [
"public",
"static",
"String",
"getOriginalFileName",
"(",
"Part",
"part",
")",
"{",
"String",
"contentDisposition",
"=",
"part",
".",
"getHeader",
"(",
"\"content-disposition\"",
")",
";",
"if",
"(",
"contentDisposition",
"!=",
"null",
")",
"{",
"for",
"(",
"S... | Get the filename of an uploaded file
@return the filename or null if not present | [
"Get",
"the",
"filename",
"of",
"an",
"uploaded",
"file"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core/src/main/java/org/molgenis/core/util/FileUploadUtils.java#L51-L65 | train |
molgenis/molgenis | molgenis-scripts/src/main/java/org/molgenis/script/ScheduledScriptConfig.java | ScheduledScriptConfig.scriptJobFactory | @Bean
public JobFactory<ScriptJobExecution> scriptJobFactory() {
return new JobFactory<ScriptJobExecution>() {
@Override
public Job<ScriptResult> createJob(ScriptJobExecution scriptJobExecution) {
final String name = scriptJobExecution.getName();
final String parameterString = scriptJo... | java | @Bean
public JobFactory<ScriptJobExecution> scriptJobFactory() {
return new JobFactory<ScriptJobExecution>() {
@Override
public Job<ScriptResult> createJob(ScriptJobExecution scriptJobExecution) {
final String name = scriptJobExecution.getName();
final String parameterString = scriptJo... | [
"@",
"Bean",
"public",
"JobFactory",
"<",
"ScriptJobExecution",
">",
"scriptJobFactory",
"(",
")",
"{",
"return",
"new",
"JobFactory",
"<",
"ScriptJobExecution",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Job",
"<",
"ScriptResult",
">",
"createJob",
"(",
... | The Script JobFactory bean. | [
"The",
"Script",
"JobFactory",
"bean",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-scripts/src/main/java/org/molgenis/script/ScheduledScriptConfig.java#L43-L64 | train |
molgenis/molgenis | molgenis-core-ui/src/main/java/org/molgenis/core/ui/menumanager/MenuManagerController.java | MenuManagerController.uploadLogo | @PreAuthorize("hasAnyRole('ROLE_SU')")
@PostMapping("/upload-logo")
public String uploadLogo(@RequestParam("logo") Part part, Model model) throws IOException {
String contentType = part.getContentType();
if ((contentType == null) || !contentType.startsWith("image")) {
model.addAttribute("errorMessage"... | java | @PreAuthorize("hasAnyRole('ROLE_SU')")
@PostMapping("/upload-logo")
public String uploadLogo(@RequestParam("logo") Part part, Model model) throws IOException {
String contentType = part.getContentType();
if ((contentType == null) || !contentType.startsWith("image")) {
model.addAttribute("errorMessage"... | [
"@",
"PreAuthorize",
"(",
"\"hasAnyRole('ROLE_SU')\"",
")",
"@",
"PostMapping",
"(",
"\"/upload-logo\"",
")",
"public",
"String",
"uploadLogo",
"(",
"@",
"RequestParam",
"(",
"\"logo\"",
")",
"Part",
"part",
",",
"Model",
"model",
")",
"throws",
"IOException",
"... | Upload a new molgenis logo | [
"Upload",
"a",
"new",
"molgenis",
"logo"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/menumanager/MenuManagerController.java#L75-L99 | train |
molgenis/molgenis | molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/service/impl/MappingServiceImpl.java | MappingServiceImpl.getCompatibleEntityTypes | public Stream<EntityType> getCompatibleEntityTypes(EntityType target) {
return dataService
.getMeta()
.getEntityTypes()
.filter(candidate -> !candidate.isAbstract())
.filter(isCompatible(target));
} | java | public Stream<EntityType> getCompatibleEntityTypes(EntityType target) {
return dataService
.getMeta()
.getEntityTypes()
.filter(candidate -> !candidate.isAbstract())
.filter(isCompatible(target));
} | [
"public",
"Stream",
"<",
"EntityType",
">",
"getCompatibleEntityTypes",
"(",
"EntityType",
"target",
")",
"{",
"return",
"dataService",
".",
"getMeta",
"(",
")",
".",
"getEntityTypes",
"(",
")",
".",
"filter",
"(",
"candidate",
"->",
"!",
"candidate",
".",
"... | Public for testability | [
"Public",
"for",
"testability"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/service/impl/MappingServiceImpl.java#L247-L253 | train |
molgenis/molgenis | molgenis-data-index/src/main/java/org/molgenis/data/index/IndexingStrategy.java | IndexingStrategy.collectResult | private Set<Impact> collectResult(
List<Impact> singleEntityChanges,
List<Impact> wholeRepoActions,
Set<String> dependentEntityIds) {
Set<String> wholeRepoIds =
union(
wholeRepoActions.stream().map(Impact::getEntityTypeId).collect(toImmutableSet()),
dependentEntityI... | java | private Set<Impact> collectResult(
List<Impact> singleEntityChanges,
List<Impact> wholeRepoActions,
Set<String> dependentEntityIds) {
Set<String> wholeRepoIds =
union(
wholeRepoActions.stream().map(Impact::getEntityTypeId).collect(toImmutableSet()),
dependentEntityI... | [
"private",
"Set",
"<",
"Impact",
">",
"collectResult",
"(",
"List",
"<",
"Impact",
">",
"singleEntityChanges",
",",
"List",
"<",
"Impact",
">",
"wholeRepoActions",
",",
"Set",
"<",
"String",
">",
"dependentEntityIds",
")",
"{",
"Set",
"<",
"String",
">",
"... | Combines the results.
@param singleEntityChanges {@link Impact}s for changes made to specific Entity instances
@param wholeRepoActions {@link Impact}s for changes made to entire repositories
@param dependentEntityIds {@link Impact}s for entitytypes that are dependent on one or more of
the changes
@return Set with the ... | [
"Combines",
"the",
"results",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-index/src/main/java/org/molgenis/data/index/IndexingStrategy.java#L56-L73 | train |
molgenis/molgenis | molgenis-js/src/main/java/org/molgenis/js/nashorn/NashornScriptEngine.java | NashornScriptEngine.eval | public Object eval(Bindings bindings, String expression) throws ScriptException {
CompiledScript compiledExpression = requireNonNull(expressions.get(expression));
Object returnValue = compiledExpression.eval(bindings);
return convertNashornValue(returnValue);
} | java | public Object eval(Bindings bindings, String expression) throws ScriptException {
CompiledScript compiledExpression = requireNonNull(expressions.get(expression));
Object returnValue = compiledExpression.eval(bindings);
return convertNashornValue(returnValue);
} | [
"public",
"Object",
"eval",
"(",
"Bindings",
"bindings",
",",
"String",
"expression",
")",
"throws",
"ScriptException",
"{",
"CompiledScript",
"compiledExpression",
"=",
"requireNonNull",
"(",
"expressions",
".",
"get",
"(",
"expression",
")",
")",
";",
"Object",
... | Evaluates an expression using the given bindings.
@param bindings the Bindings to use as ENGINE_SCOPE
@param expression the expression to evaluate
@return result of the evaluation
@throws ScriptException if the evaluation fails | [
"Evaluates",
"an",
"expression",
"using",
"the",
"given",
"bindings",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-js/src/main/java/org/molgenis/js/nashorn/NashornScriptEngine.java#L48-L52 | train |
molgenis/molgenis | molgenis-data-file/src/main/java/org/molgenis/data/file/FileRepositoryCollectionFactory.java | FileRepositoryCollectionFactory.addFileRepositoryCollectionClass | public void addFileRepositoryCollectionClass(
Class<? extends FileRepositoryCollection> clazz, Set<String> fileExtensions) {
for (String extension : fileExtensions) {
fileRepositoryCollections.put(extension.toLowerCase(), clazz);
}
} | java | public void addFileRepositoryCollectionClass(
Class<? extends FileRepositoryCollection> clazz, Set<String> fileExtensions) {
for (String extension : fileExtensions) {
fileRepositoryCollections.put(extension.toLowerCase(), clazz);
}
} | [
"public",
"void",
"addFileRepositoryCollectionClass",
"(",
"Class",
"<",
"?",
"extends",
"FileRepositoryCollection",
">",
"clazz",
",",
"Set",
"<",
"String",
">",
"fileExtensions",
")",
"{",
"for",
"(",
"String",
"extension",
":",
"fileExtensions",
")",
"{",
"fi... | Add a FileRepositorySource so it can be used by the 'createFileRepositySource' factory method | [
"Add",
"a",
"FileRepositorySource",
"so",
"it",
"can",
"be",
"used",
"by",
"the",
"createFileRepositySource",
"factory",
"method"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-file/src/main/java/org/molgenis/data/file/FileRepositoryCollectionFactory.java#L42-L47 | train |
molgenis/molgenis | molgenis-data-file/src/main/java/org/molgenis/data/file/FileRepositoryCollectionFactory.java | FileRepositoryCollectionFactory.createFileRepositoryCollection | public FileRepositoryCollection createFileRepositoryCollection(File file) {
Class<? extends FileRepositoryCollection> clazz;
String extension =
FileExtensionUtils.findExtensionFromPossibilities(
file.getName(), fileRepositoryCollections.keySet());
clazz = fileRepositoryCollections.get(... | java | public FileRepositoryCollection createFileRepositoryCollection(File file) {
Class<? extends FileRepositoryCollection> clazz;
String extension =
FileExtensionUtils.findExtensionFromPossibilities(
file.getName(), fileRepositoryCollections.keySet());
clazz = fileRepositoryCollections.get(... | [
"public",
"FileRepositoryCollection",
"createFileRepositoryCollection",
"(",
"File",
"file",
")",
"{",
"Class",
"<",
"?",
"extends",
"FileRepositoryCollection",
">",
"clazz",
";",
"String",
"extension",
"=",
"FileExtensionUtils",
".",
"findExtensionFromPossibilities",
"("... | Factory method for creating a new FileRepositorySource
<p>For example an excel file | [
"Factory",
"method",
"for",
"creating",
"a",
"new",
"FileRepositorySource"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-file/src/main/java/org/molgenis/data/file/FileRepositoryCollectionFactory.java#L54-L86 | train |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/meta/MetaDataServiceImpl.java | MetaDataServiceImpl.hasNewMappedByAttrs | private static boolean hasNewMappedByAttrs(EntityType entityType, EntityType existingEntityType) {
Set<String> mappedByAttrs =
entityType.getOwnMappedByAttributes().map(Attribute::getName).collect(toSet());
Set<String> existingMappedByAttrs =
existingEntityType.getOwnMappedByAttributes().map(At... | java | private static boolean hasNewMappedByAttrs(EntityType entityType, EntityType existingEntityType) {
Set<String> mappedByAttrs =
entityType.getOwnMappedByAttributes().map(Attribute::getName).collect(toSet());
Set<String> existingMappedByAttrs =
existingEntityType.getOwnMappedByAttributes().map(At... | [
"private",
"static",
"boolean",
"hasNewMappedByAttrs",
"(",
"EntityType",
"entityType",
",",
"EntityType",
"existingEntityType",
")",
"{",
"Set",
"<",
"String",
">",
"mappedByAttrs",
"=",
"entityType",
".",
"getOwnMappedByAttributes",
"(",
")",
".",
"map",
"(",
"A... | Returns true if entity meta contains mapped by attributes that do not exist in the existing
entity meta.
@param entityType entity meta data
@param existingEntityType existing entity meta data
@return true if entity meta contains mapped by attributes that do not exist in the existing
entity meta. | [
"Returns",
"true",
"if",
"entity",
"meta",
"contains",
"mapped",
"by",
"attributes",
"that",
"do",
"not",
"exist",
"in",
"the",
"existing",
"entity",
"meta",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/MetaDataServiceImpl.java#L261-L268 | train |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/meta/MetaDataServiceImpl.java | MetaDataServiceImpl.upsertAttributes | private void upsertAttributes(EntityType entityType, EntityType existingEntityType) {
// analyze both compound and atomic attributes owned by the entity
Map<String, Attribute> attrsMap =
stream(entityType.getOwnAllAttributes())
.collect(toMap(Attribute::getName, Function.identity()));
Ma... | java | private void upsertAttributes(EntityType entityType, EntityType existingEntityType) {
// analyze both compound and atomic attributes owned by the entity
Map<String, Attribute> attrsMap =
stream(entityType.getOwnAllAttributes())
.collect(toMap(Attribute::getName, Function.identity()));
Ma... | [
"private",
"void",
"upsertAttributes",
"(",
"EntityType",
"entityType",
",",
"EntityType",
"existingEntityType",
")",
"{",
"// analyze both compound and atomic attributes owned by the entity",
"Map",
"<",
"String",
",",
"Attribute",
">",
"attrsMap",
"=",
"stream",
"(",
"e... | Add and update entity attributes
@param entityType entity meta data
@param existingEntityType existing entity meta data | [
"Add",
"and",
"update",
"entity",
"attributes"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/MetaDataServiceImpl.java#L464-L499 | train |
molgenis/molgenis | molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxImportService.java | EmxImportService.doImport | public EntityImportReport doImport(EmxImportJob job) {
try {
return writer.doImport(job);
} catch (Exception e) {
LOG.error("Error handling EmxImportJob", e);
throw e;
}
} | java | public EntityImportReport doImport(EmxImportJob job) {
try {
return writer.doImport(job);
} catch (Exception e) {
LOG.error("Error handling EmxImportJob", e);
throw e;
}
} | [
"public",
"EntityImportReport",
"doImport",
"(",
"EmxImportJob",
"job",
")",
"{",
"try",
"{",
"return",
"writer",
".",
"doImport",
"(",
"job",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Error handling EmxImportJob\"... | Does the import in a transaction. Manually rolls back schema changes if something goes wrong.
Refreshes the metadata.
@return {@link EntityImportReport} describing what happened | [
"Does",
"the",
"import",
"in",
"a",
"transaction",
".",
"Manually",
"rolls",
"back",
"schema",
"changes",
"if",
"something",
"goes",
"wrong",
".",
"Refreshes",
"the",
"metadata",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxImportService.java#L88-L95 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlExceptionTranslator.java | PostgreSqlExceptionTranslator.tryGetEntityTypeName | private Optional<String> tryGetEntityTypeName(String tableName) {
EntityTypeDescription entityTypeDescription =
entityTypeRegistry.getEntityTypeDescription(tableName);
String entityTypeId = entityTypeDescription != null ? entityTypeDescription.getId() : null;
return Optional.ofNullable(entityTypeId)... | java | private Optional<String> tryGetEntityTypeName(String tableName) {
EntityTypeDescription entityTypeDescription =
entityTypeRegistry.getEntityTypeDescription(tableName);
String entityTypeId = entityTypeDescription != null ? entityTypeDescription.getId() : null;
return Optional.ofNullable(entityTypeId)... | [
"private",
"Optional",
"<",
"String",
">",
"tryGetEntityTypeName",
"(",
"String",
"tableName",
")",
"{",
"EntityTypeDescription",
"entityTypeDescription",
"=",
"entityTypeRegistry",
".",
"getEntityTypeDescription",
"(",
"tableName",
")",
";",
"String",
"entityTypeId",
"... | Tries to determine the entity type identifier for this table name | [
"Tries",
"to",
"determine",
"the",
"entity",
"type",
"identifier",
"for",
"this",
"table",
"name"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlExceptionTranslator.java#L507-L512 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlExceptionTranslator.java | PostgreSqlExceptionTranslator.tryGetAttributeName | private Optional<String> tryGetAttributeName(String tableName, String colName) {
String attributeName;
EntityTypeDescription entityTypeDescription =
entityTypeRegistry.getEntityTypeDescription(tableName);
if (entityTypeDescription != null) {
AttributeDescription attrDescription =
en... | java | private Optional<String> tryGetAttributeName(String tableName, String colName) {
String attributeName;
EntityTypeDescription entityTypeDescription =
entityTypeRegistry.getEntityTypeDescription(tableName);
if (entityTypeDescription != null) {
AttributeDescription attrDescription =
en... | [
"private",
"Optional",
"<",
"String",
">",
"tryGetAttributeName",
"(",
"String",
"tableName",
",",
"String",
"colName",
")",
"{",
"String",
"attributeName",
";",
"EntityTypeDescription",
"entityTypeDescription",
"=",
"entityTypeRegistry",
".",
"getEntityTypeDescription",
... | Tries to determine the attribute name for this table column name | [
"Tries",
"to",
"determine",
"the",
"attribute",
"name",
"for",
"this",
"table",
"column",
"name"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlExceptionTranslator.java#L515-L533 | train |
molgenis/molgenis | molgenis-navigator/src/main/java/org/molgenis/navigator/copy/service/PackageCopier.java | PackageCopier.assignUniqueLabel | private void assignUniqueLabel(Package pack, Package targetPackage) {
Set<String> existingLabels;
if (targetPackage != null) {
existingLabels = stream(targetPackage.getChildren()).map(Package::getLabel).collect(toSet());
} else {
existingLabels =
dataService
.query(PACKAG... | java | private void assignUniqueLabel(Package pack, Package targetPackage) {
Set<String> existingLabels;
if (targetPackage != null) {
existingLabels = stream(targetPackage.getChildren()).map(Package::getLabel).collect(toSet());
} else {
existingLabels =
dataService
.query(PACKAG... | [
"private",
"void",
"assignUniqueLabel",
"(",
"Package",
"pack",
",",
"Package",
"targetPackage",
")",
"{",
"Set",
"<",
"String",
">",
"existingLabels",
";",
"if",
"(",
"targetPackage",
"!=",
"null",
")",
"{",
"existingLabels",
"=",
"stream",
"(",
"targetPackag... | Checks if there's a Package in the target location with the same label. If so, keeps adding a
postfix until the label is unique. | [
"Checks",
"if",
"there",
"s",
"a",
"Package",
"in",
"the",
"target",
"location",
"with",
"the",
"same",
"label",
".",
"If",
"so",
"keeps",
"adding",
"a",
"postfix",
"until",
"the",
"label",
"is",
"unique",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-navigator/src/main/java/org/molgenis/navigator/copy/service/PackageCopier.java#L62-L76 | train |
molgenis/molgenis | molgenis-data-cache/src/main/java/org/molgenis/data/cache/utils/EntityHydration.java | EntityHydration.dehydrate | public Map<String, Object> dehydrate(Entity entity) {
LOG.trace("Dehydrating entity {}", entity);
Map<String, Object> dehydratedEntity = newHashMap();
EntityType entityType = entity.getEntityType();
entityType
.getAtomicAttributes()
.forEach(
attribute -> {
// ... | java | public Map<String, Object> dehydrate(Entity entity) {
LOG.trace("Dehydrating entity {}", entity);
Map<String, Object> dehydratedEntity = newHashMap();
EntityType entityType = entity.getEntityType();
entityType
.getAtomicAttributes()
.forEach(
attribute -> {
// ... | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"dehydrate",
"(",
"Entity",
"entity",
")",
"{",
"LOG",
".",
"trace",
"(",
"\"Dehydrating entity {}\"",
",",
"entity",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"dehydratedEntity",
"=",
"newHashM... | Creates a Map containing the values required to rebuild this entity. For references to other
entities only stores the ids.
@param entity the {@link Entity} to dehydrate
@return Map representation of the entity | [
"Creates",
"a",
"Map",
"containing",
"the",
"values",
"required",
"to",
"rebuild",
"this",
"entity",
".",
"For",
"references",
"to",
"other",
"entities",
"only",
"stores",
"the",
"ids",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-cache/src/main/java/org/molgenis/data/cache/utils/EntityHydration.java#L77-L96 | train |
molgenis/molgenis | molgenis-data-file/src/main/java/org/molgenis/data/file/FileStore.java | FileStore.move | public void move(String sourceDir, String targetDir) throws IOException {
validatePathname(sourceDir);
validatePathname(targetDir);
Files.move(
Paths.get(getStorageDir() + File.separator + sourceDir),
Paths.get(getStorageDir() + File.separator + targetDir));
} | java | public void move(String sourceDir, String targetDir) throws IOException {
validatePathname(sourceDir);
validatePathname(targetDir);
Files.move(
Paths.get(getStorageDir() + File.separator + sourceDir),
Paths.get(getStorageDir() + File.separator + targetDir));
} | [
"public",
"void",
"move",
"(",
"String",
"sourceDir",
",",
"String",
"targetDir",
")",
"throws",
"IOException",
"{",
"validatePathname",
"(",
"sourceDir",
")",
";",
"validatePathname",
"(",
"targetDir",
")",
";",
"Files",
".",
"move",
"(",
"Paths",
".",
"get... | Move directories in FileStore Pleae provide the path from the relative root of the fileStore
<p>So if you want to move a top-level directory the following syntax is sufficient: <code>
move("dir1", "dir2");
</code> Sub-level directory can be moved by typing: <code>
move("dir1/subdir1", "dir2/subdir1");
</code> Make sur... | [
"Move",
"directories",
"in",
"FileStore",
"Pleae",
"provide",
"the",
"path",
"from",
"the",
"relative",
"root",
"of",
"the",
"fileStore"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-file/src/main/java/org/molgenis/data/file/FileStore.java#L60-L67 | train |
molgenis/molgenis | molgenis-data-index/src/main/java/org/molgenis/data/index/IndexDependencyModel.java | IndexDependencyModel.hasAttributeThatReferences | private boolean hasAttributeThatReferences(EntityType candidate, String entityTypeId) {
Iterable<Attribute> attributes = candidate.getOwnAtomicAttributes();
return stream(attributes)
.filter(Attribute::hasRefEntity)
.map(attribute -> attribute.getRefEntity().getId())
.anyMatch(entityType... | java | private boolean hasAttributeThatReferences(EntityType candidate, String entityTypeId) {
Iterable<Attribute> attributes = candidate.getOwnAtomicAttributes();
return stream(attributes)
.filter(Attribute::hasRefEntity)
.map(attribute -> attribute.getRefEntity().getId())
.anyMatch(entityType... | [
"private",
"boolean",
"hasAttributeThatReferences",
"(",
"EntityType",
"candidate",
",",
"String",
"entityTypeId",
")",
"{",
"Iterable",
"<",
"Attribute",
">",
"attributes",
"=",
"candidate",
".",
"getOwnAtomicAttributes",
"(",
")",
";",
"return",
"stream",
"(",
"... | Determines if an entityType has an attribute that references another entity
@param candidate the EntityType that is examined
@param entityTypeId the ID of the entity that may be referenced
@return indication if candidate references entityTypeID | [
"Determines",
"if",
"an",
"entityType",
"has",
"an",
"attribute",
"that",
"references",
"another",
"entity"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-index/src/main/java/org/molgenis/data/index/IndexDependencyModel.java#L97-L103 | train |
molgenis/molgenis | molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceHelper.java | SemanticSearchServiceHelper.createDisMaxQueryRuleForAttribute | public QueryRule createDisMaxQueryRuleForAttribute(
Set<String> searchTerms, Collection<OntologyTerm> ontologyTerms) {
List<String> queryTerms = new ArrayList<>();
if (searchTerms != null) {
queryTerms.addAll(
searchTerms
.stream()
.filter(StringUtils::isNotBla... | java | public QueryRule createDisMaxQueryRuleForAttribute(
Set<String> searchTerms, Collection<OntologyTerm> ontologyTerms) {
List<String> queryTerms = new ArrayList<>();
if (searchTerms != null) {
queryTerms.addAll(
searchTerms
.stream()
.filter(StringUtils::isNotBla... | [
"public",
"QueryRule",
"createDisMaxQueryRuleForAttribute",
"(",
"Set",
"<",
"String",
">",
"searchTerms",
",",
"Collection",
"<",
"OntologyTerm",
">",
"ontologyTerms",
")",
"{",
"List",
"<",
"String",
">",
"queryTerms",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
... | Create a disMaxJunc query rule based on the given search terms as well as the information from
given ontology terms
@return disMaxJunc queryRule | [
"Create",
"a",
"disMaxJunc",
"query",
"rule",
"based",
"on",
"the",
"given",
"search",
"terms",
"as",
"well",
"as",
"the",
"information",
"from",
"given",
"ontology",
"terms"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceHelper.java#L65-L93 | train |
molgenis/molgenis | molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceHelper.java | SemanticSearchServiceHelper.createDisMaxQueryRuleForTerms | public QueryRule createDisMaxQueryRuleForTerms(List<String> queryTerms) {
List<QueryRule> rules = new ArrayList<>();
queryTerms
.stream()
.filter(StringUtils::isNotEmpty)
.map(this::escapeCharsExcludingCaretChar)
.forEach(
query -> {
rules.add(new QueryR... | java | public QueryRule createDisMaxQueryRuleForTerms(List<String> queryTerms) {
List<QueryRule> rules = new ArrayList<>();
queryTerms
.stream()
.filter(StringUtils::isNotEmpty)
.map(this::escapeCharsExcludingCaretChar)
.forEach(
query -> {
rules.add(new QueryR... | [
"public",
"QueryRule",
"createDisMaxQueryRuleForTerms",
"(",
"List",
"<",
"String",
">",
"queryTerms",
")",
"{",
"List",
"<",
"QueryRule",
">",
"rules",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"queryTerms",
".",
"stream",
"(",
")",
".",
"filter",
"("... | Create disMaxJunc query rule based a list of queryTerm. All queryTerms are lower cased and stop
words are removed
@return disMaxJunc queryRule | [
"Create",
"disMaxJunc",
"query",
"rule",
"based",
"a",
"list",
"of",
"queryTerm",
".",
"All",
"queryTerms",
"are",
"lower",
"cased",
"and",
"stop",
"words",
"are",
"removed"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceHelper.java#L101-L115 | train |
molgenis/molgenis | molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceHelper.java | SemanticSearchServiceHelper.createBoostedDisMaxQueryRuleForTerms | public QueryRule createBoostedDisMaxQueryRuleForTerms(
List<String> queryTerms, Double boostValue) {
QueryRule finalDisMaxQuery = createDisMaxQueryRuleForTerms(queryTerms);
if (boostValue != null && boostValue.intValue() != 0) {
finalDisMaxQuery.setValue(boostValue);
}
return finalDisMaxQuer... | java | public QueryRule createBoostedDisMaxQueryRuleForTerms(
List<String> queryTerms, Double boostValue) {
QueryRule finalDisMaxQuery = createDisMaxQueryRuleForTerms(queryTerms);
if (boostValue != null && boostValue.intValue() != 0) {
finalDisMaxQuery.setValue(boostValue);
}
return finalDisMaxQuer... | [
"public",
"QueryRule",
"createBoostedDisMaxQueryRuleForTerms",
"(",
"List",
"<",
"String",
">",
"queryTerms",
",",
"Double",
"boostValue",
")",
"{",
"QueryRule",
"finalDisMaxQuery",
"=",
"createDisMaxQueryRuleForTerms",
"(",
"queryTerms",
")",
";",
"if",
"(",
"boostVa... | Create a disMaxQueryRule with corresponding boosted value
@return a disMaxQueryRule with boosted value | [
"Create",
"a",
"disMaxQueryRule",
"with",
"corresponding",
"boosted",
"value"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceHelper.java#L122-L129 | train |
molgenis/molgenis | molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceHelper.java | SemanticSearchServiceHelper.createShouldQueryRule | public QueryRule createShouldQueryRule(String multiOntologyTermIri) {
QueryRule shouldQueryRule = new QueryRule(new ArrayList<>());
shouldQueryRule.setOperator(Operator.SHOULD);
for (String ontologyTermIri : multiOntologyTermIri.split(COMMA_CHAR)) {
OntologyTerm ontologyTerm = ontologyService.getOntol... | java | public QueryRule createShouldQueryRule(String multiOntologyTermIri) {
QueryRule shouldQueryRule = new QueryRule(new ArrayList<>());
shouldQueryRule.setOperator(Operator.SHOULD);
for (String ontologyTermIri : multiOntologyTermIri.split(COMMA_CHAR)) {
OntologyTerm ontologyTerm = ontologyService.getOntol... | [
"public",
"QueryRule",
"createShouldQueryRule",
"(",
"String",
"multiOntologyTermIri",
")",
"{",
"QueryRule",
"shouldQueryRule",
"=",
"new",
"QueryRule",
"(",
"new",
"ArrayList",
"<>",
"(",
")",
")",
";",
"shouldQueryRule",
".",
"setOperator",
"(",
"Operator",
"."... | Create a boolean should query for composite tags containing multiple ontology terms
@return return a boolean should queryRule | [
"Create",
"a",
"boolean",
"should",
"query",
"for",
"composite",
"tags",
"containing",
"multiple",
"ontology",
"terms"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceHelper.java#L136-L148 | train |
molgenis/molgenis | molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceHelper.java | SemanticSearchServiceHelper.parseOntologyTermQueries | public List<String> parseOntologyTermQueries(OntologyTerm ontologyTerm) {
List<String> queryTerms =
getOtLabelAndSynonyms(ontologyTerm)
.stream()
.map(this::processQueryString)
.collect(Collectors.toList());
for (OntologyTerm childOt : ontologyService.getChildren(ont... | java | public List<String> parseOntologyTermQueries(OntologyTerm ontologyTerm) {
List<String> queryTerms =
getOtLabelAndSynonyms(ontologyTerm)
.stream()
.map(this::processQueryString)
.collect(Collectors.toList());
for (OntologyTerm childOt : ontologyService.getChildren(ont... | [
"public",
"List",
"<",
"String",
">",
"parseOntologyTermQueries",
"(",
"OntologyTerm",
"ontologyTerm",
")",
"{",
"List",
"<",
"String",
">",
"queryTerms",
"=",
"getOtLabelAndSynonyms",
"(",
"ontologyTerm",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"this",... | Create a list of string queries based on the information collected from current ontologyterm
including label, synonyms and child ontologyterms | [
"Create",
"a",
"list",
"of",
"string",
"queries",
"based",
"on",
"the",
"information",
"collected",
"from",
"current",
"ontologyterm",
"including",
"label",
"synonyms",
"and",
"child",
"ontologyterms"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceHelper.java#L154-L168 | train |
molgenis/molgenis | molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceHelper.java | SemanticSearchServiceHelper.getOtLabelAndSynonyms | public Set<String> getOtLabelAndSynonyms(OntologyTerm ontologyTerm) {
Set<String> allTerms = Sets.newLinkedHashSet(ontologyTerm.getSynonyms());
allTerms.add(ontologyTerm.getLabel());
return allTerms;
} | java | public Set<String> getOtLabelAndSynonyms(OntologyTerm ontologyTerm) {
Set<String> allTerms = Sets.newLinkedHashSet(ontologyTerm.getSynonyms());
allTerms.add(ontologyTerm.getLabel());
return allTerms;
} | [
"public",
"Set",
"<",
"String",
">",
"getOtLabelAndSynonyms",
"(",
"OntologyTerm",
"ontologyTerm",
")",
"{",
"Set",
"<",
"String",
">",
"allTerms",
"=",
"Sets",
".",
"newLinkedHashSet",
"(",
"ontologyTerm",
".",
"getSynonyms",
"(",
")",
")",
";",
"allTerms",
... | A helper function to collect synonyms as well as label of ontologyterm
@return a list of synonyms plus label | [
"A",
"helper",
"function",
"to",
"collect",
"synonyms",
"as",
"well",
"as",
"label",
"of",
"ontologyterm"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceHelper.java#L175-L179 | train |
molgenis/molgenis | molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceHelper.java | SemanticSearchServiceHelper.getAttributeIdentifiers | public List<String> getAttributeIdentifiers(EntityType sourceEntityType) {
Entity entityTypeEntity =
dataService.findOne(
ENTITY_TYPE_META_DATA,
new QueryImpl<>().eq(EntityTypeMetadata.ID, sourceEntityType.getId()));
if (entityTypeEntity == null)
throw new MolgenisDataAcce... | java | public List<String> getAttributeIdentifiers(EntityType sourceEntityType) {
Entity entityTypeEntity =
dataService.findOne(
ENTITY_TYPE_META_DATA,
new QueryImpl<>().eq(EntityTypeMetadata.ID, sourceEntityType.getId()));
if (entityTypeEntity == null)
throw new MolgenisDataAcce... | [
"public",
"List",
"<",
"String",
">",
"getAttributeIdentifiers",
"(",
"EntityType",
"sourceEntityType",
")",
"{",
"Entity",
"entityTypeEntity",
"=",
"dataService",
".",
"findOne",
"(",
"ENTITY_TYPE_META_DATA",
",",
"new",
"QueryImpl",
"<>",
"(",
")",
".",
"eq",
... | A helper function that gets identifiers of all the attributes from one EntityType | [
"A",
"helper",
"function",
"that",
"gets",
"identifiers",
"of",
"all",
"the",
"attributes",
"from",
"one",
"EntityType"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceHelper.java#L220-L236 | train |
molgenis/molgenis | molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxDataProvider.java | EmxDataProvider.toEntity | private Entity toEntity(EntityType entityType, Entity emxEntity) {
Entity entity = entityManager.create(entityType, POPULATE);
for (Attribute attr : entityType.getAtomicAttributes()) {
if (attr.getExpression() == null && !attr.isMappedBy()) {
String attrName = attr.getName();
Object emxVal... | java | private Entity toEntity(EntityType entityType, Entity emxEntity) {
Entity entity = entityManager.create(entityType, POPULATE);
for (Attribute attr : entityType.getAtomicAttributes()) {
if (attr.getExpression() == null && !attr.isMappedBy()) {
String attrName = attr.getName();
Object emxVal... | [
"private",
"Entity",
"toEntity",
"(",
"EntityType",
"entityType",
",",
"Entity",
"emxEntity",
")",
"{",
"Entity",
"entity",
"=",
"entityManager",
".",
"create",
"(",
"entityType",
",",
"POPULATE",
")",
";",
"for",
"(",
"Attribute",
"attr",
":",
"entityType",
... | Create an entity from the EMX entity
@param entityType entity meta data
@param emxEntity EMX entity
@return MOLGENIS entity | [
"Create",
"an",
"entity",
"from",
"the",
"EMX",
"entity"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxDataProvider.java#L84-L141 | train |
molgenis/molgenis | molgenis-one-click-importer/src/main/java/org/molgenis/oneclickimporter/service/impl/OneClickImporterServiceImpl.java | OneClickImporterServiceImpl.createColumnFromCell | private Column createColumnFromCell(Sheet sheet, Cell cell) {
if (cell.getCellTypeEnum() == CellType.STRING) {
return Column.create(
cell.getStringCellValue(),
cell.getColumnIndex(),
getColumnDataFromSheet(sheet, cell.getColumnIndex()));
} else {
throw new MolgenisDataE... | java | private Column createColumnFromCell(Sheet sheet, Cell cell) {
if (cell.getCellTypeEnum() == CellType.STRING) {
return Column.create(
cell.getStringCellValue(),
cell.getColumnIndex(),
getColumnDataFromSheet(sheet, cell.getColumnIndex()));
} else {
throw new MolgenisDataE... | [
"private",
"Column",
"createColumnFromCell",
"(",
"Sheet",
"sheet",
",",
"Cell",
"cell",
")",
"{",
"if",
"(",
"cell",
".",
"getCellTypeEnum",
"(",
")",
"==",
"CellType",
".",
"STRING",
")",
"{",
"return",
"Column",
".",
"create",
"(",
"cell",
".",
"getSt... | Specific columntypes are permitted in the import. The supported columntypes are specified in
the method.
@param sheet worksheet
@param cell cell on worksheet
@return Column | [
"Specific",
"columntypes",
"are",
"permitted",
"in",
"the",
"import",
".",
"The",
"supported",
"columntypes",
"are",
"specified",
"in",
"the",
"method",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-one-click-importer/src/main/java/org/molgenis/oneclickimporter/service/impl/OneClickImporterServiceImpl.java#L171-L182 | train |
molgenis/molgenis | molgenis-one-click-importer/src/main/java/org/molgenis/oneclickimporter/service/impl/OneClickImporterServiceImpl.java | OneClickImporterServiceImpl.getCellValue | private Object getCellValue(Cell cell) {
Object value;
// Empty cells are null, instead of BLANK
if (cell == null) {
return null;
}
switch (cell.getCellTypeEnum()) {
case STRING:
value = cell.getStringCellValue();
break;
case NUMERIC:
if (isCellDateFormatt... | java | private Object getCellValue(Cell cell) {
Object value;
// Empty cells are null, instead of BLANK
if (cell == null) {
return null;
}
switch (cell.getCellTypeEnum()) {
case STRING:
value = cell.getStringCellValue();
break;
case NUMERIC:
if (isCellDateFormatt... | [
"private",
"Object",
"getCellValue",
"(",
"Cell",
"cell",
")",
"{",
"Object",
"value",
";",
"// Empty cells are null, instead of BLANK",
"if",
"(",
"cell",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"switch",
"(",
"cell",
".",
"getCellTypeEnum",
"(",
... | Retrieves the proper Java type instance based on the Excel CellTypeEnum | [
"Retrieves",
"the",
"proper",
"Java",
"type",
"instance",
"based",
"on",
"the",
"Excel",
"CellTypeEnum"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-one-click-importer/src/main/java/org/molgenis/oneclickimporter/service/impl/OneClickImporterServiceImpl.java#L194-L233 | train |
molgenis/molgenis | molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java | EntityTypeValidator.validate | public void validate(EntityType entityType) {
validateEntityId(entityType);
validateEntityLabel(entityType);
validatePackage(entityType);
validateExtends(entityType);
validateOwnAttributes(entityType);
Map<String, Attribute> ownAllAttrMap =
stream(entityType.getOwnAllAttributes())
... | java | public void validate(EntityType entityType) {
validateEntityId(entityType);
validateEntityLabel(entityType);
validatePackage(entityType);
validateExtends(entityType);
validateOwnAttributes(entityType);
Map<String, Attribute> ownAllAttrMap =
stream(entityType.getOwnAllAttributes())
... | [
"public",
"void",
"validate",
"(",
"EntityType",
"entityType",
")",
"{",
"validateEntityId",
"(",
"entityType",
")",
";",
"validateEntityLabel",
"(",
"entityType",
")",
";",
"validatePackage",
"(",
"entityType",
")",
";",
"validateExtends",
"(",
"entityType",
")",... | Validates entity meta data
@param entityType entity meta data
@throws MolgenisValidationException if entity meta data is not valid | [
"Validates",
"entity",
"meta",
"data"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java#L45-L61 | train |
molgenis/molgenis | molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java | EntityTypeValidator.validateBackend | void validateBackend(EntityType entityType) {
// Validate backend exists
String backendName = entityType.getBackend();
if (!dataService.getMeta().hasBackend(backendName)) {
throw new MolgenisValidationException(
new ConstraintViolation(format("Unknown backend [%s]", backendName)));
}
} | java | void validateBackend(EntityType entityType) {
// Validate backend exists
String backendName = entityType.getBackend();
if (!dataService.getMeta().hasBackend(backendName)) {
throw new MolgenisValidationException(
new ConstraintViolation(format("Unknown backend [%s]", backendName)));
}
} | [
"void",
"validateBackend",
"(",
"EntityType",
"entityType",
")",
"{",
"// Validate backend exists",
"String",
"backendName",
"=",
"entityType",
".",
"getBackend",
"(",
")",
";",
"if",
"(",
"!",
"dataService",
".",
"getMeta",
"(",
")",
".",
"hasBackend",
"(",
"... | Validate that the entity meta data backend exists
@param entityType entity meta data
@throws MolgenisValidationException if the entity meta data backend does not exist | [
"Validate",
"that",
"the",
"entity",
"meta",
"data",
"backend",
"exists"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java#L95-L102 | train |
molgenis/molgenis | molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java | EntityTypeValidator.validateOwnLookupAttributes | static void validateOwnLookupAttributes(
EntityType entityType, Map<String, Attribute> ownAllAttrMap) {
// Validate lookup attributes
entityType
.getOwnLookupAttributes()
.forEach(
ownLookupAttr -> {
// Validate that lookup attribute is in the attributes list
... | java | static void validateOwnLookupAttributes(
EntityType entityType, Map<String, Attribute> ownAllAttrMap) {
// Validate lookup attributes
entityType
.getOwnLookupAttributes()
.forEach(
ownLookupAttr -> {
// Validate that lookup attribute is in the attributes list
... | [
"static",
"void",
"validateOwnLookupAttributes",
"(",
"EntityType",
"entityType",
",",
"Map",
"<",
"String",
",",
"Attribute",
">",
"ownAllAttrMap",
")",
"{",
"// Validate lookup attributes",
"entityType",
".",
"getOwnLookupAttributes",
"(",
")",
".",
"forEach",
"(",
... | Validate that the lookup attributes owned by this entity are part of the owned attributes.
@param entityType entity meta data
@param ownAllAttrMap attribute identifier to attribute map
@throws MolgenisValidationException if one or more lookup attributes are not entity attributes | [
"Validate",
"that",
"the",
"lookup",
"attributes",
"owned",
"by",
"this",
"entity",
"are",
"part",
"of",
"the",
"owned",
"attributes",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java#L111-L137 | train |
molgenis/molgenis | molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java | EntityTypeValidator.validateOwnLabelAttribute | static void validateOwnLabelAttribute(
EntityType entityType, Map<String, Attribute> ownAllAttrMap) {
// Validate label attribute
Attribute ownLabelAttr = entityType.getOwnLabelAttribute();
if (ownLabelAttr != null) {
// Validate that label attribute is in the attributes list
Attribute own... | java | static void validateOwnLabelAttribute(
EntityType entityType, Map<String, Attribute> ownAllAttrMap) {
// Validate label attribute
Attribute ownLabelAttr = entityType.getOwnLabelAttribute();
if (ownLabelAttr != null) {
// Validate that label attribute is in the attributes list
Attribute own... | [
"static",
"void",
"validateOwnLabelAttribute",
"(",
"EntityType",
"entityType",
",",
"Map",
"<",
"String",
",",
"Attribute",
">",
"ownAllAttrMap",
")",
"{",
"// Validate label attribute",
"Attribute",
"ownLabelAttr",
"=",
"entityType",
".",
"getOwnLabelAttribute",
"(",
... | Validate that the label attribute owned by this entity is part of the owned attributes.
@param entityType entity meta data
@param ownAllAttrMap attribute identifier to attribute map
@throws MolgenisValidationException if the label attribute is not an entity attribute | [
"Validate",
"that",
"the",
"label",
"attribute",
"owned",
"by",
"this",
"entity",
"is",
"part",
"of",
"the",
"owned",
"attributes",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java#L146-L170 | train |
molgenis/molgenis | molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java | EntityTypeValidator.validateOwnIdAttribute | static void validateOwnIdAttribute(EntityType entityType, Map<String, Attribute> ownAllAttrMap) {
// Validate ID attribute
Attribute ownIdAttr = entityType.getOwnIdAttribute();
if (ownIdAttr != null) {
// Validate that ID attribute is in the attributes list
Attribute ownAttr = ownAllAttrMap.get(... | java | static void validateOwnIdAttribute(EntityType entityType, Map<String, Attribute> ownAllAttrMap) {
// Validate ID attribute
Attribute ownIdAttr = entityType.getOwnIdAttribute();
if (ownIdAttr != null) {
// Validate that ID attribute is in the attributes list
Attribute ownAttr = ownAllAttrMap.get(... | [
"static",
"void",
"validateOwnIdAttribute",
"(",
"EntityType",
"entityType",
",",
"Map",
"<",
"String",
",",
"Attribute",
">",
"ownAllAttrMap",
")",
"{",
"// Validate ID attribute",
"Attribute",
"ownIdAttr",
"=",
"entityType",
".",
"getOwnIdAttribute",
"(",
")",
";"... | Validate that the ID attribute owned by this entity is part of the owned attributes.
@param entityType entity meta data
@param ownAllAttrMap attribute identifier to attribute map
@throws MolgenisValidationException if the ID attribute is not an entity attribute | [
"Validate",
"that",
"the",
"ID",
"attribute",
"owned",
"by",
"this",
"entity",
"is",
"part",
"of",
"the",
"owned",
"attributes",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java#L179-L226 | train |
molgenis/molgenis | molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java | EntityTypeValidator.validateExtends | static void validateExtends(EntityType entityType) {
EntityType entityTypeExtends = entityType.getExtends();
if (entityTypeExtends != null && !entityTypeExtends.isAbstract()) {
throw new MolgenisValidationException(
new ConstraintViolation(
format(
"EntityType [%s... | java | static void validateExtends(EntityType entityType) {
EntityType entityTypeExtends = entityType.getExtends();
if (entityTypeExtends != null && !entityTypeExtends.isAbstract()) {
throw new MolgenisValidationException(
new ConstraintViolation(
format(
"EntityType [%s... | [
"static",
"void",
"validateExtends",
"(",
"EntityType",
"entityType",
")",
"{",
"EntityType",
"entityTypeExtends",
"=",
"entityType",
".",
"getExtends",
"(",
")",
";",
"if",
"(",
"entityTypeExtends",
"!=",
"null",
"&&",
"!",
"entityTypeExtends",
".",
"isAbstract",... | Validates if this entityType extends another entityType. If so, checks whether that parent
entityType is abstract.
@param entityType entity meta data
@throws MolgenisValidationException if the entity extends from a non-abstract entity | [
"Validates",
"if",
"this",
"entityType",
"extends",
"another",
"entityType",
".",
"If",
"so",
"checks",
"whether",
"that",
"parent",
"entityType",
"is",
"abstract",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java#L273-L282 | train |
molgenis/molgenis | molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java | EntityTypeValidator.validatePackage | void validatePackage(EntityType entityType) {
Package pack = entityType.getPackage();
if (pack != null
&& isSystemPackage(pack)
&& !systemEntityTypeRegistry.hasSystemEntityType(entityType.getId())) {
throw new MolgenisValidationException(
new ConstraintViolation(
fo... | java | void validatePackage(EntityType entityType) {
Package pack = entityType.getPackage();
if (pack != null
&& isSystemPackage(pack)
&& !systemEntityTypeRegistry.hasSystemEntityType(entityType.getId())) {
throw new MolgenisValidationException(
new ConstraintViolation(
fo... | [
"void",
"validatePackage",
"(",
"EntityType",
"entityType",
")",
"{",
"Package",
"pack",
"=",
"entityType",
".",
"getPackage",
"(",
")",
";",
"if",
"(",
"pack",
"!=",
"null",
"&&",
"isSystemPackage",
"(",
"pack",
")",
"&&",
"!",
"systemEntityTypeRegistry",
"... | Validate that non-system entities are not assigned to a system package
@param entityType entity type | [
"Validate",
"that",
"non",
"-",
"system",
"entities",
"are",
"not",
"assigned",
"to",
"a",
"system",
"package"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java#L333-L344 | train |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/listeners/EntityListenersService.java | EntityListenersService.register | void register(String repoFullName) {
lock.writeLock().lock();
try {
if (!entityListenersByRepo.containsKey(requireNonNull(repoFullName))) {
entityListenersByRepo.put(repoFullName, HashMultimap.create());
}
} finally {
lock.writeLock().unlock();
}
} | java | void register(String repoFullName) {
lock.writeLock().lock();
try {
if (!entityListenersByRepo.containsKey(requireNonNull(repoFullName))) {
entityListenersByRepo.put(repoFullName, HashMultimap.create());
}
} finally {
lock.writeLock().unlock();
}
} | [
"void",
"register",
"(",
"String",
"repoFullName",
")",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"entityListenersByRepo",
".",
"containsKey",
"(",
"requireNonNull",
"(",
"repoFullName",
")",
")",
")... | Register a repository to the entity listeners service once | [
"Register",
"a",
"repository",
"to",
"the",
"entity",
"listeners",
"service",
"once"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/listeners/EntityListenersService.java#L27-L36 | train |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/listeners/EntityListenersService.java | EntityListenersService.updateEntities | Stream<Entity> updateEntities(String repoFullName, Stream<Entity> entities) {
lock.readLock().lock();
try {
verifyRepoRegistered(repoFullName);
SetMultimap<Object, EntityListener> entityListeners =
this.entityListenersByRepo.get(repoFullName);
return entities.filter(
entity... | java | Stream<Entity> updateEntities(String repoFullName, Stream<Entity> entities) {
lock.readLock().lock();
try {
verifyRepoRegistered(repoFullName);
SetMultimap<Object, EntityListener> entityListeners =
this.entityListenersByRepo.get(repoFullName);
return entities.filter(
entity... | [
"Stream",
"<",
"Entity",
">",
"updateEntities",
"(",
"String",
"repoFullName",
",",
"Stream",
"<",
"Entity",
">",
"entities",
")",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"verifyRepoRegistered",
"(",
"repoFullName",
... | Update all registered listeners of the entities
@return Stream<Entity> | [
"Update",
"all",
"registered",
"listeners",
"of",
"the",
"entities"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/listeners/EntityListenersService.java#L43-L58 | train |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/listeners/EntityListenersService.java | EntityListenersService.updateEntity | void updateEntity(String repoFullName, Entity entity) {
lock.readLock().lock();
try {
verifyRepoRegistered(repoFullName);
SetMultimap<Object, EntityListener> entityListeners =
this.entityListenersByRepo.get(repoFullName);
Set<EntityListener> entityEntityListeners = entityListeners.ge... | java | void updateEntity(String repoFullName, Entity entity) {
lock.readLock().lock();
try {
verifyRepoRegistered(repoFullName);
SetMultimap<Object, EntityListener> entityListeners =
this.entityListenersByRepo.get(repoFullName);
Set<EntityListener> entityEntityListeners = entityListeners.ge... | [
"void",
"updateEntity",
"(",
"String",
"repoFullName",
",",
"Entity",
"entity",
")",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"verifyRepoRegistered",
"(",
"repoFullName",
")",
";",
"SetMultimap",
"<",
"Object",
",",
... | Update all registered listeners of an entity | [
"Update",
"all",
"registered",
"listeners",
"of",
"an",
"entity"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/listeners/EntityListenersService.java#L61-L72 | train |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/listeners/EntityListenersService.java | EntityListenersService.addEntityListener | public void addEntityListener(String repoFullName, EntityListener entityListener) {
lock.writeLock().lock();
try {
verifyRepoRegistered(repoFullName);
SetMultimap<Object, EntityListener> entityListeners =
this.entityListenersByRepo.get(repoFullName);
entityListeners.put(entityListene... | java | public void addEntityListener(String repoFullName, EntityListener entityListener) {
lock.writeLock().lock();
try {
verifyRepoRegistered(repoFullName);
SetMultimap<Object, EntityListener> entityListeners =
this.entityListenersByRepo.get(repoFullName);
entityListeners.put(entityListene... | [
"public",
"void",
"addEntityListener",
"(",
"String",
"repoFullName",
",",
"EntityListener",
"entityListener",
")",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"verifyRepoRegistered",
"(",
"repoFullName",
")",
";",
"SetMult... | Adds an entity listener for a entity of the given class that listens to entity changes
@param entityListener entity listener for a entity | [
"Adds",
"an",
"entity",
"listener",
"for",
"a",
"entity",
"of",
"the",
"given",
"class",
"that",
"listens",
"to",
"entity",
"changes"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/listeners/EntityListenersService.java#L79-L89 | train |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/listeners/EntityListenersService.java | EntityListenersService.removeEntityListener | public boolean removeEntityListener(String repoFullName, EntityListener entityListener) {
lock.writeLock().lock();
try {
verifyRepoRegistered(repoFullName);
SetMultimap<Object, EntityListener> entityListeners =
this.entityListenersByRepo.get(repoFullName);
if (entityListeners.contain... | java | public boolean removeEntityListener(String repoFullName, EntityListener entityListener) {
lock.writeLock().lock();
try {
verifyRepoRegistered(repoFullName);
SetMultimap<Object, EntityListener> entityListeners =
this.entityListenersByRepo.get(repoFullName);
if (entityListeners.contain... | [
"public",
"boolean",
"removeEntityListener",
"(",
"String",
"repoFullName",
",",
"EntityListener",
"entityListener",
")",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"verifyRepoRegistered",
"(",
"repoFullName",
")",
";",
"S... | Removes an entity listener for a entity of the given class
@param entityListener entity listener for a entity
@return boolean | [
"Removes",
"an",
"entity",
"listener",
"for",
"a",
"entity",
"of",
"the",
"given",
"class"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/listeners/EntityListenersService.java#L97-L111 | train |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/listeners/EntityListenersService.java | EntityListenersService.isEmpty | boolean isEmpty(String repoFullName) {
lock.readLock().lock();
try {
verifyRepoRegistered(repoFullName);
return entityListenersByRepo.get(repoFullName).isEmpty();
} finally {
lock.readLock().unlock();
}
} | java | boolean isEmpty(String repoFullName) {
lock.readLock().lock();
try {
verifyRepoRegistered(repoFullName);
return entityListenersByRepo.get(repoFullName).isEmpty();
} finally {
lock.readLock().unlock();
}
} | [
"boolean",
"isEmpty",
"(",
"String",
"repoFullName",
")",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"verifyRepoRegistered",
"(",
"repoFullName",
")",
";",
"return",
"entityListenersByRepo",
".",
"get",
"(",
"repoFullName... | Check if a repository has no listeners Repository must be registered
@return boolean | [
"Check",
"if",
"a",
"repository",
"has",
"no",
"listeners",
"Repository",
"must",
"be",
"registered"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/listeners/EntityListenersService.java#L118-L126 | train |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/listeners/EntityListenersService.java | EntityListenersService.verifyRepoRegistered | private void verifyRepoRegistered(String repoFullName) {
lock.readLock().lock();
try {
if (!entityListenersByRepo.containsKey(requireNonNull(repoFullName))) {
LOG.error(
"Repository [{}] is not registered in the entity listeners service", repoFullName);
throw new MolgenisDataEx... | java | private void verifyRepoRegistered(String repoFullName) {
lock.readLock().lock();
try {
if (!entityListenersByRepo.containsKey(requireNonNull(repoFullName))) {
LOG.error(
"Repository [{}] is not registered in the entity listeners service", repoFullName);
throw new MolgenisDataEx... | [
"private",
"void",
"verifyRepoRegistered",
"(",
"String",
"repoFullName",
")",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"entityListenersByRepo",
".",
"containsKey",
"(",
"requireNonNull",
"(",
"repoFullN... | Verify that the repository is registered | [
"Verify",
"that",
"the",
"repository",
"is",
"registered"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/listeners/EntityListenersService.java#L129-L143 | train |
molgenis/molgenis | molgenis-data-i18n/src/main/java/org/molgenis/data/i18n/LocalizationPopulator.java | LocalizationPopulator.populateLocalizationStrings | @Transactional
public void populateLocalizationStrings(AllPropertiesMessageSource source) {
source
.getAllMessageIds()
.asMap()
.forEach(
(namespace, messageIds) ->
updateNamespace(source, namespace, ImmutableSet.copyOf(messageIds)));
} | java | @Transactional
public void populateLocalizationStrings(AllPropertiesMessageSource source) {
source
.getAllMessageIds()
.asMap()
.forEach(
(namespace, messageIds) ->
updateNamespace(source, namespace, ImmutableSet.copyOf(messageIds)));
} | [
"@",
"Transactional",
"public",
"void",
"populateLocalizationStrings",
"(",
"AllPropertiesMessageSource",
"source",
")",
"{",
"source",
".",
"getAllMessageIds",
"(",
")",
".",
"asMap",
"(",
")",
".",
"forEach",
"(",
"(",
"namespace",
",",
"messageIds",
")",
"->"... | Adds all values in all namespaces from those specified in the property files for that
namespace.
<p>Already existing values are left exactly how they are. All new values are written to the
repository.
<p>If no {@link L10nString} exists yet for a certain messageID, a new one will be added. | [
"Adds",
"all",
"values",
"in",
"all",
"namespaces",
"from",
"those",
"specified",
"in",
"the",
"property",
"files",
"for",
"that",
"namespace",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-i18n/src/main/java/org/molgenis/data/i18n/LocalizationPopulator.java#L43-L51 | train |
molgenis/molgenis | molgenis-core-ui/src/main/java/org/molgenis/core/ui/MolgenisMenuController.java | MolgenisMenuController.forwardDefaultMenuDefaultPlugin | @SuppressWarnings("squid:S3752") // multiple methods required
@RequestMapping(method = {RequestMethod.GET, RequestMethod.POST})
public String forwardDefaultMenuDefaultPlugin(Model model) {
Menu menu =
menuReaderService
.getMenu()
.orElseThrow(() -> new RuntimeException("main menu... | java | @SuppressWarnings("squid:S3752") // multiple methods required
@RequestMapping(method = {RequestMethod.GET, RequestMethod.POST})
public String forwardDefaultMenuDefaultPlugin(Model model) {
Menu menu =
menuReaderService
.getMenu()
.orElseThrow(() -> new RuntimeException("main menu... | [
"@",
"SuppressWarnings",
"(",
"\"squid:S3752\"",
")",
"// multiple methods required",
"@",
"RequestMapping",
"(",
"method",
"=",
"{",
"RequestMethod",
".",
"GET",
",",
"RequestMethod",
".",
"POST",
"}",
")",
"public",
"String",
"forwardDefaultMenuDefaultPlugin",
"(",
... | Forwards to the first plugin of the first menu that the user can read since no menu path is
provided. | [
"Forwards",
"to",
"the",
"first",
"plugin",
"of",
"the",
"first",
"menu",
"that",
"the",
"user",
"can",
"read",
"since",
"no",
"menu",
"path",
"is",
"provided",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/MolgenisMenuController.java#L77-L99 | train |
molgenis/molgenis | molgenis-data-security/src/main/java/org/molgenis/data/security/owned/RowLevelSecurityRepositoryDecorator.java | RowLevelSecurityRepositoryDecorator.getPermission | private EntityPermission getPermission(Action operation) {
EntityPermission result;
switch (operation) {
case COUNT:
case READ:
result = EntityPermission.READ;
break;
case UPDATE:
result = EntityPermission.UPDATE;
break;
case DELETE:
result = Entit... | java | private EntityPermission getPermission(Action operation) {
EntityPermission result;
switch (operation) {
case COUNT:
case READ:
result = EntityPermission.READ;
break;
case UPDATE:
result = EntityPermission.UPDATE;
break;
case DELETE:
result = Entit... | [
"private",
"EntityPermission",
"getPermission",
"(",
"Action",
"operation",
")",
"{",
"EntityPermission",
"result",
";",
"switch",
"(",
"operation",
")",
"{",
"case",
"COUNT",
":",
"case",
"READ",
":",
"result",
"=",
"EntityPermission",
".",
"READ",
";",
"brea... | Finds out what permission to check for an operation that is being performed on this repository.
@param operation the Operation that is being performed on the repository
@return the EntityPermission to check | [
"Finds",
"out",
"what",
"permission",
"to",
"check",
"for",
"an",
"operation",
"that",
"is",
"being",
"performed",
"on",
"this",
"repository",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-security/src/main/java/org/molgenis/data/security/owned/RowLevelSecurityRepositoryDecorator.java#L67-L86 | train |
molgenis/molgenis | molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/job/MappingJobConfig.java | MappingJobConfig.mappingJobFactory | @Bean
public JobFactory<MappingJobExecution> mappingJobFactory() {
return new JobFactory<MappingJobExecution>() {
@Override
public Job createJob(MappingJobExecution mappingJobExecution) {
final String mappingProjectId = mappingJobExecution.getMappingProjectId();
final String targetEnti... | java | @Bean
public JobFactory<MappingJobExecution> mappingJobFactory() {
return new JobFactory<MappingJobExecution>() {
@Override
public Job createJob(MappingJobExecution mappingJobExecution) {
final String mappingProjectId = mappingJobExecution.getMappingProjectId();
final String targetEnti... | [
"@",
"Bean",
"public",
"JobFactory",
"<",
"MappingJobExecution",
">",
"mappingJobFactory",
"(",
")",
"{",
"return",
"new",
"JobFactory",
"<",
"MappingJobExecution",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Job",
"createJob",
"(",
"MappingJobExecution",
"m... | The MappingJob Factory bean. | [
"The",
"MappingJob",
"Factory",
"bean",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/job/MappingJobConfig.java#L45-L70 | train |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/DataConverter.java | DataConverter.convert | public static Object convert(Object source, Attribute attr) {
try {
return convert(source, attr.getDataType());
} catch (DataConversionException e) {
throw new AttributeValueConversionException(
format(
"Conversion failure in entity type [%s] attribute [%s]; %s",
... | java | public static Object convert(Object source, Attribute attr) {
try {
return convert(source, attr.getDataType());
} catch (DataConversionException e) {
throw new AttributeValueConversionException(
format(
"Conversion failure in entity type [%s] attribute [%s]; %s",
... | [
"public",
"static",
"Object",
"convert",
"(",
"Object",
"source",
",",
"Attribute",
"attr",
")",
"{",
"try",
"{",
"return",
"convert",
"(",
"source",
",",
"attr",
".",
"getDataType",
"(",
")",
")",
";",
"}",
"catch",
"(",
"DataConversionException",
"e",
... | Convert value to the type based on the given attribute.
@param source value to convert
@param attr attribute that defines the type of the converted value
@return converted value or the input value if the attribute type is a reference type
@throws AttributeValueConversionException if conversion failed | [
"Convert",
"value",
"to",
"the",
"type",
"based",
"on",
"the",
"given",
"attribute",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/DataConverter.java#L54-L64 | train |
molgenis/molgenis | molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java | RestController.entityExists | @GetMapping(value = "/{entityTypeId}/exist", produces = APPLICATION_JSON_VALUE)
public boolean entityExists(@PathVariable("entityTypeId") String entityTypeId) {
return dataService.hasRepository(entityTypeId);
} | java | @GetMapping(value = "/{entityTypeId}/exist", produces = APPLICATION_JSON_VALUE)
public boolean entityExists(@PathVariable("entityTypeId") String entityTypeId) {
return dataService.hasRepository(entityTypeId);
} | [
"@",
"GetMapping",
"(",
"value",
"=",
"\"/{entityTypeId}/exist\"",
",",
"produces",
"=",
"APPLICATION_JSON_VALUE",
")",
"public",
"boolean",
"entityExists",
"(",
"@",
"PathVariable",
"(",
"\"entityTypeId\"",
")",
"String",
"entityTypeId",
")",
"{",
"return",
"dataSe... | Checks if an entity exists. | [
"Checks",
"if",
"an",
"entity",
"exists",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java#L164-L167 | train |
molgenis/molgenis | molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java | RestController.retrieveEntityType | @GetMapping(value = "/{entityTypeId}/meta", produces = APPLICATION_JSON_VALUE)
public EntityTypeResponse retrieveEntityType(
@PathVariable("entityTypeId") String entityTypeId,
@RequestParam(value = "attributes", required = false) String[] attributes,
@RequestParam(value = "expand", required = false)... | java | @GetMapping(value = "/{entityTypeId}/meta", produces = APPLICATION_JSON_VALUE)
public EntityTypeResponse retrieveEntityType(
@PathVariable("entityTypeId") String entityTypeId,
@RequestParam(value = "attributes", required = false) String[] attributes,
@RequestParam(value = "expand", required = false)... | [
"@",
"GetMapping",
"(",
"value",
"=",
"\"/{entityTypeId}/meta\"",
",",
"produces",
"=",
"APPLICATION_JSON_VALUE",
")",
"public",
"EntityTypeResponse",
"retrieveEntityType",
"(",
"@",
"PathVariable",
"(",
"\"entityTypeId\"",
")",
"String",
"entityTypeId",
",",
"@",
"Re... | Gets the metadata for an entity
<p>Example url: /api/v1/person/meta
@return EntityType | [
"Gets",
"the",
"metadata",
"for",
"an",
"entity"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java#L176-L187 | train |
molgenis/molgenis | molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java | RestController.retrieveEntity | @GetMapping(value = "/{entityTypeId}/{id}", produces = APPLICATION_JSON_VALUE)
public Map<String, Object> retrieveEntity(
@PathVariable("entityTypeId") String entityTypeId,
@PathVariable("id") String untypedId,
@RequestParam(value = "attributes", required = false) String[] attributes,
@Request... | java | @GetMapping(value = "/{entityTypeId}/{id}", produces = APPLICATION_JSON_VALUE)
public Map<String, Object> retrieveEntity(
@PathVariable("entityTypeId") String entityTypeId,
@PathVariable("id") String untypedId,
@RequestParam(value = "attributes", required = false) String[] attributes,
@Request... | [
"@",
"GetMapping",
"(",
"value",
"=",
"\"/{entityTypeId}/{id}\"",
",",
"produces",
"=",
"APPLICATION_JSON_VALUE",
")",
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"retrieveEntity",
"(",
"@",
"PathVariable",
"(",
"\"entityTypeId\"",
")",
"String",
"entityTy... | Get's an entity by it's id
<p>Examples:
<p>/api/v1/person/99 Retrieves a person with id 99 | [
"Get",
"s",
"an",
"entity",
"by",
"it",
"s",
"id"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java#L256-L273 | train |
molgenis/molgenis | molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java | RestController.deleteDelete | @Transactional
@DeleteMapping("/{entityTypeId}/{id}")
@ResponseStatus(NO_CONTENT)
public void deleteDelete(
@PathVariable("entityTypeId") String entityTypeId, @PathVariable("id") String untypedId) {
delete(entityTypeId, untypedId);
} | java | @Transactional
@DeleteMapping("/{entityTypeId}/{id}")
@ResponseStatus(NO_CONTENT)
public void deleteDelete(
@PathVariable("entityTypeId") String entityTypeId, @PathVariable("id") String untypedId) {
delete(entityTypeId, untypedId);
} | [
"@",
"Transactional",
"@",
"DeleteMapping",
"(",
"\"/{entityTypeId}/{id}\"",
")",
"@",
"ResponseStatus",
"(",
"NO_CONTENT",
")",
"public",
"void",
"deleteDelete",
"(",
"@",
"PathVariable",
"(",
"\"entityTypeId\"",
")",
"String",
"entityTypeId",
",",
"@",
"PathVariab... | Deletes an entity by it's id | [
"Deletes",
"an",
"entity",
"by",
"it",
"s",
"id"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java#L689-L695 | train |
molgenis/molgenis | molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java | RestController.deletePost | @PostMapping(value = "/{entityTypeId}/{id}", params = "_method=DELETE")
@ResponseStatus(NO_CONTENT)
public void deletePost(
@PathVariable("entityTypeId") String entityTypeId, @PathVariable("id") String untypedId) {
delete(entityTypeId, untypedId);
} | java | @PostMapping(value = "/{entityTypeId}/{id}", params = "_method=DELETE")
@ResponseStatus(NO_CONTENT)
public void deletePost(
@PathVariable("entityTypeId") String entityTypeId, @PathVariable("id") String untypedId) {
delete(entityTypeId, untypedId);
} | [
"@",
"PostMapping",
"(",
"value",
"=",
"\"/{entityTypeId}/{id}\"",
",",
"params",
"=",
"\"_method=DELETE\"",
")",
"@",
"ResponseStatus",
"(",
"NO_CONTENT",
")",
"public",
"void",
"deletePost",
"(",
"@",
"PathVariable",
"(",
"\"entityTypeId\"",
")",
"String",
"enti... | Deletes an entity by it's id but tunnels DELETE through POST
<p>Example url: /api/v1/person/99?_method=DELETE | [
"Deletes",
"an",
"entity",
"by",
"it",
"s",
"id",
"but",
"tunnels",
"DELETE",
"through",
"POST"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java#L702-L707 | train |
molgenis/molgenis | molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java | RestController.deleteAll | @DeleteMapping("/{entityTypeId}")
@ResponseStatus(NO_CONTENT)
public void deleteAll(@PathVariable("entityTypeId") String entityTypeId) {
dataService.deleteAll(entityTypeId);
} | java | @DeleteMapping("/{entityTypeId}")
@ResponseStatus(NO_CONTENT)
public void deleteAll(@PathVariable("entityTypeId") String entityTypeId) {
dataService.deleteAll(entityTypeId);
} | [
"@",
"DeleteMapping",
"(",
"\"/{entityTypeId}\"",
")",
"@",
"ResponseStatus",
"(",
"NO_CONTENT",
")",
"public",
"void",
"deleteAll",
"(",
"@",
"PathVariable",
"(",
"\"entityTypeId\"",
")",
"String",
"entityTypeId",
")",
"{",
"dataService",
".",
"deleteAll",
"(",
... | Deletes all entities for the given entity name | [
"Deletes",
"all",
"entities",
"for",
"the",
"given",
"entity",
"name"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java#L721-L725 | train |
molgenis/molgenis | molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java | RestController.deleteAllPost | @PostMapping(value = "/{entityTypeId}", params = "_method=DELETE")
@ResponseStatus(NO_CONTENT)
public void deleteAllPost(@PathVariable("entityTypeId") String entityTypeId) {
dataService.deleteAll(entityTypeId);
} | java | @PostMapping(value = "/{entityTypeId}", params = "_method=DELETE")
@ResponseStatus(NO_CONTENT)
public void deleteAllPost(@PathVariable("entityTypeId") String entityTypeId) {
dataService.deleteAll(entityTypeId);
} | [
"@",
"PostMapping",
"(",
"value",
"=",
"\"/{entityTypeId}\"",
",",
"params",
"=",
"\"_method=DELETE\"",
")",
"@",
"ResponseStatus",
"(",
"NO_CONTENT",
")",
"public",
"void",
"deleteAllPost",
"(",
"@",
"PathVariable",
"(",
"\"entityTypeId\"",
")",
"String",
"entity... | Deletes all entities for the given entity name but tunnels DELETE through POST | [
"Deletes",
"all",
"entities",
"for",
"the",
"given",
"entity",
"name",
"but",
"tunnels",
"DELETE",
"through",
"POST"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java#L728-L732 | train |
molgenis/molgenis | molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java | RestController.deleteMeta | @DeleteMapping(value = "/{entityTypeId}/meta")
@ResponseStatus(NO_CONTENT)
public void deleteMeta(@PathVariable("entityTypeId") String entityTypeId) {
deleteMetaInternal(entityTypeId);
} | java | @DeleteMapping(value = "/{entityTypeId}/meta")
@ResponseStatus(NO_CONTENT)
public void deleteMeta(@PathVariable("entityTypeId") String entityTypeId) {
deleteMetaInternal(entityTypeId);
} | [
"@",
"DeleteMapping",
"(",
"value",
"=",
"\"/{entityTypeId}/meta\"",
")",
"@",
"ResponseStatus",
"(",
"NO_CONTENT",
")",
"public",
"void",
"deleteMeta",
"(",
"@",
"PathVariable",
"(",
"\"entityTypeId\"",
")",
"String",
"entityTypeId",
")",
"{",
"deleteMetaInternal",... | Deletes all entities and entity meta data for the given entity name | [
"Deletes",
"all",
"entities",
"and",
"entity",
"meta",
"data",
"for",
"the",
"given",
"entity",
"name"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java#L735-L739 | train |
molgenis/molgenis | molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java | RestController.deleteMetaPost | @PostMapping(value = "/{entityTypeId}/meta", params = "_method=DELETE")
@ResponseStatus(NO_CONTENT)
public void deleteMetaPost(@PathVariable("entityTypeId") String entityTypeId) {
deleteMetaInternal(entityTypeId);
} | java | @PostMapping(value = "/{entityTypeId}/meta", params = "_method=DELETE")
@ResponseStatus(NO_CONTENT)
public void deleteMetaPost(@PathVariable("entityTypeId") String entityTypeId) {
deleteMetaInternal(entityTypeId);
} | [
"@",
"PostMapping",
"(",
"value",
"=",
"\"/{entityTypeId}/meta\"",
",",
"params",
"=",
"\"_method=DELETE\"",
")",
"@",
"ResponseStatus",
"(",
"NO_CONTENT",
")",
"public",
"void",
"deleteMetaPost",
"(",
"@",
"PathVariable",
"(",
"\"entityTypeId\"",
")",
"String",
"... | Deletes all entities and entity meta data for the given entity name but tunnels DELETE through
POST | [
"Deletes",
"all",
"entities",
"and",
"entity",
"meta",
"data",
"for",
"the",
"given",
"entity",
"name",
"but",
"tunnels",
"DELETE",
"through",
"POST"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java#L745-L749 | train |
molgenis/molgenis | molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java | RestController.retrieveEntityCollectionInternal | @SuppressWarnings("deprecation")
private EntityCollectionResponse retrieveEntityCollectionInternal(
String entityTypeId,
EntityCollectionRequest request,
Set<String> attributesSet,
Map<String, Set<String>> attributeExpandsSet) {
EntityType meta = dataService.getEntityType(entityTypeId);
... | java | @SuppressWarnings("deprecation")
private EntityCollectionResponse retrieveEntityCollectionInternal(
String entityTypeId,
EntityCollectionRequest request,
Set<String> attributesSet,
Map<String, Set<String>> attributeExpandsSet) {
EntityType meta = dataService.getEntityType(entityTypeId);
... | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"private",
"EntityCollectionResponse",
"retrieveEntityCollectionInternal",
"(",
"String",
"entityTypeId",
",",
"EntityCollectionRequest",
"request",
",",
"Set",
"<",
"String",
">",
"attributesSet",
",",
"Map",
"<",
"... | Handles a Query | [
"Handles",
"a",
"Query"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java#L1044-L1092 | train |
molgenis/molgenis | molgenis-file-ingester/src/main/java/org/molgenis/file/ingest/execution/FileIngestConfig.java | FileIngestConfig.fileIngestJobFactory | @Bean
public JobFactory<FileIngestJobExecution> fileIngestJobFactory() {
return new JobFactory<FileIngestJobExecution>() {
@Override
public Job createJob(FileIngestJobExecution fileIngestJobExecution) {
final String targetEntityId = fileIngestJobExecution.getTargetEntityId();
final Str... | java | @Bean
public JobFactory<FileIngestJobExecution> fileIngestJobFactory() {
return new JobFactory<FileIngestJobExecution>() {
@Override
public Job createJob(FileIngestJobExecution fileIngestJobExecution) {
final String targetEntityId = fileIngestJobExecution.getTargetEntityId();
final Str... | [
"@",
"Bean",
"public",
"JobFactory",
"<",
"FileIngestJobExecution",
">",
"fileIngestJobFactory",
"(",
")",
"{",
"return",
"new",
"JobFactory",
"<",
"FileIngestJobExecution",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Job",
"createJob",
"(",
"FileIngestJobExec... | The FileIngestJob Factory bean. | [
"The",
"FileIngestJob",
"Factory",
"bean",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-file-ingester/src/main/java/org/molgenis/file/ingest/execution/FileIngestConfig.java#L45-L61 | train |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/util/EntityTypeUtils.java | EntityTypeUtils.getAttributeNames | public static Iterable<String> getAttributeNames(Iterable<Attribute> attrs) {
return () -> stream(attrs).map(Attribute::getName).iterator();
} | java | public static Iterable<String> getAttributeNames(Iterable<Attribute> attrs) {
return () -> stream(attrs).map(Attribute::getName).iterator();
} | [
"public",
"static",
"Iterable",
"<",
"String",
">",
"getAttributeNames",
"(",
"Iterable",
"<",
"Attribute",
">",
"attrs",
")",
"{",
"return",
"(",
")",
"->",
"stream",
"(",
"attrs",
")",
".",
"map",
"(",
"Attribute",
"::",
"getName",
")",
".",
"iterator"... | Returns attribute names for the given attributes
@return attribute names | [
"Returns",
"attribute",
"names",
"for",
"the",
"given",
"attributes"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/util/EntityTypeUtils.java#L290-L292 | train |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/util/EntityTypeUtils.java | EntityTypeUtils.buildFullName | public static String buildFullName(Package aPackage, String simpleName) {
String fullName;
if (aPackage != null) {
fullName = aPackage.getId() + PACKAGE_SEPARATOR + simpleName;
} else {
fullName = simpleName;
}
return fullName;
} | java | public static String buildFullName(Package aPackage, String simpleName) {
String fullName;
if (aPackage != null) {
fullName = aPackage.getId() + PACKAGE_SEPARATOR + simpleName;
} else {
fullName = simpleName;
}
return fullName;
} | [
"public",
"static",
"String",
"buildFullName",
"(",
"Package",
"aPackage",
",",
"String",
"simpleName",
")",
"{",
"String",
"fullName",
";",
"if",
"(",
"aPackage",
"!=",
"null",
")",
"{",
"fullName",
"=",
"aPackage",
".",
"getId",
"(",
")",
"+",
"PACKAGE_S... | Builds and returns an entity full name based on a package and a simpleName
@return String entity full name | [
"Builds",
"and",
"returns",
"an",
"entity",
"full",
"name",
"based",
"on",
"a",
"package",
"and",
"a",
"simpleName"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/util/EntityTypeUtils.java#L299-L307 | train |
molgenis/molgenis | molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/NameValidator.java | NameValidator.checkForKeyword | private static void checkForKeyword(String name) {
if (KEYWORDS.contains(name) || KEYWORDS.contains(name.toUpperCase())) {
throw new MolgenisDataException(
"Name [" + name + "] is not allowed because it is a reserved keyword.");
}
} | java | private static void checkForKeyword(String name) {
if (KEYWORDS.contains(name) || KEYWORDS.contains(name.toUpperCase())) {
throw new MolgenisDataException(
"Name [" + name + "] is not allowed because it is a reserved keyword.");
}
} | [
"private",
"static",
"void",
"checkForKeyword",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"KEYWORDS",
".",
"contains",
"(",
"name",
")",
"||",
"KEYWORDS",
".",
"contains",
"(",
"name",
".",
"toUpperCase",
"(",
")",
")",
")",
"{",
"throw",
"new",
"Mol... | Checks if a name is a reserved keyword. | [
"Checks",
"if",
"a",
"name",
"is",
"a",
"reserved",
"keyword",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/NameValidator.java#L17-L22 | train |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/EntityFactoryRegistry.java | EntityFactoryRegistry.registerStaticEntityFactory | <E extends Entity> void registerStaticEntityFactory(EntityFactory<E, ?> staticEntityFactory) {
String entityTypeId = staticEntityFactory.getEntityTypeId();
staticEntityFactoryMap.put(entityTypeId, staticEntityFactory);
} | java | <E extends Entity> void registerStaticEntityFactory(EntityFactory<E, ?> staticEntityFactory) {
String entityTypeId = staticEntityFactory.getEntityTypeId();
staticEntityFactoryMap.put(entityTypeId, staticEntityFactory);
} | [
"<",
"E",
"extends",
"Entity",
">",
"void",
"registerStaticEntityFactory",
"(",
"EntityFactory",
"<",
"E",
",",
"?",
">",
"staticEntityFactory",
")",
"{",
"String",
"entityTypeId",
"=",
"staticEntityFactory",
".",
"getEntityTypeId",
"(",
")",
";",
"staticEntityFac... | Registers a static entity factory
@param staticEntityFactory static entity factory
@param <E> static entity type (e.g. Tag, Language, Package) | [
"Registers",
"a",
"static",
"entity",
"factory"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/EntityFactoryRegistry.java#L28-L31 | train |
molgenis/molgenis | molgenis-one-click-importer/src/main/java/org/molgenis/oneclickimporter/service/impl/CsvServiceImpl.java | CsvServiceImpl.validateCsvFile | private void validateCsvFile(List<String[]> content, String fileName) {
if (content.isEmpty()) {
throw new MolgenisDataException(format("CSV-file: [{0}] is empty", fileName));
}
if (content.size() == 1) {
throw new MolgenisDataException(
format("Header was found, but no data is presen... | java | private void validateCsvFile(List<String[]> content, String fileName) {
if (content.isEmpty()) {
throw new MolgenisDataException(format("CSV-file: [{0}] is empty", fileName));
}
if (content.size() == 1) {
throw new MolgenisDataException(
format("Header was found, but no data is presen... | [
"private",
"void",
"validateCsvFile",
"(",
"List",
"<",
"String",
"[",
"]",
">",
"content",
",",
"String",
"fileName",
")",
"{",
"if",
"(",
"content",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"MolgenisDataException",
"(",
"format",
"(",
"\"CSV... | Validates CSV file content.
<p>Checks that the content is not empty. Checks that at least one data row is present. Checks
that data row lengths are consistent with the header row length.
@param content content of CSV-file
@param fileName the name of the file that is validated
@throws MolgenisDataException if the vali... | [
"Validates",
"CSV",
"file",
"content",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-one-click-importer/src/main/java/org/molgenis/oneclickimporter/service/impl/CsvServiceImpl.java#L69-L87 | train |
molgenis/molgenis | molgenis-js/src/main/java/org/molgenis/js/magma/JsMagmaScriptEvaluator.java | JsMagmaScriptEvaluator.eval | public Object eval(String expression, Entity entity, int depth) {
return eval(createBindings(entity, depth), expression);
} | java | public Object eval(String expression, Entity entity, int depth) {
return eval(createBindings(entity, depth), expression);
} | [
"public",
"Object",
"eval",
"(",
"String",
"expression",
",",
"Entity",
"entity",
",",
"int",
"depth",
")",
"{",
"return",
"eval",
"(",
"createBindings",
"(",
"entity",
",",
"depth",
")",
",",
"expression",
")",
";",
"}"
] | Evaluate a expression for a given entity.
@param expression JavaScript expression
@param entity entity
@return evaluated expression result, return type depends on the expression. | [
"Evaluate",
"a",
"expression",
"for",
"a",
"given",
"entity",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-js/src/main/java/org/molgenis/js/magma/JsMagmaScriptEvaluator.java#L100-L102 | train |
molgenis/molgenis | molgenis-js/src/main/java/org/molgenis/js/magma/JsMagmaScriptEvaluator.java | JsMagmaScriptEvaluator.eval | private Object eval(Bindings bindings, String expression) {
try {
return jsScriptEngine.eval(bindings, expression);
} catch (javax.script.ScriptException t) {
return new ScriptException(t.getCause().getMessage(), t.getCause());
} catch (Exception t) {
return new ScriptException(t);
}
... | java | private Object eval(Bindings bindings, String expression) {
try {
return jsScriptEngine.eval(bindings, expression);
} catch (javax.script.ScriptException t) {
return new ScriptException(t.getCause().getMessage(), t.getCause());
} catch (Exception t) {
return new ScriptException(t);
}
... | [
"private",
"Object",
"eval",
"(",
"Bindings",
"bindings",
",",
"String",
"expression",
")",
"{",
"try",
"{",
"return",
"jsScriptEngine",
".",
"eval",
"(",
"bindings",
",",
"expression",
")",
";",
"}",
"catch",
"(",
"javax",
".",
"script",
".",
"ScriptExcep... | Evaluates an expression with the given bindings.
@param bindings Bindings to use as engine scope
@param expression JavaScript expression to evaluate
@return evaluated expression result, return type depends on the expression. | [
"Evaluates",
"an",
"expression",
"with",
"the",
"given",
"bindings",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-js/src/main/java/org/molgenis/js/magma/JsMagmaScriptEvaluator.java#L111-L119 | train |
molgenis/molgenis | molgenis-js/src/main/java/org/molgenis/js/magma/JsMagmaScriptEvaluator.java | JsMagmaScriptEvaluator.createBindings | private Bindings createBindings(Entity entity, int depth) {
Bindings bindings = new SimpleBindings();
JSObject global = (JSObject) magmaBindings.get("nashorn.global");
JSObject magmaScript = (JSObject) global.getMember(KEY_MAGMA_SCRIPT);
JSObject dollarFunction = (JSObject) magmaScript.getMember(KEY_DOL... | java | private Bindings createBindings(Entity entity, int depth) {
Bindings bindings = new SimpleBindings();
JSObject global = (JSObject) magmaBindings.get("nashorn.global");
JSObject magmaScript = (JSObject) global.getMember(KEY_MAGMA_SCRIPT);
JSObject dollarFunction = (JSObject) magmaScript.getMember(KEY_DOL... | [
"private",
"Bindings",
"createBindings",
"(",
"Entity",
"entity",
",",
"int",
"depth",
")",
"{",
"Bindings",
"bindings",
"=",
"new",
"SimpleBindings",
"(",
")",
";",
"JSObject",
"global",
"=",
"(",
"JSObject",
")",
"magmaBindings",
".",
"get",
"(",
"\"nashor... | Creates magmascript bindings for a given Entity.
@param entity the entity to bind to the magmascript $ function
@param depth maximum depth to follow references when creating the entity value map
@return Bindings with $ function bound to the entity | [
"Creates",
"magmascript",
"bindings",
"for",
"a",
"given",
"Entity",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-js/src/main/java/org/molgenis/js/magma/JsMagmaScriptEvaluator.java#L128-L139 | train |
molgenis/molgenis | molgenis-js/src/main/java/org/molgenis/js/magma/JsMagmaScriptEvaluator.java | JsMagmaScriptEvaluator.toScriptEngineValueMap | private Object toScriptEngineValueMap(Entity entity, int depth) {
if (entity != null) {
Object idValue = toScriptEngineValue(entity, entity.getEntityType().getIdAttribute(), 0);
if (depth == 0) {
return idValue;
} else {
Map<String, Object> map = Maps.newHashMap();
entity
... | java | private Object toScriptEngineValueMap(Entity entity, int depth) {
if (entity != null) {
Object idValue = toScriptEngineValue(entity, entity.getEntityType().getIdAttribute(), 0);
if (depth == 0) {
return idValue;
} else {
Map<String, Object> map = Maps.newHashMap();
entity
... | [
"private",
"Object",
"toScriptEngineValueMap",
"(",
"Entity",
"entity",
",",
"int",
"depth",
")",
"{",
"if",
"(",
"entity",
"!=",
"null",
")",
"{",
"Object",
"idValue",
"=",
"toScriptEngineValue",
"(",
"entity",
",",
"entity",
".",
"getEntityType",
"(",
")",... | Convert entity to a JavaScript object. Adds "_idValue" as a special key to every level for
quick access to the id value of an entity.
@param entity The entity to be flattened, should start with non null entity
@param depth Represents the number of reference levels being added to the JavaScript object
@return A JavaScr... | [
"Convert",
"entity",
"to",
"a",
"JavaScript",
"object",
".",
"Adds",
"_idValue",
"as",
"a",
"special",
"key",
"to",
"every",
"level",
"for",
"quick",
"access",
"to",
"the",
"id",
"value",
"of",
"an",
"entity",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-js/src/main/java/org/molgenis/js/magma/JsMagmaScriptEvaluator.java#L149-L166 | train |
molgenis/molgenis | molgenis-one-click-importer/src/main/java/org/molgenis/oneclickimporter/service/impl/AttributeTypeServiceImpl.java | AttributeTypeServiceImpl.isBroader | private boolean isBroader(AttributeType enrichedTypeGuess, AttributeType columnTypeGuess) {
if (columnTypeGuess == null && enrichedTypeGuess != null || columnTypeGuess == null) {
return true;
}
switch (columnTypeGuess) {
case INT:
return enrichedTypeGuess.equals(INT)
|| enri... | java | private boolean isBroader(AttributeType enrichedTypeGuess, AttributeType columnTypeGuess) {
if (columnTypeGuess == null && enrichedTypeGuess != null || columnTypeGuess == null) {
return true;
}
switch (columnTypeGuess) {
case INT:
return enrichedTypeGuess.equals(INT)
|| enri... | [
"private",
"boolean",
"isBroader",
"(",
"AttributeType",
"enrichedTypeGuess",
",",
"AttributeType",
"columnTypeGuess",
")",
"{",
"if",
"(",
"columnTypeGuess",
"==",
"null",
"&&",
"enrichedTypeGuess",
"!=",
"null",
"||",
"columnTypeGuess",
"==",
"null",
")",
"{",
"... | Check if the new enriched type is broader the the previously found type
@return | [
"Check",
"if",
"the",
"new",
"enriched",
"type",
"is",
"broader",
"the",
"the",
"previously",
"found",
"type"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-one-click-importer/src/main/java/org/molgenis/oneclickimporter/service/impl/AttributeTypeServiceImpl.java#L62-L99 | train |
molgenis/molgenis | molgenis-one-click-importer/src/main/java/org/molgenis/oneclickimporter/service/impl/AttributeTypeServiceImpl.java | AttributeTypeServiceImpl.getEnrichedType | private AttributeType getEnrichedType(AttributeType guess, Object value) {
if (guess == null || value == null) {
return guess;
}
if (guess.equals(STRING)) {
String stringValue = value.toString();
if (stringValue.length() > MAX_STRING_LENGTH) {
return TEXT;
}
if (canVa... | java | private AttributeType getEnrichedType(AttributeType guess, Object value) {
if (guess == null || value == null) {
return guess;
}
if (guess.equals(STRING)) {
String stringValue = value.toString();
if (stringValue.length() > MAX_STRING_LENGTH) {
return TEXT;
}
if (canVa... | [
"private",
"AttributeType",
"getEnrichedType",
"(",
"AttributeType",
"guess",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"guess",
"==",
"null",
"||",
"value",
"==",
"null",
")",
"{",
"return",
"guess",
";",
"}",
"if",
"(",
"guess",
".",
"equals",
"(",
... | Returns an enriched AttributeType for when the value meets certain criteria i.e. if a string
value is longer dan 255 characters, the type should be TEXT | [
"Returns",
"an",
"enriched",
"AttributeType",
"for",
"when",
"the",
"value",
"meets",
"certain",
"criteria",
"i",
".",
"e",
".",
"if",
"a",
"string",
"value",
"is",
"longer",
"dan",
"255",
"characters",
"the",
"type",
"should",
"be",
"TEXT"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-one-click-importer/src/main/java/org/molgenis/oneclickimporter/service/impl/AttributeTypeServiceImpl.java#L105-L142 | train |
molgenis/molgenis | molgenis-one-click-importer/src/main/java/org/molgenis/oneclickimporter/service/impl/AttributeTypeServiceImpl.java | AttributeTypeServiceImpl.getCommonType | private AttributeType getCommonType(AttributeType existingGuess, AttributeType newGuess) {
if (existingGuess == null && newGuess == null) {
return null;
}
if (existingGuess == null) {
return newGuess;
}
if (newGuess == null) {
return existingGuess;
}
if (existingGuess.eq... | java | private AttributeType getCommonType(AttributeType existingGuess, AttributeType newGuess) {
if (existingGuess == null && newGuess == null) {
return null;
}
if (existingGuess == null) {
return newGuess;
}
if (newGuess == null) {
return existingGuess;
}
if (existingGuess.eq... | [
"private",
"AttributeType",
"getCommonType",
"(",
"AttributeType",
"existingGuess",
",",
"AttributeType",
"newGuess",
")",
"{",
"if",
"(",
"existingGuess",
"==",
"null",
"&&",
"newGuess",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"existing... | Returns the AttributeType shared by both types | [
"Returns",
"the",
"AttributeType",
"shared",
"by",
"both",
"types"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-one-click-importer/src/main/java/org/molgenis/oneclickimporter/service/impl/AttributeTypeServiceImpl.java#L145-L190 | train |
molgenis/molgenis | molgenis-one-click-importer/src/main/java/org/molgenis/oneclickimporter/service/impl/AttributeTypeServiceImpl.java | AttributeTypeServiceImpl.getBasicAttributeType | private AttributeType getBasicAttributeType(Object value) {
if (value == null) {
return null;
}
if (value instanceof Integer) {
return INT;
} else if (value instanceof Double || value instanceof Float) {
return DECIMAL;
} else if (value instanceof Long) {
return LONG;
} ... | java | private AttributeType getBasicAttributeType(Object value) {
if (value == null) {
return null;
}
if (value instanceof Integer) {
return INT;
} else if (value instanceof Double || value instanceof Float) {
return DECIMAL;
} else if (value instanceof Long) {
return LONG;
} ... | [
"private",
"AttributeType",
"getBasicAttributeType",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"value",
"instanceof",
"Integer",
")",
"{",
"return",
"INT",
";",
"}",
"else",
"if",... | Sets the basic type based on instance of the value Object | [
"Sets",
"the",
"basic",
"type",
"based",
"on",
"instance",
"of",
"the",
"value",
"Object"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-one-click-importer/src/main/java/org/molgenis/oneclickimporter/service/impl/AttributeTypeServiceImpl.java#L193-L209 | train |
molgenis/molgenis | molgenis-data-security/src/main/java/org/molgenis/data/security/meta/AttributeRepositorySecurityDecorator.java | AttributeRepositorySecurityDecorator.validateDeleteAllowed | private void validateDeleteAllowed(Attribute attr) {
String attrIdentifier = attr.getIdentifier();
if (systemEntityTypeRegistry.hasSystemAttribute(attrIdentifier)) {
throw new SystemMetadataModificationException();
}
} | java | private void validateDeleteAllowed(Attribute attr) {
String attrIdentifier = attr.getIdentifier();
if (systemEntityTypeRegistry.hasSystemAttribute(attrIdentifier)) {
throw new SystemMetadataModificationException();
}
} | [
"private",
"void",
"validateDeleteAllowed",
"(",
"Attribute",
"attr",
")",
"{",
"String",
"attrIdentifier",
"=",
"attr",
".",
"getIdentifier",
"(",
")",
";",
"if",
"(",
"systemEntityTypeRegistry",
".",
"hasSystemAttribute",
"(",
"attrIdentifier",
")",
")",
"{",
... | Deleting attribute meta data is allowed for non-system attributes.
@param attr attribute | [
"Deleting",
"attribute",
"meta",
"data",
"is",
"allowed",
"for",
"non",
"-",
"system",
"attributes",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-security/src/main/java/org/molgenis/data/security/meta/AttributeRepositorySecurityDecorator.java#L245-L250 | train |
molgenis/molgenis | molgenis-dataexplorer/src/main/java/org/molgenis/dataexplorer/controller/DataExplorerController.java | DataExplorerController.init | @GetMapping
public String init(
@RequestParam(value = "entity", required = false) String selectedEntityName,
@RequestParam(value = "entityId", required = false) String selectedEntityId,
Model model) {
StringBuilder message = new StringBuilder("");
final boolean currentUserIsSu = SecurityUti... | java | @GetMapping
public String init(
@RequestParam(value = "entity", required = false) String selectedEntityName,
@RequestParam(value = "entityId", required = false) String selectedEntityId,
Model model) {
StringBuilder message = new StringBuilder("");
final boolean currentUserIsSu = SecurityUti... | [
"@",
"GetMapping",
"public",
"String",
"init",
"(",
"@",
"RequestParam",
"(",
"value",
"=",
"\"entity\"",
",",
"required",
"=",
"false",
")",
"String",
"selectedEntityName",
",",
"@",
"RequestParam",
"(",
"value",
"=",
"\"entityId\"",
",",
"required",
"=",
"... | Show the explorer page
@return the view name | [
"Show",
"the",
"explorer",
"page"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-dataexplorer/src/main/java/org/molgenis/dataexplorer/controller/DataExplorerController.java#L111-L155 | train |
molgenis/molgenis | molgenis-navigator/src/main/java/org/molgenis/navigator/copy/service/EntityTypeCopier.java | EntityTypeCopier.assignUniqueLabel | private EntityType assignUniqueLabel(EntityType entityType, CopyState state) {
Set<String> existingLabels;
Package targetPackage = state.targetPackage();
if (targetPackage != null) {
existingLabels =
stream(targetPackage.getEntityTypes()).map(EntityType::getLabel).collect(toSet());
} els... | java | private EntityType assignUniqueLabel(EntityType entityType, CopyState state) {
Set<String> existingLabels;
Package targetPackage = state.targetPackage();
if (targetPackage != null) {
existingLabels =
stream(targetPackage.getEntityTypes()).map(EntityType::getLabel).collect(toSet());
} els... | [
"private",
"EntityType",
"assignUniqueLabel",
"(",
"EntityType",
"entityType",
",",
"CopyState",
"state",
")",
"{",
"Set",
"<",
"String",
">",
"existingLabels",
";",
"Package",
"targetPackage",
"=",
"state",
".",
"targetPackage",
"(",
")",
";",
"if",
"(",
"tar... | Checks if there's an EntityType in the target location with the same label. If so, keeps adding
a postfix until the label is unique. | [
"Checks",
"if",
"there",
"s",
"an",
"EntityType",
"in",
"the",
"target",
"location",
"with",
"the",
"same",
"label",
".",
"If",
"so",
"keeps",
"adding",
"a",
"postfix",
"until",
"the",
"label",
"is",
"unique",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-navigator/src/main/java/org/molgenis/navigator/copy/service/EntityTypeCopier.java#L103-L120 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlNameGenerator.java | PostgreSqlNameGenerator.getJunctionTableName | public static String getJunctionTableName(
EntityType entityType, Attribute attr, boolean quotedIdentifier) {
int nrAdditionalChars = 1;
String entityPart =
generateId(entityType, (MAX_IDENTIFIER_BYTE_LENGTH - nrAdditionalChars) / 2);
String attrPart = generateId(attr, (MAX_IDENTIFIER_BYTE_LEN... | java | public static String getJunctionTableName(
EntityType entityType, Attribute attr, boolean quotedIdentifier) {
int nrAdditionalChars = 1;
String entityPart =
generateId(entityType, (MAX_IDENTIFIER_BYTE_LENGTH - nrAdditionalChars) / 2);
String attrPart = generateId(attr, (MAX_IDENTIFIER_BYTE_LEN... | [
"public",
"static",
"String",
"getJunctionTableName",
"(",
"EntityType",
"entityType",
",",
"Attribute",
"attr",
",",
"boolean",
"quotedIdentifier",
")",
"{",
"int",
"nrAdditionalChars",
"=",
"1",
";",
"String",
"entityPart",
"=",
"generateId",
"(",
"entityType",
... | Returns the junction table name for the given attribute of the given entity
@param entityType entity meta data that owns the attribute
@param attr attribute
@return PostgreSQL junction table name | [
"Returns",
"the",
"junction",
"table",
"name",
"for",
"the",
"given",
"attribute",
"of",
"the",
"given",
"entity"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlNameGenerator.java#L55-L64 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlNameGenerator.java | PostgreSqlNameGenerator.getJunctionTableIndexName | static String getJunctionTableIndexName(
EntityType entityType, Attribute attr, Attribute idxAttr) {
String indexNamePostfix = "_idx";
int nrAdditionalChars = 1 + indexNamePostfix.length();
String entityPart =
generateId(entityType, (MAX_IDENTIFIER_BYTE_LENGTH - nrAdditionalChars) / 3);
St... | java | static String getJunctionTableIndexName(
EntityType entityType, Attribute attr, Attribute idxAttr) {
String indexNamePostfix = "_idx";
int nrAdditionalChars = 1 + indexNamePostfix.length();
String entityPart =
generateId(entityType, (MAX_IDENTIFIER_BYTE_LENGTH - nrAdditionalChars) / 3);
St... | [
"static",
"String",
"getJunctionTableIndexName",
"(",
"EntityType",
"entityType",
",",
"Attribute",
"attr",
",",
"Attribute",
"idxAttr",
")",
"{",
"String",
"indexNamePostfix",
"=",
"\"_idx\"",
";",
"int",
"nrAdditionalChars",
"=",
"1",
"+",
"indexNamePostfix",
".",... | Returns the junction table index name for the given indexed attribute in a junction table
@param entityType entity meta data
@param attr attribute
@param idxAttr indexed attribute
@return PostgreSQL junction table index name | [
"Returns",
"the",
"junction",
"table",
"index",
"name",
"for",
"the",
"given",
"indexed",
"attribute",
"in",
"a",
"junction",
"table"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlNameGenerator.java#L74-L83 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.