public MutationQuery forMutation(final String mutationName, final Object... inputs) { return new MutationQuery(buildQuery(mutationName), buildInput(mutationName, inputs)); }
private String getMutationInputArgumentName() { return graphQLSchemaHolder.getGraphQLSchemaConfig().getMutationInputArgumentName(); }
private boolean isClientMutationIdInjected() { return graphQLSchemaHolder.getGraphQLSchemaConfig().isInjectClientMutationId(); }
@Override public Object get(DataFetchingEnvironment environment) { Object targetMethodResult = null; try { beforeInvocation(environment); Object[] bindByClassValues = collectBindByClassValues(environment); Object[] inputArguments = getMethodParametersBinder().bindParameters(unwrapInputArguments(environment), bindByClassValues); targetMethodResult = getTargetMethod().invoke(getTargetObject(), inputArguments); targetMethodResult = afterInvocation(environment, targetMethodResult); } catch (Exception e) { String msg = "Exception while calling data fetcher [" + getTargetMethod().getName() + "]"; if (LOGGER.isErrorEnabled()) LOGGER.error(msg, e); throw new DataMutatorRuntimeException(msg, e); } return targetMethodResult; }
public GraphQLQueryTemplate(final GraphQLSchemaHolder graphQLSchemaHolder) { Assert.notNull(graphQLSchemaHolder, "GraphQL Schema holder can not be null"); this.graphQLSchemaHolder = graphQLSchemaHolder; this.graphQLSchema = this.graphQLSchemaHolder.getGraphQLSchema(); this.objectMapper = new ObjectMapper(); if (!graphQLSchemaHolder.getGraphQLSchemaConfig().isDateAsTimestamp()) this.objectMapper.setDateFormat(new SimpleDateFormat(graphQLSchemaHolder.getGraphQLSchemaConfig().getDateFormat())); }
private void injectClientMutationIdIfRequired(Map<String, Object> inputMap, Map<String, Object> outputMap) { if (getGraphQLSchemaConfig().isInjectClientMutationId()) { String clientMutationId = (String) inputMap.get(getGraphQLSchemaConfig().getClientMutationIdName()); outputMap.put(getGraphQLSchemaConfig().getClientMutationIdName(), clientMutationId); } }
private String getClientMutationIdName() { return graphQLSchemaHolder.getGraphQLSchemaConfig().getClientMutationIdName(); }
public static String getGraphQLDescription(AnnotatedElement accessibleObject, String defaultValue) { return getAnnotationValue(accessibleObject, GraphQLDescription.class, defaultValue); }
protected Map<String, Object> unwrapInputArguments(DataFetchingEnvironment environment) { Map<String, Object> inputObject = null; String inArgName = getGraphQLSchemaConfig().getMutationInputArgumentName(); if (environment.getArguments() != null && (environment.getArguments() instanceof Map)) { inputObject = (Map<String, Object>) environment.getArguments().get(inArgName); } return inputObject; }
@Bean public GraphQLSchemaConfig graphQLSchemaConfig() { GraphQLSchemaConfig graphQLSchemaConfig = new GraphQLSchemaConfig(); return graphQLSchemaConfig; }
public Object[] bindParameters(Map<String, Object> parametersValues) { return bindAllParameters(parametersValues, null); }
public static String getGraphQLUnionName(AnnotatedElement accessibleObject, String defaultValue) { return getAnnotationValue(accessibleObject, GraphQLUnion.class, defaultValue); }
@Bean public GraphQLSchemaConfig graphQLSchemaConfig() { GraphQLSchemaConfig graphQLSchemaConfig = new GraphQLSchemaConfig(); return graphQLSchemaConfig; }
public Object[] bindParameters(Map<String, Object> parametersValues, Object[] bindByClassValues) { return bindAllParameters(parametersValues, bindByClassValues); }
public static String getGraphQLMutationName(AnnotatedElement accessibleObject, String defaultValue) { return getAnnotationValue(accessibleObject, GraphQLMutation.class, defaultValue); }
@Bean public GraphQLSchemaConfig graphQLSchemaConfig() { GraphQLSchemaConfig graphQLSchemaConfig = new GraphQLSchemaConfig(); return graphQLSchemaConfig; }
public static String getGraphQLSchemaName(AnnotatedElement accessibleObject, String defaultValue) { return getAnnotationValue(accessibleObject, GraphQLSchema.class, defaultValue); }
@Bean public GraphQLSchemaConfig graphQLSchemaConfig() { GraphQLSchemaConfig graphQLSchemaConfig = new GraphQLSchemaConfig(); return graphQLSchemaConfig; }
public static String getGraphQLObjectName(AnnotatedElement accessibleObject, String defaultValue) { return getAnnotationValue(accessibleObject, GraphQLObject.class, defaultValue); }
public static String getGraphQLInterfaceName(AnnotatedElement accessibleObject, String defaultValue) { return getAnnotationValue(accessibleObject, GraphQLInterface.class, defaultValue); }