Search in sources :

Example 1 with AtlasTermRelationshipStatus

use of org.apache.atlas.model.glossary.enums.AtlasTermRelationshipStatus in project atlas by apache.

the class AbstractGlossaryDTO method constructRelatedTermId.

protected AtlasRelatedTermHeader constructRelatedTermId(AtlasRelatedObjectId relatedObjectId) {
    AtlasRelatedTermHeader ret = new AtlasRelatedTermHeader();
    ret.setTermGuid(relatedObjectId.getGuid());
    ret.setRelationGuid(relatedObjectId.getRelationshipGuid());
    ret.setDisplayText(relatedObjectId.getDisplayText());
    AtlasStruct relationshipAttributes = relatedObjectId.getRelationshipAttributes();
    if (relationshipAttributes != null) {
        ret.setDescription((String) relationshipAttributes.getAttribute("description"));
        ret.setExpression((String) relationshipAttributes.getAttribute("expression"));
        ret.setSource((String) relationshipAttributes.getAttribute("source"));
        ret.setSteward((String) relationshipAttributes.getAttribute("steward"));
        Object status = relationshipAttributes.getAttribute("status");
        if (status instanceof String) {
            ret.setStatus(AtlasTermRelationshipStatus.valueOf((String) status));
        } else if (status instanceof AtlasTermRelationshipStatus) {
            ret.setStatus((AtlasTermRelationshipStatus) status);
        }
    }
    return ret;
}
Also used : AtlasStruct(org.apache.atlas.model.instance.AtlasStruct) AtlasRelatedTermHeader(org.apache.atlas.model.glossary.relations.AtlasRelatedTermHeader) AbstractDataTransferObject(org.apache.atlas.repository.ogm.AbstractDataTransferObject) AtlasBaseModelObject(org.apache.atlas.model.AtlasBaseModelObject) AtlasTermRelationshipStatus(org.apache.atlas.model.glossary.enums.AtlasTermRelationshipStatus)

Example 2 with AtlasTermRelationshipStatus

use of org.apache.atlas.model.glossary.enums.AtlasTermRelationshipStatus in project atlas by apache.

the class AbstractGlossaryDTO method constructTermCategorizationId.

protected AtlasTermCategorizationHeader constructTermCategorizationId(final AtlasRelatedObjectId category) {
    AtlasTermCategorizationHeader ret = new AtlasTermCategorizationHeader();
    ret.setCategoryGuid(category.getGuid());
    ret.setRelationGuid(category.getRelationshipGuid());
    AtlasStruct relationshipAttributes = category.getRelationshipAttributes();
    if (relationshipAttributes != null) {
        ret.setDescription((String) relationshipAttributes.getAttribute("description"));
        Object status = relationshipAttributes.getAttribute("status");
        if (status instanceof AtlasTermRelationshipStatus) {
            ret.setStatus((AtlasTermRelationshipStatus) status);
        } else if (status instanceof String) {
            ret.setStatus(AtlasTermRelationshipStatus.valueOf((String) status));
        }
    }
    return ret;
}
Also used : AtlasStruct(org.apache.atlas.model.instance.AtlasStruct) AbstractDataTransferObject(org.apache.atlas.repository.ogm.AbstractDataTransferObject) AtlasBaseModelObject(org.apache.atlas.model.AtlasBaseModelObject) AtlasTermCategorizationHeader(org.apache.atlas.model.glossary.relations.AtlasTermCategorizationHeader) AtlasTermRelationshipStatus(org.apache.atlas.model.glossary.enums.AtlasTermRelationshipStatus)

Aggregations

AtlasBaseModelObject (org.apache.atlas.model.AtlasBaseModelObject)2 AtlasTermRelationshipStatus (org.apache.atlas.model.glossary.enums.AtlasTermRelationshipStatus)2 AtlasStruct (org.apache.atlas.model.instance.AtlasStruct)2 AbstractDataTransferObject (org.apache.atlas.repository.ogm.AbstractDataTransferObject)2 AtlasRelatedTermHeader (org.apache.atlas.model.glossary.relations.AtlasRelatedTermHeader)1 AtlasTermCategorizationHeader (org.apache.atlas.model.glossary.relations.AtlasTermCategorizationHeader)1