[unomi-site] branch master updated: Correct name of OASIS specification
This is an automated email from the ASF dual-hosted git repository. shuber pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/unomi-site.git The following commit(s) were added to refs/heads/master by this push: new ae4171c Correct name of OASIS specification ae4171c is described below commit ae4171c7fcd86603993d952fa453a24cbfb2763d Author: Serge Huber AuthorDate: Wed May 29 08:57:07 2019 +0200 Correct name of OASIS specification --- src/main/webapp/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html index d1b0f55..259d208 100644 --- a/src/main/webapp/index.html +++ b/src/main/webapp/index.html @@ -158,7 +158,7 @@ The Apache Unomi™ advantage ? Each organization is unique and will always have specific needs, this is why Apache Unomi™ has been designed to be extended and to ease the integration of external data. The embedded features such as segmentation, scoring and built-in privacy will be appreciated by business users while horizontal scalability and open source positioning will be loved by developers and architects. -Apache Unomi™ is also the reference implementation of the upcoming OASIS Context Server (CXS) standard (https://www.oasis-open.org/committees/cxs/";>https://www.oasis-open.org/committees/cxs/) to help standardize personalization of customer experience while promoting ethical web experience management and increased user privacy controls. +Apache Unomi™ is also the reference implementation of the upcoming OASIS Context Server Customer Data Platform (CDP) standard (https://www.oasis-open.org/committees/cxs/";>https://www.oasis-open.org/committees/cxs/) to help standardize personalization of customer experience while promoting ethical web experience management and increased user privacy controls.
[GitHub] [unomi] sergehuber commented on issue #88: Update developper roles from old incubator roles
sergehuber commented on issue #88: Update developper roles from old incubator roles URL: https://github.com/apache/unomi/pull/88#issuecomment-496645919 Thanks for the corrections, I've merged the PR ! This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[unomi] branch master updated: Update developper roles from old incubator roles
This is an automated email from the ASF dual-hosted git repository. shuber pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/unomi.git The following commit(s) were added to refs/heads/master by this push: new 145823c Update developper roles from old incubator roles new 8ace7a5 This closes pull request number #88 145823c is described below commit 145823c3fa092fcd633b70f4b859c35b97b78194 Author: Francois Papon AuthorDate: Tue May 28 03:11:46 2019 +0400 Update developper roles from old incubator roles --- pom.xml | 43 --- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/pom.xml b/pom.xml index 9be1d68..3954fd7 100644 --- a/pom.xml +++ b/pom.xml @@ -125,10 +125,10 @@ champion committer -PPMC +PMC Talend -http://www.talend.com +https://www.talend.com shuber @@ -137,10 +137,10 @@ +1 committer -PPMC +PMC Chair Jahia -http://www.jahia.com +https://www.jahia.com bdelacretaz @@ -148,8 +148,8 @@ bdelacre...@apache.org +1 -Mentor -PPMC +Retired(Mentor) +Retired(PPMC) Adobe @@ -158,8 +158,8 @@ Roman Shaposhnik r...@apache.org -Mentor -PPMC +Retired(Mentor) +Retired(PPMC) Pivotal @@ -168,8 +168,8 @@ Chris Mattmann mattm...@apache.org -Mentor -PPMC +Retired(Mentor) +Retired(PPMC) NASA JPL @@ -179,42 +179,40 @@ dra...@apache.org committer -PPMC +PMC Sergiy Shyrkov committer -PPMC Kevan Jahanshahi committer -PPMC +PMC Cédric Mailleux -committer -PPMC +Retired(committer) +Retired(PPMC) Régis Mora -committer -PPMC +Retired(committer) +Retired(PPMC) Quentin Lamerand committer -PPMC @@ -224,16 +222,15 @@ +1 committer -PPMC -Jahia -http://www.jahia.com +RedHat +https://www.redhat.com David Griffon committer -PPMC +PMC @@ -261,7 +258,7 @@ +4 committer -PPMC +PMC Yupiik https://www.yupiik.com
[GitHub] [unomi] asfgit merged pull request #88: Update developper roles from old incubator roles
asfgit merged pull request #88: Update developper roles from old incubator roles URL: https://github.com/apache/unomi/pull/88 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[unomi-site] branch master updated: Correct name of OASIS specification
This is an automated email from the ASF dual-hosted git repository. shuber pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/unomi-site.git The following commit(s) were added to refs/heads/master by this push: new 143857d Correct name of OASIS specification 143857d is described below commit 143857d014cc7f23c4b274654027c61b1f4fcb99 Author: Serge Huber AuthorDate: Tue May 28 20:37:19 2019 +0200 Correct name of OASIS specification --- src/main/webapp/get-started.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/get-started.html b/src/main/webapp/get-started.html index 640b3cd..dd5d954 100644 --- a/src/main/webapp/get-started.html +++ b/src/main/webapp/get-started.html @@ -87,7 +87,7 @@ Basically the server tracks users using different mechanisms (by default cookies), builds a progressively populated profile and associates events that are performed by a user with his profile. Events may range from a click on a page, to a file being downloaded, a native mobile application button being clicked, or anything that can be sent to the server. The server has a built-in rule system that makes it possible to perform any action when an event is collected for a profile. It also has the notion of user segments, making it possible to classify user profiles into dynamic sub-groups, notably to build personalized experiences for specific segments. As Apache Unomi is built as an OSGi application running inside https://karaf.apache.org";>Apache Karaf, it is extremely extensible and built to be scalable. For example it is possible to plugin new conditions, actions, or any other service that may be needed such as beacon tracking or push notifications. - Apache Unomi is also the reference implementation of the upcoming https://www.oasis-open.org/committees/cxs/";>OASIS Context Server (CXS) standard to help standardize personalization of online experience while promoting ethical web experience management and increased user privacy controls. + Apache Unomi is also the reference implementation of the upcoming https://www.oasis-open.org/committees/cxs/";>OASIS Customer Data Platform specification to help standardize personalization of online experience while promoting ethical web experience management and increased user privacy controls.
[unomi] branch master updated: Adjust missed version numbers
This is an automated email from the ASF dual-hosted git repository. shuber pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/unomi.git The following commit(s) were added to refs/heads/master by this push: new 729ef07 Adjust missed version numbers 729ef07 is described below commit 729ef0727d956d80649771a9cf6ae28368f53a32 Author: Serge Huber AuthorDate: Tue May 28 20:27:42 2019 +0200 Adjust missed version numbers Signed-off-by: Serge Huber --- manual/src/main/asciidoc/samples/twitter-sample.adoc | 2 +- performance-tests/pom.xml| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manual/src/main/asciidoc/samples/twitter-sample.adoc b/manual/src/main/asciidoc/samples/twitter-sample.adoc index 48a3d9b..16330ec 100644 --- a/manual/src/main/asciidoc/samples/twitter-sample.adoc +++ b/manual/src/main/asciidoc/samples/twitter-sample.adoc @@ -42,7 +42,7 @@ If you are using the packaged version of Unomi (as opposed to deploying it to yo [source] -cp target/tweet-button-plugin-1.4.0-SNAPSHOT.jar ../../package/target/unomi-1.4.0-SNAPSHOT/deploy +cp target/tweet-button-plugin-1.5.0-SNAPSHOT.jar ../../package/target/unomi-1.5.0-SNAPSHOT/deploy = Testing the samples diff --git a/performance-tests/pom.xml b/performance-tests/pom.xml index b844b39..526d4f6 100644 --- a/performance-tests/pom.xml +++ b/performance-tests/pom.xml @@ -20,7 +20,7 @@ org.apache.unomi unomi-root -1.4.0-SNAPSHOT +1.5.0-SNAPSHOT unomi-performance-tests Apache Unomi :: Performance Tests
[unomi] 10/25: UNOMI-180 Implement CXS GraphQL API - Event output field generation is working again, input will be harder because of the way the objects are prefixed with the input naming convention
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 b47524f44050c837f92401e09911f9f1543dc7c0 Author: Serge Huber AuthorDate: Fri Jul 27 22:12:41 2018 +0200 UNOMI-180 Implement CXS GraphQL API - Event output field generation is working again, input will be harder because of the way the objects are prefixed with the input naming convention Signed-off-by: Serge Huber --- .../java/org/apache/unomi/graphql/CXSQuery.java| 6 +++ .../unomi/graphql/builders/CXSBuildersUtils.java | 52 ++ .../unomi/graphql/builders/CXSEventBuilders.java | 24 ++ .../graphql/internal/CXSGraphQLProviderImpl.java | 24 -- 4 files changed, 70 insertions(+), 36 deletions(-) diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSQuery.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSQuery.java index 24d11ff..7b548a9 100644 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSQuery.java +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSQuery.java @@ -26,6 +26,12 @@ import java.util.List; @GraphQLName("CXS_Query") public class CXSQuery { +CXSGraphQLProvider cxsGraphQLProvider; + +public CXSQuery(CXSGraphQLProvider cxsGraphQLProvider) { +this.cxsGraphQLProvider = cxsGraphQLProvider; +} + @GraphQLField public List getEventTypes() { return new ArrayList<>(); diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/builders/CXSBuildersUtils.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/builders/CXSBuildersUtils.java new file mode 100644 index 000..3d9c586 --- /dev/null +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/builders/CXSBuildersUtils.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.unomi.graphql.builders; + +import graphql.annotations.processor.GraphQLAnnotationsComponent; +import graphql.annotations.processor.ProcessingElementsContainer; +import graphql.schema.GraphQLInputObjectType; +import graphql.schema.GraphQLObjectType; + +public class CXSBuildersUtils { + +public static GraphQLObjectType.Builder getOutputBuilderFromAnnotatedClass( +GraphQLAnnotationsComponent annotationsComponent, +ProcessingElementsContainer container, +String typeName, +Class annotatedClass) { +if (typeName == null) { +typeName = annotatedClass.getName(); +} +return GraphQLObjectType.newObject() +.name(typeName) +.fields(((GraphQLObjectType) annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(annotatedClass, container)).getFieldDefinitions()); +} + +public static GraphQLInputObjectType.Builder getInputBuilderFromAnnotatedClass( +GraphQLAnnotationsComponent annotationsComponent, +ProcessingElementsContainer container, +String typeName, +Class annotatedClass) { +if (typeName == null) { +typeName = annotatedClass.getName(); +} +return GraphQLInputObjectType.newInputObject() +.name(typeName) +.fields(((GraphQLInputObjectType) annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(annotatedClass, container)).getFieldDefinitions()); +} + +} diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/builders/CXSEventBuilders.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/builders/CXSEventBuilders.java index f5e5777..ff2a27e 100644 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/builders/CXSEventBuilders.java +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/builders/CXSEventBuilders.java @@ -19,10 +19,7 @@ package org.apache.unomi.graphql.builders; import graphql.annotations.processor.GraphQLAnnotationsComponent; import graphql.annotations.processor.ProcessingElementsContainer; import graphql.schema.*; -import org.apache.unomi.graphql.CXSEvent; -import org.apache.unomi.graphql.CXS
[unomi] 08/25: UNOMI-180 Implement CXS GraphQL API Get event type creation to work (partially, the event GraphQL schema types are not yet properly modified)
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 8b7d8d38eb132594b3b960fefcc6b6a47b7dc4cf Author: Serge Huber AuthorDate: Fri Jul 27 17:45:05 2018 +0200 UNOMI-180 Implement CXS GraphQL API Get event type creation to work (partially, the event GraphQL schema types are not yet properly modified) Signed-off-by: Serge Huber --- .../unomi/graphql/CXSBooleanPropertyType.java | 28 - .../apache/unomi/graphql/CXSDatePropertyType.java | 26 - .../org/apache/unomi/graphql/CXSEventType.java | 34 +- .../apache/unomi/graphql/CXSEventTypeInput.java| 33 +- .../apache/unomi/graphql/CXSFloatPropertyType.java | 30 - .../unomi/graphql/CXSGeoPointPropertyType.java | 25 .../unomi/graphql/CXSIdentifierPropertyType.java | 28 - .../apache/unomi/graphql/CXSIntPropertyType.java | 30 - .../java/org/apache/unomi/graphql/CXSMutation.java | 88 +++--- .../org/apache/unomi/graphql/CXSPropertyType.java | 40 --- .../apache/unomi/graphql/CXSPropertyTypeInput.java | 20 .../apache/unomi/graphql/CXSSetPropertyType.java | 27 - .../unomi/graphql/CXSSetPropertyTypeInput.java | 21 +++- .../unomi/graphql/CXSStringPropertyType.java | 28 - .../unomi/graphql/builders/CXSEventBuilders.java | 31 ++--- .../graphql/internal/CXSGraphQLProviderImpl.java | 127 ++--- .../graphql/internal/CXSProviderManagerImpl.java | 2 - .../propertytypes/CXSBooleanPropertyType.java | 51 + .../CXSDatePropertyType.java} | 29 +++-- .../propertytypes/CXSFloatPropertyType.java| 60 ++ .../propertytypes/CXSGeoPointPropertyType.java | 44 +++ .../propertytypes/CXSIdentifierPropertyType.java | 52 + .../graphql/propertytypes/CXSIntPropertyType.java | 60 ++ .../graphql/propertytypes/CXSPropertyType.java | 94 +++ .../graphql/propertytypes/CXSSetPropertyType.java | 44 +++ .../propertytypes/CXSStringPropertyType.java | 53 + 26 files changed, 644 insertions(+), 461 deletions(-) diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSBooleanPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSBooleanPropertyType.java deleted file mode 100644 index caea959..000 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSBooleanPropertyType.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.unomi.graphql; - -import graphql.annotations.annotationTypes.GraphQLField; -import graphql.annotations.annotationTypes.GraphQLName; - -@GraphQLName("CXSBooleanPropertyType") -public class CXSBooleanPropertyType extends CXSPropertyType { - -@GraphQLField -public boolean defaultValue; - -} diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDatePropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDatePropertyType.java deleted file mode 100644 index 362d2bc..000 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDatePropertyType.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.unomi.graphql; - -import graphql.annotations.annot
[unomi] 22/25: UNOMI-180 CDP Specification implementation - Add todo for configurability of CORS headers
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 9a484f678fe4531d101cdea8d76f20666f6bb7fb Author: sergehuber AuthorDate: Mon May 27 20:32:54 2019 +0200 UNOMI-180 CDP Specification implementation - Add todo for configurability of CORS headers --- .../main/java/org/apache/unomi/graphql/internal/CDPSDLServletImpl.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 1545aa2..68be5b9 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,8 +32,6 @@ 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; @@ -280,6 +278,7 @@ public class CDPSDLServletImpl extends HttpServlet { */ public void setupCORSHeaders(HttpServletRequest httpServletRequest, ServletResponse response) throws IOException { if (response instanceof HttpServletResponse) { +// todo this should be configurable HttpServletResponse httpServletResponse = (HttpServletResponse) response; if (httpServletRequest != null && httpServletRequest.getHeader("Origin") != null) { httpServletResponse.setHeader("Access-Control-Allow-Origin", httpServletRequest.getHeader("Origin"));
[unomi] 13/25: UNOMI-180 Implement CXS GraphQL API - Update version numbers
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 a3a1dd96ff69a497b8428e6b27d2c484aab6092e Author: Serge Huber AuthorDate: Wed Nov 21 20:21:37 2018 +0100 UNOMI-180 Implement CXS GraphQL API - Update version numbers Signed-off-by: Serge Huber --- graphql/cxs-impl/pom.xml | 4 ++-- graphql/karaf-feature/pom.xml | 8 graphql/pom.xml | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/graphql/cxs-impl/pom.xml b/graphql/cxs-impl/pom.xml index af951ca..7f41d79 100644 --- a/graphql/cxs-impl/pom.xml +++ b/graphql/cxs-impl/pom.xml @@ -21,7 +21,7 @@ org.apache.unomi unomi-graphql -1.3.0-incubating-SNAPSHOT +1.4.0-incubating-SNAPSHOT 4.0.0 @@ -76,7 +76,7 @@ org.apache.unomi unomi-api -1.3.0-incubating-SNAPSHOT +1.4.0-incubating-SNAPSHOT provided diff --git a/graphql/karaf-feature/pom.xml b/graphql/karaf-feature/pom.xml index 3179638..61aa3a1 100644 --- a/graphql/karaf-feature/pom.xml +++ b/graphql/karaf-feature/pom.xml @@ -21,12 +21,12 @@ org.apache.unomi unomi-graphql -1.3.0-incubating-SNAPSHOT +1.4.0-incubating-SNAPSHOT 4.0.0 feature -cxs-graphql-feature +cdp-graphql-feature Apache Unomi :: GraphQL API :: Karaf Feature Apache Unomi Context GraphQL API Karaf Feature @@ -113,8 +113,8 @@ org.apache.unomi -cxs-graphql-api-impl -1.3.0-incubating-SNAPSHOT +cdp-graphql-api-impl +1.4.0-incubating-SNAPSHOT diff --git a/graphql/pom.xml b/graphql/pom.xml index 25d0e3f..9ab861d 100644 --- a/graphql/pom.xml +++ b/graphql/pom.xml @@ -22,7 +22,7 @@ org.apache.unomi unomi-root -1.3.0-incubating-SNAPSHOT +1.4.0-incubating-SNAPSHOT unomi-graphql
[unomi] 19/25: UNOMI-180 CDP Specification implementation - Add CORS support to get it to work with GraphQL Playground - Managed to execute a query (but doesn't return any data as DataFetchers are not
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 2b005ca79d65ffb281cb1d61797b6d9183c515fc Author: sergehuber AuthorDate: Mon May 13 14:04:34 2019 +0200 UNOMI-180 CDP Specification implementation - Add CORS support to get it to work with GraphQL Playground - Managed to execute a query (but doesn't return any data as DataFetchers are not yet implemented !) --- .../unomi/graphql/internal/CDPSDLServletImpl.java | 66 +- 1 file changed, 51 insertions(+), 15 deletions(-) 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 df69692..d56c0d7 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 @@ -37,6 +37,7 @@ import org.osgi.service.component.annotations.Component; import javax.servlet.ServletConfig; import javax.servlet.ServletException; +import javax.servlet.ServletResponse; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -199,24 +200,10 @@ public class CDPSDLServletImpl extends HttpServlet { variables = objectMapper.readValue(variableStr, typeRef); } +setupCORSHeaders(req, resp); executeGraphQLRequest(resp, query, operationName, variables); } -private void executeGraphQLRequest(HttpServletResponse resp, String query, String operationName, Map variables) throws IOException { -ExecutionInput executionInput = ExecutionInput.newExecutionInput() -.query(query) -.variables(variables) -.operationName(operationName) -.build(); - -ExecutionResult executionResult = graphQL.execute(executionInput); - -Map toSpecificationResult = executionResult.toSpecification(); - -PrintWriter out = resp.getWriter(); -objectMapper.writeValue(out, toSpecificationResult); -} - @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { InputStream bodyStream = req.getInputStream(); @@ -230,9 +217,33 @@ public class CDPSDLServletImpl extends HttpServlet { variables = new HashMap<>(); } +setupCORSHeaders(req, resp); executeGraphQLRequest(resp, query, operationName, variables); } +@Override +protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { +setupCORSHeaders(req, resp); +resp.flushBuffer(); +} + +private void executeGraphQLRequest(HttpServletResponse resp, String query, String operationName, Map variables) throws IOException { +if (query == null || query.trim().length() == 0) { +throw new RuntimeException("Query cannot be empty or null"); +} +ExecutionInput executionInput = ExecutionInput.newExecutionInput() +.query(query) +.variables(variables) +.operationName(operationName) +.build(); + +ExecutionResult executionResult = graphQL.execute(executionInput); + +Map toSpecificationResult = executionResult.toSpecification(); +PrintWriter out = resp.getWriter(); +objectMapper.writeValue(out, toSpecificationResult); +} + private Reader getSchemaReader(String resourceUrl) { try { return new InputStreamReader(bundleContext.getBundle().getResource(resourceUrl).openConnection().getInputStream(), Charsets.UTF_8.name()); @@ -241,4 +252,29 @@ public class CDPSDLServletImpl extends HttpServlet { } return null; } + +/** + * Setup CORS headers as soon as possible so that errors are not misconstrued on the client for CORS errors + * + * @param httpServletRequest + * @param response + * @throws IOException + */ +public void setupCORSHeaders(HttpServletRequest httpServletRequest, ServletResponse response) throws IOException { +if (response instanceof HttpServletResponse) { +HttpServletResponse httpServletResponse = (HttpServletResponse) response; +if (httpServletRequest != null && httpServletRequest.getHeader("Origin") != null) { +httpServletResponse.setHeader("Access-Control-Allow-Origin", httpServletRequest.getHeader("Origin")); +} else { +httpServletResponse.setHeader("Access-Control-Allow-Origin", "*"); +} +httpServletResponse.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With,
[unomi] 12/25: UNOMI-180 Implement CXS GraphQL API - Rename CXS to CDP
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 df454f45db1b87d6d969bcc5ba7072fcf2de48bf Author: Serge Huber AuthorDate: Mon Nov 19 18:17:11 2018 +0100 UNOMI-180 Implement CXS GraphQL API - Rename CXS to CDP Signed-off-by: Serge Huber --- graphql/cxs-impl/pom.xml | 6 +- ...raphQLProvider.java => CDPGraphQLProvider.java} | 10 +- .../java/org/apache/unomi/graphql/CDPMutation.java | 128 +++ ...Filter.java => CDPProfilePropertiesFilter.java} | 8 +- ...roviderManager.java => CDPProviderManager.java} | 2 +- .../unomi/graphql/{CXSQuery.java => CDPQuery.java} | 60 ++--- .../java/org/apache/unomi/graphql/CXSMutation.java | 127 -- .../builders/{CXSBuilder.java => CDPBuilder.java} | 2 +- ...CXSBuildersUtils.java => CDPBuildersUtils.java} | 2 +- ...CXSEventBuilders.java => CDPEventBuilders.java} | 256 ++--- ...oviderImpl.java => CDPGraphQLProviderImpl.java} | 122 +- ...anagerImpl.java => CDPProviderManagerImpl.java} | 22 +- ...opertyType.java => CDPBooleanPropertyType.java} | 8 +- ...ePropertyType.java => CDPDatePropertyType.java} | 6 +- ...PropertyType.java => CDPFloatPropertyType.java} | 6 +- ...pertyType.java => CDPGeoPointPropertyType.java} | 6 +- ...rtyType.java => CDPIdentifierPropertyType.java} | 6 +- ...ntPropertyType.java => CDPIntPropertyType.java} | 6 +- .../{CXSPropertyType.java => CDPPropertyType.java} | 8 +- ...etPropertyType.java => CDPSetPropertyType.java} | 12 +- ...ropertyType.java => CDPStringPropertyType.java} | 6 +- .../{CXSDateFilter.java => CDPDateFilter.java} | 4 +- .../{CXSEventFilter.java => CDPEventFilter.java} | 8 +- .../{CXSEventInput.java => CDPEventInput.java} | 8 +- ...put.java => CDPEventOccurrenceFilterInput.java} | 4 +- ...SEventTypeInput.java => CDPEventTypeInput.java} | 12 +- ...DistanceInput.java => CDPGeoDistanceInput.java} | 12 +- ...CXSGeoPointInput.java => CDPGeoPointInput.java} | 4 +- .../{CXSOrderByInput.java => CDPOrderByInput.java} | 8 +- ...rtyTypeInput.java => CDPPropertyTypeInput.java} | 38 +-- ...FilterInput.java => CDPSegmentFilterInput.java} | 8 +- ...TypeInput.java => CDPSetPropertyTypeInput.java} | 13 +- .../types/output/{CXSEvent.java => CDPEvent.java} | 12 +- ...ventConnection.java => CDPEventConnection.java} | 6 +- .../{CXSEventEdge.java => CDPEventEdge.java} | 6 +- .../{CXSEventFilter.java => CDPEventFilter.java} | 8 +- ...ceFilter.java => CDPEventOccurrenceFilter.java} | 6 +- ...ventProperties.java => CDPEventProperties.java} | 4 +- ...esFilter.java => CDPEventPropertiesFilter.java} | 4 +- .../{CXSEventType.java => CDPEventType.java} | 14 +- ...eoDistanceUnit.java => CDPGeoDistanceUnit.java} | 4 +- .../output/{CXSGeoPoint.java => CDPGeoPoint.java} | 4 +- .../output/{CXSSegment.java => CDPSegment.java}| 8 +- ...mentCondition.java => CDPSegmentCondition.java} | 10 +- ...ntConnection.java => CDPSegmentConnection.java} | 6 +- .../{CXSSegmentEdge.java => CDPSegmentEdge.java} | 6 +- .../{CXSSortOrder.java => CDPSortOrder.java} | 4 +- .../types/output/{CXSView.java => CDPView.java}| 4 +- 48 files changed, 518 insertions(+), 516 deletions(-) diff --git a/graphql/cxs-impl/pom.xml b/graphql/cxs-impl/pom.xml index 22a1edd..af951ca 100644 --- a/graphql/cxs-impl/pom.xml +++ b/graphql/cxs-impl/pom.xml @@ -25,9 +25,9 @@ 4.0.0 -cxs-graphql-api-impl -Apache Unomi :: GraphQL API :: CXS Implementation -Apache Unomi Context GraphQL API CXS Implementation +cdp-graphql-api-impl +Apache Unomi :: GraphQL API :: CDP Implementation +Apache Unomi Context GraphQL API CDP Implementation bundle diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGraphQLProvider.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CDPGraphQLProvider.java similarity index 77% rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGraphQLProvider.java rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CDPGraphQLProvider.java index f5a62a3..ed67d71 100644 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGraphQLProvider.java +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CDPGraphQLProvider.java @@ -16,15 +16,15 @@ */ package org.apache.unomi.graphql; -import org.apache.unomi.graphql.types.output.CXSEventType; +import org.apache.unomi.graphql.types.output.CDPEventType; import java.util.Map; -public interface CXSGraphQLProvider { +public interface CDPGraphQLProvider { -Map getEventTypes(); -CXSProviderManager getCxsProviderManager(); +Map getEventTypes(); +CDPProviderManager getCdpProviderManager(); void updateGraphQLTypes(); -void s
[unomi] 07/25: UNOMI-180 Implement CXS GraphQL API Big refactoring, will now use a mixture of annotations and manually declared fields to build dynamic fields in schema. Because of these changes all t
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 251f4d95b97fdab4c3827b4e4bda6fd3be119a9e Author: Serge Huber AuthorDate: Fri Jul 13 15:22:34 2018 +0200 UNOMI-180 Implement CXS GraphQL API Big refactoring, will now use a mixture of annotations and manually declared fields to build dynamic fields in schema. Because of these changes all the previous functionality is a bit broken for the moment but should be restored in a future commmit. Signed-off-by: Serge Huber --- graphql/cxs-impl/pom.xml | 2 + .../java/org/apache/unomi/graphql/CXSEvent.java| 14 +- ...raphQLProvider.java => CXSEventConnection.java} | 11 +- .../{CXSGraphQLProvider.java => CXSEventEdge.java} | 9 +- ...CXSGraphQLProvider.java => CXSEventFilter.java} | 11 +- ...aphQLProvider.java => CXSEventFilterInput.java} | 15 +- .../graphql/{CXSEvent.java => CXSEventInput.java} | 16 +- ...Provider.java => CXSEventOccurrenceFilter.java} | 15 +- ...raphQLProvider.java => CXSEventProperties.java} | 14 +- ...Provider.java => CXSEventPropertiesFilter.java} | 5 +- .../apache/unomi/graphql/CXSGraphQLProvider.java | 5 + .../java/org/apache/unomi/graphql/CXSMutation.java | 113 + ...ovider.java => CXSProfilePropertiesFilter.java} | 15 +- .../apache/unomi/graphql/CXSPropertyTypeInput.java | 2 +- .../{CXSPropertyTypeInput.java => CXSQuery.java} | 46 +- .../{CXSGraphQLProvider.java => CXSSegment.java} | 15 +- ...aphQLProvider.java => CXSSegmentCondition.java} | 13 +- .../{CXSGraphQLProvider.java => CXSView.java} | 7 +- .../CXSBuilder.java} | 6 +- .../CXSEventBuilders.java} | 347 ++ .../graphql/internal/CXSGraphQLProviderImpl.java | 498 +++-- graphql/karaf-feature/pom.xml | 2 + graphql/pom.xml| 2 +- 23 files changed, 368 insertions(+), 815 deletions(-) diff --git a/graphql/cxs-impl/pom.xml b/graphql/cxs-impl/pom.xml index ac3123d..3e29f66 100644 --- a/graphql/cxs-impl/pom.xml +++ b/graphql/cxs-impl/pom.xml @@ -26,6 +26,8 @@ 4.0.0 cxs-graphql-api-impl +Apache Unomi :: GraphQL API :: CXS Implementation +Apache Unomi Context GraphQL API CXS Implementation bundle diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEvent.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEvent.java index c278678..123dd87 100644 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEvent.java +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEvent.java @@ -16,8 +16,7 @@ */ package org.apache.unomi.graphql; -import java.util.LinkedHashMap; -import java.util.Map; +import graphql.annotations.annotationTypes.GraphQLField; public class CXSEvent { @@ -26,33 +25,40 @@ public class CXSEvent { private long timeStamp; private String subject; private String object; -private Map properties = new LinkedHashMap<>(); +private CXSEventProperties properties = new CXSEventProperties(); private CXSGeoPoint location; +@GraphQLField public String getId() { return id; } +@GraphQLField public String getEventType() { return eventType; } +@GraphQLField public long getTimeStamp() { return timeStamp; } +@GraphQLField public String getSubject() { return subject; } +@GraphQLField public String getObject() { return object; } -public Map getProperties() { +@GraphQLField +public CXSEventProperties getProperties() { return properties; } +@GraphQLField public CXSGeoPoint getLocation() { return location; } diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGraphQLProvider.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventConnection.java similarity index 79% copy from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGraphQLProvider.java copy to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventConnection.java index ae444b9..04c208c 100644 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGraphQLProvider.java +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventConnection.java @@ -16,8 +16,15 @@ */ package org.apache.unomi.graphql; -public interface CXSGraphQLProvider { +import graphql.annotations.annotationTypes.GraphQLField; -void setCxsProviderManager(CXSProviderManager cxsProviderManager); +import java.util.List; + +public class CXSEventConnection { + +@GraphQLField +public List edges; +@GraphQLField +public PageInfo pageInfo; } diff --git a/graphql/cxs-impl/src/main/java/org/ap
[unomi] 21/25: 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 db64ae64394b4e3ed3166fc23d2fd33140aad059 Author: Serge Huber 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 events = eventService.searchEvents(condition, offset, size); +return null; +} +})) // this uses builder function lambda syntax /* .type("QueryType", typeWiring -> typeWiring
[unomi] 16/25: UNOMI-180 - Start building a new servlet that loads the SDL schema and will combine it with dynamic type registration. - Deactivated old graphql-java-servlet for the moment.
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 79127c2f6997f6d5b15e4c77531d7cb7dfeb746d Author: sergehuber AuthorDate: Sun May 12 22:12:14 2019 +0200 UNOMI-180 - Start building a new servlet that loads the SDL schema and will combine it with dynamic type registration. - Deactivated old graphql-java-servlet for the moment. --- .../unomi/graphql/internal/CDPSDLServletImpl.java | 105 + .../{cdp-schema.sdl => cdp-schema.graphqls}| Bin graphql/karaf-feature/pom.xml | 6 +- 3 files changed, 109 insertions(+), 2 deletions(-) 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 new file mode 100644 index 000..dfd1ca6 --- /dev/null +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CDPSDLServletImpl.java @@ -0,0 +1,105 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.unomi.graphql.internal; + +import graphql.schema.GraphQLSchema; +import graphql.schema.StaticDataFetcher; +import graphql.schema.idl.RuntimeWiring; +import graphql.schema.idl.SchemaGenerator; +import graphql.schema.idl.SchemaParser; +import graphql.schema.idl.TypeDefinitionRegistry; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; + +import static graphql.schema.idl.TypeRuntimeWiring.newTypeWiring; + +@Component( + service={javax.servlet.http.HttpServlet.class,javax.servlet.Servlet.class}, +property = {"alias=/graphql", "jmx.objectname=graphql.servlet:type=graphql"} +) +public class CDPSDLServletImpl extends HttpServlet { + +@Reference +private BundleContext bundleContext; + +RuntimeWiring buildRuntimeWiring() { +return RuntimeWiring.newRuntimeWiring() +// .scalar(CustomScalar) +// this uses builder function lambda syntax +/* +.type("QueryType", typeWiring -> typeWiring +.dataFetcher("hero", new StaticDataFetcher(StarWarsData.getArtoo())) +.dataFetcher("human", StarWarsData.getHumanDataFetcher()) +.dataFetcher("droid", StarWarsData.getDroidDataFetcher()) +) +.type("Human", typeWiring -> typeWiring +.dataFetcher("friends", StarWarsData.getFriendsDataFetcher()) +) +// you can use builder syntax if you don't like the lambda syntax +.type("Droid", typeWiring -> typeWiring +.dataFetcher("friends", StarWarsData.getFriendsDataFetcher()) +) +// or full builder syntax if that takes your fancy +.type( +newTypeWiring("Character") + .typeResolver(StarWarsData.getCharacterTypeResolver()) +.build() +) +*/ +.build(); +} + +@Override +public void init(ServletConfig config) throws ServletException { +super.init(config); + +SchemaParser schemaParser = new SchemaParser(); +SchemaGenerator schemaGenerator = new SchemaGenerator(); + +Reader schemaReader = getSchemaReader("cdp-schema.graphqls"); +//File schemaFile2 = loadSchema("cdp-schema.graphqls"); +//File schemaFile3 = loadSchema("cdp-schema.graphqls"); + +TypeDefinitionRegistry typeRegistry = new TypeDefinitionRegistry(); + +// each registry is merged into the main registry +typeRegistry.merge(schemaParser.parse(schemaReader)); +//typeRegistry.merge(schemaParse
[unomi] 23/25: findSegments and findEvents fields now work partially, retrieving partially built results. Filters are not yet doing anything.
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 54ca4398e6460f516739f9d840c9fb2ba3cc5afd Author: Serge Huber AuthorDate: Tue May 28 15:36:29 2019 +0200 findSegments and findEvents fields now work partially, retrieving partially built results. Filters are not yet doing anything. --- graphql/README.md | 77 ++ .../unomi/graphql/internal/CDPSDLServletImpl.java | 156 + .../src/main/resources/cdp-schema.graphqls | 8 +- 3 files changed, 213 insertions(+), 28 deletions(-) diff --git a/graphql/README.md b/graphql/README.md new file mode 100644 index 000..94e8714 --- /dev/null +++ b/graphql/README.md @@ -0,0 +1,77 @@ +Apache Unomi GraphQL API + + +Install +--- + +Installing GraphQL feature: + +feature:repo-add mvn:org.apache.unomi/cdp-graphql-feature/1.4.0-SNAPSHOT/xml/features +feature:install cdp-graphql-feature + +GraphQL Endpoint + + +You can then access the GraphQL endpoint at the following URL: + +http://localhost:8181/sdlgraphql + +Query example +- + +operation:: + +query findEvents($filter: CDP_EventFilterInput) { + cdp { +findEvents(filter: $filter) { + pageInfo { +hasNextPage +hasPreviousPage + } + edges { +cursor +node { + id + cdp_profileID { +client { + id + title +} +id +uri + } + __typename +} + } +} + } +} + +variables:: + +{ + "filter": { +"cdp_profileID_equals": "" + } +} + +Segment query operation: + +query findSegments($segmentFilter: CDP_SegmentFilterInput) { + cdp { +findSegments(filter: $segmentFilter) { + edges { +node { + id + name + view { +name + } + profiles { +profileIDs + } +} + } +} + } +} 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 68be5b9..2deae05 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,7 +32,15 @@ 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.Metadata; +import org.apache.unomi.api.PartialList; +import org.apache.unomi.api.conditions.Condition; +import org.apache.unomi.api.query.Query; +import org.apache.unomi.api.segments.Segment; +import org.apache.unomi.api.services.DefinitionsService; import org.apache.unomi.api.services.EventService; +import org.apache.unomi.api.services.SegmentService; import org.osgi.framework.BundleContext; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; @@ -45,7 +53,9 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; @Component( @@ -59,6 +69,9 @@ public class CDPSDLServletImpl extends HttpServlet { private GraphQL graphQL; private EventService eventService; +private DefinitionsService definitionsService; +private SegmentService segmentService; + @Activate void activate(BundleContext bundleContext) { @@ -70,6 +83,16 @@ public class CDPSDLServletImpl extends HttpServlet { this.eventService = eventService; } +@Reference +public void setDefinitionService(DefinitionsService definitionService) { +this.definitionsService = definitionService; +} + +@Reference +public void setSegmentService(SegmentService segmentService) { +this.segmentService = segmentService; +} + RuntimeWiring buildRuntimeWiring() { GraphQLScalarType emptyTypeWorkAroundScalarType = GraphQLScalarType.newScalar() @@ -125,7 +148,7 @@ public class CDPSDLServletImpl extends HttpServlet { .typeResolver(new TypeResolver() { @Override public GraphQLObjectType getType(TypeResolutionEnvironment env) { -return null; +
[unomi] 14/25: UNOMI-180 Implement CXS GraphQL API - Update dependency versions to make the GraphQL framework work again
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 c69cb0d2e6e2cbecfe4e28a57abc2656476ea9c3 Author: Serge Huber AuthorDate: Thu Nov 22 13:33:51 2018 +0100 UNOMI-180 Implement CXS GraphQL API - Update dependency versions to make the GraphQL framework work again Signed-off-by: Serge Huber --- graphql/cxs-impl/pom.xml | 2 +- graphql/karaf-feature/pom.xml | 16 ++-- graphql/pom.xml | 5 +++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/graphql/cxs-impl/pom.xml b/graphql/cxs-impl/pom.xml index 7f41d79..8a0e883 100644 --- a/graphql/cxs-impl/pom.xml +++ b/graphql/cxs-impl/pom.xml @@ -32,7 +32,7 @@ -com.graphql-java +com.graphql-java-kickstart graphql-java-servlet ${graphql.java.servlet.version} provided diff --git a/graphql/karaf-feature/pom.xml b/graphql/karaf-feature/pom.xml index 61aa3a1..c051b18 100644 --- a/graphql/karaf-feature/pom.xml +++ b/graphql/karaf-feature/pom.xml @@ -35,22 +35,26 @@ com.fasterxml.jackson.core jackson-core -2.8.6 +${jackson.version} +compile com.fasterxml.jackson.core jackson-annotations -2.8.6 +${jackson.version} +compile com.fasterxml.jackson.core jackson-databind -2.8.6 +${jackson.version} +compile com.fasterxml.jackson.datatype jackson-datatype-jdk8 -2.8.4 +${jackson.version} +compile com.google.guava @@ -70,7 +74,7 @@ com.graphql-java java-dataloader -2.0.2 +2.2.0 org.reactivestreams @@ -80,7 +84,7 @@ -com.graphql-java +com.graphql-java-kickstart graphql-java-servlet ${graphql.java.servlet.version} diff --git a/graphql/pom.xml b/graphql/pom.xml index 9ab861d..d879d27 100644 --- a/graphql/pom.xml +++ b/graphql/pom.xml @@ -31,9 +31,10 @@ pom -5.0.1 -8.0 +7.1.0 +11.0 6.1 +2.9.7
[unomi] 20/25: UNOMI-180 CDP Specification implementation - Integrate Apollo Tracing support
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 6dfd97408b4cba8599b7a9901cbc51b57e878a46 Author: sergehuber AuthorDate: Mon May 13 14:44:04 2019 +0200 UNOMI-180 CDP Specification implementation - Integrate Apollo Tracing support --- .../main/java/org/apache/unomi/graphql/internal/CDPSDLServletImpl.java | 2 ++ 1 file changed, 2 insertions(+) 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 d56c0d7..5abb6fb 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 @@ -24,6 +24,7 @@ import graphql.ExecutionInput; import graphql.ExecutionResult; import graphql.GraphQL; import graphql.TypeResolutionEnvironment; +import graphql.execution.instrumentation.tracing.TracingInstrumentation; import graphql.introspection.IntrospectionQuery; import graphql.scalars.ExtendedScalars; import graphql.schema.*; @@ -179,6 +180,7 @@ public class CDPSDLServletImpl extends HttpServlet { RuntimeWiring wiring = buildRuntimeWiring(); GraphQLSchema graphQLSchema = schemaGenerator.makeExecutableSchema(typeRegistry, wiring); graphQL = GraphQL.newGraphQL(graphQLSchema) +.instrumentation(new TracingInstrumentation()) .build(); objectMapper = new ObjectMapper();
[unomi] 18/25: UNOMI-180 CDP Specification implementation - Implement GET and POST basic support - Add support for schema retrieval - Add extended scalars (some scalars are not implemented yet such as
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 5e21cbc7003b4ef069c7df5e73bb65221edc7841 Author: sergehuber AuthorDate: Mon May 13 11:59:36 2019 +0200 UNOMI-180 CDP Specification implementation - Implement GET and POST basic support - Add support for schema retrieval - Add extended scalars (some scalars are not implemented yet such as GeoPoint) --- graphql/cxs-impl/pom.xml | 6 + .../unomi/graphql/internal/CDPSDLServletImpl.java | 146 - .../src/main/resources/cdp-schema.graphqls | 6 +- graphql/karaf-feature/pom.xml | 5 + graphql/pom.xml| 1 + 5 files changed, 155 insertions(+), 9 deletions(-) diff --git a/graphql/cxs-impl/pom.xml b/graphql/cxs-impl/pom.xml index 79cd629..e4e093e 100644 --- a/graphql/cxs-impl/pom.xml +++ b/graphql/cxs-impl/pom.xml @@ -50,6 +50,12 @@ provided +com.graphql-java +graphql-java-extended-scalars +${graphql.java.extended.scalars.version} +provided + + org.osgi osgi.enterprise 6.0.0 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 8cafa15..df69692 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 @@ -16,8 +16,17 @@ */ package org.apache.unomi.graphql.internal; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; import com.google.common.base.Charsets; -import graphql.schema.GraphQLSchema; +import graphql.ExecutionInput; +import graphql.ExecutionResult; +import graphql.GraphQL; +import graphql.TypeResolutionEnvironment; +import graphql.introspection.IntrospectionQuery; +import graphql.scalars.ExtendedScalars; +import graphql.schema.*; import graphql.schema.idl.RuntimeWiring; import graphql.schema.idl.SchemaGenerator; import graphql.schema.idl.SchemaParser; @@ -29,9 +38,11 @@ import org.osgi.service.component.annotations.Component; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.Reader; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.util.HashMap; +import java.util.Map; @Component( service={javax.servlet.http.HttpServlet.class,javax.servlet.Servlet.class}, @@ -40,6 +51,9 @@ import java.io.Reader; public class CDPSDLServletImpl extends HttpServlet { private BundleContext bundleContext; +private ObjectMapper objectMapper; +private GraphQL graphQL; + @Activate void activate(BundleContext bundleContext) { @@ -47,7 +61,77 @@ public class CDPSDLServletImpl extends HttpServlet { } RuntimeWiring buildRuntimeWiring() { + +GraphQLScalarType emptyTypeWorkAroundScalarType = GraphQLScalarType.newScalar() +.name("EmptyTypeWorkAround") +.description("A marker type to get around the limitation of GraphQL that doesn't allow empty types. It should be always ignored.") +.coercing(new Coercing() { +@Override +public Object serialize(Object dataFetcherResult) throws CoercingSerializeException { +return null; +} + +@Override +public Object parseValue(Object input) throws CoercingParseValueException { +return input; +} + +@Override +public Object parseLiteral(Object input) throws CoercingParseLiteralException { +return input; +} +}) +.build(); + +GraphQLScalarType geopointScalarType = GraphQLScalarType.newScalar() +.name("GeoPoint") +.description("A type that represents a geographical location") +.coercing(new Coercing() { +@Override +public Object serialize(Object dataFetcherResult) throws CoercingSerializeException { +return null; +} + +@Override +public Object parseValue(Object input) throws CoercingParseValueException { +return input; +
[unomi] 25/25: Update project version to 1.5.0
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 ca1bbddcfd70179aec3d99fd155351e1f9dc5f5d Author: Serge Huber AuthorDate: Tue May 28 20:13:33 2019 +0200 Update project version to 1.5.0 --- graphql/README.md | 19 ++- graphql/cxs-impl/pom.xml | 4 ++-- graphql/karaf-feature/pom.xml | 4 ++-- graphql/pom.xml | 2 +- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/graphql/README.md b/graphql/README.md index 94e8714..903fb69 100644 --- a/graphql/README.md +++ b/graphql/README.md @@ -1,3 +1,20 @@ + + Apache Unomi GraphQL API @@ -6,7 +23,7 @@ Install Installing GraphQL feature: -feature:repo-add mvn:org.apache.unomi/cdp-graphql-feature/1.4.0-SNAPSHOT/xml/features +feature:repo-add mvn:org.apache.unomi/cdp-graphql-feature/1.5.0-SNAPSHOT/xml/features feature:install cdp-graphql-feature GraphQL Endpoint diff --git a/graphql/cxs-impl/pom.xml b/graphql/cxs-impl/pom.xml index e4e093e..1a6ef43 100644 --- a/graphql/cxs-impl/pom.xml +++ b/graphql/cxs-impl/pom.xml @@ -21,7 +21,7 @@ org.apache.unomi unomi-graphql -1.4.0-SNAPSHOT +1.5.0-SNAPSHOT 4.0.0 @@ -82,7 +82,7 @@ org.apache.unomi unomi-api -1.4.0-SNAPSHOT +1.5.0-SNAPSHOT provided diff --git a/graphql/karaf-feature/pom.xml b/graphql/karaf-feature/pom.xml index ae56dd4..3ea0456 100644 --- a/graphql/karaf-feature/pom.xml +++ b/graphql/karaf-feature/pom.xml @@ -21,7 +21,7 @@ org.apache.unomi unomi-graphql -1.4.0-SNAPSHOT +1.5.0-SNAPSHOT 4.0.0 feature @@ -122,7 +122,7 @@ org.apache.unomi cdp-graphql-api-impl -1.4.0-SNAPSHOT +1.5.0-SNAPSHOT diff --git a/graphql/pom.xml b/graphql/pom.xml index 26f1644..a8a9514 100644 --- a/graphql/pom.xml +++ b/graphql/pom.xml @@ -22,7 +22,7 @@ org.apache.unomi unomi-root -1.4.0-SNAPSHOT +1.5.0-SNAPSHOT unomi-graphql
[unomi] 24/25: Add custom unomi types with custom event types.
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 af70f6f8921a5445f371365b5596a6ac5b5e6344 Author: Serge Huber AuthorDate: Tue May 28 17:55:54 2019 +0200 Add custom unomi types with custom event types. --- .../unomi/graphql/internal/CDPSDLServletImpl.java | 16 - .../src/main/resources/cdp-schema.graphqls | 6 -- .../src/main/resources/unomi-schema.graphqls | 74 ++ 3 files changed, 87 insertions(+), 9 deletions(-) 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 2deae05..6a0e7ff 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 @@ -148,7 +148,15 @@ public class CDPSDLServletImpl extends HttpServlet { .typeResolver(new TypeResolver() { @Override public GraphQLObjectType getType(TypeResolutionEnvironment env) { -return env.getSchema().getObjectType("CDP_ProfileUpdateEvent"); +Map object = env.getObject(); +String unomiEventType = (String) object.get("__unomiEventType"); +if ("view".equals(unomiEventType)) { +return env.getSchema().getObjectType("Unomi_PageViewEvent"); +} else if ("sessionCreated".equals(unomiEventType)) { +return env.getSchema().getObjectType("Unomi_SessionCreatedEvent"); +} else { +return env.getSchema().getObjectType("Unomi_UnknownEvent"); +} } })) .type("CDP_ProfileInterface", typeWiring -> typeWiring @@ -282,14 +290,16 @@ public class CDPSDLServletImpl extends HttpServlet { SchemaParser schemaParser = new SchemaParser(); SchemaGenerator schemaGenerator = new SchemaGenerator(); -Reader schemaReader = getSchemaReader("cdp-schema.graphqls"); +Reader cdpSchemaReader = getSchemaReader("cdp-schema.graphqls"); +Reader unomiSchemaReader = getSchemaReader("unomi-schema.graphqls"); //File schemaFile2 = loadSchema("cdp-schema.graphqls"); //File schemaFile3 = loadSchema("cdp-schema.graphqls"); TypeDefinitionRegistry typeRegistry = new TypeDefinitionRegistry(); // each registry is merged into the main registry -typeRegistry.merge(schemaParser.parse(schemaReader)); +typeRegistry.merge(schemaParser.parse(cdpSchemaReader)); +typeRegistry.merge(schemaParser.parse(unomiSchemaReader)); //typeRegistry.merge(schemaParser.parse(schemaFile2)); //typeRegistry.merge(schemaParser.parse(schemaFile3)); diff --git a/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls b/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls index 1e71cbe..bea3348 100644 --- a/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls +++ b/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls @@ -972,9 +972,3 @@ https://github.com/graphql-java/graphql-java-extended-scalars for example implementation """ scalar Time - -schema { - query : Query - mutation : Mutation - subscription : Subscription -} \ No newline at end of file diff --git a/graphql/cxs-impl/src/main/resources/unomi-schema.graphqls b/graphql/cxs-impl/src/main/resources/unomi-schema.graphqls new file mode 100644 index 000..73a87ec --- /dev/null +++ b/graphql/cxs-impl/src/main/resources/unomi-schema.graphqls @@ -0,0 +1,74 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This file contains extensions to the CDP specification that are specific to Apache Unomi + +type Unomi_PageView { +url : String +path : String +referrer : String +} + +type Unomi_PageViewEvent implements CDP_EventInterface { +id: ID! +cdp_source: CDP_Source +cdp_client: CDP_Client +cdp_profileID: CDP_ProfileID! +cdp_profile: CDP_Profile! +cdp_object: C
[unomi] 15/25: UNOMI-180 - Updated GraphQL projects to latest version - Added CDP SDL schema generated from latest CDP specification
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 b4915883ddec2fd55b274d07f8af80e2a78baf2d Author: sergehuber AuthorDate: Sun May 12 16:43:35 2019 +0200 UNOMI-180 - Updated GraphQL projects to latest version - Added CDP SDL schema generated from latest CDP specification --- graphql/cxs-impl/src/main/resources/cdp-schema.sdl | Bin 0 -> 45752 bytes graphql/pom.xml| 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/graphql/cxs-impl/src/main/resources/cdp-schema.sdl b/graphql/cxs-impl/src/main/resources/cdp-schema.sdl new file mode 100644 index 000..22fba9a Binary files /dev/null and b/graphql/cxs-impl/src/main/resources/cdp-schema.sdl differ diff --git a/graphql/pom.xml b/graphql/pom.xml index d879d27..191e642 100644 --- a/graphql/pom.xml +++ b/graphql/pom.xml @@ -31,9 +31,9 @@ pom -7.1.0 -11.0 - 6.1 +7.4.1 +12.0 + 7.0 2.9.7
[unomi] 11/25: UNOMI-180 Implement CXS GraphQL API - Modify the type generation to use "Input" suffix for input types instead of a prefix.
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 fe0e16f4fc29286a6139127656411934e554b316 Author: Serge Huber AuthorDate: Sun Nov 18 23:50:09 2018 +0100 UNOMI-180 Implement CXS GraphQL API - Modify the type generation to use "Input" suffix for input types instead of a prefix. Signed-off-by: Serge Huber --- graphql/cxs-impl/pom.xml | 6 +++ .../apache/unomi/graphql/CXSGraphQLProvider.java | 4 +- .../java/org/apache/unomi/graphql/CXSMutation.java | 22 ++- .../apache/unomi/graphql/CXSProviderManager.java | 4 ++ .../java/org/apache/unomi/graphql/CXSQuery.java| 45 +- .../unomi/graphql/builders/CXSEventBuilders.java | 9 - .../graphql/internal/CXSGraphQLProviderImpl.java | 18 +++-- .../graphql/internal/CXSProviderManagerImpl.java | 23 +++ .../propertytypes/CXSFloatPropertyType.java| 18 - .../input/CXSDateFilter.java} | 6 +-- .../input/CXSEventFilter.java} | 10 ++--- .../graphql/{ => types/input}/CXSEventInput.java | 4 +- .../input}/CXSEventOccurrenceFilterInput.java | 4 +- .../{ => types/input}/CXSEventTypeInput.java | 4 +- .../{ => types/input}/CXSGeoDistanceInput.java | 8 ++-- .../{ => types/input}/CXSGeoPointInput.java| 8 ++-- .../graphql/{ => types/input}/CXSOrderByInput.java | 5 ++- .../{ => types/input}/CXSPropertyTypeInput.java| 4 +- .../input/CXSSegmentFilterInput.java} | 26 ++--- .../{ => types/input}/CXSSetPropertyTypeInput.java | 7 ++-- .../unomi/graphql/{ => types/output}/CXSEvent.java | 2 +- .../{ => types/output}/CXSEventConnection.java | 2 +- .../graphql/{ => types/output}/CXSEventEdge.java | 2 +- .../graphql/{ => types/output}/CXSEventFilter.java | 2 +- .../output}/CXSEventOccurrenceFilter.java | 2 +- .../{ => types/output}/CXSEventProperties.java | 2 +- .../output}/CXSEventPropertiesFilter.java | 2 +- .../graphql/{ => types/output}/CXSEventType.java | 2 +- .../{ => types/output}/CXSGeoDistanceUnit.java | 2 +- .../graphql/{ => types/output}/CXSGeoPoint.java| 6 +-- .../graphql/{ => types/output}/CXSSegment.java | 2 +- .../{ => types/output}/CXSSegmentCondition.java| 3 +- .../output/CXSSegmentConnection.java} | 9 ++--- .../output/CXSSegmentEdge.java}| 9 +++-- .../graphql/{ => types/output}/CXSSortOrder.java | 2 +- .../unomi/graphql/{ => types/output}/CXSView.java | 2 +- .../unomi/graphql/{ => types/output}/PageInfo.java | 2 +- graphql/karaf-feature/pom.xml | 19 +++-- graphql/pom.xml| 6 +-- 39 files changed, 220 insertions(+), 93 deletions(-) diff --git a/graphql/cxs-impl/pom.xml b/graphql/cxs-impl/pom.xml index 3e29f66..22a1edd 100644 --- a/graphql/cxs-impl/pom.xml +++ b/graphql/cxs-impl/pom.xml @@ -73,6 +73,12 @@ 1.7.21 provided + +org.apache.unomi +unomi-api +1.3.0-incubating-SNAPSHOT +provided + \ No newline at end of file diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGraphQLProvider.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGraphQLProvider.java index 1636402..f5a62a3 100644 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGraphQLProvider.java +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGraphQLProvider.java @@ -16,11 +16,13 @@ */ package org.apache.unomi.graphql; +import org.apache.unomi.graphql.types.output.CXSEventType; + import java.util.Map; public interface CXSGraphQLProvider { -Map getEventTypes(); +Map getEventTypes(); CXSProviderManager getCxsProviderManager(); void updateGraphQLTypes(); void setCxsProviderManager(CXSProviderManager cxsProviderManager); diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSMutation.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSMutation.java index 9732de4..f7cb1e1 100644 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSMutation.java +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSMutation.java @@ -20,9 +20,13 @@ import graphql.annotations.annotationTypes.GraphQLField; import graphql.annotations.annotationTypes.GraphQLName; import graphql.schema.DataFetchingEnvironment; import org.apache.unomi.graphql.propertytypes.CXSIdentifierPropertyType; -import org.apache.unomi.graphql.propertytypes.CXSPropertyType; import org.apache.unomi.graphql.propertytypes.CXSSetPropertyType; import org.apache.unomi.graphql.propertytypes.CXSStringPropertyType; +import org.apache.unomi.graphql.types.input.CXSEven
[unomi] 17/25: UNOMI-180 CDP Specification implementation - Get CDP feature to install properly (but it doesn't start yet since it is missing custom scalar and event registrations) - Fixed GraphQL sch
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 3d88da486c53ea4457a062495352cf453b877e76 Author: sergehuber AuthorDate: Sun May 12 23:49:05 2019 +0200 UNOMI-180 CDP Specification implementation - Get CDP feature to install properly (but it doesn't start yet since it is missing custom scalar and event registrations) - Fixed GraphQL schema JSON encoding to UTF-8 - Removed references to incubating that are no longer needed. --- graphql/cxs-impl/pom.xml| 4 ++-- .../unomi/graphql/internal/CDPSDLServletImpl.java | 17 + .../cxs-impl/src/main/resources/cdp-schema.graphqls | Bin 45752 -> 22300 bytes graphql/karaf-feature/pom.xml | 11 --- graphql/pom.xml | 2 +- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/graphql/cxs-impl/pom.xml b/graphql/cxs-impl/pom.xml index 8a0e883..79cd629 100644 --- a/graphql/cxs-impl/pom.xml +++ b/graphql/cxs-impl/pom.xml @@ -21,7 +21,7 @@ org.apache.unomi unomi-graphql -1.4.0-incubating-SNAPSHOT +1.4.0-SNAPSHOT 4.0.0 @@ -76,7 +76,7 @@ org.apache.unomi unomi-api -1.4.0-incubating-SNAPSHOT +1.4.0-SNAPSHOT provided 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 dfd1ca6..8cafa15 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 @@ -16,35 +16,36 @@ */ package org.apache.unomi.graphql.internal; +import com.google.common.base.Charsets; import graphql.schema.GraphQLSchema; -import graphql.schema.StaticDataFetcher; import graphql.schema.idl.RuntimeWiring; import graphql.schema.idl.SchemaGenerator; import graphql.schema.idl.SchemaParser; import graphql.schema.idl.TypeDefinitionRegistry; 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; import javax.servlet.http.HttpServlet; -import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; -import static graphql.schema.idl.TypeRuntimeWiring.newTypeWiring; - @Component( service={javax.servlet.http.HttpServlet.class,javax.servlet.Servlet.class}, -property = {"alias=/graphql", "jmx.objectname=graphql.servlet:type=graphql"} +property = {"alias=/sdlgraphql", "jmx.objectname=graphql.servlet:type=graphql"} ) public class CDPSDLServletImpl extends HttpServlet { -@Reference private BundleContext bundleContext; +@Activate +void activate(BundleContext bundleContext) { +this.bundleContext = bundleContext; +} + RuntimeWiring buildRuntimeWiring() { return RuntimeWiring.newRuntimeWiring() // .scalar(CustomScalar) @@ -96,7 +97,7 @@ public class CDPSDLServletImpl extends HttpServlet { private Reader getSchemaReader(String resourceUrl) { try { -return new InputStreamReader(bundleContext.getBundle().getResource(resourceUrl).openConnection().getInputStream()); +return new InputStreamReader(bundleContext.getBundle().getResource(resourceUrl).openConnection().getInputStream(), Charsets.UTF_8.name()); } catch (IOException e) { e.printStackTrace(); } diff --git a/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls b/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls index 22fba9a..7a924ca 100644 Binary files a/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls and b/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls differ diff --git a/graphql/karaf-feature/pom.xml b/graphql/karaf-feature/pom.xml index 0437dba..b813872 100644 --- a/graphql/karaf-feature/pom.xml +++ b/graphql/karaf-feature/pom.xml @@ -21,7 +21,7 @@ org.apache.unomi unomi-graphql -1.4.0-incubating-SNAPSHOT +1.4.0-SNAPSHOT 4.0.0 feature @@ -59,7 +59,7 @@ com.google.guava guava -20.0 +24.1.1-jre commons-fileupload @@ -82,7 +82,6 @@ 1.0.2 - + com.graphql-java graphql-java @@ -110,17 +109,15 @@ - org.apache.unomi
[unomi] 09/25: UNOMI-180 Implement CXS GraphQL API Make sure we use CXS_ prefix everywhere.
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 00cbb339884baae2f1410843605a6f803e10125d Author: Serge Huber AuthorDate: Fri Jul 27 18:08:27 2018 +0200 UNOMI-180 Implement CXS GraphQL API Make sure we use CXS_ prefix everywhere. Signed-off-by: Serge Huber --- .../apache/unomi/graphql/CXSDateFilterInput.java | 2 ++ .../java/org/apache/unomi/graphql/CXSEvent.java| 2 ++ .../apache/unomi/graphql/CXSEventConnection.java | 2 ++ .../org/apache/unomi/graphql/CXSEventEdge.java | 2 ++ .../org/apache/unomi/graphql/CXSEventFilter.java | 2 ++ .../apache/unomi/graphql/CXSEventFilterInput.java | 1 + .../org/apache/unomi/graphql/CXSEventInput.java| 2 ++ .../unomi/graphql/CXSEventOccurrenceFilter.java| 2 ++ .../graphql/CXSEventOccurrenceFilterInput.java | 2 ++ .../apache/unomi/graphql/CXSEventProperties.java | 2 ++ .../unomi/graphql/CXSEventPropertiesFilter.java| 3 +++ .../apache/unomi/graphql/CXSEventTypeInput.java| 1 + .../apache/unomi/graphql/CXSGeoDistanceInput.java | 2 ++ .../apache/unomi/graphql/CXSGeoDistanceUnit.java | 3 +++ .../java/org/apache/unomi/graphql/CXSGeoPoint.java | 2 ++ .../org/apache/unomi/graphql/CXSGeoPointInput.java | 2 ++ .../org/apache/unomi/graphql/CXSOrderByInput.java | 2 ++ .../unomi/graphql/CXSProfilePropertiesFilter.java | 1 + .../org/apache/unomi/graphql/CXSProperties.java| 28 -- .../apache/unomi/graphql/CXSPropertyTypeInput.java | 2 +- .../unomi/graphql/CXSSetPropertyTypeInput.java | 1 + .../org/apache/unomi/graphql/CXSSortOrder.java | 3 +++ .../java/org/apache/unomi/graphql/CXSView.java | 2 ++ .../unomi/graphql/builders/CXSEventBuilders.java | 22 - .../graphql/internal/CXSGraphQLProviderImpl.java | 20 +++- .../propertytypes/CXSBooleanPropertyType.java | 2 +- .../graphql/propertytypes/CXSDatePropertyType.java | 1 + .../propertytypes/CXSFloatPropertyType.java| 1 + .../propertytypes/CXSGeoPointPropertyType.java | 1 + .../propertytypes/CXSIdentifierPropertyType.java | 1 + .../graphql/propertytypes/CXSIntPropertyType.java | 1 + .../graphql/propertytypes/CXSPropertyType.java | 1 + .../graphql/propertytypes/CXSSetPropertyType.java | 1 + .../propertytypes/CXSStringPropertyType.java | 1 + 34 files changed, 71 insertions(+), 52 deletions(-) diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDateFilterInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDateFilterInput.java index f92759e..c9e1d07 100644 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDateFilterInput.java +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDateFilterInput.java @@ -17,7 +17,9 @@ package org.apache.unomi.graphql; import graphql.annotations.annotationTypes.GraphQLField; +import graphql.annotations.annotationTypes.GraphQLName; +@GraphQLName("CXS_DateFilterInput") public class CXSDateFilterInput { @GraphQLField public long after; diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEvent.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEvent.java index 123dd87..6e71c28 100644 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEvent.java +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEvent.java @@ -17,7 +17,9 @@ package org.apache.unomi.graphql; import graphql.annotations.annotationTypes.GraphQLField; +import graphql.annotations.annotationTypes.GraphQLName; +@GraphQLName("CXS_Event") public class CXSEvent { private String id; diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventConnection.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventConnection.java index 04c208c..7974543 100644 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventConnection.java +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventConnection.java @@ -17,9 +17,11 @@ package org.apache.unomi.graphql; import graphql.annotations.annotationTypes.GraphQLField; +import graphql.annotations.annotationTypes.GraphQLName; import java.util.List; +@GraphQLName("CXS_EventConnection") public class CXSEventConnection { @GraphQLField diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventEdge.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventEdge.java index e58d422..3b81f0a 100644 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventEdge.java +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventEdge.java @@ -17,7 +17,9 @@ package org.apache.unomi.graphql; import graphql.annotations.annotationTypes.GraphQLField; +import graphql.annotations.annotation
[unomi] 06/25: UNOMI-180 Implement CXS GraphQL API - Add some example operators for String filters - Add the possibility to provide a "or" operator as a default for property matching using a seperate
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 126f611c0b868f04108287c15b40ae89716927c4 Author: Serge Huber AuthorDate: Fri Jun 8 11:11:51 2018 +0200 UNOMI-180 Implement CXS GraphQL API - Add some example operators for String filters - Add the possibility to provide a "or" operator as a default for property matching using a seperate "properties_or" field Signed-off-by: Serge Huber --- .../unomi/graphql/internal/CXSGraphQLProviderImpl.java | 12 1 file changed, 12 insertions(+) diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSGraphQLProviderImpl.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSGraphQLProviderImpl.java index 2c7a0b4..a0596cc 100644 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSGraphQLProviderImpl.java +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSGraphQLProviderImpl.java @@ -189,6 +189,14 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP .name(propertyName + "_regexp") .type(GraphQLString) ); +inputTypeBuilder.field(newInputObjectField() +.name(propertyName + "_startsWith") +.type(GraphQLString) +); +inputTypeBuilder.field(newInputObjectField() +.name(propertyName + "_contains") +.type(new GraphQLList(GraphQLString)) +); } private void addBooleanFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) { @@ -275,6 +283,10 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP .type(registeredInputTypes.get("CXS_EventPropertiesFilterInput")) ) .field(newInputObjectField() +.name("properties_or") + .type(registeredInputTypes.get("CXS_EventPropertiesFilterInput")) +) +.field(newInputObjectField() .name("eventOccurrence") .type(registeredInputTypes.get(CXSEventOccurrenceFilterInput.class.getName())) );
[unomi] 05/25: UNOMI-180 Implement CXS GraphQL API - We now have basic filtering generation for event types working !
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 62aef254ca5814c02dc0272bf86c95ead9252d3a Author: Serge Huber AuthorDate: Mon May 28 15:07:00 2018 +0200 UNOMI-180 Implement CXS GraphQL API - We now have basic filtering generation for event types working ! Signed-off-by: Serge Huber --- .../apache/unomi/graphql/CXSDateFilterInput.java | 30 +++ .../graphql/CXSEventOccurrenceFilterInput.java | 33 +++ .../apache/unomi/graphql/CXSGeoDistanceInput.java | 28 ++ .../apache/unomi/graphql/CXSGeoDistanceUnit.java | 23 ++ .../org/apache/unomi/graphql/CXSGeoPointInput.java | 26 ++ .../org/apache/unomi/graphql/CXSOrderByInput.java | 28 ++ .../org/apache/unomi/graphql/CXSSortOrder.java | 23 ++ .../java/org/apache/unomi/graphql/PageInfo.java| 28 ++ .../graphql/internal/CXSGraphQLProviderImpl.java | 285 - 9 files changed, 496 insertions(+), 8 deletions(-) diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDateFilterInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDateFilterInput.java new file mode 100644 index 000..f92759e --- /dev/null +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDateFilterInput.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.unomi.graphql; + +import graphql.annotations.annotationTypes.GraphQLField; + +public class CXSDateFilterInput { +@GraphQLField +public long after; +@GraphQLField +public boolean includeAfter; +@GraphQLField +public long before; +@GraphQLField +public boolean includeBefore; +} diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventOccurrenceFilterInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventOccurrenceFilterInput.java new file mode 100644 index 000..83d23da --- /dev/null +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventOccurrenceFilterInput.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.unomi.graphql; + +import graphql.annotations.annotationTypes.GraphQLField; + +public class CXSEventOccurrenceFilterInput { + +@GraphQLField +public String eventId; +@GraphQLField +public String beforeTime; +@GraphQLField +public String afterTime; +@GraphQLField +public String betweenTime; +@GraphQLField +public int count; +} diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoDistanceInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoDistanceInput.java new file mode 100644 index 000..59d0fa9 --- /dev/null +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoDistanceInput.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ap
[unomi] 02/25: UNOMI-180 Implement CXS GraphQL API - Started implementing mutation for event type definitions, but still struggling with some limitations in the graphql-java-annotations project, notab
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 689fceeb96617364bccb0064371ff553d9f5a769 Author: Serge Huber AuthorDate: Fri May 11 14:52:56 2018 +0200 UNOMI-180 Implement CXS GraphQL API - Started implementing mutation for event type definitions, but still struggling with some limitations in the graphql-java-annotations project, notably it doesn't easily provide a way to build input types, and it seems to prefix all input types with "Input" which is not something wanted as we have already postfixed them. Postfixing seems to be more of a conventation than prefixing them in the GraphQL world. Signed-off-by: Serge Huber --- .../unomi/graphql/AbstractPropertyTypeInput.java | 40 .../unomi/graphql/CXSBooleanPropertyTypeInput.java | 28 +++ .../unomi/graphql/CXSDatePropertyTypeInput.java| 26 ++ .../apache/unomi/graphql/CXSEventTypeInput.java| 36 ++ .../unomi/graphql/CXSFloatPropertyTypeInput.java | 30 .../graphql/CXSGeoPointPropertyTypeInput.java | 25 ++ .../graphql/CXSIdentifierPropertyTypeInput.java| 28 +++ .../unomi/graphql/CXSIntPropertyTypeInput.java | 30 .../apache/unomi/graphql/CXSPropertyTypeInput.java | 56 ++ .../unomi/graphql/CXSSetPropertyTypeInput.java | 27 +++ .../unomi/graphql/CXSStringPropertyTypeInput.java | 28 +++ .../graphql/internal/CXSGraphQLProviderImpl.java | 43 - 12 files changed, 396 insertions(+), 1 deletion(-) diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/AbstractPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/AbstractPropertyTypeInput.java new file mode 100644 index 000..ad7ae5e --- /dev/null +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/AbstractPropertyTypeInput.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.unomi.graphql; + +import graphql.annotations.annotationTypes.GraphQLField; + +import java.util.List; + +public class AbstractPropertyTypeInput { + +@GraphQLField +public String id; +@GraphQLField +public String name; +@GraphQLField +public int minOccurrences; +@GraphQLField +public int maxOccurrences; +@GraphQLField +public List tags; +@GraphQLField +public List systemTags; +@GraphQLField +public boolean personalData; + +} diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSBooleanPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSBooleanPropertyTypeInput.java new file mode 100644 index 000..3843f5a --- /dev/null +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSBooleanPropertyTypeInput.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.unomi.graphql; + +import graphql.annotations.annotationTypes.GraphQLField; +import graphql.annotations.annotationTypes.GraphQLName; + +@GraphQLName("CXSBooleanPropertyTypeInput") +public class CXSBooleanPropertyTypeInput extends AbstractPropertyTypeInput { + +@GraphQLField +public boolean defaultValue; + +} diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDateProperty
[unomi] branch UNOMI-180-CXS-GRAPHQLAPI updated (0f7d203 -> ca1bbdd)
This is an automated email from the ASF dual-hosted git repository. shuber pushed a change to branch UNOMI-180-CXS-GRAPHQLAPI in repository https://gitbox.apache.org/repos/asf/unomi.git. discard 0f7d203 Add custom unomi types with custom event types. discard e420ae3 findSegments and findEvents fields now work partially, retrieving partially built results. Filters are not yet doing anything. discard 8369030 UNOMI-180 CDP Specification implementation - Add todo for configurability of CORS headers discard 1a088ca Initial work on integrating event service. discard 026cea3 UNOMI-180 CDP Specification implementation - Integrate Apollo Tracing support discard bc2ed14 UNOMI-180 CDP Specification implementation - Add CORS support to get it to work with GraphQL Playground - Managed to execute a query (but doesn't return any data as DataFetchers are not yet implemented !) discard bff5e6d UNOMI-180 CDP Specification implementation - Implement GET and POST basic support - Add support for schema retrieval - Add extended scalars (some scalars are not implemented yet such as GeoPoint) discard 0d2b509 UNOMI-180 CDP Specification implementation - Get CDP feature to install properly (but it doesn't start yet since it is missing custom scalar and event registrations) - Fixed GraphQL schema JSON encoding to UTF-8 - Removed references to incubating that are no longer needed. discard 9633289 UNOMI-180 - Start building a new servlet that loads the SDL schema and will combine it with dynamic type registration. - Deactivated old graphql-java-servlet for the moment. discard 32b2ba8 UNOMI-180 - Updated GraphQL projects to latest version - Added CDP SDL schema generated from latest CDP specification discard 1bb44a5 UNOMI-180 Implement CXS GraphQL API - Update dependency versions to make the GraphQL framework work again discard 6bd5e94 UNOMI-180 Implement CXS GraphQL API - Update version numbers discard 7720c49 UNOMI-180 Implement CXS GraphQL API - Rename CXS to CDP discard 8e45a07 UNOMI-180 Implement CXS GraphQL API - Modify the type generation to use "Input" suffix for input types instead of a prefix. discard bba63b8 UNOMI-180 Implement CXS GraphQL API - Event output field generation is working again, input will be harder because of the way the objects are prefixed with the input naming convention discard 7f57a46 UNOMI-180 Implement CXS GraphQL API Make sure we use CXS_ prefix everywhere. discard 2bd7945 UNOMI-180 Implement CXS GraphQL API Get event type creation to work (partially, the event GraphQL schema types are not yet properly modified) discard 0dacbe9 UNOMI-180 Implement CXS GraphQL API Big refactoring, will now use a mixture of annotations and manually declared fields to build dynamic fields in schema. Because of these changes all the previous functionality is a bit broken for the moment but should be restored in a future commmit. discard 01bfc89 UNOMI-180 Implement CXS GraphQL API - Add some example operators for String filters - Add the possibility to provide a "or" operator as a default for property matching using a seperate "properties_or" field discard bbfc5e6 UNOMI-180 Implement CXS GraphQL API - We now have basic filtering generation for event types working ! discard 6fc9ee9 UNOMI-180 Implement CXS GraphQL API - Event type registration and dynamic schema generation is now mostly working ! discard 7a446c9 UNOMI-180 Implement CXS GraphQL API - First implementation of registering event types. Not yet perfect but some parts are working. discard e6802b0 UNOMI-180 Implement CXS GraphQL API - Started implementing mutation for event type definitions, but still struggling with some limitations in the graphql-java-annotations project, notably it doesn't easily provide a way to build input types, and it seems to prefix all input types with "Input" which is not something wanted as we have already postfixed them. Postfixing seems to be more of a conventation than prefixing them in the GraphQL world. discard e89dddf UNOMI-180 Implement CXS GraphQL API - Initial framework for CXS GraphQL API. Lots of stuff is just testing, please don't consider it as finalized in any way. add ab608e7 - Update NOTICE files in preparation for release - Remove DISCLAIMER no longer needed now that we are out of incubation - Remove ZIP file that was removed before (how did it come back ?) - add e3a8df6 [maven-release-plugin] prepare release unomi-root-1.4.0 add e0dec39 [maven-release-plugin] prepare for next development iteration add 6c4c3f8 Revert back to 1.4.0-SNAPSHOT since building process failed. add b5e289c Change router packaging to KAR to make it consistent with all other packages. add a53cddd [maven-release-plugin] prepare release unomi-root-1.4.0 add 5a400a5 [maven-release-plugin] prepare for next development iteration add d2804d7 Switch to https urls in pom add fd4c825 Merge pull request #87 from fpapon
[unomi] 04/25: UNOMI-180 Implement CXS GraphQL API - Event type registration and dynamic schema generation is now mostly working !
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 29c2ce5ab827ed74cee4794b4fb87896e6b99365 Author: Serge Huber AuthorDate: Wed May 23 20:56:03 2018 +0200 UNOMI-180 Implement CXS GraphQL API - Event type registration and dynamic schema generation is now mostly working ! Signed-off-by: Serge Huber --- .../graphql/internal/CXSGraphQLProviderImpl.java | 133 +++-- .../graphql/internal/CXSProviderManagerImpl.java | 12 +- 2 files changed, 132 insertions(+), 13 deletions(-) diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSGraphQLProviderImpl.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSGraphQLProviderImpl.java index ea2043d..6d5a792 100644 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSGraphQLProviderImpl.java +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSGraphQLProviderImpl.java @@ -16,12 +16,8 @@ */ package org.apache.unomi.graphql.internal; -import graphql.annotations.processor.GraphQLAnnotations; -import graphql.annotations.processor.retrievers.GraphQLFieldRetriever; -import graphql.annotations.processor.retrievers.GraphQLObjectInfoRetriever; -import graphql.annotations.processor.searchAlgorithms.BreadthFirstSearch; -import graphql.annotations.processor.searchAlgorithms.ParentalSearch; -import graphql.annotations.processor.typeBuilders.InputObjectBuilder; +import graphql.annotations.processor.GraphQLAnnotationsComponent; +import graphql.annotations.processor.ProcessingElementsContainer; import graphql.schema.*; import graphql.servlet.GraphQLMutationProvider; import graphql.servlet.GraphQLQueryProvider; @@ -38,6 +34,8 @@ import java.util.*; import static graphql.Scalars.*; import static graphql.schema.GraphQLArgument.newArgument; import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition; +import static graphql.schema.GraphQLInputObjectField.newInputObjectField; +import static graphql.schema.GraphQLInputObjectType.newInputObject; import static graphql.schema.GraphQLObjectType.newObject; public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryProvider, GraphQLTypesProvider, GraphQLMutationProvider { @@ -47,30 +45,97 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP private Map registeredOutputTypes = new TreeMap<>(); private Map registeredInputTypes = new TreeMap<>(); private CXSProviderManager cxsProviderManager; +private GraphQLAnnotationsComponent annotationsComponent; +private ProcessingElementsContainer container; private Map eventTypes = new TreeMap<>(); -public CXSGraphQLProviderImpl() { +public CXSGraphQLProviderImpl(GraphQLAnnotationsComponent annotationsComponent) { +this.annotationsComponent = annotationsComponent; +container = annotationsComponent.createContainer(); updateGraphQLTypes(); } private void updateGraphQLTypes() { -registeredOutputTypes.put(CXSGeoPoint.class.getName(), GraphQLAnnotations.object(CXSGeoPoint.class)); -registeredOutputTypes.put(CXSSetPropertyType.class.getName(), GraphQLAnnotations.object(CXSSetPropertyType.class)); + +registeredOutputTypes.put(CXSGeoPoint.class.getName(), annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSGeoPoint.class, container)); + registeredOutputTypes.put(CXSSetPropertyType.class.getName(),annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSSetPropertyType.class, container)); +registeredOutputTypes.put(CXSEventType.class.getName(), annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSEventType.class, container)); + +registeredInputTypes.put(CXSEventTypeInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSEventTypeInput.class, container)); +registeredInputTypes.put("CXS_EventInput", buildCXSEventInputType()); + registeredOutputTypes.put("CXS_EventProperties", buildCXSEventPropertiesOutputType()); -registeredOutputTypes.put(CXSEventType.class.getName(), GraphQLAnnotations.object(CXSEventType.class)); +/* GraphQLObjectInfoRetriever graphQLObjectInfoRetriever = new GraphQLObjectInfoRetriever(); GraphQLInputObjectType cxsEventTypeInput = new InputObjectBuilder(graphQLObjectInfoRetriever, new ParentalSearch(graphQLObjectInfoRetriever), new BreadthFirstSearch(graphQLObjectInfoRetriever), new GraphQLFieldRetriever()). getInputObjectBuilder(CXSEventTypeInput.class, GraphQLAnnotations.getInstance().getContainer()).build(); registeredInputTypes.put(CXSEventTypeInput.class.getName(), cxsEventTypeInput); +*/ registeredOutputTypes.put("C
[unomi] 01/25: UNOMI-180 Implement CXS GraphQL API - Initial framework for CXS GraphQL API. Lots of stuff is just testing, please don't consider it as finalized in any way.
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 cca93205445d1763d38a7bd2a00245063188c208 Author: Serge Huber AuthorDate: Thu May 3 12:42:32 2018 +0200 UNOMI-180 Implement CXS GraphQL API - Initial framework for CXS GraphQL API. Lots of stuff is just testing, please don't consider it as finalized in any way. Signed-off-by: Serge Huber --- graphql/cxs-impl/pom.xml | 76 + .../java/org/apache/unomi/graphql/CXSEvent.java| 59 +++ .../org/apache/unomi/graphql/CXSEventType.java | 26 +++ .../java/org/apache/unomi/graphql/CXSGeoPoint.java | 29 .../apache/unomi/graphql/CXSGraphQLProvider.java | 21 +++ .../org/apache/unomi/graphql/CXSProperties.java| 28 +++ .../org/apache/unomi/graphql/CXSPropertyType.java | 32 .../apache/unomi/graphql/CXSProviderManager.java | 70 .../graphql/internal/CXSGraphQLProviderImpl.java | 188 + graphql/karaf-feature/pom.xml | 126 ++ graphql/pom.xml| 44 + pom.xml| 1 + 12 files changed, 700 insertions(+) diff --git a/graphql/cxs-impl/pom.xml b/graphql/cxs-impl/pom.xml new file mode 100644 index 000..ac3123d --- /dev/null +++ b/graphql/cxs-impl/pom.xml @@ -0,0 +1,76 @@ + + +http://maven.apache.org/POM/4.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> + +org.apache.unomi +unomi-graphql +1.3.0-incubating-SNAPSHOT + +4.0.0 + +cxs-graphql-api-impl +bundle + + + +com.graphql-java +graphql-java-servlet +${graphql.java.servlet.version} +provided + + +com.graphql-java +graphql-java +${graphql.java.version} +provided + + +io.github.graphql-java +graphql-java-annotations +${graphql.java.annotations.version} +provided + + +org.osgi +osgi.enterprise +6.0.0 +provided + + +org.osgi +osgi.core +6.0.0 +provided + + +org.apache.felix +org.apache.felix.scr.ds-annotations +1.2.4 +provided + + +org.slf4j +slf4j-api +1.7.21 +provided + + + + \ No newline at end of file diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEvent.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEvent.java new file mode 100644 index 000..c278678 --- /dev/null +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEvent.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.unomi.graphql; + +import java.util.LinkedHashMap; +import java.util.Map; + +public class CXSEvent { + +private String id; +private String eventType; +private long timeStamp; +private String subject; +private String object; +private Map properties = new LinkedHashMap<>(); +private CXSGeoPoint location; + +public String getId() { +return id; +} + +public String getEventType() { +return eventType; +} + +public long getTimeStamp() { +return timeStamp; +} + +public String getSubject() { +return subject; +} + +public String getObject() { +return object; +} + +public Map getProperties() { +return properties; +} + +public CXSGeoPoint getLocation() { +return location; +} +} diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventType.java new file mode 100644 index 000..43
[unomi] 03/25: UNOMI-180 Implement CXS GraphQL API - First implementation of registering event types. Not yet perfect but some parts are working.
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 df20220a8f422d470e2c17f4ebb07c6fac1d2620 Author: Serge Huber AuthorDate: Thu May 17 21:33:59 2018 +0200 UNOMI-180 Implement CXS GraphQL API - First implementation of registering event types. Not yet perfect but some parts are working. Signed-off-by: Serge Huber --- .../unomi/graphql/AbstractPropertyTypeInput.java | 40 -- ...yTypeInput.java => CXSBooleanPropertyType.java} | 4 +- ...ertyTypeInput.java => CXSDatePropertyType.java} | 2 +- .../org/apache/unomi/graphql/CXSEventType.java | 13 ++ ...rtyTypeInput.java => CXSFloatPropertyType.java} | 2 +- ...TypeInput.java => CXSGeoPointPropertyType.java} | 2 +- .../apache/unomi/graphql/CXSGraphQLProvider.java | 2 + ...peInput.java => CXSIdentifierPropertyType.java} | 2 +- ...pertyTypeInput.java => CXSIntPropertyType.java} | 2 +- .../org/apache/unomi/graphql/CXSPropertyType.java | 26 ++-- .../apache/unomi/graphql/CXSPropertyTypeInput.java | 14 +- .../apache/unomi/graphql/CXSProviderManager.java | 51 +-- ...pertyTypeInput.java => CXSSetPropertyType.java} | 4 +- .../unomi/graphql/CXSSetPropertyTypeInput.java | 3 +- ...tyTypeInput.java => CXSStringPropertyType.java} | 2 +- .../graphql/internal/CXSGraphQLProviderImpl.java | 157 ++--- .../CXSProviderManagerImpl.java} | 20 ++- 17 files changed, 209 insertions(+), 137 deletions(-) diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/AbstractPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/AbstractPropertyTypeInput.java deleted file mode 100644 index ad7ae5e..000 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/AbstractPropertyTypeInput.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.unomi.graphql; - -import graphql.annotations.annotationTypes.GraphQLField; - -import java.util.List; - -public class AbstractPropertyTypeInput { - -@GraphQLField -public String id; -@GraphQLField -public String name; -@GraphQLField -public int minOccurrences; -@GraphQLField -public int maxOccurrences; -@GraphQLField -public List tags; -@GraphQLField -public List systemTags; -@GraphQLField -public boolean personalData; - -} diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSBooleanPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSBooleanPropertyType.java similarity index 89% rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSBooleanPropertyTypeInput.java rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSBooleanPropertyType.java index 3843f5a..caea959 100644 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSBooleanPropertyTypeInput.java +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSBooleanPropertyType.java @@ -19,8 +19,8 @@ package org.apache.unomi.graphql; import graphql.annotations.annotationTypes.GraphQLField; import graphql.annotations.annotationTypes.GraphQLName; -@GraphQLName("CXSBooleanPropertyTypeInput") -public class CXSBooleanPropertyTypeInput extends AbstractPropertyTypeInput { +@GraphQLName("CXSBooleanPropertyType") +public class CXSBooleanPropertyType extends CXSPropertyType { @GraphQLField public boolean defaultValue; diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDatePropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDatePropertyType.java similarity index 92% rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDatePropertyTypeInput.java rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDatePropertyType.java index e8036aa..362d2bc 100644 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDatePropertyTypeInput.java +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDatePropertyType.java @@ -18,7 +18,7 @@ packa
[unomi] branch UNOMI-180-CXS-GRAPHQLAPI updated (8369030 -> 0f7d203)
This is an automated email from the ASF dual-hosted git repository. shuber pushed a change to branch UNOMI-180-CXS-GRAPHQLAPI in repository https://gitbox.apache.org/repos/asf/unomi.git. from 8369030 UNOMI-180 CDP Specification implementation - Add todo for configurability of CORS headers new e420ae3 findSegments and findEvents fields now work partially, retrieving partially built results. Filters are not yet doing anything. new 0f7d203 Add custom unomi types with custom event types. The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: graphql/README.md | 77 ++ .../unomi/graphql/internal/CDPSDLServletImpl.java | 170 + .../src/main/resources/cdp-schema.graphqls | 2 +- .../src/main/resources/unomi-schema.graphqls | 74 + 4 files changed, 293 insertions(+), 30 deletions(-) create mode 100644 graphql/README.md create mode 100644 graphql/cxs-impl/src/main/resources/unomi-schema.graphqls
[unomi] 02/02: Add custom unomi types with custom event types.
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 0f7d2030174fe9e49d8d211ae465e3c455beaf29 Author: Serge Huber AuthorDate: Tue May 28 17:55:54 2019 +0200 Add custom unomi types with custom event types. --- .../unomi/graphql/internal/CDPSDLServletImpl.java | 16 - .../src/main/resources/cdp-schema.graphqls | 6 -- .../src/main/resources/unomi-schema.graphqls | 74 ++ 3 files changed, 87 insertions(+), 9 deletions(-) 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 2deae05..6a0e7ff 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 @@ -148,7 +148,15 @@ public class CDPSDLServletImpl extends HttpServlet { .typeResolver(new TypeResolver() { @Override public GraphQLObjectType getType(TypeResolutionEnvironment env) { -return env.getSchema().getObjectType("CDP_ProfileUpdateEvent"); +Map object = env.getObject(); +String unomiEventType = (String) object.get("__unomiEventType"); +if ("view".equals(unomiEventType)) { +return env.getSchema().getObjectType("Unomi_PageViewEvent"); +} else if ("sessionCreated".equals(unomiEventType)) { +return env.getSchema().getObjectType("Unomi_SessionCreatedEvent"); +} else { +return env.getSchema().getObjectType("Unomi_UnknownEvent"); +} } })) .type("CDP_ProfileInterface", typeWiring -> typeWiring @@ -282,14 +290,16 @@ public class CDPSDLServletImpl extends HttpServlet { SchemaParser schemaParser = new SchemaParser(); SchemaGenerator schemaGenerator = new SchemaGenerator(); -Reader schemaReader = getSchemaReader("cdp-schema.graphqls"); +Reader cdpSchemaReader = getSchemaReader("cdp-schema.graphqls"); +Reader unomiSchemaReader = getSchemaReader("unomi-schema.graphqls"); //File schemaFile2 = loadSchema("cdp-schema.graphqls"); //File schemaFile3 = loadSchema("cdp-schema.graphqls"); TypeDefinitionRegistry typeRegistry = new TypeDefinitionRegistry(); // each registry is merged into the main registry -typeRegistry.merge(schemaParser.parse(schemaReader)); +typeRegistry.merge(schemaParser.parse(cdpSchemaReader)); +typeRegistry.merge(schemaParser.parse(unomiSchemaReader)); //typeRegistry.merge(schemaParser.parse(schemaFile2)); //typeRegistry.merge(schemaParser.parse(schemaFile3)); diff --git a/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls b/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls index 1e71cbe..bea3348 100644 --- a/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls +++ b/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls @@ -972,9 +972,3 @@ https://github.com/graphql-java/graphql-java-extended-scalars for example implementation """ scalar Time - -schema { - query : Query - mutation : Mutation - subscription : Subscription -} \ No newline at end of file diff --git a/graphql/cxs-impl/src/main/resources/unomi-schema.graphqls b/graphql/cxs-impl/src/main/resources/unomi-schema.graphqls new file mode 100644 index 000..73a87ec --- /dev/null +++ b/graphql/cxs-impl/src/main/resources/unomi-schema.graphqls @@ -0,0 +1,74 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This file contains extensions to the CDP specification that are specific to Apache Unomi + +type Unomi_PageView { +url : String +path : String +referrer : String +} + +type Unomi_PageViewEvent implements CDP_EventInterface { +id: ID! +cdp_source: CDP_Source +cdp_client: CDP_Client +cdp_profileID: CDP_ProfileID! +cdp_profile: CDP_Profile! +cdp_object: C
[unomi] 01/02: findSegments and findEvents fields now work partially, retrieving partially built results. Filters are not yet doing anything.
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 e420ae329a0d3eec511630de472667eb0bdb1788 Author: Serge Huber AuthorDate: Tue May 28 15:36:29 2019 +0200 findSegments and findEvents fields now work partially, retrieving partially built results. Filters are not yet doing anything. --- graphql/README.md | 77 ++ .../unomi/graphql/internal/CDPSDLServletImpl.java | 156 + .../src/main/resources/cdp-schema.graphqls | 8 +- 3 files changed, 213 insertions(+), 28 deletions(-) diff --git a/graphql/README.md b/graphql/README.md new file mode 100644 index 000..94e8714 --- /dev/null +++ b/graphql/README.md @@ -0,0 +1,77 @@ +Apache Unomi GraphQL API + + +Install +--- + +Installing GraphQL feature: + +feature:repo-add mvn:org.apache.unomi/cdp-graphql-feature/1.4.0-SNAPSHOT/xml/features +feature:install cdp-graphql-feature + +GraphQL Endpoint + + +You can then access the GraphQL endpoint at the following URL: + +http://localhost:8181/sdlgraphql + +Query example +- + +operation:: + +query findEvents($filter: CDP_EventFilterInput) { + cdp { +findEvents(filter: $filter) { + pageInfo { +hasNextPage +hasPreviousPage + } + edges { +cursor +node { + id + cdp_profileID { +client { + id + title +} +id +uri + } + __typename +} + } +} + } +} + +variables:: + +{ + "filter": { +"cdp_profileID_equals": "" + } +} + +Segment query operation: + +query findSegments($segmentFilter: CDP_SegmentFilterInput) { + cdp { +findSegments(filter: $segmentFilter) { + edges { +node { + id + name + view { +name + } + profiles { +profileIDs + } +} + } +} + } +} 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 68be5b9..2deae05 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,7 +32,15 @@ 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.Metadata; +import org.apache.unomi.api.PartialList; +import org.apache.unomi.api.conditions.Condition; +import org.apache.unomi.api.query.Query; +import org.apache.unomi.api.segments.Segment; +import org.apache.unomi.api.services.DefinitionsService; import org.apache.unomi.api.services.EventService; +import org.apache.unomi.api.services.SegmentService; import org.osgi.framework.BundleContext; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; @@ -45,7 +53,9 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; @Component( @@ -59,6 +69,9 @@ public class CDPSDLServletImpl extends HttpServlet { private GraphQL graphQL; private EventService eventService; +private DefinitionsService definitionsService; +private SegmentService segmentService; + @Activate void activate(BundleContext bundleContext) { @@ -70,6 +83,16 @@ public class CDPSDLServletImpl extends HttpServlet { this.eventService = eventService; } +@Reference +public void setDefinitionService(DefinitionsService definitionService) { +this.definitionsService = definitionService; +} + +@Reference +public void setSegmentService(SegmentService segmentService) { +this.segmentService = segmentService; +} + RuntimeWiring buildRuntimeWiring() { GraphQLScalarType emptyTypeWorkAroundScalarType = GraphQLScalarType.newScalar() @@ -125,7 +148,7 @@ public class CDPSDLServletImpl extends HttpServlet { .typeResolver(new TypeResolver() { @Override public GraphQLObjectType getType(TypeResolutionEnvironment env) { -return null; +