use of org.apache.atlas.typesystem.types.cache.TypeCache.TYPE_FILTER in project incubator-atlas by apache.
the class GremlinExpressionFactory method typeTestExpressionUsingInFilter.
private List<GroovyExpression> typeTestExpressionUsingInFilter(GraphPersistenceStrategies s, GroovyExpression parent, final String typeName) throws AtlasException {
List<GroovyExpression> typeNames = new ArrayList<>();
typeNames.add(new LiteralExpression(typeName));
Map<TYPE_FILTER, String> filters = new HashMap<TYPE_FILTER, String>() {
{
put(TYPE_FILTER.SUPERTYPE, typeName);
}
};
ImmutableList<String> subTypes = TypeSystem.getInstance().getTypeNames(filters);
if (!subTypes.isEmpty()) {
for (String subType : subTypes) {
typeNames.add(new LiteralExpression(subType));
}
}
GroovyExpression inFilterExpr = generateHasExpression(s, parent, s.typeAttributeName(), IN_OPERATOR, new ListExpression(typeNames), null);
return Collections.singletonList(inFilterExpr);
}
Aggregations