You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2020/01/28 15:11:18 UTC
[unomi] 21/27: Initial work on integrating event service.
This is an automated email from the ASF dual-hosted git repository.
shuber pushed a commit to branch UNOMI-180-CXS-GRAPHQLAPI
in repository https://gitbox.apache.org/repos/asf/unomi.git
commit b4f89b3919d10448d5482007b4b789a05696e2ee
Author: Serge Huber <sh...@jahia.com>
AuthorDate: Sun May 26 11:32:18 2019 +0200
Initial work on integrating event service.
---
.../unomi/graphql/internal/CDPSDLServletImpl.java | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CDPSDLServletImpl.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CDPSDLServletImpl.java
index 5abb6fb..1545aa2 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CDPSDLServletImpl.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CDPSDLServletImpl.java
@@ -32,9 +32,13 @@ import graphql.schema.idl.RuntimeWiring;
import graphql.schema.idl.SchemaGenerator;
import graphql.schema.idl.SchemaParser;
import graphql.schema.idl.TypeDefinitionRegistry;
+import org.apache.unomi.api.Event;
+import org.apache.unomi.api.PartialList;
+import org.apache.unomi.api.services.EventService;
import org.osgi.framework.BundleContext;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
@@ -56,12 +60,18 @@ public class CDPSDLServletImpl extends HttpServlet {
private ObjectMapper objectMapper;
private GraphQL graphQL;
+ private EventService eventService;
@Activate
void activate(BundleContext bundleContext) {
this.bundleContext = bundleContext;
}
+ @Reference
+ public void setEventService(EventService eventService) {
+ this.eventService = eventService;
+ }
+
RuntimeWiring buildRuntimeWiring() {
GraphQLScalarType emptyTypeWorkAroundScalarType = GraphQLScalarType.newScalar()
@@ -134,7 +144,13 @@ public class CDPSDLServletImpl extends HttpServlet {
return null;
}
}))
- // .scalar(CustomScalar)
+ .type("CDP_Query", typeWiring -> typeWiring.dataFetcher("findEvents", new DataFetcher() {
+ @Override
+ public Object get(DataFetchingEnvironment dataFetchingEnvironment) throws Exception {
+ // PartialList<Event> events = eventService.searchEvents(condition, offset, size);
+ return null;
+ }
+ }))
// this uses builder function lambda syntax
/*
.type("QueryType", typeWiring -> typeWiring