Search in sources :

Example 31 with RepositoryException

use of org.apache.atlas.repository.RepositoryException in project incubator-atlas by apache.

the class ClassStore method createInstance.

/*
     * - assumes id is already validated
     */
ReferenceableInstance createInstance(MemRepository repo, Id id) throws RepositoryException {
    Integer pos = idPosMap.get(id);
    String typeName = typeNameList.get(pos);
    if (!Objects.equals(typeName, hierarchicalType.getName())) {
        return repo.getClassStore(typeName).createInstance(repo, id);
    }
    ImmutableList<String> traitNames = traitNamesStore.get(pos);
    String[] tNs = traitNames.toArray(new String[] {});
    try {
        return (ReferenceableInstance) classType.createInstance(id, tNs);
    } catch (AtlasException me) {
        throw new RepositoryException(me);
    }
}
Also used : RepositoryException(org.apache.atlas.repository.RepositoryException) ReferenceableInstance(org.apache.atlas.typesystem.persistence.ReferenceableInstance) AtlasException(org.apache.atlas.AtlasException)

Aggregations

RepositoryException (org.apache.atlas.repository.RepositoryException)31 AtlasBaseException (org.apache.atlas.exception.AtlasBaseException)12 AtlasVertex (org.apache.atlas.repository.graphdb.AtlasVertex)12 AtlasException (org.apache.atlas.AtlasException)11 AtlasEdge (org.apache.atlas.repository.graphdb.AtlasEdge)10 GraphTransaction (org.apache.atlas.annotation.GraphTransaction)6 AtlasGraphManagement (org.apache.atlas.repository.graphdb.AtlasGraphManagement)5 RequestContext (org.apache.atlas.RequestContext)4 ITypedReferenceableInstance (org.apache.atlas.typesystem.ITypedReferenceableInstance)4 CreateUpdateEntitiesResult (org.apache.atlas.CreateUpdateEntitiesResult)3 AtlasObjectId (org.apache.atlas.model.instance.AtlasObjectId)3 GuidMapping (org.apache.atlas.model.instance.GuidMapping)3 IReferenceableInstance (org.apache.atlas.typesystem.IReferenceableInstance)3 EntityExistsException (org.apache.atlas.typesystem.exception.EntityExistsException)3 EntityNotFoundException (org.apache.atlas.typesystem.exception.EntityNotFoundException)3 Id (org.apache.atlas.typesystem.persistence.Id)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 EntityResult (org.apache.atlas.model.legacy.EntityResult)2 AtlasBaseTypeDef (org.apache.atlas.model.typedef.AtlasBaseTypeDef)2