@GraphQLField public ColorMarker color(@GraphQLIn("id") String id) throws InterruptedException { Thread.sleep(DELAY_MS); return null; }
public String getGraphQLInDefaultValueProviderMethodName() { GraphQLIn graphQLIn = getAnnotation(GraphQLIn.class); String defaultValueProviderMethod = ""; if (graphQLIn != null) { defaultValueProviderMethod = graphQLIn.defaultProvider(); } return defaultValueProviderMethod; }
public String getGraphQLInDefaultValueSpel() { GraphQLIn graphQLIn = getAnnotation(GraphQLIn.class); String GraphQLInValueSpel = ""; if (graphQLIn != null) { GraphQLInValueSpel = graphQLIn.defaultSpel(); } return GraphQLInValueSpel; }
@Override protected String getParameterName(int idx, MethodParameter methodParameter) { String inputParameterName = null; GraphQLIn graphQLIn = methodParameter.getParameterAnnotation(GraphQLIn.class); if (graphQLIn != null && StringUtils.hasLength(graphQLIn.value())) { inputParameterName = graphQLIn.value(); } return inputParameterName; }
public boolean isRequiredGraphQLInParameter() { GraphQLIn graphQLIn = getAnnotation(GraphQLIn.class); boolean isRequired = false; if (graphQLIn != null) { isRequired = graphQLIn.required(); } return isRequired; }
@GraphQLField public Character hero(@GraphQLIn("hero") Episode episode) { return null /** StarWarsData.getArtoo() **/; }
@GraphQLField public long event(@GraphQLNonNull @GraphQLIn(value = "id") final Long event) { return new Date().getTime(); }
@GraphQLField public Marker any(@GraphQLNonNull @GraphQLIn("id") String id) throws InterruptedException { Thread.sleep(DELAY_MS); return null; }
@GraphQLField public DynamicMarker dynamic(@GraphQLNonNull @GraphQLIn("id") String id) throws InterruptedException { Thread.sleep(DELAY_MS); return null; }
@GraphQLMutation("updateTodoDateMutation") public @GraphQLOut("outDate") Date updateTodoDateMutation(@GraphQLIn(value = "dateInput") Date date) { return new Date(); }
@GraphQLMutation("updateTodoLongMutation") public @GraphQLOut("outLong") Long updateTodoLongMutation(@GraphQLIn(value = "longInput") Long newText) { return Long.MAX_VALUE; }
@GraphQLField public Droid droid(@GraphQLNonNull @GraphQLIn("id") String id) { return null /** StarWarsData.getDroidDataFetcher() **/; } }
@GraphQLMutation("updateTodoMutation") public @GraphQLOut("todoEdge") String updateTodoMutation(@GraphQLIn(value = "updateTodoInput") String newText) { return "Simple output string"; }
@GraphQLField public Human human(@GraphQLNonNull @GraphQLIn("id") String id) { return null /** StarWarsData.getHumanDataFetcher() **/; }
@GraphQLField @GraphQLComplexity("1 + #first * #childScore") public TodoObjectType.TodoConnectionObjectType todos(@GraphQLIn("before") String before, @GraphQLIn("after") String after, @GraphQLIn(value = "first", defaultProvider = "getFirstDefaultValue") Integer first, @GraphQLIn(value = "last", defaultProvider = "getLastDefaultValue") Integer last, GenericTodoSchemaParserTest.GraphQLContext graphQLContext) { TodoObjectType.TodoEdgeObjectType todoEdgeObjectType = new TodoObjectType.TodoEdgeObjectType(); todoEdgeObjectType.setCursor("base64;test:cursor"); TodoObjectType todoObjectType = new TodoObjectType(); todoObjectType.setText("user:12345:todo-987"); todoObjectType.setComplete(true); todoObjectType.setId("todo:id:56789"); todoObjectType.setUpdated(new Date()); todoEdgeObjectType.setNode(todoObjectType); TodoObjectType.TodoConnectionObjectType todoConnectionObjectType = new TodoObjectType.TodoConnectionObjectType(); todoConnectionObjectType.setEdges(Lists.newArrayList(todoEdgeObjectType)); return todoConnectionObjectType; }
@GraphQLField("getAllUsersByRole") public List<UserObjectType> getAllUsersByRole(UserObjectType employee, @GraphQLIn("role") ROLE role) { UserObjectType userManagerObjectType = new UserObjectType(); userManagerObjectType.setId("user:id:manager:000001"); userManagerObjectType.setName("Adam Smith"); userManagerObjectType.setUpdated(new Date()); userManagerObjectType.setRole(UserObjectType.ROLE.MANAGER); return Lists.newArrayList(userManagerObjectType); }
@GraphQLField("manager") public UserObjectType getManager(UserObjectType employee, @GraphQLIn(value = "ids", defaultSpel = "T(java.util.Collections).EMPTY_SET") Set<String> ids) { UserObjectType userManagerObjectType = new UserObjectType(); userManagerObjectType.setId("user:id:manager:1234567"); userManagerObjectType.setName("Wolf Adolf Riverswood"); userManagerObjectType.setUpdated(new Date()); userManagerObjectType.setRole(UserObjectType.ROLE.MANAGER); return userManagerObjectType; }
@GraphQLField public RelayNode node(@GraphQLID @GraphQLNonNull @GraphQLIn(value = "id") final String id) { /** data fetcher goes here **/ TodoObjectType todoObjectType = new TodoObjectType(); todoObjectType.setId(id); todoObjectType.setText("Node text for test!"); todoObjectType.setUpdated(new Date()); return todoObjectType; } }
@GraphQLDescription("Mutation to add new todo item") @GraphQLMutation("addTodoMutation") public @GraphQLOut("todoEdge") TodoObjectType.TodoEdgeObjectType addTodoMutation(@GraphQLIn(value = "addTodoInput", defaultProvider = "getAddTodoInputDefaultValue") AddTodoIn addTodoInput, AddTodoIn2 addTodoInput2) { TodoObjectType.TodoEdgeObjectType todoEdgeObjectType = new TodoObjectType.TodoEdgeObjectType(); todoEdgeObjectType.setCursor("test-cursor"); todoEdgeObjectType.setNode(new TodoObjectType()); todoEdgeObjectType.getNode().setId("id-12345"); todoEdgeObjectType.getNode().setText("simple text"); todoEdgeObjectType.getNode().setComplete(false); todoEdgeObjectType.getNode().setUpdated(new Date()); return todoEdgeObjectType; }