public AtlasVertex getVertexForInstanceByUniqueAttribute(ClassType classType, IReferenceableInstance instance)
        throws AtlasException {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Checking if there is an instance with the same unique attributes for instance {}", instance.toShortString());
        }

        AtlasVertex result = null;
        for (AttributeInfo attributeInfo : classType.fieldMapping().fields.values()) {
            if (attributeInfo.isUnique) {
                String propertyKey = getQualifiedFieldName(classType, attributeInfo.name);
                try {
                    result = findVertex(propertyKey, instance.get(attributeInfo.name),
                            Constants.ENTITY_TYPE_PROPERTY_KEY, classType.getName(),
                            Constants.STATE_PROPERTY_KEY, Id.EntityState.ACTIVE.name());
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Found vertex by unique attribute : {}={}", propertyKey, instance.get(attributeInfo.name));
                    }
                } catch (EntityNotFoundException e) {
                    //Its ok if there is no entity with the same unique value
                }
            }
        }

        return result;
    }
public AtlasVertex getVertexForInstanceByUniqueAttribute ( ClassType classType , IReferenceableInstance instance ) throws AtlasException { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Checking if there is an instance with the same unique attributes for instance {}" , instance . toShortString ( ) ) ; } AtlasVertex result = null ; for ( AttributeInfo attributeInfo : classType . fieldMapping ( ) . fields . values ( ) ) { if ( attributeInfo . isUnique ) { String propertyKey = getQualifiedFieldName ( classType , attributeInfo . name ) ; try { result = findVertex ( propertyKey , instance . get ( attributeInfo . name ) , Constants . ENTITY_TYPE_PROPERTY_KEY , classType . getName ( ) , Constants . STATE_PROPERTY_KEY , Id . EntityState . ACTIVE . name ( ) ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Found vertex by unique attribute : {}={}" , propertyKey , instance . get ( attributeInfo . name ) ) ; } } catch ( EntityNotFoundException e ) { } } } return result ; }
For the given type, finds an unique attribute and checks if there is an existing instance with the same
unique value

@param classType
@param instance
@return
@throws AtlasException