Java Code Examples for org.apache.atlas.AtlasErrorCode#TYPE_GUID_NOT_FOUND
The following examples show how to use
org.apache.atlas.AtlasErrorCode#TYPE_GUID_NOT_FOUND .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AtlasStructDefStoreV2.java From atlas with Apache License 2.0 | 6 votes |
@Override public AtlasStructDef getByGuid(String guid) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasStructDefStoreV1.getByGuid({})", guid); } AtlasVertex vertex = typeDefStore.findTypeVertexByGuidAndCategory(guid, TypeCategory.STRUCT); if (vertex == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid); } AtlasStructDef ret = toStructDef(vertex); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasStructDefStoreV1.getByGuid({}): {}", guid, ret); } return ret; }
Example 2
Source File: AtlasClassificationDefStoreV1.java From incubator-atlas with Apache License 2.0 | 6 votes |
@Override public AtlasVertex preDeleteByGuid(String guid) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasClassificationDefStoreV1.preDeleteByGuid({})", guid); } AtlasVertex ret = typeDefStore.findTypeVertexByGuidAndCategory(guid, TypeCategory.TRAIT); String typeName = AtlasGraphUtilsV1.getProperty(ret, Constants.TYPENAME_PROPERTY_KEY, String.class); if (AtlasGraphUtilsV1.typeHasInstanceVertex(typeName)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_HAS_REFERENCES, typeName); } if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid); } typeDefStore.deleteTypeVertexOutEdges(ret); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasClassificationDefStoreV1.preDeleteByGuid({}): ret=", guid, ret); } return ret; }
Example 3
Source File: AtlasStructDefStoreV1.java From incubator-atlas with Apache License 2.0 | 6 votes |
@Override public AtlasVertex preDeleteByGuid(String guid) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasStructDefStoreV1.preDeleteByGuid({})", guid); } AtlasVertex ret = typeDefStore.findTypeVertexByGuidAndCategory(guid, TypeCategory.STRUCT); String typeName = AtlasGraphUtilsV1.getProperty(ret, Constants.TYPENAME_PROPERTY_KEY, String.class); if (AtlasGraphUtilsV1.typeHasInstanceVertex(typeName)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_HAS_REFERENCES, typeName); } if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid); } typeDefStore.deleteTypeVertexOutEdges(ret); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasStructDefStoreV1.preDeleteByGuid({}): {}", guid, ret); } return ret; }
Example 4
Source File: AtlasRelationshipDefStoreV2.java From atlas with Apache License 2.0 | 6 votes |
@Override public AtlasRelationshipDef getByGuid(String guid) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasRelationshipDefStoreV1.getByGuid({})", guid); } AtlasVertex vertex = typeDefStore.findTypeVertexByGuidAndCategory(guid, TypeCategory.RELATIONSHIP); if (vertex == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid); } AtlasRelationshipDef ret = toRelationshipDef(vertex); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasRelationshipDefStoreV1.getByGuid({}): {}", guid, ret); } return ret; }
Example 5
Source File: AtlasRelationshipDefStoreV1.java From incubator-atlas with Apache License 2.0 | 6 votes |
@Override public AtlasRelationshipDef getByGuid(String guid) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasRelationshipDefStoreV1.getByGuid({})", guid); } AtlasVertex vertex = typeDefStore.findTypeVertexByGuidAndCategory(guid, TypeCategory.RELATIONSHIP); if (vertex == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid); } AtlasRelationshipDef ret = toRelationshipDef(vertex); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasRelationshipDefStoreV1.getByGuid({}): {}", guid, ret); } return ret; }
Example 6
Source File: AtlasStructDefStoreV2.java From atlas with Apache License 2.0 | 5 votes |
@Override public AtlasVertex preDeleteByGuid(String guid) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasStructDefStoreV1.preDeleteByGuid({})", guid); } AtlasStructDef existingDef = typeRegistry.getStructDefByGuid(guid); AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_DELETE, existingDef), "delete struct-def ", (existingDef != null ? existingDef.getName() : guid)); AtlasVertex ret = typeDefStore.findTypeVertexByGuidAndCategory(guid, TypeCategory.STRUCT); String typeName = AtlasGraphUtilsV2.getEncodedProperty(ret, Constants.TYPENAME_PROPERTY_KEY, String.class); if (AtlasGraphUtilsV2.typeHasInstanceVertex(typeName)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_HAS_REFERENCES, typeName); } if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid); } typeDefStore.deleteTypeVertexOutEdges(ret); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasStructDefStoreV1.preDeleteByGuid({}): {}", guid, ret); } return ret; }
Example 7
Source File: AtlasTypeRegistry.java From atlas with Apache License 2.0 | 5 votes |
public AtlasType getTypeByGuid(String guid) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeRegistry.getTypeByGuid({})", guid); } AtlasType ret = registryData.allTypes.getTypeByGuid(guid); if(ret == null) throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeRegistry.getTypeByGuid({}): {}", guid, ret); } return ret; }
Example 8
Source File: AtlasTypeDefGraphStore.java From incubator-atlas with Apache License 2.0 | 5 votes |
@Override public AtlasStructDef getStructDefByGuid(String guid) throws AtlasBaseException { AtlasStructDef ret = typeRegistry.getStructDefByGuid(guid); if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid); } return ret; }
Example 9
Source File: AtlasTypeDefGraphStore.java From incubator-atlas with Apache License 2.0 | 5 votes |
@Override public AtlasClassificationDef getClassificationDefByGuid(String guid) throws AtlasBaseException { AtlasClassificationDef ret = typeRegistry.getClassificationDefByGuid(guid); if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid); } return ret; }
Example 10
Source File: AtlasTypeDefGraphStore.java From incubator-atlas with Apache License 2.0 | 5 votes |
@Override public AtlasBaseTypeDef getByGuid(String guid) throws AtlasBaseException { if (StringUtils.isBlank(guid)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid); } AtlasType type = typeRegistry.getTypeByGuid(guid); return getTypeDefFromType(type); }
Example 11
Source File: AtlasRelationshipDefStoreV2.java From atlas with Apache License 2.0 | 5 votes |
@Override public AtlasVertex preDeleteByGuid(String guid) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasRelationshipDefStoreV1.preDeleteByGuid({})", guid); } AtlasRelationshipDef existingDef = typeRegistry.getRelationshipDefByGuid(guid); AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_DELETE, existingDef), "delete relationship-def ", (existingDef != null ? existingDef.getName() : guid)); AtlasVertex ret = typeDefStore.findTypeVertexByGuidAndCategory(guid, TypeCategory.RELATIONSHIP); if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid); } String typeName = AtlasGraphUtilsV2.getEncodedProperty(ret, Constants.TYPENAME_PROPERTY_KEY, String.class); if (AtlasGraphUtilsV2.relationshipTypeHasInstanceEdges(typeName)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_HAS_REFERENCES, typeName); } typeDefStore.deleteTypeVertexOutEdges(ret); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasRelationshipDefStoreV1.preDeleteByGuid({}): {}", guid, ret); } return ret; }
Example 12
Source File: AtlasTypeDefGraphStore.java From atlas with Apache License 2.0 | 5 votes |
private void tryTypeCreation(AtlasTypesDef typesDef, AtlasTransientTypeRegistry ttr) throws AtlasBaseException { // Translate any NOT FOUND errors to BAD REQUEST try { ttr.addTypes(typesDef); } catch (AtlasBaseException e) { if (AtlasErrorCode.TYPE_NAME_NOT_FOUND == e.getAtlasErrorCode() || AtlasErrorCode.TYPE_GUID_NOT_FOUND == e.getAtlasErrorCode()) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, e.getMessage()); } else { throw e; } } }
Example 13
Source File: AtlasTypeDefGraphStore.java From atlas with Apache License 2.0 | 5 votes |
private void tryUpdateByGUID(String guid, AtlasBaseTypeDef typeDef, AtlasTransientTypeRegistry ttr) throws AtlasBaseException { try { ttr.updateTypeByGuid(guid, typeDef); } catch (AtlasBaseException e) { if (AtlasErrorCode.TYPE_GUID_NOT_FOUND == e.getAtlasErrorCode()) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, e.getMessage()); } else { throw e; } } }
Example 14
Source File: AtlasTypeDefGraphStore.java From incubator-atlas with Apache License 2.0 | 5 votes |
@Override public AtlasEnumDef getEnumDefByGuid(String guid) throws AtlasBaseException { AtlasEnumDef ret = typeRegistry.getEnumDefByGuid(guid); if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid); } return ret; }
Example 15
Source File: AtlasClassificationDefStoreV1.java From incubator-atlas with Apache License 2.0 | 5 votes |
@Override public AtlasClassificationDef updateByGuid(String guid, AtlasClassificationDef classificationDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasClassificationDefStoreV1.updateByGuid({})", guid); } validateType(classificationDef); AtlasType type = typeRegistry.getTypeByGuid(guid); if (type.getTypeCategory() != org.apache.atlas.model.TypeCategory.CLASSIFICATION) { throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, classificationDef.getName(), TypeCategory.TRAIT.name()); } AtlasVertex vertex = typeDefStore.findTypeVertexByGuidAndCategory(guid, TypeCategory.TRAIT); if (vertex == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid); } updateVertexPreUpdate(classificationDef, (AtlasClassificationType)type, vertex); updateVertexAddReferences(classificationDef, vertex); AtlasClassificationDef ret = toClassificationDef(vertex); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasClassificationDefStoreV1.updateByGuid({}): {}", guid, ret); } return ret; }
Example 16
Source File: AtlasTypeDefGraphStore.java From incubator-atlas with Apache License 2.0 | 5 votes |
private void tryUpdateByGUID(String guid, AtlasBaseTypeDef typeDef, AtlasTransientTypeRegistry ttr) throws AtlasBaseException { try { ttr.updateTypeByGuid(guid, typeDef); } catch (AtlasBaseException e) { if (AtlasErrorCode.TYPE_GUID_NOT_FOUND == e.getAtlasErrorCode()) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, e.getMessage()); } else { throw e; } } }
Example 17
Source File: AtlasTypeDefGraphStore.java From incubator-atlas with Apache License 2.0 | 5 votes |
@Override public AtlasEntityDef getEntityDefByGuid(String guid) throws AtlasBaseException { AtlasEntityDef ret = typeRegistry.getEntityDefByGuid(guid); if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid); } return ret; }
Example 18
Source File: AtlasTypeDefGraphStore.java From atlas with Apache License 2.0 | 5 votes |
@Override public AtlasStructDef getStructDefByGuid(String guid) throws AtlasBaseException { AtlasStructDef ret = typeRegistry.getStructDefByGuid(guid); if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid); } return ret; }
Example 19
Source File: AtlasEnumDefStoreV2.java From atlas with Apache License 2.0 | 3 votes |
@Override public AtlasEnumDef updateByGuid(String guid, AtlasEnumDef enumDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasEnumDefStoreV2.updateByGuid({})", guid); } AtlasEnumDef existingDef = typeRegistry.getEnumDefByGuid(guid); AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_UPDATE, existingDef), "update enum-def ", (existingDef != null ? existingDef.getName() : guid)); validateType(enumDef); AtlasVertex vertex = typeDefStore.findTypeVertexByGuidAndCategory(guid, TypeCategory.ENUM); if (vertex == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid); } typeDefStore.updateTypeVertex(enumDef, vertex); toVertex(enumDef, vertex); AtlasEnumDef ret = toEnumDef(vertex); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasEnumDefStoreV2.updateByGuid({}): {}", guid, ret); } return ret; }
Example 20
Source File: AtlasBusinessMetadataDefStoreV2.java From atlas with Apache License 2.0 | 3 votes |
public AtlasBusinessMetadataDef updateByGuid(String guid, AtlasBusinessMetadataDef typeDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasBusinessMetadataDefStoreV2.updateByGuid({})", guid); } AtlasBusinessMetadataDef existingDef = typeRegistry.getBusinessMetadataDefByGuid(guid); AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_UPDATE, existingDef), "update businessMetadata-def ", (existingDef != null ? existingDef.getName() : guid)); validateType(typeDef); AtlasType type = typeRegistry.getTypeByGuid(guid); if (type.getTypeCategory() != org.apache.atlas.model.TypeCategory.BUSINESS_METADATA) { throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, typeDef.getName(), DataTypes.TypeCategory.BUSINESS_METADATA.name()); } AtlasVertex vertex = typeDefStore.findTypeVertexByGuidAndCategory(guid, DataTypes.TypeCategory.BUSINESS_METADATA); if (vertex == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid); } updateVertexPreUpdate(typeDef, (AtlasBusinessMetadataType)type, vertex); AtlasBusinessMetadataDef ret = toBusinessMetadataDef(vertex); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasBusinessMetadataDefStoreV2.updateByGuid({}): {}", guid, ret); } return ret; }