Search in sources :

Example 1 with PartialEntity

use of org.molgenis.data.support.PartialEntity in project molgenis by molgenis.

the class EntityManagerImpl method create.

private Entity create(EntityType entityType, Fetch fetch, CreationMode creationMode) {
    Entity entity = new DynamicEntity(entityType);
    if (fetch != null) {
        // create partial entity that loads attribute values not contained in the fetch on demand.
        entity = new PartialEntity(entity, fetch, this);
    }
    if (entityType.hasAttributeWithExpression()) {
        // create entity that computed values based on expressions defined in meta data
        entity = new EntityWithComputedAttributes(entity);
    }
    if (creationMode == POPULATE) {
        entityPopulator.populate(entity);
    }
    EntityFactory<? extends Entity, ?> entityFactory = entityFactoryRegistry.getEntityFactory(entityType);
    if (entityFactory != null) {
        // create static entity (e.g. Tag, Language, Package) that wraps the constructed dynamic or partial entity.
        return entityFactory.create(entity);
    }
    return entity;
}
Also used : PartialEntity(org.molgenis.data.support.PartialEntity) DynamicEntity(org.molgenis.data.support.DynamicEntity) PartialEntity(org.molgenis.data.support.PartialEntity) EntityWithComputedAttributes(org.molgenis.data.support.EntityWithComputedAttributes) DynamicEntity(org.molgenis.data.support.DynamicEntity)

Aggregations

DynamicEntity (org.molgenis.data.support.DynamicEntity)1 EntityWithComputedAttributes (org.molgenis.data.support.EntityWithComputedAttributes)1 PartialEntity (org.molgenis.data.support.PartialEntity)1