use of org.codice.ddf.admin.api.fields.FunctionField in project admin-console-beta by connexta.
the class GraphQLTransformOutput method fieldToGraphQLFieldDefinition.
public GraphQLFieldDefinition fieldToGraphQLFieldDefinition(Field field) {
List<GraphQLArgument> graphQLArgs = new ArrayList<>();
DataType returnType;
if (field instanceof FunctionField) {
FunctionField function = (FunctionField) field;
if (function.getArguments() != null) {
function.getArguments().forEach(f -> graphQLArgs.add(fieldToGraphQLArgument((DataType) f)));
}
returnType = function.getReturnType();
} else {
returnType = (DataType) field;
}
return GraphQLFieldDefinition.newFieldDefinition().name(field.fieldName()).description(field.description()).type(fieldToGraphQLOutputType(returnType)).argument(graphQLArgs).dataFetcher(field instanceof FunctionField ? (env -> functionDataFetcher(env, (FunctionField) field)) : (env -> dataTypeDataFetcher(env, (DataType) field))).build();
}
use of org.codice.ddf.admin.api.fields.FunctionField in project admin-console-beta by connexta.
the class BaseFieldProvider method getFields.
@Override
public List<Field> getFields() {
List<FunctionField> mutations = getMutationFunctions() == null ? new ArrayList() : getMutationFunctions();
List<Field> discoveryFields = getDiscoveryFields() == null ? new ArrayList() : getDiscoveryFields();
return Stream.concat(mutations.stream(), discoveryFields.stream()).collect(Collectors.toList());
}
Aggregations