Java Code Examples for org.apache.atlas.model.instance.AtlasClassification#getEntityGuid()

The following examples show how to use org.apache.atlas.model.instance.AtlasClassification#getEntityGuid() . 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: EntityAuditListenerV2.java    From atlas with Apache License 2.0 6 votes vote down vote up
private boolean hasPropagatedEntry(Map<String, List<AtlasClassification>> propagationsMap, String guid, AtlasClassification classification) {
    boolean ret = false;

    if (MapUtils.isNotEmpty(propagationsMap) && propagationsMap.containsKey(guid) && CollectionUtils.isNotEmpty(propagationsMap.get(guid))) {
        List<AtlasClassification> classifications    = propagationsMap.get(guid);
        String                    classificationName = classification.getTypeName();
        String                    entityGuid         = classification.getEntityGuid();

        for (AtlasClassification c : classifications) {
            if (StringUtils.equals(c.getTypeName(), classificationName) && StringUtils.equals(c.getEntityGuid(), entityGuid)) {
                ret = true;
                break;
            }
        }
    }

    return ret;
}
 
Example 2
Source File: AtlasEntityStoreV2.java    From atlas with Apache License 2.0 6 votes vote down vote up
private List<String> getClassificationNames(String guid) throws AtlasBaseException {
    List<String>              ret             = null;
    List<AtlasClassification> classifications = retrieveClassifications(guid);

    if (CollectionUtils.isNotEmpty(classifications)) {
        ret = new ArrayList<>();

        for (AtlasClassification classification : classifications) {
            String entityGuid = classification.getEntityGuid();

            if (StringUtils.isEmpty(entityGuid) || StringUtils.equalsIgnoreCase(guid, entityGuid)) {
                ret.add(classification.getTypeName());
            }
        }
    }

    return ret;
}
 
Example 3
Source File: ClassificationPropagationTest.java    From atlas with Apache License 2.0 5 votes vote down vote up
private void assertClassificationExistInList(Set<AtlasClassification> classifications, AtlasClassification classification) {
    String  classificationName  = classification.getTypeName();
    String  entityGuid          = classification.getEntityGuid();
    boolean foundClassification = false;

    for (AtlasClassification c : classifications) {
        if (c.getTypeName().equals(classificationName) && c.getEntityGuid().equals(entityGuid)) {
            foundClassification = true;
        }
    }

    if (!foundClassification) {
        fail("Propagated classification is not present in classifications list!");
    }
}
 
Example 4
Source File: ClassificationPropagationTest.java    From atlas with Apache License 2.0 5 votes vote down vote up
private void assertClassificationNotExistInEntity(String entityName, AtlasClassification classification) throws AtlasBaseException {
    List<AtlasClassification> classifications    = getEntity(entityName).getClassifications();
    String                    classificationName = classification.getTypeName();
    String                    entityGuid         = classification.getEntityGuid();

    if (CollectionUtils.isNotEmpty(classifications)) {
        for (AtlasClassification c : classifications) {
            if (c.getTypeName().equals(classificationName) && c.getEntityGuid().equals(entityGuid)) {
                fail("Propagated classification should not be present in entity!");
            }
        }
    }
}
 
Example 5
Source File: EntityGraphMapper.java    From atlas with Apache License 2.0 4 votes vote down vote up
private boolean isPropagatedClassification(AtlasClassification classification, String guid) {
    String classificationEntityGuid = classification.getEntityGuid();

    return StringUtils.isNotEmpty(classificationEntityGuid) && !StringUtils.equals(classificationEntityGuid, guid);
}