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

The following examples show how to use org.apache.atlas.AtlasErrorCode#INSTANCE_LINEAGE_INVALID_PARAMS . 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: EntityLineageService.java    From incubator-atlas with Apache License 2.0 6 votes vote down vote up
@Override
@GraphTransaction
public AtlasLineageInfo getAtlasLineageInfo(String guid, LineageDirection direction, int depth) throws AtlasBaseException {
    AtlasLineageInfo lineageInfo;

    if (!entityExists(guid)) {
        throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
    }

    if (direction != null) {
        if (direction.equals(LineageDirection.INPUT)) {
            lineageInfo = getLineageInfo(guid, LineageDirection.INPUT, depth);
        } else if (direction.equals(LineageDirection.OUTPUT)) {
            lineageInfo = getLineageInfo(guid, LineageDirection.OUTPUT, depth);
        } else if (direction.equals(LineageDirection.BOTH)) {
            lineageInfo = getBothLineageInfo(guid, depth);
        } else {
            throw new AtlasBaseException(AtlasErrorCode.INSTANCE_LINEAGE_INVALID_PARAMS, "direction", direction.toString());
        }
    } else {
        throw new AtlasBaseException(AtlasErrorCode.INSTANCE_LINEAGE_INVALID_PARAMS, "direction", null);
    }

    return lineageInfo;
}
 
Example 2
Source File: EntityLineageServiceTest.java    From incubator-atlas with Apache License 2.0 5 votes vote down vote up
@DataProvider(name = "invalidQueryParamsProvider")
private Object[][] params() throws Exception {
    String entityGuid = getEntityId(HIVE_TABLE_TYPE, "name", "sales_fact_monthly_mv");

    // String guid, LineageDirection direction, int depth, AtlasErrorCode errorCode

    return new Object[][]{
            {"", null, 0, AtlasErrorCode.INSTANCE_GUID_NOT_FOUND},
            {" ", null, 0, AtlasErrorCode.INSTANCE_GUID_NOT_FOUND},
            {null, null, 0, AtlasErrorCode.INSTANCE_GUID_NOT_FOUND},
            {"invalidGuid", LineageDirection.OUTPUT, 6, AtlasErrorCode.INSTANCE_GUID_NOT_FOUND},
            {entityGuid, null, -10, AtlasErrorCode.INSTANCE_LINEAGE_INVALID_PARAMS},
            {entityGuid, null, 5, AtlasErrorCode.INSTANCE_LINEAGE_INVALID_PARAMS}
    };
}