org.molgenis.data.Entity.getEntityType()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(89)

本文整理了Java中org.molgenis.data.Entity.getEntityType()方法的一些代码示例,展示了Entity.getEntityType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getEntityType()方法的具体详情如下:
包路径:org.molgenis.data.Entity
类名称:Entity
方法名:getEntityType

Entity.getEntityType介绍

暂无

代码示例

代码示例来源:origin: org.molgenis/molgenis-das

public String getAttributeName(String attribute, String fieldName, Entity entity)
{
  if (attribute == null)
  {
    attribute = config.getAttributeNameForAttributeNameArray(fieldName, entity.getEntityType());
  }
  return attribute;
}

代码示例来源:origin: org.molgenis/molgenis-navigator

@Override
public EntityType getEntityType() {
 String id = delegate().getEntityType().getId();
 if (copiedEntityTypes.containsKey(id)) {
  return copiedEntityTypes.get(id);
 } else {
  return delegate().getEntityType();
 }
}

代码示例来源:origin: org.molgenis/molgenis-data-rest

private Map<String, Object> createEntityResponse(
  Entity entity, Fetch fetch, boolean includeMetaData, boolean includeCategories) {
 Map<String, Object> responseData = new LinkedHashMap<>();
 if (includeMetaData) {
  createEntityTypeResponse(entity.getEntityType(), fetch, responseData, includeCategories);
 }
 createEntityValuesResponse(entity, fetch, responseData);
 return responseData;
}

代码示例来源:origin: org.molgenis/molgenis-data-rest

private void createEntityValuesResponse(
  Entity entity, Fetch fetch, Map<String, Object> responseData) {
 Iterable<Attribute> attrs = entity.getEntityType().getAtomicAttributes();
 createEntityValuesResponseRec(entity, attrs, fetch, responseData);
}

代码示例来源:origin: org.molgenis/molgenis-data-validation

@Override
public void validateEntityNotReferenced(Entity entity) {
 validateEntityNotReferencedById(entity.getIdValue(), entity.getEntityType());
}

代码示例来源:origin: org.molgenis/molgenis-web

private JsonElement serializeReference(Entity entity, JsonSerializationContext context) {
 JsonObject result = new JsonObject();
 result.addProperty("__entityTypeId", entity.getEntityType().getId());
 result.add("__idValue", context.serialize(entity.getIdValue()));
 result.add("__labelValue", context.serialize(entity.getLabelValue()));
 return result;
}

代码示例来源:origin: org.molgenis/molgenis-data-cache

/**
 * Inserts an entity into the cache.
 *
 * @param entity the entity to insert into the cache
 */
public void put(Entity entity) {
 EntityType entityType = entity.getEntityType();
 cache.put(
   EntityKey.create(entityType, entity.getIdValue()),
   CacheHit.of(entityHydration.dehydrate(entity)));
}

代码示例来源:origin: org.molgenis/molgenis-fair

public void addEntityToModel(String subjectIRI, Entity objectEntity, Model model) {
 Resource subject = valueFactory.createIRI(subjectIRI);
 EntityType entityType = objectEntity.getEntityType();
 addStatementsForAttributeTags(objectEntity, model, subject, entityType);
 addStatementsForEntityTags(model, subject, entityType);
}

代码示例来源: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-rest

public static String concatEntityHref(Entity entity) {
 return concatEntityHref("/api/v2", entity.getEntityType().getId(), entity.getIdValue());
}

代码示例来源:origin: org.molgenis/molgenis-data-postgresql

@Override
public void setValues(PreparedStatement preparedStatement, int i) throws SQLException {
 Map<String, Object> mref = mrefs.get(i);
 Object idValue0;
 Object idValue1;
 if (attr.isMappedBy()) {
  Entity mrefEntity = (Entity) mref.get(attr.getName());
  idValue0 = getPostgreSqlValue(mrefEntity, attr.getRefEntity().getIdAttribute());
  idValue1 = mref.get(idAttr.getName());
 } else {
  idValue0 = mref.get(idAttr.getName());
  Entity mrefEntity = (Entity) mref.get(attr.getName());
  idValue1 = getPostgreSqlValue(mrefEntity, mrefEntity.getEntityType().getIdAttribute());
 }
 preparedStatement.setInt(1, (int) mref.get(getJunctionTableOrderColumnName()));
 preparedStatement.setObject(2, idValue0);
 preparedStatement.setObject(3, idValue1);
}

代码示例来源:origin: org.molgenis/molgenis-jobs

private void tryUpdate(JobExecution jobExecution) {
  Entity jobExecutionCopy = new DynamicEntity(jobExecution.getEntityType());
  jobExecutionCopy.set(jobExecution);

  try {
   dataService.update(jobExecutionCopy.getEntityType().getId(), jobExecutionCopy);
  } catch (Exception ex) {
   LOG.warn("Error updating job execution", ex);
  }
 }
}

