public static Optional<String> getDirectiveArgument(GraphQLObjectType parentType, String directiveName, String argumentName) { return Optional.ofNullable(parentType.getDefinition().getDirective(directiveName)) .map(d -> d.getArgument(argumentName)) .map(v -> (StringValue) v.getValue()) .map(StringValue::getValue); }
public static Optional<String> getDirectiveArgument(GraphQLFieldDefinition field, String directiveName, String argumentName) { return Optional.ofNullable(field.getDefinition().getDirective(directiveName)) .map(d -> d.getArgument(argumentName)) .map(v -> (StringValue) v.getValue()) .map(StringValue::getValue); } }
String iri = ((StringValue) field.getDirective("href").getArgument("iri").getValue()).getValue(); contextMap.put(field.getName(), iri); }); String serviceId = ((StringValue) dir.getArgument("id").getValue()).getValue(); rdfSchema.insertObjectTriple(typeUri, HGQL_HAS_FIELD, fieldURI); String serviceId = ((StringValue) field.getDirective("service").getArgument("id").getValue()).getValue(); String serviceURI = HGQL_SERVICE_NAMESPACE + serviceId; rdfSchema.insertObjectTriple(fieldURI, HGQL_HAS_SERVICE, serviceURI);
String iri = ((StringValue) field.getDirective("href").getArgument("iri").getValue()).getValue(); contextMap.put(field.getName(), iri); }); String serviceId = ((StringValue) dir.getArgument("id").getValue()).getValue(); rdfSchema.insertObjectTriple(typeUri, HGQL_HAS_FIELD, fieldURI); String serviceId = ((StringValue) field.getDirective("service").getArgument("id").getValue()).getValue(); String serviceURI = HGQL_SERVICE_NAMESPACE + serviceId; rdfSchema.insertObjectTriple(fieldURI, HGQL_HAS_SERVICE, serviceURI);
} else if (environment.getFieldDefinition().getDirective("related") != null) { final Directive directive = environment.getFieldDefinition().getDirective("related"); String source = ((StringValue) directive.getArgument("source").getValue()).getValue(); String predicate = ((StringValue) directive.getArgument("predicate").getValue()).getValue(); String direction = ((StringValue) directive.getArgument("direction").getValue()).getValue(); return new CollectionFetcherWrapper(argumentsHelper, new RelationsOfSubjectDataFetcher( source, } else if (environment.getFieldDefinition().getDirective("fromCollection") != null) { final Directive directive = environment.getFieldDefinition().getDirective("fromCollection"); String uri = ((StringValue) directive.getArgument("uri").getValue()).getValue(); return new CollectionFetcherWrapper(argumentsHelper, new CollectionDataFetcher(uri)); } else if (environment.getFieldDefinition().getDirective("rdf") != null) { final Directive directive = environment.getFieldDefinition().getDirective("rdf"); String uri = ((StringValue) directive.getArgument("predicate").getValue()).getValue(); Direction direction = valueOf(((StringValue) directive.getArgument("direction").getValue()).getValue()); boolean isList = ((BooleanValue) directive.getArgument("isList").getValue()).isValue(); boolean isObject = ((BooleanValue) directive.getArgument("isObject").getValue()).isValue(); boolean isValue = ((BooleanValue) directive.getArgument("isValue").getValue()).isValue(); if (isObject && isValue) { return new DataFetcherWrapper(argumentsHelper, isList, new UnionDataFetcher(uri, direction)); } else if (environment.getFieldDefinition().getDirective("dataSet") != null) { final Directive directive = environment.getFieldDefinition().getDirective("dataSet"); String userId = ((StringValue) directive.getArgument("userId").getValue()).getValue(); String dataSetId = ((StringValue) directive.getArgument("dataSetId").getValue()).getValue(); final DataSet dataSet = dataSetRepository.unsafeGetDataSetWithoutCheckingPermissions(userId, dataSetId) .orElse(null);