Java Code Examples for org.apache.atlas.AtlasErrorCode#UNKNOWN_ATTRIBUTE

The following examples show how to use org.apache.atlas.AtlasErrorCode#UNKNOWN_ATTRIBUTE . 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: SearchContext.java    From atlas with Apache License 2.0 6 votes vote down vote up
private void validateAttributes(final AtlasStructType structType, final String... attributeNames) throws AtlasBaseException {
    for (String attributeName : attributeNames) {
        if (StringUtils.isNotEmpty(attributeName) && (structType == null || structType.getAttributeType(attributeName) == null)) {
            if (structType == null) {
                throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_TYPENAME, "NULL");
            }

            String name = structType.getTypeName();
            if (name.equals(MATCH_ALL_ENTITY_TYPES.getTypeName())) {
                name = ALL_ENTITY_TYPES;
            } else if (name.equals(MATCH_ALL_CLASSIFICATION_TYPES.getTypeName())) {
                name = ALL_CLASSIFICATION_TYPES;
            }
            throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_ATTRIBUTE, attributeName, name);
        }
    }
}
 
Example 2
Source File: AtlasAuditService.java    From atlas with Apache License 2.0 6 votes vote down vote up
private SearchParameters.FilterCriteria getNonEmptyFilter(SearchParameters.FilterCriteria auditFilter) throws AtlasBaseException {
    SearchParameters.FilterCriteria outCriteria = new SearchParameters.FilterCriteria();
    outCriteria.setCriterion(new ArrayList<>());

    if(auditFilter != null) {
        outCriteria.setCondition(auditFilter.getCondition());
        List<SearchParameters.FilterCriteria> givenFilterCriterion = auditFilter.getCriterion();

        for (SearchParameters.FilterCriteria each : givenFilterCriterion) {
            if (StringUtils.isNotEmpty(each.getAttributeName()) && !AtlasAuditEntryDTO.getAttributes().contains(each.getAttributeName())) {
                throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_ATTRIBUTE, each.getAttributeName(), "Atlas Audit Entry");
            }

            addParameterIfValueNotEmpty(outCriteria, each.getAttributeName(), each.getOperator(), each.getAttributeValue());
        }
    }

    return outCriteria;
}
 
Example 3
Source File: AtlasEntityType.java    From atlas with Apache License 2.0 5 votes vote down vote up
public String getVertexPropertyName(String attrName) throws AtlasBaseException {
    AtlasAttribute ret = getAttribute(attrName);

    if (ret == null) {
        ret = relationshipAttributes.get(attrName).values().iterator().next();
    }

    if (ret != null) {
        return ret.getVertexPropertyName();
    }

    throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_ATTRIBUTE, attrName, entityDef.getName());
}
 
Example 4
Source File: AtlasStructType.java    From atlas with Apache License 2.0 5 votes vote down vote up
public String getVertexPropertyName(String attrName) throws AtlasBaseException {
    AtlasAttribute attribute = getAttribute(attrName);

    if (attribute != null) {
        return attribute.getVertexPropertyName();
    }

    throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_ATTRIBUTE, attrName, structDef.getName());
}
 
Example 5
Source File: AtlasStructType.java    From atlas with Apache License 2.0 5 votes vote down vote up
public String getQualifiedAttributePropertyKey(String attrName) throws AtlasBaseException {
    if ( allAttributes.containsKey(attrName)) {
        return allAttributes.get(attrName).getVertexPropertyName();
    }

    throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_ATTRIBUTE, attrName, structDef.getName());
}
 
Example 6
Source File: AtlasEntityType.java    From incubator-atlas with Apache License 2.0 5 votes vote down vote up
public String getQualifiedAttributeName(String attrName) throws AtlasBaseException {
    if (allAttributes.containsKey(attrName)) {
        return allAttributes.get(attrName).getQualifiedName();
    } else if (relationshipAttributes.containsKey(attrName)) {
        return relationshipAttributes.get(attrName).getQualifiedName();
    }

    throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_ATTRIBUTE, attrName, entityDef.getName());
}
 
Example 7
Source File: AtlasStructType.java    From incubator-atlas with Apache License 2.0 5 votes vote down vote up
public String getQualifiedAttributeName(String attrName) throws AtlasBaseException {
    if ( allAttributes.containsKey(attrName)) {
        return allAttributes.get(attrName).getQualifiedName();
    }

    throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_ATTRIBUTE, attrName, structDef.getName());
}
 
Example 8
Source File: AtlasAuditService.java    From atlas with Apache License 2.0 4 votes vote down vote up
private void validateSortByParameter(String sortBy) throws AtlasBaseException{
    if (StringUtils.isNotEmpty(sortBy) && !AtlasAuditEntryDTO.getAttributes().contains(sortBy)) {
        throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_ATTRIBUTE, sortBy, "Atlas Audit Entry");
    }
}