代码示例来源:origin: org.molgenis/molgenis-data-annotators

private Entity createVcfEntityStructureForSingleEntity(Entity variant, List<Entity> effectsForVariant)
{
  createResultEntityType(effectsForVariant.get(0), variant.getEntityType());
  Entity newVariant = new DynamicEntity(vcfVariantEntityType);
  newVariant.set(variant);
  if (effectsForVariant.size() > 1)
  {
    newVariant.set(EFFECT, effectsForVariant);
  }
  else
  {
    // is this an empty effect entity?
    Entity effectForVariant = effectsForVariant.get(0);
    if (!isEmptyEffectEntity(effectForVariant)) newVariant.set(EFFECT, effectsForVariant);
  }
  return newVariant;
}

代码示例来源:origin: org.molgenis/molgenis-data-annotators

@Override
public String getMessage()
{
  String message = "Annotation failed while running annotator " + getAnnotatorName() + " on ";
  if (getFailedEntity() == null)
  {
    message += " unknown entity.";
  }
  else
  {
    message += " entity with [" + concatAttributeNameValue(getFailedEntity().getEntityType().getIdAttribute())
        + ", " + getRequiredAttributes().stream()
                        .map(this::concatAttributeNameValue)
                        .collect(Collectors.joining(", ")) + "]";
  }
  message += " Cause: " + super.getCause();
  return message;
}

代码示例来源:origin: org.molgenis/molgenis-annotators-cmd

private Entity createVcfEntityStructureForSingleEntity(Entity variant, List<Entity> effectsForVariant)
{
  createResultEntityType(effectsForVariant.get(0), variant.getEntityType());
  Entity newVariant = new DynamicEntity(vcfVariantEntityType);
  newVariant.set(variant);
  if (effectsForVariant.size() > 1)
  {
    newVariant.set(EFFECT, effectsForVariant);
  }
  else
  {
    // is this an empty effect entity?
    Entity effectForVariant = effectsForVariant.get(0);
    if (!isEmptyEffectEntity(effectForVariant)) newVariant.set(EFFECT, effectsForVariant);
  }
  return newVariant;
}

代码示例来源:origin: org.molgenis/molgenis-one-click-importer

private void setRowValueForAttribute(Entity row, int index, Column column) {
 String attributeName = oneClickImporterNamingService.asValidColumnName(column.getName());
 Object dataValue = column.getDataValues().get(index);
 EntityType rowType = row.getEntityType();
 Attribute attribute = rowType.getAttribute(attributeName);
 Object castedValue =
   oneClickImporterService.castValueAsAttributeType(dataValue, attribute.getDataType());
 row.set(attributeName, castedValue);
}

代码示例来源:origin: org.molgenis/molgenis-data-validation

private ConstraintViolation checkXref(Entity entity, Attribute attr, EntityType entityType) {
 Entity refEntity;
 try {
  refEntity = entity.getEntity(attr.getName());
 } catch (Exception e) {
  return createConstraintViolation(entity, attr, entityType, "Not a valid entity.");
 }
 if (refEntity == null) {
  return null;
 }
 if (!refEntity.getEntityType().getId().equals(attr.getRefEntity().getId())) {
  return createConstraintViolation(entity, attr, entityType, "Not a valid entity type.");
 }
 return null;
}

代码示例来源:origin: org.molgenis/molgenis-fair

private void addRelationForXrefTypeAttribute(
  Model model, Resource subject, IRI predicate, Entity objectEntity) {
 if (contains(objectEntity.getEntityType().getAttributeNames(), "IRI")) {
  model.add(subject, predicate, valueFactory.createIRI(objectEntity.getString("IRI")));
 } else {
  model.add(
    subject,
    predicate,
    valueFactory.createIRI(subject.stringValue() + '/' + objectEntity.getIdValue()));
 }
}

代码示例来源:origin: org.molgenis/molgenis-data-annotators

private void createResultEntityType(Entity effect, EntityType variantEMD)
{
  if (vcfVariantEntityType == null || effectEntityType == null)
  {
    effectEntityType = effect.getEntityType();
    vcfVariantEntityType = EntityType.newInstance(variantEMD);
    vcfVariantEntityType.addAttribute(
        attributeFactory.create().setName(EFFECT).setDataType(MREF).setRefEntity(effectEntityType));
  }
}

代码示例来源:origin: org.molgenis/molgenis-annotators-cmd

private void createResultEntityType(Entity effect, EntityType variantEMD)
{
  if (vcfVariantEntityType == null || effectEntityType == null)
  {
    effectEntityType = effect.getEntityType();
    vcfVariantEntityType = EntityType.newInstance(variantEMD);
    vcfVariantEntityType.addAttribute(
        attributeFactory.create().setName(EFFECT).setDataType(MREF).setRefEntity(effectEntityType));
  }
}

相关文章