use of org.kie.kogito.index.model.ProcessInstanceState in project kogito-apps by kiegroup.
the class GraphQLSchemaManager method createSchema.
private GraphQLSchema createSchema() {
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("schema.graphqls");
SchemaParser schemaParser = new SchemaParser();
TypeDefinitionRegistry typeDefinitionRegistry = schemaParser.parse(new InputStreamReader(stream));
RuntimeWiring runtimeWiring = RuntimeWiring.newRuntimeWiring().type("Query", builder -> {
builder.dataFetcher("ProcessInstances", this::getProcessInstancesValues);
builder.dataFetcher("UserTaskInstances", this::getUserTaskInstancesValues);
builder.dataFetcher("Jobs", this::getJobsValues);
return builder;
}).type("Mutation", builder -> {
builder.dataFetcher("ProcessInstanceAbort", this::abortProcessInstance);
builder.dataFetcher("ProcessInstanceRetry", this::retryProcessInstance);
builder.dataFetcher("ProcessInstanceSkip", this::skipProcessInstance);
builder.dataFetcher("ProcessInstanceUpdateVariables", this::updateProcessInstanceVariables);
builder.dataFetcher("NodeInstanceTrigger", this::triggerNodeInstance);
builder.dataFetcher("NodeInstanceRetrigger", this::retriggerNodeInstance);
builder.dataFetcher("NodeInstanceCancel", this::cancelNodeInstance);
builder.dataFetcher("JobCancel", this::cancelJob);
builder.dataFetcher("JobReschedule", this::rescheduleJob);
builder.dataFetcher("UserTaskInstanceUpdate", this::updateUserTaskInstance);
builder.dataFetcher("UserTaskInstanceCommentCreate", this::createTaskInstanceComment);
builder.dataFetcher("UserTaskInstanceAttachmentCreate", this::createTaskInstanceAttachment);
builder.dataFetcher("UserTaskInstanceCommentUpdate", this::updateUserTaskComment);
builder.dataFetcher("UserTaskInstanceCommentDelete", this::deleteUserTaskComment);
builder.dataFetcher("UserTaskInstanceAttachmentUpdate", this::updateUserTaskAttachment);
builder.dataFetcher("UserTaskInstanceAttachmentDelete", this::deleteUserTaskAttachment);
return builder;
}).type("ProcessInstance", builder -> {
builder.dataFetcher("parentProcessInstance", this::getParentProcessInstanceValue);
builder.dataFetcher("childProcessInstances", this::getChildProcessInstancesValues);
builder.dataFetcher("serviceUrl", this::getProcessInstanceServiceUrl);
builder.dataFetcher("diagram", this::getProcessInstanceDiagram);
builder.dataFetcher("nodeDefinitions", this::getProcessNodes);
return builder;
}).type("UserTaskInstance", builder -> {
builder.dataFetcher("schema", this::getUserTaskInstanceSchema);
return builder;
}).type("ProcessInstanceMeta", builder -> {
builder.dataFetcher("serviceUrl", this::getProcessInstanceJsonServiceUrl);
return builder;
}).type("ProcessInstanceState", builder -> {
builder.enumValues(name -> ProcessInstanceState.valueOf(name).ordinal());
return builder;
}).type("Subscription", builder -> {
builder.dataFetcher(PROCESS_INSTANCE_ADDED, getProcessInstanceAddedDataFetcher());
builder.dataFetcher(PROCESS_INSTANCE_UPDATED, getProcessInstanceUpdatedDataFetcher());
builder.dataFetcher(USER_TASK_INSTANCE_ADDED, getUserTaskInstanceAddedDataFetcher());
builder.dataFetcher(USER_TASK_INSTANCE_UPDATED, getUserTaskInstanceUpdatedDataFetcher());
builder.dataFetcher(JOB_ADDED, getJobAddedDataFetcher());
builder.dataFetcher(JOB_UPDATED, getJobUpdatedDataFetcher());
return builder;
}).scalar(qlDateTimeScalarType).build();
SchemaGenerator schemaGenerator = new SchemaGenerator();
return schemaGenerator.makeExecutableSchema(typeDefinitionRegistry, runtimeWiring);
}
Aggregations