Search in sources :

Example 6 with StringValue

use of graphql.language.StringValue in project structr by structr.

the class QueryConfig method castValue.

private Object castValue(final SecurityContext securityContext, final Class type, final PropertyKey key, final Value value) throws FrameworkException {
    if (value instanceof StringValue) {
        return getStringValue(value, null);
    }
    if (value instanceof IntValue) {
        return getIntegerValue(value, -1);
    }
    if (value instanceof BooleanValue) {
        return getBooleanValue(value, false);
    }
    if (value instanceof ObjectValue && key != null) {
        final Map<String, Object> parameters = new LinkedHashMap<>();
        parameters.put(key.jsonName(), getMapValue(securityContext, type, value));
        final PropertyMap propertyMap = PropertyMap.inputTypeToJavaType(securityContext, type, parameters);
        // return converted result (should be replaced by NodeInterface)
        return propertyMap.get(key);
    }
    return null;
}
Also used : ObjectValue(graphql.language.ObjectValue) PropertyMap(org.structr.core.property.PropertyMap) BooleanValue(graphql.language.BooleanValue) GraphObject(org.structr.core.GraphObject) StringValue(graphql.language.StringValue) IntValue(graphql.language.IntValue) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

StringValue (graphql.language.StringValue)6 BooleanValue (graphql.language.BooleanValue)4 IntValue (graphql.language.IntValue)3 ObjectValue (graphql.language.ObjectValue)3 Argument (graphql.language.Argument)2 ArrayValue (graphql.language.ArrayValue)2 Directive (graphql.language.Directive)2 EnumValue (graphql.language.EnumValue)2 FloatValue (graphql.language.FloatValue)2 ObjectField (graphql.language.ObjectField)2 GraphqlParser (graphql.parser.antlr.GraphqlParser)2 BigDecimal (java.math.BigDecimal)2 BigInteger (java.math.BigInteger)2 VariableReference (graphql.language.VariableReference)1 LinkedHashMap (java.util.LinkedHashMap)1 DataSet (nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSet)1 Direction (nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.dto.Direction)1 CollectionDataFetcher (nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.berkeleydb.datafetchers.CollectionDataFetcher)1 RelationDataFetcher (nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.berkeleydb.datafetchers.RelationDataFetcher)1 RelationsOfSubjectDataFetcher (nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.berkeleydb.datafetchers.RelationsOfSubjectDataFetcher)1