You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2020/01/28 15:10:57 UTC

[unomi] branch UNOMI-180-CXS-GRAPHQLAPI updated (1bfc166 -> 84510c8)

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 1bfc166  Remove SDL implementation since we will focus instead on GraphQL Java annotations-based implementation
 discard 93f29e2  Add manual validation of specification steps
 discard 8b12fa2  Update project version to 1.5.0
 discard 339b793  Add custom unomi types with custom event types.
 discard b3de82f  findSegments and findEvents fields now work partially, retrieving partially built results. Filters are not yet doing anything.
 discard 8c65786  UNOMI-180 CDP Specification implementation - Add todo for configurability of CORS headers
 discard 3423689  Initial work on integrating event service.
 discard 7511bf4  UNOMI-180 CDP Specification implementation - Integrate Apollo Tracing support
 discard c784914  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 434d710  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 dbdff1b  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 856b7d8  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 a474c95  UNOMI-180 - Updated GraphQL projects to latest version - Added CDP SDL schema generated from latest CDP specification
 discard 80b1657  UNOMI-180 Implement CXS GraphQL API - Update dependency versions to make the GraphQL framework work again
 discard 6b0fad6  UNOMI-180 Implement CXS GraphQL API - Update version numbers
 discard b38b851  UNOMI-180 Implement CXS GraphQL API - Rename CXS to CDP
 discard 65af202  UNOMI-180 Implement CXS GraphQL API - Modify the type generation to use "Input" suffix for input types instead of a prefix.
 discard e15d8e2  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 9f82a28  UNOMI-180 Implement CXS GraphQL API Make sure we use CXS_ prefix everywhere.
 discard 6e00421  UNOMI-180 Implement CXS GraphQL API Get event type creation to work (partially, the event GraphQL schema types are not yet properly modified)
 discard fb7c19d  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 d6a1e19  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 0af1006  UNOMI-180 Implement CXS GraphQL API - We now have basic filtering generation for event types working !
 discard 1061d2d  UNOMI-180 Implement CXS GraphQL API - Event type registration and dynamic schema generation is now mostly working !
 discard 4683cf4  UNOMI-180 Implement CXS GraphQL API - First implementation of registering event types. Not yet perfect but some parts are working.
 discard 6fe066c  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 b128823  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 6e75f85  Update dependencies for Karaf 4.2.x
     add 0126841  Fix OSGi headers in couple of bundles. Fix bin/setenv
     add f7f1b43  Downgrade to Jackson 2.9.10 (including CVE fixes) waithing XBean fix.
     add 7e077f5  Merge pull request #107 from jbonofre/KARAF42
     add c0c944c  UNOMI-225 Initial work on ElasticSearch 7 support. Includes switching to Java High Level Rest Client This is very prelimiinary work, it doesn't even compile yet.
     add 87c9223  Update gitignore
     add a605e27  WIP [UNOMI-225]
     add 838fc1c  UNOMI-225 ElasticSearch 7 support - Rewrote all the code in the persistence service - Working on getting the import package statements right, probably still some problems in them - Karaf starts but Unomi doesn't start properly yet
     add a9268fa  UNOMI-225 ElasticSearch 7 support - Connection to ElasticSearch is not starting, but still some errors
     add 1a69880  UNOMI-225 ElasticSearch 7 support - Connection to ElasticSearch is now working, still lots of things to fix, notably in mappings.
     add 39e6070  UNOMI-225 ElasticSearch 7 support Model changes: - change geonames to use context prefix (will require re-import) - added mapping types for all types - Unomi should now start, but there are still known issues (integration tests do not run, actions are not properly register on first start). - index.name was changed to index.prefix
     add 3abb04b  UNOMI-225 ElasticSearch 7 support Model changes: - bug fixes to get queries to work properly - fixed index template setup
     add aa93b2e  remove cluster health check at ES persistence service start, as it could introduce 30sec tiemout per index when cluster is not green.
     add 3f87ede  adapt PropertyConditionEvaluator.getDate to Joda ES7 parser
     add 7e5df35  fix scoring plan mapping creation
     add 0f4a133  fix aggregation cast issue ES7
     add 3a95b1a  fix aggregation cast issue ES7 (clean import)
     add 71149bc  UNOMI-225 ElasticSearch 7 support Model changes: - fix issue with full text search not working
     add f694fac  ES7 support code cleanup mostly Persistence Service Impl, removing unnecessary stuff.
     add 1c50357  Merge pull request #111 from apache/UNOMI-225-ES7
     add c06cbe0  UNOMI-254 Add Groovy scripting support for actions These changes include: - Make the ActionExecutorDispatcher pluggeable, so that it may delegate to multiple implementations - Provide an implementation for Groovy - Provide an sample bundle that uses a Groovy action
     add 50b49c0  Remove System.out.println and e.printStackTrace and replace with slf4j logs.
     add feda0ac  UNOMI-254 Groovy Actions - Moved HttpBuilder and Jsoup library to Groovy Action feature - Added example of retrieving data from event - Added DynamicImport-Package for Groovy script dependencies (is there a better way to do this ?) - Fix dynamic reloading of Groovy scripts from project source code
     add 3267173  Merge pull request #106 from apache/UNOMI-254-groovy-actions
     add 61b9958  add device brand and name to user agent detector
     add b324449  Merge pull request #109 from kressaty/feature/useragent-mobile-expansion
     add 926388b  Provide documentation for ES7 support and Data model changes
     add 696ce07  Merge pull request #113 from apache/UNOMI-225-ES7-documentation
     add 38dd795  UNOMI-225 ElasticSearch 7 support Increase timeout values in integration tests as some continuous integrations might be slow/overloaded.
     add 06b0e42  UNOMI-225 ElasticSearch 7 support Revert change committed by mistake
     add 46a2c2c  Fix typo in merge action
     add acfe957  Attempting to fix issues in integration tests.
     add e852a6d  UNOMI-257 add predefined mapping for itemType sfdcConfiguration
     add d1e260a  Merge pull request #114 from apache/UNOMI-257-mappings
     add 80a4059  Adjust all timeouts to be longer for Jenkins (that is pretty slow !) Add more log information on failures.
     add c0ed8ba  UNOMI-225 ElasticSearch 7 migration In this commit a migration implementation has been added to migrate from ElasticSearch 5 to ElasticSearch 7. Also included is the documentation (and we have moved the existing documentation to the archive) on how to use the migration
     add ebd3ca2  Merge pull request #116 from apache/UNOMI-225-es7-migration
     add 7b17bc5  Add support for basic authentication on ES7 client
     add 9d92d6a  UNOMI-225: add missing config props in custom.system.properties on ES7 authentication
     add f5c3ca9  UNOMI-225: fix bad character
     add dbdbe22  Merge pull request #117 from apache/es7-basic-authentication-support
     add d31b448  UNOMI-225: implement ssl communication support with ES7
     add d38cea1  Merge pull request #119 from apache/UNOMI-225-ssl-es7-impl
     add a068e02  UNOMI-258 Add support for identify() and track() methods in web-tracker This commits add basic support to make sure that the identify and track methods do something and send back events to Unomi. This commit does not contain any documentation but it does add an example to the web tracker example page. You can view the generated events using the event-tail and event-view commands on the server.
     add 4e5b13a  Merge pull request #115 from apache/UNOMI-258-identify-and-track-webtracker
     add b90ea67  UNOMI-225: add documentation on ES7 authentication and ssl support
     add f6e0881  Update manual/src/main/asciidoc/configuration.adoc
     add c44e8c9  Update manual/src/main/asciidoc/configuration.adoc
     add 23ae19a  Merge pull request #120 from apache/UNOMI-225-es7-auth-ssl-documentation
     add c329441  UNOMI-225 ElasticSearch 7 fix for changes in the total hits - Replaced total hits with count API requests when possible - For aggregations replaced with a manual sum of all buckets - Added in the PartialList the relation for the total hits so that users of the API can know if the total size is EQUAL or GREATER_THAN_OR_EQUAL_TO
     add f76c082  UNOMI-225 ElasticSearch 7 fix for changes in the total hits Remove commented out code
     add 29f36f8  Merge pull request #118 from apache/UNOMI-225-es7-fix-counts
     add e6c1957  UNOMI-225 Fix typo in documentation
     add f6f4711  UNOMI-225 ElasticSearch 7 Migration documentation and clarification of SOURCE and TARGET settings
     add 30093ce  UNOMI-225 ElasticSearch 7 fix issues with mappings when migrating These corrections are based on tests with real customer datasets. Basically the mappings are now first read from the old ElasticSearch 5 indices and then merged with the new mapping definitions included in Apache Unomi. The result is then used to create the indices properly. Also, the total mapping fields value is also copied from the ES 5 indices if it exists. Finally we added an important note in the doc [...]
     add e953ffe  UNOMI-225 ElasticSearch 7 fix issues with mappings when migrating Remove whitespace introduced by mistake
     add efc9af5  UNOMI-225 ElasticSearch 7 fix issues with mappings when migrating Fix issue with properties merging that was not properly replacing all the configuration for a mapping field type.
     add 325cae3  UNOMI-225: code review cosmetics changes
     add 37e2eef  Merge pull request #121 from apache/UNOMI-225-fix-migration-mappings
     add 516d24f  UNOMI-259 support jdk 11 (WIP)
     add 621861d  UNOMI-259 - Switch CXF to CXF-JaxRS in feature dependency - Upgrade FailSafe to support JDK 11 - Fix OGNL to work with JDK 11
     add a4b1108  UNOMI-259 - (Temporarily) Deactivate CXF Buss logging since it is causing problems with JDK 11 - Remove most endorsed libraries as they don't seem needed anymore - Add some libraries to the feature - Fix miredot plugin support for JDK 8 & 11 - Fix problem with JDK 8 compilation with maven-compiler-plugin
     add cb0852f  UNOMI-259 - Quick typo
     add 4f9a6dc  UNOMI-259 - Cleanup imports - Fix issues with JAXB libraries
     add 3093a2b  UNOMI-259 - Fix integration tests & performance tests that were not executing with JDK 11
     add 08e36fa  Merge pull request #122 from apache/UNOMI-259-jdk11-support
     add 647b29f  UNOMI-259 - Update documentation for JDK 11 & ElasticSearch 7
     add 23562e4  Handled Enum while merging profiles
     add 13fd3df  Merge pull request #124 from akvishnuta/feature/UNOMI_261
     add 1c44fe2  UNOMI-261 Clean up white space.
     new b288e2d  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.
     new bdf3c9a  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.
     new 82b5c13  UNOMI-180 Implement CXS GraphQL API - First implementation of registering event types. Not yet perfect but some parts are working.
     new eea2b5a  UNOMI-180 Implement CXS GraphQL API - Event type registration and dynamic schema generation is now mostly working !
     new ba2336c  UNOMI-180 Implement CXS GraphQL API - We now have basic filtering generation for event types working !
     new defce33  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
     new 616dd6b  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.
     new 8d825f9  UNOMI-180 Implement CXS GraphQL API Get event type creation to work (partially, the event GraphQL schema types are not yet properly modified)
     new 6333eb0  UNOMI-180 Implement CXS GraphQL API Make sure we use CXS_ prefix everywhere.
     new e647753  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
     new f6bc8b6  UNOMI-180 Implement CXS GraphQL API - Modify the type generation to use "Input" suffix for input types instead of a prefix.
     new bc6a887  UNOMI-180 Implement CXS GraphQL API - Rename CXS to CDP
     new 2be33e4  UNOMI-180 Implement CXS GraphQL API - Update version numbers
     new 7abbcc8  UNOMI-180 Implement CXS GraphQL API - Update dependency versions to make the GraphQL framework work again
     new 12f6acc  UNOMI-180 - Updated GraphQL projects to latest version - Added CDP SDL schema generated from latest CDP specification
     new 9302483  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.
     new cfd7a2d  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.
     new dd61925  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)
     new aaafe3f  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 !)
     new cdc4906  UNOMI-180 CDP Specification implementation - Integrate Apollo Tracing support
     new b4f89b3  Initial work on integrating event service.
     new c1ea476  UNOMI-180 CDP Specification implementation - Add todo for configurability of CORS headers
     new c416416  findSegments and findEvents fields now work partially, retrieving partially built results. Filters are not yet doing anything.
     new 055cdd8  Add custom unomi types with custom event types.
     new f0a792a  Update project version to 1.5.0
     new 7f50cd3  Add manual validation of specification steps
     new 84510c8  Remove SDL implementation since we will focus instead on GraphQL Java annotations-based implementation

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (1bfc166)
            \
             N -- N -- N   refs/heads/UNOMI-180-CXS-GRAPHQLAPI (84510c8)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 27 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:
 .gitignore                                         |   2 +-
 api/pom.xml                                        |  33 +
 .../java/org/apache/unomi/api/PartialList.java     |  28 +-
 .../apache/unomi/api/actions/ActionDispatcher.java |  50 ++
 .../org/apache/unomi/api/actions/ActionType.java   |  10 +-
 .../unomi/api/services/DefinitionsService.java     |   6 +
 .../apache/unomi/api/services/ProfileService.java  |   7 +-
 docker/docker-compose.yml                          |   1 -
 .../unomi/geonames/services/GeonameEntry.java      |   1 -
 .../geonames/services/GeonamesServiceImpl.java     |   6 +-
 .../META-INF/cxs/mappings/geonameEntry.json        |  47 +-
 .../karaf-kar/pom.xml                              |  33 +-
 .../{unomi-mailchimp => groovy-actions}/pom.xml    |   9 +-
 .../services/pom.xml                               |  35 +-
 .../services/actions/groovy/GroovyAction.java      |  59 ++
 .../actions/groovy/GroovyActionDispatcher.java     | 179 ++++
 .../groovy/GroovyBundleResourceConnector.java      |  81 ++
 .../resources/OSGI-INF/blueprint/blueprint.xml     |  20 +-
 .../apache/unomi/services/UserListServiceImpl.java |   4 +-
 .../resources/META-INF/cxs/mappings/userList.json  |  46 +-
 extensions/pom.xml                                 |   1 +
 .../META-INF/cxs/mappings/sfdcConfiguration.json   |  20 +
 .../web-tracker/javascript/dist/unomi-tracker.js   |  18 +-
 .../javascript/dist/unomi-tracker.min.js           |   2 +-
 .../src/analytics.js-integration-apache-unomi.js   |  19 +-
 .../web-tracker/wab/src/main/webapp/index.html     |  14 +-
 itests/pom.xml                                     |   2 +-
 .../test/java/org/apache/unomi/itests/BaseIT.java  |  51 +-
 .../test/java/org/apache/unomi/itests/BasicIT.java |   9 +-
 .../apache/unomi/itests/ConditionEvaluatorIT.java  |   4 +-
 .../org/apache/unomi/itests/ModifyConsentIT.java   |   4 +-
 .../test/java/org/apache/unomi/itests/PatchIT.java |  22 +-
 .../org/apache/unomi/itests/ProfileExportIT.java   |   9 +-
 .../apache/unomi/itests/ProfileImportActorsIT.java |   6 +-
 .../apache/unomi/itests/ProfileImportBasicIT.java  |   6 +-
 .../unomi/itests/ProfileImportRankingIT.java       |   6 +-
 .../unomi/itests/ProfileImportSurfersIT.java       |  10 +-
 .../org/apache/unomi/itests/ProfileServiceIT.java  |   2 +-
 .../unomi/itests/PropertiesUpdateActionIT.java     |   4 +-
 .../java/org/apache/unomi/itests/SegmentIT.java    |   2 +-
 kar/src/main/feature/feature.xml                   |   5 +-
 manual/pom.xml                                     |   6 +-
 .../1.4}/asciidoc/5-min-quickstart.adoc            |   0
 .../{main => archives/1.4}/asciidoc/actions.adoc   |   0
 .../src/{main => archives/1.4}/asciidoc/apache.css |   0
 .../1.4}/asciidoc/building-and-deploying.adoc      |   0
 .../1.4}/asciidoc/clustering.adoc                  |   0
 .../{main => archives/1.4}/asciidoc/concepts.adoc  |   0
 .../1.4}/asciidoc/conditions.adoc                  |   0
 .../1.4}/asciidoc/configuration.adoc               |   4 +-
 .../1.4}/asciidoc/connectors/connectors.adoc       |   0
 .../asciidoc/connectors/mailchimp-connector.adoc   |   0
 .../asciidoc/connectors/salesforce-connector.adoc  |   0
 .../1.4}/asciidoc/consent-api.adoc                 |   0
 .../1.4}/asciidoc/custom-extensions.adoc           |   0
 .../1.4}/asciidoc/extending-plugins.adoc           |   0
 .../1.4}/asciidoc/getting-started.adoc             |   0
 .../1.4}/asciidoc/how-profile-tracking-works.adoc  |   0
 .../1.4/asciidoc}/images/asf_logo_url.png          | Bin
 .../1.4}/asciidoc/images/incubator-logo.png        | Bin
 .../1.4}/asciidoc/images/unomi-request.png         | Bin
 .../1.4}/asciidoc/images/unomi-rule-engine.png     | Bin
 .../src/{main => archives/1.4}/asciidoc/index.adoc |   2 +-
 .../{main => archives/1.4}/asciidoc/patches.adoc   |   0
 .../{main => archives/1.4}/asciidoc/privacy.adoc   |   0
 .../1.4}/asciidoc/profile-import-export.adoc       |   0
 .../1.4}/asciidoc/queries-and-aggregations.adoc    |   0
 .../{main => archives/1.4}/asciidoc/recipes.adoc   |   0
 .../1.4}/asciidoc/request-examples.adoc            |   0
 .../1.4}/asciidoc/samples/login-sample.adoc        |   0
 .../1.4}/asciidoc/samples/samples.adoc             |   0
 .../1.4}/asciidoc/samples/twitter-sample.adoc      |   0
 .../asciidoc/samples/weather-update-sample.adoc    |   0
 .../1.4}/asciidoc/shell-commands.adoc              |   0
 .../1.4}/asciidoc/useful-unomi-urls.adoc           |   0
 .../1.4}/asciidoc/web-tracker.adoc                 |   0
 manual/src/main/asciidoc/5-min-quickstart.adoc     |  12 +-
 .../src/main/asciidoc/building-and-deploying.adoc  |  31 +-
 manual/src/main/asciidoc/configuration.adoc        |  68 +-
 manual/src/main/asciidoc/getting-started.adoc      |  28 +-
 manual/src/main/asciidoc/index.adoc                |   2 +
 manual/src/main/asciidoc/new-data-model.adoc       | 104 +++
 manual/src/main/asciidoc/privacy.adoc              |  10 +-
 .../src/main/asciidoc/samples/twitter-sample.adoc  |   2 +-
 package/pom.xml                                    |   4 +-
 package/src/main/resources/bin/setenv              |   1 -
 .../main/resources/etc/custom.system.properties    |  13 +-
 .../apache/unomi/performancetests/BasicTest.java   |  40 +-
 persistence-elasticsearch/core/pom.xml             | 189 +++--
 .../ElasticSearchPersistenceServiceImpl.java       | 928 ++++++++++-----------
 .../resources/META-INF/cxs/mappings/_default_.json |  22 -
 .../META-INF/cxs/mappings/actiontype.json          |  20 +
 .../resources/META-INF/cxs/mappings/campaign.json  |  64 +-
 .../META-INF/cxs/mappings/campaignevent.json       |  58 +-
 .../META-INF/cxs/mappings/conditiontype.json       |  20 +
 .../resources/META-INF/cxs/mappings/event.json     |  59 +-
 .../META-INF/cxs/mappings/exportconfig.json        |  20 +
 .../main/resources/META-INF/cxs/mappings/goal.json |  47 +-
 .../META-INF/cxs/mappings/importconfig.json        |  20 +
 .../resources/META-INF/cxs/mappings/persona.json   |  38 +
 .../META-INF/cxs/mappings/personaSession.json      |  53 +-
 .../resources/META-INF/cxs/mappings/profile.json   |  48 +-
 .../META-INF/cxs/mappings/propertyType.json        |  90 +-
 .../main/resources/META-INF/cxs/mappings/rule.json |  64 +-
 .../resources/META-INF/cxs/mappings/rulestats.json |  20 +
 .../resources/META-INF/cxs/mappings/scoring.json   |  47 +-
 .../resources/META-INF/cxs/mappings/segment.json   |  48 +-
 .../resources/META-INF/cxs/mappings/session.json   |  85 +-
 .../resources/OSGI-INF/blueprint/blueprint.xml     |  31 +-
 .../org.apache.unomi.persistence.elasticsearch.cfg |  18 +-
 .../ElasticsearchPersistenceTest.java              | 173 ++++
 persistence-elasticsearch/pom.xml                  |  22 +-
 .../unomi/persistence/spi/PersistenceService.java  |  12 +-
 plugins/baseplugin/pom.xml                         |   4 +-
 .../actions/MergeProfilesOnPropertyAction.java     |   4 +-
 .../conditions/PropertyConditionEvaluator.java     |  45 +-
 plugins/mail/pom.xml                               |  14 +
 plugins/request/pom.xml                            |   9 +
 .../request/actions/SetRemoteHostInfoAction.java   |  31 +-
 .../unomi/plugins/request/useragent/UserAgent.java |  20 +
 .../useragent/UserAgentDetectorServiceImpl.java    |   4 +
 pom.xml                                            |  41 +-
 rest/pom.xml                                       | 161 +++-
 .../resources/OSGI-INF/blueprint/blueprint.xml     |   6 +-
 .../services => samples/groovy-actions}/pom.xml    |  34 +-
 .../META-INF/cxs/actions/testGroovyAction.groovy   |  34 +-
 .../META-INF/cxs/actions/testGroovyAction.json     |  15 +
 .../META-INF/cxs/rules/testGroovyActionRule.json   |  22 +
 samples/pom.xml                                    |   1 +
 .../services/actions/ActionExecutorDispatcher.java |  55 +-
 .../unomi/services/impl/AbstractServiceImpl.java   |   4 +-
 .../impl/definitions/DefinitionsServiceImpl.java   |  30 +-
 .../services/impl/goals/GoalsServiceImpl.java      |   2 +-
 .../services/impl/profiles/ProfileServiceImpl.java |  24 +-
 .../services/impl/rules/RulesServiceImpl.java      |  17 +-
 .../services/impl/segments/SegmentServiceImpl.java |  26 +-
 .../resources/OSGI-INF/blueprint/blueprint.xml     |  10 +-
 .../apache/unomi/shell/migration/Migration.java    |   3 +-
 .../unomi/shell/migration/actions/Migrate.java     |   4 +-
 .../unomi/shell/migration/impl/MigrationTo121.java |   3 +-
 .../unomi/shell/migration/impl/MigrationTo122.java |   3 +-
 .../unomi/shell/migration/impl/MigrationTo150.java | 293 +++++++
 .../unomi/shell/migration/utils/ConsoleUtils.java  |  12 +
 .../unomi/shell/migration/utils/HttpUtils.java     |  30 +-
 .../resources/OSGI-INF/blueprint/blueprint.xml     |   2 +
 145 files changed, 3123 insertions(+), 1236 deletions(-)
 create mode 100644 api/src/main/java/org/apache/unomi/api/actions/ActionDispatcher.java
 copy extensions/{salesforce-connector => groovy-actions}/karaf-kar/pom.xml (74%)
 copy extensions/{unomi-mailchimp => groovy-actions}/pom.xml (84%)
 copy extensions/{privacy-extension => groovy-actions}/services/pom.xml (77%)
 create mode 100644 extensions/groovy-actions/services/src/main/java/org/apache/unomi/services/actions/groovy/GroovyAction.java
 create mode 100644 extensions/groovy-actions/services/src/main/java/org/apache/unomi/services/actions/groovy/GroovyActionDispatcher.java
 create mode 100644 extensions/groovy-actions/services/src/main/java/org/apache/unomi/services/actions/groovy/GroovyBundleResourceConnector.java
 copy {samples/tweet-button-plugin => extensions/groovy-actions/services}/src/main/resources/OSGI-INF/blueprint/blueprint.xml (62%)
 create mode 100644 extensions/salesforce-connector/services/src/main/resources/META-INF/cxs/mappings/sfdcConfiguration.json
 copy manual/src/{main => archives/1.4}/asciidoc/5-min-quickstart.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/actions.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/apache.css (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/building-and-deploying.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/clustering.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/concepts.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/conditions.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/configuration.adoc (99%)
 copy manual/src/{main => archives/1.4}/asciidoc/connectors/connectors.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/connectors/mailchimp-connector.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/connectors/salesforce-connector.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/consent-api.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/custom-extensions.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/extending-plugins.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/getting-started.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/how-profile-tracking-works.adoc (100%)
 copy manual/src/{theme => archives/1.4/asciidoc}/images/asf_logo_url.png (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/images/incubator-logo.png (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/images/unomi-request.png (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/images/unomi-rule-engine.png (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/index.adoc (98%)
 copy manual/src/{main => archives/1.4}/asciidoc/patches.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/privacy.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/profile-import-export.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/queries-and-aggregations.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/recipes.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/request-examples.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/samples/login-sample.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/samples/samples.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/samples/twitter-sample.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/samples/weather-update-sample.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/shell-commands.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/useful-unomi-urls.adoc (100%)
 copy manual/src/{main => archives/1.4}/asciidoc/web-tracker.adoc (100%)
 create mode 100644 manual/src/main/asciidoc/new-data-model.adoc
 delete mode 100644 persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/_default_.json
 create mode 100644 persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/actiontype.json
 create mode 100644 persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/conditiontype.json
 create mode 100644 persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/exportconfig.json
 create mode 100644 persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/importconfig.json
 create mode 100644 persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/persona.json
 create mode 100644 persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/rulestats.json
 create mode 100644 persistence-elasticsearch/core/src/test/java/org/apache/unomi/persistence/elasticsearch/ElasticsearchPersistenceTest.java
 copy {extensions/privacy-extension/services => samples/groovy-actions}/pom.xml (71%)
 copy extensions/web-tracker/javascript/src/index.js => samples/groovy-actions/src/main/resources/META-INF/cxs/actions/testGroovyAction.groovy (56%)
 create mode 100644 samples/groovy-actions/src/main/resources/META-INF/cxs/actions/testGroovyAction.json
 create mode 100644 samples/groovy-actions/src/main/resources/META-INF/cxs/rules/testGroovyActionRule.json
 create mode 100644 tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/impl/MigrationTo150.java


[unomi] 19/27: 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 !)

Posted by sh...@apache.org.
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 aaafe3f011cea14688b78d8c735f98b1212e60c9
Author: sergehuber <sh...@jahia.com>
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<String, Object> variables) throws IOException {
-        ExecutionInput executionInput = ExecutionInput.newExecutionInput()
-                .query(query)
-                .variables(variables)
-                .operationName(operationName)
-                .build();
-
-        ExecutionResult executionResult = graphQL.execute(executionInput);
-
-        Map<String, Object> 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<String, Object> 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<String, Object> 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, Content-Type, Accept, X-Apollo-Tracing, test");
+            httpServletResponse.setHeader("Access-Control-Allow-Credentials", "true");
+            httpServletResponse.setHeader("Access-Control-Allow-Methods", "OPTIONS, POST, GET");
+            // httpServletResponse.setHeader("Access-Control-Max-Age", "600");
+            // httpServletResponse.setHeader("Access-Control-Expose-Headers","Access-Control-Allow-Origin");
+            // httpServletResponse.flushBuffer();
+        }
+    }
+
 }


[unomi] 09/27: UNOMI-180 Implement CXS GraphQL API Make sure we use CXS_ prefix everywhere.

Posted by sh...@apache.org.
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 6333eb0fffac854c83a00cc89fa41a3846a388d6
Author: Serge Huber <sh...@apache.org>
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 <sh...@apache.org>
---
 .../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.annotationTypes.GraphQLName;
 
+@GraphQLName("CXS_EventEdge")
 public class CXSEventEdge {
 
     @GraphQLField
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventFilter.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventFilter.java
index 9e4ebe8..82a3ebd 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventFilter.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventFilter.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_EventFilter")
 public class CXSEventFilter {
 
     @GraphQLField
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventFilterInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventFilterInput.java
index 1e46e60..855a6ab 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventFilterInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventFilterInput.java
@@ -21,6 +21,7 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
+@GraphQLName("CXS_EventFilterInput")
 public class CXSEventFilterInput {
 
     @GraphQLField
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventInput.java
index 9b7b752..473953b 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventInput.java
@@ -17,10 +17,12 @@
 package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.LinkedHashMap;
 import java.util.Map;
 
+@GraphQLName("CXS_EventInput")
 public class CXSEventInput {
     private String id;
     private String eventType;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventOccurrenceFilter.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventOccurrenceFilter.java
index a80fb0f..7abd342 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventOccurrenceFilter.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventOccurrenceFilter.java
@@ -17,7 +17,9 @@
 package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
 
+@GraphQLName("CXS_EventOccurrenceFilter")
 public class CXSEventOccurrenceFilter {
     @GraphQLField
     public String eventType;
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
index 83d23da..1ffaa19 100644
--- 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
@@ -17,7 +17,9 @@
 package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
 
+@GraphQLName("CXS_EventOccurrenceFilterInput")
 public class CXSEventOccurrenceFilterInput {
 
     @GraphQLField
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventProperties.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventProperties.java
index 7b072b9..95c0b1b 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventProperties.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventProperties.java
@@ -17,10 +17,12 @@
 package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.LinkedHashMap;
 import java.util.Map;
 
+@GraphQLName("CXS_EventProperties")
 public class CXSEventProperties {
     @GraphQLField
     public int nbProperties;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventPropertiesFilter.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventPropertiesFilter.java
index c24664f..45f9101 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventPropertiesFilter.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventPropertiesFilter.java
@@ -16,5 +16,8 @@
  */
 package org.apache.unomi.graphql;
 
+import graphql.annotations.annotationTypes.GraphQLName;
+
+@GraphQLName("CXS_EventPropertiesFilter")
 public class CXSEventPropertiesFilter {
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventTypeInput.java
index a6f8200..06e78f5 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventTypeInput.java
@@ -22,6 +22,7 @@ import graphql.annotations.annotationTypes.GraphQLName;
 import java.util.ArrayList;
 import java.util.List;
 
+@GraphQLName("CXS_EventTypeInput")
 public class CXSEventTypeInput {
 
     private String id;
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
index 59d0fa9..bd95070 100644
--- 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
@@ -17,7 +17,9 @@
 package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
 
+@GraphQLName("CXS_GeoDistanceInput")
 public class CXSGeoDistanceInput {
     @GraphQLField
     public CXSGeoPoint center;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoDistanceUnit.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoDistanceUnit.java
index 5db4d3e..ad3f08a 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoDistanceUnit.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoDistanceUnit.java
@@ -16,6 +16,9 @@
  */
 package org.apache.unomi.graphql;
 
+import graphql.annotations.annotationTypes.GraphQLName;
+
+@GraphQLName("CXS_GeoDistanceUnit")
 public enum CXSGeoDistanceUnit {
     METERS,
     KILOMETERS,
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPoint.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPoint.java
index bfa7c24..703a541 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPoint.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPoint.java
@@ -17,7 +17,9 @@
 package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
 
+@GraphQLName("CXS_GeoPoint")
 public class CXSGeoPoint {
 
     @GraphQLField
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointInput.java
index 19b0297..bd402c0 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointInput.java
@@ -17,7 +17,9 @@
 package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
 
+@GraphQLName("CXS_GeoPointInput")
 public class CXSGeoPointInput {
     @GraphQLField
     public float longitude;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSOrderByInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSOrderByInput.java
index a0221d2..dbe63c0 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSOrderByInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSOrderByInput.java
@@ -17,7 +17,9 @@
 package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
 
+@GraphQLName("CXS_OrderByInput")
 public class CXSOrderByInput {
 
     @GraphQLField
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProfilePropertiesFilter.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProfilePropertiesFilter.java
index c1eae63..ff005af 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProfilePropertiesFilter.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProfilePropertiesFilter.java
@@ -21,6 +21,7 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
+@GraphQLName("CXS_ProfilePropertiesFilter")
 public class CXSProfilePropertiesFilter {
 
     @GraphQLField
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProperties.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProperties.java
deleted file mode 100644
index 55a1b3e..0000000
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProperties.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;
-
-public class CXSProperties {
-
-    @GraphQLField
-    public String key;
-
-    @GraphQLField
-    public String value;
-}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java
index dda0ea4..5662123 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java
@@ -20,7 +20,7 @@ import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 import org.apache.unomi.graphql.propertytypes.*;
 
-@GraphQLName("CXSPropertyTypeInput")
+@GraphQLName("CXS_PropertyTypeInput")
 public class CXSPropertyTypeInput {
 
     public CXSPropertyTypeInput(
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java
index 8f32019..52d1101 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java
@@ -22,6 +22,7 @@ import org.apache.unomi.graphql.propertytypes.CXSPropertyType;
 
 import java.util.List;
 
+@GraphQLName("CXS_SetPropertyTypeInput")
 public class CXSSetPropertyTypeInput extends CXSPropertyType {
 
     private List<CXSPropertyTypeInput> properties;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSortOrder.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSortOrder.java
index ca0f3bd..0fbad2c 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSortOrder.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSortOrder.java
@@ -16,6 +16,9 @@
  */
 package org.apache.unomi.graphql;
 
+import graphql.annotations.annotationTypes.GraphQLName;
+
+@GraphQLName("CXS_SortOrder")
 public enum CXSSortOrder {
     ASC,
     DESC,
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSView.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSView.java
index ddc74b6..5ee0066 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSView.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSView.java
@@ -17,7 +17,9 @@
 package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
 
+@GraphQLName("CXS_view")
 public class CXSView {
     @GraphQLField
     public String name;
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 da5546a..f5e5777 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,7 +19,10 @@ package org.apache.unomi.graphql.builders;
 import graphql.annotations.processor.GraphQLAnnotationsComponent;
 import graphql.annotations.processor.ProcessingElementsContainer;
 import graphql.schema.*;
-import org.apache.unomi.graphql.*;
+import org.apache.unomi.graphql.CXSEvent;
+import org.apache.unomi.graphql.CXSEventOccurrenceFilterInput;
+import org.apache.unomi.graphql.CXSEventType;
+import org.apache.unomi.graphql.PageInfo;
 import org.apache.unomi.graphql.propertytypes.*;
 
 import java.util.ArrayList;
@@ -52,16 +55,13 @@ public class CXSEventBuilders implements CXSBuilder {
     public void updateTypes() {
         Map<String,GraphQLType> typeRegistry = container.getTypeRegistry();
         typeRegistry.put("CXS_EventInput", buildCXSEventInputType());
-        typeRegistry.put(CXSEventOccurrenceFilterInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSEventOccurrenceFilterInput.class, container));
+        typeRegistry.put("CXS_EventOccurrenceFilterInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSEventOccurrenceFilterInput.class, container));
         typeRegistry.put("CXS_EventPropertiesFilterInput", buildCXSEventPropertiesFilterInput());
         typeRegistry.put("CXS_EventFilterInput", buildCXSEventFilterInputType());
-
         typeRegistry.put("CXS_EventProperties", buildCXSEventPropertiesOutputType());
-
         typeRegistry.put("CXS_Event", buildCXSEventOutputType());
         typeRegistry.put("CXS_EventEdge", buildCXSEventEdgeOutputType());
         typeRegistry.put("CXS_EventConnection", buildCXSEventConnectionOutputType());
-
     }
 
     private GraphQLOutputType buildCXSEventEdgeOutputType() {
@@ -237,14 +237,14 @@ public class CXSEventBuilders implements CXSBuilder {
     private void addDistanceFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
         inputTypeBuilder.field(newInputObjectField()
                 .name(propertyName + "_distance")
-                .type((GraphQLInputType) typeRegistry.get(CXSGeoDistanceInput.class.getName()))
+                .type((GraphQLInputType) typeRegistry.get("CXS_GeoDistanceInput"))
         );
     }
 
     private void addDateFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
         inputTypeBuilder.field(newInputObjectField()
                 .name(propertyName + "_between")
-                .type((GraphQLInputType) typeRegistry.get(CXSDateFilterInput.class.getName()))
+                .type((GraphQLInputType) typeRegistry.get("CXS_DateFilterInput"))
         );
     }
 
@@ -270,7 +270,7 @@ public class CXSEventBuilders implements CXSBuilder {
                 )
                 .field(newInputObjectField()
                         .name("eventOccurrence")
-                        .type((GraphQLInputType) typeRegistry.get(CXSEventOccurrenceFilterInput.class.getName()))
+                        .type((GraphQLInputType) typeRegistry.get("CXS_EventOccurrenceFilterInput"))
                 );
         return cxsEventFilterInputType.build();
     }
@@ -317,7 +317,7 @@ public class CXSEventBuilders implements CXSBuilder {
             } else if (cxsEventPropertyType instanceof CXSDatePropertyType) {
                 eventPropertyInputType = GraphQLString;
             } else if (cxsEventPropertyType instanceof CXSGeoPointPropertyType) {
-                eventPropertyInputType = (GraphQLInputType) typeRegistry.get(CXSGeoPoint.class.getName());
+                eventPropertyInputType = (GraphQLInputType) typeRegistry.get("CXS_GeoPoint");
             } else if (cxsEventPropertyType instanceof CXSSetPropertyType) {
                 eventPropertyInputType = buildCXSEventTypeInputProperty(cxsEventPropertyType.getName(), ((CXSSetPropertyType)cxsEventPropertyType).getProperties());
             }
@@ -389,7 +389,7 @@ public class CXSEventBuilders implements CXSBuilder {
                         })
                 )
                 .field(newFieldDefinition()
-                        .type((GraphQLOutputType) typeRegistry.get(CXSGeoPoint.class.getName()))
+                        .type((GraphQLOutputType) typeRegistry.get("CXS_GeoPoint"))
                         .name("location")
                         .description("The geo-point location where the event was fired.")
                         .dataFetcher(new DataFetcher() {
@@ -458,7 +458,7 @@ public class CXSEventBuilders implements CXSBuilder {
             } else if (cxsEventPropertyType instanceof CXSDatePropertyType) {
                 eventPropertyOutputType = GraphQLString;
             } else if (cxsEventPropertyType instanceof CXSGeoPointPropertyType) {
-                eventPropertyOutputType = (GraphQLOutputType) typeRegistry.get(CXSGeoPoint.class.getName());
+                eventPropertyOutputType = (GraphQLOutputType) typeRegistry.get("CXS_GeoPoint");
             } else if (cxsEventPropertyType instanceof CXSSetPropertyType) {
                 eventPropertyOutputType = buildEventOutputType(cxsEventPropertyType.getName(), ((CXSSetPropertyType)cxsEventPropertyType).getProperties());
             }
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 949f51e..a67cace 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
@@ -71,19 +71,17 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
 
         typeRegistry.put(PageInfo.class.getName(), annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(PageInfo.class, container));
 
-        typeRegistry.put(CXSGeoPoint.class.getName(), annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSGeoPoint.class, container));
-        typeRegistry.put(CXSSetPropertyType.class.getName(),annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSSetPropertyType.class, container));
-        typeRegistry.put(CXSEventType.class.getName(), annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSEventType.class, container));
+        typeRegistry.put("CXS_GeoPoint", annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSGeoPoint.class, container));
+        typeRegistry.put("CXS_SetPropertyType",annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSSetPropertyType.class, container));
+        typeRegistry.put("CXS_EventType", annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSEventType.class, container));
 
-        typeRegistry.put(CXSGeoDistanceInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSGeoDistanceInput.class, container));
-        typeRegistry.put(CXSDateFilterInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSDateFilterInput.class, container));
-        typeRegistry.put(CXSEventTypeInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSEventTypeInput.class, container));
-        typeRegistry.put(CXSOrderByInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSOrderByInput.class, container));
+        typeRegistry.put("CXS_GeoDistanceInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSGeoDistanceInput.class, container));
+        typeRegistry.put("CXS_DateFilterInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSDateFilterInput.class, container));
+        typeRegistry.put("CXS_EventTypeInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSEventTypeInput.class, container));
+        typeRegistry.put("CXS_OrderByInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSOrderByInput.class, container));
 
         typeRegistry.put("CXS_Query", annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSQuery.class, container));
         typeRegistry.put("CXS_Mutation", annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSMutation.class, container));
-        // typeRegistry.put("CXS_Query", buildCXSQueryOutputType());
-        // typeRegistry.put("CXS_Mutation", buildCXSMutationOutputType());
 
         cxsEventBuilders.updateTypes();
 
@@ -151,7 +149,7 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                 .name("CXS_Query")
                 .description("Root CXS query type")
                 .field(newFieldDefinition()
-                        .type(new GraphQLList(getOutputTypeFromRegistry(CXSEventType.class.getName())))
+                        .type(new GraphQLList(getOutputTypeFromRegistry("CXS_EventType")))
                         .name("getEventTypes")
                         .description("Retrieves the list of all the declared CXS event types in the Apache Unomi server")
                 )
@@ -169,7 +167,7 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                         )
                         .argument(newArgument()
                                 .name("orderBy")
-                                .type(getInputTypeFromRegistry(CXSOrderByInput.class.getName()))
+                                .type(getInputTypeFromRegistry("CXS_OrderByInput"))
                         )
                         .argument(newArgument()
                                 .name("first")
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSBooleanPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSBooleanPropertyType.java
index 75bc309..c50dd3b 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSBooleanPropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSBooleanPropertyType.java
@@ -21,7 +21,7 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXSBooleanPropertyType")
+@GraphQLName("CXS_BooleanPropertyType")
 public class CXSBooleanPropertyType extends CXSPropertyType {
 
     private Boolean defaultValue;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSDatePropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSDatePropertyType.java
index 4b4b403..bd5d0a1 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSDatePropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSDatePropertyType.java
@@ -21,6 +21,7 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
+@GraphQLName("CXS_DatePropertyType")
 public class CXSDatePropertyType extends CXSPropertyType {
 
     private String defaultValue;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSFloatPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSFloatPropertyType.java
index 6a37058..abd46b4 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSFloatPropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSFloatPropertyType.java
@@ -21,6 +21,7 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
+@GraphQLName("CXS_FloatPropertyType")
 public class CXSFloatPropertyType extends CXSPropertyType {
 
     private Float minValue;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSGeoPointPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSGeoPointPropertyType.java
index 94f2d97..a3935b4 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSGeoPointPropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSGeoPointPropertyType.java
@@ -21,6 +21,7 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
+@GraphQLName("CXS_GeoPointPropertyType")
 public class CXSGeoPointPropertyType extends CXSPropertyType {
 
     private String defaultValue;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIdentifierPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIdentifierPropertyType.java
index 7207740..01435cb 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIdentifierPropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIdentifierPropertyType.java
@@ -21,6 +21,7 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
+@GraphQLName("CXS_IdentifierPropertyType")
 public class CXSIdentifierPropertyType extends CXSPropertyType {
 
     private String regexp;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIntPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIntPropertyType.java
index 96c3322..99239ee 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIntPropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIntPropertyType.java
@@ -21,6 +21,7 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
+@GraphQLName("CXS_IntPropertyType")
 public class CXSIntPropertyType extends CXSPropertyType {
 
     private Integer minValue;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSPropertyType.java
index 28aaf7e..ab2f9e4 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSPropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSPropertyType.java
@@ -21,6 +21,7 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
+@GraphQLName("CXS_PropertyType")
 public class CXSPropertyType {
 
     private String id;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSSetPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSSetPropertyType.java
index 25e796c..befb5bd 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSSetPropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSSetPropertyType.java
@@ -21,6 +21,7 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
+@GraphQLName("CXS_SetPropertyType")
 public class CXSSetPropertyType extends CXSPropertyType {
 
     private List<CXSPropertyType> properties;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSStringPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSStringPropertyType.java
index 7736d09..8604436 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSStringPropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSStringPropertyType.java
@@ -21,6 +21,7 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
+@GraphQLName("CXS_StringPropertyType")
 public class CXSStringPropertyType extends CXSPropertyType {
 
     private String regexp;


[unomi] 20/27: UNOMI-180 CDP Specification implementation - Integrate Apollo Tracing support

Posted by sh...@apache.org.
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 cdc490665ca750a7caa56147e9990f67434320d0
Author: sergehuber <sh...@jahia.com>
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] 24/27: Add custom unomi types with custom event types.

Posted by sh...@apache.org.
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 055cdd8d6dc3478e036c0ff71a7abf14e22953d3
Author: Serge Huber <sh...@jahia.com>
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<String,Object> 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 0000000..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: CDP_Object!
+    cdp_location: GeoPoint
+    cdp_timestamp: DateTime
+    cdp_topics: [CDP_Topic]
+
+    pageView : Unomi_PageView
+}
+
+type Unomi_SessionCreated {
+    creationTime : DateTime
+    duration : Int
+}
+
+type Unomi_SessionCreatedEvent implements CDP_EventInterface {
+    id: ID!
+    cdp_source: CDP_Source
+    cdp_client: CDP_Client
+    cdp_profileID: CDP_ProfileID!
+    cdp_profile: CDP_Profile!
+    cdp_object: CDP_Object!
+    cdp_location: GeoPoint
+    cdp_timestamp: DateTime
+    cdp_topics: [CDP_Topic]
+
+    sessionCreated : Unomi_SessionCreated
+}
+
+type Unomi_PropertyPair {
+    name : String
+    value : JSON
+}
+
+type Unomi_UnknownEvent implements CDP_EventInterface {
+
+    id: ID!
+    cdp_source: CDP_Source
+    cdp_client: CDP_Client
+    cdp_profileID: CDP_ProfileID!
+    cdp_profile: CDP_Profile!
+    cdp_object: CDP_Object!
+    cdp_location: GeoPoint
+    cdp_timestamp: DateTime
+    cdp_topics: [CDP_Topic]
+
+    unknownProperties : [Unomi_PropertyPair]
+}
\ No newline at end of file


[unomi] 26/27: Add manual validation of specification steps

Posted by sh...@apache.org.
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 7f50cd332d98b78e3fe8c9fc7d1d1ac632d20351
Author: Serge Huber <sh...@jahia.com>
AuthorDate: Thu Oct 3 11:52:30 2019 +0200

    Add manual validation of specification steps
---
 graphql/README.md | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/graphql/README.md b/graphql/README.md
index 903fb69..d1755b2 100644
--- a/graphql/README.md
+++ b/graphql/README.md
@@ -92,3 +92,10 @@ Segment query operation:
         }
       }
     }
+
+Manually validating against specification schema
+---------------------------------------
+
+Steps:
+1. Build aggregation schema using graphql-FIND_NAME_OF_TOOL
+2. Validate aggregated schema using https://github.com/kamilkisiela/graphql-inspector against running instance of Apache Unomi


[unomi] 07/27: 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.

Posted by sh...@apache.org.
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 616dd6b56354af3a02174b989e81aba14fbf87ac
Author: Serge Huber <sh...@apache.org>
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 <sh...@apache.org>
---
 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 @@
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>cxs-graphql-api-impl</artifactId>
+    <name>Apache Unomi :: GraphQL API :: CXS Implementation</name>
+    <description>Apache Unomi Context GraphQL API CXS Implementation</description>
     <packaging>bundle</packaging>
 
     <dependencies>
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<Object,Object> 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<Object, Object> 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<CXSEventEdge> edges;
+    @GraphQLField
+    public PageInfo pageInfo;
 
 }
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/CXSEventEdge.java
similarity index 82%
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/CXSEventEdge.java
index ae444b9..e58d422 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/CXSEventEdge.java
@@ -16,8 +16,13 @@
  */
 package org.apache.unomi.graphql;
 
-public interface CXSGraphQLProvider {
+import graphql.annotations.annotationTypes.GraphQLField;
 
-    void setCxsProviderManager(CXSProviderManager cxsProviderManager);
+public class CXSEventEdge {
+
+    @GraphQLField
+    public CXSEvent node;
+    @GraphQLField
+    public String cursor;
 
 }
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/CXSEventFilter.java
similarity index 78%
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/CXSEventFilter.java
index ae444b9..9e4ebe8 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/CXSEventFilter.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 CXSEventFilter {
+
+    @GraphQLField
+    public List<CXSEventFilter> andFilters;
+    @GraphQLField
+    public List<CXSEventFilter> orFilters;
 
 }
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/CXSEventFilterInput.java
similarity index 70%
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/CXSEventFilterInput.java
index ae444b9..1e46e60 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/CXSEventFilterInput.java
@@ -16,8 +16,19 @@
  */
 package org.apache.unomi.graphql;
 
-public interface CXSGraphQLProvider {
+import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
 
-    void setCxsProviderManager(CXSProviderManager cxsProviderManager);
+import java.util.List;
+
+public class CXSEventFilterInput {
+
+    @GraphQLField
+    @GraphQLName("and")
+    public List<CXSEventFilterInput> andFilters;
+
+    @GraphQLField
+    @GraphQLName("or")
+    public List<CXSEventFilterInput> orFilters;
 
 }
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/CXSEventInput.java
similarity index 84%
copy from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEvent.java
copy to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventInput.java
index c278678..9b7b752 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/CXSEventInput.java
@@ -16,35 +16,41 @@
  */
 package org.apache.unomi.graphql;
 
+import graphql.annotations.annotationTypes.GraphQLField;
+
 import java.util.LinkedHashMap;
 import java.util.Map;
 
-public class CXSEvent {
-
+public class CXSEventInput {
     private String id;
     private String eventType;
     private long timeStamp;
     private String subject;
     private String object;
     private Map<Object,Object> properties = new LinkedHashMap<>();
-    private CXSGeoPoint location;
+    private CXSGeoPointInput 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;
     }
@@ -53,7 +59,9 @@ public class CXSEvent {
         return properties;
     }
 
-    public CXSGeoPoint getLocation() {
+    @GraphQLField
+    public CXSGeoPointInput 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/CXSEventOccurrenceFilter.java
similarity index 69%
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/CXSEventOccurrenceFilter.java
index ae444b9..a80fb0f 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/CXSEventOccurrenceFilter.java
@@ -16,8 +16,19 @@
  */
 package org.apache.unomi.graphql;
 
-public interface CXSGraphQLProvider {
+import graphql.annotations.annotationTypes.GraphQLField;
 
-    void setCxsProviderManager(CXSProviderManager cxsProviderManager);
+public class CXSEventOccurrenceFilter {
+    @GraphQLField
+    public String eventType;
+    @GraphQLField
+    public String beforeTime;
+    @GraphQLField
+    public String afterTime;
+    @GraphQLField
+    public String betweenTime;
+    @GraphQLField
+    public int count;
 
+    public CXSEventFilter eventFilter;
 }
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/CXSEventProperties.java
similarity index 71%
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/CXSEventProperties.java
index ae444b9..7b072b9 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/CXSEventProperties.java
@@ -16,8 +16,18 @@
  */
 package org.apache.unomi.graphql;
 
-public interface CXSGraphQLProvider {
+import graphql.annotations.annotationTypes.GraphQLField;
 
-    void setCxsProviderManager(CXSProviderManager cxsProviderManager);
+import java.util.LinkedHashMap;
+import java.util.Map;
 
+public class CXSEventProperties {
+    @GraphQLField
+    public int nbProperties;
+
+    Map<Object,Object> properties = new LinkedHashMap<>();
+
+    public Map<Object, Object> getProperties() {
+        return properties;
+    }
 }
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/CXSEventPropertiesFilter.java
similarity index 88%
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/CXSEventPropertiesFilter.java
index ae444b9..c24664f 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/CXSEventPropertiesFilter.java
@@ -16,8 +16,5 @@
  */
 package org.apache.unomi.graphql;
 
-public interface CXSGraphQLProvider {
-
-    void setCxsProviderManager(CXSProviderManager cxsProviderManager);
-
+public class CXSEventPropertiesFilter {
 }
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 ae444b9..1636402 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,8 +16,13 @@
  */
 package org.apache.unomi.graphql;
 
+import java.util.Map;
+
 public interface CXSGraphQLProvider {
 
+    Map<String,CXSEventType> 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
new file mode 100644
index 0000000..e3a4dce
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSMutation.java
@@ -0,0 +1,113 @@
+/*
+ * 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;
+import graphql.schema.DataFetchingEnvironment;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@GraphQLName("CXS_Mutation")
+public class CXSMutation {
+
+    @GraphQLField
+    public CXSEventType createOrUpdateEventType(DataFetchingEnvironment env, @GraphQLName("eventType") CXSEventTypeInput cxsEventTypeInput) {
+
+        CXSGraphQLProvider cxsGraphQLProvider = null;
+        CXSEventType cxsEventType = new CXSEventType();
+        cxsEventType.id = cxsEventTypeInput.id;
+        cxsEventType.typeName = cxsEventTypeInput.scope;
+        cxsEventType.properties = new ArrayList<>();
+        for (CXSPropertyTypeInput propertyTypeInput : cxsEventTypeInput.properties) {
+            CXSPropertyType propertyType = getPropertyType(propertyTypeInput);
+            cxsEventType.properties.add(propertyType);
+        }
+        cxsGraphQLProvider.getEventTypes().put(cxsEventType.typeName, cxsEventType);
+        cxsGraphQLProvider.updateGraphQLTypes();
+        if (cxsGraphQLProvider.getCxsProviderManager() != null) {
+            cxsGraphQLProvider.getCxsProviderManager().refreshProviders();
+        }
+        return cxsEventType;
+
+    }
+
+    @GraphQLField
+    public int processEvents(DataFetchingEnvironment env, @GraphQLName("events") List<CXSEventInput> events) {
+        return 0;
+    }
+
+    private CXSPropertyType getPropertyType(CXSPropertyTypeInput cxsPropertyTypeInput) {
+        CXSPropertyType propertyType = null;
+        if (cxsPropertyTypeInput.identifierPropertyTypeInput != null) {
+            propertyType = getIdentifierPropertyType(cxsPropertyTypeInput.identifierPropertyTypeInput);
+        } else if (cxsPropertyTypeInput.stringPropertyTypeInput != null) {
+            propertyType = getStringPropertyType(cxsPropertyTypeInput.stringPropertyTypeInput);
+        } else if (cxsPropertyTypeInput.setPropertyTypeInput != null) {
+            propertyType = getSetPropertyType(cxsPropertyTypeInput.setPropertyTypeInput);
+        }
+        return propertyType;
+    }
+
+    private CXSPropertyType getSetPropertyType(CXSSetPropertyTypeInput cxsSetPropertyTypeInput) {
+        CXSSetPropertyType cxsSetPropertyType = new CXSSetPropertyType();
+
+        populateCommonProperties(cxsSetPropertyTypeInput, cxsSetPropertyType);
+        if (cxsSetPropertyTypeInput.properties != null) {
+            List<CXSPropertyType> setProperties = new ArrayList<>();
+            for (CXSPropertyTypeInput setProperty : cxsSetPropertyTypeInput.properties) {
+                CXSPropertyType subPropertyType = getPropertyType(setProperty);
+                if (subPropertyType != null) {
+                    setProperties.add(subPropertyType);
+                }
+            }
+            cxsSetPropertyType.properties = setProperties;
+        }
+        return cxsSetPropertyType;
+    }
+
+    private CXSPropertyType getStringPropertyType(CXSStringPropertyType stringPropertyType) {
+        CXSStringPropertyType cxsStringPropertyType = new CXSStringPropertyType();
+        populateCommonProperties(stringPropertyType, cxsStringPropertyType);
+        cxsStringPropertyType.defaultValue = stringPropertyType.defaultValue;
+        cxsStringPropertyType.regexp = stringPropertyType.regexp;
+        return cxsStringPropertyType;
+    }
+
+    private CXSPropertyType getIdentifierPropertyType(CXSIdentifierPropertyType identifierPropertyType) {
+        CXSIdentifierPropertyType cxsIdentifierPropertyType = new CXSIdentifierPropertyType();
+        populateCommonProperties(identifierPropertyType, cxsIdentifierPropertyType);
+        cxsIdentifierPropertyType.defaultValue = identifierPropertyType.defaultValue;
+        cxsIdentifierPropertyType.regexp = identifierPropertyType.regexp;
+        return cxsIdentifierPropertyType;
+    }
+
+    private void populateCommonProperties(CXSPropertyType source, CXSPropertyType destination) {
+        if (source == null) {
+            return;
+        }
+        destination.id = source.id;
+        destination.name = source.name;
+        destination.personalData = source.personalData;
+        destination.systemTags = source.systemTags;
+        destination.tags = source.tags;
+        destination.minOccurrences = source.minOccurrences;
+        destination.maxOccurrences = source.maxOccurrences;
+    }
+
+}
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/CXSProfilePropertiesFilter.java
similarity index 69%
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/CXSProfilePropertiesFilter.java
index ae444b9..c1eae63 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/CXSProfilePropertiesFilter.java
@@ -16,8 +16,19 @@
  */
 package org.apache.unomi.graphql;
 
-public interface CXSGraphQLProvider {
+import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
 
-    void setCxsProviderManager(CXSProviderManager cxsProviderManager);
+import java.util.List;
+
+public class CXSProfilePropertiesFilter {
+
+    @GraphQLField
+    @GraphQLName("and")
+    public List<CXSProfilePropertiesFilter> andFilters;
+
+    @GraphQLField
+    @GraphQLName("or")
+    public List<CXSProfilePropertiesFilter> orFilters;
 
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java
index 900cc4a..48eadec 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java
@@ -32,7 +32,7 @@ public class CXSPropertyTypeInput {
 
     @GraphQLField
     @GraphQLName("int")
-    public CXSIntPropertyType integer;
+    public CXSIntPropertyType integerPropertyTypeInput;
 
     @GraphQLField
     @GraphQLName("float")
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSQuery.java
similarity index 55%
copy from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java
copy to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSQuery.java
index 900cc4a..24d11ff 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSQuery.java
@@ -18,39 +18,35 @@ package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
+import graphql.schema.DataFetchingEnvironment;
 
-@GraphQLName("CXSPropertyTypeInput")
-public class CXSPropertyTypeInput {
+import java.util.ArrayList;
+import java.util.List;
 
-    @GraphQLField
-    @GraphQLName("identifier")
-    public CXSIdentifierPropertyType identifierPropertyTypeInput;
-
-    @GraphQLField
-    @GraphQLName("string")
-    public CXSStringPropertyType stringPropertyTypeInput;
-
-    @GraphQLField
-    @GraphQLName("int")
-    public CXSIntPropertyType integer;
-
-    @GraphQLField
-    @GraphQLName("float")
-    public CXSFloatPropertyType floatPropertyTypeInput;
+@GraphQLName("CXS_Query")
+public class CXSQuery {
 
     @GraphQLField
-    @GraphQLName("date")
-    public CXSDatePropertyType datePropertyTypeInput;
+    public List<CXSEventType> getEventTypes() {
+        return new ArrayList<>();
+    }
 
     @GraphQLField
-    @GraphQLName("boolean")
-    public CXSBooleanPropertyType booleanPropertyTypeInput;
+    public CXSEvent getEvent(@GraphQLName("id") String id) {
+        return new CXSEvent();
+    }
 
     @GraphQLField
-    @GraphQLName("geopoint")
-    public CXSGeoPointPropertyType geoPointPropertyTypeInput;
+    public CXSEventConnection findEvents(@GraphQLName("filter") CXSEventFilterInput filter,
+                                         @GraphQLName("orderBy") CXSOrderByInput orderBy,
+                                         DataFetchingEnvironment env) {
+        env.getArgument("first");
+        env.getArgument("after");
+        return new CXSEventConnection();
+    }
 
     @GraphQLField
-    @GraphQLName("set")
-    public CXSSetPropertyTypeInput setPropertyTypeInput;
+    public CXSSegment getSegment(@GraphQLName("segmentId") String segmentId) {
+        return new CXSSegment();
+    }
 }
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/CXSSegment.java
similarity index 70%
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/CXSSegment.java
index ae444b9..4d81f90 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/CXSSegment.java
@@ -16,8 +16,17 @@
  */
 package org.apache.unomi.graphql;
 
-public interface CXSGraphQLProvider {
-
-    void setCxsProviderManager(CXSProviderManager cxsProviderManager);
+import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
 
+@GraphQLName("CXS_Segment")
+public class CXSSegment {
+    @GraphQLField
+    public String id;
+    @GraphQLField
+    public CXSView view;
+    @GraphQLField
+    public String name;
+    @GraphQLField
+    public CXSSegmentCondition condition;
 }
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/CXSSegmentCondition.java
similarity index 66%
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/CXSSegmentCondition.java
index ae444b9..37d3311 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/CXSSegmentCondition.java
@@ -16,8 +16,17 @@
  */
 package org.apache.unomi.graphql;
 
-public interface CXSGraphQLProvider {
+import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
 
-    void setCxsProviderManager(CXSProviderManager cxsProviderManager);
+import java.util.List;
 
+@GraphQLName("CXS_SegmentCondition")
+public class CXSSegmentCondition {
+    @GraphQLField
+    public CXSProfilePropertiesFilter profilePropertiesFilter;
+    @GraphQLField
+    public List<String> grantedConsents;
+    @GraphQLField
+    public CXSEventOccurrenceFilter eventOccurrenceFilter;
 }
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/CXSView.java
similarity index 87%
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/CXSView.java
index ae444b9..ddc74b6 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/CXSView.java
@@ -16,8 +16,9 @@
  */
 package org.apache.unomi.graphql;
 
-public interface CXSGraphQLProvider {
-
-    void setCxsProviderManager(CXSProviderManager cxsProviderManager);
+import graphql.annotations.annotationTypes.GraphQLField;
 
+public class CXSView {
+    @GraphQLField
+    public String name;
 }
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/builders/CXSBuilder.java
similarity index 84%
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/builders/CXSBuilder.java
index ae444b9..83c7a85 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/builders/CXSBuilder.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.builders;
 
-public interface CXSGraphQLProvider {
+public interface CXSBuilder {
 
-    void setCxsProviderManager(CXSProviderManager cxsProviderManager);
+    void updateTypes();
 
 }
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/builders/CXSEventBuilders.java
similarity index 53%
copy from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSGraphQLProviderImpl.java
copy to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/builders/CXSEventBuilders.java
index a0596cc..bc1d4f7 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/builders/CXSEventBuilders.java
@@ -14,72 +14,53 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql.internal;
+package org.apache.unomi.graphql.builders;
 
 import graphql.annotations.processor.GraphQLAnnotationsComponent;
 import graphql.annotations.processor.ProcessingElementsContainer;
 import graphql.schema.*;
-import graphql.servlet.GraphQLMutationProvider;
-import graphql.servlet.GraphQLQueryProvider;
-import graphql.servlet.GraphQLTypesProvider;
 import org.apache.unomi.graphql.*;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.component.ComponentContext;
-import org.osgi.service.component.annotations.Deactivate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 
 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 {
+public class CXSEventBuilders implements CXSBuilder {
 
-    private static final Logger logger = LoggerFactory.getLogger(CXSGraphQLProviderImpl.class.getName());
-
-    private Map<String,GraphQLOutputType> registeredOutputTypes = new TreeMap<>();
-    private Map<String,GraphQLInputType> registeredInputTypes = new TreeMap<>();
-    private CXSProviderManager cxsProviderManager;
     private GraphQLAnnotationsComponent annotationsComponent;
     private ProcessingElementsContainer container;
+    private Map<String,CXSEventType> eventTypes;
+    private Map<String,GraphQLType> typeRegistry;
 
-    private Map<String,CXSEventType> eventTypes = new TreeMap<>();
-
-    public CXSGraphQLProviderImpl(GraphQLAnnotationsComponent annotationsComponent) {
+    public CXSEventBuilders(GraphQLAnnotationsComponent annotationsComponent,
+                            ProcessingElementsContainer container,
+                            Map<String, CXSEventType> eventTypes) {
         this.annotationsComponent = annotationsComponent;
-        container = annotationsComponent.createContainer();
-        updateGraphQLTypes();
+        this.container = container;
+        this.eventTypes = eventTypes;
+        this.typeRegistry = container.getTypeRegistry();
     }
 
-    private void updateGraphQLTypes() {
-
-        registeredOutputTypes.put(PageInfo.class.getName(), annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(PageInfo.class, container));
-
-        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));
+    @Override
+    public void updateTypes() {
+        Map<String,GraphQLType> typeRegistry = container.getTypeRegistry();
+        typeRegistry.put("CXS_EventInput", buildCXSEventInputType());
+        typeRegistry.put(CXSEventOccurrenceFilterInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSEventOccurrenceFilterInput.class, container));
+        typeRegistry.put("CXS_EventPropertiesFilterInput", buildCXSEventPropertiesFilterInput());
+        typeRegistry.put("CXS_EventFilterInput", buildCXSEventFilterInputType());
 
-        registeredInputTypes.put(CXSGeoDistanceInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSGeoDistanceInput.class, container));
-        registeredInputTypes.put(CXSDateFilterInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSDateFilterInput.class, container));
-        registeredInputTypes.put(CXSEventTypeInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSEventTypeInput.class, container));
-        registeredInputTypes.put(CXSOrderByInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSOrderByInput.class, container));
-        registeredInputTypes.put("CXS_EventInput", buildCXSEventInputType());
-        registeredInputTypes.put(CXSEventOccurrenceFilterInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSEventOccurrenceFilterInput.class, container));
-        registeredInputTypes.put("CXS_EventPropertiesFilterInput", buildCXSEventPropertiesFilterInput());
-        registeredInputTypes.put("CXS_EventFilterInput", buildCXSEventFilterInputType());
+        typeRegistry.put("CXS_EventProperties", buildCXSEventPropertiesOutputType());
 
-        registeredOutputTypes.put("CXS_EventProperties", buildCXSEventPropertiesOutputType());
+        typeRegistry.put("CXS_Event", buildCXSEventOutputType());
+        typeRegistry.put("CXS_EventEdge", buildCXSEventEdgeOutputType());
+        typeRegistry.put("CXS_EventConnection", buildCXSEventConnectionOutputType());
 
-        registeredOutputTypes.put("CXS_Event", buildCXSEventOutputType());
-        registeredOutputTypes.put("CXS_EventEdge", buildCXSEventEdgeOutputType());
-        registeredOutputTypes.put("CXS_EventConnection", buildCXSEventConnectionOutputType());
-        registeredOutputTypes.put("CXS_Query", buildCXSQueryOutputType());
-        registeredOutputTypes.put("CXS_Mutation", buildCXSMutationOutputType());
     }
 
     private GraphQLOutputType buildCXSEventEdgeOutputType() {
@@ -88,7 +69,7 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                 .description("The Relay edge type for the CXS_Event output type")
                 .field(newFieldDefinition()
                         .name("node")
-                        .type(registeredOutputTypes.get("CXS_Event"))
+                        .type((GraphQLOutputType) typeRegistry.get("CXS_Event"))
                 )
                 .field(newFieldDefinition()
                         .name("cursor")
@@ -103,11 +84,11 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                 .description("The Relay connection type for the CXS_Event output type")
                 .field(newFieldDefinition()
                         .name("edges")
-                        .type(new GraphQLList(registeredOutputTypes.get("CXS_EventEdge")))
+                        .type(new GraphQLList(typeRegistry.get("CXS_EventEdge")))
                 )
                 .field(newFieldDefinition()
                         .name("pageInfo")
-                        .type(new GraphQLList(registeredOutputTypes.get(PageInfo.class.getName())))
+                        .type(new GraphQLList(typeRegistry.get(PageInfo.class.getName())))
                 )
                 .build();
     }
@@ -164,11 +145,11 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
             }
         }
 
-        registeredInputTypes.put(eventTypeName + "FilterInput", eventTypeFilterInput.build());
+        typeRegistry.put(eventTypeName + "FilterInput", eventTypeFilterInput.build());
 
         inputTypeBuilder.field(newInputObjectField()
                 .name(eventTypeName)
-                .type(registeredInputTypes.get(eventTypeName + "FilterInput"))
+                .type((GraphQLInputType) typeRegistry.get(eventTypeName + "FilterInput"))
         );
 
     }
@@ -255,14 +236,14 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
     private void addDistanceFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
         inputTypeBuilder.field(newInputObjectField()
                 .name(propertyName + "_distance")
-                .type(registeredInputTypes.get(CXSGeoDistanceInput.class.getName()))
+                .type((GraphQLInputType) typeRegistry.get(CXSGeoDistanceInput.class.getName()))
         );
     }
 
     private void addDateFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
         inputTypeBuilder.field(newInputObjectField()
                 .name(propertyName + "_between")
-                .type(registeredInputTypes.get(CXSDateFilterInput.class.getName()))
+                .type((GraphQLInputType) typeRegistry.get(CXSDateFilterInput.class.getName()))
         );
     }
 
@@ -280,15 +261,15 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                 )
                 .field(newInputObjectField()
                         .name("properties")
-                        .type(registeredInputTypes.get("CXS_EventPropertiesFilterInput"))
+                        .type((GraphQLInputType) typeRegistry.get("CXS_EventPropertiesFilterInput"))
                 )
                 .field(newInputObjectField()
                         .name("properties_or")
-                        .type(registeredInputTypes.get("CXS_EventPropertiesFilterInput"))
+                        .type((GraphQLInputType) typeRegistry.get("CXS_EventPropertiesFilterInput"))
                 )
                 .field(newInputObjectField()
                         .name("eventOccurrence")
-                        .type(registeredInputTypes.get(CXSEventOccurrenceFilterInput.class.getName()))
+                        .type((GraphQLInputType) typeRegistry.get(CXSEventOccurrenceFilterInput.class.getName()))
                 );
         return cxsEventFilterInputType.build();
     }
@@ -335,7 +316,7 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
             } else if (cxsEventPropertyType instanceof CXSDatePropertyType) {
                 eventPropertyInputType = GraphQLString;
             } else if (cxsEventPropertyType instanceof CXSGeoPointPropertyType) {
-                eventPropertyInputType = registeredInputTypes.get(CXSGeoPoint.class.getName());
+                eventPropertyInputType = (GraphQLInputType) typeRegistry.get(CXSGeoPoint.class.getName());
             } else if (cxsEventPropertyType instanceof CXSSetPropertyType) {
                 eventPropertyInputType = buildCXSEventTypeInputProperty(cxsEventPropertyType.name, ((CXSSetPropertyType)cxsEventPropertyType).properties);
             }
@@ -349,256 +330,6 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
         return eventInputType.build();
     }
 
-    @Deactivate
-    void deactivate(
-            ComponentContext cc,
-            BundleContext bc,
-            Map<String,Object> config) {
-
-        registeredOutputTypes.clear();
-    }
-
-    public void setCxsProviderManager(CXSProviderManager cxsProviderManager) {
-        this.cxsProviderManager = cxsProviderManager;
-    }
-
-    @Override
-    public Collection<GraphQLFieldDefinition> getQueries() {
-        List<GraphQLFieldDefinition> fieldDefinitions = new ArrayList<GraphQLFieldDefinition>();
-        fieldDefinitions.add(newFieldDefinition()
-                .type(registeredOutputTypes.get("CXS_Query"))
-                .name("cxs")
-                .description("Root field for all CXS queries")
-                .dataFetcher(new DataFetcher() {
-                    public Object get(DataFetchingEnvironment environment) {
-                        Map<String,Object> map = environment.getContext();
-                        return map.keySet();
-                    }
-                }).build());
-        return fieldDefinitions;
-    }
-
-    @Override
-    public Collection<GraphQLType> getTypes() {
-        return new ArrayList<>();
-    }
-
-    @Override
-    public Collection<GraphQLFieldDefinition> getMutations() {
-        List<GraphQLFieldDefinition> fieldDefinitions = new ArrayList<GraphQLFieldDefinition>();
-        fieldDefinitions.add(newFieldDefinition()
-                .type(registeredOutputTypes.get("CXS_Mutation"))
-                .name("cxs")
-                .description("Root field for all CXS mutation")
-                .dataFetcher(new DataFetcher<Object>() {
-                    @Override
-                    public Object get(DataFetchingEnvironment environment) {
-                        Object contextObject = environment.getContext();
-                        return contextObject;
-                    }
-                }).build());
-        return fieldDefinitions;
-    }
-
-    private GraphQLOutputType buildCXSQueryOutputType() {
-        return newObject()
-                .name("CXS_Query")
-                .description("Root CXS query type")
-                .field(newFieldDefinition()
-                        .type(new GraphQLList(registeredOutputTypes.get(CXSEventType.class.getName())))
-                        .name("getEventTypes")
-                        .description("Retrieves the list of all the declared CXS event types in the Apache Unomi server")
-                )
-                .field(newFieldDefinition()
-                        .type(new GraphQLList(registeredOutputTypes.get("CXS_Event")))
-                        .name("getEvent")
-                        .description("Retrieves a specific event")
-                )
-                .field(newFieldDefinition()
-                        .type(new GraphQLList(registeredOutputTypes.get("CXS_EventConnection")))
-                        .name("findEvents")
-                        .argument(newArgument()
-                                .name("filter")
-                                .type(registeredInputTypes.get("CXS_EventFilterInput"))
-                        )
-                        .argument(newArgument()
-                                .name("orderBy")
-                                .type(registeredInputTypes.get(CXSOrderByInput.class.getName()))
-                        )
-                        .argument(newArgument()
-                                .name("first")
-                                .type(GraphQLInt)
-                                .description("Number of objects to retrieve starting at the after cursor position")
-                        )
-                        .argument(newArgument()
-                                .name("after")
-                                .type(GraphQLString)
-                                .description("Starting cursor location to retrieve the object from")
-                        )
-                        .argument(newArgument()
-                                .name("last")
-                                .type(GraphQLInt)
-                                .description("Number of objects to retrieve end at the before cursor position")
-                        )
-                        .argument(newArgument()
-                                .name("before")
-                                .type(GraphQLString)
-                                .description("End cursor location to retrieve the object from")
-                        )
-                        .description("Retrieves the events that match the specified filters")
-                )
-                /*
-                .field(newFieldDefinition()
-                        .type(new GraphQLList(registeredOutputTypes.get("CXS_ProfileConnection")))
-                        .name("findProfiles")
-                        .argument(newArgument()
-                                .name("filter")
-                                .type(registeredInputTypes.get("CXS_ProfileFilterInput"))
-                        )
-                        .argument(newArgument()
-                                .name("orderBy")
-                                .type(registeredInputTypes.get(CXSOrderByInput.class.getName()))
-                        )
-                        .argument(newArgument()
-                                .name("first")
-                                .type(GraphQLInt)
-                                .description("Number of objects to retrieve starting at the after cursor position")
-                        )
-                        .argument(newArgument()
-                                .name("after")
-                                .type(GraphQLString)
-                                .description("Starting cursor location to retrieve the object from")
-                        )
-                        .argument(newArgument()
-                                .name("last")
-                                .type(GraphQLInt)
-                                .description("Number of objects to retrieve end at the before cursor position")
-                        )
-                        .argument(newArgument()
-                                .name("before")
-                                .type(GraphQLString)
-                                .description("End cursor location to retrieve the object from")
-                        )
-                        .description("Retrieves the profiles that match the specified profiles")
-                )
-                */
-                .build();
-    }
-
-    private GraphQLOutputType buildCXSMutationOutputType() {
-        return newObject()
-                .name("CXS_Mutation")
-                .description("Root CXS mutation type")
-                .field(newFieldDefinition()
-                        .type(registeredOutputTypes.get(CXSEventType.class.getName()))
-                        .name("createOrUpdateEventType")
-                        .argument(newArgument()
-                                .name("eventType")
-                                .type(registeredInputTypes.get(CXSEventTypeInput.class.getName()))
-                        )
-                        .description("Create or updates a CXS event type in the Apache Unomi server")
-                        .dataFetcher(new DataFetcher<CXSEventType>() {
-                            @Override
-                            public CXSEventType get(DataFetchingEnvironment environment) {
-                                Map<String,Object> arguments = environment.getArguments();
-                                CXSEventType cxsEventType = new CXSEventType();
-                                if (arguments.containsKey("eventType")) {
-                                    Map<String,Object> eventTypeArguments = (Map<String,Object>) arguments.get("eventType");
-                                    if (eventTypeArguments.containsKey("typeName")) {
-                                        cxsEventType.id = (String) eventTypeArguments.get("typeName");
-                                        cxsEventType.typeName = (String) eventTypeArguments.get("typeName");
-                                    }
-                                    cxsEventType.properties = new ArrayList<>();
-                                    if (eventTypeArguments.containsKey("properties")) {
-                                        List<Map<String, Object>> properties = (List<Map<String, Object>>) eventTypeArguments.get("properties");
-                                        for (Map<String, Object> propertyTypeMap : properties) {
-                                            CXSPropertyType cxsPropertyType = getPropertyType(propertyTypeMap);
-                                            if (cxsPropertyType != null) {
-                                                cxsEventType.properties.add(cxsPropertyType);
-                                            }
-                                        }
-                                    }
-                                }
-                                eventTypes.put(cxsEventType.typeName, cxsEventType);
-                                updateGraphQLTypes();
-                                if (cxsProviderManager != null) {
-                                    cxsProviderManager.refreshProviders();
-                                }
-                                return cxsEventType;
-                            }
-                        })
-                )
-                .field(newFieldDefinition()
-                        .name("processEvents")
-                        .description("Processes events sent to the Context Server")
-                        .argument(newArgument()
-                                .name("events")
-                                .type(new GraphQLList(registeredInputTypes.get("CXS_EventInput"))))
-                        .type(GraphQLInt)
-                )
-                .build();
-    }
-
-    private CXSPropertyType getPropertyType(Map<String, Object> propertyTypeMap) {
-        if (propertyTypeMap.size() > 1) {
-            logger.error("Only one property type is allowed for each property !");
-            return null;
-        }
-        CXSPropertyType propertyType = null;
-        if (propertyTypeMap.containsKey("identifier")) {
-            propertyType = getIdentifierPropertyType(propertyTypeMap);
-        } else if (propertyTypeMap.containsKey("string")) {
-            propertyType = getStringPropertyType(propertyTypeMap);
-        } else if (propertyTypeMap.containsKey("set")) {
-            propertyType = getSetPropertyType(propertyTypeMap);
-        }
-        return propertyType;
-    }
-
-    private CXSPropertyType getSetPropertyType(Map<String, Object> propertyTypeMap) {
-        CXSSetPropertyType cxsSetPropertyType = new CXSSetPropertyType();
-        Map<String,Object> setPropertyTypeMap = (Map<String,Object>) propertyTypeMap.get("set");
-        populateCommonProperties(setPropertyTypeMap, cxsSetPropertyType);
-        if (setPropertyTypeMap.containsKey("properties")) {
-            List<Map<String,Object>> propertyList = (List<Map<String,Object>>) setPropertyTypeMap.get("properties");
-            List<CXSPropertyType> setProperties = new ArrayList<>();
-            for (Map<String,Object> setProperty : propertyList) {
-                CXSPropertyType subPropertyType = getPropertyType(setProperty);
-                if (subPropertyType != null) {
-                    setProperties.add(subPropertyType);
-                }
-            }
-            cxsSetPropertyType.properties = setProperties;
-        }
-        return cxsSetPropertyType;
-    }
-
-    private CXSPropertyType getStringPropertyType(Map<String, Object> propertyTypeMap) {
-        CXSStringPropertyType cxsStringPropertyType = new CXSStringPropertyType();
-        Map<String,Object> stringPropertyTypeMap = (Map<String,Object>) propertyTypeMap.get("string");
-        populateCommonProperties(stringPropertyTypeMap, cxsStringPropertyType);
-        return cxsStringPropertyType;
-    }
-
-    private CXSPropertyType getIdentifierPropertyType(Map<String, Object> propertyTypeMap) {
-        CXSIdentifierPropertyType cxsIdentifierPropertyType = new CXSIdentifierPropertyType();
-        Map<String,Object> identifierPropertyTypeMap = (Map<String,Object>) propertyTypeMap.get("identifier");
-        populateCommonProperties(identifierPropertyTypeMap, cxsIdentifierPropertyType);
-        return cxsIdentifierPropertyType;
-    }
-
-    private void populateCommonProperties(Map<String, Object> propertyTypeMap, CXSPropertyType cxsPropertyType) {
-        if (propertyTypeMap == null || propertyTypeMap.size() == 0) {
-            return;
-        }
-        if (propertyTypeMap.containsKey("id")) {
-            cxsPropertyType.id = (String) propertyTypeMap.get("id");
-        }
-        if (propertyTypeMap.containsKey("name")) {
-            cxsPropertyType.name = (String) propertyTypeMap.get("name");
-        }
-    }
-
     private GraphQLOutputType buildCXSEventOutputType() {
         return newObject()
                 .name("CXS_Event")
@@ -657,7 +388,7 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                         })
                 )
                 .field(newFieldDefinition()
-                        .type(registeredOutputTypes.get(CXSGeoPoint.class.getName()))
+                        .type((GraphQLOutputType) typeRegistry.get(CXSGeoPoint.class.getName()))
                         .name("location")
                         .description("The geo-point location where the event was fired.")
                         .dataFetcher(new DataFetcher() {
@@ -668,13 +399,13 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                         })
                 )
                 .field(newFieldDefinition()
-                        .type(new GraphQLList(registeredOutputTypes.get("CXS_EventProperties")))
+                        .type(new GraphQLList(typeRegistry.get("CXS_EventProperties")))
                         .name("properties")
                         .description("Generic properties for the event")
                         .dataFetcher(new DataFetcher() {
                             public Object get(DataFetchingEnvironment environment) {
                                 CXSEvent CXSEvent = environment.getSource();
-                                return new ArrayList<Map.Entry<Object,Object>>(CXSEvent.getProperties().entrySet());
+                                return new ArrayList<Map.Entry<Object,Object>>(CXSEvent.getProperties().getProperties().entrySet());
                             }
                         })
                 )
@@ -726,7 +457,7 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
             } else if (cxsEventPropertyType instanceof CXSDatePropertyType) {
                 eventPropertyOutputType = GraphQLString;
             } else if (cxsEventPropertyType instanceof CXSGeoPointPropertyType) {
-                eventPropertyOutputType = registeredOutputTypes.get(CXSGeoPoint.class.getName());
+                eventPropertyOutputType = (GraphQLOutputType) typeRegistry.get(CXSGeoPoint.class.getName());
             } else if (cxsEventPropertyType instanceof CXSSetPropertyType) {
                 eventPropertyOutputType = buildEventOutputType(cxsEventPropertyType.name, ((CXSSetPropertyType)cxsEventPropertyType).properties);
             }
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 a0596cc..a3c299d 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
@@ -23,339 +23,83 @@ import graphql.servlet.GraphQLMutationProvider;
 import graphql.servlet.GraphQLQueryProvider;
 import graphql.servlet.GraphQLTypesProvider;
 import org.apache.unomi.graphql.*;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.component.ComponentContext;
-import org.osgi.service.component.annotations.Deactivate;
+import org.apache.unomi.graphql.builders.CXSEventBuilders;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.util.*;
 
-import static graphql.Scalars.*;
+import static graphql.Scalars.GraphQLInt;
+import static graphql.Scalars.GraphQLString;
 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 {
 
     private static final Logger logger = LoggerFactory.getLogger(CXSGraphQLProviderImpl.class.getName());
 
-    private Map<String,GraphQLOutputType> registeredOutputTypes = new TreeMap<>();
-    private Map<String,GraphQLInputType> registeredInputTypes = new TreeMap<>();
     private CXSProviderManager cxsProviderManager;
     private GraphQLAnnotationsComponent annotationsComponent;
     private ProcessingElementsContainer container;
+    private CXSEventBuilders cxsEventBuilders;
+    private Map<String,GraphQLType> typeRegistry;
 
     private Map<String,CXSEventType> eventTypes = new TreeMap<>();
 
     public CXSGraphQLProviderImpl(GraphQLAnnotationsComponent annotationsComponent) {
         this.annotationsComponent = annotationsComponent;
         container = annotationsComponent.createContainer();
+        typeRegistry = container.getTypeRegistry();
+        cxsEventBuilders = new CXSEventBuilders(annotationsComponent, container, eventTypes);
         updateGraphQLTypes();
     }
 
-    private void updateGraphQLTypes() {
-
-        registeredOutputTypes.put(PageInfo.class.getName(), annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(PageInfo.class, container));
-
-        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(CXSGeoDistanceInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSGeoDistanceInput.class, container));
-        registeredInputTypes.put(CXSDateFilterInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSDateFilterInput.class, container));
-        registeredInputTypes.put(CXSEventTypeInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSEventTypeInput.class, container));
-        registeredInputTypes.put(CXSOrderByInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSOrderByInput.class, container));
-        registeredInputTypes.put("CXS_EventInput", buildCXSEventInputType());
-        registeredInputTypes.put(CXSEventOccurrenceFilterInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSEventOccurrenceFilterInput.class, container));
-        registeredInputTypes.put("CXS_EventPropertiesFilterInput", buildCXSEventPropertiesFilterInput());
-        registeredInputTypes.put("CXS_EventFilterInput", buildCXSEventFilterInputType());
-
-        registeredOutputTypes.put("CXS_EventProperties", buildCXSEventPropertiesOutputType());
-
-        registeredOutputTypes.put("CXS_Event", buildCXSEventOutputType());
-        registeredOutputTypes.put("CXS_EventEdge", buildCXSEventEdgeOutputType());
-        registeredOutputTypes.put("CXS_EventConnection", buildCXSEventConnectionOutputType());
-        registeredOutputTypes.put("CXS_Query", buildCXSQueryOutputType());
-        registeredOutputTypes.put("CXS_Mutation", buildCXSMutationOutputType());
-    }
-
-    private GraphQLOutputType buildCXSEventEdgeOutputType() {
-        return newObject()
-                .name("CXS_EventEdge")
-                .description("The Relay edge type for the CXS_Event output type")
-                .field(newFieldDefinition()
-                        .name("node")
-                        .type(registeredOutputTypes.get("CXS_Event"))
-                )
-                .field(newFieldDefinition()
-                        .name("cursor")
-                        .type(GraphQLString)
-                )
-                .build();
-    }
-
-    private GraphQLOutputType buildCXSEventConnectionOutputType() {
-        return newObject()
-                .name("CXS_EventConnection")
-                .description("The Relay connection type for the CXS_Event output type")
-                .field(newFieldDefinition()
-                        .name("edges")
-                        .type(new GraphQLList(registeredOutputTypes.get("CXS_EventEdge")))
-                )
-                .field(newFieldDefinition()
-                        .name("pageInfo")
-                        .type(new GraphQLList(registeredOutputTypes.get(PageInfo.class.getName())))
-                )
-                .build();
-    }
-
-    private GraphQLInputType buildCXSEventPropertiesFilterInput() {
-        GraphQLInputObjectType.Builder cxsEventPropertiesFilterInput = newInputObject()
-                .name("CXS_EventPropertiesFilterInput")
-                .description("Filter conditions for each event types and built-in properties");
-
-        generateEventPropertiesFilters(cxsEventPropertiesFilterInput);
-        generateEventTypesFilters(cxsEventPropertiesFilterInput);
-
-        return cxsEventPropertiesFilterInput.build();
-    }
-
-
-    private void generateEventPropertiesFilters(GraphQLInputObjectType.Builder cxsEventPropertiesFilterInput) {
-        addIdentityFilters("id", cxsEventPropertiesFilterInput);
-        addIdentityFilters("sourceId", cxsEventPropertiesFilterInput);
-        addIdentityFilters("clientId", cxsEventPropertiesFilterInput);
-        addIdentityFilters("profileId", cxsEventPropertiesFilterInput);
-        addDistanceFilters("location", cxsEventPropertiesFilterInput);
-        addDateFilters("timestamp", cxsEventPropertiesFilterInput);
-    }
-
-    private void generateEventTypesFilters(GraphQLInputObjectType.Builder cxsEventPropertiesFilterInput) {
-        for (Map.Entry<String,CXSEventType> eventTypeEntry : eventTypes.entrySet()) {
-            addSetFilters(eventTypeEntry.getKey(), eventTypeEntry.getValue().properties, cxsEventPropertiesFilterInput);
-        }
+    @Override
+    public Map<String, CXSEventType> getEventTypes() {
+        return eventTypes;
     }
 
-    private void addSetFilters(String eventTypeName, List<CXSPropertyType> properties, GraphQLInputObjectType.Builder inputTypeBuilder) {
-        GraphQLInputObjectType.Builder eventTypeFilterInput = newInputObject()
-                .name(eventTypeName + "FilterInput")
-                .description("Auto-generated filter input type for event type " + eventTypeName);
-
-        for (CXSPropertyType cxsPropertyType : properties) {
-            if (cxsPropertyType instanceof CXSIdentifierPropertyType) {
-                addIdentityFilters(cxsPropertyType.name, eventTypeFilterInput);
-            } else if (cxsPropertyType instanceof CXSStringPropertyType) {
-                addStringFilters(cxsPropertyType.name, eventTypeFilterInput);
-            } else if (cxsPropertyType instanceof CXSBooleanPropertyType) {
-                addBooleanFilters(cxsPropertyType.name, eventTypeFilterInput);
-            } else if (cxsPropertyType instanceof CXSIntPropertyType) {
-                addIntegerFilters(cxsPropertyType.name, eventTypeFilterInput);
-            } else if (cxsPropertyType instanceof CXSFloatPropertyType) {
-                addFloatFilters(cxsPropertyType.name, eventTypeFilterInput);
-            } else if (cxsPropertyType instanceof CXSGeoPointPropertyType) {
-                addDistanceFilters(cxsPropertyType.name, eventTypeFilterInput);
-            } else if (cxsPropertyType instanceof CXSDatePropertyType) {
-                addDateFilters(cxsPropertyType.name, eventTypeFilterInput);
-            } else if (cxsPropertyType instanceof CXSSetPropertyType) {
-                addSetFilters(cxsPropertyType.name, ((CXSSetPropertyType) cxsPropertyType).properties, eventTypeFilterInput);
-            }
-        }
-
-        registeredInputTypes.put(eventTypeName + "FilterInput", eventTypeFilterInput.build());
-
-        inputTypeBuilder.field(newInputObjectField()
-                .name(eventTypeName)
-                .type(registeredInputTypes.get(eventTypeName + "FilterInput"))
-        );
-
+    public CXSProviderManager getCxsProviderManager() {
+        return cxsProviderManager;
     }
 
-    private void addIdentityFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
-        inputTypeBuilder.field(newInputObjectField()
-                .name(propertyName + "_equals")
-                .type(GraphQLString)
-        );
-    }
+    public void updateGraphQLTypes() {
 
-    private void addStringFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
-        inputTypeBuilder.field(newInputObjectField()
-                .name(propertyName + "_equals")
-                .type(GraphQLString)
-        );
-        inputTypeBuilder.field(newInputObjectField()
-                .name(propertyName + "_regexp")
-                .type(GraphQLString)
-        );
-        inputTypeBuilder.field(newInputObjectField()
-                .name(propertyName + "_startsWith")
-                .type(GraphQLString)
-        );
-        inputTypeBuilder.field(newInputObjectField()
-                .name(propertyName + "_contains")
-                .type(new GraphQLList(GraphQLString))
-        );
-    }
+        Map<String,GraphQLType> typeRegistry = container.getTypeRegistry();
 
-    private void addBooleanFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
-        inputTypeBuilder.field(newInputObjectField()
-                .name(propertyName + "_equals")
-                .type(GraphQLBoolean)
-        );
-    }
+        typeRegistry.put(PageInfo.class.getName(), annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(PageInfo.class, container));
 
-    private void addIntegerFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
-        inputTypeBuilder.field(newInputObjectField()
-                .name(propertyName + "_equals")
-                .type(GraphQLInt)
-        );
-        inputTypeBuilder.field(newInputObjectField()
-                .name(propertyName + "_gt")
-                .type(GraphQLInt)
-        );
-        inputTypeBuilder.field(newInputObjectField()
-                .name(propertyName + "_gte")
-                .type(GraphQLInt)
-        );
-        inputTypeBuilder.field(newInputObjectField()
-                .name(propertyName + "_lt")
-                .type(GraphQLInt)
-        );
-        inputTypeBuilder.field(newInputObjectField()
-                .name(propertyName + "_lte")
-                .type(GraphQLInt)
-        );
-    }
+        typeRegistry.put(CXSGeoPoint.class.getName(), annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSGeoPoint.class, container));
+        typeRegistry.put(CXSSetPropertyType.class.getName(),annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSSetPropertyType.class, container));
+        typeRegistry.put(CXSEventType.class.getName(), annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSEventType.class, container));
 
-    private void addFloatFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
-        inputTypeBuilder.field(newInputObjectField()
-                .name(propertyName + "_equals")
-                .type(GraphQLFloat)
-        );
-        inputTypeBuilder.field(newInputObjectField()
-                .name(propertyName + "_gt")
-                .type(GraphQLFloat)
-        );
-        inputTypeBuilder.field(newInputObjectField()
-                .name(propertyName + "_gte")
-                .type(GraphQLFloat)
-        );
-        inputTypeBuilder.field(newInputObjectField()
-                .name(propertyName + "_lt")
-                .type(GraphQLFloat)
-        );
-        inputTypeBuilder.field(newInputObjectField()
-                .name(propertyName + "_lte")
-                .type(GraphQLFloat)
-        );
-    }
+        typeRegistry.put(CXSGeoDistanceInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSGeoDistanceInput.class, container));
+        typeRegistry.put(CXSDateFilterInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSDateFilterInput.class, container));
+        typeRegistry.put(CXSEventTypeInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSEventTypeInput.class, container));
+        typeRegistry.put(CXSOrderByInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSOrderByInput.class, container));
 
-    private void addDistanceFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
-        inputTypeBuilder.field(newInputObjectField()
-                .name(propertyName + "_distance")
-                .type(registeredInputTypes.get(CXSGeoDistanceInput.class.getName()))
-        );
-    }
+        typeRegistry.put("CXS_Query", annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSQuery.class, container));
+        typeRegistry.put("CXS_Mutation", annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSMutation.class, container));
+        // typeRegistry.put("CXS_Query", buildCXSQueryOutputType());
+        // typeRegistry.put("CXS_Mutation", buildCXSMutationOutputType());
 
-    private void addDateFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
-        inputTypeBuilder.field(newInputObjectField()
-                .name(propertyName + "_between")
-                .type(registeredInputTypes.get(CXSDateFilterInput.class.getName()))
-        );
-    }
+        cxsEventBuilders.updateTypes();
 
-    private GraphQLInputType buildCXSEventFilterInputType() {
-        GraphQLInputObjectType.Builder cxsEventFilterInputType = newInputObject()
-                .name("CXS_EventFilterInput")
-                .description("Filter conditions for each event types and built-in properties")
-                .field(newInputObjectField()
-                        .name("and")
-                        .type(new GraphQLList(new GraphQLTypeReference("CXS_EventFilterInput")))
-                )
-                .field(newInputObjectField()
-                        .name("or")
-                        .type(new GraphQLList(new GraphQLTypeReference("CXS_EventFilterInput")))
-                )
-                .field(newInputObjectField()
-                        .name("properties")
-                        .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()))
-                );
-        return cxsEventFilterInputType.build();
     }
 
-    private GraphQLInputType buildCXSEventInputType() {
-        GraphQLInputObjectType.Builder cxsEventInputType = newInputObject()
-                .name("CXS_EventInput")
-                .description("The event input object to send events to the Context Server")
-                .field(newInputObjectField()
-                        .name("id")
-                        .type(GraphQLID)
-                );
-
-        for (Map.Entry<String,CXSEventType> cxsEventTypeEntry : eventTypes.entrySet()) {
-            CXSEventType cxsEventType = cxsEventTypeEntry.getValue();
-            cxsEventInputType.field(newInputObjectField()
-                    .name(cxsEventTypeEntry.getKey())
-                    .type(buildCXSEventTypeInputProperty(cxsEventType.typeName, cxsEventType.properties))
-            );
-        }
-
-        return cxsEventInputType.build();
-
+    private GraphQLObjectType.Builder getBuilderFromAnnotatedClass(Class annotatedClass) {
+        return GraphQLObjectType.newObject()
+                .name(annotatedClass.getName())
+                .fields(((GraphQLObjectType) annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(annotatedClass, container)).getFieldDefinitions());
     }
 
-    private GraphQLInputType buildCXSEventTypeInputProperty(String typeName, List<CXSPropertyType> propertyTypes) {
-        String eventTypeName = typeName.substring(0, 1).toUpperCase() + typeName.substring(1) + "EventTypeInput";
-        GraphQLInputObjectType.Builder eventInputType = newInputObject()
-                .name(eventTypeName)
-                .description("Event type object for event type " + typeName);
-
-        for (CXSPropertyType cxsEventPropertyType : propertyTypes) {
-            GraphQLInputType eventPropertyInputType = null;
-            if (cxsEventPropertyType instanceof CXSIdentifierPropertyType) {
-                eventPropertyInputType = GraphQLID;
-            } else if (cxsEventPropertyType instanceof CXSStringPropertyType) {
-                eventPropertyInputType = GraphQLString;
-            } else if (cxsEventPropertyType instanceof CXSIntPropertyType) {
-                eventPropertyInputType = GraphQLInt;
-            } else if (cxsEventPropertyType instanceof CXSFloatPropertyType) {
-                eventPropertyInputType = GraphQLFloat;
-            } else if (cxsEventPropertyType instanceof CXSBooleanPropertyType) {
-                eventPropertyInputType = GraphQLBoolean;
-            } else if (cxsEventPropertyType instanceof CXSDatePropertyType) {
-                eventPropertyInputType = GraphQLString;
-            } else if (cxsEventPropertyType instanceof CXSGeoPointPropertyType) {
-                eventPropertyInputType = registeredInputTypes.get(CXSGeoPoint.class.getName());
-            } else if (cxsEventPropertyType instanceof CXSSetPropertyType) {
-                eventPropertyInputType = buildCXSEventTypeInputProperty(cxsEventPropertyType.name, ((CXSSetPropertyType)cxsEventPropertyType).properties);
-            }
-            eventInputType
-                    .field(newInputObjectField()
-                            .type(eventPropertyInputType)
-                            .name(cxsEventPropertyType.name)
-                    );
-        }
-
-        return eventInputType.build();
+    private GraphQLOutputType getOutputTypeFromRegistry(String typeName) {
+        return (GraphQLOutputType) typeRegistry.get(typeName);
     }
 
-    @Deactivate
-    void deactivate(
-            ComponentContext cc,
-            BundleContext bc,
-            Map<String,Object> config) {
-
-        registeredOutputTypes.clear();
+    private GraphQLInputObjectType getInputTypeFromRegistry(String typeName) {
+        return (GraphQLInputObjectType) typeRegistry.get(typeName);
     }
 
     public void setCxsProviderManager(CXSProviderManager cxsProviderManager) {
@@ -366,7 +110,7 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
     public Collection<GraphQLFieldDefinition> getQueries() {
         List<GraphQLFieldDefinition> fieldDefinitions = new ArrayList<GraphQLFieldDefinition>();
         fieldDefinitions.add(newFieldDefinition()
-                .type(registeredOutputTypes.get("CXS_Query"))
+                .type(getOutputTypeFromRegistry("CXS_Query"))
                 .name("cxs")
                 .description("Root field for all CXS queries")
                 .dataFetcher(new DataFetcher() {
@@ -387,9 +131,9 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
     public Collection<GraphQLFieldDefinition> getMutations() {
         List<GraphQLFieldDefinition> fieldDefinitions = new ArrayList<GraphQLFieldDefinition>();
         fieldDefinitions.add(newFieldDefinition()
-                .type(registeredOutputTypes.get("CXS_Mutation"))
+                .type(getOutputTypeFromRegistry("CXS_Mutation"))
                 .name("cxs")
-                .description("Root field for all CXS mutation")
+                .description("Root field for all CXS mutations")
                 .dataFetcher(new DataFetcher<Object>() {
                     @Override
                     public Object get(DataFetchingEnvironment environment) {
@@ -405,25 +149,25 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                 .name("CXS_Query")
                 .description("Root CXS query type")
                 .field(newFieldDefinition()
-                        .type(new GraphQLList(registeredOutputTypes.get(CXSEventType.class.getName())))
+                        .type(new GraphQLList(getOutputTypeFromRegistry(CXSEventType.class.getName())))
                         .name("getEventTypes")
                         .description("Retrieves the list of all the declared CXS event types in the Apache Unomi server")
                 )
                 .field(newFieldDefinition()
-                        .type(new GraphQLList(registeredOutputTypes.get("CXS_Event")))
+                        .type(new GraphQLList(getOutputTypeFromRegistry("CXS_Event")))
                         .name("getEvent")
                         .description("Retrieves a specific event")
                 )
                 .field(newFieldDefinition()
-                        .type(new GraphQLList(registeredOutputTypes.get("CXS_EventConnection")))
+                        .type(new GraphQLList(getOutputTypeFromRegistry("CXS_EventConnection")))
                         .name("findEvents")
                         .argument(newArgument()
                                 .name("filter")
-                                .type(registeredInputTypes.get("CXS_EventFilterInput"))
+                                .type(getInputTypeFromRegistry("CXS_EventFilterInput"))
                         )
                         .argument(newArgument()
                                 .name("orderBy")
-                                .type(registeredInputTypes.get(CXSOrderByInput.class.getName()))
+                                .type(getInputTypeFromRegistry(CXSOrderByInput.class.getName()))
                         )
                         .argument(newArgument()
                                 .name("first")
@@ -447,6 +191,15 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                         )
                         .description("Retrieves the events that match the specified filters")
                 )
+                .field(newFieldDefinition()
+                        .type(getOutputTypeFromRegistry("CXS_Segment"))
+                        .name("getSegment")
+                        .argument(newArgument()
+                                .name("segmentId")
+                                .type(GraphQLString)
+                                .description("Unique identifier for the segment")
+                        )
+                )
                 /*
                 .field(newFieldDefinition()
                         .type(new GraphQLList(registeredOutputTypes.get("CXS_ProfileConnection")))
@@ -490,11 +243,11 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                 .name("CXS_Mutation")
                 .description("Root CXS mutation type")
                 .field(newFieldDefinition()
-                        .type(registeredOutputTypes.get(CXSEventType.class.getName()))
+                        .type(getOutputTypeFromRegistry(CXSEventType.class.getName()))
                         .name("createOrUpdateEventType")
                         .argument(newArgument()
                                 .name("eventType")
-                                .type(registeredInputTypes.get(CXSEventTypeInput.class.getName()))
+                                .type(getInputTypeFromRegistry(CXSEventTypeInput.class.getName()))
                         )
                         .description("Create or updates a CXS event type in the Apache Unomi server")
                         .dataFetcher(new DataFetcher<CXSEventType>() {
@@ -533,7 +286,7 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                         .description("Processes events sent to the Context Server")
                         .argument(newArgument()
                                 .name("events")
-                                .type(new GraphQLList(registeredInputTypes.get("CXS_EventInput"))))
+                                .type(new GraphQLList(getInputTypeFromRegistry("CXS_EventInput"))))
                         .type(GraphQLInt)
                 )
                 .build();
@@ -599,146 +352,5 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
         }
     }
 
-    private GraphQLOutputType buildCXSEventOutputType() {
-        return newObject()
-                .name("CXS_Event")
-                .description("An event is generated by user interacting with the Context Server")
-                .field(newFieldDefinition()
-                        .type(GraphQLID)
-                        .name("id")
-                        .description("A unique identifier for the event")
-                        .dataFetcher(new DataFetcher() {
-                            public Object get(DataFetchingEnvironment environment) {
-                                CXSEvent CXSEvent = environment.getSource();
-                                return CXSEvent.getId();
-                            }
-                        })
-                )
-                .field(newFieldDefinition()
-                        .type(GraphQLString)
-                        .name("eventType")
-                        .description("An identifier for the event type")
-                        .dataFetcher(new DataFetcher() {
-                            public Object get(DataFetchingEnvironment environment) {
-                                CXSEvent CXSEvent = environment.getSource();
-                                return CXSEvent.getEventType();
-                            }
-                        })
-                )
-                .field(newFieldDefinition()
-                        .type(GraphQLLong)
-                        .name("timestamp")
-                        .description("The difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.")
-                        .dataFetcher(new DataFetcher() {
-                            public Object get(DataFetchingEnvironment environment) {
-                                CXSEvent CXSEvent = environment.getSource();
-                                return CXSEvent.getTimeStamp();
-                            }
-                        }))
-                .field(newFieldDefinition()
-                        .type(GraphQLString)
-                        .name("subject")
-                        .description("The entity that has fired the event (using the profile)")
-                        .dataFetcher(new DataFetcher() {
-                            public Object get(DataFetchingEnvironment environment) {
-                                CXSEvent CXSEvent = environment.getSource();
-                                return CXSEvent.getSubject();
-                            }
-                        }))
-                .field(newFieldDefinition()
-                        .type(GraphQLString)
-                        .name("object")
-                        .description("The object on which the event was fired.")
-                        .dataFetcher(new DataFetcher() {
-                            public Object get(DataFetchingEnvironment environment) {
-                                CXSEvent CXSEvent = environment.getSource();
-                                return CXSEvent.getObject();
-                            }
-                        })
-                )
-                .field(newFieldDefinition()
-                        .type(registeredOutputTypes.get(CXSGeoPoint.class.getName()))
-                        .name("location")
-                        .description("The geo-point location where the event was fired.")
-                        .dataFetcher(new DataFetcher() {
-                            public Object get(DataFetchingEnvironment environment) {
-                                CXSEvent CXSEvent = environment.getSource();
-                                return CXSEvent.getLocation();
-                            }
-                        })
-                )
-                .field(newFieldDefinition()
-                        .type(new GraphQLList(registeredOutputTypes.get("CXS_EventProperties")))
-                        .name("properties")
-                        .description("Generic properties for the event")
-                        .dataFetcher(new DataFetcher() {
-                            public Object get(DataFetchingEnvironment environment) {
-                                CXSEvent CXSEvent = environment.getSource();
-                                return new ArrayList<Map.Entry<Object,Object>>(CXSEvent.getProperties().entrySet());
-                            }
-                        })
-                )
-                .build();
-    }
-
-    private GraphQLOutputType buildCXSEventPropertiesOutputType() {
-        GraphQLObjectType.Builder eventPropertiesOutputType = newObject()
-                .name("CXS_EventProperties")
-                .description("All possible properties of an event");
-
-        // we create a dummy field because GraphQL requires at least one
-        eventPropertiesOutputType.field(newFieldDefinition()
-                .type(GraphQLInt)
-                .name("typeCount")
-                .description("Total count of different field types")
-        );
-
-        for (Map.Entry<String,CXSEventType> cxsEventTypeEntry : eventTypes.entrySet()) {
-            CXSEventType cxsEventType = cxsEventTypeEntry.getValue();
-            eventPropertiesOutputType
-                    .field(newFieldDefinition()
-                            .type(buildEventOutputType(cxsEventType.typeName, cxsEventType.properties))
-                            .name(cxsEventTypeEntry.getKey())
-                    );
-        }
-
-        return eventPropertiesOutputType.build();
-    }
-
-    private GraphQLOutputType buildEventOutputType(String typeName, List<CXSPropertyType> propertyTypes) {
-        String eventTypeName = typeName.substring(0, 1).toUpperCase() + typeName.substring(1) + "EventType";
-        GraphQLObjectType.Builder eventOutputType = newObject()
-                .name(eventTypeName)
-                .description("Event type object for event type " + typeName);
-
-        for (CXSPropertyType cxsEventPropertyType : propertyTypes) {
-            GraphQLOutputType eventPropertyOutputType = null;
-            if (cxsEventPropertyType instanceof CXSIdentifierPropertyType) {
-                eventPropertyOutputType = GraphQLID;
-            } else if (cxsEventPropertyType instanceof CXSStringPropertyType) {
-                eventPropertyOutputType = GraphQLString;
-            } else if (cxsEventPropertyType instanceof CXSIntPropertyType) {
-                eventPropertyOutputType = GraphQLInt;
-            } else if (cxsEventPropertyType instanceof CXSFloatPropertyType) {
-                eventPropertyOutputType = GraphQLFloat;
-            } else if (cxsEventPropertyType instanceof CXSBooleanPropertyType) {
-                eventPropertyOutputType = GraphQLBoolean;
-            } else if (cxsEventPropertyType instanceof CXSDatePropertyType) {
-                eventPropertyOutputType = GraphQLString;
-            } else if (cxsEventPropertyType instanceof CXSGeoPointPropertyType) {
-                eventPropertyOutputType = registeredOutputTypes.get(CXSGeoPoint.class.getName());
-            } else if (cxsEventPropertyType instanceof CXSSetPropertyType) {
-                eventPropertyOutputType = buildEventOutputType(cxsEventPropertyType.name, ((CXSSetPropertyType)cxsEventPropertyType).properties);
-            }
-            eventOutputType
-                    .field(newFieldDefinition()
-                            .type(eventPropertyOutputType)
-                            .name(cxsEventPropertyType.name)
-                    );
-        }
-
-
-        return eventOutputType.build();
-    }
 
 }
diff --git a/graphql/karaf-feature/pom.xml b/graphql/karaf-feature/pom.xml
index 011e1eb..c61df57 100644
--- a/graphql/karaf-feature/pom.xml
+++ b/graphql/karaf-feature/pom.xml
@@ -27,6 +27,8 @@
     <packaging>feature</packaging>
 
     <artifactId>cxs-graphql-feature</artifactId>
+    <name>Apache Unomi :: GraphQL API :: Karaf Feature</name>
+    <description>Apache Unomi Context GraphQL API Karaf Feature</description>
 
     <dependencies>
 
diff --git a/graphql/pom.xml b/graphql/pom.xml
index bc03766..ea476f6 100644
--- a/graphql/pom.xml
+++ b/graphql/pom.xml
@@ -27,7 +27,7 @@
 
     <artifactId>unomi-graphql</artifactId>
     <name>Apache Unomi :: GraphQL API</name>
-    <description>Apache Unomi Context GraphQL API</description>
+    <description>Apache Unomi Context GraphQL API Root Project</description>
     <packaging>pom</packaging>
 
     <properties>


[unomi] 17/27: 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.

Posted by sh...@apache.org.
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 cfd7a2df7f4edb5a98043bd15a7482712169e288
Author: sergehuber <sh...@jahia.com>
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 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-graphql</artifactId>
-        <version>1.4.0-incubating-SNAPSHOT</version>
+        <version>1.4.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
@@ -76,7 +76,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-api</artifactId>
-            <version>1.4.0-incubating-SNAPSHOT</version>
+            <version>1.4.0-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>
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 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-graphql</artifactId>
-        <version>1.4.0-incubating-SNAPSHOT</version>
+        <version>1.4.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <packaging>feature</packaging>
@@ -59,7 +59,7 @@
         <dependency>
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
-            <version>20.0</version>
+            <version>24.1.1-jre</version>
         </dependency>
         <dependency>
             <groupId>commons-fileupload</groupId>
@@ -82,7 +82,6 @@
             <version>1.0.2</version>
         </dependency>
 
-<!--
         <dependency>
             <groupId>com.graphql-java-kickstart</groupId>
             <artifactId>graphql-java-servlet</artifactId>
@@ -98,7 +97,7 @@
                 </exclusion>
             </exclusions>
         </dependency>
--->
+
         <dependency>
             <groupId>com.graphql-java</groupId>
             <artifactId>graphql-java</artifactId>
@@ -110,17 +109,15 @@
                 </exclusion>
             </exclusions>
         </dependency>
-<!--
         <dependency>
             <groupId>io.github.graphql-java</groupId>
             <artifactId>graphql-java-annotations</artifactId>
             <version>${graphql.java.annotations.version}</version>
         </dependency>
--->
         <dependency>
             <groupId>org.apache.unomi</groupId>
                 <artifactId>cdp-graphql-api-impl</artifactId>
-            <version>1.4.0-incubating-SNAPSHOT</version>
+            <version>1.4.0-SNAPSHOT</version>
         </dependency>
 
     </dependencies>
diff --git a/graphql/pom.xml b/graphql/pom.xml
index 191e642..260f787 100644
--- a/graphql/pom.xml
+++ b/graphql/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-root</artifactId>
-        <version>1.4.0-incubating-SNAPSHOT</version>
+        <version>1.4.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-graphql</artifactId>


[unomi] 08/27: UNOMI-180 Implement CXS GraphQL API Get event type creation to work (partially, the event GraphQL schema types are not yet properly modified)

Posted by sh...@apache.org.
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 8d825f960e2207d8b15ef361bcb7d94dd1cd0254
Author: Serge Huber <sh...@apache.org>
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 <sh...@apache.org>
---
 .../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..0000000
--- 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..0000000
--- 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.annotationTypes.GraphQLField;
-
-public class CXSDatePropertyType extends CXSPropertyType {
-
-    @GraphQLField
-    public String defaultValue;
-
-}
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
index a7c1c2c..2d4c5ae 100644
--- 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
@@ -18,22 +18,46 @@ package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
+import org.apache.unomi.graphql.propertytypes.CXSPropertyType;
 
+import java.util.ArrayList;
 import java.util.List;
 
 @GraphQLName("CXS_EventType")
 public class CXSEventType {
 
-    @GraphQLField
-    public String id;
+    private String id;
+    private String scope;
+    private String typeName;
+    private List<CXSPropertyType> properties = new ArrayList<>();
+
+    public CXSEventType(@GraphQLName("id") String id,
+                        @GraphQLName("scope") String scope,
+                        @GraphQLName("typeName") String typeName,
+                        @GraphQLName("properties") List<CXSPropertyType> properties) {
+        this.id = id;
+        this.scope = scope;
+        this.typeName = typeName;
+        this.properties = properties;
+    }
 
     @GraphQLField
-    public String scope;
+    public String getId() {
+        return id;
+    }
 
     @GraphQLField
-    public String typeName;
+    public String getScope() {
+        return scope;
+    }
 
     @GraphQLField
-    public List<CXSPropertyType> properties;
+    public String getTypeName() {
+        return typeName;
+    }
 
+    @GraphQLField
+    public List<CXSPropertyType> getProperties() {
+        return properties;
+    }
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventTypeInput.java
index b84175f..a6f8200 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventTypeInput.java
@@ -17,20 +17,45 @@
 package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
 
+import java.util.ArrayList;
 import java.util.List;
 
 public class CXSEventTypeInput {
 
+    private String id;
+    private String scope;
+    private String typeName;
+    private List<CXSPropertyTypeInput> properties = new ArrayList<>();
+
+    public CXSEventTypeInput(@GraphQLName("id") String id,
+                             @GraphQLName("scope") String scope,
+                             @GraphQLName("typeName") String typeName,
+                             @GraphQLName("properties") List<CXSPropertyTypeInput> properties) {
+        this.id = id;
+        this.scope = scope;
+        this.typeName = typeName;
+        this.properties = properties;
+    }
+
     @GraphQLField
-    public String id;
+    public String getId() {
+        return id;
+    }
 
     @GraphQLField
-    public String scope;
+    public String getScope() {
+        return scope;
+    }
 
     @GraphQLField
-    public String typeName;
+    public String getTypeName() {
+        return typeName;
+    }
 
     @GraphQLField
-    public List<CXSPropertyTypeInput> properties;
+    public List<CXSPropertyTypeInput> getProperties() {
+        return properties;
+    }
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSFloatPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSFloatPropertyType.java
deleted file mode 100644
index 229b8db..0000000
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSFloatPropertyType.java
+++ /dev/null
@@ -1,30 +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;
-
-public class CXSFloatPropertyType extends CXSPropertyType {
-
-    @GraphQLField
-    public float minValue;
-    @GraphQLField
-    public float maxValue;
-    @GraphQLField
-    public float defaultValue;
-
-}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointPropertyType.java
deleted file mode 100644
index ce218c8..0000000
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointPropertyType.java
+++ /dev/null
@@ -1,25 +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;
-
-public class CXSGeoPointPropertyType extends CXSPropertyType {
-
-    @GraphQLField
-    public String defaultValue;
-}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIdentifierPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIdentifierPropertyType.java
deleted file mode 100644
index 11f0742..0000000
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIdentifierPropertyType.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;
-
-public class CXSIdentifierPropertyType extends CXSPropertyType {
-
-    @GraphQLField
-    public String regexp;
-    @GraphQLField
-    public String defaultValue;
-
-}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIntPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIntPropertyType.java
deleted file mode 100644
index c7c904f..0000000
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIntPropertyType.java
+++ /dev/null
@@ -1,30 +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;
-
-public class CXSIntPropertyType extends CXSPropertyType {
-
-    @GraphQLField
-    public int minValue;
-    @GraphQLField
-    public int maxValue;
-    @GraphQLField
-    public int defaultValue;
-
-}
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 e3a4dce..9732de4 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
@@ -19,6 +19,10 @@ package org.apache.unomi.graphql;
 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 java.util.ArrayList;
 import java.util.List;
@@ -26,19 +30,21 @@ import java.util.List;
 @GraphQLName("CXS_Mutation")
 public class CXSMutation {
 
+    CXSGraphQLProvider cxsGraphQLProvider;
+
+    public CXSMutation(CXSGraphQLProvider cxsGraphQLProvider) {
+        this.cxsGraphQLProvider = cxsGraphQLProvider;
+    }
+
     @GraphQLField
     public CXSEventType createOrUpdateEventType(DataFetchingEnvironment env, @GraphQLName("eventType") CXSEventTypeInput cxsEventTypeInput) {
 
-        CXSGraphQLProvider cxsGraphQLProvider = null;
-        CXSEventType cxsEventType = new CXSEventType();
-        cxsEventType.id = cxsEventTypeInput.id;
-        cxsEventType.typeName = cxsEventTypeInput.scope;
-        cxsEventType.properties = new ArrayList<>();
-        for (CXSPropertyTypeInput propertyTypeInput : cxsEventTypeInput.properties) {
+        CXSEventType cxsEventType = new CXSEventType(cxsEventTypeInput.getId(), cxsEventTypeInput.getScope(), cxsEventTypeInput.getTypeName(), new ArrayList<>());
+        for (CXSPropertyTypeInput propertyTypeInput : cxsEventTypeInput.getProperties()) {
             CXSPropertyType propertyType = getPropertyType(propertyTypeInput);
-            cxsEventType.properties.add(propertyType);
+            cxsEventType.getProperties().add(propertyType);
         }
-        cxsGraphQLProvider.getEventTypes().put(cxsEventType.typeName, cxsEventType);
+        cxsGraphQLProvider.getEventTypes().put(cxsEventType.getTypeName(), cxsEventType);
         cxsGraphQLProvider.updateGraphQLTypes();
         if (cxsGraphQLProvider.getCxsProviderManager() != null) {
             cxsGraphQLProvider.getCxsProviderManager().refreshProviders();
@@ -65,49 +71,53 @@ public class CXSMutation {
     }
 
     private CXSPropertyType getSetPropertyType(CXSSetPropertyTypeInput cxsSetPropertyTypeInput) {
-        CXSSetPropertyType cxsSetPropertyType = new CXSSetPropertyType();
-
-        populateCommonProperties(cxsSetPropertyTypeInput, cxsSetPropertyType);
-        if (cxsSetPropertyTypeInput.properties != null) {
-            List<CXSPropertyType> setProperties = new ArrayList<>();
-            for (CXSPropertyTypeInput setProperty : cxsSetPropertyTypeInput.properties) {
+        List<CXSPropertyType> setProperties = null;
+        if (cxsSetPropertyTypeInput.getProperties() != null) {
+            setProperties = new ArrayList<>();
+            for (CXSPropertyTypeInput setProperty : cxsSetPropertyTypeInput.getProperties()) {
                 CXSPropertyType subPropertyType = getPropertyType(setProperty);
                 if (subPropertyType != null) {
                     setProperties.add(subPropertyType);
                 }
             }
-            cxsSetPropertyType.properties = setProperties;
         }
-        return cxsSetPropertyType;
+        return new CXSSetPropertyType(
+                cxsSetPropertyTypeInput.getId(),
+                cxsSetPropertyTypeInput.getName(),
+                cxsSetPropertyTypeInput.getMinOccurrences(),
+                cxsSetPropertyTypeInput.getMaxOccurrences(),
+                cxsSetPropertyTypeInput.getTags(),
+                cxsSetPropertyTypeInput.getSystemTags(),
+                cxsSetPropertyTypeInput.isPersonalData(),
+                setProperties);
     }
 
     private CXSPropertyType getStringPropertyType(CXSStringPropertyType stringPropertyType) {
-        CXSStringPropertyType cxsStringPropertyType = new CXSStringPropertyType();
-        populateCommonProperties(stringPropertyType, cxsStringPropertyType);
-        cxsStringPropertyType.defaultValue = stringPropertyType.defaultValue;
-        cxsStringPropertyType.regexp = stringPropertyType.regexp;
-        return cxsStringPropertyType;
+        return new CXSStringPropertyType(
+                stringPropertyType.getId(),
+                stringPropertyType.getName(),
+                stringPropertyType.getMinOccurrences(),
+                stringPropertyType.getMaxOccurrences(),
+                stringPropertyType.getTags(),
+                stringPropertyType.getSystemTags(),
+                stringPropertyType.isPersonalData(),
+                stringPropertyType.getRegexp(),
+                stringPropertyType.getDefaultValue()
+                );
     }
 
     private CXSPropertyType getIdentifierPropertyType(CXSIdentifierPropertyType identifierPropertyType) {
-        CXSIdentifierPropertyType cxsIdentifierPropertyType = new CXSIdentifierPropertyType();
-        populateCommonProperties(identifierPropertyType, cxsIdentifierPropertyType);
-        cxsIdentifierPropertyType.defaultValue = identifierPropertyType.defaultValue;
-        cxsIdentifierPropertyType.regexp = identifierPropertyType.regexp;
-        return cxsIdentifierPropertyType;
-    }
-
-    private void populateCommonProperties(CXSPropertyType source, CXSPropertyType destination) {
-        if (source == null) {
-            return;
-        }
-        destination.id = source.id;
-        destination.name = source.name;
-        destination.personalData = source.personalData;
-        destination.systemTags = source.systemTags;
-        destination.tags = source.tags;
-        destination.minOccurrences = source.minOccurrences;
-        destination.maxOccurrences = source.maxOccurrences;
+        return new CXSIdentifierPropertyType(
+                identifierPropertyType.getId(),
+                identifierPropertyType.getName(),
+                identifierPropertyType.getMinOccurrences(),
+                identifierPropertyType.getMaxOccurrences(),
+                identifierPropertyType.getTags(),
+                identifierPropertyType.getSystemTags(),
+                identifierPropertyType.isPersonalData(),
+                identifierPropertyType.getRegexp(),
+                identifierPropertyType.getDefaultValue()
+        );
     }
 
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyType.java
deleted file mode 100644
index 641eff4..0000000
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyType.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 CXSPropertyType {
-
-    @GraphQLField
-    public String id;
-    @GraphQLField
-    public String name;
-    @GraphQLField
-    public int minOccurrences;
-    @GraphQLField
-    public int maxOccurrences;
-    @GraphQLField
-    public List<String> tags;
-    @GraphQLField
-    public List<String> systemTags;
-    @GraphQLField
-    public boolean personalData;
-
-}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java
index 48eadec..dda0ea4 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java
@@ -18,10 +18,30 @@ package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
+import org.apache.unomi.graphql.propertytypes.*;
 
 @GraphQLName("CXSPropertyTypeInput")
 public class CXSPropertyTypeInput {
 
+    public CXSPropertyTypeInput(
+            @GraphQLName("identifier") CXSIdentifierPropertyType identifierPropertyTypeInput,
+            @GraphQLName("string") CXSStringPropertyType stringPropertyTypeInput,
+            @GraphQLName("int") CXSIntPropertyType integerPropertyTypeInput,
+            @GraphQLName("float") CXSFloatPropertyType floatPropertyTypeInput,
+            @GraphQLName("date") CXSDatePropertyType datePropertyTypeInput,
+            @GraphQLName("boolean") CXSBooleanPropertyType booleanPropertyTypeInput,
+            @GraphQLName("geopoint") CXSGeoPointPropertyType geoPointPropertyTypeInput,
+            @GraphQLName("set") CXSSetPropertyTypeInput setPropertyTypeInput) {
+        this.identifierPropertyTypeInput = identifierPropertyTypeInput;
+        this.stringPropertyTypeInput = stringPropertyTypeInput;
+        this.integerPropertyTypeInput = integerPropertyTypeInput;
+        this.floatPropertyTypeInput = floatPropertyTypeInput;
+        this.datePropertyTypeInput = datePropertyTypeInput;
+        this.booleanPropertyTypeInput = booleanPropertyTypeInput;
+        this.geoPointPropertyTypeInput = geoPointPropertyTypeInput;
+        this.setPropertyTypeInput = setPropertyTypeInput;
+    }
+
     @GraphQLField
     @GraphQLName("identifier")
     public CXSIdentifierPropertyType identifierPropertyTypeInput;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyType.java
deleted file mode 100644
index 3c054ae..0000000
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyType.java
+++ /dev/null
@@ -1,27 +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 CXSSetPropertyType extends CXSPropertyType {
-
-    @GraphQLField
-    public List<CXSPropertyType> properties;
-}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java
index 2f0de04..8f32019 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java
@@ -17,12 +17,29 @@
 package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
+import org.apache.unomi.graphql.propertytypes.CXSPropertyType;
 
 import java.util.List;
 
 public class CXSSetPropertyTypeInput extends CXSPropertyType {
 
-    @GraphQLField
-    public List<CXSPropertyTypeInput> properties;
+    private List<CXSPropertyTypeInput> properties;
+
+    public CXSSetPropertyTypeInput(@GraphQLName("id") String id,
+                                   @GraphQLName("name") String name,
+                                   @GraphQLName("minOccurrences") Integer minOccurrences,
+                                   @GraphQLName("maxOccurrences") Integer maxOccurrences,
+                                   @GraphQLName("tags") List<String> tags,
+                                   @GraphQLName("systemTags") List<String> systemTags,
+                                   @GraphQLName("personalData") Boolean personalData,
+                                   @GraphQLName("properties") List<CXSPropertyTypeInput> properties) {
+        super(id, name, minOccurrences, maxOccurrences, tags, systemTags, personalData);
+        this.properties = properties;
+    }
 
+    @GraphQLField
+    public List<CXSPropertyTypeInput> getProperties() {
+        return properties;
+    }
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSStringPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSStringPropertyType.java
deleted file mode 100644
index 2a4ef90..0000000
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSStringPropertyType.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;
-
-public class CXSStringPropertyType extends CXSPropertyType {
-
-    @GraphQLField
-    public String regexp;
-    @GraphQLField
-    public String defaultValue;
-
-}
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 bc1d4f7..da5546a 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
@@ -20,6 +20,7 @@ import graphql.annotations.processor.GraphQLAnnotationsComponent;
 import graphql.annotations.processor.ProcessingElementsContainer;
 import graphql.schema.*;
 import org.apache.unomi.graphql.*;
+import org.apache.unomi.graphql.propertytypes.*;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -116,7 +117,7 @@ public class CXSEventBuilders implements CXSBuilder {
 
     private void generateEventTypesFilters(GraphQLInputObjectType.Builder cxsEventPropertiesFilterInput) {
         for (Map.Entry<String,CXSEventType> eventTypeEntry : eventTypes.entrySet()) {
-            addSetFilters(eventTypeEntry.getKey(), eventTypeEntry.getValue().properties, cxsEventPropertiesFilterInput);
+            addSetFilters(eventTypeEntry.getKey(), eventTypeEntry.getValue().getProperties(), cxsEventPropertiesFilterInput);
         }
     }
 
@@ -127,21 +128,21 @@ public class CXSEventBuilders implements CXSBuilder {
 
         for (CXSPropertyType cxsPropertyType : properties) {
             if (cxsPropertyType instanceof CXSIdentifierPropertyType) {
-                addIdentityFilters(cxsPropertyType.name, eventTypeFilterInput);
+                addIdentityFilters(cxsPropertyType.getName(), eventTypeFilterInput);
             } else if (cxsPropertyType instanceof CXSStringPropertyType) {
-                addStringFilters(cxsPropertyType.name, eventTypeFilterInput);
+                addStringFilters(cxsPropertyType.getName(), eventTypeFilterInput);
             } else if (cxsPropertyType instanceof CXSBooleanPropertyType) {
-                addBooleanFilters(cxsPropertyType.name, eventTypeFilterInput);
+                addBooleanFilters(cxsPropertyType.getName(), eventTypeFilterInput);
             } else if (cxsPropertyType instanceof CXSIntPropertyType) {
-                addIntegerFilters(cxsPropertyType.name, eventTypeFilterInput);
+                addIntegerFilters(cxsPropertyType.getName(), eventTypeFilterInput);
             } else if (cxsPropertyType instanceof CXSFloatPropertyType) {
-                addFloatFilters(cxsPropertyType.name, eventTypeFilterInput);
+                addFloatFilters(cxsPropertyType.getName(), eventTypeFilterInput);
             } else if (cxsPropertyType instanceof CXSGeoPointPropertyType) {
-                addDistanceFilters(cxsPropertyType.name, eventTypeFilterInput);
+                addDistanceFilters(cxsPropertyType.getName(), eventTypeFilterInput);
             } else if (cxsPropertyType instanceof CXSDatePropertyType) {
-                addDateFilters(cxsPropertyType.name, eventTypeFilterInput);
+                addDateFilters(cxsPropertyType.getName(), eventTypeFilterInput);
             } else if (cxsPropertyType instanceof CXSSetPropertyType) {
-                addSetFilters(cxsPropertyType.name, ((CXSSetPropertyType) cxsPropertyType).properties, eventTypeFilterInput);
+                addSetFilters(cxsPropertyType.getName(), ((CXSSetPropertyType) cxsPropertyType).getProperties(), eventTypeFilterInput);
             }
         }
 
@@ -287,7 +288,7 @@ public class CXSEventBuilders implements CXSBuilder {
             CXSEventType cxsEventType = cxsEventTypeEntry.getValue();
             cxsEventInputType.field(newInputObjectField()
                     .name(cxsEventTypeEntry.getKey())
-                    .type(buildCXSEventTypeInputProperty(cxsEventType.typeName, cxsEventType.properties))
+                    .type(buildCXSEventTypeInputProperty(cxsEventType.getTypeName(), cxsEventType.getProperties()))
             );
         }
 
@@ -318,12 +319,12 @@ public class CXSEventBuilders implements CXSBuilder {
             } else if (cxsEventPropertyType instanceof CXSGeoPointPropertyType) {
                 eventPropertyInputType = (GraphQLInputType) typeRegistry.get(CXSGeoPoint.class.getName());
             } else if (cxsEventPropertyType instanceof CXSSetPropertyType) {
-                eventPropertyInputType = buildCXSEventTypeInputProperty(cxsEventPropertyType.name, ((CXSSetPropertyType)cxsEventPropertyType).properties);
+                eventPropertyInputType = buildCXSEventTypeInputProperty(cxsEventPropertyType.getName(), ((CXSSetPropertyType)cxsEventPropertyType).getProperties());
             }
             eventInputType
                     .field(newInputObjectField()
                             .type(eventPropertyInputType)
-                            .name(cxsEventPropertyType.name)
+                            .name(cxsEventPropertyType.getName())
                     );
         }
 
@@ -428,7 +429,7 @@ public class CXSEventBuilders implements CXSBuilder {
             CXSEventType cxsEventType = cxsEventTypeEntry.getValue();
             eventPropertiesOutputType
                     .field(newFieldDefinition()
-                            .type(buildEventOutputType(cxsEventType.typeName, cxsEventType.properties))
+                            .type(buildEventOutputType(cxsEventType.getTypeName(), cxsEventType.getProperties()))
                             .name(cxsEventTypeEntry.getKey())
                     );
         }
@@ -459,12 +460,12 @@ public class CXSEventBuilders implements CXSBuilder {
             } else if (cxsEventPropertyType instanceof CXSGeoPointPropertyType) {
                 eventPropertyOutputType = (GraphQLOutputType) typeRegistry.get(CXSGeoPoint.class.getName());
             } else if (cxsEventPropertyType instanceof CXSSetPropertyType) {
-                eventPropertyOutputType = buildEventOutputType(cxsEventPropertyType.name, ((CXSSetPropertyType)cxsEventPropertyType).properties);
+                eventPropertyOutputType = buildEventOutputType(cxsEventPropertyType.getName(), ((CXSSetPropertyType)cxsEventPropertyType).getProperties());
             }
             eventOutputType
                     .field(newFieldDefinition()
                             .type(eventPropertyOutputType)
-                            .name(cxsEventPropertyType.name)
+                            .name(cxsEventPropertyType.getName())
                     );
         }
 
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 a3c299d..949f51e 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
@@ -24,6 +24,7 @@ import graphql.servlet.GraphQLQueryProvider;
 import graphql.servlet.GraphQLTypesProvider;
 import org.apache.unomi.graphql.*;
 import org.apache.unomi.graphql.builders.CXSEventBuilders;
+import org.apache.unomi.graphql.propertytypes.CXSSetPropertyType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -113,12 +114,13 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                 .type(getOutputTypeFromRegistry("CXS_Query"))
                 .name("cxs")
                 .description("Root field for all CXS queries")
+                /*
                 .dataFetcher(new DataFetcher() {
                     public Object get(DataFetchingEnvironment environment) {
                         Map<String,Object> map = environment.getContext();
                         return map.keySet();
                     }
-                }).build());
+                })*/.build());
         return fieldDefinitions;
     }
 
@@ -130,15 +132,15 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
     @Override
     public Collection<GraphQLFieldDefinition> getMutations() {
         List<GraphQLFieldDefinition> fieldDefinitions = new ArrayList<GraphQLFieldDefinition>();
+        final CXSGraphQLProvider cxsGraphQLProvider = this;
         fieldDefinitions.add(newFieldDefinition()
                 .type(getOutputTypeFromRegistry("CXS_Mutation"))
                 .name("cxs")
                 .description("Root field for all CXS mutations")
-                .dataFetcher(new DataFetcher<Object>() {
+                .dataFetcher(new DataFetcher<CXSGraphQLProvider>() {
                     @Override
-                    public Object get(DataFetchingEnvironment environment) {
-                        Object contextObject = environment.getContext();
-                        return contextObject;
+                    public CXSGraphQLProvider get(DataFetchingEnvironment environment) {
+                        return cxsGraphQLProvider;
                     }
                 }).build());
         return fieldDefinitions;
@@ -238,119 +240,4 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                 .build();
     }
 
-    private GraphQLOutputType buildCXSMutationOutputType() {
-        return newObject()
-                .name("CXS_Mutation")
-                .description("Root CXS mutation type")
-                .field(newFieldDefinition()
-                        .type(getOutputTypeFromRegistry(CXSEventType.class.getName()))
-                        .name("createOrUpdateEventType")
-                        .argument(newArgument()
-                                .name("eventType")
-                                .type(getInputTypeFromRegistry(CXSEventTypeInput.class.getName()))
-                        )
-                        .description("Create or updates a CXS event type in the Apache Unomi server")
-                        .dataFetcher(new DataFetcher<CXSEventType>() {
-                            @Override
-                            public CXSEventType get(DataFetchingEnvironment environment) {
-                                Map<String,Object> arguments = environment.getArguments();
-                                CXSEventType cxsEventType = new CXSEventType();
-                                if (arguments.containsKey("eventType")) {
-                                    Map<String,Object> eventTypeArguments = (Map<String,Object>) arguments.get("eventType");
-                                    if (eventTypeArguments.containsKey("typeName")) {
-                                        cxsEventType.id = (String) eventTypeArguments.get("typeName");
-                                        cxsEventType.typeName = (String) eventTypeArguments.get("typeName");
-                                    }
-                                    cxsEventType.properties = new ArrayList<>();
-                                    if (eventTypeArguments.containsKey("properties")) {
-                                        List<Map<String, Object>> properties = (List<Map<String, Object>>) eventTypeArguments.get("properties");
-                                        for (Map<String, Object> propertyTypeMap : properties) {
-                                            CXSPropertyType cxsPropertyType = getPropertyType(propertyTypeMap);
-                                            if (cxsPropertyType != null) {
-                                                cxsEventType.properties.add(cxsPropertyType);
-                                            }
-                                        }
-                                    }
-                                }
-                                eventTypes.put(cxsEventType.typeName, cxsEventType);
-                                updateGraphQLTypes();
-                                if (cxsProviderManager != null) {
-                                    cxsProviderManager.refreshProviders();
-                                }
-                                return cxsEventType;
-                            }
-                        })
-                )
-                .field(newFieldDefinition()
-                        .name("processEvents")
-                        .description("Processes events sent to the Context Server")
-                        .argument(newArgument()
-                                .name("events")
-                                .type(new GraphQLList(getInputTypeFromRegistry("CXS_EventInput"))))
-                        .type(GraphQLInt)
-                )
-                .build();
-    }
-
-    private CXSPropertyType getPropertyType(Map<String, Object> propertyTypeMap) {
-        if (propertyTypeMap.size() > 1) {
-            logger.error("Only one property type is allowed for each property !");
-            return null;
-        }
-        CXSPropertyType propertyType = null;
-        if (propertyTypeMap.containsKey("identifier")) {
-            propertyType = getIdentifierPropertyType(propertyTypeMap);
-        } else if (propertyTypeMap.containsKey("string")) {
-            propertyType = getStringPropertyType(propertyTypeMap);
-        } else if (propertyTypeMap.containsKey("set")) {
-            propertyType = getSetPropertyType(propertyTypeMap);
-        }
-        return propertyType;
-    }
-
-    private CXSPropertyType getSetPropertyType(Map<String, Object> propertyTypeMap) {
-        CXSSetPropertyType cxsSetPropertyType = new CXSSetPropertyType();
-        Map<String,Object> setPropertyTypeMap = (Map<String,Object>) propertyTypeMap.get("set");
-        populateCommonProperties(setPropertyTypeMap, cxsSetPropertyType);
-        if (setPropertyTypeMap.containsKey("properties")) {
-            List<Map<String,Object>> propertyList = (List<Map<String,Object>>) setPropertyTypeMap.get("properties");
-            List<CXSPropertyType> setProperties = new ArrayList<>();
-            for (Map<String,Object> setProperty : propertyList) {
-                CXSPropertyType subPropertyType = getPropertyType(setProperty);
-                if (subPropertyType != null) {
-                    setProperties.add(subPropertyType);
-                }
-            }
-            cxsSetPropertyType.properties = setProperties;
-        }
-        return cxsSetPropertyType;
-    }
-
-    private CXSPropertyType getStringPropertyType(Map<String, Object> propertyTypeMap) {
-        CXSStringPropertyType cxsStringPropertyType = new CXSStringPropertyType();
-        Map<String,Object> stringPropertyTypeMap = (Map<String,Object>) propertyTypeMap.get("string");
-        populateCommonProperties(stringPropertyTypeMap, cxsStringPropertyType);
-        return cxsStringPropertyType;
-    }
-
-    private CXSPropertyType getIdentifierPropertyType(Map<String, Object> propertyTypeMap) {
-        CXSIdentifierPropertyType cxsIdentifierPropertyType = new CXSIdentifierPropertyType();
-        Map<String,Object> identifierPropertyTypeMap = (Map<String,Object>) propertyTypeMap.get("identifier");
-        populateCommonProperties(identifierPropertyTypeMap, cxsIdentifierPropertyType);
-        return cxsIdentifierPropertyType;
-    }
-
-    private void populateCommonProperties(Map<String, Object> propertyTypeMap, CXSPropertyType cxsPropertyType) {
-        if (propertyTypeMap == null || propertyTypeMap.size() == 0) {
-            return;
-        }
-        if (propertyTypeMap.containsKey("id")) {
-            cxsPropertyType.id = (String) propertyTypeMap.get("id");
-        }
-        if (propertyTypeMap.containsKey("name")) {
-            cxsPropertyType.name = (String) propertyTypeMap.get("name");
-        }
-    }
-
-
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSProviderManagerImpl.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSProviderManagerImpl.java
index bb00d54..99d9d1f 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSProviderManagerImpl.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSProviderManagerImpl.java
@@ -17,7 +17,6 @@
 package org.apache.unomi.graphql.internal;
 
 import graphql.annotations.processor.GraphQLAnnotationsComponent;
-import graphql.annotations.processor.ProcessingElementsContainer;
 import graphql.servlet.GraphQLMutationProvider;
 import graphql.servlet.GraphQLQueryProvider;
 import graphql.servlet.GraphQLTypesProvider;
@@ -41,7 +40,6 @@ public class CXSProviderManagerImpl implements CXSProviderManager {
 
     private CXSGraphQLProvider cxsGraphQLProvider;
     private GraphQLAnnotationsComponent annotationsComponent;
-    private ProcessingElementsContainer container;
     private ServiceRegistration<?> providerSR;
     private BundleContext bundleContext;
 
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSBooleanPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSBooleanPropertyType.java
new file mode 100644
index 0000000..75bc309
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSBooleanPropertyType.java
@@ -0,0 +1,51 @@
+/*
+ * 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.propertytypes;
+
+import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
+
+import java.util.List;
+
+@GraphQLName("CXSBooleanPropertyType")
+public class CXSBooleanPropertyType extends CXSPropertyType {
+
+    private Boolean defaultValue;
+
+    public CXSBooleanPropertyType(@GraphQLName("id") String id,
+                                  @GraphQLName("name") String name,
+                                  @GraphQLName("minOccurrences") Integer minOccurrences,
+                                  @GraphQLName("maxOccurrences") Integer maxOccurrences,
+                                  @GraphQLName("tags") List<String> tags,
+                                  @GraphQLName("systemTags") List<String> systemTags,
+                                  @GraphQLName("personalData") Boolean personalData,
+                                  @GraphQLName("defaultValue") Boolean defaultValue) {
+        super(id, name, minOccurrences, maxOccurrences, tags, systemTags, personalData);
+        this.defaultValue = defaultValue;
+    }
+
+    public CXSBooleanPropertyType(CXSPropertyType input, Boolean defaultValue) {
+        super(input);
+        this.defaultValue = defaultValue;
+    }
+
+    @GraphQLField
+    @GraphQLName("defaultValue")
+    public Boolean isDefaultValue() {
+        return defaultValue;
+    }
+}
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/propertytypes/CXSDatePropertyType.java
similarity index 50%
copy from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventType.java
copy to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSDatePropertyType.java
index a7c1c2c..4b4b403 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSDatePropertyType.java
@@ -14,26 +14,31 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.propertytypes;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_EventType")
-public class CXSEventType {
+public class CXSDatePropertyType extends CXSPropertyType {
 
-    @GraphQLField
-    public String id;
+    private String defaultValue;
 
-    @GraphQLField
-    public String scope;
+    public CXSDatePropertyType(@GraphQLName("id") String id,
+                               @GraphQLName("name") String name,
+                               @GraphQLName("minOccurrences") Integer minOccurrences,
+                               @GraphQLName("maxOccurrences") Integer maxOccurrences,
+                               @GraphQLName("tags") List<String> tags,
+                               @GraphQLName("systemTags") List<String> systemTags,
+                               @GraphQLName("personalData") Boolean personalData,
+                               @GraphQLName("defaultValue") String defaultValue) {
+        super(id, name, minOccurrences, maxOccurrences, tags, systemTags, personalData);
+        this.defaultValue = defaultValue;
+    }
 
     @GraphQLField
-    public String typeName;
-
-    @GraphQLField
-    public List<CXSPropertyType> properties;
-
+    public String getDefaultValue() {
+        return defaultValue;
+    }
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSFloatPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSFloatPropertyType.java
new file mode 100644
index 0000000..6a37058
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSFloatPropertyType.java
@@ -0,0 +1,60 @@
+/*
+ * 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.propertytypes;
+
+import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
+
+import java.util.List;
+
+public class CXSFloatPropertyType extends CXSPropertyType {
+
+    private Float minValue;
+    private Float maxValue;
+    private Float defaultValue;
+
+    public CXSFloatPropertyType(@GraphQLName("id") String id,
+                                @GraphQLName("name") String name,
+                                @GraphQLName("minOccurrences") Integer minOccurrences,
+                                @GraphQLName("maxOccurrences") Integer maxOccurrences,
+                                @GraphQLName("tags") List<String> tags,
+                                @GraphQLName("systemTags") List<String> systemTags,
+                                @GraphQLName("personalData") Boolean personalData,
+                                @GraphQLName("minValue") Float minValue,
+                                @GraphQLName("maxValue") Float maxValue,
+                                @GraphQLName("defaultValue") Float defaultValue) {
+        super(id, name, minOccurrences, maxOccurrences, tags, systemTags, personalData);
+        this.minValue = minValue;
+        this.maxValue = maxValue;
+        this.defaultValue = defaultValue;
+    }
+
+    @GraphQLField
+    public Float getMinValue() {
+        return minValue;
+    }
+
+    @GraphQLField
+    public Float getMaxValue() {
+        return maxValue;
+    }
+
+    @GraphQLField
+    public Float getDefaultValue() {
+        return defaultValue;
+    }
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSGeoPointPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSGeoPointPropertyType.java
new file mode 100644
index 0000000..94f2d97
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSGeoPointPropertyType.java
@@ -0,0 +1,44 @@
+/*
+ * 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.propertytypes;
+
+import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
+
+import java.util.List;
+
+public class CXSGeoPointPropertyType extends CXSPropertyType {
+
+    private String defaultValue;
+
+    public CXSGeoPointPropertyType(@GraphQLName("id") String id,
+                                   @GraphQLName("name") String name,
+                                   @GraphQLName("minOccurrences") Integer minOccurrences,
+                                   @GraphQLName("maxOccurrences") Integer maxOccurrences,
+                                   @GraphQLName("tags") List<String> tags,
+                                   @GraphQLName("systemTags") List<String> systemTags,
+                                   @GraphQLName("personalData") Boolean personalData,
+                                   @GraphQLName("defaultValue") String defaultValue) {
+        super(id, name, minOccurrences, maxOccurrences, tags, systemTags, personalData);
+        this.defaultValue = defaultValue;
+    }
+
+    @GraphQLField
+    public String getDefaultValue() {
+        return defaultValue;
+    }
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIdentifierPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIdentifierPropertyType.java
new file mode 100644
index 0000000..7207740
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIdentifierPropertyType.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.propertytypes;
+
+import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
+
+import java.util.List;
+
+public class CXSIdentifierPropertyType extends CXSPropertyType {
+
+    private String regexp;
+    private String defaultValue;
+
+    public CXSIdentifierPropertyType(@GraphQLName("id") String id,
+                                     @GraphQLName("name") String name,
+                                     @GraphQLName("minOccurrences") Integer minOccurrences,
+                                     @GraphQLName("maxOccurrences") Integer maxOccurrences,
+                                     @GraphQLName("tags") List<String> tags,
+                                     @GraphQLName("systemTags") List<String> systemTags,
+                                     @GraphQLName("personalData") Boolean personalData,
+                                     @GraphQLName("regexp") String regexp,
+                                     @GraphQLName("defaultValue") String defaultValue) {
+        super(id, name, minOccurrences, maxOccurrences, tags, systemTags, personalData);
+        this.regexp = regexp;
+        this.defaultValue = defaultValue;
+    }
+
+    @GraphQLField
+    public String getRegexp() {
+        return regexp;
+    }
+
+    @GraphQLField
+    public String getDefaultValue() {
+        return defaultValue;
+    }
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIntPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIntPropertyType.java
new file mode 100644
index 0000000..96c3322
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIntPropertyType.java
@@ -0,0 +1,60 @@
+/*
+ * 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.propertytypes;
+
+import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
+
+import java.util.List;
+
+public class CXSIntPropertyType extends CXSPropertyType {
+
+    private Integer minValue;
+    private Integer maxValue;
+    private Integer defaultValue;
+
+    public CXSIntPropertyType(@GraphQLName("id") String id,
+                              @GraphQLName("name") String name,
+                              @GraphQLName("minOccurrences") Integer minOccurrences,
+                              @GraphQLName("maxOccurrences") Integer maxOccurrences,
+                              @GraphQLName("tags") List<String> tags,
+                              @GraphQLName("systemTags") List<String> systemTags,
+                              @GraphQLName("personalData") Boolean personalData,
+                              @GraphQLName("minValue") Integer minValue,
+                              @GraphQLName("maxValue") Integer maxValue,
+                              @GraphQLName("defaultValue") Integer defaultValue) {
+        super(id, name, minOccurrences, maxOccurrences, tags, systemTags, personalData);
+        this.minValue = minValue;
+        this.maxValue = maxValue;
+        this.defaultValue = defaultValue;
+    }
+
+    @GraphQLField
+    public Integer getMinValue() {
+        return minValue;
+    }
+
+    @GraphQLField
+    public Integer getMaxValue() {
+        return maxValue;
+    }
+
+    @GraphQLField
+    public Integer getDefaultValue() {
+        return defaultValue;
+    }
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSPropertyType.java
new file mode 100644
index 0000000..28aaf7e
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSPropertyType.java
@@ -0,0 +1,94 @@
+/*
+ * 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.propertytypes;
+
+import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
+
+import java.util.List;
+
+public class CXSPropertyType {
+
+    private String id;
+    private String name;
+    private Integer minOccurrences;
+    private Integer maxOccurrences;
+    private List<String> tags;
+    private List<String> systemTags;
+    private Boolean personalData;
+
+    public CXSPropertyType(@GraphQLName("id") String id,
+                           @GraphQLName("name") String name,
+                           @GraphQLName("minOccurrences") Integer minOccurrences,
+                           @GraphQLName("maxOccurrences") Integer maxOccurrences,
+                           @GraphQLName("tags") List<String> tags,
+                           @GraphQLName("systemTags") List<String> systemTags,
+                           @GraphQLName("personalData") Boolean personalData) {
+        this.id = id;
+        this.name = name;
+        this.minOccurrences = minOccurrences;
+        this.maxOccurrences = maxOccurrences;
+        this.tags = tags;
+        this.systemTags = systemTags;
+        this.personalData = personalData;
+    }
+
+    public CXSPropertyType(CXSPropertyType input) {
+        this.id = input.id;
+        this.name = input.name;
+        this.minOccurrences = input.minOccurrences;
+        this.maxOccurrences = input.maxOccurrences;
+        this.tags = input.tags;
+        this.systemTags = input.systemTags;
+        this.personalData = input.personalData;
+    }
+
+    @GraphQLField
+    public String getId() {
+        return id;
+    }
+
+    @GraphQLField
+    public String getName() {
+        return name;
+    }
+
+    @GraphQLField
+    public Integer getMinOccurrences() {
+        return minOccurrences;
+    }
+
+    @GraphQLField
+    public Integer getMaxOccurrences() {
+        return maxOccurrences;
+    }
+
+    @GraphQLField
+    public List<String> getTags() {
+        return tags;
+    }
+
+    @GraphQLField
+    public List<String> getSystemTags() {
+        return systemTags;
+    }
+
+    @GraphQLField
+    public Boolean isPersonalData() {
+        return personalData;
+    }
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSSetPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSSetPropertyType.java
new file mode 100644
index 0000000..25e796c
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSSetPropertyType.java
@@ -0,0 +1,44 @@
+/*
+ * 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.propertytypes;
+
+import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
+
+import java.util.List;
+
+public class CXSSetPropertyType extends CXSPropertyType {
+
+    private List<CXSPropertyType> properties;
+
+    public CXSSetPropertyType(@GraphQLName("id") String id,
+                              @GraphQLName("name") String name,
+                              @GraphQLName("minOccurrences") Integer minOccurrences,
+                              @GraphQLName("maxOccurrences") Integer maxOccurrences,
+                              @GraphQLName("tags") List<String> tags,
+                              @GraphQLName("systemTags") List<String> systemTags,
+                              @GraphQLName("personalData") Boolean personalData,
+                              @GraphQLName("properties") List<CXSPropertyType> properties) {
+        super(id, name, minOccurrences, maxOccurrences, tags, systemTags, personalData);
+        this.properties = properties;
+    }
+
+    @GraphQLField
+    public List<CXSPropertyType> getProperties() {
+        return properties;
+    }
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSStringPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSStringPropertyType.java
new file mode 100644
index 0000000..7736d09
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSStringPropertyType.java
@@ -0,0 +1,53 @@
+/*
+ * 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.propertytypes;
+
+import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
+
+import java.util.List;
+
+public class CXSStringPropertyType extends CXSPropertyType {
+
+    private String regexp;
+    private String defaultValue;
+
+    public CXSStringPropertyType(@GraphQLName("id") String id,
+                                 @GraphQLName("name") String name,
+                                 @GraphQLName("minOccurrences") Integer minOccurrences,
+                                 @GraphQLName("maxOccurrences") Integer maxOccurrences,
+                                 @GraphQLName("tags") List<String> tags,
+                                 @GraphQLName("systemTags") List<String> systemTags,
+                                 @GraphQLName("personalData") Boolean personalData,
+                                 @GraphQLName("regexp") String regexp,
+                                 @GraphQLName("defaultValue") String defaultValue) {
+        super(id, name, minOccurrences, maxOccurrences, tags, systemTags, personalData);
+        this.regexp = regexp;
+        this.defaultValue = defaultValue;
+    }
+
+    @GraphQLField
+    public String getRegexp() {
+        return regexp;
+    }
+
+    @GraphQLField
+    public String getDefaultValue() {
+        return defaultValue;
+    }
+
+}


[unomi] 27/27: Remove SDL implementation since we will focus instead on GraphQL Java annotations-based implementation

Posted by sh...@apache.org.
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 84510c8ec53c6153325422a39895be8bae5421bc
Author: Serge Huber <sh...@apache.org>
AuthorDate: Thu Nov 7 16:38:21 2019 +0100

    Remove SDL implementation since we will focus instead on GraphQL Java annotations-based implementation
    
    Signed-off-by: Serge Huber <sh...@apache.org>
---
 graphql/README.md                                  |   2 +-
 .../unomi/graphql/internal/CDPSDLServletImpl.java  | 409 ---------
 .../src/main/resources/cdp-schema.graphqls         | 974 ---------------------
 .../src/main/resources/unomi-schema.graphqls       |  74 --
 4 files changed, 1 insertion(+), 1458 deletions(-)

diff --git a/graphql/README.md b/graphql/README.md
index d1755b2..5be691b 100644
--- a/graphql/README.md
+++ b/graphql/README.md
@@ -31,7 +31,7 @@ GraphQL Endpoint
 
 You can then access the GraphQL endpoint at the following URL:
 
-    http://localhost:8181/sdlgraphql
+    http://localhost:8181/graphql
     
 Query example
 -------------
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
deleted file mode 100644
index 6a0e7ff..0000000
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CDPSDLServletImpl.java
+++ /dev/null
@@ -1,409 +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.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.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.*;
-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;
-import org.osgi.service.component.annotations.Reference;
-
-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;
-import java.io.*;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@Component(
-        service={javax.servlet.http.HttpServlet.class,javax.servlet.Servlet.class},
-        property = {"alias=/sdlgraphql", "jmx.objectname=graphql.servlet:type=graphql"}
-)
-public class CDPSDLServletImpl extends HttpServlet {
-
-    private BundleContext bundleContext;
-    private ObjectMapper objectMapper;
-    private GraphQL graphQL;
-
-    private EventService eventService;
-    private DefinitionsService definitionsService;
-    private SegmentService segmentService;
-
-
-    @Activate
-    void activate(BundleContext bundleContext) {
-        this.bundleContext = bundleContext;
-    }
-
-    @Reference
-    public void setEventService(EventService eventService) {
-        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()
-                .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;
-                    }
-
-                    @Override
-                    public Object parseLiteral(Object input) throws CoercingParseLiteralException {
-                        return input;
-                    }
-                })
-                .build();
-
-        return RuntimeWiring.newRuntimeWiring()
-                .scalar(ExtendedScalars.DateTime)
-                .scalar(ExtendedScalars.Date)
-                .scalar(ExtendedScalars.Json)
-                .scalar(ExtendedScalars.Time)
-                .scalar(emptyTypeWorkAroundScalarType)
-                .scalar(geopointScalarType)
-                .type("CDP_EventInterface", typeWiring -> typeWiring
-                        .typeResolver(new TypeResolver() {
-                            @Override
-                            public GraphQLObjectType getType(TypeResolutionEnvironment env) {
-                                Map<String,Object> 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
-                        .typeResolver(new TypeResolver() {
-                            @Override
-                            public GraphQLObjectType getType(TypeResolutionEnvironment env) {
-                                return null;
-                            }
-                        }))
-                .type("CDP_PropertyInterface", typeWiring -> typeWiring
-                        .typeResolver(new TypeResolver() {
-                            @Override
-                            public GraphQLObjectType getType(TypeResolutionEnvironment env) {
-                                return null;
-                            }
-                        }))
-                .type("Query", typeWiring -> typeWiring.dataFetcher("cdp", dataFetchingEnvironment -> "CDP"))
-                .type("CDP_Query", typeWiring -> typeWiring
-                        .dataFetcher("findEvents", dataFetchingEnvironment -> {
-                    Map<String,Object> arguments = dataFetchingEnvironment.getArguments();
-                    Integer size = (Integer) arguments.get("first");
-                    if (size == null) {
-                        size = 10;
-                    }
-                    String after = (String) arguments.get("after");
-                    if (after == null) {
-                        after = "0";
-                    }
-                    int offset = Integer.parseInt(after);
-                    Object filter = arguments.get("filter");
-                    Condition condition = eventFilter2Condition(filter);
-                    PartialList<Event> events = eventService.searchEvents(condition, offset, size);
-                    Map<String,Object> eventConnection = new HashMap<>();
-                    List<Map<String,Object>> eventEdges = new ArrayList<>();
-                    for (Event event : events.getList()) {
-                        Map<String,Object> eventEdge = new HashMap<>();
-                        Map<String,Object> eventNode = new HashMap<>();
-                        eventNode.put("id", event.getItemId());
-                        eventNode.put("__unomiEventType", event.getEventType());
-                        eventNode.put("cdp_profileID", getCDPProfileID(event.getProfileId()));
-                        eventEdge.put("node", eventNode);
-                        eventEdge.put("cursor", event.getItemId());
-                        eventEdges.add(eventEdge);
-                    }
-                    eventConnection.put("edges", eventEdges);
-                    Map<String,Object> pageInfo = new HashMap<>();
-                    pageInfo.put("hasPreviousPage", false);
-                    pageInfo.put("hasNextPage", events.getTotalSize() > events.getList().size());
-                    eventConnection.put("pageInfo", pageInfo);
-                    return eventConnection;
-                })
-                .dataFetcher("findSegments", dataFetchingEnvironment -> {
-                    Map<String,Object> arguments = dataFetchingEnvironment.getArguments();
-                    Integer size = (Integer) arguments.get("first");
-                    if (size == null) {
-                        size = 10;
-                    }
-                    String after = (String) arguments.get("after");
-                    if (after == null) {
-                        after = "0";
-                    }
-                    int offset = Integer.parseInt(after);
-                    Object filter = arguments.get("filter");
-                    Condition condition = eventFilter2Condition(filter);
-
-                    Map<String,Object> segmentConnection = new HashMap<>();
-                    Query query = new Query();
-                    query.setCondition(condition);
-                    query.setLimit(size);
-                    query.setOffset(offset);
-                    // query.setSortby(sortBy);
-                    PartialList<Metadata> segmentMetadatas = segmentService.getSegmentMetadatas(query);
-                    List<Map<String,Object>> segmentEdges = new ArrayList<>();
-                    for (Metadata segmentMetadata : segmentMetadatas.getList()) {
-                        Map<String,Object> segment = new HashMap<>();
-                        segment.put("id", segmentMetadata.getId());
-                        segment.put("name", segmentMetadata.getName());
-                        Map<String,Object> segmentView = new HashMap<>();
-                        segmentView.put("name", segmentMetadata.getScope());
-                        segment.put("view", segmentView);
-                        Segment unomiSegment = segmentService.getSegmentDefinition(segmentMetadata.getId());
-                        Condition segmentCondition = unomiSegment.getCondition();
-                        segment.put("profiles", segmentConditionToProfileFilter(segmentCondition));
-                        Map<String,Object> segmentEdge = new HashMap<>();
-                        segmentEdge.put("node", segment);
-                        segmentEdge.put("cursor", segmentMetadata.getId());
-                        segmentEdges.add(segmentEdge);
-                    }
-                    segmentConnection.put("edges", segmentEdges);
-                    Map<String,Object> pageInfo = new HashMap<>();
-                    pageInfo.put("hasPreviousPage", false);
-                    pageInfo.put("hasNextPage", segmentMetadatas.getTotalSize() > segmentMetadatas.getList().size());
-                    segmentConnection.put("pageInfo", pageInfo);
-                    return segmentConnection;
-                }))
-                .build();
-    }
-
-    private Map<String, Object> segmentConditionToProfileFilter(Condition segmentCondition) {
-        Map<String,Object> profileFilter = new HashMap<>();
-        // profileFilter.put("profileIDs", new ArrayList<String>());
-        return profileFilter;
-    }
-
-    private Map<String,Object> getCDPProfileID(String profileId) {
-        Map<String,Object> cdpProfileID = new HashMap<>();
-        Map<String,Object> client = getCDPClient(profileId);
-        cdpProfileID.put("client", client);
-        cdpProfileID.put("id", profileId);
-        cdpProfileID.put("uri", "cdp_profile:" + client.get("id") + "/" + profileId);
-        return cdpProfileID;
-    }
-
-    private Map<String,Object> getCDPClient(String profileId) {
-        Map<String,Object> cdpClient = new HashMap<>();
-        cdpClient.put("id", "unomi");
-        cdpClient.put("title", "Default Unomi client");
-        return cdpClient;
-    }
-
-    private Condition eventFilter2Condition(Object filter) {
-        // todo implement transformation to proper event conditions
-        Condition matchAllCondition = new Condition(definitionsService.getConditionType("matchAllCondition"));
-        return matchAllCondition;
-    }
-
-    @Override
-    public void init(ServletConfig config) throws ServletException {
-        super.init(config);
-
-        SchemaParser schemaParser = new SchemaParser();
-        SchemaGenerator schemaGenerator = new SchemaGenerator();
-
-        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(cdpSchemaReader));
-        typeRegistry.merge(schemaParser.parse(unomiSchemaReader));
-        //typeRegistry.merge(schemaParser.parse(schemaFile2));
-        //typeRegistry.merge(schemaParser.parse(schemaFile3));
-
-        RuntimeWiring wiring = buildRuntimeWiring();
-        GraphQLSchema graphQLSchema = schemaGenerator.makeExecutableSchema(typeRegistry, wiring);
-        graphQL = GraphQL.newGraphQL(graphQLSchema)
-                .instrumentation(new TracingInstrumentation())
-                .build();
-
-        objectMapper = new ObjectMapper();
-        objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
-    }
-
-    @Override
-    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        String query = req.getParameter("query");
-        if ("/schema.json".equals(req.getPathInfo())) {
-            query = IntrospectionQuery.INTROSPECTION_QUERY;
-        }
-        String operationName = req.getParameter("operationName");
-        String variableStr = req.getParameter("variables");
-        Map<String, Object> variables = new HashMap<>();
-        if ((variableStr != null) && (variableStr.trim().length() > 0)) {
-            TypeReference<Map<String, Object>> typeRef = new TypeReference<Map<String, Object>>() {
-            };
-            variables = objectMapper.readValue(variableStr, typeRef);
-        }
-
-        setupCORSHeaders(req, resp);
-        executeGraphQLRequest(resp, query, operationName, variables);
-    }
-
-    @Override
-    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        InputStream bodyStream = req.getInputStream();
-        TypeReference<Map<String, Object>> typeRef = new TypeReference<Map<String, Object>>() {
-        };
-        Map<String, Object> body = objectMapper.readValue(bodyStream, typeRef);
-        String query = (String) body.get("query");
-        String operationName = (String) body.get("operationName");
-        Map<String, Object> variables = (Map<String, Object>) body.get("variables");
-        if (variables == null) {
-            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<String, Object> 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<String, Object> 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());
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        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) {
-            // 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"));
-            } else {
-                httpServletResponse.setHeader("Access-Control-Allow-Origin", "*");
-            }
-            httpServletResponse.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, X-Apollo-Tracing, test");
-            httpServletResponse.setHeader("Access-Control-Allow-Credentials", "true");
-            httpServletResponse.setHeader("Access-Control-Allow-Methods", "OPTIONS, POST, GET");
-            // httpServletResponse.setHeader("Access-Control-Max-Age", "600");
-            // httpServletResponse.setHeader("Access-Control-Expose-Headers","Access-Control-Allow-Origin");
-            // httpServletResponse.flushBuffer();
-        }
-    }
-
-}
diff --git a/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls b/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls
deleted file mode 100644
index bea3348..0000000
--- a/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls
+++ /dev/null
@@ -1,974 +0,0 @@
-#
-# 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.
-#
-input CDP_AlgorithmInput {
-  name: String!
-  parameters: JSON
-}
-
-type CDP_BooleanProperty implements CDP_PropertyInterface {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-  defaultValue: Boolean
-}
-
-input CDP_BooleanPropertyInput {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-  defaultValue: Boolean
-}
-
-type CDP_Client {
-  id: ID!
-  title: String
-}
-
-input CDP_ClientInput {
-  id: ID!
-  title: String
-}
-
-type CDP_Consent {
-  token: ID!
-  source: CDP_Source
-  client: CDP_Client
-  type: String!
-  status: CDP_ConsentStatus!
-  lastUpdate: DateTime
-  expiration: DateTime
-  profile: CDP_ProfileInterface
-  events: CDP_EventConnection
-}
-
-enum CDP_ConsentStatus {
-  GRANTED
-  DENIED
-  REVOKED
-}
-
-type CDP_ConsentUpdateEvent implements CDP_EventInterface {
-  id: ID!
-  cdp_source: CDP_Source
-  cdp_client: CDP_Client
-  cdp_profileID: CDP_ProfileID!
-  cdp_profile: CDP_Profile!
-  cdp_object: CDP_Object!
-  cdp_location: GeoPoint
-  cdp_timestamp: DateTime
-  cdp_topics: [CDP_Topic]
-  type: String!
-  status: String
-  lastUpdate: DateTime
-  expiration: DateTime
-}
-
-"""Filter for consent update events"""
-type CDP_ConsentUpdateEventFilter {
-  type_equals: String
-  status_equals: String
-  lastUpdate_equals: DateTime
-  lastUpdate_lt: DateTime
-  lastUpdate_lte: DateTime
-  lastUpdate_gt: DateTime
-  lastUpdate_gte: DateTime
-  expiration_equals: DateTime
-  expiration_lt: DateTime
-  expiration_lte: DateTime
-  expiration_gt: DateTime
-  expiration_gte: DateTime
-}
-
-input CDP_ConsentUpdateEventFilterInput {
-  type_equals: String
-  status_equals: String
-  lastUpdate_equals: DateTime
-  lastUpdate_lt: DateTime
-  lastUpdate_lte: DateTime
-  lastUpdate_gt: DateTime
-  lastUpdate_gte: DateTime
-  expiration_equals: DateTime
-  expiration_lt: DateTime
-  expiration_lte: DateTime
-  expiration_gt: DateTime
-  expiration_gte: DateTime
-}
-
-"""Standard EventType used to create or update a consent"""
-input CDP_ConsentUpdateEventInput {
-  type: String!
-  status: String
-  lastUpdate: DateTime
-  expiration: DateTime
-}
-
-type CDP_DateFilter {
-  after: DateTime
-  before: DateTime
-  includeAfter: Boolean
-  includeBefore: Boolean
-}
-
-input CDP_DateFilterInput {
-  after: DateTime
-  before: DateTime
-  includeAfter: Boolean
-  includeBefore: Boolean
-}
-
-"""Dates are in ISO-8601 format equivalent to Java 8 Instants."""
-type CDP_DateProperty implements CDP_PropertyInterface {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-  defaultValue: String
-}
-
-input CDP_DatePropertyInput {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-  defaultValue: String
-}
-
-"""
-The enumeration property type is a collection of unique strings that contain the
-possible values for the enumeration property type
-"""
-type CDP_EnumProperty implements CDP_PropertyInterface {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-  values: [String]
-}
-
-input CDP_EnumPropertyInput {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-  values: [String]
-}
-
-type CDP_EventConnection {
-  edges: [CDP_EventEdge]
-  pageInfo: PageInfo
-}
-
-type CDP_EventEdge {
-  node: CDP_EventInterface
-  cursor: String!
-}
-
-type CDP_EventFilter {
-  and: [CDP_EventFilter]
-  or: [CDP_EventFilter]
-  id_equals: String
-  cdp_clientID_equals: String
-  cdp_sourceID_equals: String
-  cdp_profileID_equals: String
-  cdp_objectID_equals: String
-  cdp_location_distance: CDP_GeoDistanceFilter
-  cdp_timestamp_equals: DateTime
-  cdp_timestamp_lt: DateTime
-  cdp_timestamp_lte: DateTime
-  cdp_timestamp_gt: DateTime
-  cdp_timestamp_gte: DateTime
-  cdp_topics_equals: String
-  cdp_profileUpdateEvent: CDP_ProfileUpdateEventFilter
-  cdp_consentUpdateEvent: CDP_ConsentUpdateEventFilter
-  cdp_listsUpdateEvent: CDP_ListsUpdateEventFilter
-  cdp_sessionEvent: CDP_SessionEventFilter
-}
-
-input CDP_EventFilterInput {
-  and: [CDP_EventFilterInput]
-  or: [CDP_EventFilterInput]
-  id_equals: String
-  cdp_clientID_equals: String
-  cdp_sourceID_equals: String
-  cdp_profileID_equals: String
-  cdp_objectID_equals: String
-  cdp_location_distance: CDP_GeoDistanceFilterInput
-  cdp_timestamp_equals: DateTime
-  cdp_timestamp_lt: DateTime
-  cdp_timestamp_lte: DateTime
-  cdp_timestamp_gt: DateTime
-  cdp_timestamp_gte: DateTime
-  cdp_profileUpdateEvent: CDP_ProfileUpdateEventFilterInput
-  cdp_consentUpdateEvent: CDP_ConsentUpdateEventFilterInput
-  cdp_listsUpdateEvent: CDP_ListsUpdateEventFilterInput
-  cdp_sessionEvent: CDP_SessionEventFilterInput
-}
-
-"""
-Event wrapper object to handle missing input inheritance in GraphQL
-NB! For optimization reasons, a single EventInput may contain multiple events,
-but only one of each type. ID is optional, with the exception of importing
-"""
-input CDP_EventInput {
-  id: ID
-  cdp_sourceID: String
-  cdp_profileID: CDP_ProfileIDInput!
-  cdp_objectID: ID!
-  cdp_location: GeoPoint
-  cdp_timestamp: DateTime
-  cdp_topics: [ID]
-  cdp_profileUpdateEvent: CDP_ProfileUpdateEventInput
-  cdp_consentUpdateEvent: CDP_ConsentUpdateEventInput
-  cdp_listsUpdateEvent: CDP_ListsUpdateEventInput
-  cdp_sessionEvent: CDP_SessionEventInput
-}
-
-interface CDP_EventInterface {
-  id: ID!
-  cdp_source: CDP_Source
-  cdp_client: CDP_Client
-  cdp_profileID: CDP_ProfileID!
-  cdp_profile: CDP_Profile!
-  cdp_object: CDP_Object!
-  cdp_location: GeoPoint
-  cdp_timestamp: DateTime
-  cdp_topics: [CDP_Topic]
-}
-
-input CDP_EventOccurenceBoostInput {
-  eventType: String
-  boost: Int
-  fromDate: DateTime
-  toDate: DateTime
-}
-
-"""A result for a named filter match request."""
-type CDP_FilterMatch {
-  name: String
-  matched: Boolean
-  executionTimeMillis: Int
-}
-
-type CDP_FloatProperty implements CDP_PropertyInterface {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-  minValue: Float
-  maxValue: Float
-  defaultValue: Float
-}
-
-input CDP_FloatPropertyInput {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-  minValue: Float
-  maxValue: Float
-  defaultValue: Float
-}
-
-type CDP_GeoDistanceFilter {
-  center: GeoPoint
-  unit: CDP_GeoDistanceFilterUnit
-  distance: Float
-}
-
-input CDP_GeoDistanceFilterInput {
-  center: GeoPoint
-  unit: CDP_GeoDistanceFilterUnit
-  distance: Float
-}
-
-enum CDP_GeoDistanceFilterUnit {
-  METERS
-  KILOMETERS
-  MILES
-}
-
-"""Geopoints map to a String in lat,lon format"""
-type CDP_GeoPointProperty implements CDP_PropertyInterface {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-  defaultValue: String
-}
-
-input CDP_GeoPointPropertyInput {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-  defaultValue: String
-}
-
-"""The identifier property type is a string that is used as an identifier"""
-type CDP_IdentifierProperty implements CDP_PropertyInterface {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-  regexp: String
-  defaultValue: String
-}
-
-input CDP_IdentifierPropertyInput {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-  regexp: String
-  defaultValue: String
-}
-
-type CDP_Interest {
-  topic: CDP_Topic!
-  score: Float
-}
-
-type CDP_InterestConnection {
-  totalCount: Int
-  edges: [CDP_InterestEdge]
-  pageInfo: PageInfo
-}
-
-type CDP_InterestEdge {
-  node: CDP_Interest
-  cursor: String!
-}
-
-type CDP_InterestFilter {
-  and: [CDP_InterestFilter]
-  or: [CDP_InterestFilter]
-  topic_equals: ID
-  score_equals: Float
-  score_lt: Float
-  score_lte: Float
-  score_gt: Float
-  score_gte: Float
-}
-
-input CDP_InterestFilterInput {
-  and: [CDP_InterestFilterInput]
-  or: [CDP_InterestFilterInput]
-  topic_equals: ID
-  score_equals: Float
-  score_lt: Float
-  score_lte: Float
-  score_gt: Float
-  score_gte: Float
-}
-
-input CDP_InterestInput {
-  topic: ID!
-  score: Float
-}
-
-type CDP_IntProperty implements CDP_PropertyInterface {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-  minValue: Int
-  maxValue: Int
-  defaultValue: Int
-}
-
-input CDP_IntPropertyInput {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-  minValue: Int
-  maxValue: Int
-  defaultValue: Int
-}
-
-type CDP_List {
-  id: ID!
-  view: CDP_View!
-  name: String!
-  active(first: Int, after: String, last: Int, before: String): CDP_ProfileConnection
-  inactive(first: Int, after: String, last: Int, before: String): CDP_ProfileConnection
-}
-
-type CDP_ListConnection {
-  totalCount: Int
-  edges: [CDP_ListEdge]
-  pageInfo: PageInfo
-}
-
-type CDP_ListEdge {
-  node: CDP_List
-  cursor: String!
-}
-
-input CDP_ListFilterInput {
-  and: [CDP_ListFilterInput]
-  or: [CDP_ListFilterInput]
-  view_equals: ID
-  name_equals: String
-}
-
-"""
-The id optional only when creating a list and can be server generated. For all other operations it is required
-"""
-input CDP_ListInput {
-  id: ID
-  view: ID!
-  name: String!
-}
-
-type CDP_ListsUpdateEvent implements CDP_EventInterface {
-  id: ID!
-  cdp_source: CDP_Source
-  cdp_client: CDP_Client
-  cdp_profileID: CDP_ProfileID!
-  cdp_profile: CDP_Profile!
-  cdp_object: CDP_Object!
-  cdp_location: GeoPoint
-  cdp_timestamp: DateTime
-  cdp_topics: [CDP_Topic]
-  joinLists: [CDP_List]
-  leaveLists: [CDP_List]
-}
-
-type CDP_ListsUpdateEventFilter {
-  joinLists_contains: [ID]
-  leaveLists_contains: [ID]
-}
-
-input CDP_ListsUpdateEventFilterInput {
-  joinLists_contains: [ID]
-  leaveLists_contains: [ID]
-}
-
-"""CDP standard eventType used to update profile list memberships"""
-input CDP_ListsUpdateEventInput {
-  joinLists: [ID]
-  leaveLists: [ID]
-}
-
-type CDP_Mutation {
-  """
-  Please disregard the underscore field, it is only there because GraphQL schema doesn't allow empty types
-  """
-  _: EmptyTypeWorkAround
-  processEvents(events: [CDP_EventInput]!): Int
-  createOrUpdateProfileProperties(properties: [CDP_PropertyInput]): Boolean
-  deleteProfileProperties(propertyNames: [ID]!): Boolean
-  deleteProfile(profileID: CDP_ProfileIDInput): CDP_Profile
-  deleteAllPersonalData(profileID: CDP_ProfileIDInput): Boolean
-  createOrUpdatePersona(persona: CDP_PersonaInput): CDP_Persona
-  deletePersona(personaID: String): CDP_Persona
-  createOrUpdateTopic(topic: CDP_TopicInput): CDP_Topic
-  deleteTopic(topicID: String): CDP_Topic
-  createOrUpdateSegment(segment: CDP_SegmentInput): CDP_Segment
-  deleteSegment(segmentID: String): CDP_Segment
-  createOrUpdateSource(source: CDP_SourceInput): CDP_Source
-  deleteSource(sourceID: ID!): Boolean
-  createOrUpdateList(list: CDP_ListInput): CDP_List
-  addProfileToList(listID: ID, profileID: CDP_ProfileIDInput, active: Boolean): CDP_List
-  removeProfileFromList(listID: ID, profileID: CDP_ProfileIDInput): CDP_List
-  deleteList(listID: ID): CDP_List
-  createOrUpdateView(view: CDP_ViewInput): CDP_View
-  deleteView(viewID: ID!): Boolean
-}
-
-"""
-Named filters are used to evaluate filters against a profile - useful for building personalized experiences.
-"""
-input CDP_NamedFilterInput {
-  name: String!
-  filter: CDP_ProfileFilterInput
-}
-
-type CDP_Object {
-  uri: ID!
-  scheme: String
-  path: String
-  topics: [CDP_Topic]
-}
-
-input CDP_ObjectInput {
-  uri: ID!
-}
-
-input CDP_OptimizationInput {
-  name: String!
-  objects: [ID]
-  eventOccurenceBoosts: [CDP_EventOccurenceBoostInput]
-  strategy: String
-  size: Int
-}
-
-type CDP_OptimizationResult {
-  name: String!
-  scoredObjects: [CDP_ScoredObject]
-}
-
-input CDP_OrderByInput {
-  fieldName: String
-  order: CDP_SortOrder
-}
-
-"""Emulate real profiles with personas"""
-type CDP_Persona implements CDP_ProfileInterface {
-  id: ID!
-  cdp_name: String!
-  cdp_view: CDP_View!
-  cdp_profileIDs: [CDP_ProfileID]
-  cdp_segments(views: [ID]): [CDP_Segment]
-  cdp_interests(views: [ID]): [CDP_Interest]
-  cdp_consents: [CDP_Consent]
-  cdp_lists(views: [ID]): [CDP_List]
-}
-
-"""Used to update personas"""
-input CDP_PersonaConsentInput {
-  type: String!
-  status: String
-  lastUpdate: DateTime
-  expiration: DateTime
-}
-
-input CDP_PersonaInput {
-  id: ID
-  cdp_name: String!
-  cdp_view: ID!
-  cdp_profileIDs: [CDP_ProfileIDInput]
-  cdp_segments: [ID]
-  cdp_interests: [CDP_InterestInput]
-  cdp_consents: [CDP_PersonaConsentInput]
-}
-
-type CDP_Profile implements CDP_ProfileInterface {
-  cdp_profileIDs: [CDP_ProfileID]
-  cdp_events(filter: CDP_EventFilterInput, first: Int, last: Int, after: String, before: String): CDP_EventConnection
-  cdp_lastEvents(count: Int, profileID: CDP_ProfileIDInput): CDP_EventConnection
-  cdp_segments(views: [ID]): [CDP_Segment]
-  cdp_interests(views: [ID]): [CDP_Interest]
-  cdp_consents: [CDP_Consent]
-  cdp_lists(views: [ID]): [CDP_List]
-  cdp_matches(namedFilters: [CDP_NamedFilterInput]): [CDP_FilterMatch]
-  cdp_optimize(parameters: [CDP_OptimizationInput]): [CDP_OptimizationResult]
-  cdp_recommend(parameters: [CDP_RecommendationInput]): [CDP_RecommendationResult]
-}
-
-type CDP_ProfileConnection {
-  totalCount: Int
-  edges: [CDP_ProfileEdge]
-  pageInfo: PageInfo
-}
-
-type CDP_ProfileEdge {
-  node: CDP_ProfileInterface
-  cursor: String!
-}
-
-type CDP_ProfileEventsFilter {
-  and: [CDP_ProfileEventsFilter]
-  or: [CDP_ProfileEventsFilter]
-  not: CDP_ProfileEventsFilter
-  minimalCount: Int
-  maximalCount: Int
-  eventFilter: CDP_EventFilter
-}
-
-input CDP_ProfileEventsFilterInput {
-  and: [CDP_ProfileEventsFilterInput]
-  or: [CDP_ProfileEventsFilterInput]
-  not: CDP_ProfileEventsFilterInput
-  minimalCount: Int
-  maximalCount: Int
-  eventFilter: CDP_EventFilterInput
-}
-
-type CDP_ProfileFilter {
-  profileIDs: [String]
-  properties: CDP_ProfilePropertiesFilter
-  segments_contains: [ID]
-  consents_contains: [ID]
-  lists_contains: [ID]
-  interests: CDP_InterestFilter
-  events: CDP_ProfileEventsFilter
-}
-
-input CDP_ProfileFilterInput {
-  profileIDs_contains: [String]
-  properties: CDP_ProfilePropertiesFilterInput
-  segments_contains: [ID]
-  consents_contains: [ID]
-  lists_contains: [ID]
-  interests: CDP_InterestFilterInput
-  events: CDP_ProfileEventsFilterInput
-}
-
-"""ProfileIDs uniquely identify a profile within a source"""
-type CDP_ProfileID {
-  client: CDP_Client!
-  id: ID!
-  uri: ID
-}
-
-input CDP_ProfileIDInput {
-  clientID: ID!
-  id: ID!
-}
-
-"""Common interface for both profiles and personas"""
-interface CDP_ProfileInterface {
-  cdp_profileIDs: [CDP_ProfileID]
-  cdp_segments(views: [ID]): [CDP_Segment]
-  cdp_interests(views: [ID]): [CDP_Interest]
-  cdp_consents: [CDP_Consent]
-  cdp_lists(views: [ID]): [CDP_List]
-}
-
-"""Query profiles based on properties with this filter"""
-type CDP_ProfilePropertiesFilter {
-  and: [CDP_ProfilePropertiesFilter]
-  or: [CDP_ProfilePropertiesFilter]
-}
-
-input CDP_ProfilePropertiesFilterInput {
-  and: [CDP_ProfilePropertiesFilterInput]
-  or: CDP_ProfilePropertiesFilterInput
-}
-
-type CDP_ProfileUpdateEvent implements CDP_EventInterface {
-  id: ID!
-  cdp_source: CDP_Source
-  cdp_client: CDP_Client
-  cdp_profileID: CDP_ProfileID!
-  cdp_profile: CDP_Profile!
-  cdp_object: CDP_Object!
-  cdp_location: GeoPoint
-  cdp_timestamp: DateTime
-  cdp_topics: [CDP_Topic]
-}
-
-type CDP_ProfileUpdateEventFilter {
-  """
-  Please disregard the underscore field, it is only there because GraphQL schema doesn't allow empty types
-  """
-  _: EmptyTypeWorkAround
-}
-
-input CDP_ProfileUpdateEventFilterInput {
-  """
-  Please disregard the underscore field, it is only there because GraphQL schema doesn't allow empty types
-  """
-  _: EmptyTypeWorkAround
-}
-
-"""CDP standard eventType used to update profile properties"""
-input CDP_ProfileUpdateEventInput {
-  """
-  Please disregard the underscore field, it is only there because GraphQL schema doesn't allow empty types
-  """
-  _: EmptyTypeWorkAround
-}
-
-type CDP_PropertyConnection {
-  edges: [CDP_PropertyEdge]
-  pageInfo: PageInfo
-}
-
-type CDP_PropertyEdge {
-  node: CDP_PropertyInterface
-  cursor: String!
-}
-
-"""
-Workaround for missing GraphQL inheritance, only one field allowed at a time, all others should be null.
-"""
-input CDP_PropertyInput {
-  identifier: CDP_IdentifierPropertyInput
-  string: CDP_StringPropertyInput
-  int: CDP_IntPropertyInput
-  float: CDP_FloatPropertyInput
-  date: CDP_DatePropertyInput
-  boolean: CDP_BooleanPropertyInput
-  geopoint: CDP_GeoPointPropertyInput
-  enum: CDP_EnumPropertyInput
-  set: CDP_SetPropertyInput
-}
-
-"""This interface regroups all the common fields between properties."""
-interface CDP_PropertyInterface {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-}
-
-"""Namespaced queries"""
-type CDP_Query {
-  """
-  Please disregard the underscore field, it is only there because GraphQL schema doesn't allow empty types
-  """
-  _: EmptyTypeWorkAround
-  getEvent(id: String!): CDP_EventInterface
-  findEvents(filter: CDP_EventFilterInput, orderBy: [CDP_OrderByInput], first: Int, after: String, last: Int, before: String): CDP_EventConnection
-  getProfile(profileID: CDP_ProfileIDInput, createIfMissing: Boolean): CDP_Profile
-  findProfiles(filter: CDP_ProfileFilterInput, orderBy: [CDP_OrderByInput], first: Int, after: String, last: Int, before: String): CDP_ProfileConnection
-  getProfileProperties: CDP_PropertyConnection
-  getPersona(personaID: String): CDP_Persona
-  findPersonas(filter: CDP_ProfileFilterInput, orderBy: [CDP_OrderByInput], first: Int, after: String, last: Int, before: String): CDP_ProfileConnection
-  getTopic(topicID: ID): CDP_Topic
-  findTopics(filter: CDP_TopicFilterInput, orderBy: [CDP_OrderByInput], first: Int, after: String, last: Int, before: String): CDP_TopicConnection
-  getSegment(segmentID: ID): CDP_Segment
-  findSegments(filter: CDP_SegmentFilterInput, orderBy: [CDP_OrderByInput], first: Int, after: String, last: Int, before: String): CDP_SegmentConnection
-  getSources: [CDP_Source]
-  getList(listID: ID): CDP_List
-  findLists(filter: CDP_ListFilterInput, orderBy: [CDP_OrderByInput], first: Int, after: String, last: Int, before: String): CDP_ListConnection
-  getViews: [CDP_View]
-}
-
-input CDP_RecommendationInput {
-  name: String!
-  objectUri: ID
-  topics: [ID]
-  size: Int
-  algorithm: CDP_AlgorithmInput
-}
-
-type CDP_RecommendationResult {
-  name: String!
-  scoredObjects: [CDP_ScoredObject]
-}
-
-type CDP_ScoredObject {
-  object: CDP_Object
-  score: Float
-}
-
-type CDP_Segment {
-  id: ID!
-  view: CDP_View!
-  name: String!
-  profiles: CDP_ProfileFilter
-}
-
-type CDP_SegmentConnection {
-  totalCount: Int
-  edges: [CDP_SegmentEdge]
-  pageInfo: PageInfo
-}
-
-type CDP_SegmentEdge {
-  node: CDP_Segment
-  cursor: String!
-}
-
-input CDP_SegmentFilterInput {
-  and: [CDP_SegmentFilterInput]
-  or: [CDP_SegmentFilterInput]
-  view_equals: ID
-  name_equals: String
-}
-
-input CDP_SegmentInput {
-  id: ID
-  view: ID!
-  name: String
-  profiles: CDP_ProfileFilterInput
-}
-
-type CDP_SessionEvent implements CDP_EventInterface {
-  id: ID!
-  cdp_source: CDP_Source
-  cdp_client: CDP_Client
-  cdp_profileID: CDP_ProfileID!
-  cdp_profile: CDP_Profile!
-  cdp_object: CDP_Object!
-  cdp_location: GeoPoint
-  cdp_timestamp: DateTime
-  cdp_topics: [CDP_Topic]
-  state: CDP_SessionState
-}
-
-type CDP_SessionEventFilter {
-  state_equals: CDP_SessionState
-}
-
-input CDP_SessionEventFilterInput {
-  state_equals: CDP_SessionState
-}
-
-input CDP_SessionEventInput {
-  state: CDP_SessionState
-}
-
-enum CDP_SessionState {
-  START
-  STOP
-  PAUSE
-  RESUME
-}
-
-"""Enables creation of nested property types."""
-type CDP_SetProperty implements CDP_PropertyInterface {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-  properties: [CDP_PropertyInterface]
-}
-
-input CDP_SetPropertyInput {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-  properties: [CDP_PropertyInput]
-}
-
-enum CDP_SortOrder {
-  ASC
-  DESC
-  UNSPECIFIED
-}
-
-type CDP_Source {
-  id: ID!
-  thirdParty: Boolean
-}
-
-input CDP_SourceInput {
-  id: ID!
-  thirdParty: Boolean
-}
-
-type CDP_StringProperty implements CDP_PropertyInterface {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-  regexp: String
-  defaultValue: String
-}
-
-input CDP_StringPropertyInput {
-  name: ID!
-  minOccurrences: Int
-  maxOccurrences: Int
-  tags: [String]
-  regexp: String
-  defaultValue: String
-}
-
-type CDP_Subscription {
-  """
-  Please disregard the underscore field, it is only there because GraphQL schema doesn't allow empty types
-  """
-  _: EmptyTypeWorkAround
-  eventListener(filter: CDP_EventFilterInput): CDP_EventInterface!
-  profileListener(filter: CDP_ProfileFilterInput): CDP_Profile
-}
-
-type CDP_Topic {
-  id: ID!
-  view: CDP_View!
-  name: String!
-}
-
-type CDP_TopicConnection {
-  totalCount: Int
-  edges: [CDP_TopicEdge]
-  pageInfo: PageInfo
-}
-
-type CDP_TopicEdge {
-  node: CDP_Topic
-  cursor: String!
-}
-
-input CDP_TopicFilterInput {
-  and: [CDP_TopicFilterInput]
-  or: [CDP_TopicFilterInput]
-  view_equals: ID
-  id_equals: String
-  name_equals: String
-}
-
-input CDP_TopicInput {
-  id: ID
-  view: ID!
-  name: String!
-}
-
-type CDP_View {
-  name: ID!
-}
-
-input CDP_ViewInput {
-  name: ID!
-}
-
-"""
-Uses RFC-3339 representation, for example 1996-12-19, see
-https://github.com/graphql-java/graphql-java-extended-scalars for example
-implementation 
-"""
-scalar Date
-
-"""
-Uses RFC-3339 representation, for example 1996-12-19T16:39:57-08:00, see
-https://github.com/graphql-java/graphql-java-extended-scalars for example
-implementation 
-"""
-scalar DateTime
-
-"""
-This scalar is simply used to mark types as empty, since GraphQL doesn't allow
-that by default. Please ignore any fields using this scalar as they are not
-intended to be exposed
-"""
-scalar EmptyTypeWorkAround
-
-"""Uses a string representation of lat,lon"""
-scalar GeoPoint
-
-"""For values and arguments that cannot be defined structurally"""
-scalar JSON
-
-type Mutation {
-  cdp: CDP_Mutation
-}
-
-type PageInfo {
-  hasPreviousPage: Boolean!
-  hasNextPage: Boolean!
-}
-
-type Query {
-  cdp: CDP_Query
-}
-
-type Subscription {
-  cdp: CDP_Subscription
-}
-
-"""
-Uses RFC-3339 representation, for example 16:39:57-08:00, see
-https://github.com/graphql-java/graphql-java-extended-scalars for example
-implementation 
-"""
-scalar Time
diff --git a/graphql/cxs-impl/src/main/resources/unomi-schema.graphqls b/graphql/cxs-impl/src/main/resources/unomi-schema.graphqls
deleted file mode 100644
index 73a87ec..0000000
--- a/graphql/cxs-impl/src/main/resources/unomi-schema.graphqls
+++ /dev/null
@@ -1,74 +0,0 @@
-#
-# 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: CDP_Object!
-    cdp_location: GeoPoint
-    cdp_timestamp: DateTime
-    cdp_topics: [CDP_Topic]
-
-    pageView : Unomi_PageView
-}
-
-type Unomi_SessionCreated {
-    creationTime : DateTime
-    duration : Int
-}
-
-type Unomi_SessionCreatedEvent implements CDP_EventInterface {
-    id: ID!
-    cdp_source: CDP_Source
-    cdp_client: CDP_Client
-    cdp_profileID: CDP_ProfileID!
-    cdp_profile: CDP_Profile!
-    cdp_object: CDP_Object!
-    cdp_location: GeoPoint
-    cdp_timestamp: DateTime
-    cdp_topics: [CDP_Topic]
-
-    sessionCreated : Unomi_SessionCreated
-}
-
-type Unomi_PropertyPair {
-    name : String
-    value : JSON
-}
-
-type Unomi_UnknownEvent implements CDP_EventInterface {
-
-    id: ID!
-    cdp_source: CDP_Source
-    cdp_client: CDP_Client
-    cdp_profileID: CDP_ProfileID!
-    cdp_profile: CDP_Profile!
-    cdp_object: CDP_Object!
-    cdp_location: GeoPoint
-    cdp_timestamp: DateTime
-    cdp_topics: [CDP_Topic]
-
-    unknownProperties : [Unomi_PropertyPair]
-}
\ No newline at end of file


[unomi] 11/27: UNOMI-180 Implement CXS GraphQL API - Modify the type generation to use "Input" suffix for input types instead of a prefix.

Posted by sh...@apache.org.
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 f6bc8b62dd8a6449d98d9633b1961c54a9719fe5
Author: Serge Huber <sh...@apache.org>
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 <sh...@apache.org>
---
 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 @@
             <version>1.7.21</version>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-api</artifactId>
+            <version>1.3.0-incubating-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
 
 </project>
\ 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<String,CXSEventType> getEventTypes();
+    Map<String, CXSEventType> 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.CXSEventInput;
+import org.apache.unomi.graphql.types.input.CXSEventTypeInput;
+import org.apache.unomi.graphql.types.input.CXSPropertyTypeInput;
+import org.apache.unomi.graphql.types.input.CXSSetPropertyTypeInput;
+import org.apache.unomi.graphql.types.output.CXSEventType;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -41,7 +45,7 @@ public class CXSMutation {
 
         CXSEventType cxsEventType = new CXSEventType(cxsEventTypeInput.getId(), cxsEventTypeInput.getScope(), cxsEventTypeInput.getTypeName(), new ArrayList<>());
         for (CXSPropertyTypeInput propertyTypeInput : cxsEventTypeInput.getProperties()) {
-            CXSPropertyType propertyType = getPropertyType(propertyTypeInput);
+            org.apache.unomi.graphql.propertytypes.CXSPropertyType propertyType = getPropertyType(propertyTypeInput);
             cxsEventType.getProperties().add(propertyType);
         }
         cxsGraphQLProvider.getEventTypes().put(cxsEventType.getTypeName(), cxsEventType);
@@ -58,8 +62,8 @@ public class CXSMutation {
         return 0;
     }
 
-    private CXSPropertyType getPropertyType(CXSPropertyTypeInput cxsPropertyTypeInput) {
-        CXSPropertyType propertyType = null;
+    private org.apache.unomi.graphql.propertytypes.CXSPropertyType getPropertyType(CXSPropertyTypeInput cxsPropertyTypeInput) {
+        org.apache.unomi.graphql.propertytypes.CXSPropertyType propertyType = null;
         if (cxsPropertyTypeInput.identifierPropertyTypeInput != null) {
             propertyType = getIdentifierPropertyType(cxsPropertyTypeInput.identifierPropertyTypeInput);
         } else if (cxsPropertyTypeInput.stringPropertyTypeInput != null) {
@@ -70,12 +74,12 @@ public class CXSMutation {
         return propertyType;
     }
 
-    private CXSPropertyType getSetPropertyType(CXSSetPropertyTypeInput cxsSetPropertyTypeInput) {
-        List<CXSPropertyType> setProperties = null;
+    private org.apache.unomi.graphql.propertytypes.CXSPropertyType getSetPropertyType(CXSSetPropertyTypeInput cxsSetPropertyTypeInput) {
+        List<org.apache.unomi.graphql.propertytypes.CXSPropertyType> setProperties = null;
         if (cxsSetPropertyTypeInput.getProperties() != null) {
             setProperties = new ArrayList<>();
             for (CXSPropertyTypeInput setProperty : cxsSetPropertyTypeInput.getProperties()) {
-                CXSPropertyType subPropertyType = getPropertyType(setProperty);
+                org.apache.unomi.graphql.propertytypes.CXSPropertyType subPropertyType = getPropertyType(setProperty);
                 if (subPropertyType != null) {
                     setProperties.add(subPropertyType);
                 }
@@ -92,7 +96,7 @@ public class CXSMutation {
                 setProperties);
     }
 
-    private CXSPropertyType getStringPropertyType(CXSStringPropertyType stringPropertyType) {
+    private org.apache.unomi.graphql.propertytypes.CXSPropertyType getStringPropertyType(CXSStringPropertyType stringPropertyType) {
         return new CXSStringPropertyType(
                 stringPropertyType.getId(),
                 stringPropertyType.getName(),
@@ -106,7 +110,7 @@ public class CXSMutation {
                 );
     }
 
-    private CXSPropertyType getIdentifierPropertyType(CXSIdentifierPropertyType identifierPropertyType) {
+    private org.apache.unomi.graphql.propertytypes.CXSPropertyType getIdentifierPropertyType(CXSIdentifierPropertyType identifierPropertyType) {
         return new CXSIdentifierPropertyType(
                 identifierPropertyType.getId(),
                 identifierPropertyType.getName(),
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java
index 18c7533..66d4d93 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java
@@ -16,8 +16,12 @@
  */
 package org.apache.unomi.graphql;
 
+import org.apache.unomi.api.services.SegmentService;
+
 public interface CXSProviderManager {
 
     void refreshProviders();
 
+    SegmentService getSegmentService();
+
 }
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 7b548a9..728bb38 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
@@ -19,6 +19,14 @@ package org.apache.unomi.graphql;
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 import graphql.schema.DataFetchingEnvironment;
+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.SegmentService;
+import org.apache.unomi.graphql.types.input.CXSEventFilter;
+import org.apache.unomi.graphql.types.input.CXSOrderByInput;
+import org.apache.unomi.graphql.types.input.CXSSegmentFilterInput;
+import org.apache.unomi.graphql.types.output.*;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -43,7 +51,7 @@ public class CXSQuery {
     }
 
     @GraphQLField
-    public CXSEventConnection findEvents(@GraphQLName("filter") CXSEventFilterInput filter,
+    public CXSEventConnection findEvents(@GraphQLName("filter") CXSEventFilter filter,
                                          @GraphQLName("orderBy") CXSOrderByInput orderBy,
                                          DataFetchingEnvironment env) {
         env.getArgument("first");
@@ -52,7 +60,40 @@ public class CXSQuery {
     }
 
     @GraphQLField
+    public CXSSegmentConnection findSegments(@GraphQLName("filter") CXSSegmentFilterInput filter,
+                                             @GraphQLName("orderBy") CXSOrderByInput orderBy,
+                                             DataFetchingEnvironment env) {
+        SegmentService segmentService = cxsGraphQLProvider.getCxsProviderManager().getSegmentService();
+        Query query = new Query();
+        segmentService.getSegmentMetadatas(query);
+        return new CXSSegmentConnection();
+    }
+
+    @GraphQLField
     public CXSSegment getSegment(@GraphQLName("segmentId") String segmentId) {
-        return new CXSSegment();
+        SegmentService segmentService = cxsGraphQLProvider.getCxsProviderManager().getSegmentService();
+        Segment segment = segmentService.getSegmentDefinition(segmentId);
+        if (segment == null) {
+            return null;
+        }
+        CXSSegment cxsSegment = new CXSSegment();
+        cxsSegment.id = segment.getItemId();
+        cxsSegment.name = segment.getMetadata().getName();
+        CXSView cxsView = new CXSView();
+        cxsView.name = segment.getScope();
+        cxsSegment.view = cxsView;
+        cxsSegment.condition = getSegmentCondition(segment.getCondition());
+        return cxsSegment;
+    }
+
+    private CXSSegmentCondition getSegmentCondition(Condition segmentRootCondition) {
+        if (segmentRootCondition == null) {
+            return null;
+        }
+        // @todo translate the conditions into something that the CXS spec can work with.
+
+        // we probably have to scan the tree to find any event conditions and seperate them
+        // from the profile property conditions (what about session conditions ?)
+        return null;
     }
 }
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 ff2a27e..8c616d4 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,8 +19,13 @@ package org.apache.unomi.graphql.builders;
 import graphql.annotations.processor.GraphQLAnnotationsComponent;
 import graphql.annotations.processor.ProcessingElementsContainer;
 import graphql.schema.*;
-import org.apache.unomi.graphql.*;
 import org.apache.unomi.graphql.propertytypes.*;
+import org.apache.unomi.graphql.types.input.CXSEventInput;
+import org.apache.unomi.graphql.types.input.CXSEventOccurrenceFilterInput;
+import org.apache.unomi.graphql.types.output.CXSEvent;
+import org.apache.unomi.graphql.types.output.CXSEventProperties;
+import org.apache.unomi.graphql.types.output.CXSEventType;
+import org.apache.unomi.graphql.types.output.PageInfo;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -36,7 +41,7 @@ public class CXSEventBuilders implements CXSBuilder {
 
     private GraphQLAnnotationsComponent annotationsComponent;
     private ProcessingElementsContainer container;
-    private Map<String,CXSEventType> eventTypes;
+    private Map<String, CXSEventType> eventTypes;
     private Map<String,GraphQLType> typeRegistry;
 
     public CXSEventBuilders(GraphQLAnnotationsComponent annotationsComponent,
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 5880731..e5dc6ba 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
@@ -22,9 +22,19 @@ import graphql.schema.*;
 import graphql.servlet.GraphQLMutationProvider;
 import graphql.servlet.GraphQLQueryProvider;
 import graphql.servlet.GraphQLTypesProvider;
-import org.apache.unomi.graphql.*;
+import org.apache.unomi.graphql.CXSGraphQLProvider;
+import org.apache.unomi.graphql.CXSMutation;
+import org.apache.unomi.graphql.CXSProviderManager;
+import org.apache.unomi.graphql.CXSQuery;
 import org.apache.unomi.graphql.builders.CXSEventBuilders;
 import org.apache.unomi.graphql.propertytypes.CXSSetPropertyType;
+import org.apache.unomi.graphql.types.input.CXSDateFilter;
+import org.apache.unomi.graphql.types.input.CXSEventTypeInput;
+import org.apache.unomi.graphql.types.input.CXSGeoDistanceInput;
+import org.apache.unomi.graphql.types.input.CXSOrderByInput;
+import org.apache.unomi.graphql.types.output.CXSEventType;
+import org.apache.unomi.graphql.types.output.CXSGeoPoint;
+import org.apache.unomi.graphql.types.output.PageInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,11 +56,13 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
     private CXSEventBuilders cxsEventBuilders;
     private Map<String,GraphQLType> typeRegistry;
 
-    private Map<String,CXSEventType> eventTypes = new TreeMap<>();
+    private Map<String, CXSEventType> eventTypes = new TreeMap<>();
 
     public CXSGraphQLProviderImpl(GraphQLAnnotationsComponent annotationsComponent) {
         this.annotationsComponent = annotationsComponent;
         container = annotationsComponent.createContainer();
+        container.setInputPrefix("");
+        container.setInputSuffix("Input");
         typeRegistry = container.getTypeRegistry();
         cxsEventBuilders = new CXSEventBuilders(annotationsComponent, container, eventTypes);
         updateGraphQLTypes();
@@ -74,7 +86,7 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
         typeRegistry.put("CXS_EventType", annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSEventType.class, container));
 
         typeRegistry.put("CXS_GeoDistanceInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSGeoDistanceInput.class, container));
-        typeRegistry.put("CXS_DateFilterInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSDateFilterInput.class, container));
+        typeRegistry.put("CXS_DateFilterInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSDateFilter.class, container));
         typeRegistry.put("CXS_EventTypeInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSEventTypeInput.class, container));
         typeRegistry.put("CXS_OrderByInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSOrderByInput.class, container));
 
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSProviderManagerImpl.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSProviderManagerImpl.java
index 99d9d1f..cd7c56f 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSProviderManagerImpl.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSProviderManagerImpl.java
@@ -17,9 +17,11 @@
 package org.apache.unomi.graphql.internal;
 
 import graphql.annotations.processor.GraphQLAnnotationsComponent;
+import graphql.annotations.processor.retrievers.GraphQLFieldRetriever;
 import graphql.servlet.GraphQLMutationProvider;
 import graphql.servlet.GraphQLQueryProvider;
 import graphql.servlet.GraphQLTypesProvider;
+import org.apache.unomi.api.services.SegmentService;
 import org.apache.unomi.graphql.CXSGraphQLProvider;
 import org.apache.unomi.graphql.CXSProviderManager;
 import org.osgi.framework.BundleContext;
@@ -40,6 +42,9 @@ public class CXSProviderManagerImpl implements CXSProviderManager {
 
     private CXSGraphQLProvider cxsGraphQLProvider;
     private GraphQLAnnotationsComponent annotationsComponent;
+    private GraphQLFieldRetriever graphQLFieldRetriever;
+    private SegmentService segmentService;
+
     private ServiceRegistration<?> providerSR;
     private BundleContext bundleContext;
 
@@ -48,6 +53,24 @@ public class CXSProviderManagerImpl implements CXSProviderManager {
         this.annotationsComponent = annotationsComponent;
     }
 
+    @Reference
+    public void setGraphQLFieldRetriever(GraphQLFieldRetriever graphQLFieldRetriever) {
+        this.graphQLFieldRetriever = graphQLFieldRetriever;
+        if (graphQLFieldRetriever != null) {
+            graphQLFieldRetriever.setAlwaysPrettify(true);
+        }
+    }
+
+    @Reference
+    public void setSegmentService(SegmentService segmentService) {
+        this.segmentService = segmentService;
+    }
+
+    @Override
+    public SegmentService getSegmentService() {
+        return segmentService;
+    }
+
     @Activate
     void activate(
             ComponentContext componentContext,
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSFloatPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSFloatPropertyType.java
index abd46b4..e53b28b 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSFloatPropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSFloatPropertyType.java
@@ -24,9 +24,9 @@ import java.util.List;
 @GraphQLName("CXS_FloatPropertyType")
 public class CXSFloatPropertyType extends CXSPropertyType {
 
-    private Float minValue;
-    private Float maxValue;
-    private Float defaultValue;
+    private Double minValue;
+    private Double maxValue;
+    private Double defaultValue;
 
     public CXSFloatPropertyType(@GraphQLName("id") String id,
                                 @GraphQLName("name") String name,
@@ -35,9 +35,9 @@ public class CXSFloatPropertyType extends CXSPropertyType {
                                 @GraphQLName("tags") List<String> tags,
                                 @GraphQLName("systemTags") List<String> systemTags,
                                 @GraphQLName("personalData") Boolean personalData,
-                                @GraphQLName("minValue") Float minValue,
-                                @GraphQLName("maxValue") Float maxValue,
-                                @GraphQLName("defaultValue") Float defaultValue) {
+                                @GraphQLName("minValue") Double minValue,
+                                @GraphQLName("maxValue") Double maxValue,
+                                @GraphQLName("defaultValue") Double defaultValue) {
         super(id, name, minOccurrences, maxOccurrences, tags, systemTags, personalData);
         this.minValue = minValue;
         this.maxValue = maxValue;
@@ -45,17 +45,17 @@ public class CXSFloatPropertyType extends CXSPropertyType {
     }
 
     @GraphQLField
-    public Float getMinValue() {
+    public Double getMinValue() {
         return minValue;
     }
 
     @GraphQLField
-    public Float getMaxValue() {
+    public Double getMaxValue() {
         return maxValue;
     }
 
     @GraphQLField
-    public Float getDefaultValue() {
+    public Double getDefaultValue() {
         return defaultValue;
     }
 }
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/types/input/CXSDateFilter.java
similarity index 91%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDateFilterInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSDateFilter.java
index c9e1d07..0a48393 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/types/input/CXSDateFilter.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.input;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 
-@GraphQLName("CXS_DateFilterInput")
-public class CXSDateFilterInput {
+@GraphQLName("CXS_DateFilter")
+public class CXSDateFilter {
     @GraphQLField
     public long after;
     @GraphQLField
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventFilterInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventFilter.java
similarity index 83%
copy from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventFilterInput.java
copy to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventFilter.java
index 855a6ab..b699672 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventFilterInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventFilter.java
@@ -14,22 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.input;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_EventFilterInput")
-public class CXSEventFilterInput {
+@GraphQLName("CXS_EventFilter")
+public class CXSEventFilter {
 
     @GraphQLField
     @GraphQLName("and")
-    public List<CXSEventFilterInput> andFilters;
+    public List<CXSEventFilter> andFilters;
 
     @GraphQLField
     @GraphQLName("or")
-    public List<CXSEventFilterInput> orFilters;
+    public List<CXSEventFilter> orFilters;
 
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventInput.java
similarity index 96%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventInput.java
index 473953b..2a076cd 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventInput.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.input;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
@@ -22,7 +22,7 @@ import graphql.annotations.annotationTypes.GraphQLName;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
-@GraphQLName("CXS_EventInput")
+@GraphQLName("CXS_Event")
 public class CXSEventInput {
     private String id;
     private String eventType;
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/types/input/CXSEventOccurrenceFilterInput.java
similarity index 93%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventOccurrenceFilterInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventOccurrenceFilterInput.java
index 1ffaa19..ee74489 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventOccurrenceFilterInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventOccurrenceFilterInput.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.input;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 
-@GraphQLName("CXS_EventOccurrenceFilterInput")
+@GraphQLName("CXS_EventOccurrenceFilter")
 public class CXSEventOccurrenceFilterInput {
 
     @GraphQLField
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventTypeInput.java
similarity index 96%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventTypeInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventTypeInput.java
index 06e78f5..5f94aff 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventTypeInput.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.input;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
@@ -22,7 +22,7 @@ import graphql.annotations.annotationTypes.GraphQLName;
 import java.util.ArrayList;
 import java.util.List;
 
-@GraphQLName("CXS_EventTypeInput")
+@GraphQLName("CXS_EventType")
 public class CXSEventTypeInput {
 
     private String id;
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/types/input/CXSGeoDistanceInput.java
similarity index 82%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoDistanceInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSGeoDistanceInput.java
index bd95070..7b8352a 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoDistanceInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSGeoDistanceInput.java
@@ -14,17 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.input;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
+import org.apache.unomi.graphql.types.output.CXSGeoDistanceUnit;
+import org.apache.unomi.graphql.types.output.CXSGeoPoint;
 
-@GraphQLName("CXS_GeoDistanceInput")
+@GraphQLName("CXS_GeoDistance")
 public class CXSGeoDistanceInput {
     @GraphQLField
     public CXSGeoPoint center;
     @GraphQLField
     public CXSGeoDistanceUnit unit;
     @GraphQLField
-    public float distance;
+    public Double distance;
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSGeoPointInput.java
similarity index 88%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSGeoPointInput.java
index bd402c0..772abb8 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSGeoPointInput.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.input;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 
-@GraphQLName("CXS_GeoPointInput")
+@GraphQLName("CXS_GeoPoint")
 public class CXSGeoPointInput {
     @GraphQLField
-    public float longitude;
+    public Double longitude;
     @GraphQLField
-    public float latitude;
+    public Double latitude;
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSOrderByInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSOrderByInput.java
similarity index 88%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSOrderByInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSOrderByInput.java
index dbe63c0..3ee5e1c 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSOrderByInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSOrderByInput.java
@@ -14,12 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.input;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
+import org.apache.unomi.graphql.types.output.CXSSortOrder;
 
-@GraphQLName("CXS_OrderByInput")
+@GraphQLName("CXS_OrderBy")
 public class CXSOrderByInput {
 
     @GraphQLField
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSPropertyTypeInput.java
similarity index 97%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSPropertyTypeInput.java
index 5662123..9917ca3 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSPropertyTypeInput.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.input;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 import org.apache.unomi.graphql.propertytypes.*;
 
-@GraphQLName("CXS_PropertyTypeInput")
+@GraphQLName("CXS_PropertyType")
 public class CXSPropertyTypeInput {
 
     public CXSPropertyTypeInput(
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventFilterInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSSegmentFilterInput.java
similarity index 65%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventFilterInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSSegmentFilterInput.java
index 855a6ab..95bbc9d 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventFilterInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSSegmentFilterInput.java
@@ -14,22 +14,38 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.input;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_EventFilterInput")
-public class CXSEventFilterInput {
+@GraphQLName("CXS_SegmentFilter")
+public class CXSSegmentFilterInput {
 
     @GraphQLField
     @GraphQLName("and")
-    public List<CXSEventFilterInput> andFilters;
+    public List<CXSSegmentFilterInput> andFilters;
 
     @GraphQLField
     @GraphQLName("or")
-    public List<CXSEventFilterInput> orFilters;
+    public List<CXSSegmentFilterInput> orFilters;
+
+    @GraphQLField
+    @GraphQLName("view_equals")
+    public String viewEquals;
+
+    @GraphQLField
+    @GraphQLName("view_regexp")
+    public String viewRegexp;
+
+    @GraphQLField
+    @GraphQLName("name_equals")
+    public String nameEquals;
+
+    @GraphQLField
+    @GraphQLName("name_regexp")
+    public String nameRegexp;
 
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSSetPropertyTypeInput.java
similarity index 90%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSSetPropertyTypeInput.java
index 52d1101..ba762f9 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSSetPropertyTypeInput.java
@@ -14,16 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.input;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
-import org.apache.unomi.graphql.propertytypes.CXSPropertyType;
 
 import java.util.List;
 
-@GraphQLName("CXS_SetPropertyTypeInput")
-public class CXSSetPropertyTypeInput extends CXSPropertyType {
+@GraphQLName("CXS_SetPropertyType")
+public class CXSSetPropertyTypeInput extends org.apache.unomi.graphql.propertytypes.CXSPropertyType {
 
     private List<CXSPropertyTypeInput> properties;
 
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/types/output/CXSEvent.java
similarity index 97%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEvent.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEvent.java
index 6e71c28..738ef7e 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/types/output/CXSEvent.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
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/types/output/CXSEventConnection.java
similarity index 95%
copy from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventConnection.java
copy to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventConnection.java
index 7974543..5852b8d 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/types/output/CXSEventConnection.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
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/types/output/CXSEventEdge.java
similarity index 95%
copy from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventEdge.java
copy to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventEdge.java
index 3b81f0a..1be39a6 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/types/output/CXSEventEdge.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventFilter.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventFilter.java
similarity index 96%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventFilter.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventFilter.java
index 82a3ebd..9d26663 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventFilter.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventFilter.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventOccurrenceFilter.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventOccurrenceFilter.java
similarity index 96%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventOccurrenceFilter.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventOccurrenceFilter.java
index 7abd342..7fac676 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventOccurrenceFilter.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventOccurrenceFilter.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventProperties.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventProperties.java
similarity index 96%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventProperties.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventProperties.java
index 95c0b1b..7431cf9 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventProperties.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventProperties.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventPropertiesFilter.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventPropertiesFilter.java
similarity index 95%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventPropertiesFilter.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventPropertiesFilter.java
index 45f9101..9580a51 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventPropertiesFilter.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventPropertiesFilter.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLName;
 
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/types/output/CXSEventType.java
similarity index 97%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventType.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventType.java
index 2d4c5ae..38a7d4e 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventType.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoDistanceUnit.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSGeoDistanceUnit.java
similarity index 95%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoDistanceUnit.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSGeoDistanceUnit.java
index ad3f08a..8be9aee 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoDistanceUnit.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSGeoDistanceUnit.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLName;
 
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPoint.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSGeoPoint.java
similarity index 90%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPoint.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSGeoPoint.java
index 703a541..12e3e0a 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPoint.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSGeoPoint.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
@@ -23,9 +23,9 @@ import graphql.annotations.annotationTypes.GraphQLName;
 public class CXSGeoPoint {
 
     @GraphQLField
-    public double latitude;
+    public Double latitude;
 
     @GraphQLField
-    public double longitude;
+    public Double longitude;
 
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSegment.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegment.java
similarity index 96%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSegment.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegment.java
index 4d81f90..5f64798 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSegment.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegment.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSegmentCondition.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegmentCondition.java
similarity index 92%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSegmentCondition.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegmentCondition.java
index 37d3311..eca9f90 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSegmentCondition.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegmentCondition.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
+import org.apache.unomi.graphql.CXSProfilePropertiesFilter;
 
 import java.util.List;
 
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/types/output/CXSSegmentConnection.java
similarity index 86%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventConnection.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegmentConnection.java
index 7974543..09fe699 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/types/output/CXSSegmentConnection.java
@@ -14,18 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_EventConnection")
-public class CXSEventConnection {
-
+@GraphQLName("CXS_SegmentConnection")
+public class CXSSegmentConnection {
     @GraphQLField
-    public List<CXSEventEdge> edges;
+    public List<CXSSegmentEdge> edges;
     @GraphQLField
     public PageInfo pageInfo;
 
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/types/output/CXSSegmentEdge.java
similarity index 87%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventEdge.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegmentEdge.java
index 3b81f0a..f45b872 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/types/output/CXSSegmentEdge.java
@@ -14,16 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 
-@GraphQLName("CXS_EventEdge")
-public class CXSEventEdge {
+@GraphQLName("CXS_SegmentEdge")
+public class CXSSegmentEdge {
 
     @GraphQLField
-    public CXSEvent node;
+    public CXSSegment edge;
+
     @GraphQLField
     public String cursor;
 
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSortOrder.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSortOrder.java
similarity index 95%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSortOrder.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSortOrder.java
index 0fbad2c..34d8c11 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSortOrder.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSortOrder.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLName;
 
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSView.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSView.java
similarity index 95%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSView.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSView.java
index 5ee0066..a8e3616 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSView.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSView.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/PageInfo.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/PageInfo.java
similarity index 95%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/PageInfo.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/PageInfo.java
index a49d774..7242a87 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/PageInfo.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/PageInfo.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 
diff --git a/graphql/karaf-feature/pom.xml b/graphql/karaf-feature/pom.xml
index c61df57..3179638 100644
--- a/graphql/karaf-feature/pom.xml
+++ b/graphql/karaf-feature/pom.xml
@@ -35,17 +35,17 @@
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-core</artifactId>
-            <version>2.8.4</version>
+            <version>2.8.6</version>
         </dependency>
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-annotations</artifactId>
-            <version>2.8.4</version>
+            <version>2.8.6</version>
         </dependency>
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
-            <version>2.8.4</version>
+            <version>2.8.6</version>
         </dependency>
         <dependency>
             <groupId>com.fasterxml.jackson.datatype</groupId>
@@ -65,8 +65,19 @@
         <dependency>
             <groupId>org.antlr</groupId>
             <artifactId>antlr4-runtime</artifactId>
-            <version>4.5.1</version>
+            <version>4.7.1</version>
         </dependency>
+        <dependency>
+            <groupId>com.graphql-java</groupId>
+            <artifactId>java-dataloader</artifactId>
+            <version>2.0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.reactivestreams</groupId>
+            <artifactId>reactive-streams</artifactId>
+            <version>1.0.2</version>
+        </dependency>
+
 
         <dependency>
             <groupId>com.graphql-java</groupId>
diff --git a/graphql/pom.xml b/graphql/pom.xml
index ea476f6..25d0e3f 100644
--- a/graphql/pom.xml
+++ b/graphql/pom.xml
@@ -31,9 +31,9 @@
     <packaging>pom</packaging>
 
     <properties>
-        <graphql.java.servlet.version>4.7.0</graphql.java.servlet.version>
-        <graphql.java.version>6.0</graphql.java.version>
-        <graphql.java.annotations.version>5.1</graphql.java.annotations.version>
+        <graphql.java.servlet.version>5.0.1</graphql.java.servlet.version>
+        <graphql.java.version>8.0</graphql.java.version>
+        <graphql.java.annotations.version>6.1</graphql.java.annotations.version>
     </properties>
 
     <modules>


[unomi] 14/27: UNOMI-180 Implement CXS GraphQL API - Update dependency versions to make the GraphQL framework work again

Posted by sh...@apache.org.
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 7abbcc85669298c982422c5d041508aecc3c9f21
Author: Serge Huber <sh...@apache.org>
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 <sh...@apache.org>
---
 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 @@
 
     <dependencies>
         <dependency>
-            <groupId>com.graphql-java</groupId>
+            <groupId>com.graphql-java-kickstart</groupId>
             <artifactId>graphql-java-servlet</artifactId>
             <version>${graphql.java.servlet.version}</version>
             <scope>provided</scope>
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 @@
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-core</artifactId>
-            <version>2.8.6</version>
+            <version>${jackson.version}</version>
+            <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-annotations</artifactId>
-            <version>2.8.6</version>
+            <version>${jackson.version}</version>
+            <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
-            <version>2.8.6</version>
+            <version>${jackson.version}</version>
+            <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>com.fasterxml.jackson.datatype</groupId>
             <artifactId>jackson-datatype-jdk8</artifactId>
-            <version>2.8.4</version>
+            <version>${jackson.version}</version>
+            <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>com.google.guava</groupId>
@@ -70,7 +74,7 @@
         <dependency>
             <groupId>com.graphql-java</groupId>
             <artifactId>java-dataloader</artifactId>
-            <version>2.0.2</version>
+            <version>2.2.0</version>
         </dependency>
         <dependency>
             <groupId>org.reactivestreams</groupId>
@@ -80,7 +84,7 @@
 
 
         <dependency>
-            <groupId>com.graphql-java</groupId>
+            <groupId>com.graphql-java-kickstart</groupId>
             <artifactId>graphql-java-servlet</artifactId>
             <version>${graphql.java.servlet.version}</version>
             <exclusions>
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 @@
     <packaging>pom</packaging>
 
     <properties>
-        <graphql.java.servlet.version>5.0.1</graphql.java.servlet.version>
-        <graphql.java.version>8.0</graphql.java.version>
+        <graphql.java.servlet.version>7.1.0</graphql.java.servlet.version>
+        <graphql.java.version>11.0</graphql.java.version>
         <graphql.java.annotations.version>6.1</graphql.java.annotations.version>
+        <jackson.version>2.9.7</jackson.version>
     </properties>
 
     <modules>


[unomi] 22/27: UNOMI-180 CDP Specification implementation - Add todo for configurability of CORS headers

Posted by sh...@apache.org.
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 c1ea4767cd05a4e140f801d634d9099abf36859f
Author: sergehuber <sh...@jahia.com>
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] 06/27: 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

Posted by sh...@apache.org.
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 defce3301b46156c7c8d75a40f50696d85d18c1b
Author: Serge Huber <sh...@apache.org>
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 <sh...@apache.org>
---
 .../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] 10/27: 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

Posted by sh...@apache.org.
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 e6477536b86b936147a4f46490de8afe19aba445
Author: Serge Huber <sh...@apache.org>
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 <sh...@apache.org>
---
 .../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<CXSEventType> 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 0000000..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.CXSEventOccurrenceFilterInput;
-import org.apache.unomi.graphql.CXSEventType;
-import org.apache.unomi.graphql.PageInfo;
+import org.apache.unomi.graphql.*;
 import org.apache.unomi.graphql.propertytypes.*;
 
 import java.util.ArrayList;
@@ -276,13 +273,8 @@ public class CXSEventBuilders implements CXSBuilder {
     }
 
     private GraphQLInputType buildCXSEventInputType() {
-        GraphQLInputObjectType.Builder cxsEventInputType = newInputObject()
-                .name("CXS_EventInput")
-                .description("The event input object to send events to the Context Server")
-                .field(newInputObjectField()
-                        .name("id")
-                        .type(GraphQLID)
-                );
+        GraphQLInputObjectType.Builder cxsEventInputType = CXSBuildersUtils.getInputBuilderFromAnnotatedClass(annotationsComponent, container, "CXS_EventInput", CXSEventInput.class)
+                .description("The event input object to send events to the Context Server");
 
         for (Map.Entry<String,CXSEventType> cxsEventTypeEntry : eventTypes.entrySet()) {
             CXSEventType cxsEventType = cxsEventTypeEntry.getValue();
@@ -414,17 +406,9 @@ public class CXSEventBuilders implements CXSBuilder {
     }
 
     private GraphQLOutputType buildCXSEventPropertiesOutputType() {
-        GraphQLObjectType.Builder eventPropertiesOutputType = newObject()
-                .name("CXS_EventProperties")
+        GraphQLObjectType.Builder eventPropertiesOutputType = CXSBuildersUtils.getOutputBuilderFromAnnotatedClass(annotationsComponent, container, "CXS_EventProperties", CXSEventProperties.class)
                 .description("All possible properties of an event");
 
-        // we create a dummy field because GraphQL requires at least one
-        eventPropertiesOutputType.field(newFieldDefinition()
-                .type(GraphQLInt)
-                .name("typeCount")
-                .description("Total count of different field types")
-        );
-
         for (Map.Entry<String,CXSEventType> cxsEventTypeEntry : eventTypes.entrySet()) {
             CXSEventType cxsEventType = cxsEventTypeEntry.getValue();
             eventPropertiesOutputType
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 a67cace..5880731 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
@@ -66,9 +66,7 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
     }
 
     public void updateGraphQLTypes() {
-
-        Map<String,GraphQLType> typeRegistry = container.getTypeRegistry();
-
+        typeRegistry.clear();
         typeRegistry.put(PageInfo.class.getName(), annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(PageInfo.class, container));
 
         typeRegistry.put("CXS_GeoPoint", annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSGeoPoint.class, container));
@@ -80,18 +78,13 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
         typeRegistry.put("CXS_EventTypeInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSEventTypeInput.class, container));
         typeRegistry.put("CXS_OrderByInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSOrderByInput.class, container));
 
+        cxsEventBuilders.updateTypes();
+
         typeRegistry.put("CXS_Query", annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSQuery.class, container));
         typeRegistry.put("CXS_Mutation", annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSMutation.class, container));
 
-        cxsEventBuilders.updateTypes();
-
     }
 
-    private GraphQLObjectType.Builder getBuilderFromAnnotatedClass(Class annotatedClass) {
-        return GraphQLObjectType.newObject()
-                .name(annotatedClass.getName())
-                .fields(((GraphQLObjectType) annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(annotatedClass, container)).getFieldDefinitions());
-    }
 
     private GraphQLOutputType getOutputTypeFromRegistry(String typeName) {
         return (GraphQLOutputType) typeRegistry.get(typeName);
@@ -108,17 +101,16 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
     @Override
     public Collection<GraphQLFieldDefinition> getQueries() {
         List<GraphQLFieldDefinition> fieldDefinitions = new ArrayList<GraphQLFieldDefinition>();
+        final CXSGraphQLProvider cxsGraphQLProvider = this;
         fieldDefinitions.add(newFieldDefinition()
                 .type(getOutputTypeFromRegistry("CXS_Query"))
                 .name("cxs")
                 .description("Root field for all CXS queries")
-                /*
-                .dataFetcher(new DataFetcher() {
-                    public Object get(DataFetchingEnvironment environment) {
-                        Map<String,Object> map = environment.getContext();
-                        return map.keySet();
+                .dataFetcher(new DataFetcher<CXSGraphQLProvider>() {
+                    public CXSGraphQLProvider get(DataFetchingEnvironment environment) {
+                        return cxsGraphQLProvider;
                     }
-                })*/.build());
+                }).build());
         return fieldDefinitions;
     }
 


[unomi] 25/27: Update project version to 1.5.0

Posted by sh...@apache.org.
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 f0a792ad3228fbdfb56a35652761fda47f90d596
Author: Serge Huber <sh...@jahia.com>
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 @@
+<!--
+  ~ 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.
+  -->
+
 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 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-graphql</artifactId>
-        <version>1.4.0-SNAPSHOT</version>
+        <version>1.5.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
@@ -82,7 +82,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-api</artifactId>
-            <version>1.4.0-SNAPSHOT</version>
+            <version>1.5.0-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>
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 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-graphql</artifactId>
-        <version>1.4.0-SNAPSHOT</version>
+        <version>1.5.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <packaging>feature</packaging>
@@ -122,7 +122,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
                 <artifactId>cdp-graphql-api-impl</artifactId>
-            <version>1.4.0-SNAPSHOT</version>
+            <version>1.5.0-SNAPSHOT</version>
         </dependency>
 
     </dependencies>
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 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-root</artifactId>
-        <version>1.4.0-SNAPSHOT</version>
+        <version>1.5.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-graphql</artifactId>


[unomi] 23/27: findSegments and findEvents fields now work partially, retrieving partially built results. Filters are not yet doing anything.

Posted by sh...@apache.org.
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 c41641684a0a12282a5acdcd5b04a6a970c05f7e
Author: Serge Huber <sh...@jahia.com>
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 0000000..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;
+                                return env.getSchema().getObjectType("CDP_ProfileUpdateEvent");
                             }
                         }))
                 .type("CDP_ProfileInterface", typeWiring -> typeWiring
@@ -142,37 +165,116 @@ public class CDPSDLServletImpl extends HttpServlet {
                                 return null;
                             }
                         }))
-                .type("CDP_Query", typeWiring -> typeWiring.dataFetcher("findEvents", new DataFetcher() {
-                    @Override
-                    public Object get(DataFetchingEnvironment dataFetchingEnvironment) throws Exception {
-                        // PartialList<Event> events = eventService.searchEvents(condition, offset, size);
-                        return null;
+                .type("Query", typeWiring -> typeWiring.dataFetcher("cdp", dataFetchingEnvironment -> "CDP"))
+                .type("CDP_Query", typeWiring -> typeWiring
+                        .dataFetcher("findEvents", dataFetchingEnvironment -> {
+                    Map<String,Object> arguments = dataFetchingEnvironment.getArguments();
+                    Integer size = (Integer) arguments.get("first");
+                    if (size == null) {
+                        size = 10;
+                    }
+                    String after = (String) arguments.get("after");
+                    if (after == null) {
+                        after = "0";
+                    }
+                    int offset = Integer.parseInt(after);
+                    Object filter = arguments.get("filter");
+                    Condition condition = eventFilter2Condition(filter);
+                    PartialList<Event> events = eventService.searchEvents(condition, offset, size);
+                    Map<String,Object> eventConnection = new HashMap<>();
+                    List<Map<String,Object>> eventEdges = new ArrayList<>();
+                    for (Event event : events.getList()) {
+                        Map<String,Object> eventEdge = new HashMap<>();
+                        Map<String,Object> eventNode = new HashMap<>();
+                        eventNode.put("id", event.getItemId());
+                        eventNode.put("__unomiEventType", event.getEventType());
+                        eventNode.put("cdp_profileID", getCDPProfileID(event.getProfileId()));
+                        eventEdge.put("node", eventNode);
+                        eventEdge.put("cursor", event.getItemId());
+                        eventEdges.add(eventEdge);
                     }
+                    eventConnection.put("edges", eventEdges);
+                    Map<String,Object> pageInfo = new HashMap<>();
+                    pageInfo.put("hasPreviousPage", false);
+                    pageInfo.put("hasNextPage", events.getTotalSize() > events.getList().size());
+                    eventConnection.put("pageInfo", pageInfo);
+                    return eventConnection;
+                })
+                .dataFetcher("findSegments", dataFetchingEnvironment -> {
+                    Map<String,Object> arguments = dataFetchingEnvironment.getArguments();
+                    Integer size = (Integer) arguments.get("first");
+                    if (size == null) {
+                        size = 10;
+                    }
+                    String after = (String) arguments.get("after");
+                    if (after == null) {
+                        after = "0";
+                    }
+                    int offset = Integer.parseInt(after);
+                    Object filter = arguments.get("filter");
+                    Condition condition = eventFilter2Condition(filter);
+
+                    Map<String,Object> segmentConnection = new HashMap<>();
+                    Query query = new Query();
+                    query.setCondition(condition);
+                    query.setLimit(size);
+                    query.setOffset(offset);
+                    // query.setSortby(sortBy);
+                    PartialList<Metadata> segmentMetadatas = segmentService.getSegmentMetadatas(query);
+                    List<Map<String,Object>> segmentEdges = new ArrayList<>();
+                    for (Metadata segmentMetadata : segmentMetadatas.getList()) {
+                        Map<String,Object> segment = new HashMap<>();
+                        segment.put("id", segmentMetadata.getId());
+                        segment.put("name", segmentMetadata.getName());
+                        Map<String,Object> segmentView = new HashMap<>();
+                        segmentView.put("name", segmentMetadata.getScope());
+                        segment.put("view", segmentView);
+                        Segment unomiSegment = segmentService.getSegmentDefinition(segmentMetadata.getId());
+                        Condition segmentCondition = unomiSegment.getCondition();
+                        segment.put("profiles", segmentConditionToProfileFilter(segmentCondition));
+                        Map<String,Object> segmentEdge = new HashMap<>();
+                        segmentEdge.put("node", segment);
+                        segmentEdge.put("cursor", segmentMetadata.getId());
+                        segmentEdges.add(segmentEdge);
+                    }
+                    segmentConnection.put("edges", segmentEdges);
+                    Map<String,Object> pageInfo = new HashMap<>();
+                    pageInfo.put("hasPreviousPage", false);
+                    pageInfo.put("hasNextPage", segmentMetadatas.getTotalSize() > segmentMetadatas.getList().size());
+                    segmentConnection.put("pageInfo", pageInfo);
+                    return segmentConnection;
                 }))
-                // 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();
     }
 
+    private Map<String, Object> segmentConditionToProfileFilter(Condition segmentCondition) {
+        Map<String,Object> profileFilter = new HashMap<>();
+        // profileFilter.put("profileIDs", new ArrayList<String>());
+        return profileFilter;
+    }
+
+    private Map<String,Object> getCDPProfileID(String profileId) {
+        Map<String,Object> cdpProfileID = new HashMap<>();
+        Map<String,Object> client = getCDPClient(profileId);
+        cdpProfileID.put("client", client);
+        cdpProfileID.put("id", profileId);
+        cdpProfileID.put("uri", "cdp_profile:" + client.get("id") + "/" + profileId);
+        return cdpProfileID;
+    }
+
+    private Map<String,Object> getCDPClient(String profileId) {
+        Map<String,Object> cdpClient = new HashMap<>();
+        cdpClient.put("id", "unomi");
+        cdpClient.put("title", "Default Unomi client");
+        return cdpClient;
+    }
+
+    private Condition eventFilter2Condition(Object filter) {
+        // todo implement transformation to proper event conditions
+        Condition matchAllCondition = new Condition(definitionsService.getConditionType("matchAllCondition"));
+        return matchAllCondition;
+    }
+
     @Override
     public void init(ServletConfig config) throws ServletException {
         super.init(config);
diff --git a/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls b/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls
index 6e178a6..1e71cbe 100644
--- a/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls
+++ b/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls
@@ -971,4 +971,10 @@ Uses RFC-3339 representation, for example 16:39:57-08:00, see
 https://github.com/graphql-java/graphql-java-extended-scalars for example
 implementation 
 """
-scalar Time
\ No newline at end of file
+scalar Time
+
+schema {
+  query : Query
+  mutation : Mutation
+  subscription : Subscription
+}
\ No newline at end of file


[unomi] 18/27: 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)

Posted by sh...@apache.org.
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 dd6192582fd63db05a6a409875b81018bcb2d243
Author: sergehuber <sh...@jahia.com>
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 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
+            <groupId>com.graphql-java</groupId>
+            <artifactId>graphql-java-extended-scalars</artifactId>
+            <version>${graphql.java.extended.scalars.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>osgi.enterprise</artifactId>
             <version>6.0.0</version>
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;
+                    }
+
+                    @Override
+                    public Object parseLiteral(Object input) throws CoercingParseLiteralException {
+                        return input;
+                    }
+                })
+                .build();
+
         return RuntimeWiring.newRuntimeWiring()
+                .scalar(ExtendedScalars.DateTime)
+                .scalar(ExtendedScalars.Date)
+                .scalar(ExtendedScalars.Json)
+                .scalar(ExtendedScalars.Time)
+                .scalar(emptyTypeWorkAroundScalarType)
+                .scalar(geopointScalarType)
+                .type("CDP_EventInterface", typeWiring -> typeWiring
+                        .typeResolver(new TypeResolver() {
+                            @Override
+                            public GraphQLObjectType getType(TypeResolutionEnvironment env) {
+                                return null;
+                            }
+                        }))
+                .type("CDP_ProfileInterface", typeWiring -> typeWiring
+                        .typeResolver(new TypeResolver() {
+                            @Override
+                            public GraphQLObjectType getType(TypeResolutionEnvironment env) {
+                                return null;
+                            }
+                        }))
+                .type("CDP_PropertyInterface", typeWiring -> typeWiring
+                        .typeResolver(new TypeResolver() {
+                            @Override
+                            public GraphQLObjectType getType(TypeResolutionEnvironment env) {
+                                return null;
+                            }
+                        }))
                 // .scalar(CustomScalar)
                 // this uses builder function lambda syntax
                 /*
@@ -93,6 +177,60 @@ public class CDPSDLServletImpl extends HttpServlet {
 
         RuntimeWiring wiring = buildRuntimeWiring();
         GraphQLSchema graphQLSchema = schemaGenerator.makeExecutableSchema(typeRegistry, wiring);
+        graphQL = GraphQL.newGraphQL(graphQLSchema)
+                .build();
+
+        objectMapper = new ObjectMapper();
+        objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
+    }
+
+    @Override
+    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+        String query = req.getParameter("query");
+        if ("/schema.json".equals(req.getPathInfo())) {
+            query = IntrospectionQuery.INTROSPECTION_QUERY;
+        }
+        String operationName = req.getParameter("operationName");
+        String variableStr = req.getParameter("variables");
+        Map<String, Object> variables = new HashMap<>();
+        if ((variableStr != null) && (variableStr.trim().length() > 0)) {
+            TypeReference<Map<String, Object>> typeRef = new TypeReference<Map<String, Object>>() {
+            };
+            variables = objectMapper.readValue(variableStr, typeRef);
+        }
+
+        executeGraphQLRequest(resp, query, operationName, variables);
+    }
+
+    private void executeGraphQLRequest(HttpServletResponse resp, String query, String operationName, Map<String, Object> variables) throws IOException {
+        ExecutionInput executionInput = ExecutionInput.newExecutionInput()
+                .query(query)
+                .variables(variables)
+                .operationName(operationName)
+                .build();
+
+        ExecutionResult executionResult = graphQL.execute(executionInput);
+
+        Map<String, Object> 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();
+        TypeReference<Map<String, Object>> typeRef = new TypeReference<Map<String, Object>>() {
+        };
+        Map<String, Object> body = objectMapper.readValue(bodyStream, typeRef);
+        String query = (String) body.get("query");
+        String operationName = (String) body.get("operationName");
+        Map<String, Object> variables = (Map<String, Object>) body.get("variables");
+        if (variables == null) {
+            variables = new HashMap<>();
+        }
+
+        executeGraphQLRequest(resp, query, operationName, variables);
     }
 
     private Reader getSchemaReader(String resourceUrl) {
diff --git a/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls b/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls
index 7a924ca..6e178a6 100644
--- a/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls
+++ b/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls
@@ -971,8 +971,4 @@ Uses RFC-3339 representation, for example 16:39:57-08:00, see
 https://github.com/graphql-java/graphql-java-extended-scalars for example
 implementation 
 """
-scalar Time
-
-"""The `Upload` scalar type represents a file upload."""
-scalar Upload
-
+scalar Time
\ No newline at end of file
diff --git a/graphql/karaf-feature/pom.xml b/graphql/karaf-feature/pom.xml
index b813872..ae56dd4 100644
--- a/graphql/karaf-feature/pom.xml
+++ b/graphql/karaf-feature/pom.xml
@@ -115,6 +115,11 @@
             <version>${graphql.java.annotations.version}</version>
         </dependency>
         <dependency>
+            <groupId>com.graphql-java</groupId>
+            <artifactId>graphql-java-extended-scalars</artifactId>
+            <version>${graphql.java.extended.scalars.version}</version>
+        </dependency>
+        <dependency>
             <groupId>org.apache.unomi</groupId>
                 <artifactId>cdp-graphql-api-impl</artifactId>
             <version>1.4.0-SNAPSHOT</version>
diff --git a/graphql/pom.xml b/graphql/pom.xml
index 260f787..26f1644 100644
--- a/graphql/pom.xml
+++ b/graphql/pom.xml
@@ -34,6 +34,7 @@
         <graphql.java.servlet.version>7.4.1</graphql.java.servlet.version>
         <graphql.java.version>12.0</graphql.java.version>
         <graphql.java.annotations.version>7.0</graphql.java.annotations.version>
+        <graphql.java.extended.scalars.version>1.0</graphql.java.extended.scalars.version>
         <jackson.version>2.9.7</jackson.version>
     </properties>
 


[unomi] 21/27: Initial work on integrating event service.

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shuber pushed a commit to branch UNOMI-180-CXS-GRAPHQLAPI
in repository https://gitbox.apache.org/repos/asf/unomi.git

commit b4f89b3919d10448d5482007b4b789a05696e2ee
Author: Serge Huber <sh...@jahia.com>
AuthorDate: Sun May 26 11:32:18 2019 +0200

    Initial work on integrating event service.
---
 .../unomi/graphql/internal/CDPSDLServletImpl.java      | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CDPSDLServletImpl.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CDPSDLServletImpl.java
index 5abb6fb..1545aa2 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CDPSDLServletImpl.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CDPSDLServletImpl.java
@@ -32,9 +32,13 @@ import graphql.schema.idl.RuntimeWiring;
 import graphql.schema.idl.SchemaGenerator;
 import graphql.schema.idl.SchemaParser;
 import graphql.schema.idl.TypeDefinitionRegistry;
+import org.apache.unomi.api.Event;
+import org.apache.unomi.api.PartialList;
+import org.apache.unomi.api.services.EventService;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
 
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
@@ -56,12 +60,18 @@ public class CDPSDLServletImpl extends HttpServlet {
     private ObjectMapper objectMapper;
     private GraphQL graphQL;
 
+    private EventService eventService;
 
     @Activate
     void activate(BundleContext bundleContext) {
         this.bundleContext = bundleContext;
     }
 
+    @Reference
+    public void setEventService(EventService eventService) {
+        this.eventService = eventService;
+    }
+
     RuntimeWiring buildRuntimeWiring() {
 
         GraphQLScalarType emptyTypeWorkAroundScalarType = GraphQLScalarType.newScalar()
@@ -134,7 +144,13 @@ public class CDPSDLServletImpl extends HttpServlet {
                                 return null;
                             }
                         }))
-                // .scalar(CustomScalar)
+                .type("CDP_Query", typeWiring -> typeWiring.dataFetcher("findEvents", new DataFetcher() {
+                    @Override
+                    public Object get(DataFetchingEnvironment dataFetchingEnvironment) throws Exception {
+                        // PartialList<Event> events = eventService.searchEvents(condition, offset, size);
+                        return null;
+                    }
+                }))
                 // this uses builder function lambda syntax
                 /*
                 .type("QueryType", typeWiring -> typeWiring


[unomi] 15/27: UNOMI-180 - Updated GraphQL projects to latest version - Added CDP SDL schema generated from latest CDP specification

Posted by sh...@apache.org.
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 12f6acc1f3576945b7c62c10b1f2ff15e1ed54b3
Author: sergehuber <sh...@jahia.com>
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 0000000..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 @@
     <packaging>pom</packaging>
 
     <properties>
-        <graphql.java.servlet.version>7.1.0</graphql.java.servlet.version>
-        <graphql.java.version>11.0</graphql.java.version>
-        <graphql.java.annotations.version>6.1</graphql.java.annotations.version>
+        <graphql.java.servlet.version>7.4.1</graphql.java.servlet.version>
+        <graphql.java.version>12.0</graphql.java.version>
+        <graphql.java.annotations.version>7.0</graphql.java.annotations.version>
         <jackson.version>2.9.7</jackson.version>
     </properties>
 


[unomi] 05/27: UNOMI-180 Implement CXS GraphQL API - We now have basic filtering generation for event types working !

Posted by sh...@apache.org.
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 ba2336c7feb9a950f738c076475bfa17cb3e7596
Author: Serge Huber <sh...@apache.org>
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 <sh...@apache.org>
---
 .../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 0000000..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 0000000..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 0000000..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 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 CXSGeoDistanceInput {
+    @GraphQLField
+    public CXSGeoPoint center;
+    @GraphQLField
+    public CXSGeoDistanceUnit unit;
+    @GraphQLField
+    public float distance;
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoDistanceUnit.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoDistanceUnit.java
new file mode 100644
index 0000000..5db4d3e
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoDistanceUnit.java
@@ -0,0 +1,23 @@
+/*
+ * 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;
+
+public enum CXSGeoDistanceUnit {
+    METERS,
+    KILOMETERS,
+    MILES
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointInput.java
new file mode 100644
index 0000000..19b0297
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointInput.java
@@ -0,0 +1,26 @@
+/*
+ * 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 CXSGeoPointInput {
+    @GraphQLField
+    public float longitude;
+    @GraphQLField
+    public float latitude;
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSOrderByInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSOrderByInput.java
new file mode 100644
index 0000000..a0221d2
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSOrderByInput.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;
+
+public class CXSOrderByInput {
+
+    @GraphQLField
+    public String fieldName;
+
+    @GraphQLField
+    public CXSSortOrder sortOrder;
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSortOrder.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSortOrder.java
new file mode 100644
index 0000000..ca0f3bd
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSortOrder.java
@@ -0,0 +1,23 @@
+/*
+ * 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;
+
+public enum CXSSortOrder {
+    ASC,
+    DESC,
+    UNSPECIFIED
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/PageInfo.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/PageInfo.java
new file mode 100644
index 0000000..a49d774
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/PageInfo.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;
+
+public class PageInfo {
+
+    @GraphQLField
+    public boolean hasPreviousPage;
+    @GraphQLField
+    public boolean hasNextPage;
+
+}
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 6d5a792..2c7a0b4 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
@@ -58,28 +58,229 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
 
     private void updateGraphQLTypes() {
 
+        registeredOutputTypes.put(PageInfo.class.getName(), annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(PageInfo.class, container));
+
         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(CXSGeoDistanceInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSGeoDistanceInput.class, container));
+        registeredInputTypes.put(CXSDateFilterInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSDateFilterInput.class, container));
         registeredInputTypes.put(CXSEventTypeInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSEventTypeInput.class, container));
+        registeredInputTypes.put(CXSOrderByInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSOrderByInput.class, container));
         registeredInputTypes.put("CXS_EventInput", buildCXSEventInputType());
+        registeredInputTypes.put(CXSEventOccurrenceFilterInput.class.getName(), annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSEventOccurrenceFilterInput.class, container));
+        registeredInputTypes.put("CXS_EventPropertiesFilterInput", buildCXSEventPropertiesFilterInput());
+        registeredInputTypes.put("CXS_EventFilterInput", buildCXSEventFilterInputType());
 
         registeredOutputTypes.put("CXS_EventProperties", buildCXSEventPropertiesOutputType());
 
-        /*
-        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("CXS_Event", buildCXSEventOutputType());
+        registeredOutputTypes.put("CXS_EventEdge", buildCXSEventEdgeOutputType());
+        registeredOutputTypes.put("CXS_EventConnection", buildCXSEventConnectionOutputType());
         registeredOutputTypes.put("CXS_Query", buildCXSQueryOutputType());
         registeredOutputTypes.put("CXS_Mutation", buildCXSMutationOutputType());
     }
 
+    private GraphQLOutputType buildCXSEventEdgeOutputType() {
+        return newObject()
+                .name("CXS_EventEdge")
+                .description("The Relay edge type for the CXS_Event output type")
+                .field(newFieldDefinition()
+                        .name("node")
+                        .type(registeredOutputTypes.get("CXS_Event"))
+                )
+                .field(newFieldDefinition()
+                        .name("cursor")
+                        .type(GraphQLString)
+                )
+                .build();
+    }
+
+    private GraphQLOutputType buildCXSEventConnectionOutputType() {
+        return newObject()
+                .name("CXS_EventConnection")
+                .description("The Relay connection type for the CXS_Event output type")
+                .field(newFieldDefinition()
+                        .name("edges")
+                        .type(new GraphQLList(registeredOutputTypes.get("CXS_EventEdge")))
+                )
+                .field(newFieldDefinition()
+                        .name("pageInfo")
+                        .type(new GraphQLList(registeredOutputTypes.get(PageInfo.class.getName())))
+                )
+                .build();
+    }
+
+    private GraphQLInputType buildCXSEventPropertiesFilterInput() {
+        GraphQLInputObjectType.Builder cxsEventPropertiesFilterInput = newInputObject()
+                .name("CXS_EventPropertiesFilterInput")
+                .description("Filter conditions for each event types and built-in properties");
+
+        generateEventPropertiesFilters(cxsEventPropertiesFilterInput);
+        generateEventTypesFilters(cxsEventPropertiesFilterInput);
+
+        return cxsEventPropertiesFilterInput.build();
+    }
+
+
+    private void generateEventPropertiesFilters(GraphQLInputObjectType.Builder cxsEventPropertiesFilterInput) {
+        addIdentityFilters("id", cxsEventPropertiesFilterInput);
+        addIdentityFilters("sourceId", cxsEventPropertiesFilterInput);
+        addIdentityFilters("clientId", cxsEventPropertiesFilterInput);
+        addIdentityFilters("profileId", cxsEventPropertiesFilterInput);
+        addDistanceFilters("location", cxsEventPropertiesFilterInput);
+        addDateFilters("timestamp", cxsEventPropertiesFilterInput);
+    }
+
+    private void generateEventTypesFilters(GraphQLInputObjectType.Builder cxsEventPropertiesFilterInput) {
+        for (Map.Entry<String,CXSEventType> eventTypeEntry : eventTypes.entrySet()) {
+            addSetFilters(eventTypeEntry.getKey(), eventTypeEntry.getValue().properties, cxsEventPropertiesFilterInput);
+        }
+    }
+
+    private void addSetFilters(String eventTypeName, List<CXSPropertyType> properties, GraphQLInputObjectType.Builder inputTypeBuilder) {
+        GraphQLInputObjectType.Builder eventTypeFilterInput = newInputObject()
+                .name(eventTypeName + "FilterInput")
+                .description("Auto-generated filter input type for event type " + eventTypeName);
+
+        for (CXSPropertyType cxsPropertyType : properties) {
+            if (cxsPropertyType instanceof CXSIdentifierPropertyType) {
+                addIdentityFilters(cxsPropertyType.name, eventTypeFilterInput);
+            } else if (cxsPropertyType instanceof CXSStringPropertyType) {
+                addStringFilters(cxsPropertyType.name, eventTypeFilterInput);
+            } else if (cxsPropertyType instanceof CXSBooleanPropertyType) {
+                addBooleanFilters(cxsPropertyType.name, eventTypeFilterInput);
+            } else if (cxsPropertyType instanceof CXSIntPropertyType) {
+                addIntegerFilters(cxsPropertyType.name, eventTypeFilterInput);
+            } else if (cxsPropertyType instanceof CXSFloatPropertyType) {
+                addFloatFilters(cxsPropertyType.name, eventTypeFilterInput);
+            } else if (cxsPropertyType instanceof CXSGeoPointPropertyType) {
+                addDistanceFilters(cxsPropertyType.name, eventTypeFilterInput);
+            } else if (cxsPropertyType instanceof CXSDatePropertyType) {
+                addDateFilters(cxsPropertyType.name, eventTypeFilterInput);
+            } else if (cxsPropertyType instanceof CXSSetPropertyType) {
+                addSetFilters(cxsPropertyType.name, ((CXSSetPropertyType) cxsPropertyType).properties, eventTypeFilterInput);
+            }
+        }
+
+        registeredInputTypes.put(eventTypeName + "FilterInput", eventTypeFilterInput.build());
+
+        inputTypeBuilder.field(newInputObjectField()
+                .name(eventTypeName)
+                .type(registeredInputTypes.get(eventTypeName + "FilterInput"))
+        );
+
+    }
+
+    private void addIdentityFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
+        inputTypeBuilder.field(newInputObjectField()
+                .name(propertyName + "_equals")
+                .type(GraphQLString)
+        );
+    }
+
+    private void addStringFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
+        inputTypeBuilder.field(newInputObjectField()
+                .name(propertyName + "_equals")
+                .type(GraphQLString)
+        );
+        inputTypeBuilder.field(newInputObjectField()
+                .name(propertyName + "_regexp")
+                .type(GraphQLString)
+        );
+    }
+
+    private void addBooleanFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
+        inputTypeBuilder.field(newInputObjectField()
+                .name(propertyName + "_equals")
+                .type(GraphQLBoolean)
+        );
+    }
+
+    private void addIntegerFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
+        inputTypeBuilder.field(newInputObjectField()
+                .name(propertyName + "_equals")
+                .type(GraphQLInt)
+        );
+        inputTypeBuilder.field(newInputObjectField()
+                .name(propertyName + "_gt")
+                .type(GraphQLInt)
+        );
+        inputTypeBuilder.field(newInputObjectField()
+                .name(propertyName + "_gte")
+                .type(GraphQLInt)
+        );
+        inputTypeBuilder.field(newInputObjectField()
+                .name(propertyName + "_lt")
+                .type(GraphQLInt)
+        );
+        inputTypeBuilder.field(newInputObjectField()
+                .name(propertyName + "_lte")
+                .type(GraphQLInt)
+        );
+    }
+
+    private void addFloatFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
+        inputTypeBuilder.field(newInputObjectField()
+                .name(propertyName + "_equals")
+                .type(GraphQLFloat)
+        );
+        inputTypeBuilder.field(newInputObjectField()
+                .name(propertyName + "_gt")
+                .type(GraphQLFloat)
+        );
+        inputTypeBuilder.field(newInputObjectField()
+                .name(propertyName + "_gte")
+                .type(GraphQLFloat)
+        );
+        inputTypeBuilder.field(newInputObjectField()
+                .name(propertyName + "_lt")
+                .type(GraphQLFloat)
+        );
+        inputTypeBuilder.field(newInputObjectField()
+                .name(propertyName + "_lte")
+                .type(GraphQLFloat)
+        );
+    }
+
+    private void addDistanceFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
+        inputTypeBuilder.field(newInputObjectField()
+                .name(propertyName + "_distance")
+                .type(registeredInputTypes.get(CXSGeoDistanceInput.class.getName()))
+        );
+    }
+
+    private void addDateFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
+        inputTypeBuilder.field(newInputObjectField()
+                .name(propertyName + "_between")
+                .type(registeredInputTypes.get(CXSDateFilterInput.class.getName()))
+        );
+    }
+
+    private GraphQLInputType buildCXSEventFilterInputType() {
+        GraphQLInputObjectType.Builder cxsEventFilterInputType = newInputObject()
+                .name("CXS_EventFilterInput")
+                .description("Filter conditions for each event types and built-in properties")
+                .field(newInputObjectField()
+                        .name("and")
+                        .type(new GraphQLList(new GraphQLTypeReference("CXS_EventFilterInput")))
+                )
+                .field(newInputObjectField()
+                        .name("or")
+                        .type(new GraphQLList(new GraphQLTypeReference("CXS_EventFilterInput")))
+                )
+                .field(newInputObjectField()
+                        .name("properties")
+                        .type(registeredInputTypes.get("CXS_EventPropertiesFilterInput"))
+                )
+                .field(newInputObjectField()
+                        .name("eventOccurrence")
+                        .type(registeredInputTypes.get(CXSEventOccurrenceFilterInput.class.getName()))
+                );
+        return cxsEventFilterInputType.build();
+    }
+
     private GraphQLInputType buildCXSEventInputType() {
         GraphQLInputObjectType.Builder cxsEventInputType = newInputObject()
                 .name("CXS_EventInput")
@@ -201,6 +402,74 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                         .name("getEvent")
                         .description("Retrieves a specific event")
                 )
+                .field(newFieldDefinition()
+                        .type(new GraphQLList(registeredOutputTypes.get("CXS_EventConnection")))
+                        .name("findEvents")
+                        .argument(newArgument()
+                                .name("filter")
+                                .type(registeredInputTypes.get("CXS_EventFilterInput"))
+                        )
+                        .argument(newArgument()
+                                .name("orderBy")
+                                .type(registeredInputTypes.get(CXSOrderByInput.class.getName()))
+                        )
+                        .argument(newArgument()
+                                .name("first")
+                                .type(GraphQLInt)
+                                .description("Number of objects to retrieve starting at the after cursor position")
+                        )
+                        .argument(newArgument()
+                                .name("after")
+                                .type(GraphQLString)
+                                .description("Starting cursor location to retrieve the object from")
+                        )
+                        .argument(newArgument()
+                                .name("last")
+                                .type(GraphQLInt)
+                                .description("Number of objects to retrieve end at the before cursor position")
+                        )
+                        .argument(newArgument()
+                                .name("before")
+                                .type(GraphQLString)
+                                .description("End cursor location to retrieve the object from")
+                        )
+                        .description("Retrieves the events that match the specified filters")
+                )
+                /*
+                .field(newFieldDefinition()
+                        .type(new GraphQLList(registeredOutputTypes.get("CXS_ProfileConnection")))
+                        .name("findProfiles")
+                        .argument(newArgument()
+                                .name("filter")
+                                .type(registeredInputTypes.get("CXS_ProfileFilterInput"))
+                        )
+                        .argument(newArgument()
+                                .name("orderBy")
+                                .type(registeredInputTypes.get(CXSOrderByInput.class.getName()))
+                        )
+                        .argument(newArgument()
+                                .name("first")
+                                .type(GraphQLInt)
+                                .description("Number of objects to retrieve starting at the after cursor position")
+                        )
+                        .argument(newArgument()
+                                .name("after")
+                                .type(GraphQLString)
+                                .description("Starting cursor location to retrieve the object from")
+                        )
+                        .argument(newArgument()
+                                .name("last")
+                                .type(GraphQLInt)
+                                .description("Number of objects to retrieve end at the before cursor position")
+                        )
+                        .argument(newArgument()
+                                .name("before")
+                                .type(GraphQLString)
+                                .description("End cursor location to retrieve the object from")
+                        )
+                        .description("Retrieves the profiles that match the specified profiles")
+                )
+                */
                 .build();
     }
 


[unomi] 02/27: 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.

Posted by sh...@apache.org.
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 bdf3c9ad4dd6c783aee57fa6f4c8b061d116c791
Author: Serge Huber <sh...@apache.org>
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 <sh...@apache.org>
---
 .../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 0000000..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<String> tags;
+    @GraphQLField
+    public List<String> 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 0000000..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/CXSDatePropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDatePropertyTypeInput.java
new file mode 100644
index 0000000..e8036aa
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSDatePropertyTypeInput.java
@@ -0,0 +1,26 @@
+/*
+ * 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 CXSDatePropertyTypeInput extends AbstractPropertyTypeInput {
+
+    @GraphQLField
+    public String defaultValue;
+
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventTypeInput.java
new file mode 100644
index 0000000..b84175f
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventTypeInput.java
@@ -0,0 +1,36 @@
+/*
+ * 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 CXSEventTypeInput {
+
+    @GraphQLField
+    public String id;
+
+    @GraphQLField
+    public String scope;
+
+    @GraphQLField
+    public String typeName;
+
+    @GraphQLField
+    public List<CXSPropertyTypeInput> properties;
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSFloatPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSFloatPropertyTypeInput.java
new file mode 100644
index 0000000..038f4a5
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSFloatPropertyTypeInput.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 CXSFloatPropertyTypeInput extends AbstractPropertyTypeInput{
+
+    @GraphQLField
+    public float minValue;
+    @GraphQLField
+    public float maxValue;
+    @GraphQLField
+    public float defaultValue;
+
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointPropertyTypeInput.java
new file mode 100644
index 0000000..c32def1
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointPropertyTypeInput.java
@@ -0,0 +1,25 @@
+/*
+ * 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 CXSGeoPointPropertyTypeInput extends AbstractPropertyTypeInput {
+
+    @GraphQLField
+    public String defaultValue;
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIdentifierPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIdentifierPropertyTypeInput.java
new file mode 100644
index 0000000..49869bc
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIdentifierPropertyTypeInput.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;
+
+public class CXSIdentifierPropertyTypeInput extends AbstractPropertyTypeInput {
+
+    @GraphQLField
+    public String regexp;
+    @GraphQLField
+    public String defaultValue;
+
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIntPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIntPropertyTypeInput.java
new file mode 100644
index 0000000..f2dac72
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIntPropertyTypeInput.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 CXSIntPropertyTypeInput extends AbstractPropertyTypeInput {
+
+    @GraphQLField
+    public int minValue;
+    @GraphQLField
+    public int maxValue;
+    @GraphQLField
+    public int defaultValue;
+
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java
new file mode 100644
index 0000000..60a1aa4
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java
@@ -0,0 +1,56 @@
+/*
+ * 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("CXSPropertyTypeInput")
+public class CXSPropertyTypeInput {
+
+    @GraphQLField
+    @GraphQLName("identifier")
+    public CXSIdentifierPropertyTypeInput identifierPropertyTypeInput;
+
+    @GraphQLField
+    @GraphQLName("string")
+    public CXSStringPropertyTypeInput stringPropertyTypeInput;
+
+    @GraphQLField
+    @GraphQLName("int")
+    public CXSIntPropertyTypeInput integer;
+
+    @GraphQLField
+    @GraphQLName("float")
+    public CXSFloatPropertyTypeInput floatPropertyTypeInput;
+
+    @GraphQLField
+    @GraphQLName("date")
+    public CXSDatePropertyTypeInput datePropertyTypeInput;
+
+    @GraphQLField
+    @GraphQLName("boolean")
+    public CXSBooleanPropertyTypeInput booleanPropertyTypeInput;
+
+    @GraphQLField
+    @GraphQLName("geopoint")
+    public CXSGeoPointPropertyTypeInput geoPointPropertyTypeInput;
+
+    @GraphQLField
+    @GraphQLName("set")
+    public CXSSetPropertyTypeInput setPropertyTypeInput;
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java
new file mode 100644
index 0000000..5db69dd
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java
@@ -0,0 +1,27 @@
+/*
+ * 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 CXSSetPropertyTypeInput extends AbstractPropertyTypeInput {
+
+    @GraphQLField
+    public List<CXSPropertyTypeInput> properties;
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSStringPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSStringPropertyTypeInput.java
new file mode 100644
index 0000000..c44496f
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSStringPropertyTypeInput.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;
+
+public class CXSStringPropertyTypeInput extends AbstractPropertyTypeInput {
+
+    @GraphQLField
+    public String regexp;
+    @GraphQLField
+    public String defaultValue;
+
+}
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 e451dde..b9e876a 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
@@ -17,6 +17,11 @@
 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.schema.*;
 import graphql.servlet.GraphQLMutationProvider;
 import graphql.servlet.GraphQLQueryProvider;
@@ -31,6 +36,7 @@ import org.osgi.service.component.annotations.Deactivate;
 import java.util.*;
 
 import static graphql.Scalars.*;
+import static graphql.schema.GraphQLArgument.newArgument;
 import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
 import static graphql.schema.GraphQLObjectType.newObject;
 
@@ -41,6 +47,7 @@ import static graphql.schema.GraphQLObjectType.newObject;
 public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryProvider, GraphQLTypesProvider, GraphQLMutationProvider {
 
     private Map<String,GraphQLOutputType> registeredOutputTypes = new TreeMap<>();
+    private Map<String,GraphQLInputType> registeredInputTypes = new TreeMap<>();
 
     @Activate
     void activate(
@@ -52,8 +59,15 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
         registeredOutputTypes.put(CXSProperties.class.getName(), GraphQLAnnotations.object(CXSProperties.class));
         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("CXS_Event", buildCXSEventOutputType());
         registeredOutputTypes.put("CXS_Query", buildCXSQueryOutputType());
+        registeredOutputTypes.put("CXS_Mutation", buildCXSMutationOutputType());
     }
 
     @Deactivate
@@ -88,7 +102,18 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
 
     @Override
     public Collection<GraphQLFieldDefinition> getMutations() {
-        return new ArrayList<>();
+        List<GraphQLFieldDefinition> fieldDefinitions = new ArrayList<GraphQLFieldDefinition>();
+        fieldDefinitions.add(newFieldDefinition()
+                .type(registeredOutputTypes.get("CXS_Mutation"))
+                .name("cxs")
+                .description("Root field for all CXS mutation")
+                .dataFetcher(new DataFetcher() {
+                    public Object get(DataFetchingEnvironment environment) {
+                        Map<String,Object> map = environment.getContext();
+                        return map.keySet();
+                    }
+                }).build());
+        return fieldDefinitions;
     }
 
     private GraphQLOutputType buildCXSQueryOutputType() {
@@ -103,6 +128,22 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                 .build();
     }
 
+    private GraphQLOutputType buildCXSMutationOutputType() {
+        return newObject()
+                .name("CXS_Mutation")
+                .description("Root CXS mutation type")
+                .field(newFieldDefinition()
+                        .type(registeredOutputTypes.get(CXSEventType.class.getName()))
+                        .name("createOrUpdateEventType")
+                        .argument(newArgument()
+                                .name("eventType")
+                                .type(registeredInputTypes.get(CXSEventTypeInput.class.getName()))
+                        )
+                        .description("Create or updates a CXS event type in the Apache Unomi server")
+                )
+                .build();
+    }
+
 
     private GraphQLOutputType buildCXSEventOutputType() {
         return newObject()


[unomi] 12/27: UNOMI-180 Implement CXS GraphQL API - Rename CXS to CDP

Posted by sh...@apache.org.
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 bc6a88792a6ffac44d0101d7254d02a6aade9cf3
Author: Serge Huber <sh...@apache.org>
AuthorDate: Mon Nov 19 18:17:11 2018 +0100

    UNOMI-180 Implement CXS GraphQL API
    - Rename CXS to CDP
    
    Signed-off-by: Serge Huber <sh...@apache.org>
---
 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 @@
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>cxs-graphql-api-impl</artifactId>
-    <name>Apache Unomi :: GraphQL API :: CXS Implementation</name>
-    <description>Apache Unomi Context GraphQL API CXS Implementation</description>
+    <artifactId>cdp-graphql-api-impl</artifactId>
+    <name>Apache Unomi :: GraphQL API :: CDP Implementation</name>
+    <description>Apache Unomi Context GraphQL API CDP Implementation</description>
     <packaging>bundle</packaging>
 
     <dependencies>
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<String, CXSEventType> getEventTypes();
-    CXSProviderManager getCxsProviderManager();
+    Map<String, CDPEventType> getEventTypes();
+    CDPProviderManager getCdpProviderManager();
     void updateGraphQLTypes();
-    void setCxsProviderManager(CXSProviderManager cxsProviderManager);
+    void setCdpProviderManager(CDPProviderManager cdpProviderManager);
 
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CDPMutation.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CDPMutation.java
new file mode 100644
index 0000000..fd72f84
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CDPMutation.java
@@ -0,0 +1,128 @@
+/*
+ * 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;
+import graphql.schema.DataFetchingEnvironment;
+import org.apache.unomi.graphql.propertytypes.CDPIdentifierPropertyType;
+import org.apache.unomi.graphql.propertytypes.CDPPropertyType;
+import org.apache.unomi.graphql.propertytypes.CDPSetPropertyType;
+import org.apache.unomi.graphql.propertytypes.CDPStringPropertyType;
+import org.apache.unomi.graphql.types.input.CDPEventInput;
+import org.apache.unomi.graphql.types.input.CDPEventTypeInput;
+import org.apache.unomi.graphql.types.input.CDPPropertyTypeInput;
+import org.apache.unomi.graphql.types.input.CDPSetPropertyTypeInput;
+import org.apache.unomi.graphql.types.output.CDPEventType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@GraphQLName("CDP_Mutation")
+public class CDPMutation {
+
+    CDPGraphQLProvider cdpGraphQLProvider;
+
+    public CDPMutation(CDPGraphQLProvider cdpGraphQLProvider) {
+        this.cdpGraphQLProvider = cdpGraphQLProvider;
+    }
+
+    @GraphQLField
+    public CDPEventType createOrUpdateEventType(DataFetchingEnvironment env, @GraphQLName("eventType") CDPEventTypeInput cdpEventTypeInput) {
+
+        CDPEventType cdpEventType = new CDPEventType(cdpEventTypeInput.getId(), cdpEventTypeInput.getScope(), cdpEventTypeInput.getTypeName(), new ArrayList<>());
+        for (CDPPropertyTypeInput propertyTypeInput : cdpEventTypeInput.getProperties()) {
+            CDPPropertyType propertyType = getPropertyType(propertyTypeInput);
+            cdpEventType.getProperties().add(propertyType);
+        }
+        cdpGraphQLProvider.getEventTypes().put(cdpEventType.getTypeName(), cdpEventType);
+        cdpGraphQLProvider.updateGraphQLTypes();
+        if (cdpGraphQLProvider.getCdpProviderManager() != null) {
+            cdpGraphQLProvider.getCdpProviderManager().refreshProviders();
+        }
+        return cdpEventType;
+
+    }
+
+    @GraphQLField
+    public int processEvents(DataFetchingEnvironment env, @GraphQLName("events") List<CDPEventInput> events) {
+        return 0;
+    }
+
+    private CDPPropertyType getPropertyType(CDPPropertyTypeInput cdpPropertyTypeInput) {
+        CDPPropertyType propertyType = null;
+        if (cdpPropertyTypeInput.identifierPropertyTypeInput != null) {
+            propertyType = getIdentifierPropertyType(cdpPropertyTypeInput.identifierPropertyTypeInput);
+        } else if (cdpPropertyTypeInput.stringPropertyTypeInput != null) {
+            propertyType = getStringPropertyType(cdpPropertyTypeInput.stringPropertyTypeInput);
+        } else if (cdpPropertyTypeInput.setPropertyTypeInput != null) {
+            propertyType = getSetPropertyType(cdpPropertyTypeInput.setPropertyTypeInput);
+        }
+        return propertyType;
+    }
+
+    private CDPPropertyType getSetPropertyType(CDPSetPropertyTypeInput cdpSetPropertyTypeInput) {
+        List<CDPPropertyType> setProperties = null;
+        if (cdpSetPropertyTypeInput.getProperties() != null) {
+            setProperties = new ArrayList<>();
+            for (CDPPropertyTypeInput setProperty : cdpSetPropertyTypeInput.getProperties()) {
+                CDPPropertyType subPropertyType = getPropertyType(setProperty);
+                if (subPropertyType != null) {
+                    setProperties.add(subPropertyType);
+                }
+            }
+        }
+        return new CDPSetPropertyType(
+                cdpSetPropertyTypeInput.getId(),
+                cdpSetPropertyTypeInput.getName(),
+                cdpSetPropertyTypeInput.getMinOccurrences(),
+                cdpSetPropertyTypeInput.getMaxOccurrences(),
+                cdpSetPropertyTypeInput.getTags(),
+                cdpSetPropertyTypeInput.getSystemTags(),
+                cdpSetPropertyTypeInput.isPersonalData(),
+                setProperties);
+    }
+
+    private CDPPropertyType getStringPropertyType(CDPStringPropertyType stringPropertyType) {
+        return new CDPStringPropertyType(
+                stringPropertyType.getId(),
+                stringPropertyType.getName(),
+                stringPropertyType.getMinOccurrences(),
+                stringPropertyType.getMaxOccurrences(),
+                stringPropertyType.getTags(),
+                stringPropertyType.getSystemTags(),
+                stringPropertyType.isPersonalData(),
+                stringPropertyType.getRegexp(),
+                stringPropertyType.getDefaultValue()
+                );
+    }
+
+    private CDPPropertyType getIdentifierPropertyType(CDPIdentifierPropertyType identifierPropertyType) {
+        return new CDPIdentifierPropertyType(
+                identifierPropertyType.getId(),
+                identifierPropertyType.getName(),
+                identifierPropertyType.getMinOccurrences(),
+                identifierPropertyType.getMaxOccurrences(),
+                identifierPropertyType.getTags(),
+                identifierPropertyType.getSystemTags(),
+                identifierPropertyType.isPersonalData(),
+                identifierPropertyType.getRegexp(),
+                identifierPropertyType.getDefaultValue()
+        );
+    }
+
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProfilePropertiesFilter.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CDPProfilePropertiesFilter.java
similarity index 84%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProfilePropertiesFilter.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CDPProfilePropertiesFilter.java
index ff005af..f7b4d4a 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProfilePropertiesFilter.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CDPProfilePropertiesFilter.java
@@ -21,15 +21,15 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_ProfilePropertiesFilter")
-public class CXSProfilePropertiesFilter {
+@GraphQLName("CDP_ProfilePropertiesFilter")
+public class CDPProfilePropertiesFilter {
 
     @GraphQLField
     @GraphQLName("and")
-    public List<CXSProfilePropertiesFilter> andFilters;
+    public List<CDPProfilePropertiesFilter> andFilters;
 
     @GraphQLField
     @GraphQLName("or")
-    public List<CXSProfilePropertiesFilter> orFilters;
+    public List<CDPProfilePropertiesFilter> orFilters;
 
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CDPProviderManager.java
similarity index 96%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CDPProviderManager.java
index 66d4d93..7024733 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CDPProviderManager.java
@@ -18,7 +18,7 @@ package org.apache.unomi.graphql;
 
 import org.apache.unomi.api.services.SegmentService;
 
-public interface CXSProviderManager {
+public interface CDPProviderManager {
 
     void refreshProviders();
 
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/CDPQuery.java
similarity index 60%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSQuery.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CDPQuery.java
index 728bb38..2d88bc4 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/CDPQuery.java
@@ -23,74 +23,74 @@ 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.SegmentService;
-import org.apache.unomi.graphql.types.input.CXSEventFilter;
-import org.apache.unomi.graphql.types.input.CXSOrderByInput;
-import org.apache.unomi.graphql.types.input.CXSSegmentFilterInput;
+import org.apache.unomi.graphql.types.input.CDPEventFilter;
+import org.apache.unomi.graphql.types.input.CDPOrderByInput;
+import org.apache.unomi.graphql.types.input.CDPSegmentFilterInput;
 import org.apache.unomi.graphql.types.output.*;
 
 import java.util.ArrayList;
 import java.util.List;
 
-@GraphQLName("CXS_Query")
-public class CXSQuery {
+@GraphQLName("CDP_Query")
+public class CDPQuery {
 
-    CXSGraphQLProvider cxsGraphQLProvider;
+    CDPGraphQLProvider cdpGraphQLProvider;
 
-    public CXSQuery(CXSGraphQLProvider cxsGraphQLProvider) {
-        this.cxsGraphQLProvider = cxsGraphQLProvider;
+    public CDPQuery(CDPGraphQLProvider cdpGraphQLProvider) {
+        this.cdpGraphQLProvider = cdpGraphQLProvider;
     }
 
     @GraphQLField
-    public List<CXSEventType> getEventTypes() {
+    public List<CDPEventType> getEventTypes() {
         return new ArrayList<>();
     }
 
     @GraphQLField
-    public CXSEvent getEvent(@GraphQLName("id") String id) {
-        return new CXSEvent();
+    public CDPEvent getEvent(@GraphQLName("id") String id) {
+        return new CDPEvent();
     }
 
     @GraphQLField
-    public CXSEventConnection findEvents(@GraphQLName("filter") CXSEventFilter filter,
-                                         @GraphQLName("orderBy") CXSOrderByInput orderBy,
+    public CDPEventConnection findEvents(@GraphQLName("filter") CDPEventFilter filter,
+                                         @GraphQLName("orderBy") CDPOrderByInput orderBy,
                                          DataFetchingEnvironment env) {
         env.getArgument("first");
         env.getArgument("after");
-        return new CXSEventConnection();
+        return new CDPEventConnection();
     }
 
     @GraphQLField
-    public CXSSegmentConnection findSegments(@GraphQLName("filter") CXSSegmentFilterInput filter,
-                                             @GraphQLName("orderBy") CXSOrderByInput orderBy,
+    public CDPSegmentConnection findSegments(@GraphQLName("filter") CDPSegmentFilterInput filter,
+                                             @GraphQLName("orderBy") CDPOrderByInput orderBy,
                                              DataFetchingEnvironment env) {
-        SegmentService segmentService = cxsGraphQLProvider.getCxsProviderManager().getSegmentService();
+        SegmentService segmentService = cdpGraphQLProvider.getCdpProviderManager().getSegmentService();
         Query query = new Query();
         segmentService.getSegmentMetadatas(query);
-        return new CXSSegmentConnection();
+        return new CDPSegmentConnection();
     }
 
     @GraphQLField
-    public CXSSegment getSegment(@GraphQLName("segmentId") String segmentId) {
-        SegmentService segmentService = cxsGraphQLProvider.getCxsProviderManager().getSegmentService();
+    public CDPSegment getSegment(@GraphQLName("segmentId") String segmentId) {
+        SegmentService segmentService = cdpGraphQLProvider.getCdpProviderManager().getSegmentService();
         Segment segment = segmentService.getSegmentDefinition(segmentId);
         if (segment == null) {
             return null;
         }
-        CXSSegment cxsSegment = new CXSSegment();
-        cxsSegment.id = segment.getItemId();
-        cxsSegment.name = segment.getMetadata().getName();
-        CXSView cxsView = new CXSView();
-        cxsView.name = segment.getScope();
-        cxsSegment.view = cxsView;
-        cxsSegment.condition = getSegmentCondition(segment.getCondition());
-        return cxsSegment;
+        CDPSegment cdpSegment = new CDPSegment();
+        cdpSegment.id = segment.getItemId();
+        cdpSegment.name = segment.getMetadata().getName();
+        CDPView cdpView = new CDPView();
+        cdpView.name = segment.getScope();
+        cdpSegment.view = cdpView;
+        cdpSegment.condition = getSegmentCondition(segment.getCondition());
+        return cdpSegment;
     }
 
-    private CXSSegmentCondition getSegmentCondition(Condition segmentRootCondition) {
+    private CDPSegmentCondition getSegmentCondition(Condition segmentRootCondition) {
         if (segmentRootCondition == null) {
             return null;
         }
-        // @todo translate the conditions into something that the CXS spec can work with.
+        // @todo translate the conditions into something that the CDP spec can work with.
 
         // we probably have to scan the tree to find any event conditions and seperate them
         // from the profile property conditions (what about session conditions ?)
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
deleted file mode 100644
index f7cb1e1..0000000
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSMutation.java
+++ /dev/null
@@ -1,127 +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;
-import graphql.schema.DataFetchingEnvironment;
-import org.apache.unomi.graphql.propertytypes.CXSIdentifierPropertyType;
-import org.apache.unomi.graphql.propertytypes.CXSSetPropertyType;
-import org.apache.unomi.graphql.propertytypes.CXSStringPropertyType;
-import org.apache.unomi.graphql.types.input.CXSEventInput;
-import org.apache.unomi.graphql.types.input.CXSEventTypeInput;
-import org.apache.unomi.graphql.types.input.CXSPropertyTypeInput;
-import org.apache.unomi.graphql.types.input.CXSSetPropertyTypeInput;
-import org.apache.unomi.graphql.types.output.CXSEventType;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@GraphQLName("CXS_Mutation")
-public class CXSMutation {
-
-    CXSGraphQLProvider cxsGraphQLProvider;
-
-    public CXSMutation(CXSGraphQLProvider cxsGraphQLProvider) {
-        this.cxsGraphQLProvider = cxsGraphQLProvider;
-    }
-
-    @GraphQLField
-    public CXSEventType createOrUpdateEventType(DataFetchingEnvironment env, @GraphQLName("eventType") CXSEventTypeInput cxsEventTypeInput) {
-
-        CXSEventType cxsEventType = new CXSEventType(cxsEventTypeInput.getId(), cxsEventTypeInput.getScope(), cxsEventTypeInput.getTypeName(), new ArrayList<>());
-        for (CXSPropertyTypeInput propertyTypeInput : cxsEventTypeInput.getProperties()) {
-            org.apache.unomi.graphql.propertytypes.CXSPropertyType propertyType = getPropertyType(propertyTypeInput);
-            cxsEventType.getProperties().add(propertyType);
-        }
-        cxsGraphQLProvider.getEventTypes().put(cxsEventType.getTypeName(), cxsEventType);
-        cxsGraphQLProvider.updateGraphQLTypes();
-        if (cxsGraphQLProvider.getCxsProviderManager() != null) {
-            cxsGraphQLProvider.getCxsProviderManager().refreshProviders();
-        }
-        return cxsEventType;
-
-    }
-
-    @GraphQLField
-    public int processEvents(DataFetchingEnvironment env, @GraphQLName("events") List<CXSEventInput> events) {
-        return 0;
-    }
-
-    private org.apache.unomi.graphql.propertytypes.CXSPropertyType getPropertyType(CXSPropertyTypeInput cxsPropertyTypeInput) {
-        org.apache.unomi.graphql.propertytypes.CXSPropertyType propertyType = null;
-        if (cxsPropertyTypeInput.identifierPropertyTypeInput != null) {
-            propertyType = getIdentifierPropertyType(cxsPropertyTypeInput.identifierPropertyTypeInput);
-        } else if (cxsPropertyTypeInput.stringPropertyTypeInput != null) {
-            propertyType = getStringPropertyType(cxsPropertyTypeInput.stringPropertyTypeInput);
-        } else if (cxsPropertyTypeInput.setPropertyTypeInput != null) {
-            propertyType = getSetPropertyType(cxsPropertyTypeInput.setPropertyTypeInput);
-        }
-        return propertyType;
-    }
-
-    private org.apache.unomi.graphql.propertytypes.CXSPropertyType getSetPropertyType(CXSSetPropertyTypeInput cxsSetPropertyTypeInput) {
-        List<org.apache.unomi.graphql.propertytypes.CXSPropertyType> setProperties = null;
-        if (cxsSetPropertyTypeInput.getProperties() != null) {
-            setProperties = new ArrayList<>();
-            for (CXSPropertyTypeInput setProperty : cxsSetPropertyTypeInput.getProperties()) {
-                org.apache.unomi.graphql.propertytypes.CXSPropertyType subPropertyType = getPropertyType(setProperty);
-                if (subPropertyType != null) {
-                    setProperties.add(subPropertyType);
-                }
-            }
-        }
-        return new CXSSetPropertyType(
-                cxsSetPropertyTypeInput.getId(),
-                cxsSetPropertyTypeInput.getName(),
-                cxsSetPropertyTypeInput.getMinOccurrences(),
-                cxsSetPropertyTypeInput.getMaxOccurrences(),
-                cxsSetPropertyTypeInput.getTags(),
-                cxsSetPropertyTypeInput.getSystemTags(),
-                cxsSetPropertyTypeInput.isPersonalData(),
-                setProperties);
-    }
-
-    private org.apache.unomi.graphql.propertytypes.CXSPropertyType getStringPropertyType(CXSStringPropertyType stringPropertyType) {
-        return new CXSStringPropertyType(
-                stringPropertyType.getId(),
-                stringPropertyType.getName(),
-                stringPropertyType.getMinOccurrences(),
-                stringPropertyType.getMaxOccurrences(),
-                stringPropertyType.getTags(),
-                stringPropertyType.getSystemTags(),
-                stringPropertyType.isPersonalData(),
-                stringPropertyType.getRegexp(),
-                stringPropertyType.getDefaultValue()
-                );
-    }
-
-    private org.apache.unomi.graphql.propertytypes.CXSPropertyType getIdentifierPropertyType(CXSIdentifierPropertyType identifierPropertyType) {
-        return new CXSIdentifierPropertyType(
-                identifierPropertyType.getId(),
-                identifierPropertyType.getName(),
-                identifierPropertyType.getMinOccurrences(),
-                identifierPropertyType.getMaxOccurrences(),
-                identifierPropertyType.getTags(),
-                identifierPropertyType.getSystemTags(),
-                identifierPropertyType.isPersonalData(),
-                identifierPropertyType.getRegexp(),
-                identifierPropertyType.getDefaultValue()
-        );
-    }
-
-}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/builders/CXSBuilder.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/builders/CDPBuilder.java
similarity index 96%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/builders/CXSBuilder.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/builders/CDPBuilder.java
index 83c7a85..a8350f8 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/builders/CXSBuilder.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/builders/CDPBuilder.java
@@ -16,7 +16,7 @@
  */
 package org.apache.unomi.graphql.builders;
 
-public interface CXSBuilder {
+public interface CDPBuilder {
 
     void updateTypes();
 
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/CDPBuildersUtils.java
similarity index 98%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/builders/CXSBuildersUtils.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/builders/CDPBuildersUtils.java
index 3d9c586..f353d6c 100644
--- 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/CDPBuildersUtils.java
@@ -21,7 +21,7 @@ import graphql.annotations.processor.ProcessingElementsContainer;
 import graphql.schema.GraphQLInputObjectType;
 import graphql.schema.GraphQLObjectType;
 
-public class CXSBuildersUtils {
+public class CDPBuildersUtils {
 
     public static GraphQLObjectType.Builder getOutputBuilderFromAnnotatedClass(
             GraphQLAnnotationsComponent annotationsComponent,
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/CDPEventBuilders.java
similarity index 64%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/builders/CXSEventBuilders.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/builders/CDPEventBuilders.java
index 8c616d4..a5a8fc7 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/CDPEventBuilders.java
@@ -20,11 +20,11 @@ import graphql.annotations.processor.GraphQLAnnotationsComponent;
 import graphql.annotations.processor.ProcessingElementsContainer;
 import graphql.schema.*;
 import org.apache.unomi.graphql.propertytypes.*;
-import org.apache.unomi.graphql.types.input.CXSEventInput;
-import org.apache.unomi.graphql.types.input.CXSEventOccurrenceFilterInput;
-import org.apache.unomi.graphql.types.output.CXSEvent;
-import org.apache.unomi.graphql.types.output.CXSEventProperties;
-import org.apache.unomi.graphql.types.output.CXSEventType;
+import org.apache.unomi.graphql.types.input.CDPEventInput;
+import org.apache.unomi.graphql.types.input.CDPEventOccurrenceFilterInput;
+import org.apache.unomi.graphql.types.output.CDPEvent;
+import org.apache.unomi.graphql.types.output.CDPEventProperties;
+import org.apache.unomi.graphql.types.output.CDPEventType;
 import org.apache.unomi.graphql.types.output.PageInfo;
 
 import java.util.ArrayList;
@@ -37,16 +37,16 @@ import static graphql.schema.GraphQLInputObjectField.newInputObjectField;
 import static graphql.schema.GraphQLInputObjectType.newInputObject;
 import static graphql.schema.GraphQLObjectType.newObject;
 
-public class CXSEventBuilders implements CXSBuilder {
+public class CDPEventBuilders implements CDPBuilder {
 
     private GraphQLAnnotationsComponent annotationsComponent;
     private ProcessingElementsContainer container;
-    private Map<String, CXSEventType> eventTypes;
+    private Map<String, CDPEventType> eventTypes;
     private Map<String,GraphQLType> typeRegistry;
 
-    public CXSEventBuilders(GraphQLAnnotationsComponent annotationsComponent,
+    public CDPEventBuilders(GraphQLAnnotationsComponent annotationsComponent,
                             ProcessingElementsContainer container,
-                            Map<String, CXSEventType> eventTypes) {
+                            Map<String, CDPEventType> eventTypes) {
         this.annotationsComponent = annotationsComponent;
         this.container = container;
         this.eventTypes = eventTypes;
@@ -56,23 +56,23 @@ public class CXSEventBuilders implements CXSBuilder {
     @Override
     public void updateTypes() {
         Map<String,GraphQLType> typeRegistry = container.getTypeRegistry();
-        typeRegistry.put("CXS_EventInput", buildCXSEventInputType());
-        typeRegistry.put("CXS_EventOccurrenceFilterInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSEventOccurrenceFilterInput.class, container));
-        typeRegistry.put("CXS_EventPropertiesFilterInput", buildCXSEventPropertiesFilterInput());
-        typeRegistry.put("CXS_EventFilterInput", buildCXSEventFilterInputType());
-        typeRegistry.put("CXS_EventProperties", buildCXSEventPropertiesOutputType());
-        typeRegistry.put("CXS_Event", buildCXSEventOutputType());
-        typeRegistry.put("CXS_EventEdge", buildCXSEventEdgeOutputType());
-        typeRegistry.put("CXS_EventConnection", buildCXSEventConnectionOutputType());
+        typeRegistry.put("CDP_EventInput", buildCDPEventInputType());
+        typeRegistry.put("CDP_EventOccurrenceFilterInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CDPEventOccurrenceFilterInput.class, container));
+        typeRegistry.put("CDP_EventPropertiesFilterInput", buildCDPEventPropertiesFilterInput());
+        typeRegistry.put("CDP_EventFilterInput", buildCDPEventFilterInputType());
+        typeRegistry.put("CDP_EventProperties", buildCDPEventPropertiesOutputType());
+        typeRegistry.put("CDP_Event", buildCDPEventOutputType());
+        typeRegistry.put("CDP_EventEdge", buildCDPEventEdgeOutputType());
+        typeRegistry.put("CDP_EventConnection", buildCDPEventConnectionOutputType());
     }
 
-    private GraphQLOutputType buildCXSEventEdgeOutputType() {
+    private GraphQLOutputType buildCDPEventEdgeOutputType() {
         return newObject()
-                .name("CXS_EventEdge")
-                .description("The Relay edge type for the CXS_Event output type")
+                .name("CDP_EventEdge")
+                .description("The Relay edge type for the CDP_Event output type")
                 .field(newFieldDefinition()
                         .name("node")
-                        .type((GraphQLOutputType) typeRegistry.get("CXS_Event"))
+                        .type((GraphQLOutputType) typeRegistry.get("CDP_Event"))
                 )
                 .field(newFieldDefinition()
                         .name("cursor")
@@ -81,13 +81,13 @@ public class CXSEventBuilders implements CXSBuilder {
                 .build();
     }
 
-    private GraphQLOutputType buildCXSEventConnectionOutputType() {
+    private GraphQLOutputType buildCDPEventConnectionOutputType() {
         return newObject()
-                .name("CXS_EventConnection")
-                .description("The Relay connection type for the CXS_Event output type")
+                .name("CDP_EventConnection")
+                .description("The Relay connection type for the CDP_Event output type")
                 .field(newFieldDefinition()
                         .name("edges")
-                        .type(new GraphQLList(typeRegistry.get("CXS_EventEdge")))
+                        .type(new GraphQLList(typeRegistry.get("CDP_EventEdge")))
                 )
                 .field(newFieldDefinition()
                         .name("pageInfo")
@@ -96,55 +96,55 @@ public class CXSEventBuilders implements CXSBuilder {
                 .build();
     }
 
-    private GraphQLInputType buildCXSEventPropertiesFilterInput() {
-        GraphQLInputObjectType.Builder cxsEventPropertiesFilterInput = newInputObject()
-                .name("CXS_EventPropertiesFilterInput")
+    private GraphQLInputType buildCDPEventPropertiesFilterInput() {
+        GraphQLInputObjectType.Builder cdpEventPropertiesFilterInput = newInputObject()
+                .name("CDP_EventPropertiesFilterInput")
                 .description("Filter conditions for each event types and built-in properties");
 
-        generateEventPropertiesFilters(cxsEventPropertiesFilterInput);
-        generateEventTypesFilters(cxsEventPropertiesFilterInput);
+        generateEventPropertiesFilters(cdpEventPropertiesFilterInput);
+        generateEventTypesFilters(cdpEventPropertiesFilterInput);
 
-        return cxsEventPropertiesFilterInput.build();
+        return cdpEventPropertiesFilterInput.build();
     }
 
 
-    private void generateEventPropertiesFilters(GraphQLInputObjectType.Builder cxsEventPropertiesFilterInput) {
-        addIdentityFilters("id", cxsEventPropertiesFilterInput);
-        addIdentityFilters("sourceId", cxsEventPropertiesFilterInput);
-        addIdentityFilters("clientId", cxsEventPropertiesFilterInput);
-        addIdentityFilters("profileId", cxsEventPropertiesFilterInput);
-        addDistanceFilters("location", cxsEventPropertiesFilterInput);
-        addDateFilters("timestamp", cxsEventPropertiesFilterInput);
+    private void generateEventPropertiesFilters(GraphQLInputObjectType.Builder cdpEventPropertiesFilterInput) {
+        addIdentityFilters("id", cdpEventPropertiesFilterInput);
+        addIdentityFilters("sourceId", cdpEventPropertiesFilterInput);
+        addIdentityFilters("clientId", cdpEventPropertiesFilterInput);
+        addIdentityFilters("profileId", cdpEventPropertiesFilterInput);
+        addDistanceFilters("location", cdpEventPropertiesFilterInput);
+        addDateFilters("timestamp", cdpEventPropertiesFilterInput);
     }
 
-    private void generateEventTypesFilters(GraphQLInputObjectType.Builder cxsEventPropertiesFilterInput) {
-        for (Map.Entry<String,CXSEventType> eventTypeEntry : eventTypes.entrySet()) {
-            addSetFilters(eventTypeEntry.getKey(), eventTypeEntry.getValue().getProperties(), cxsEventPropertiesFilterInput);
+    private void generateEventTypesFilters(GraphQLInputObjectType.Builder cdpEventPropertiesFilterInput) {
+        for (Map.Entry<String, CDPEventType> eventTypeEntry : eventTypes.entrySet()) {
+            addSetFilters(eventTypeEntry.getKey(), eventTypeEntry.getValue().getProperties(), cdpEventPropertiesFilterInput);
         }
     }
 
-    private void addSetFilters(String eventTypeName, List<CXSPropertyType> properties, GraphQLInputObjectType.Builder inputTypeBuilder) {
+    private void addSetFilters(String eventTypeName, List<CDPPropertyType> properties, GraphQLInputObjectType.Builder inputTypeBuilder) {
         GraphQLInputObjectType.Builder eventTypeFilterInput = newInputObject()
                 .name(eventTypeName + "FilterInput")
                 .description("Auto-generated filter input type for event type " + eventTypeName);
 
-        for (CXSPropertyType cxsPropertyType : properties) {
-            if (cxsPropertyType instanceof CXSIdentifierPropertyType) {
-                addIdentityFilters(cxsPropertyType.getName(), eventTypeFilterInput);
-            } else if (cxsPropertyType instanceof CXSStringPropertyType) {
-                addStringFilters(cxsPropertyType.getName(), eventTypeFilterInput);
-            } else if (cxsPropertyType instanceof CXSBooleanPropertyType) {
-                addBooleanFilters(cxsPropertyType.getName(), eventTypeFilterInput);
-            } else if (cxsPropertyType instanceof CXSIntPropertyType) {
-                addIntegerFilters(cxsPropertyType.getName(), eventTypeFilterInput);
-            } else if (cxsPropertyType instanceof CXSFloatPropertyType) {
-                addFloatFilters(cxsPropertyType.getName(), eventTypeFilterInput);
-            } else if (cxsPropertyType instanceof CXSGeoPointPropertyType) {
-                addDistanceFilters(cxsPropertyType.getName(), eventTypeFilterInput);
-            } else if (cxsPropertyType instanceof CXSDatePropertyType) {
-                addDateFilters(cxsPropertyType.getName(), eventTypeFilterInput);
-            } else if (cxsPropertyType instanceof CXSSetPropertyType) {
-                addSetFilters(cxsPropertyType.getName(), ((CXSSetPropertyType) cxsPropertyType).getProperties(), eventTypeFilterInput);
+        for (CDPPropertyType cdpPropertyType : properties) {
+            if (cdpPropertyType instanceof CDPIdentifierPropertyType) {
+                addIdentityFilters(cdpPropertyType.getName(), eventTypeFilterInput);
+            } else if (cdpPropertyType instanceof CDPStringPropertyType) {
+                addStringFilters(cdpPropertyType.getName(), eventTypeFilterInput);
+            } else if (cdpPropertyType instanceof CDPBooleanPropertyType) {
+                addBooleanFilters(cdpPropertyType.getName(), eventTypeFilterInput);
+            } else if (cdpPropertyType instanceof CDPIntPropertyType) {
+                addIntegerFilters(cdpPropertyType.getName(), eventTypeFilterInput);
+            } else if (cdpPropertyType instanceof CDPFloatPropertyType) {
+                addFloatFilters(cdpPropertyType.getName(), eventTypeFilterInput);
+            } else if (cdpPropertyType instanceof CDPGeoPointPropertyType) {
+                addDistanceFilters(cdpPropertyType.getName(), eventTypeFilterInput);
+            } else if (cdpPropertyType instanceof CDPDatePropertyType) {
+                addDateFilters(cdpPropertyType.getName(), eventTypeFilterInput);
+            } else if (cdpPropertyType instanceof CDPSetPropertyType) {
+                addSetFilters(cdpPropertyType.getName(), ((CDPSetPropertyType) cdpPropertyType).getProperties(), eventTypeFilterInput);
             }
         }
 
@@ -239,98 +239,98 @@ public class CXSEventBuilders implements CXSBuilder {
     private void addDistanceFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
         inputTypeBuilder.field(newInputObjectField()
                 .name(propertyName + "_distance")
-                .type((GraphQLInputType) typeRegistry.get("CXS_GeoDistanceInput"))
+                .type((GraphQLInputType) typeRegistry.get("CDP_GeoDistanceInput"))
         );
     }
 
     private void addDateFilters(String propertyName, GraphQLInputObjectType.Builder inputTypeBuilder) {
         inputTypeBuilder.field(newInputObjectField()
                 .name(propertyName + "_between")
-                .type((GraphQLInputType) typeRegistry.get("CXS_DateFilterInput"))
+                .type((GraphQLInputType) typeRegistry.get("CDP_DateFilterInput"))
         );
     }
 
-    private GraphQLInputType buildCXSEventFilterInputType() {
-        GraphQLInputObjectType.Builder cxsEventFilterInputType = newInputObject()
-                .name("CXS_EventFilterInput")
+    private GraphQLInputType buildCDPEventFilterInputType() {
+        GraphQLInputObjectType.Builder cdpEventFilterInputType = newInputObject()
+                .name("CDP_EventFilterInput")
                 .description("Filter conditions for each event types and built-in properties")
                 .field(newInputObjectField()
                         .name("and")
-                        .type(new GraphQLList(new GraphQLTypeReference("CXS_EventFilterInput")))
+                        .type(new GraphQLList(new GraphQLTypeReference("CDP_EventFilterInput")))
                 )
                 .field(newInputObjectField()
                         .name("or")
-                        .type(new GraphQLList(new GraphQLTypeReference("CXS_EventFilterInput")))
+                        .type(new GraphQLList(new GraphQLTypeReference("CDP_EventFilterInput")))
                 )
                 .field(newInputObjectField()
                         .name("properties")
-                        .type((GraphQLInputType) typeRegistry.get("CXS_EventPropertiesFilterInput"))
+                        .type((GraphQLInputType) typeRegistry.get("CDP_EventPropertiesFilterInput"))
                 )
                 .field(newInputObjectField()
                         .name("properties_or")
-                        .type((GraphQLInputType) typeRegistry.get("CXS_EventPropertiesFilterInput"))
+                        .type((GraphQLInputType) typeRegistry.get("CDP_EventPropertiesFilterInput"))
                 )
                 .field(newInputObjectField()
                         .name("eventOccurrence")
-                        .type((GraphQLInputType) typeRegistry.get("CXS_EventOccurrenceFilterInput"))
+                        .type((GraphQLInputType) typeRegistry.get("CDP_EventOccurrenceFilterInput"))
                 );
-        return cxsEventFilterInputType.build();
+        return cdpEventFilterInputType.build();
     }
 
-    private GraphQLInputType buildCXSEventInputType() {
-        GraphQLInputObjectType.Builder cxsEventInputType = CXSBuildersUtils.getInputBuilderFromAnnotatedClass(annotationsComponent, container, "CXS_EventInput", CXSEventInput.class)
+    private GraphQLInputType buildCDPEventInputType() {
+        GraphQLInputObjectType.Builder cdpEventInputType = CDPBuildersUtils.getInputBuilderFromAnnotatedClass(annotationsComponent, container, "CDP_EventInput", CDPEventInput.class)
                 .description("The event input object to send events to the Context Server");
 
-        for (Map.Entry<String,CXSEventType> cxsEventTypeEntry : eventTypes.entrySet()) {
-            CXSEventType cxsEventType = cxsEventTypeEntry.getValue();
-            cxsEventInputType.field(newInputObjectField()
-                    .name(cxsEventTypeEntry.getKey())
-                    .type(buildCXSEventTypeInputProperty(cxsEventType.getTypeName(), cxsEventType.getProperties()))
+        for (Map.Entry<String, CDPEventType> cdpEventTypeEntry : eventTypes.entrySet()) {
+            CDPEventType cdpEventType = cdpEventTypeEntry.getValue();
+            cdpEventInputType.field(newInputObjectField()
+                    .name(cdpEventTypeEntry.getKey())
+                    .type(buildCDPEventTypeInputProperty(cdpEventType.getTypeName(), cdpEventType.getProperties()))
             );
         }
 
-        return cxsEventInputType.build();
+        return cdpEventInputType.build();
 
     }
 
-    private GraphQLInputType buildCXSEventTypeInputProperty(String typeName, List<CXSPropertyType> propertyTypes) {
+    private GraphQLInputType buildCDPEventTypeInputProperty(String typeName, List<CDPPropertyType> propertyTypes) {
         String eventTypeName = typeName.substring(0, 1).toUpperCase() + typeName.substring(1) + "EventTypeInput";
         GraphQLInputObjectType.Builder eventInputType = newInputObject()
                 .name(eventTypeName)
                 .description("Event type object for event type " + typeName);
 
-        for (CXSPropertyType cxsEventPropertyType : propertyTypes) {
+        for (CDPPropertyType cdpEventPropertyType : propertyTypes) {
             GraphQLInputType eventPropertyInputType = null;
-            if (cxsEventPropertyType instanceof CXSIdentifierPropertyType) {
+            if (cdpEventPropertyType instanceof CDPIdentifierPropertyType) {
                 eventPropertyInputType = GraphQLID;
-            } else if (cxsEventPropertyType instanceof CXSStringPropertyType) {
+            } else if (cdpEventPropertyType instanceof CDPStringPropertyType) {
                 eventPropertyInputType = GraphQLString;
-            } else if (cxsEventPropertyType instanceof CXSIntPropertyType) {
+            } else if (cdpEventPropertyType instanceof CDPIntPropertyType) {
                 eventPropertyInputType = GraphQLInt;
-            } else if (cxsEventPropertyType instanceof CXSFloatPropertyType) {
+            } else if (cdpEventPropertyType instanceof CDPFloatPropertyType) {
                 eventPropertyInputType = GraphQLFloat;
-            } else if (cxsEventPropertyType instanceof CXSBooleanPropertyType) {
+            } else if (cdpEventPropertyType instanceof CDPBooleanPropertyType) {
                 eventPropertyInputType = GraphQLBoolean;
-            } else if (cxsEventPropertyType instanceof CXSDatePropertyType) {
+            } else if (cdpEventPropertyType instanceof CDPDatePropertyType) {
                 eventPropertyInputType = GraphQLString;
-            } else if (cxsEventPropertyType instanceof CXSGeoPointPropertyType) {
-                eventPropertyInputType = (GraphQLInputType) typeRegistry.get("CXS_GeoPoint");
-            } else if (cxsEventPropertyType instanceof CXSSetPropertyType) {
-                eventPropertyInputType = buildCXSEventTypeInputProperty(cxsEventPropertyType.getName(), ((CXSSetPropertyType)cxsEventPropertyType).getProperties());
+            } else if (cdpEventPropertyType instanceof CDPGeoPointPropertyType) {
+                eventPropertyInputType = (GraphQLInputType) typeRegistry.get("CDP_GeoPoint");
+            } else if (cdpEventPropertyType instanceof CDPSetPropertyType) {
+                eventPropertyInputType = buildCDPEventTypeInputProperty(cdpEventPropertyType.getName(), ((CDPSetPropertyType)cdpEventPropertyType).getProperties());
             }
             eventInputType
                     .field(newInputObjectField()
                             .type(eventPropertyInputType)
-                            .name(cxsEventPropertyType.getName())
+                            .name(cdpEventPropertyType.getName())
                     );
         }
 
         return eventInputType.build();
     }
 
-    private GraphQLOutputType buildCXSEventOutputType() {
+    private GraphQLOutputType buildCDPEventOutputType() {
         return newObject()
-                .name("CXS_Event")
+                .name("CDP_Event")
                 .description("An event is generated by user interacting with the Context Server")
                 .field(newFieldDefinition()
                         .type(GraphQLID)
@@ -338,8 +338,8 @@ public class CXSEventBuilders implements CXSBuilder {
                         .description("A unique identifier for the event")
                         .dataFetcher(new DataFetcher() {
                             public Object get(DataFetchingEnvironment environment) {
-                                CXSEvent CXSEvent = environment.getSource();
-                                return CXSEvent.getId();
+                                CDPEvent cdpEvent = environment.getSource();
+                                return cdpEvent.getId();
                             }
                         })
                 )
@@ -349,8 +349,8 @@ public class CXSEventBuilders implements CXSBuilder {
                         .description("An identifier for the event type")
                         .dataFetcher(new DataFetcher() {
                             public Object get(DataFetchingEnvironment environment) {
-                                CXSEvent CXSEvent = environment.getSource();
-                                return CXSEvent.getEventType();
+                                CDPEvent cdpEvent = environment.getSource();
+                                return cdpEvent.getEventType();
                             }
                         })
                 )
@@ -360,8 +360,8 @@ public class CXSEventBuilders implements CXSBuilder {
                         .description("The difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.")
                         .dataFetcher(new DataFetcher() {
                             public Object get(DataFetchingEnvironment environment) {
-                                CXSEvent CXSEvent = environment.getSource();
-                                return CXSEvent.getTimeStamp();
+                                CDPEvent cdpEvent = environment.getSource();
+                                return cdpEvent.getTimeStamp();
                             }
                         }))
                 .field(newFieldDefinition()
@@ -370,8 +370,8 @@ public class CXSEventBuilders implements CXSBuilder {
                         .description("The entity that has fired the event (using the profile)")
                         .dataFetcher(new DataFetcher() {
                             public Object get(DataFetchingEnvironment environment) {
-                                CXSEvent CXSEvent = environment.getSource();
-                                return CXSEvent.getSubject();
+                                CDPEvent cdpEvent = environment.getSource();
+                                return cdpEvent.getSubject();
                             }
                         }))
                 .field(newFieldDefinition()
@@ -380,81 +380,81 @@ public class CXSEventBuilders implements CXSBuilder {
                         .description("The object on which the event was fired.")
                         .dataFetcher(new DataFetcher() {
                             public Object get(DataFetchingEnvironment environment) {
-                                CXSEvent CXSEvent = environment.getSource();
-                                return CXSEvent.getObject();
+                                CDPEvent cdpEvent = environment.getSource();
+                                return cdpEvent.getObject();
                             }
                         })
                 )
                 .field(newFieldDefinition()
-                        .type((GraphQLOutputType) typeRegistry.get("CXS_GeoPoint"))
+                        .type((GraphQLOutputType) typeRegistry.get("CDP_GeoPoint"))
                         .name("location")
                         .description("The geo-point location where the event was fired.")
                         .dataFetcher(new DataFetcher() {
                             public Object get(DataFetchingEnvironment environment) {
-                                CXSEvent CXSEvent = environment.getSource();
-                                return CXSEvent.getLocation();
+                                CDPEvent cdpEvent = environment.getSource();
+                                return cdpEvent.getLocation();
                             }
                         })
                 )
                 .field(newFieldDefinition()
-                        .type(new GraphQLList(typeRegistry.get("CXS_EventProperties")))
+                        .type(new GraphQLList(typeRegistry.get("CDP_EventProperties")))
                         .name("properties")
                         .description("Generic properties for the event")
                         .dataFetcher(new DataFetcher() {
                             public Object get(DataFetchingEnvironment environment) {
-                                CXSEvent CXSEvent = environment.getSource();
-                                return new ArrayList<Map.Entry<Object,Object>>(CXSEvent.getProperties().getProperties().entrySet());
+                                CDPEvent cdpEvent = environment.getSource();
+                                return new ArrayList<Map.Entry<Object,Object>>(cdpEvent.getProperties().getProperties().entrySet());
                             }
                         })
                 )
                 .build();
     }
 
-    private GraphQLOutputType buildCXSEventPropertiesOutputType() {
-        GraphQLObjectType.Builder eventPropertiesOutputType = CXSBuildersUtils.getOutputBuilderFromAnnotatedClass(annotationsComponent, container, "CXS_EventProperties", CXSEventProperties.class)
+    private GraphQLOutputType buildCDPEventPropertiesOutputType() {
+        GraphQLObjectType.Builder eventPropertiesOutputType = CDPBuildersUtils.getOutputBuilderFromAnnotatedClass(annotationsComponent, container, "CDP_EventProperties", CDPEventProperties.class)
                 .description("All possible properties of an event");
 
-        for (Map.Entry<String,CXSEventType> cxsEventTypeEntry : eventTypes.entrySet()) {
-            CXSEventType cxsEventType = cxsEventTypeEntry.getValue();
+        for (Map.Entry<String, CDPEventType> cdpEventTypeEntry : eventTypes.entrySet()) {
+            CDPEventType cdpEventType = cdpEventTypeEntry.getValue();
             eventPropertiesOutputType
                     .field(newFieldDefinition()
-                            .type(buildEventOutputType(cxsEventType.getTypeName(), cxsEventType.getProperties()))
-                            .name(cxsEventTypeEntry.getKey())
+                            .type(buildEventOutputType(cdpEventType.getTypeName(), cdpEventType.getProperties()))
+                            .name(cdpEventTypeEntry.getKey())
                     );
         }
 
         return eventPropertiesOutputType.build();
     }
 
-    private GraphQLOutputType buildEventOutputType(String typeName, List<CXSPropertyType> propertyTypes) {
+    private GraphQLOutputType buildEventOutputType(String typeName, List<CDPPropertyType> propertyTypes) {
         String eventTypeName = typeName.substring(0, 1).toUpperCase() + typeName.substring(1) + "EventType";
         GraphQLObjectType.Builder eventOutputType = newObject()
                 .name(eventTypeName)
                 .description("Event type object for event type " + typeName);
 
-        for (CXSPropertyType cxsEventPropertyType : propertyTypes) {
+        for (CDPPropertyType cdpEventPropertyType : propertyTypes) {
             GraphQLOutputType eventPropertyOutputType = null;
-            if (cxsEventPropertyType instanceof CXSIdentifierPropertyType) {
+            if (cdpEventPropertyType instanceof CDPIdentifierPropertyType) {
                 eventPropertyOutputType = GraphQLID;
-            } else if (cxsEventPropertyType instanceof CXSStringPropertyType) {
+            } else if (cdpEventPropertyType instanceof CDPStringPropertyType) {
                 eventPropertyOutputType = GraphQLString;
-            } else if (cxsEventPropertyType instanceof CXSIntPropertyType) {
+            } else if (cdpEventPropertyType instanceof CDPIntPropertyType) {
                 eventPropertyOutputType = GraphQLInt;
-            } else if (cxsEventPropertyType instanceof CXSFloatPropertyType) {
+            } else if (cdpEventPropertyType instanceof CDPFloatPropertyType) {
                 eventPropertyOutputType = GraphQLFloat;
-            } else if (cxsEventPropertyType instanceof CXSBooleanPropertyType) {
+            } else if (cdpEventPropertyType instanceof CDPBooleanPropertyType) {
                 eventPropertyOutputType = GraphQLBoolean;
-            } else if (cxsEventPropertyType instanceof CXSDatePropertyType) {
+            } else if (cdpEventPropertyType instanceof CDPDatePropertyType) {
                 eventPropertyOutputType = GraphQLString;
-            } else if (cxsEventPropertyType instanceof CXSGeoPointPropertyType) {
-                eventPropertyOutputType = (GraphQLOutputType) typeRegistry.get("CXS_GeoPoint");
-            } else if (cxsEventPropertyType instanceof CXSSetPropertyType) {
-                eventPropertyOutputType = buildEventOutputType(cxsEventPropertyType.getName(), ((CXSSetPropertyType)cxsEventPropertyType).getProperties());
+            } else if (cdpEventPropertyType instanceof CDPGeoPointPropertyType) {
+                eventPropertyOutputType = (GraphQLOutputType) typeRegistry.get("CDP_GeoPoint");
+            } else if (cdpEventPropertyType instanceof CDPSetPropertyType) {
+                eventPropertyOutputType = buildEventOutputType(cdpEventPropertyType.getName(), ((CDPSetPropertyType)cdpEventPropertyType).getProperties());
             }
             eventOutputType
                     .field(newFieldDefinition()
                             .type(eventPropertyOutputType)
-                            .name(cxsEventPropertyType.getName())
+                            .name(cdpEventPropertyType.getName())
                     );
         }
 
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/CDPGraphQLProviderImpl.java
similarity index 68%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSGraphQLProviderImpl.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CDPGraphQLProviderImpl.java
index e5dc6ba..62adf7f 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/CDPGraphQLProviderImpl.java
@@ -22,18 +22,18 @@ import graphql.schema.*;
 import graphql.servlet.GraphQLMutationProvider;
 import graphql.servlet.GraphQLQueryProvider;
 import graphql.servlet.GraphQLTypesProvider;
-import org.apache.unomi.graphql.CXSGraphQLProvider;
-import org.apache.unomi.graphql.CXSMutation;
-import org.apache.unomi.graphql.CXSProviderManager;
-import org.apache.unomi.graphql.CXSQuery;
-import org.apache.unomi.graphql.builders.CXSEventBuilders;
-import org.apache.unomi.graphql.propertytypes.CXSSetPropertyType;
-import org.apache.unomi.graphql.types.input.CXSDateFilter;
-import org.apache.unomi.graphql.types.input.CXSEventTypeInput;
-import org.apache.unomi.graphql.types.input.CXSGeoDistanceInput;
-import org.apache.unomi.graphql.types.input.CXSOrderByInput;
-import org.apache.unomi.graphql.types.output.CXSEventType;
-import org.apache.unomi.graphql.types.output.CXSGeoPoint;
+import org.apache.unomi.graphql.CDPGraphQLProvider;
+import org.apache.unomi.graphql.CDPMutation;
+import org.apache.unomi.graphql.CDPProviderManager;
+import org.apache.unomi.graphql.CDPQuery;
+import org.apache.unomi.graphql.builders.CDPEventBuilders;
+import org.apache.unomi.graphql.propertytypes.CDPSetPropertyType;
+import org.apache.unomi.graphql.types.input.CDPDateFilter;
+import org.apache.unomi.graphql.types.input.CDPEventTypeInput;
+import org.apache.unomi.graphql.types.input.CDPGeoDistanceInput;
+import org.apache.unomi.graphql.types.input.CDPOrderByInput;
+import org.apache.unomi.graphql.types.output.CDPEventType;
+import org.apache.unomi.graphql.types.output.CDPGeoPoint;
 import org.apache.unomi.graphql.types.output.PageInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -46,54 +46,54 @@ import static graphql.schema.GraphQLArgument.newArgument;
 import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
 import static graphql.schema.GraphQLObjectType.newObject;
 
-public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryProvider, GraphQLTypesProvider, GraphQLMutationProvider {
+public class CDPGraphQLProviderImpl implements CDPGraphQLProvider, GraphQLQueryProvider, GraphQLTypesProvider, GraphQLMutationProvider {
 
-    private static final Logger logger = LoggerFactory.getLogger(CXSGraphQLProviderImpl.class.getName());
+    private static final Logger logger = LoggerFactory.getLogger(CDPGraphQLProviderImpl.class.getName());
 
-    private CXSProviderManager cxsProviderManager;
+    private CDPProviderManager cdpProviderManager;
     private GraphQLAnnotationsComponent annotationsComponent;
     private ProcessingElementsContainer container;
-    private CXSEventBuilders cxsEventBuilders;
+    private CDPEventBuilders cdpEventBuilders;
     private Map<String,GraphQLType> typeRegistry;
 
-    private Map<String, CXSEventType> eventTypes = new TreeMap<>();
+    private Map<String, CDPEventType> eventTypes = new TreeMap<>();
 
-    public CXSGraphQLProviderImpl(GraphQLAnnotationsComponent annotationsComponent) {
+    public CDPGraphQLProviderImpl(GraphQLAnnotationsComponent annotationsComponent) {
         this.annotationsComponent = annotationsComponent;
         container = annotationsComponent.createContainer();
         container.setInputPrefix("");
         container.setInputSuffix("Input");
         typeRegistry = container.getTypeRegistry();
-        cxsEventBuilders = new CXSEventBuilders(annotationsComponent, container, eventTypes);
+        cdpEventBuilders = new CDPEventBuilders(annotationsComponent, container, eventTypes);
         updateGraphQLTypes();
     }
 
     @Override
-    public Map<String, CXSEventType> getEventTypes() {
+    public Map<String, CDPEventType> getEventTypes() {
         return eventTypes;
     }
 
-    public CXSProviderManager getCxsProviderManager() {
-        return cxsProviderManager;
+    public CDPProviderManager getCdpProviderManager() {
+        return cdpProviderManager;
     }
 
     public void updateGraphQLTypes() {
         typeRegistry.clear();
         typeRegistry.put(PageInfo.class.getName(), annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(PageInfo.class, container));
 
-        typeRegistry.put("CXS_GeoPoint", annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSGeoPoint.class, container));
-        typeRegistry.put("CXS_SetPropertyType",annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSSetPropertyType.class, container));
-        typeRegistry.put("CXS_EventType", annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSEventType.class, container));
+        typeRegistry.put("CDP_GeoPoint", annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CDPGeoPoint.class, container));
+        typeRegistry.put("CDP_SetPropertyType",annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CDPSetPropertyType.class, container));
+        typeRegistry.put("CDP_EventType", annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CDPEventType.class, container));
 
-        typeRegistry.put("CXS_GeoDistanceInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSGeoDistanceInput.class, container));
-        typeRegistry.put("CXS_DateFilterInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSDateFilter.class, container));
-        typeRegistry.put("CXS_EventTypeInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSEventTypeInput.class, container));
-        typeRegistry.put("CXS_OrderByInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CXSOrderByInput.class, container));
+        typeRegistry.put("CDP_GeoDistanceInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CDPGeoDistanceInput.class, container));
+        typeRegistry.put("CDP_DateFilterInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CDPDateFilter.class, container));
+        typeRegistry.put("CDP_EventTypeInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CDPEventTypeInput.class, container));
+        typeRegistry.put("CDP_OrderByInput", annotationsComponent.getInputTypeProcessor().getInputTypeOrRef(CDPOrderByInput.class, container));
 
-        cxsEventBuilders.updateTypes();
+        cdpEventBuilders.updateTypes();
 
-        typeRegistry.put("CXS_Query", annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSQuery.class, container));
-        typeRegistry.put("CXS_Mutation", annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CXSMutation.class, container));
+        typeRegistry.put("CDP_Query", annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CDPQuery.class, container));
+        typeRegistry.put("CDP_Mutation", annotationsComponent.getOutputTypeProcessor().getOutputTypeOrRef(CDPMutation.class, container));
 
     }
 
@@ -106,21 +106,21 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
         return (GraphQLInputObjectType) typeRegistry.get(typeName);
     }
 
-    public void setCxsProviderManager(CXSProviderManager cxsProviderManager) {
-        this.cxsProviderManager = cxsProviderManager;
+    public void setCdpProviderManager(CDPProviderManager cdpProviderManager) {
+        this.cdpProviderManager = cdpProviderManager;
     }
 
     @Override
     public Collection<GraphQLFieldDefinition> getQueries() {
         List<GraphQLFieldDefinition> fieldDefinitions = new ArrayList<GraphQLFieldDefinition>();
-        final CXSGraphQLProvider cxsGraphQLProvider = this;
+        final CDPGraphQLProvider cdpGraphQLProvider = this;
         fieldDefinitions.add(newFieldDefinition()
-                .type(getOutputTypeFromRegistry("CXS_Query"))
-                .name("cxs")
-                .description("Root field for all CXS queries")
-                .dataFetcher(new DataFetcher<CXSGraphQLProvider>() {
-                    public CXSGraphQLProvider get(DataFetchingEnvironment environment) {
-                        return cxsGraphQLProvider;
+                .type(getOutputTypeFromRegistry("CDP_Query"))
+                .name("cdp")
+                .description("Root field for all CDP queries")
+                .dataFetcher(new DataFetcher<CDPGraphQLProvider>() {
+                    public CDPGraphQLProvider get(DataFetchingEnvironment environment) {
+                        return cdpGraphQLProvider;
                     }
                 }).build());
         return fieldDefinitions;
@@ -134,44 +134,44 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
     @Override
     public Collection<GraphQLFieldDefinition> getMutations() {
         List<GraphQLFieldDefinition> fieldDefinitions = new ArrayList<GraphQLFieldDefinition>();
-        final CXSGraphQLProvider cxsGraphQLProvider = this;
+        final CDPGraphQLProvider cdpGraphQLProvider = this;
         fieldDefinitions.add(newFieldDefinition()
-                .type(getOutputTypeFromRegistry("CXS_Mutation"))
-                .name("cxs")
-                .description("Root field for all CXS mutations")
-                .dataFetcher(new DataFetcher<CXSGraphQLProvider>() {
+                .type(getOutputTypeFromRegistry("CDP_Mutation"))
+                .name("cdp")
+                .description("Root field for all CDP mutations")
+                .dataFetcher(new DataFetcher<CDPGraphQLProvider>() {
                     @Override
-                    public CXSGraphQLProvider get(DataFetchingEnvironment environment) {
-                        return cxsGraphQLProvider;
+                    public CDPGraphQLProvider get(DataFetchingEnvironment environment) {
+                        return cdpGraphQLProvider;
                     }
                 }).build());
         return fieldDefinitions;
     }
 
-    private GraphQLOutputType buildCXSQueryOutputType() {
+    private GraphQLOutputType buildCDPQueryOutputType() {
         return newObject()
-                .name("CXS_Query")
-                .description("Root CXS query type")
+                .name("CDP_Query")
+                .description("Root CDP query type")
                 .field(newFieldDefinition()
-                        .type(new GraphQLList(getOutputTypeFromRegistry("CXS_EventType")))
+                        .type(new GraphQLList(getOutputTypeFromRegistry("CDP_EventType")))
                         .name("getEventTypes")
-                        .description("Retrieves the list of all the declared CXS event types in the Apache Unomi server")
+                        .description("Retrieves the list of all the declared CDP event types in the Apache Unomi server")
                 )
                 .field(newFieldDefinition()
-                        .type(new GraphQLList(getOutputTypeFromRegistry("CXS_Event")))
+                        .type(new GraphQLList(getOutputTypeFromRegistry("CDP_Event")))
                         .name("getEvent")
                         .description("Retrieves a specific event")
                 )
                 .field(newFieldDefinition()
-                        .type(new GraphQLList(getOutputTypeFromRegistry("CXS_EventConnection")))
+                        .type(new GraphQLList(getOutputTypeFromRegistry("CDP_EventConnection")))
                         .name("findEvents")
                         .argument(newArgument()
                                 .name("filter")
-                                .type(getInputTypeFromRegistry("CXS_EventFilterInput"))
+                                .type(getInputTypeFromRegistry("CDP_EventFilterInput"))
                         )
                         .argument(newArgument()
                                 .name("orderBy")
-                                .type(getInputTypeFromRegistry("CXS_OrderByInput"))
+                                .type(getInputTypeFromRegistry("CDP_OrderByInput"))
                         )
                         .argument(newArgument()
                                 .name("first")
@@ -196,7 +196,7 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                         .description("Retrieves the events that match the specified filters")
                 )
                 .field(newFieldDefinition()
-                        .type(getOutputTypeFromRegistry("CXS_Segment"))
+                        .type(getOutputTypeFromRegistry("CDP_Segment"))
                         .name("getSegment")
                         .argument(newArgument()
                                 .name("segmentId")
@@ -206,15 +206,15 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                 )
                 /*
                 .field(newFieldDefinition()
-                        .type(new GraphQLList(registeredOutputTypes.get("CXS_ProfileConnection")))
+                        .type(new GraphQLList(registeredOutputTypes.get("CDP_ProfileConnection")))
                         .name("findProfiles")
                         .argument(newArgument()
                                 .name("filter")
-                                .type(registeredInputTypes.get("CXS_ProfileFilterInput"))
+                                .type(registeredInputTypes.get("CDP_ProfileFilterInput"))
                         )
                         .argument(newArgument()
                                 .name("orderBy")
-                                .type(registeredInputTypes.get(CXSOrderByInput.class.getName()))
+                                .type(registeredInputTypes.get(CDPOrderByInput.class.getName()))
                         )
                         .argument(newArgument()
                                 .name("first")
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSProviderManagerImpl.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CDPProviderManagerImpl.java
similarity index 86%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSProviderManagerImpl.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CDPProviderManagerImpl.java
index cd7c56f..e8b75f8 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSProviderManagerImpl.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CDPProviderManagerImpl.java
@@ -22,8 +22,8 @@ import graphql.servlet.GraphQLMutationProvider;
 import graphql.servlet.GraphQLQueryProvider;
 import graphql.servlet.GraphQLTypesProvider;
 import org.apache.unomi.api.services.SegmentService;
-import org.apache.unomi.graphql.CXSGraphQLProvider;
-import org.apache.unomi.graphql.CXSProviderManager;
+import org.apache.unomi.graphql.CDPGraphQLProvider;
+import org.apache.unomi.graphql.CDPProviderManager;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.component.ComponentContext;
@@ -35,12 +35,12 @@ import org.osgi.service.component.annotations.Reference;
 import java.util.Map;
 
 @Component(
-        name="CXSProviderManager",
+        name="CDPProviderManager",
         immediate = true
 )
-public class CXSProviderManagerImpl implements CXSProviderManager {
+public class CDPProviderManagerImpl implements CDPProviderManager {
 
-    private CXSGraphQLProvider cxsGraphQLProvider;
+    private CDPGraphQLProvider cdpGraphQLProvider;
     private GraphQLAnnotationsComponent annotationsComponent;
     private GraphQLFieldRetriever graphQLFieldRetriever;
     private SegmentService segmentService;
@@ -77,13 +77,13 @@ public class CXSProviderManagerImpl implements CXSProviderManager {
             BundleContext bundleContext,
             Map<String,Object> config) {
         this.bundleContext = bundleContext;
-        this.cxsGraphQLProvider = new CXSGraphQLProviderImpl(annotationsComponent);
-        this.cxsGraphQLProvider.setCxsProviderManager(this);
+        this.cdpGraphQLProvider = new CDPGraphQLProviderImpl(annotationsComponent);
+        this.cdpGraphQLProvider.setCdpProviderManager(this);
         providerSR = bundleContext.registerService(new String[] {
                 GraphQLQueryProvider.class.getName(),
                 GraphQLTypesProvider.class.getName(),
                 GraphQLMutationProvider.class.getName()
-        }, cxsGraphQLProvider, null);
+        }, cdpGraphQLProvider, null);
     }
 
     @Deactivate
@@ -92,8 +92,8 @@ public class CXSProviderManagerImpl implements CXSProviderManager {
             BundleContext bundleContext,
             Map<String,Object> config) {
         providerSR.unregister();
-        cxsGraphQLProvider.setCxsProviderManager(null);
-        cxsGraphQLProvider = null;
+        cdpGraphQLProvider.setCdpProviderManager(null);
+        cdpGraphQLProvider = null;
     }
 
     public void refreshProviders() {
@@ -104,7 +104,7 @@ public class CXSProviderManagerImpl implements CXSProviderManager {
                     GraphQLQueryProvider.class.getName(),
                     GraphQLTypesProvider.class.getName(),
                     GraphQLMutationProvider.class.getName()
-            }, cxsGraphQLProvider, null);
+            }, cdpGraphQLProvider, null);
         }
     }
 
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSBooleanPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPBooleanPropertyType.java
similarity index 89%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSBooleanPropertyType.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPBooleanPropertyType.java
index c50dd3b..f066102 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSBooleanPropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPBooleanPropertyType.java
@@ -21,12 +21,12 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_BooleanPropertyType")
-public class CXSBooleanPropertyType extends CXSPropertyType {
+@GraphQLName("CDP_BooleanPropertyType")
+public class CDPBooleanPropertyType extends CDPPropertyType {
 
     private Boolean defaultValue;
 
-    public CXSBooleanPropertyType(@GraphQLName("id") String id,
+    public CDPBooleanPropertyType(@GraphQLName("id") String id,
                                   @GraphQLName("name") String name,
                                   @GraphQLName("minOccurrences") Integer minOccurrences,
                                   @GraphQLName("maxOccurrences") Integer maxOccurrences,
@@ -38,7 +38,7 @@ public class CXSBooleanPropertyType extends CXSPropertyType {
         this.defaultValue = defaultValue;
     }
 
-    public CXSBooleanPropertyType(CXSPropertyType input, Boolean defaultValue) {
+    public CDPBooleanPropertyType(CDPPropertyType input, Boolean defaultValue) {
         super(input);
         this.defaultValue = defaultValue;
     }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSDatePropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPDatePropertyType.java
similarity index 92%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSDatePropertyType.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPDatePropertyType.java
index bd5d0a1..cdac2c2 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSDatePropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPDatePropertyType.java
@@ -21,12 +21,12 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_DatePropertyType")
-public class CXSDatePropertyType extends CXSPropertyType {
+@GraphQLName("CDP_DatePropertyType")
+public class CDPDatePropertyType extends CDPPropertyType {
 
     private String defaultValue;
 
-    public CXSDatePropertyType(@GraphQLName("id") String id,
+    public CDPDatePropertyType(@GraphQLName("id") String id,
                                @GraphQLName("name") String name,
                                @GraphQLName("minOccurrences") Integer minOccurrences,
                                @GraphQLName("maxOccurrences") Integer maxOccurrences,
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSFloatPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPFloatPropertyType.java
similarity index 93%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSFloatPropertyType.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPFloatPropertyType.java
index e53b28b..35f3b7d 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSFloatPropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPFloatPropertyType.java
@@ -21,14 +21,14 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_FloatPropertyType")
-public class CXSFloatPropertyType extends CXSPropertyType {
+@GraphQLName("CDP_FloatPropertyType")
+public class CDPFloatPropertyType extends CDPPropertyType {
 
     private Double minValue;
     private Double maxValue;
     private Double defaultValue;
 
-    public CXSFloatPropertyType(@GraphQLName("id") String id,
+    public CDPFloatPropertyType(@GraphQLName("id") String id,
                                 @GraphQLName("name") String name,
                                 @GraphQLName("minOccurrences") Integer minOccurrences,
                                 @GraphQLName("maxOccurrences") Integer maxOccurrences,
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSGeoPointPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPGeoPointPropertyType.java
similarity index 91%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSGeoPointPropertyType.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPGeoPointPropertyType.java
index a3935b4..734bfd6 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSGeoPointPropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPGeoPointPropertyType.java
@@ -21,12 +21,12 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_GeoPointPropertyType")
-public class CXSGeoPointPropertyType extends CXSPropertyType {
+@GraphQLName("CDP_GeoPointPropertyType")
+public class CDPGeoPointPropertyType extends CDPPropertyType {
 
     private String defaultValue;
 
-    public CXSGeoPointPropertyType(@GraphQLName("id") String id,
+    public CDPGeoPointPropertyType(@GraphQLName("id") String id,
                                    @GraphQLName("name") String name,
                                    @GraphQLName("minOccurrences") Integer minOccurrences,
                                    @GraphQLName("maxOccurrences") Integer maxOccurrences,
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIdentifierPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPIdentifierPropertyType.java
similarity index 92%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIdentifierPropertyType.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPIdentifierPropertyType.java
index 01435cb..ab09a6b 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIdentifierPropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPIdentifierPropertyType.java
@@ -21,13 +21,13 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_IdentifierPropertyType")
-public class CXSIdentifierPropertyType extends CXSPropertyType {
+@GraphQLName("CDP_IdentifierPropertyType")
+public class CDPIdentifierPropertyType extends CDPPropertyType {
 
     private String regexp;
     private String defaultValue;
 
-    public CXSIdentifierPropertyType(@GraphQLName("id") String id,
+    public CDPIdentifierPropertyType(@GraphQLName("id") String id,
                                      @GraphQLName("name") String name,
                                      @GraphQLName("minOccurrences") Integer minOccurrences,
                                      @GraphQLName("maxOccurrences") Integer maxOccurrences,
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIntPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPIntPropertyType.java
similarity index 93%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIntPropertyType.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPIntPropertyType.java
index 99239ee..100dd9a 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSIntPropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPIntPropertyType.java
@@ -21,14 +21,14 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_IntPropertyType")
-public class CXSIntPropertyType extends CXSPropertyType {
+@GraphQLName("CDP_IntPropertyType")
+public class CDPIntPropertyType extends CDPPropertyType {
 
     private Integer minValue;
     private Integer maxValue;
     private Integer defaultValue;
 
-    public CXSIntPropertyType(@GraphQLName("id") String id,
+    public CDPIntPropertyType(@GraphQLName("id") String id,
                               @GraphQLName("name") String name,
                               @GraphQLName("minOccurrences") Integer minOccurrences,
                               @GraphQLName("maxOccurrences") Integer maxOccurrences,
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPPropertyType.java
similarity index 94%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSPropertyType.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPPropertyType.java
index ab2f9e4..2851f08 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSPropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPPropertyType.java
@@ -21,8 +21,8 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_PropertyType")
-public class CXSPropertyType {
+@GraphQLName("CDP_PropertyType")
+public class CDPPropertyType {
 
     private String id;
     private String name;
@@ -32,7 +32,7 @@ public class CXSPropertyType {
     private List<String> systemTags;
     private Boolean personalData;
 
-    public CXSPropertyType(@GraphQLName("id") String id,
+    public CDPPropertyType(@GraphQLName("id") String id,
                            @GraphQLName("name") String name,
                            @GraphQLName("minOccurrences") Integer minOccurrences,
                            @GraphQLName("maxOccurrences") Integer maxOccurrences,
@@ -48,7 +48,7 @@ public class CXSPropertyType {
         this.personalData = personalData;
     }
 
-    public CXSPropertyType(CXSPropertyType input) {
+    public CDPPropertyType(CDPPropertyType input) {
         this.id = input.id;
         this.name = input.name;
         this.minOccurrences = input.minOccurrences;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSSetPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPSetPropertyType.java
similarity index 82%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSSetPropertyType.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPSetPropertyType.java
index befb5bd..bf1c52c 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSSetPropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPSetPropertyType.java
@@ -21,25 +21,25 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_SetPropertyType")
-public class CXSSetPropertyType extends CXSPropertyType {
+@GraphQLName("CDP_SetPropertyType")
+public class CDPSetPropertyType extends CDPPropertyType {
 
-    private List<CXSPropertyType> properties;
+    private List<CDPPropertyType> properties;
 
-    public CXSSetPropertyType(@GraphQLName("id") String id,
+    public CDPSetPropertyType(@GraphQLName("id") String id,
                               @GraphQLName("name") String name,
                               @GraphQLName("minOccurrences") Integer minOccurrences,
                               @GraphQLName("maxOccurrences") Integer maxOccurrences,
                               @GraphQLName("tags") List<String> tags,
                               @GraphQLName("systemTags") List<String> systemTags,
                               @GraphQLName("personalData") Boolean personalData,
-                              @GraphQLName("properties") List<CXSPropertyType> properties) {
+                              @GraphQLName("properties") List<CDPPropertyType> properties) {
         super(id, name, minOccurrences, maxOccurrences, tags, systemTags, personalData);
         this.properties = properties;
     }
 
     @GraphQLField
-    public List<CXSPropertyType> getProperties() {
+    public List<CDPPropertyType> getProperties() {
         return properties;
     }
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSStringPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPStringPropertyType.java
similarity index 92%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSStringPropertyType.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPStringPropertyType.java
index 8604436..7982c80 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CXSStringPropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/propertytypes/CDPStringPropertyType.java
@@ -21,13 +21,13 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_StringPropertyType")
-public class CXSStringPropertyType extends CXSPropertyType {
+@GraphQLName("CDP_StringPropertyType")
+public class CDPStringPropertyType extends CDPPropertyType {
 
     private String regexp;
     private String defaultValue;
 
-    public CXSStringPropertyType(@GraphQLName("id") String id,
+    public CDPStringPropertyType(@GraphQLName("id") String id,
                                  @GraphQLName("name") String name,
                                  @GraphQLName("minOccurrences") Integer minOccurrences,
                                  @GraphQLName("maxOccurrences") Integer maxOccurrences,
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSDateFilter.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPDateFilter.java
similarity index 95%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSDateFilter.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPDateFilter.java
index 0a48393..9058fc1 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSDateFilter.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPDateFilter.java
@@ -19,8 +19,8 @@ package org.apache.unomi.graphql.types.input;
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 
-@GraphQLName("CXS_DateFilter")
-public class CXSDateFilter {
+@GraphQLName("CDP_DateFilter")
+public class CDPDateFilter {
     @GraphQLField
     public long after;
     @GraphQLField
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventFilter.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPEventFilter.java
similarity index 87%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventFilter.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPEventFilter.java
index b699672..c058b71 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventFilter.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPEventFilter.java
@@ -21,15 +21,15 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_EventFilter")
-public class CXSEventFilter {
+@GraphQLName("CDP_EventFilter")
+public class CDPEventFilter {
 
     @GraphQLField
     @GraphQLName("and")
-    public List<CXSEventFilter> andFilters;
+    public List<CDPEventFilter> andFilters;
 
     @GraphQLField
     @GraphQLName("or")
-    public List<CXSEventFilter> orFilters;
+    public List<CDPEventFilter> orFilters;
 
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPEventInput.java
similarity index 92%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPEventInput.java
index 2a076cd..9d1d6f2 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPEventInput.java
@@ -22,15 +22,15 @@ import graphql.annotations.annotationTypes.GraphQLName;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
-@GraphQLName("CXS_Event")
-public class CXSEventInput {
+@GraphQLName("CDP_Event")
+public class CDPEventInput {
     private String id;
     private String eventType;
     private long timeStamp;
     private String subject;
     private String object;
     private Map<Object,Object> properties = new LinkedHashMap<>();
-    private CXSGeoPointInput location;
+    private CDPGeoPointInput location;
 
     @GraphQLField
     public String getId() {
@@ -62,7 +62,7 @@ public class CXSEventInput {
     }
 
     @GraphQLField
-    public CXSGeoPointInput getLocation() {
+    public CDPGeoPointInput getLocation() {
         return location;
     }
 
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventOccurrenceFilterInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPEventOccurrenceFilterInput.java
similarity index 93%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventOccurrenceFilterInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPEventOccurrenceFilterInput.java
index ee74489..2934464 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventOccurrenceFilterInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPEventOccurrenceFilterInput.java
@@ -19,8 +19,8 @@ package org.apache.unomi.graphql.types.input;
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 
-@GraphQLName("CXS_EventOccurrenceFilter")
-public class CXSEventOccurrenceFilterInput {
+@GraphQLName("CDP_EventOccurrenceFilter")
+public class CDPEventOccurrenceFilterInput {
 
     @GraphQLField
     public String eventId;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPEventTypeInput.java
similarity index 84%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventTypeInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPEventTypeInput.java
index 5f94aff..42dfe9f 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSEventTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPEventTypeInput.java
@@ -22,18 +22,18 @@ import graphql.annotations.annotationTypes.GraphQLName;
 import java.util.ArrayList;
 import java.util.List;
 
-@GraphQLName("CXS_EventType")
-public class CXSEventTypeInput {
+@GraphQLName("CDP_EventType")
+public class CDPEventTypeInput {
 
     private String id;
     private String scope;
     private String typeName;
-    private List<CXSPropertyTypeInput> properties = new ArrayList<>();
+    private List<CDPPropertyTypeInput> properties = new ArrayList<>();
 
-    public CXSEventTypeInput(@GraphQLName("id") String id,
+    public CDPEventTypeInput(@GraphQLName("id") String id,
                              @GraphQLName("scope") String scope,
                              @GraphQLName("typeName") String typeName,
-                             @GraphQLName("properties") List<CXSPropertyTypeInput> properties) {
+                             @GraphQLName("properties") List<CDPPropertyTypeInput> properties) {
         this.id = id;
         this.scope = scope;
         this.typeName = typeName;
@@ -56,7 +56,7 @@ public class CXSEventTypeInput {
     }
 
     @GraphQLField
-    public List<CXSPropertyTypeInput> getProperties() {
+    public List<CDPPropertyTypeInput> getProperties() {
         return properties;
     }
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSGeoDistanceInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPGeoDistanceInput.java
similarity index 80%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSGeoDistanceInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPGeoDistanceInput.java
index 7b8352a..3dd45a2 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSGeoDistanceInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPGeoDistanceInput.java
@@ -18,15 +18,15 @@ package org.apache.unomi.graphql.types.input;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
-import org.apache.unomi.graphql.types.output.CXSGeoDistanceUnit;
-import org.apache.unomi.graphql.types.output.CXSGeoPoint;
+import org.apache.unomi.graphql.types.output.CDPGeoDistanceUnit;
+import org.apache.unomi.graphql.types.output.CDPGeoPoint;
 
-@GraphQLName("CXS_GeoDistance")
-public class CXSGeoDistanceInput {
+@GraphQLName("CDP_GeoDistance")
+public class CDPGeoDistanceInput {
     @GraphQLField
-    public CXSGeoPoint center;
+    public CDPGeoPoint center;
     @GraphQLField
-    public CXSGeoDistanceUnit unit;
+    public CDPGeoDistanceUnit unit;
     @GraphQLField
     public Double distance;
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSGeoPointInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPGeoPointInput.java
similarity index 94%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSGeoPointInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPGeoPointInput.java
index 772abb8..8359d46 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSGeoPointInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPGeoPointInput.java
@@ -19,8 +19,8 @@ package org.apache.unomi.graphql.types.input;
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 
-@GraphQLName("CXS_GeoPoint")
-public class CXSGeoPointInput {
+@GraphQLName("CDP_GeoPoint")
+public class CDPGeoPointInput {
     @GraphQLField
     public Double longitude;
     @GraphQLField
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSOrderByInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPOrderByInput.java
similarity index 87%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSOrderByInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPOrderByInput.java
index 3ee5e1c..6ba329d 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSOrderByInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPOrderByInput.java
@@ -18,14 +18,14 @@ package org.apache.unomi.graphql.types.input;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
-import org.apache.unomi.graphql.types.output.CXSSortOrder;
+import org.apache.unomi.graphql.types.output.CDPSortOrder;
 
-@GraphQLName("CXS_OrderBy")
-public class CXSOrderByInput {
+@GraphQLName("CDP_OrderBy")
+public class CDPOrderByInput {
 
     @GraphQLField
     public String fieldName;
 
     @GraphQLField
-    public CXSSortOrder sortOrder;
+    public CDPSortOrder sortOrder;
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPPropertyTypeInput.java
similarity index 65%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSPropertyTypeInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPPropertyTypeInput.java
index 9917ca3..c9cb037 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSPropertyTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPPropertyTypeInput.java
@@ -20,18 +20,18 @@ import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 import org.apache.unomi.graphql.propertytypes.*;
 
-@GraphQLName("CXS_PropertyType")
-public class CXSPropertyTypeInput {
+@GraphQLName("CDP_PropertyType")
+public class CDPPropertyTypeInput {
 
-    public CXSPropertyTypeInput(
-            @GraphQLName("identifier") CXSIdentifierPropertyType identifierPropertyTypeInput,
-            @GraphQLName("string") CXSStringPropertyType stringPropertyTypeInput,
-            @GraphQLName("int") CXSIntPropertyType integerPropertyTypeInput,
-            @GraphQLName("float") CXSFloatPropertyType floatPropertyTypeInput,
-            @GraphQLName("date") CXSDatePropertyType datePropertyTypeInput,
-            @GraphQLName("boolean") CXSBooleanPropertyType booleanPropertyTypeInput,
-            @GraphQLName("geopoint") CXSGeoPointPropertyType geoPointPropertyTypeInput,
-            @GraphQLName("set") CXSSetPropertyTypeInput setPropertyTypeInput) {
+    public CDPPropertyTypeInput(
+            @GraphQLName("identifier") CDPIdentifierPropertyType identifierPropertyTypeInput,
+            @GraphQLName("string") CDPStringPropertyType stringPropertyTypeInput,
+            @GraphQLName("int") CDPIntPropertyType integerPropertyTypeInput,
+            @GraphQLName("float") CDPFloatPropertyType floatPropertyTypeInput,
+            @GraphQLName("date") CDPDatePropertyType datePropertyTypeInput,
+            @GraphQLName("boolean") CDPBooleanPropertyType booleanPropertyTypeInput,
+            @GraphQLName("geopoint") CDPGeoPointPropertyType geoPointPropertyTypeInput,
+            @GraphQLName("set") CDPSetPropertyTypeInput setPropertyTypeInput) {
         this.identifierPropertyTypeInput = identifierPropertyTypeInput;
         this.stringPropertyTypeInput = stringPropertyTypeInput;
         this.integerPropertyTypeInput = integerPropertyTypeInput;
@@ -44,33 +44,33 @@ public class CXSPropertyTypeInput {
 
     @GraphQLField
     @GraphQLName("identifier")
-    public CXSIdentifierPropertyType identifierPropertyTypeInput;
+    public CDPIdentifierPropertyType identifierPropertyTypeInput;
 
     @GraphQLField
     @GraphQLName("string")
-    public CXSStringPropertyType stringPropertyTypeInput;
+    public CDPStringPropertyType stringPropertyTypeInput;
 
     @GraphQLField
     @GraphQLName("int")
-    public CXSIntPropertyType integerPropertyTypeInput;
+    public CDPIntPropertyType integerPropertyTypeInput;
 
     @GraphQLField
     @GraphQLName("float")
-    public CXSFloatPropertyType floatPropertyTypeInput;
+    public CDPFloatPropertyType floatPropertyTypeInput;
 
     @GraphQLField
     @GraphQLName("date")
-    public CXSDatePropertyType datePropertyTypeInput;
+    public CDPDatePropertyType datePropertyTypeInput;
 
     @GraphQLField
     @GraphQLName("boolean")
-    public CXSBooleanPropertyType booleanPropertyTypeInput;
+    public CDPBooleanPropertyType booleanPropertyTypeInput;
 
     @GraphQLField
     @GraphQLName("geopoint")
-    public CXSGeoPointPropertyType geoPointPropertyTypeInput;
+    public CDPGeoPointPropertyType geoPointPropertyTypeInput;
 
     @GraphQLField
     @GraphQLName("set")
-    public CXSSetPropertyTypeInput setPropertyTypeInput;
+    public CDPSetPropertyTypeInput setPropertyTypeInput;
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSSegmentFilterInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPSegmentFilterInput.java
similarity index 89%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSSegmentFilterInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPSegmentFilterInput.java
index 95bbc9d..0f8193b 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSSegmentFilterInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPSegmentFilterInput.java
@@ -21,16 +21,16 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_SegmentFilter")
-public class CXSSegmentFilterInput {
+@GraphQLName("CDP_SegmentFilter")
+public class CDPSegmentFilterInput {
 
     @GraphQLField
     @GraphQLName("and")
-    public List<CXSSegmentFilterInput> andFilters;
+    public List<CDPSegmentFilterInput> andFilters;
 
     @GraphQLField
     @GraphQLName("or")
-    public List<CXSSegmentFilterInput> orFilters;
+    public List<CDPSegmentFilterInput> orFilters;
 
     @GraphQLField
     @GraphQLName("view_equals")
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSSetPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPSetPropertyTypeInput.java
similarity index 82%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSSetPropertyTypeInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPSetPropertyTypeInput.java
index ba762f9..120e8f6 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CXSSetPropertyTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/input/CDPSetPropertyTypeInput.java
@@ -18,28 +18,29 @@ package org.apache.unomi.graphql.types.input;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
+import org.apache.unomi.graphql.propertytypes.CDPPropertyType;
 
 import java.util.List;
 
-@GraphQLName("CXS_SetPropertyType")
-public class CXSSetPropertyTypeInput extends org.apache.unomi.graphql.propertytypes.CXSPropertyType {
+@GraphQLName("CDP_SetPropertyType")
+public class CDPSetPropertyTypeInput extends CDPPropertyType {
 
-    private List<CXSPropertyTypeInput> properties;
+    private List<CDPPropertyTypeInput> properties;
 
-    public CXSSetPropertyTypeInput(@GraphQLName("id") String id,
+    public CDPSetPropertyTypeInput(@GraphQLName("id") String id,
                                    @GraphQLName("name") String name,
                                    @GraphQLName("minOccurrences") Integer minOccurrences,
                                    @GraphQLName("maxOccurrences") Integer maxOccurrences,
                                    @GraphQLName("tags") List<String> tags,
                                    @GraphQLName("systemTags") List<String> systemTags,
                                    @GraphQLName("personalData") Boolean personalData,
-                                   @GraphQLName("properties") List<CXSPropertyTypeInput> properties) {
+                                   @GraphQLName("properties") List<CDPPropertyTypeInput> properties) {
         super(id, name, minOccurrences, maxOccurrences, tags, systemTags, personalData);
         this.properties = properties;
     }
 
     @GraphQLField
-    public List<CXSPropertyTypeInput> getProperties() {
+    public List<CDPPropertyTypeInput> getProperties() {
         return properties;
     }
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEvent.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEvent.java
similarity index 87%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEvent.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEvent.java
index 738ef7e..cf973a5 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEvent.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEvent.java
@@ -19,16 +19,16 @@ package org.apache.unomi.graphql.types.output;
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 
-@GraphQLName("CXS_Event")
-public class CXSEvent {
+@GraphQLName("CDP_Event")
+public class CDPEvent {
 
     private String id;
     private String eventType;
     private long timeStamp;
     private String subject;
     private String object;
-    private CXSEventProperties properties = new CXSEventProperties();
-    private CXSGeoPoint location;
+    private CDPEventProperties properties = new CDPEventProperties();
+    private CDPGeoPoint location;
 
     @GraphQLField
     public String getId() {
@@ -56,12 +56,12 @@ public class CXSEvent {
     }
 
     @GraphQLField
-    public CXSEventProperties getProperties() {
+    public CDPEventProperties getProperties() {
         return properties;
     }
 
     @GraphQLField
-    public CXSGeoPoint getLocation() {
+    public CDPGeoPoint getLocation() {
         return location;
     }
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventConnection.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventConnection.java
similarity index 90%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventConnection.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventConnection.java
index 5852b8d..cd26ab9 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventConnection.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventConnection.java
@@ -21,11 +21,11 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_EventConnection")
-public class CXSEventConnection {
+@GraphQLName("CDP_EventConnection")
+public class CDPEventConnection {
 
     @GraphQLField
-    public List<CXSEventEdge> edges;
+    public List<CDPEventEdge> edges;
     @GraphQLField
     public PageInfo pageInfo;
 
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventEdge.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventEdge.java
similarity index 92%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventEdge.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventEdge.java
index 1be39a6..a42bb50 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventEdge.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventEdge.java
@@ -19,11 +19,11 @@ package org.apache.unomi.graphql.types.output;
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 
-@GraphQLName("CXS_EventEdge")
-public class CXSEventEdge {
+@GraphQLName("CDP_EventEdge")
+public class CDPEventEdge {
 
     @GraphQLField
-    public CXSEvent node;
+    public CDPEvent node;
     @GraphQLField
     public String cursor;
 
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventFilter.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventFilter.java
similarity index 87%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventFilter.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventFilter.java
index 9d26663..9a168a5 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventFilter.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventFilter.java
@@ -21,12 +21,12 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_EventFilter")
-public class CXSEventFilter {
+@GraphQLName("CDP_EventFilter")
+public class CDPEventFilter {
 
     @GraphQLField
-    public List<CXSEventFilter> andFilters;
+    public List<CDPEventFilter> andFilters;
     @GraphQLField
-    public List<CXSEventFilter> orFilters;
+    public List<CDPEventFilter> orFilters;
 
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventOccurrenceFilter.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventOccurrenceFilter.java
similarity index 90%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventOccurrenceFilter.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventOccurrenceFilter.java
index 7fac676..2fb2272 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventOccurrenceFilter.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventOccurrenceFilter.java
@@ -19,8 +19,8 @@ package org.apache.unomi.graphql.types.output;
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 
-@GraphQLName("CXS_EventOccurrenceFilter")
-public class CXSEventOccurrenceFilter {
+@GraphQLName("CDP_EventOccurrenceFilter")
+public class CDPEventOccurrenceFilter {
     @GraphQLField
     public String eventType;
     @GraphQLField
@@ -32,5 +32,5 @@ public class CXSEventOccurrenceFilter {
     @GraphQLField
     public int count;
 
-    public CXSEventFilter eventFilter;
+    public CDPEventFilter eventFilter;
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventProperties.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventProperties.java
similarity index 94%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventProperties.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventProperties.java
index 7431cf9..1fe0739 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventProperties.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventProperties.java
@@ -22,8 +22,8 @@ import graphql.annotations.annotationTypes.GraphQLName;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
-@GraphQLName("CXS_EventProperties")
-public class CXSEventProperties {
+@GraphQLName("CDP_EventProperties")
+public class CDPEventProperties {
     @GraphQLField
     public int nbProperties;
 
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventPropertiesFilter.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventPropertiesFilter.java
similarity index 91%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventPropertiesFilter.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventPropertiesFilter.java
index 9580a51..1340387 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventPropertiesFilter.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventPropertiesFilter.java
@@ -18,6 +18,6 @@ package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLName;
 
-@GraphQLName("CXS_EventPropertiesFilter")
-public class CXSEventPropertiesFilter {
+@GraphQLName("CDP_EventPropertiesFilter")
+public class CDPEventPropertiesFilter {
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventType.java
similarity index 82%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventType.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventType.java
index 38a7d4e..e59895b 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSEventType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPEventType.java
@@ -18,23 +18,23 @@ package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
-import org.apache.unomi.graphql.propertytypes.CXSPropertyType;
+import org.apache.unomi.graphql.propertytypes.CDPPropertyType;
 
 import java.util.ArrayList;
 import java.util.List;
 
-@GraphQLName("CXS_EventType")
-public class CXSEventType {
+@GraphQLName("CDP_EventType")
+public class CDPEventType {
 
     private String id;
     private String scope;
     private String typeName;
-    private List<CXSPropertyType> properties = new ArrayList<>();
+    private List<CDPPropertyType> properties = new ArrayList<>();
 
-    public CXSEventType(@GraphQLName("id") String id,
+    public CDPEventType(@GraphQLName("id") String id,
                         @GraphQLName("scope") String scope,
                         @GraphQLName("typeName") String typeName,
-                        @GraphQLName("properties") List<CXSPropertyType> properties) {
+                        @GraphQLName("properties") List<CDPPropertyType> properties) {
         this.id = id;
         this.scope = scope;
         this.typeName = typeName;
@@ -57,7 +57,7 @@ public class CXSEventType {
     }
 
     @GraphQLField
-    public List<CXSPropertyType> getProperties() {
+    public List<CDPPropertyType> getProperties() {
         return properties;
     }
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSGeoDistanceUnit.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPGeoDistanceUnit.java
similarity index 93%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSGeoDistanceUnit.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPGeoDistanceUnit.java
index 8be9aee..f046e62 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSGeoDistanceUnit.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPGeoDistanceUnit.java
@@ -18,8 +18,8 @@ package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLName;
 
-@GraphQLName("CXS_GeoDistanceUnit")
-public enum CXSGeoDistanceUnit {
+@GraphQLName("CDP_GeoDistanceUnit")
+public enum CDPGeoDistanceUnit {
     METERS,
     KILOMETERS,
     MILES
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSGeoPoint.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPGeoPoint.java
similarity index 94%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSGeoPoint.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPGeoPoint.java
index 12e3e0a..58cc2b8 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSGeoPoint.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPGeoPoint.java
@@ -19,8 +19,8 @@ package org.apache.unomi.graphql.types.output;
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 
-@GraphQLName("CXS_GeoPoint")
-public class CXSGeoPoint {
+@GraphQLName("CDP_GeoPoint")
+public class CDPGeoPoint {
 
     @GraphQLField
     public Double latitude;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegment.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPSegment.java
similarity index 89%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegment.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPSegment.java
index 5f64798..abf8e53 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegment.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPSegment.java
@@ -19,14 +19,14 @@ package org.apache.unomi.graphql.types.output;
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 
-@GraphQLName("CXS_Segment")
-public class CXSSegment {
+@GraphQLName("CDP_Segment")
+public class CDPSegment {
     @GraphQLField
     public String id;
     @GraphQLField
-    public CXSView view;
+    public CDPView view;
     @GraphQLField
     public String name;
     @GraphQLField
-    public CXSSegmentCondition condition;
+    public CDPSegmentCondition condition;
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegmentCondition.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPSegmentCondition.java
similarity index 81%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegmentCondition.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPSegmentCondition.java
index eca9f90..2f42b68 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegmentCondition.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPSegmentCondition.java
@@ -18,16 +18,16 @@ package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
-import org.apache.unomi.graphql.CXSProfilePropertiesFilter;
+import org.apache.unomi.graphql.CDPProfilePropertiesFilter;
 
 import java.util.List;
 
-@GraphQLName("CXS_SegmentCondition")
-public class CXSSegmentCondition {
+@GraphQLName("CDP_SegmentCondition")
+public class CDPSegmentCondition {
     @GraphQLField
-    public CXSProfilePropertiesFilter profilePropertiesFilter;
+    public CDPProfilePropertiesFilter profilePropertiesFilter;
     @GraphQLField
     public List<String> grantedConsents;
     @GraphQLField
-    public CXSEventOccurrenceFilter eventOccurrenceFilter;
+    public CDPEventOccurrenceFilter eventOccurrenceFilter;
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegmentConnection.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPSegmentConnection.java
similarity index 90%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegmentConnection.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPSegmentConnection.java
index 09fe699..92def0f 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegmentConnection.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPSegmentConnection.java
@@ -21,10 +21,10 @@ import graphql.annotations.annotationTypes.GraphQLName;
 
 import java.util.List;
 
-@GraphQLName("CXS_SegmentConnection")
-public class CXSSegmentConnection {
+@GraphQLName("CDP_SegmentConnection")
+public class CDPSegmentConnection {
     @GraphQLField
-    public List<CXSSegmentEdge> edges;
+    public List<CDPSegmentEdge> edges;
     @GraphQLField
     public PageInfo pageInfo;
 
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegmentEdge.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPSegmentEdge.java
similarity index 91%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegmentEdge.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPSegmentEdge.java
index f45b872..d0dd7eb 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSegmentEdge.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPSegmentEdge.java
@@ -19,11 +19,11 @@ package org.apache.unomi.graphql.types.output;
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 
-@GraphQLName("CXS_SegmentEdge")
-public class CXSSegmentEdge {
+@GraphQLName("CDP_SegmentEdge")
+public class CDPSegmentEdge {
 
     @GraphQLField
-    public CXSSegment edge;
+    public CDPSegment edge;
 
     @GraphQLField
     public String cursor;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSortOrder.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPSortOrder.java
similarity index 94%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSortOrder.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPSortOrder.java
index 34d8c11..20cc1da 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSSortOrder.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPSortOrder.java
@@ -18,8 +18,8 @@ package org.apache.unomi.graphql.types.output;
 
 import graphql.annotations.annotationTypes.GraphQLName;
 
-@GraphQLName("CXS_SortOrder")
-public enum CXSSortOrder {
+@GraphQLName("CDP_SortOrder")
+public enum CDPSortOrder {
     ASC,
     DESC,
     UNSPECIFIED
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSView.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPView.java
similarity index 95%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSView.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPView.java
index a8e3616..c053755 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CXSView.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/types/output/CDPView.java
@@ -19,8 +19,8 @@ package org.apache.unomi.graphql.types.output;
 import graphql.annotations.annotationTypes.GraphQLField;
 import graphql.annotations.annotationTypes.GraphQLName;
 
-@GraphQLName("CXS_view")
-public class CXSView {
+@GraphQLName("CDP_View")
+public class CDPView {
     @GraphQLField
     public String name;
 }


[unomi] 01/27: 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.

Posted by sh...@apache.org.
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 b288e2dd05a03e6a681ac489e973c9f8b3595ab5
Author: Serge Huber <sh...@apache.org>
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 <sh...@apache.org>
---
 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 0000000..ac3123d
--- /dev/null
+++ b/graphql/cxs-impl/pom.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<project xmlns="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">
+    <parent>
+        <groupId>org.apache.unomi</groupId>
+        <artifactId>unomi-graphql</artifactId>
+        <version>1.3.0-incubating-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>cxs-graphql-api-impl</artifactId>
+    <packaging>bundle</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.graphql-java</groupId>
+            <artifactId>graphql-java-servlet</artifactId>
+            <version>${graphql.java.servlet.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.graphql-java</groupId>
+            <artifactId>graphql-java</artifactId>
+            <version>${graphql.java.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.github.graphql-java</groupId>
+            <artifactId>graphql-java-annotations</artifactId>
+            <version>${graphql.java.annotations.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi.enterprise</artifactId>
+            <version>6.0.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi.core</artifactId>
+            <version>6.0.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.ds-annotations</artifactId>
+            <version>1.2.4</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.7.21</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+</project>
\ 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 0000000..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<Object,Object> 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<Object, Object> 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 0000000..43f04fb
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventType.java
@@ -0,0 +1,26 @@
+/*
+ * 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 CXSEventType {
+
+    @GraphQLField
+    public String id;
+
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPoint.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPoint.java
new file mode 100644
index 0000000..bfa7c24
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPoint.java
@@ -0,0 +1,29 @@
+/*
+ * 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 CXSGeoPoint {
+
+    @GraphQLField
+    public double latitude;
+
+    @GraphQLField
+    public double longitude;
+
+}
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
new file mode 100644
index 0000000..01f2636
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGraphQLProvider.java
@@ -0,0 +1,21 @@
+/*
+ * 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;
+
+public interface CXSGraphQLProvider {
+
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProperties.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProperties.java
new file mode 100644
index 0000000..55a1b3e
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProperties.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;
+
+public class CXSProperties {
+
+    @GraphQLField
+    public String key;
+
+    @GraphQLField
+    public String value;
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyType.java
new file mode 100644
index 0000000..a55a04b
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyType.java
@@ -0,0 +1,32 @@
+/*
+ * 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.LinkedHashSet;
+import java.util.Set;
+
+public class CXSPropertyType {
+
+    private String id;
+    private String name;
+    private int minOccurrences = 0;
+    private int maxOccurrences = 1;
+    private Set<String> tags = new LinkedHashSet<>();
+    private Set<String> systemTags = new LinkedHashSet<>();
+    private boolean personalData = false;
+
+}
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java
new file mode 100644
index 0000000..a341a9f
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java
@@ -0,0 +1,70 @@
+/*
+ * 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.servlet.GraphQLMutationProvider;
+import graphql.servlet.GraphQLQueryProvider;
+import graphql.servlet.GraphQLTypesProvider;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+
+import java.util.Map;
+
+@Component(
+        name="CXSProviderManager",
+        immediate = true
+)
+public class CXSProviderManager {
+
+    @Reference(name = "CXSGraphQLProvider")
+    private CXSGraphQLProvider cxsGraphQLProvider;
+    private ServiceRegistration<?> providerSR;
+    private BundleContext bundleContext;
+
+    @Activate
+    void activate(
+            ComponentContext componentContext,
+            BundleContext bundleContext,
+            Map<String,Object> config) {
+        this.bundleContext = bundleContext;
+    }
+
+    @Deactivate
+    void deactivate(
+            ComponentContext componentContext,
+            BundleContext bundleContext,
+            Map<String,Object> config) {
+    }
+
+    void refreshProviders() {
+        if (providerSR != null) {
+            providerSR.unregister();
+            providerSR = null;
+            providerSR = bundleContext.registerService(new String[] {
+                    GraphQLQueryProvider.class.getName(),
+                    GraphQLTypesProvider.class.getName(),
+                    GraphQLMutationProvider.class.getName()
+            }, cxsGraphQLProvider, null);
+        }
+    }
+
+}
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
new file mode 100644
index 0000000..e451dde
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSGraphQLProviderImpl.java
@@ -0,0 +1,188 @@
+/*
+ * 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.annotations.processor.GraphQLAnnotations;
+import graphql.schema.*;
+import graphql.servlet.GraphQLMutationProvider;
+import graphql.servlet.GraphQLQueryProvider;
+import graphql.servlet.GraphQLTypesProvider;
+import org.apache.unomi.graphql.*;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+
+import java.util.*;
+
+import static graphql.Scalars.*;
+import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
+import static graphql.schema.GraphQLObjectType.newObject;
+
+@Component(
+        name = "CXSGraphQLProvider",
+        immediate = true
+)
+public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryProvider, GraphQLTypesProvider, GraphQLMutationProvider {
+
+    private Map<String,GraphQLOutputType> registeredOutputTypes = new TreeMap<>();
+
+    @Activate
+    void activate(
+            ComponentContext cc,
+            BundleContext bc,
+            Map<String,Object> config) {
+
+        registeredOutputTypes.put(CXSGeoPoint.class.getName(), GraphQLAnnotations.object(CXSGeoPoint.class));
+        registeredOutputTypes.put(CXSProperties.class.getName(), GraphQLAnnotations.object(CXSProperties.class));
+        registeredOutputTypes.put(CXSEventType.class.getName(), GraphQLAnnotations.object(CXSEventType.class));
+
+        registeredOutputTypes.put("CXS_Event", buildCXSEventOutputType());
+        registeredOutputTypes.put("CXS_Query", buildCXSQueryOutputType());
+    }
+
+    @Deactivate
+    void deactivate(
+            ComponentContext cc,
+            BundleContext bc,
+            Map<String,Object> config) {
+
+        registeredOutputTypes.clear();
+    }
+
+    @Override
+    public Collection<GraphQLFieldDefinition> getQueries() {
+        List<GraphQLFieldDefinition> fieldDefinitions = new ArrayList<GraphQLFieldDefinition>();
+        fieldDefinitions.add(newFieldDefinition()
+                .type(registeredOutputTypes.get("CXS_Query"))
+                .name("cxs")
+                .description("Root field for all CXS queries")
+                .dataFetcher(new DataFetcher() {
+                    public Object get(DataFetchingEnvironment environment) {
+                        Map<String,Object> map = environment.getContext();
+                        return map.keySet();
+                    }
+                }).build());
+        return fieldDefinitions;
+    }
+
+    @Override
+    public Collection<GraphQLType> getTypes() {
+        return new ArrayList<>();
+    }
+
+    @Override
+    public Collection<GraphQLFieldDefinition> getMutations() {
+        return new ArrayList<>();
+    }
+
+    private GraphQLOutputType buildCXSQueryOutputType() {
+        return newObject()
+                .name("CXS_Query")
+                .description("Root CXS query type")
+                .field(newFieldDefinition()
+                        .type(new GraphQLList(registeredOutputTypes.get(CXSEventType.class.getName())))
+                        .name("getEventTypes")
+                        .description("Retrieves the list of all the declared CXS event types in the Apache Unomi server")
+                )
+                .build();
+    }
+
+
+    private GraphQLOutputType buildCXSEventOutputType() {
+        return newObject()
+                .name("CXS_Event")
+                .description("An event is generated by user interacting with the Context Server")
+                .field(newFieldDefinition()
+                        .type(GraphQLID)
+                        .name("id")
+                        .description("A unique identifier for the event")
+                        .dataFetcher(new DataFetcher() {
+                            public Object get(DataFetchingEnvironment environment) {
+                                CXSEvent CXSEvent = environment.getSource();
+                                return CXSEvent.getId();
+                            }
+                        })
+                )
+                .field(newFieldDefinition()
+                        .type(GraphQLString)
+                        .name("eventType")
+                        .description("An identifier for the event type")
+                        .dataFetcher(new DataFetcher() {
+                            public Object get(DataFetchingEnvironment environment) {
+                                CXSEvent CXSEvent = environment.getSource();
+                                return CXSEvent.getEventType();
+                            }
+                        })
+                )
+                .field(newFieldDefinition()
+                        .type(GraphQLLong)
+                        .name("timestamp")
+                        .description("The difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.")
+                        .dataFetcher(new DataFetcher() {
+                            public Object get(DataFetchingEnvironment environment) {
+                                CXSEvent CXSEvent = environment.getSource();
+                                return CXSEvent.getTimeStamp();
+                            }
+                        }))
+                .field(newFieldDefinition()
+                        .type(GraphQLString)
+                        .name("subject")
+                        .description("The entity that has fired the event (using the profile)")
+                        .dataFetcher(new DataFetcher() {
+                            public Object get(DataFetchingEnvironment environment) {
+                                CXSEvent CXSEvent = environment.getSource();
+                                return CXSEvent.getSubject();
+                            }
+                        }))
+                .field(newFieldDefinition()
+                        .type(GraphQLString)
+                        .name("object")
+                        .description("The object on which the event was fired.")
+                        .dataFetcher(new DataFetcher() {
+                            public Object get(DataFetchingEnvironment environment) {
+                                CXSEvent CXSEvent = environment.getSource();
+                                return CXSEvent.getObject();
+                            }
+                        })
+                )
+                .field(newFieldDefinition()
+                        .type(registeredOutputTypes.get(CXSGeoPoint.class.getName()))
+                        .name("location")
+                        .description("The geo-point location where the event was fired.")
+                        .dataFetcher(new DataFetcher() {
+                            public Object get(DataFetchingEnvironment environment) {
+                                CXSEvent CXSEvent = environment.getSource();
+                                return CXSEvent.getLocation();
+                            }
+                        })
+                )
+                .field(newFieldDefinition()
+                        .type(new GraphQLList(registeredOutputTypes.get(CXSProperties.class.getName())))
+                        .name("properties")
+                        .description("Generic properties for the event")
+                        .dataFetcher(new DataFetcher() {
+                            public Object get(DataFetchingEnvironment environment) {
+                                CXSEvent CXSEvent = environment.getSource();
+                                return new ArrayList<Map.Entry<Object,Object>>(CXSEvent.getProperties().entrySet());
+                            }
+                        })
+                )
+                .build();
+    }
+}
diff --git a/graphql/karaf-feature/pom.xml b/graphql/karaf-feature/pom.xml
new file mode 100644
index 0000000..011e1eb
--- /dev/null
+++ b/graphql/karaf-feature/pom.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<project xmlns="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">
+    <parent>
+        <groupId>org.apache.unomi</groupId>
+        <artifactId>unomi-graphql</artifactId>
+        <version>1.3.0-incubating-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>feature</packaging>
+
+    <artifactId>cxs-graphql-feature</artifactId>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-core</artifactId>
+            <version>2.8.4</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-annotations</artifactId>
+            <version>2.8.4</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+            <version>2.8.4</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.datatype</groupId>
+            <artifactId>jackson-datatype-jdk8</artifactId>
+            <version>2.8.4</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <version>20.0</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-fileupload</groupId>
+            <artifactId>commons-fileupload</artifactId>
+            <version>1.3.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.antlr</groupId>
+            <artifactId>antlr4-runtime</artifactId>
+            <version>4.5.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.graphql-java</groupId>
+            <artifactId>graphql-java-servlet</artifactId>
+            <version>${graphql.java.servlet.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>javax.servlet</groupId>
+                    <artifactId>javax.servlet-api</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>com.graphql-java</groupId>
+            <artifactId>graphql-java</artifactId>
+            <version>${graphql.java.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-api</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>io.github.graphql-java</groupId>
+            <artifactId>graphql-java-annotations</artifactId>
+            <version>${graphql.java.annotations.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+                <artifactId>cxs-graphql-api-impl</artifactId>
+            <version>1.3.0-incubating-SNAPSHOT</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>karaf-maven-plugin</artifactId>
+                <version>${version.karaf}</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <startLevel>80</startLevel>
+                    <addTransitiveFeatures>true</addTransitiveFeatures>
+                    <includeTransitiveDependency>true</includeTransitiveDependency>
+                </configuration>
+            </plugin>
+        </plugins>
+
+    </build>
+
+</project>
\ No newline at end of file
diff --git a/graphql/pom.xml b/graphql/pom.xml
new file mode 100644
index 0000000..bc03766
--- /dev/null
+++ b/graphql/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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
+  -->
+
+<project xmlns="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">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.unomi</groupId>
+        <artifactId>unomi-root</artifactId>
+        <version>1.3.0-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>unomi-graphql</artifactId>
+    <name>Apache Unomi :: GraphQL API</name>
+    <description>Apache Unomi Context GraphQL API</description>
+    <packaging>pom</packaging>
+
+    <properties>
+        <graphql.java.servlet.version>4.7.0</graphql.java.servlet.version>
+        <graphql.java.version>6.0</graphql.java.version>
+        <graphql.java.annotations.version>5.1</graphql.java.annotations.version>
+    </properties>
+
+    <modules>
+        <module>cxs-impl</module>
+        <module>karaf-feature</module>
+    </modules>
+
+</project>
diff --git a/pom.xml b/pom.xml
index 3e30b82..8900e2e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -990,6 +990,7 @@
         <module>persistence-elasticsearch</module>
         <module>services</module>
         <module>rest</module>
+        <module>graphql</module>
         <module>wab</module>
         <module>plugins</module>
         <module>extensions</module>


[unomi] 16/27: 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.

Posted by sh...@apache.org.
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 930248344c068134c2cf0c0646554dcfda0ea4b3
Author: sergehuber <sh...@jahia.com>
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 0000000..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(schemaParser.parse(schemaFile2));
+        //typeRegistry.merge(schemaParser.parse(schemaFile3));
+
+        RuntimeWiring wiring = buildRuntimeWiring();
+        GraphQLSchema graphQLSchema = schemaGenerator.makeExecutableSchema(typeRegistry, wiring);
+    }
+
+    private Reader getSchemaReader(String resourceUrl) {
+        try {
+            return new InputStreamReader(bundleContext.getBundle().getResource(resourceUrl).openConnection().getInputStream());
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+}
diff --git a/graphql/cxs-impl/src/main/resources/cdp-schema.sdl b/graphql/cxs-impl/src/main/resources/cdp-schema.graphqls
similarity index 100%
rename from graphql/cxs-impl/src/main/resources/cdp-schema.sdl
rename to graphql/cxs-impl/src/main/resources/cdp-schema.graphqls
diff --git a/graphql/karaf-feature/pom.xml b/graphql/karaf-feature/pom.xml
index c051b18..0437dba 100644
--- a/graphql/karaf-feature/pom.xml
+++ b/graphql/karaf-feature/pom.xml
@@ -82,7 +82,7 @@
             <version>1.0.2</version>
         </dependency>
 
-
+<!--
         <dependency>
             <groupId>com.graphql-java-kickstart</groupId>
             <artifactId>graphql-java-servlet</artifactId>
@@ -98,6 +98,7 @@
                 </exclusion>
             </exclusions>
         </dependency>
+-->
         <dependency>
             <groupId>com.graphql-java</groupId>
             <artifactId>graphql-java</artifactId>
@@ -109,12 +110,13 @@
                 </exclusion>
             </exclusions>
         </dependency>
+<!--
         <dependency>
             <groupId>io.github.graphql-java</groupId>
             <artifactId>graphql-java-annotations</artifactId>
             <version>${graphql.java.annotations.version}</version>
         </dependency>
-
+-->
         <dependency>
             <groupId>org.apache.unomi</groupId>
                 <artifactId>cdp-graphql-api-impl</artifactId>


[unomi] 04/27: UNOMI-180 Implement CXS GraphQL API - Event type registration and dynamic schema generation is now mostly working !

Posted by sh...@apache.org.
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 eea2b5ad577abf3581dfae8d021e41b1298d078c
Author: Serge Huber <sh...@apache.org>
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 <sh...@apache.org>
---
 .../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<String,GraphQLOutputType> registeredOutputTypes = new TreeMap<>();
     private Map<String,GraphQLInputType> registeredInputTypes = new TreeMap<>();
     private CXSProviderManager cxsProviderManager;
+    private GraphQLAnnotationsComponent annotationsComponent;
+    private ProcessingElementsContainer container;
 
     private Map<String,CXSEventType> 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("CXS_Event", buildCXSEventOutputType());
         registeredOutputTypes.put("CXS_Query", buildCXSQueryOutputType());
         registeredOutputTypes.put("CXS_Mutation", buildCXSMutationOutputType());
     }
 
+    private GraphQLInputType buildCXSEventInputType() {
+        GraphQLInputObjectType.Builder cxsEventInputType = newInputObject()
+                .name("CXS_EventInput")
+                .description("The event input object to send events to the Context Server")
+                .field(newInputObjectField()
+                        .name("id")
+                        .type(GraphQLID)
+                );
+
+        for (Map.Entry<String,CXSEventType> cxsEventTypeEntry : eventTypes.entrySet()) {
+            CXSEventType cxsEventType = cxsEventTypeEntry.getValue();
+            cxsEventInputType.field(newInputObjectField()
+                    .name(cxsEventTypeEntry.getKey())
+                    .type(buildCXSEventTypeInputProperty(cxsEventType.typeName, cxsEventType.properties))
+            );
+        }
+
+        return cxsEventInputType.build();
+
+    }
+
+    private GraphQLInputType buildCXSEventTypeInputProperty(String typeName, List<CXSPropertyType> propertyTypes) {
+        String eventTypeName = typeName.substring(0, 1).toUpperCase() + typeName.substring(1) + "EventTypeInput";
+        GraphQLInputObjectType.Builder eventInputType = newInputObject()
+                .name(eventTypeName)
+                .description("Event type object for event type " + typeName);
+
+        for (CXSPropertyType cxsEventPropertyType : propertyTypes) {
+            GraphQLInputType eventPropertyInputType = null;
+            if (cxsEventPropertyType instanceof CXSIdentifierPropertyType) {
+                eventPropertyInputType = GraphQLID;
+            } else if (cxsEventPropertyType instanceof CXSStringPropertyType) {
+                eventPropertyInputType = GraphQLString;
+            } else if (cxsEventPropertyType instanceof CXSIntPropertyType) {
+                eventPropertyInputType = GraphQLInt;
+            } else if (cxsEventPropertyType instanceof CXSFloatPropertyType) {
+                eventPropertyInputType = GraphQLFloat;
+            } else if (cxsEventPropertyType instanceof CXSBooleanPropertyType) {
+                eventPropertyInputType = GraphQLBoolean;
+            } else if (cxsEventPropertyType instanceof CXSDatePropertyType) {
+                eventPropertyInputType = GraphQLString;
+            } else if (cxsEventPropertyType instanceof CXSGeoPointPropertyType) {
+                eventPropertyInputType = registeredInputTypes.get(CXSGeoPoint.class.getName());
+            } else if (cxsEventPropertyType instanceof CXSSetPropertyType) {
+                eventPropertyInputType = buildCXSEventTypeInputProperty(cxsEventPropertyType.name, ((CXSSetPropertyType)cxsEventPropertyType).properties);
+            }
+            eventInputType
+                    .field(newInputObjectField()
+                            .type(eventPropertyInputType)
+                            .name(cxsEventPropertyType.name)
+                    );
+        }
+
+        return eventInputType.build();
+    }
+
     @Deactivate
     void deactivate(
             ComponentContext cc,
@@ -182,6 +247,14 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                             }
                         })
                 )
+                .field(newFieldDefinition()
+                        .name("processEvents")
+                        .description("Processes events sent to the Context Server")
+                        .argument(newArgument()
+                                .name("events")
+                                .type(new GraphQLList(registeredInputTypes.get("CXS_EventInput"))))
+                        .type(GraphQLInt)
+                )
                 .build();
     }
 
@@ -205,7 +278,7 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
         CXSSetPropertyType cxsSetPropertyType = new CXSSetPropertyType();
         Map<String,Object> setPropertyTypeMap = (Map<String,Object>) propertyTypeMap.get("set");
         populateCommonProperties(setPropertyTypeMap, cxsSetPropertyType);
-        if (propertyTypeMap.containsKey("properties")) {
+        if (setPropertyTypeMap.containsKey("properties")) {
             List<Map<String,Object>> propertyList = (List<Map<String,Object>>) setPropertyTypeMap.get("properties");
             List<CXSPropertyType> setProperties = new ArrayList<>();
             for (Map<String,Object> setProperty : propertyList) {
@@ -343,7 +416,7 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
             CXSEventType cxsEventType = cxsEventTypeEntry.getValue();
             eventPropertiesOutputType
                     .field(newFieldDefinition()
-                            .type(registeredOutputTypes.get(CXSSetPropertyType.class.getName()))
+                            .type(buildEventOutputType(cxsEventType.typeName, cxsEventType.properties))
                             .name(cxsEventTypeEntry.getKey())
                     );
         }
@@ -351,4 +424,40 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
         return eventPropertiesOutputType.build();
     }
 
+    private GraphQLOutputType buildEventOutputType(String typeName, List<CXSPropertyType> propertyTypes) {
+        String eventTypeName = typeName.substring(0, 1).toUpperCase() + typeName.substring(1) + "EventType";
+        GraphQLObjectType.Builder eventOutputType = newObject()
+                .name(eventTypeName)
+                .description("Event type object for event type " + typeName);
+
+        for (CXSPropertyType cxsEventPropertyType : propertyTypes) {
+            GraphQLOutputType eventPropertyOutputType = null;
+            if (cxsEventPropertyType instanceof CXSIdentifierPropertyType) {
+                eventPropertyOutputType = GraphQLID;
+            } else if (cxsEventPropertyType instanceof CXSStringPropertyType) {
+                eventPropertyOutputType = GraphQLString;
+            } else if (cxsEventPropertyType instanceof CXSIntPropertyType) {
+                eventPropertyOutputType = GraphQLInt;
+            } else if (cxsEventPropertyType instanceof CXSFloatPropertyType) {
+                eventPropertyOutputType = GraphQLFloat;
+            } else if (cxsEventPropertyType instanceof CXSBooleanPropertyType) {
+                eventPropertyOutputType = GraphQLBoolean;
+            } else if (cxsEventPropertyType instanceof CXSDatePropertyType) {
+                eventPropertyOutputType = GraphQLString;
+            } else if (cxsEventPropertyType instanceof CXSGeoPointPropertyType) {
+                eventPropertyOutputType = registeredOutputTypes.get(CXSGeoPoint.class.getName());
+            } else if (cxsEventPropertyType instanceof CXSSetPropertyType) {
+                eventPropertyOutputType = buildEventOutputType(cxsEventPropertyType.name, ((CXSSetPropertyType)cxsEventPropertyType).properties);
+            }
+            eventOutputType
+                    .field(newFieldDefinition()
+                            .type(eventPropertyOutputType)
+                            .name(cxsEventPropertyType.name)
+                    );
+        }
+
+
+        return eventOutputType.build();
+    }
+
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSProviderManagerImpl.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSProviderManagerImpl.java
index 8b7b80a..bb00d54 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSProviderManagerImpl.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSProviderManagerImpl.java
@@ -16,6 +16,8 @@
  */
 package org.apache.unomi.graphql.internal;
 
+import graphql.annotations.processor.GraphQLAnnotationsComponent;
+import graphql.annotations.processor.ProcessingElementsContainer;
 import graphql.servlet.GraphQLMutationProvider;
 import graphql.servlet.GraphQLQueryProvider;
 import graphql.servlet.GraphQLTypesProvider;
@@ -27,6 +29,7 @@ import org.osgi.service.component.ComponentContext;
 import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
 import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
 
 import java.util.Map;
 
@@ -37,16 +40,23 @@ import java.util.Map;
 public class CXSProviderManagerImpl implements CXSProviderManager {
 
     private CXSGraphQLProvider cxsGraphQLProvider;
+    private GraphQLAnnotationsComponent annotationsComponent;
+    private ProcessingElementsContainer container;
     private ServiceRegistration<?> providerSR;
     private BundleContext bundleContext;
 
+    @Reference
+    public void setAnnotationsComponent(GraphQLAnnotationsComponent annotationsComponent) {
+        this.annotationsComponent = annotationsComponent;
+    }
+
     @Activate
     void activate(
             ComponentContext componentContext,
             BundleContext bundleContext,
             Map<String,Object> config) {
         this.bundleContext = bundleContext;
-        this.cxsGraphQLProvider = new CXSGraphQLProviderImpl();
+        this.cxsGraphQLProvider = new CXSGraphQLProviderImpl(annotationsComponent);
         this.cxsGraphQLProvider.setCxsProviderManager(this);
         providerSR = bundleContext.registerService(new String[] {
                 GraphQLQueryProvider.class.getName(),


[unomi] 03/27: UNOMI-180 Implement CXS GraphQL API - First implementation of registering event types. Not yet perfect but some parts are working.

Posted by sh...@apache.org.
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 82b5c13e322284f65f97a5a911ada8515890c437
Author: Serge Huber <sh...@apache.org>
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 <sh...@apache.org>
---
 .../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..0000000
--- 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<String> tags;
-    @GraphQLField
-    public List<String> 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 @@ package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 
-public class CXSDatePropertyTypeInput extends AbstractPropertyTypeInput {
+public class CXSDatePropertyType extends CXSPropertyType {
 
     @GraphQLField
     public String defaultValue;
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
index 43f04fb..a7c1c2c 100644
--- 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
@@ -17,10 +17,23 @@
 package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
+import graphql.annotations.annotationTypes.GraphQLName;
 
+import java.util.List;
+
+@GraphQLName("CXS_EventType")
 public class CXSEventType {
 
     @GraphQLField
     public String id;
 
+    @GraphQLField
+    public String scope;
+
+    @GraphQLField
+    public String typeName;
+
+    @GraphQLField
+    public List<CXSPropertyType> properties;
+
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSFloatPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSFloatPropertyType.java
similarity index 93%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSFloatPropertyTypeInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSFloatPropertyType.java
index 038f4a5..229b8db 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSFloatPropertyTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSFloatPropertyType.java
@@ -18,7 +18,7 @@ package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 
-public class CXSFloatPropertyTypeInput extends AbstractPropertyTypeInput{
+public class CXSFloatPropertyType extends CXSPropertyType {
 
     @GraphQLField
     public float minValue;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointPropertyType.java
similarity index 92%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointPropertyTypeInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointPropertyType.java
index c32def1..ce218c8 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointPropertyTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPointPropertyType.java
@@ -18,7 +18,7 @@ package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 
-public class CXSGeoPointPropertyTypeInput extends AbstractPropertyTypeInput {
+public class CXSGeoPointPropertyType extends CXSPropertyType {
 
     @GraphQLField
     public String defaultValue;
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 01f2636..ae444b9 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
@@ -18,4 +18,6 @@ package org.apache.unomi.graphql;
 
 public interface CXSGraphQLProvider {
 
+    void setCxsProviderManager(CXSProviderManager cxsProviderManager);
+
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSStringPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIdentifierPropertyType.java
similarity index 92%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSStringPropertyTypeInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIdentifierPropertyType.java
index c44496f..11f0742 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSStringPropertyTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIdentifierPropertyType.java
@@ -18,7 +18,7 @@ package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 
-public class CXSStringPropertyTypeInput extends AbstractPropertyTypeInput {
+public class CXSIdentifierPropertyType extends CXSPropertyType {
 
     @GraphQLField
     public String regexp;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIntPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIntPropertyType.java
similarity index 93%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIntPropertyTypeInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIntPropertyType.java
index f2dac72..c7c904f 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIntPropertyTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIntPropertyType.java
@@ -18,7 +18,7 @@ package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 
-public class CXSIntPropertyTypeInput extends AbstractPropertyTypeInput {
+public class CXSIntPropertyType extends CXSPropertyType {
 
     @GraphQLField
     public int minValue;
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyType.java
index a55a04b..641eff4 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyType.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyType.java
@@ -16,17 +16,25 @@
  */
 package org.apache.unomi.graphql;
 
-import java.util.LinkedHashSet;
-import java.util.Set;
+import graphql.annotations.annotationTypes.GraphQLField;
+
+import java.util.List;
 
 public class CXSPropertyType {
 
-    private String id;
-    private String name;
-    private int minOccurrences = 0;
-    private int maxOccurrences = 1;
-    private Set<String> tags = new LinkedHashSet<>();
-    private Set<String> systemTags = new LinkedHashSet<>();
-    private boolean personalData = false;
+    @GraphQLField
+    public String id;
+    @GraphQLField
+    public String name;
+    @GraphQLField
+    public int minOccurrences;
+    @GraphQLField
+    public int maxOccurrences;
+    @GraphQLField
+    public List<String> tags;
+    @GraphQLField
+    public List<String> systemTags;
+    @GraphQLField
+    public boolean personalData;
 
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java
index 60a1aa4..900cc4a 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyTypeInput.java
@@ -24,31 +24,31 @@ public class CXSPropertyTypeInput {
 
     @GraphQLField
     @GraphQLName("identifier")
-    public CXSIdentifierPropertyTypeInput identifierPropertyTypeInput;
+    public CXSIdentifierPropertyType identifierPropertyTypeInput;
 
     @GraphQLField
     @GraphQLName("string")
-    public CXSStringPropertyTypeInput stringPropertyTypeInput;
+    public CXSStringPropertyType stringPropertyTypeInput;
 
     @GraphQLField
     @GraphQLName("int")
-    public CXSIntPropertyTypeInput integer;
+    public CXSIntPropertyType integer;
 
     @GraphQLField
     @GraphQLName("float")
-    public CXSFloatPropertyTypeInput floatPropertyTypeInput;
+    public CXSFloatPropertyType floatPropertyTypeInput;
 
     @GraphQLField
     @GraphQLName("date")
-    public CXSDatePropertyTypeInput datePropertyTypeInput;
+    public CXSDatePropertyType datePropertyTypeInput;
 
     @GraphQLField
     @GraphQLName("boolean")
-    public CXSBooleanPropertyTypeInput booleanPropertyTypeInput;
+    public CXSBooleanPropertyType booleanPropertyTypeInput;
 
     @GraphQLField
     @GraphQLName("geopoint")
-    public CXSGeoPointPropertyTypeInput geoPointPropertyTypeInput;
+    public CXSGeoPointPropertyType geoPointPropertyTypeInput;
 
     @GraphQLField
     @GraphQLName("set")
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java
index a341a9f..18c7533 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java
@@ -16,55 +16,8 @@
  */
 package org.apache.unomi.graphql;
 
-import graphql.servlet.GraphQLMutationProvider;
-import graphql.servlet.GraphQLQueryProvider;
-import graphql.servlet.GraphQLTypesProvider;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.component.ComponentContext;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.component.annotations.Reference;
+public interface CXSProviderManager {
 
-import java.util.Map;
-
-@Component(
-        name="CXSProviderManager",
-        immediate = true
-)
-public class CXSProviderManager {
-
-    @Reference(name = "CXSGraphQLProvider")
-    private CXSGraphQLProvider cxsGraphQLProvider;
-    private ServiceRegistration<?> providerSR;
-    private BundleContext bundleContext;
-
-    @Activate
-    void activate(
-            ComponentContext componentContext,
-            BundleContext bundleContext,
-            Map<String,Object> config) {
-        this.bundleContext = bundleContext;
-    }
-
-    @Deactivate
-    void deactivate(
-            ComponentContext componentContext,
-            BundleContext bundleContext,
-            Map<String,Object> config) {
-    }
-
-    void refreshProviders() {
-        if (providerSR != null) {
-            providerSR.unregister();
-            providerSR = null;
-            providerSR = bundleContext.registerService(new String[] {
-                    GraphQLQueryProvider.class.getName(),
-                    GraphQLTypesProvider.class.getName(),
-                    GraphQLMutationProvider.class.getName()
-            }, cxsGraphQLProvider, null);
-        }
-    }
+    void refreshProviders();
 
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyType.java
similarity index 88%
copy from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java
copy to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyType.java
index 5db69dd..3c054ae 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyType.java
@@ -20,8 +20,8 @@ import graphql.annotations.annotationTypes.GraphQLField;
 
 import java.util.List;
 
-public class CXSSetPropertyTypeInput extends AbstractPropertyTypeInput {
+public class CXSSetPropertyType extends CXSPropertyType {
 
     @GraphQLField
-    public List<CXSPropertyTypeInput> properties;
+    public List<CXSPropertyType> properties;
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java
index 5db69dd..2f0de04 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSSetPropertyTypeInput.java
@@ -20,8 +20,9 @@ import graphql.annotations.annotationTypes.GraphQLField;
 
 import java.util.List;
 
-public class CXSSetPropertyTypeInput extends AbstractPropertyTypeInput {
+public class CXSSetPropertyTypeInput extends CXSPropertyType {
 
     @GraphQLField
     public List<CXSPropertyTypeInput> properties;
+
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIdentifierPropertyTypeInput.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSStringPropertyType.java
similarity index 92%
rename from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIdentifierPropertyTypeInput.java
rename to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSStringPropertyType.java
index 49869bc..2a4ef90 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSIdentifierPropertyTypeInput.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSStringPropertyType.java
@@ -18,7 +18,7 @@ package org.apache.unomi.graphql;
 
 import graphql.annotations.annotationTypes.GraphQLField;
 
-public class CXSIdentifierPropertyTypeInput extends AbstractPropertyTypeInput {
+public class CXSStringPropertyType extends CXSPropertyType {
 
     @GraphQLField
     public String regexp;
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 b9e876a..ea2043d 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
@@ -29,9 +29,9 @@ import graphql.servlet.GraphQLTypesProvider;
 import org.apache.unomi.graphql.*;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.component.ComponentContext;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
 import org.osgi.service.component.annotations.Deactivate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.*;
 
@@ -40,23 +40,24 @@ import static graphql.schema.GraphQLArgument.newArgument;
 import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
 import static graphql.schema.GraphQLObjectType.newObject;
 
-@Component(
-        name = "CXSGraphQLProvider",
-        immediate = true
-)
 public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryProvider, GraphQLTypesProvider, GraphQLMutationProvider {
 
+    private static final Logger logger = LoggerFactory.getLogger(CXSGraphQLProviderImpl.class.getName());
+
     private Map<String,GraphQLOutputType> registeredOutputTypes = new TreeMap<>();
     private Map<String,GraphQLInputType> registeredInputTypes = new TreeMap<>();
+    private CXSProviderManager cxsProviderManager;
 
-    @Activate
-    void activate(
-            ComponentContext cc,
-            BundleContext bc,
-            Map<String,Object> config) {
+    private Map<String,CXSEventType> eventTypes = new TreeMap<>();
 
+    public CXSGraphQLProviderImpl() {
+        updateGraphQLTypes();
+    }
+
+    private void updateGraphQLTypes() {
         registeredOutputTypes.put(CXSGeoPoint.class.getName(), GraphQLAnnotations.object(CXSGeoPoint.class));
-        registeredOutputTypes.put(CXSProperties.class.getName(), GraphQLAnnotations.object(CXSProperties.class));
+        registeredOutputTypes.put(CXSSetPropertyType.class.getName(), GraphQLAnnotations.object(CXSSetPropertyType.class));
+        registeredOutputTypes.put("CXS_EventProperties", buildCXSEventPropertiesOutputType());
         registeredOutputTypes.put(CXSEventType.class.getName(), GraphQLAnnotations.object(CXSEventType.class));
 
         GraphQLObjectInfoRetriever graphQLObjectInfoRetriever = new GraphQLObjectInfoRetriever();
@@ -79,6 +80,10 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
         registeredOutputTypes.clear();
     }
 
+    public void setCxsProviderManager(CXSProviderManager cxsProviderManager) {
+        this.cxsProviderManager = cxsProviderManager;
+    }
+
     @Override
     public Collection<GraphQLFieldDefinition> getQueries() {
         List<GraphQLFieldDefinition> fieldDefinitions = new ArrayList<GraphQLFieldDefinition>();
@@ -107,10 +112,11 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                 .type(registeredOutputTypes.get("CXS_Mutation"))
                 .name("cxs")
                 .description("Root field for all CXS mutation")
-                .dataFetcher(new DataFetcher() {
+                .dataFetcher(new DataFetcher<Object>() {
+                    @Override
                     public Object get(DataFetchingEnvironment environment) {
-                        Map<String,Object> map = environment.getContext();
-                        return map.keySet();
+                        Object contextObject = environment.getContext();
+                        return contextObject;
                     }
                 }).build());
         return fieldDefinitions;
@@ -125,6 +131,11 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                         .name("getEventTypes")
                         .description("Retrieves the list of all the declared CXS event types in the Apache Unomi server")
                 )
+                .field(newFieldDefinition()
+                        .type(new GraphQLList(registeredOutputTypes.get("CXS_Event")))
+                        .name("getEvent")
+                        .description("Retrieves a specific event")
+                )
                 .build();
     }
 
@@ -140,10 +151,99 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                                 .type(registeredInputTypes.get(CXSEventTypeInput.class.getName()))
                         )
                         .description("Create or updates a CXS event type in the Apache Unomi server")
+                        .dataFetcher(new DataFetcher<CXSEventType>() {
+                            @Override
+                            public CXSEventType get(DataFetchingEnvironment environment) {
+                                Map<String,Object> arguments = environment.getArguments();
+                                CXSEventType cxsEventType = new CXSEventType();
+                                if (arguments.containsKey("eventType")) {
+                                    Map<String,Object> eventTypeArguments = (Map<String,Object>) arguments.get("eventType");
+                                    if (eventTypeArguments.containsKey("typeName")) {
+                                        cxsEventType.id = (String) eventTypeArguments.get("typeName");
+                                        cxsEventType.typeName = (String) eventTypeArguments.get("typeName");
+                                    }
+                                    cxsEventType.properties = new ArrayList<>();
+                                    if (eventTypeArguments.containsKey("properties")) {
+                                        List<Map<String, Object>> properties = (List<Map<String, Object>>) eventTypeArguments.get("properties");
+                                        for (Map<String, Object> propertyTypeMap : properties) {
+                                            CXSPropertyType cxsPropertyType = getPropertyType(propertyTypeMap);
+                                            if (cxsPropertyType != null) {
+                                                cxsEventType.properties.add(cxsPropertyType);
+                                            }
+                                        }
+                                    }
+                                }
+                                eventTypes.put(cxsEventType.typeName, cxsEventType);
+                                updateGraphQLTypes();
+                                if (cxsProviderManager != null) {
+                                    cxsProviderManager.refreshProviders();
+                                }
+                                return cxsEventType;
+                            }
+                        })
                 )
                 .build();
     }
 
+    private CXSPropertyType getPropertyType(Map<String, Object> propertyTypeMap) {
+        if (propertyTypeMap.size() > 1) {
+            logger.error("Only one property type is allowed for each property !");
+            return null;
+        }
+        CXSPropertyType propertyType = null;
+        if (propertyTypeMap.containsKey("identifier")) {
+            propertyType = getIdentifierPropertyType(propertyTypeMap);
+        } else if (propertyTypeMap.containsKey("string")) {
+            propertyType = getStringPropertyType(propertyTypeMap);
+        } else if (propertyTypeMap.containsKey("set")) {
+            propertyType = getSetPropertyType(propertyTypeMap);
+        }
+        return propertyType;
+    }
+
+    private CXSPropertyType getSetPropertyType(Map<String, Object> propertyTypeMap) {
+        CXSSetPropertyType cxsSetPropertyType = new CXSSetPropertyType();
+        Map<String,Object> setPropertyTypeMap = (Map<String,Object>) propertyTypeMap.get("set");
+        populateCommonProperties(setPropertyTypeMap, cxsSetPropertyType);
+        if (propertyTypeMap.containsKey("properties")) {
+            List<Map<String,Object>> propertyList = (List<Map<String,Object>>) setPropertyTypeMap.get("properties");
+            List<CXSPropertyType> setProperties = new ArrayList<>();
+            for (Map<String,Object> setProperty : propertyList) {
+                CXSPropertyType subPropertyType = getPropertyType(setProperty);
+                if (subPropertyType != null) {
+                    setProperties.add(subPropertyType);
+                }
+            }
+            cxsSetPropertyType.properties = setProperties;
+        }
+        return cxsSetPropertyType;
+    }
+
+    private CXSPropertyType getStringPropertyType(Map<String, Object> propertyTypeMap) {
+        CXSStringPropertyType cxsStringPropertyType = new CXSStringPropertyType();
+        Map<String,Object> stringPropertyTypeMap = (Map<String,Object>) propertyTypeMap.get("string");
+        populateCommonProperties(stringPropertyTypeMap, cxsStringPropertyType);
+        return cxsStringPropertyType;
+    }
+
+    private CXSPropertyType getIdentifierPropertyType(Map<String, Object> propertyTypeMap) {
+        CXSIdentifierPropertyType cxsIdentifierPropertyType = new CXSIdentifierPropertyType();
+        Map<String,Object> identifierPropertyTypeMap = (Map<String,Object>) propertyTypeMap.get("identifier");
+        populateCommonProperties(identifierPropertyTypeMap, cxsIdentifierPropertyType);
+        return cxsIdentifierPropertyType;
+    }
+
+    private void populateCommonProperties(Map<String, Object> propertyTypeMap, CXSPropertyType cxsPropertyType) {
+        if (propertyTypeMap == null || propertyTypeMap.size() == 0) {
+            return;
+        }
+        if (propertyTypeMap.containsKey("id")) {
+            cxsPropertyType.id = (String) propertyTypeMap.get("id");
+        }
+        if (propertyTypeMap.containsKey("name")) {
+            cxsPropertyType.name = (String) propertyTypeMap.get("name");
+        }
+    }
 
     private GraphQLOutputType buildCXSEventOutputType() {
         return newObject()
@@ -214,7 +314,7 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                         })
                 )
                 .field(newFieldDefinition()
-                        .type(new GraphQLList(registeredOutputTypes.get(CXSProperties.class.getName())))
+                        .type(new GraphQLList(registeredOutputTypes.get("CXS_EventProperties")))
                         .name("properties")
                         .description("Generic properties for the event")
                         .dataFetcher(new DataFetcher() {
@@ -226,4 +326,29 @@ public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryP
                 )
                 .build();
     }
+
+    private GraphQLOutputType buildCXSEventPropertiesOutputType() {
+        GraphQLObjectType.Builder eventPropertiesOutputType = newObject()
+                .name("CXS_EventProperties")
+                .description("All possible properties of an event");
+
+        // we create a dummy field because GraphQL requires at least one
+        eventPropertiesOutputType.field(newFieldDefinition()
+                .type(GraphQLInt)
+                .name("typeCount")
+                .description("Total count of different field types")
+        );
+
+        for (Map.Entry<String,CXSEventType> cxsEventTypeEntry : eventTypes.entrySet()) {
+            CXSEventType cxsEventType = cxsEventTypeEntry.getValue();
+            eventPropertiesOutputType
+                    .field(newFieldDefinition()
+                            .type(registeredOutputTypes.get(CXSSetPropertyType.class.getName()))
+                            .name(cxsEventTypeEntry.getKey())
+                    );
+        }
+
+        return eventPropertiesOutputType.build();
+    }
+
 }
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSProviderManagerImpl.java
similarity index 74%
copy from graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java
copy to graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSProviderManagerImpl.java
index a341a9f..8b7b80a 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSProviderManagerImpl.java
@@ -14,18 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.unomi.graphql;
+package org.apache.unomi.graphql.internal;
 
 import graphql.servlet.GraphQLMutationProvider;
 import graphql.servlet.GraphQLQueryProvider;
 import graphql.servlet.GraphQLTypesProvider;
+import org.apache.unomi.graphql.CXSGraphQLProvider;
+import org.apache.unomi.graphql.CXSProviderManager;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.component.ComponentContext;
 import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
 import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.component.annotations.Reference;
 
 import java.util.Map;
 
@@ -33,9 +34,8 @@ import java.util.Map;
         name="CXSProviderManager",
         immediate = true
 )
-public class CXSProviderManager {
+public class CXSProviderManagerImpl implements CXSProviderManager {
 
-    @Reference(name = "CXSGraphQLProvider")
     private CXSGraphQLProvider cxsGraphQLProvider;
     private ServiceRegistration<?> providerSR;
     private BundleContext bundleContext;
@@ -46,6 +46,13 @@ public class CXSProviderManager {
             BundleContext bundleContext,
             Map<String,Object> config) {
         this.bundleContext = bundleContext;
+        this.cxsGraphQLProvider = new CXSGraphQLProviderImpl();
+        this.cxsGraphQLProvider.setCxsProviderManager(this);
+        providerSR = bundleContext.registerService(new String[] {
+                GraphQLQueryProvider.class.getName(),
+                GraphQLTypesProvider.class.getName(),
+                GraphQLMutationProvider.class.getName()
+        }, cxsGraphQLProvider, null);
     }
 
     @Deactivate
@@ -53,9 +60,12 @@ public class CXSProviderManager {
             ComponentContext componentContext,
             BundleContext bundleContext,
             Map<String,Object> config) {
+        providerSR.unregister();
+        cxsGraphQLProvider.setCxsProviderManager(null);
+        cxsGraphQLProvider = null;
     }
 
-    void refreshProviders() {
+    public void refreshProviders() {
         if (providerSR != null) {
             providerSR.unregister();
             providerSR = null;


[unomi] 13/27: UNOMI-180 Implement CXS GraphQL API - Update version numbers

Posted by sh...@apache.org.
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 2be33e43be33d350213c9e7d7b60555b79b0ba3f
Author: Serge Huber <sh...@apache.org>
AuthorDate: Wed Nov 21 20:21:37 2018 +0100

    UNOMI-180 Implement CXS GraphQL API
    - Update version numbers
    
    Signed-off-by: Serge Huber <sh...@apache.org>
---
 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 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-graphql</artifactId>
-        <version>1.3.0-incubating-SNAPSHOT</version>
+        <version>1.4.0-incubating-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
@@ -76,7 +76,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-api</artifactId>
-            <version>1.3.0-incubating-SNAPSHOT</version>
+            <version>1.4.0-incubating-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>
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 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-graphql</artifactId>
-        <version>1.3.0-incubating-SNAPSHOT</version>
+        <version>1.4.0-incubating-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <packaging>feature</packaging>
 
-    <artifactId>cxs-graphql-feature</artifactId>
+    <artifactId>cdp-graphql-feature</artifactId>
     <name>Apache Unomi :: GraphQL API :: Karaf Feature</name>
     <description>Apache Unomi Context GraphQL API Karaf Feature</description>
 
@@ -113,8 +113,8 @@
 
         <dependency>
             <groupId>org.apache.unomi</groupId>
-                <artifactId>cxs-graphql-api-impl</artifactId>
-            <version>1.3.0-incubating-SNAPSHOT</version>
+                <artifactId>cdp-graphql-api-impl</artifactId>
+            <version>1.4.0-incubating-SNAPSHOT</version>
         </dependency>
 
     </dependencies>
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 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-root</artifactId>
-        <version>1.3.0-incubating-SNAPSHOT</version>
+        <version>1.4.0-incubating-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-graphql</artifactId>