Search in sources :

Example 1 with MolgenisDataAccessException

use of org.molgenis.data.MolgenisDataAccessException in project molgenis by molgenis.

the class SemanticSearchServiceHelper method getAttributeIdentifiers.

/**
 * A helper function that gets identifiers of all the attributes from one EntityType
 */
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 MolgenisDataAccessException("Could not find EntityTypeEntity by the name of " + sourceEntityType.getId());
    List<String> attributeIdentifiers = new ArrayList<>();
    recursivelyCollectAttributeIdentifiers(EntityTypeEntity.getEntities(EntityTypeMetadata.ATTRIBUTES), attributeIdentifiers);
    return attributeIdentifiers;
}
Also used : Entity(org.molgenis.data.Entity) QueryImpl(org.molgenis.data.support.QueryImpl) MolgenisDataAccessException(org.molgenis.data.MolgenisDataAccessException)

Example 2 with MolgenisDataAccessException

use of org.molgenis.data.MolgenisDataAccessException in project molgenis by molgenis.

the class ImportServiceIT method getFile.

static File getFile(String resourceName) {
    requireNonNull(resourceName);
    try {
        File file = ResourceUtils.getFile(ImportServiceIT.class, resourceName);
        LOG.trace("emx import integration test file: [{}]", file);
        return file;
    } catch (Exception e) {
        LOG.error("File name: [{}]", resourceName);
        throw new MolgenisDataAccessException(e);
    }
}
Also used : MolgenisDataAccessException(org.molgenis.data.MolgenisDataAccessException) File(java.io.File) MolgenisDataAccessException(org.molgenis.data.MolgenisDataAccessException)

Aggregations

MolgenisDataAccessException (org.molgenis.data.MolgenisDataAccessException)2 File (java.io.File)1 Entity (org.molgenis.data.Entity)1 QueryImpl (org.molgenis.data.support.QueryImpl)1