本文整理了Java中org.molgenis.data.Entity.get()
方法的一些代码示例,展示了Entity.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.get()
方法的具体详情如下:
包路径:org.molgenis.data.Entity
类名称:Entity
方法名:get
暂无
代码示例来源:origin: org.molgenis/molgenis-data-annotators
@Override
public Query<Entity> createQuery(Entity entity)
{
Object value = entity.get(EffectsMetaData.GENE_NAME);
return EQ(EffectsMetaData.GENE_NAME, value);
}
}
代码示例来源:origin: org.molgenis/molgenis-data-annotators
private String concatAttributeNameValue(Attribute attribute)
{
String value;
if (attribute.getName().equals(VARIANT))
{
value = getFailedEntity().getEntity(VARIANT).getIdValue().toString();
}
else
{
value = getFailedEntity().get(attribute.getName()).toString();
}
return attribute.getName() + "=" + value;
}
}
代码示例来源:origin: org.molgenis/molgenis-data-annotators
private Stream<Entity> createVariantEffectStructureForSingleEntity(Attribute attributeToParse,
ArrayList<Attribute> effectFieldAttributeList, EntityType effectsEntityType, Entity vcfInputEntity,
EntityType variantEntityType)
{
List<Entity> results = new ArrayList<>();
Entity variantEntity = new DynamicEntity(variantEntityType);
for (String attr : variantEntity.getAttributeNames())
{
if (vcfInputEntity.getEntityType().getAttribute(attr) != null)
{
variantEntity.set(attr, vcfInputEntity.get(attr));
}
}
List<Entity> result = createEffectsEntitiesForSingleVariant(effectsEntityType, effectFieldAttributeList,
vcfInputEntity.getString(attributeToParse.getName()), variantEntity).collect(Collectors.toList());
results.addAll(result);
return results.stream();
}
代码示例来源:origin: org.molgenis/molgenis-jobs
private void setFailed(Entity jobExecutionEntity) {
jobExecutionEntity.set(STATUS, FAILED.toString());
jobExecutionEntity.set(PROGRESS_MESSAGE, "Application terminated unexpectedly");
StringBuilder log = new StringBuilder();
if (!isEmpty(jobExecutionEntity.get(LOG))) {
log.append(jobExecutionEntity.get(LOG));
log.append('\n');
}
log.append("FAILED - Application terminated unexpectedly");
String abbreviatedLog =
abbreviateMiddle(log.toString(), "...\n" + TRUNCATION_BANNER + "\n...", MAX_LOG_LENGTH);
jobExecutionEntity.set(LOG, abbreviatedLog);
dataService.update(jobExecutionEntity.getEntityType().getId(), jobExecutionEntity);
}
代码示例来源:origin: org.molgenis/molgenis-data-validation
private void validateEntityValueRequired(Entity entity, ValidationResource validationResource) {
validationResource
.getRequiredValueAttrs()
.forEach(
nonNillableAttr -> {
Object value = entity.get(nonNillableAttr.getName());
if (value == null
|| (isMultipleReferenceType(nonNillableAttr)
&& !entity.getEntities(nonNillableAttr.getName()).iterator().hasNext())) {
ConstraintViolation constraintViolation =
new ConstraintViolation(
format(
"The attribute '%s' of entity '%s' can not be null.",
nonNillableAttr.getName(), getName()),
(long) validationResource.getRow());
validationResource.addViolation(constraintViolation);
}
});
}
代码示例来源:origin: org.molgenis/molgenis-data-annotators
/**
* Get the resource attribute value for one of this annotator's output attributes.
*
* @param attr the name of the output attribute
* @param entity the current entity
* @return the value of the attribute to copy from the resource entity
*/
protected Object getResourceAttributeValue(Attribute attr, Entity entity)
{
return entity.get(attr.getName());
}
代码示例来源:origin: org.molgenis/molgenis-settings
@Override
public Object get(String attributeName) {
return getEntity().get(attributeName);
}
代码示例来源:origin: org.molgenis/molgenis-data-annotators
@Override
protected Object getResourceAttributeValue(Attribute attr, Entity entityType)
{
String attrName = THOUSAND_GENOME_AF.equals(
attr.getName()) ? THOUSAND_GENOME_AF_RESOURCE_ATTRIBUTE_NAME : attr.getName();
return entityType.get(attrName);
}
};
代码示例来源:origin: org.molgenis/molgenis-data-annotators
private Map<Object, Entity> getIndex()
{
if (index.isEmpty())
{
forEach(e ->
{
Object key = e.get(sourceAttributeName);
if (key == null) throw new MolgenisDataException(
"Missing value for attribute [" + sourceAttributeName + "] in entity [" + e + "]");
index.put(key, e);
});
}
return index;
}
}
代码示例来源:origin: org.molgenis/molgenis-data-postgresql
static Map<String, Object> createJunctionTableRowData(
int seqNr, Attribute idAttr, Entity refEntity, Attribute junctionTableAttr, Entity entity) {
Map<String, Object> mref = Maps.newHashMapWithExpectedSize(3);
mref.put(getJunctionTableOrderColumnName(), seqNr);
mref.put(idAttr.getName(), entity.get(idAttr.getName()));
mref.put(junctionTableAttr.getName(), refEntity);
return mref;
}
代码示例来源:origin: org.molgenis/molgenis-data-annotators
@Override
protected Object getResourceAttributeValue(Attribute attr, Entity sourceEntity)
{
String attrName = EXAC_AF.equals(attr.getName()) ? EXAC_AF_ResourceAttributeName : EXAC_AC_HOM.equals(
attr.getName()) ? EXAC_AC_HOM_ResourceAttributeName : EXAC_AC_HET.equals(
attr.getName()) ? EXAC_AC_HET_ResourceAttributeName : attr.getName();
return sourceEntity.get(attrName);
}
};
代码示例来源:origin: org.molgenis/molgenis-data-annotators
private boolean refMatches(Entity resourceEntity)
{
return resourceEntity.get(vcfAttributes.getRefAttribute().getName())
.equals(vcfAttributes.getRefAttribute().getName());
}
代码示例来源:origin: org.molgenis/molgenis-data-annotators
@Override
public Query<Entity> createQuery(Entity entity)
{
Object value = entity.get(attribute.getName());
return EQ(attribute.getName(), value);
}
代码示例来源:origin: org.molgenis/molgenis-data-merge
/**
* create a new entity based on the merged entity metadata
*/
private AbstractEntity createMergedEntity(List<AttributeMetaData> commonAttributes, Entity entity)
{
AbstractEntity mergedEntity = new MapEntity(ID);
mergedEntity.set(ID, UUID.randomUUID().toString());
for (AttributeMetaData attributeMetaData : commonAttributes)
{
mergedEntity.set(attributeMetaData.getName(), entity.get(attributeMetaData.getName()));
}
return mergedEntity;
}
代码示例来源:origin: org.molgenis/molgenis-data-csv
@Override
public void add(Entity entity) {
if (cachedAttributeNames == null)
throw new MolgenisDataException("No attribute names defined call writeAttributeNames first");
int i = 0;
String[] values = new String[cachedAttributeNames.size()];
for (String colName : cachedAttributeNames) {
values[i++] = toValue(entity.get(colName));
}
csvWriter.writeNext(values);
if (csvWriter.checkError())
throw new MolgenisDataException("An exception occured writing the csv file");
}
代码示例来源:origin: org.molgenis/molgenis-annotators-cmd
private boolean isEmptyEffectEntity(Entity effectEntity)
{
boolean isEmpty = true;
for (Attribute effectAttribute : effectEntityType.getAtomicAttributes())
{
//was an empty effect entity created? this entity can be recoginized by the fact that it only has a filled Id attribute and Variant xref
if (effectAttribute.getName().equals(effectEntityType.getIdAttribute().getName()) || effectAttribute
.getName().equals(VARIANT))
{
}
else if (effectEntity.get(effectAttribute.getName()) != null)
{
isEmpty = false;
break;
}
}
return isEmpty;
}
};
代码示例来源:origin: org.molgenis/molgenis-fair
private void addStatementsForAttributeTags(
Entity objectEntity, Model model, Resource subject, EntityType entityType) {
for (Attribute objectAttribute : entityType.getAtomicAttributes()) {
Object value = objectEntity.get(objectAttribute.getName());
if (value == null) {
continue;
}
for (LabeledResource tag :
tagService
.getTagsForAttribute(entityType, objectAttribute)
.get(Relation.isAssociatedWith)) {
IRI predicate = valueFactory.createIRI(tag.getIri());
addRelationForAttribute(model, subject, predicate, objectEntity, objectAttribute);
}
}
}
代码示例来源:origin: org.molgenis/molgenis-data-annotators
@Override
protected Object getResourceAttributeValue(Attribute attr, Entity sourceEntity)
{
if (attr.getName().equals(GENERALIZED_INHERITANCE.getAttributeName()))
{
return getGeneralizedInheritance(sourceEntity);
}
String sourceName = CGDAttributeName.getCgdName(attr.getName());
if (sourceName == null) throw new MolgenisDataException("Unknown attribute [" + attr.getName() + "]");
return sourceEntity.get(sourceName);
}
代码示例来源:origin: org.molgenis/molgenis-data-validation
private static ConstraintViolation createConstraintViolation(
Entity entity, Attribute attribute, EntityType entityType) {
String message =
format(
"Invalid %s value '%s' for attribute '%s' of entity '%s'.",
attribute.getDataType().toString().toLowerCase(),
entity.get(attribute.getName()),
attribute.getLabel(),
entityType.getId());
Range range = attribute.getRange();
if (range != null) {
message += format("Value must be between %d and %d", range.getMin(), range.getMax());
}
Long maxLength = attribute.getDataType().getMaxLength();
if (maxLength != null) {
message += format("Value must be less than or equal to %d characters", maxLength);
}
return new ConstraintViolation(message);
}
代码示例来源:origin: org.molgenis/molgenis-data-merge
/**
* check if an entity for the common attributes already exists and if so, return it
*/
private Entity getMergedEntity(Repository repository, List<AttributeMetaData> commonAttributes, Entity entity)
{
Query findMergedEntityQuery = new QueryImpl();
for (AttributeMetaData attributeMetaData : commonAttributes)
{
if (!findMergedEntityQuery.getRules().isEmpty()) findMergedEntityQuery = findMergedEntityQuery.and();
findMergedEntityQuery = findMergedEntityQuery.eq(attributeMetaData.getName(),
entity.get(attributeMetaData.getName()));
}
Entity result = repository.findOne(findMergedEntityQuery);
return result;
}
内容来源于网络,如有侵权,请联系作者删除!