public static boolean isAssignedGuid(AtlasObjectId objId) { return isAssignedGuid(objId.getGuid()); }
public static boolean isAssignedGuid(AtlasObjectId objId) { return isAssignedGuid(objId.getGuid()); }
public static boolean isValidGuid(String guid) { return isAssignedGuid(guid) || isUnAssignedGuid(guid); }
public static boolean isValidGuid(String guid) { return isAssignedGuid(guid) || isUnAssignedGuid(guid); }
public static boolean isValid(AtlasObjectId objId) { if (isAssignedGuid(objId) || isUnAssignedGuid(objId)) { return true; } else if (StringUtils.isNotEmpty(objId.getTypeName()) && MapUtils.isNotEmpty(objId.getUniqueAttributes())) { return true; } return false; }
public static boolean isValid(AtlasObjectId objId) { if (isAssignedGuid(objId) || isUnAssignedGuid(objId)) { return true; } else if (StringUtils.isNotEmpty(objId.getTypeName()) && MapUtils.isNotEmpty(objId.getUniqueAttributes())) { return true; } return false; }
if (updateId != null && !AtlasTypeUtil.isAssignedGuid(updateId.getId())) { updatedEntity.setId(new Id(guid, 0, updatedEntity.getTypeName()));
if (updateId != null && !AtlasTypeUtil.isAssignedGuid(updateId.getId())) { String guid = AtlasGraphUtilsV2.getGuidByUniqueAttributes(getEntityType(entityType), attributes);
Assert.assertTrue(actual instanceof AtlasObjectId); String guid = ((AtlasObjectId) actual).getGuid(); Assert.assertTrue(AtlasTypeUtil.isAssignedGuid(guid), "expected assigned guid. found " + guid); break;
Assert.assertTrue(actual instanceof AtlasObjectId); String guid = ((AtlasObjectId) actual).getGuid(); Assert.assertTrue(AtlasTypeUtil.isAssignedGuid(guid), "expected assigned guid. found " + guid); break;
private AtlasEdge createRelationshipEdge(AtlasVertex fromVertex, AtlasVertex toVertex, AtlasRelationship relationship) throws RepositoryException, AtlasBaseException { String relationshipLabel = getRelationshipEdgeLabel(fromVertex, toVertex, relationship.getTypeName()); PropagateTags tagPropagation = getRelationshipTagPropagation(fromVertex, toVertex, relationship); AtlasEdge ret = graphHelper.getOrCreateEdge(fromVertex, toVertex, relationshipLabel); if (LOG.isDebugEnabled()) { LOG.debug("Created relationship edge from [{}] --> [{}] using edge label: [{}]", getTypeName(fromVertex), getTypeName(toVertex), relationshipLabel); } // map additional properties to relationship edge if (ret != null) { // Accept a valid (assigned) guid from the supplied relationship, or generate one. String relationshipGuid = relationship.getGuid(); final String guid = AtlasTypeUtil.isAssignedGuid(relationshipGuid) ? relationshipGuid : UUID.randomUUID().toString(); AtlasGraphUtilsV2.setEncodedProperty(ret, ENTITY_TYPE_PROPERTY_KEY, relationship.getTypeName()); AtlasGraphUtilsV2.setEncodedProperty(ret, RELATIONSHIP_GUID_PROPERTY_KEY, guid); AtlasGraphUtilsV2.setEncodedProperty(ret, VERSION_PROPERTY_KEY, getRelationshipVersion(relationship)); AtlasGraphUtilsV2.setEncodedProperty(ret, RELATIONSHIPTYPE_TAG_PROPAGATION_KEY, tagPropagation.name()); // blocked propagated classifications handleBlockedClassifications(ret, relationship.getBlockedPropagatedClassifications()); // propagate tags deleteHandler.addTagPropagation(ret, tagPropagation); } return ret; }
@Override @GraphTransaction public EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> updateEntity({}, {}, {})", objectId, updatedEntityInfo, isPartialUpdate); } if (objectId == null || updatedEntityInfo == null || updatedEntityInfo.getEntity() == null) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "null entity-id/entity"); } final String guid; if (AtlasTypeUtil.isAssignedGuid(objectId.getGuid())) { guid = objectId.getGuid(); } else { AtlasEntityType entityType = typeRegistry.getEntityTypeByName(objectId.getTypeName()); if (entityType == null) { throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_TYPENAME, objectId.getTypeName()); } guid = AtlasGraphUtilsV2.getGuidByUniqueAttributes(typeRegistry.getEntityTypeByName(objectId.getTypeName()), objectId.getUniqueAttributes()); } AtlasEntity entity = updatedEntityInfo.getEntity(); entity.setGuid(guid); return createOrUpdate(new AtlasEntityStream(updatedEntityInfo), isPartialUpdate, false); }
@Override @GraphTransaction public EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> updateEntity({}, {}, {})", objectId, updatedEntityInfo, isPartialUpdate); } if (objectId == null || updatedEntityInfo == null || updatedEntityInfo.getEntity() == null) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "null entity-id/entity"); } final String guid; if (AtlasTypeUtil.isAssignedGuid(objectId.getGuid())) { guid = objectId.getGuid(); } else { AtlasEntityType entityType = typeRegistry.getEntityTypeByName(objectId.getTypeName()); if (entityType == null) { throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_TYPENAME, objectId.getTypeName()); } guid = AtlasGraphUtilsV2.getGuidByUniqueAttributes(typeRegistry.getEntityTypeByName(objectId.getTypeName()), objectId.getUniqueAttributes()); } AtlasEntity entity = updatedEntityInfo.getEntity(); entity.setGuid(guid); return createOrUpdate(new AtlasEntityStream(updatedEntityInfo), isPartialUpdate, false); }
private AtlasVertex getEntityVertex(AtlasObjectId objId) throws AtlasBaseException { AtlasVertex ret = null; if (! AtlasTypeUtil.isValid(objId)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_OBJECT_ID, objId.toString()); } if (AtlasTypeUtil.isAssignedGuid(objId)) { ret = AtlasGraphUtilsV2.findByGuid(objId.getGuid()); } else { AtlasEntityType entityType = typeRegistry.getEntityTypeByName(objId.getTypeName()); Map<String, Object> uniqAttributes = objId.getUniqueAttributes(); ret = AtlasGraphUtilsV2.getVertexByUniqueAttributes(entityType, uniqAttributes); } if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, objId.toString()); } return ret; }
private AtlasVertex getEntityVertex(AtlasObjectId objId) throws AtlasBaseException { AtlasVertex ret = null; if (! AtlasTypeUtil.isValid(objId)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_OBJECT_ID, objId.toString()); } if (AtlasTypeUtil.isAssignedGuid(objId)) { ret = AtlasGraphUtilsV2.findByGuid(objId.getGuid()); } else { AtlasEntityType entityType = typeRegistry.getEntityTypeByName(objId.getTypeName()); Map<String, Object> uniqAttributes = objId.getUniqueAttributes(); ret = AtlasGraphUtilsV2.getVertexByUniqueAttributes(entityType, uniqAttributes); } if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, objId.toString()); } return ret; }
boolean isAssignedGuid = AtlasTypeUtil.isAssignedGuid(guid); AtlasVertex vertex = isAssignedGuid ? AtlasGraphUtilsV2.findByGuid(guid) : null;
final String guid = AtlasTypeUtil.isAssignedGuid(relationshipGuid) ? relationshipGuid : UUID.randomUUID().toString();
if ((entityStream instanceof EntityImportStream) && AtlasTypeUtil.isAssignedGuid(entity.getGuid())) { vertex = entityGraphMapper.createVertexWithGuid(entity, entity.getGuid()); } else {
boolean isAssignedGuid = AtlasTypeUtil.isAssignedGuid(guid); AtlasVertex vertex = isAssignedGuid ? AtlasGraphUtilsV2.findByGuid(guid) : null;
if (RequestContext.get().isImportInProgress() && AtlasTypeUtil.isAssignedGuid(entity.getGuid())) { vertex = entityGraphMapper.createVertexWithGuid(entity, entity.getGuid()); } else {