You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by dr...@apache.org on 2016/04/13 18:47:21 UTC

[1/2] incubator-unomi git commit: UNOMI-23 : Moved condtionTypes / actionTypes to persistence. Allows to create/update/remove new condition types with rest api. Updated exitsing condition/actions definitions

Repository: incubator-unomi
Updated Branches:
  refs/heads/master 358c4df04 -> ad73b222e


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/videoViewEventCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/videoViewEventCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/videoViewEventCondition.json
index 0828adc..cc74144 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/videoViewEventCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/videoViewEventCondition.json
@@ -1,5 +1,16 @@
 {
-  "id": "videoViewEventCondition",
+  "metadata": {
+    "id": "videoViewEventCondition",
+    "name": "videoViewEventCondition",
+    "description": "",
+    "tags": [
+      "event",
+      "eventCondition",
+      "usableInPastEventCondition",
+      "trackedCondition"
+    ],
+    "readOnly": true
+  },
   "parentCondition": {
     "type": "booleanCondition",
     "parameterValues": {
@@ -27,15 +38,9 @@
           }
         }
       ],
-      "operator" : "and"
+      "operator": "and"
     }
   },
-  "tags": [
-    "event",
-    "eventCondition",
-    "usableInPastEventCondition",
-    "trackedCondition"
-  ],
   "parameters": [
     {
       "id": "videoId",

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/hover-event/src/main/resources/META-INF/cxs/conditions/hoverEventCondition.json
----------------------------------------------------------------------
diff --git a/plugins/hover-event/src/main/resources/META-INF/cxs/conditions/hoverEventCondition.json b/plugins/hover-event/src/main/resources/META-INF/cxs/conditions/hoverEventCondition.json
index 50ade9a..711eb61 100644
--- a/plugins/hover-event/src/main/resources/META-INF/cxs/conditions/hoverEventCondition.json
+++ b/plugins/hover-event/src/main/resources/META-INF/cxs/conditions/hoverEventCondition.json
@@ -1,17 +1,26 @@
 {
+  "metadata": {
     "id": "hoverEventCondition",
-    "queryBuilder": "hoverEventConditionESQueryBuilder",
-    "tags": [ "event", "eventCondition", "usableInPastEventCondition" ],
-    "parameters": [
-        {
-            "id": "targetId",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "targetPath",
-            "type": "string",
-            "multivalued": false
-        }
-    ]
+    "name": "hoverEventCondition",
+    "description": "",
+    "tags": [
+      "event",
+      "eventCondition",
+      "usableInPastEventCondition"
+    ],
+    "readOnly": true
+  },
+  "queryBuilder": "hoverEventConditionESQueryBuilder",
+  "parameters": [
+    {
+      "id": "targetId",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "targetPath",
+      "type": "string",
+      "multivalued": false
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/mail/src/main/resources/META-INF/cxs/actions/sendMailAction.json
----------------------------------------------------------------------
diff --git a/plugins/mail/src/main/resources/META-INF/cxs/actions/sendMailAction.json b/plugins/mail/src/main/resources/META-INF/cxs/actions/sendMailAction.json
index 256ebff..c2c9152 100644
--- a/plugins/mail/src/main/resources/META-INF/cxs/actions/sendMailAction.json
+++ b/plugins/mail/src/main/resources/META-INF/cxs/actions/sendMailAction.json
@@ -1,39 +1,45 @@
 {
+  "metadata": {
     "id": "sendMailAction",
-    "actionExecutor": "sendMail",
-    "tags": [ "event" ],
-    "parameters": [
-        {
-            "id": "from",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "to",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "cc",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "bcc",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "subject",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "template",
-            "type": "string",
-            "multivalued": false,
-                    "defaultValue": "Hello $profile.properties.(\"j:firstName\")$ $profile.properties.(\"j:lastName\")$,\nHow are you doing today?"
-        }
-
-    ]
+    "name": "sendMailAction",
+    "description": "",
+    "tags": [
+      "event"
+    ],
+    "readOnly": true
+  },
+  "actionExecutor": "sendMail",
+  "parameters": [
+    {
+      "id": "from",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "to",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "cc",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "bcc",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "subject",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "template",
+      "type": "string",
+      "multivalued": false,
+      "defaultValue": "Hello $profile.properties.(\"j:firstName\")$ $profile.properties.(\"j:lastName\")$,\nHow are you doing today?"
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/request/src/main/resources/META-INF/cxs/actions/requestHeaderToProfilePropertyAction.json
----------------------------------------------------------------------
diff --git a/plugins/request/src/main/resources/META-INF/cxs/actions/requestHeaderToProfilePropertyAction.json b/plugins/request/src/main/resources/META-INF/cxs/actions/requestHeaderToProfilePropertyAction.json
index e00b989..adce6c9 100644
--- a/plugins/request/src/main/resources/META-INF/cxs/actions/requestHeaderToProfilePropertyAction.json
+++ b/plugins/request/src/main/resources/META-INF/cxs/actions/requestHeaderToProfilePropertyAction.json
@@ -1,28 +1,35 @@
 {
+  "metadata": {
     "id": "requestHeaderToProfilePropertyAction",
-    "actionExecutor": "requestHeaderToProfileProperty",
-    "tags": [ "event" ],
-    "parameters": [
-        {
-            "id": "requestHeaderName",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "profilePropertyName",
-            "type": "string",
-            "multivalued": false,
-            "choiceListInitializerFilter": "(initializerId=propertyType)"
-        },
-        {
-            "id": "sessionPropertyName",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "storeAsList",
-            "type": "boolean",
-            "multivalued": false
-        }
-    ]
+    "name": "requestHeaderToProfilePropertyAction",
+    "description": "",
+    "tags": [
+      "event"
+    ],
+    "readOnly": true
+  },
+  "actionExecutor": "requestHeaderToProfileProperty",
+  "parameters": [
+    {
+      "id": "requestHeaderName",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "profilePropertyName",
+      "type": "string",
+      "multivalued": false,
+      "choiceListInitializerFilter": "(initializerId=propertyType)"
+    },
+    {
+      "id": "sessionPropertyName",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "storeAsList",
+      "type": "boolean",
+      "multivalued": false
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/request/src/main/resources/META-INF/cxs/actions/requestParameterToProfilePropertyAction.json
----------------------------------------------------------------------
diff --git a/plugins/request/src/main/resources/META-INF/cxs/actions/requestParameterToProfilePropertyAction.json b/plugins/request/src/main/resources/META-INF/cxs/actions/requestParameterToProfilePropertyAction.json
index df5804d..740b041 100644
--- a/plugins/request/src/main/resources/META-INF/cxs/actions/requestParameterToProfilePropertyAction.json
+++ b/plugins/request/src/main/resources/META-INF/cxs/actions/requestParameterToProfilePropertyAction.json
@@ -1,28 +1,35 @@
 {
+  "metadata": {
     "id": "requestParameterToProfilePropertyAction",
-    "actionExecutor": "requestParameterToProfileProperty",
-    "tags": [ "event" ],
-    "parameters": [
-        {
-            "id": "requestParameterName",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "profilePropertyName",
-            "type": "string",
-            "multivalued": false,
-            "choiceListInitializerFilter": "(initializerId=propertyType)"
-        },
-        {
-            "id": "sessionPropertyName",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "storeAsList",
-            "type": "boolean",
-            "multivalued": false
-        }
-    ]
+    "name": "requestParameterToProfilePropertyAction",
+    "description": "",
+    "tags": [
+      "event"
+    ],
+    "readOnly": true
+  },
+  "actionExecutor": "requestParameterToProfileProperty",
+  "parameters": [
+    {
+      "id": "requestParameterName",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "profilePropertyName",
+      "type": "string",
+      "multivalued": false,
+      "choiceListInitializerFilter": "(initializerId=propertyType)"
+    },
+    {
+      "id": "sessionPropertyName",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "storeAsList",
+      "type": "boolean",
+      "multivalued": false
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/request/src/main/resources/META-INF/cxs/actions/setRemoteHostInfoAction.json
----------------------------------------------------------------------
diff --git a/plugins/request/src/main/resources/META-INF/cxs/actions/setRemoteHostInfoAction.json b/plugins/request/src/main/resources/META-INF/cxs/actions/setRemoteHostInfoAction.json
index d0b13ad..803b2e5 100644
--- a/plugins/request/src/main/resources/META-INF/cxs/actions/setRemoteHostInfoAction.json
+++ b/plugins/request/src/main/resources/META-INF/cxs/actions/setRemoteHostInfoAction.json
@@ -1,7 +1,14 @@
 {
+  "metadata": {
     "id": "setRemoteHostInfoAction",
-    "actionExecutor": "setRemoteHostInfo",
-    "tags": [ "event" ],
-    "parameters": [
-    ]
+    "name": "setRemoteHostInfoAction",
+    "description": "",
+    "tags": [
+      "event"
+    ],
+    "readOnly": true
+  },
+  "actionExecutor": "setRemoteHostInfo",
+  "parameters": [
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/rest/src/main/java/org/apache/unomi/rest/DefinitionsServiceEndPoint.java
----------------------------------------------------------------------
diff --git a/rest/src/main/java/org/apache/unomi/rest/DefinitionsServiceEndPoint.java b/rest/src/main/java/org/apache/unomi/rest/DefinitionsServiceEndPoint.java
index 1d504d3..365124c 100644
--- a/rest/src/main/java/org/apache/unomi/rest/DefinitionsServiceEndPoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/DefinitionsServiceEndPoint.java
@@ -143,6 +143,28 @@ public class DefinitionsServiceEndPoint {
     }
 
     /**
+     * Stores the condition type
+     *
+     * @param conditionType the condition type to store
+     */
+    @POST
+    @Path("/conditions")
+    public void setConditionType(ConditionType conditionType) {
+        definitionsService.setConditionType(conditionType);
+    }
+
+    /**
+     * Removes the condition type
+     *
+     * @param conditionTypeId the identifier of the action type to delete
+     */
+    @DELETE
+    @Path("/conditions/{conditionTypeId}")
+    public void removeConditionType(@PathParam("conditionTypeId") String conditionTypeId) {
+        definitionsService.removeConditionType(conditionTypeId);
+    }
+
+    /**
      * Retrieves all known action types localized using the specified language.
      *
      * @param language the language to use to localize.
@@ -189,6 +211,28 @@ public class DefinitionsServiceEndPoint {
     }
 
     /**
+     * Stores the action type
+     *
+     * @param actionType the action type to store
+     */
+    @POST
+    @Path("/actions")
+    public void setActionType(ActionType actionType) {
+        definitionsService.setActionType(actionType);
+    }
+
+    /**
+     * Removes the action type
+     *
+     * @param actionTypeId the identifier of the action type to delete
+     */
+    @DELETE
+    @Path("/actions/{actionTypeId}")
+    public void removeActionType(@PathParam("actionTypeId") String actionTypeId) {
+        definitionsService.removeActionType(actionTypeId);
+    }
+
+    /**
      * Retrieves all known value types localized using the specified language.
      *
      * @param language the language to use to localize.

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/rest/src/main/java/org/apache/unomi/rest/LocalizationHelper.java
----------------------------------------------------------------------
diff --git a/rest/src/main/java/org/apache/unomi/rest/LocalizationHelper.java b/rest/src/main/java/org/apache/unomi/rest/LocalizationHelper.java
index 55a4337..3052972 100644
--- a/rest/src/main/java/org/apache/unomi/rest/LocalizationHelper.java
+++ b/rest/src/main/java/org/apache/unomi/rest/LocalizationHelper.java
@@ -18,24 +18,19 @@
 package org.apache.unomi.rest;
 
 import org.apache.unomi.api.Parameter;
-import org.apache.unomi.api.PluginType;
 import org.apache.unomi.api.Tag;
 import org.apache.unomi.api.ValueType;
 import org.apache.unomi.api.actions.ActionType;
 import org.apache.unomi.api.conditions.ConditionType;
 import org.apache.unomi.api.conditions.initializers.ChoiceListInitializer;
 import org.apache.unomi.api.conditions.initializers.ChoiceListValue;
-import org.apache.unomi.api.conditions.initializers.I18nSupport;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.ResourceBundle;
+import java.util.*;
 
 /**
  * A helper class to provide localized versions of context server entities.
@@ -92,16 +87,15 @@ public class LocalizationHelper {
      */
     public RESTConditionType generateCondition(ConditionType conditionType, String language) {
         RESTConditionType result = new RESTConditionType();
-        result.setId(conditionType.getId());
+        result.setId(conditionType.getItemId());
 
-        ResourceBundle bundle = resourceBundleHelper.getResourceBundle(conditionType, language);
-        result.setName(resourceBundleHelper.getResourceBundleValue(bundle, conditionType.getNameKey()));
-        result.setDescription(resourceBundleHelper.getResourceBundleValue(bundle, conditionType.getDescriptionKey()));
+        result.setName(conditionType.getMetadata().getName());
+        result.setDescription(conditionType.getMetadata().getDescription());
 
-        result.setTags(conditionType.getTagIDs());
+        result.setTags(conditionType.getMetadata().getTags());
 
         for (Parameter parameter : conditionType.getParameters()) {
-            result.getParameters().add(generateParameter(parameter, bundle));
+            result.getParameters().add(generateParameter(parameter, language));
         }
 
         return result;
@@ -116,17 +110,16 @@ public class LocalizationHelper {
      */
     public RESTActionType generateAction(ActionType actionType, String language) {
         RESTActionType result = new RESTActionType();
-        result.setId(actionType.getId());
+        result.setId(actionType.getItemId());
 
-        ResourceBundle bundle = resourceBundleHelper.getResourceBundle(actionType, language);
-        result.setName(resourceBundleHelper.getResourceBundleValue(bundle, actionType.getNameKey()));
-        result.setDescription(resourceBundleHelper.getResourceBundleValue(bundle, actionType.getDescriptionKey()));
+        result.setName(actionType.getMetadata().getName());
+        result.setDescription(actionType.getMetadata().getDescription());
 
-        result.setTags(actionType.getTagIds());
+        result.setTags(actionType.getMetadata().getTags());
 
         List<RESTParameter> parameters = new ArrayList<RESTParameter>();
         for (Parameter parameter : actionType.getParameters()) {
-            parameters.add(generateParameter(parameter, bundle));
+            parameters.add(generateParameter(parameter, language));
         }
         result.setParameters(parameters);
 
@@ -137,44 +130,34 @@ public class LocalizationHelper {
      * Creates a {@link RESTParameter} based on the specified {@link Parameter} and localized using the specified {@link ResourceBundle}.
      *
      * @param parameter the {@link Parameter} to be localized
-     * @param bundle    the {@link ResourceBundle} used to localize the {@link Parameter}'s choice list values if needed
+     * @param language
      * @return a {@link RESTParameter} based on the specified {@link ActionType} and localized using the specified {@link ResourceBundle}
      */
-    public RESTParameter generateParameter(Parameter parameter, ResourceBundle bundle) {
+    public RESTParameter generateParameter(Parameter parameter, String language) {
         RESTParameter result = new RESTParameter();
         result.setId(parameter.getId());
         result.setDefaultValue(parameter.getDefaultValue());
         result.setMultivalued(parameter.isMultivalued());
         result.setType(parameter.getType());
-
-        localizeChoiceListValues(bundle, result.getChoiceListValues(), parameter.getChoiceListInitializerFilter());
+        result.setChoiceListValues(generateChoiceListValues(parameter.getChoiceListInitializerFilter(), language));
 
         return result;
     }
 
-    public void localizeChoiceListValues(ResourceBundle bundle, List<ChoiceListValue> result, String choiceListInitializerFilter) {
+    public List<ChoiceListValue> generateChoiceListValues(String choiceListInitializerFilter, String language) {
+        List<ChoiceListValue> result = new ArrayList<ChoiceListValue>();
         if (choiceListInitializerFilter != null && choiceListInitializerFilter.length() > 0) {
             try {
                 Collection<ServiceReference<ChoiceListInitializer>> matchingChoiceListInitializerReferences = bundleContext.getServiceReferences(ChoiceListInitializer.class, choiceListInitializerFilter);
                 for (ServiceReference<ChoiceListInitializer> choiceListInitializerReference : matchingChoiceListInitializerReferences) {
                     ChoiceListInitializer choiceListInitializer = bundleContext.getService(choiceListInitializerReference);
-                    List<ChoiceListValue> options = choiceListInitializer.getValues(bundle.getLocale());
-                    if (choiceListInitializer instanceof I18nSupport) {
-                        for (ChoiceListValue value : options) {
-                            if (value instanceof PluginType) {
-                                result.add(value.localizedCopy(resourceBundleHelper.getResourceBundleValue(resourceBundleHelper.getResourceBundle((PluginType) value, bundle.getLocale().getLanguage()), value.getName())));
-                            } else {
-                                result.add(value.localizedCopy(resourceBundleHelper.getResourceBundleValue(bundle, value.getName())));
-                            }
-                        }
-                    } else {
-                        result.addAll(options);
-                    }
+                    result.addAll(choiceListInitializer.getValues(null));
                 }
             } catch (InvalidSyntaxException e) {
                 logger.error("Invalid filter", e);
             }
         }
+        return result;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/samples/tweet-button-plugin/src/main/resources/META-INF/cxs/actions/incrementTweetNumberAction.json
----------------------------------------------------------------------
diff --git a/samples/tweet-button-plugin/src/main/resources/META-INF/cxs/actions/incrementTweetNumberAction.json b/samples/tweet-button-plugin/src/main/resources/META-INF/cxs/actions/incrementTweetNumberAction.json
index e65b644..473cda8 100644
--- a/samples/tweet-button-plugin/src/main/resources/META-INF/cxs/actions/incrementTweetNumberAction.json
+++ b/samples/tweet-button-plugin/src/main/resources/META-INF/cxs/actions/incrementTweetNumberAction.json
@@ -1,8 +1,13 @@
 {
-  "id": "incrementTweetNumberAction",
+  "metadata": {
+    "id": "incrementTweetNumberAction",
+    "name": "incrementTweetNumberAction",
+    "description": "",
+    "tags": [
+      "event"
+    ],
+    "readOnly": true
+  },
   "actionExecutor": "incrementTweetNumber",
-  "tags": [
-    "event"
-  ],
   "parameters": []
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/services/src/main/java/org/apache/unomi/services/conditions/initializers/ComparisonOperatorChoiceListInitializer.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/conditions/initializers/ComparisonOperatorChoiceListInitializer.java b/services/src/main/java/org/apache/unomi/services/conditions/initializers/ComparisonOperatorChoiceListInitializer.java
index 3d98548..467ecf8 100644
--- a/services/src/main/java/org/apache/unomi/services/conditions/initializers/ComparisonOperatorChoiceListInitializer.java
+++ b/services/src/main/java/org/apache/unomi/services/conditions/initializers/ComparisonOperatorChoiceListInitializer.java
@@ -19,7 +19,6 @@ package org.apache.unomi.services.conditions.initializers;
 
 import org.apache.unomi.api.conditions.initializers.ChoiceListInitializer;
 import org.apache.unomi.api.conditions.initializers.ChoiceListValue;
-import org.apache.unomi.api.conditions.initializers.I18nSupport;
 import org.osgi.framework.BundleContext;
 
 import java.util.ArrayList;
@@ -28,7 +27,7 @@ import java.util.List;
 /**
  * Initializer for the set of available comparison operators.
  */
-public class ComparisonOperatorChoiceListInitializer implements ChoiceListInitializer, I18nSupport {
+public class ComparisonOperatorChoiceListInitializer implements ChoiceListInitializer {
 
     private List<ChoiceListValue> operators;
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/services/src/main/java/org/apache/unomi/services/conditions/initializers/EventTypeIdChoiceListInitializer.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/conditions/initializers/EventTypeIdChoiceListInitializer.java b/services/src/main/java/org/apache/unomi/services/conditions/initializers/EventTypeIdChoiceListInitializer.java
index 005d19e..3076ff8 100644
--- a/services/src/main/java/org/apache/unomi/services/conditions/initializers/EventTypeIdChoiceListInitializer.java
+++ b/services/src/main/java/org/apache/unomi/services/conditions/initializers/EventTypeIdChoiceListInitializer.java
@@ -19,14 +19,13 @@ package org.apache.unomi.services.conditions.initializers;
 
 import org.apache.unomi.api.conditions.initializers.ChoiceListInitializer;
 import org.apache.unomi.api.conditions.initializers.ChoiceListValue;
-import org.apache.unomi.api.conditions.initializers.I18nSupport;
 import org.apache.unomi.api.services.EventService;
 
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 
-public class EventTypeIdChoiceListInitializer implements ChoiceListInitializer, I18nSupport {
+public class EventTypeIdChoiceListInitializer implements ChoiceListInitializer {
 
     EventService eventService;
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/services/src/main/java/org/apache/unomi/services/services/DefinitionsServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/DefinitionsServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/DefinitionsServiceImpl.java
index f4b39c2..7744652 100644
--- a/services/src/main/java/org/apache/unomi/services/services/DefinitionsServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/DefinitionsServiceImpl.java
@@ -26,6 +26,7 @@ import org.apache.unomi.api.conditions.Condition;
 import org.apache.unomi.api.conditions.ConditionType;
 import org.apache.unomi.api.services.DefinitionsService;
 import org.apache.unomi.persistence.spi.CustomObjectMapper;
+import org.apache.unomi.persistence.spi.PersistenceService;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
@@ -41,13 +42,13 @@ public class DefinitionsServiceImpl implements DefinitionsService, SynchronousBu
 
     private static final Logger logger = LoggerFactory.getLogger(DefinitionsServiceImpl.class.getName());
 
+    private PersistenceService persistenceService;
+
     private Map<String, Tag> tags = new HashMap<>();
     private Set<Tag> rootTags = new LinkedHashSet<>();
     private Map<String, ConditionType> conditionTypeById = new HashMap<>();
     private Map<String, ActionType> actionTypeById = new HashMap<>();
     private Map<String, ValueType> valueTypeById = new HashMap<>();
-    private Map<Tag, Set<ConditionType>> conditionTypeByTag = new HashMap<>();
-    private Map<Tag, Set<ActionType>> actionTypeByTag = new HashMap<>();
     private Map<Tag, Set<ValueType>> valueTypeByTag = new HashMap<>();
     private Map<Long, List<PluginType>> pluginTypes = new HashMap<>();
     private Map<String, PropertyMergeStrategyType> propertyMergeStrategyTypeById = new HashMap<>();
@@ -61,6 +62,10 @@ public class DefinitionsServiceImpl implements DefinitionsService, SynchronousBu
         this.bundleContext = bundleContext;
     }
 
+    public void setPersistenceService(PersistenceService persistenceService) {
+        this.persistenceService = persistenceService;
+    }
+
     public void postConstruct() {
         logger.debug("postConstruct {" + bundleContext.getBundle() + "}");
 
@@ -99,19 +104,7 @@ public class DefinitionsServiceImpl implements DefinitionsService, SynchronousBu
         List<PluginType> types = pluginTypes.get(bundleContext.getBundle().getBundleId());
         if (types != null) {
             for (PluginType type : types) {
-                if (type instanceof ActionType) {
-                    ActionType actionType = (ActionType) type;
-                    actionTypeById.remove(actionType.getId());
-                    for (Tag tag : actionType.getTags()) {
-                        actionTypeByTag.get(tag).remove(actionType);
-                    }
-                } else if (type instanceof ConditionType) {
-                    ConditionType conditionType = (ConditionType) type;
-                    conditionTypeById.remove(conditionType.getId());
-                    for (Tag tag : conditionType.getTags()) {
-                        conditionTypeByTag.get(tag).remove(conditionType);
-                    }
-                } else if (type instanceof ValueType) {
+                if (type instanceof ValueType) {
                     ValueType valueType = (ValueType) type;
                     valueTypeById.remove(valueType.getId());
                     for (Tag tag : valueType.getTags()) {
@@ -163,40 +156,18 @@ public class DefinitionsServiceImpl implements DefinitionsService, SynchronousBu
         if (predefinedConditionEntries == null) {
             return;
         }
-        ArrayList<PluginType> pluginTypeArrayList = (ArrayList<PluginType>) pluginTypes.get(bundleContext.getBundle().getBundleId());
+
         while (predefinedConditionEntries.hasMoreElements()) {
             URL predefinedConditionURL = predefinedConditionEntries.nextElement();
-            logger.debug("Found predefined conditions at " + predefinedConditionURL + ", loading... ");
+            logger.debug("Found predefined condition at " + predefinedConditionURL + ", loading... ");
 
             try {
                 ConditionType conditionType = CustomObjectMapper.getObjectMapper().readValue(predefinedConditionURL, ConditionType.class);
-                conditionType.setPluginId(bundleContext.getBundle().getBundleId());
-                conditionTypeById.put(conditionType.getId(), conditionType);
-                pluginTypeArrayList.add(conditionType);
-                for (String tagId : conditionType.getTagIDs()) {
-                    Tag tag = tags.get(tagId);
-                    if (tag != null) {
-                        conditionType.getTags().add(tag);
-                        Set<ConditionType> conditionTypes = conditionTypeByTag.get(tag);
-                        if (conditionTypes == null) {
-                            conditionTypes = new LinkedHashSet<ConditionType>();
-                        }
-                        conditionTypes.add(conditionType);
-                        conditionTypeByTag.put(tag, conditionTypes);
-                    } else {
-                        // we found a tag that is not defined, we will define it automatically
-                        logger.warn("Unknown tag " + tagId + " used in condition definition " + predefinedConditionURL);
-                    }
-                }
-            } catch (Exception e) {
+                setConditionType(conditionType);
+            } catch (IOException e) {
                 logger.error("Error while loading condition definition " + predefinedConditionURL, e);
             }
         }
-        for (ConditionType type : conditionTypeById.values()) {
-            if (type.getParentCondition() != null) {
-                ParserHelper.resolveConditionType(this, type.getParentCondition());
-            }
-        }
     }
 
     private void loadPredefinedActionTypes(BundleContext bundleContext) {
@@ -211,24 +182,7 @@ public class DefinitionsServiceImpl implements DefinitionsService, SynchronousBu
 
             try {
                 ActionType actionType = CustomObjectMapper.getObjectMapper().readValue(predefinedActionURL, ActionType.class);
-                actionType.setPluginId(bundleContext.getBundle().getBundleId());
-                actionTypeById.put(actionType.getId(), actionType);
-                pluginTypeArrayList.add(actionType);
-                for (String tagId : actionType.getTagIds()) {
-                    Tag tag = tags.get(tagId);
-                    if (tag != null) {
-                        actionType.getTags().add(tag);
-                        Set<ActionType> actionTypes = actionTypeByTag.get(tag);
-                        if (actionTypes == null) {
-                            actionTypes = new LinkedHashSet<>();
-                        }
-                        actionTypes.add(actionType);
-                        actionTypeByTag.put(tag, actionTypes);
-                    } else {
-                        // we found a tag that is not defined, we will define it automatically
-                        logger.warn("Unknown tag " + tagId + " used in action definition " + predefinedActionURL);
-                    }
-                }
+                setActionType(actionType);
             } catch (Exception e) {
                 logger.error("Error while loading action definition " + predefinedActionURL, e);
             }
@@ -289,20 +243,29 @@ public class DefinitionsServiceImpl implements DefinitionsService, SynchronousBu
         return completeTag;
     }
 
-    public Collection<ConditionType> getAllConditionTypes() {
-        return conditionTypeById.values();
-    }
-
     public Map<Long, List<PluginType>> getTypesByPlugin() {
         return pluginTypes;
     }
 
+    public Collection<ConditionType> getAllConditionTypes() {
+        Collection<ConditionType> all = persistenceService.getAllItems(ConditionType.class);
+        for (ConditionType type : all) {
+            if (type != null && type.getParentCondition() != null) {
+                ParserHelper.resolveConditionType(this, type.getParentCondition());
+            }
+        }
+        return all;
+    }
+
     public Set<ConditionType> getConditionTypesByTag(Tag tag, boolean includeFromSubtags) {
         Set<ConditionType> conditionTypes = new LinkedHashSet<ConditionType>();
-        Set<ConditionType> directConditionTypes = conditionTypeByTag.get(tag);
-        if (directConditionTypes != null) {
-            conditionTypes.addAll(directConditionTypes);
+        List<ConditionType> directConditionTypes = persistenceService.query("metadata.tags",tag.getId(),null, ConditionType.class);
+        for (ConditionType type : directConditionTypes) {
+            if (type.getParentCondition() != null) {
+                ParserHelper.resolveConditionType(this, type.getParentCondition());
+            }
         }
+        conditionTypes.addAll(directConditionTypes);
         if (includeFromSubtags) {
             for (Tag subTag : tag.getSubTags()) {
                 Set<ConditionType> childConditionTypes = getConditionTypesByTag(subTag, true);
@@ -313,19 +276,35 @@ public class DefinitionsServiceImpl implements DefinitionsService, SynchronousBu
     }
 
     public ConditionType getConditionType(String id) {
-        return conditionTypeById.get(id);
+        ConditionType type = conditionTypeById.get(id);
+        if (type == null) {
+            type = persistenceService.load(id, ConditionType.class);
+            conditionTypeById.put(id, type);
+        }
+        if (type != null && type.getParentCondition() != null) {
+            ParserHelper.resolveConditionType(this, type.getParentCondition());
+        }
+        return type;
+    }
+
+    public void removeConditionType(String id) {
+        persistenceService.remove(id, ConditionType.class);
+        conditionTypeById.remove(id);
+    }
+
+    public void setConditionType(ConditionType conditionType) {
+        conditionTypeById.put(conditionType.getMetadata().getId(), conditionType);
+        persistenceService.save(conditionType);
     }
 
     public Collection<ActionType> getAllActionTypes() {
-        return actionTypeById.values();
+        return persistenceService.getAllItems(ActionType.class);
     }
 
     public Set<ActionType> getActionTypeByTag(Tag tag, boolean includeFromSubtags) {
         Set<ActionType> actionTypes = new LinkedHashSet<ActionType>();
-        Set<ActionType> directActionTypes = actionTypeByTag.get(tag);
-        if (directActionTypes != null) {
-            actionTypes.addAll(directActionTypes);
-        }
+        List<ActionType> directActionTypes = persistenceService.query("metadata.tags",tag.getId(),null, ActionType.class);
+        actionTypes.addAll(directActionTypes);
         if (includeFromSubtags) {
             for (Tag subTag : tag.getSubTags()) {
                 Set<ActionType> childActionTypes = getActionTypeByTag(subTag, true);
@@ -336,7 +315,22 @@ public class DefinitionsServiceImpl implements DefinitionsService, SynchronousBu
     }
 
     public ActionType getActionType(String id) {
-        return actionTypeById.get(id);
+        ActionType type = actionTypeById.get(id);
+        if (type == null) {
+            type = persistenceService.load(id, ActionType.class);
+            actionTypeById.put(id, type);
+        }
+        return type;
+    }
+
+    public void removeActionType(String id) {
+        persistenceService.remove(id, ActionType.class);
+        actionTypeById.remove(id);
+    }
+
+    public void setActionType(ActionType actionType) {
+        actionTypeById.put(actionType.getMetadata().getId(), actionType);
+        persistenceService.save(actionType);
     }
 
     public Collection<ValueType> getAllValueTypes() {
@@ -442,7 +436,7 @@ public class DefinitionsServiceImpl implements DefinitionsService, SynchronousBu
                 }
             }
             throw new IllegalArgumentException();
-        } else if (rootCondition.getConditionType() != null && rootCondition.getConditionType().getTagIDs().contains(tagId)) {
+        } else if (rootCondition.getConditionType() != null && rootCondition.getConditionType().getMetadata().getTags().contains(tagId)) {
             return rootCondition;
         } else {
             return null;

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java
index d280f9a..65553fb 100644
--- a/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java
@@ -103,32 +103,6 @@ public class GoalsServiceImpl implements GoalsService, SynchronousBundleListener
     }
 
     private void processBundleStop(BundleContext bundleContext) {
-        if (bundleContext == null) {
-            return;
-        }
-        List<PluginType> types = definitionsService.getTypesByPlugin().get(bundleContext.getBundle().getBundleId());
-        List<String> removedConditions = new ArrayList<String>();
-        if (types != null) {
-            for (PluginType type : types) {
-                if (type instanceof ConditionType) {
-                    removedConditions.add(((ConditionType) type).getId());
-                }
-            }
-        }
-        if (!removedConditions.isEmpty()) {
-            for (Goal goal : persistenceService.getAllItems(Goal.class)) {
-                List<String> conditions = ParserHelper.getConditionTypeIds(goal.getTargetEvent());
-                if (goal.getStartEvent() != null) {
-                    conditions.addAll(ParserHelper.getConditionTypeIds(goal.getStartEvent()));
-                }
-
-                if (!Collections.disjoint(conditions, removedConditions)) {
-                    logger.info("Disable goal " + goal.getItemId());
-                    goal.getMetadata().setEnabled(false);
-                    setGoal(goal);
-                }
-            }
-        }
     }
 
     private void loadPredefinedGoals(BundleContext bundleContext) {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java
index aa25111..722c55c 100644
--- a/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java
@@ -118,29 +118,6 @@ public class RulesServiceImpl implements RulesService, EventListenerService, Syn
         }
         loadPredefinedRules(bundleContext);
 
-        List<PluginType> types = definitionsService.getTypesByPlugin().get(bundleContext.getBundle().getBundleId());
-        List<String> addedConditions = new ArrayList<String>();
-        List<String> addedActions = new ArrayList<String>();
-        if (types != null) {
-            for (PluginType type : types) {
-                if (type instanceof ConditionType) {
-                    addedConditions.add(((ConditionType) type).getId());
-                } else if (type instanceof ActionType) {
-                    addedActions.add(((ActionType) type).getId());
-                }
-            }
-        }
-        if (!addedConditions.isEmpty() || !addedActions.isEmpty()) {
-            for (Rule rule : persistenceService.query("missingPlugins", "true", null, Rule.class)) {
-                boolean succeed = ParserHelper.resolveConditionType(definitionsService, rule.getCondition()) &&
-                        ParserHelper.resolveActionTypes(definitionsService, rule.getActions());
-                if (succeed) {
-                    logger.info("Enable rule " + rule.getItemId());
-                    rule.getMetadata().setMissingPlugins(false);
-                    setRule(rule);
-                }
-            }
-        }
         if (bundleContext.getBundle().getRegisteredServices() != null) {
             for (ServiceReference<?> reference : bundleContext.getBundle().getRegisteredServices()) {
                 Object service = bundleContext.getService(reference);
@@ -155,32 +132,6 @@ public class RulesServiceImpl implements RulesService, EventListenerService, Syn
         if (bundleContext == null) {
             return;
         }
-        List<PluginType> types = definitionsService.getTypesByPlugin().get(bundleContext.getBundle().getBundleId());
-        List<String> removedConditions = new ArrayList<String>();
-        List<String> removedActions = new ArrayList<String>();
-        if (types != null) {
-            for (PluginType type : types) {
-                if (type instanceof ConditionType) {
-                    removedConditions.add(((ConditionType) type).getId());
-                } else if (type instanceof ActionType) {
-                    removedActions.add(((ActionType) type).getId());
-                }
-            }
-        }
-        if (!removedConditions.isEmpty() || !removedActions.isEmpty()) {
-            for (Rule rule : persistenceService.getAllItems(Rule.class)) {
-                List<String> conditions = ParserHelper.getConditionTypeIds(rule.getCondition());
-                List<String> actions = new ArrayList<String>();
-                for (Action action : rule.getActions()) {
-                    actions.add(action.getActionTypeId());
-                }
-                if (!Collections.disjoint(conditions, removedConditions) || !Collections.disjoint(actions, removedActions)) {
-                    logger.info("Disable rule " + rule.getItemId());
-                    rule.getMetadata().setMissingPlugins(true);
-                    setRule(rule);
-                }
-            }
-        }
         actionExecutorDispatcher.removeExecutors(bundleContext.getBundle().getBundleId());
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
index e74995b..4efbec4 100644
--- a/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
@@ -148,51 +148,12 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
         }
         loadPredefinedSegments(bundleContext);
         loadPredefinedScorings(bundleContext);
-
-        List<PluginType> types = definitionsService.getTypesByPlugin().get(bundleContext.getBundle().getBundleId());
-        List<String> addedConditions = new ArrayList<String>();
-        if (types != null) {
-            for (PluginType type : types) {
-                if (type instanceof ConditionType) {
-                    addedConditions.add(((ConditionType) type).getId());
-                }
-            }
-        }
-        if (!addedConditions.isEmpty()) {
-            for (Segment segment : persistenceService.query("missingPlugins", "true", null, Segment.class)) {
-                boolean succeed = ParserHelper.resolveConditionType(definitionsService, segment.getCondition());
-                if (succeed) {
-                    logger.info("Enable segment " + segment.getItemId());
-                    segment.getMetadata().setMissingPlugins(false);
-                    setSegmentDefinition(segment);
-                }
-            }
-        }
     }
 
     private void processBundleStop(BundleContext bundleContext) {
         if (bundleContext == null) {
             return;
         }
-        List<PluginType> types = definitionsService.getTypesByPlugin().get(bundleContext.getBundle().getBundleId());
-        List<String> removedConditions = new ArrayList<String>();
-        if (types != null) {
-            for (PluginType type : types) {
-                if (type instanceof ConditionType) {
-                    removedConditions.add(((ConditionType) type).getId());
-                }
-            }
-        }
-        if (!removedConditions.isEmpty()) {
-            for (Segment segment : persistenceService.getAllItems(Segment.class)) {
-                List<String> conditions = ParserHelper.getConditionTypeIds(segment.getCondition());
-                if (!Collections.disjoint(conditions, removedConditions)) {
-                    logger.info("Disable segment " + segment.getItemId());
-                    segment.getMetadata().setMissingPlugins(true);
-                    setSegmentDefinition(segment);
-                }
-            }
-        }
     }
 
     private void loadPredefinedSegments(BundleContext bundleContext) {
@@ -563,7 +524,8 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
     }
 
     private void getAutoGeneratedRules(Metadata metadata, Condition condition, Condition parentCondition, List<Rule> rules) {
-        if (condition.getConditionType().getTagIDs().contains("eventCondition") && !condition.getConditionType().getTagIDs().contains("profileCondition")) {
+        Set<String> tags = condition.getConditionType().getMetadata().getTags();
+        if (tags.contains("eventCondition") && !tags.contains("profileCondition")) {
             try {
                 Map<String,Object> m = new HashMap<>(3);
                 m.put("scope",metadata.getScope());

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 2af329c..ef28738 100644
--- a/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -40,6 +40,7 @@
 
     <bean id="definitionsServiceImpl" class="org.apache.unomi.services.services.DefinitionsServiceImpl"
           init-method="postConstruct" destroy-method="preDestroy">
+        <property name="persistenceService" ref="persistenceService"/>
         <property name="bundleContext" ref="blueprintBundleContext"/>
     </bean>
     <service id="definitionsService" ref="definitionsServiceImpl" auto-export="interfaces"/>



[2/2] incubator-unomi git commit: UNOMI-23 : Moved condtionTypes / actionTypes to persistence. Allows to create/update/remove new condition types with rest api. Updated exitsing condition/actions definitions

Posted by dr...@apache.org.
UNOMI-23 : Moved condtionTypes / actionTypes to persistence. Allows to create/update/remove new condition types with rest api. Updated exitsing condition/actions definitions


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/ad73b222
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/ad73b222
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/ad73b222

Branch: refs/heads/master
Commit: ad73b222ea7f068ab4a71804e0dfe08042796c0d
Parents: 358c4df
Author: Thomas Draier <dr...@apache.org>
Authored: Wed Apr 13 18:47:10 2016 +0200
Committer: Thomas Draier <dr...@apache.org>
Committed: Wed Apr 13 18:47:10 2016 +0200

----------------------------------------------------------------------
 .../org/apache/unomi/api/actions/Action.java    |   2 +-
 .../apache/unomi/api/actions/ActionType.java    | 126 ++--------------
 .../apache/unomi/api/conditions/Condition.java  |   2 +-
 .../unomi/api/conditions/ConditionType.java     | 147 ++-----------------
 .../conditions/initializers/I18nSupport.java    |  27 ----
 .../unomi/api/services/DefinitionsService.java  |  28 ++++
 .../META-INF/cxs/mappings/actionType.json       |  16 ++
 .../META-INF/cxs/mappings/conditionType.json    |  16 ++
 .../persistence/spi/CustomObjectMapper.java     |  30 ++--
 .../allEventToProfilePropertiesAction.json      |  15 +-
 .../cxs/actions/evaluateProfileAgeAction.json   |  15 +-
 .../actions/evaluateProfileSegmentsAction.json  |  15 +-
 .../actions/eventToProfilePropertyAction.json   |  39 +++--
 .../actions/incrementInterestValuesAction.json  |  16 +-
 .../actions/mergeProfilesOnPropertyAction.json  |  27 ++--
 .../META-INF/cxs/actions/sendEventAction.json   |  35 +++--
 .../actions/setEventOccurenceCountAction.json   |  25 ++--
 .../META-INF/cxs/actions/setPropertyAction.json |  65 ++++----
 .../cxs/conditions/booleanCondition.json        |  43 ++++--
 .../cxs/conditions/downloadEventCondition.json  |  66 +++++----
 .../cxs/conditions/eventPropertyCondition.json  | 123 +++++++++-------
 .../cxs/conditions/eventTypeCondition.json      |  42 +++---
 .../cxs/conditions/formEventCondition.json      |  21 ++-
 .../geoLocationByPointSessionCondition.json     |  99 +++++++------
 .../conditions/geoLocationSessionCondition.json |  40 +++--
 .../cxs/conditions/goalMatchCondition.json      |  41 ++++--
 .../cxs/conditions/loginEventCondition.json     |  27 ++--
 .../cxs/conditions/matchAllCondition.json       |  22 ++-
 .../cxs/conditions/newVisitorCondition.json     |  19 ++-
 .../META-INF/cxs/conditions/notCondition.json   |  16 +-
 .../cxs/conditions/pageViewEventCondition.json  |  93 ++++++------
 .../cxs/conditions/pastEventCondition.json      |  59 ++++----
 .../conditions/profileInterestCondition.json    |  49 ++++---
 .../conditions/profilePropertyCondition.json    | 120 ++++++++-------
 .../cxs/conditions/profileSegmentCondition.json |  51 ++++---
 .../profileUpdatedEventCondition.json           |  27 ++--
 .../conditions/returningVisitorCondition.json   |  18 ++-
 .../sessionCreatedEventCondition.json           |  26 ++--
 .../conditions/sessionDurationCondition.json    |  55 ++++---
 .../conditions/sessionPropertyCondition.json    | 120 ++++++++-------
 .../sourceEventPropertyCondition.json           |  58 ++++----
 .../cxs/conditions/videoViewEventCondition.json |  21 ++-
 .../cxs/conditions/hoverEventCondition.json     |  37 +++--
 .../META-INF/cxs/actions/sendMailAction.json    |  78 +++++-----
 .../requestHeaderToProfilePropertyAction.json   |  57 +++----
 ...requestParameterToProfilePropertyAction.json |  57 +++----
 .../cxs/actions/setRemoteHostInfoAction.json    |  15 +-
 .../unomi/rest/DefinitionsServiceEndPoint.java  |  44 ++++++
 .../apache/unomi/rest/LocalizationHelper.java   |  53 +++----
 .../cxs/actions/incrementTweetNumberAction.json |  13 +-
 ...ComparisonOperatorChoiceListInitializer.java |   3 +-
 .../EventTypeIdChoiceListInitializer.java       |   3 +-
 .../services/DefinitionsServiceImpl.java        | 142 +++++++++---------
 .../services/services/GoalsServiceImpl.java     |  26 ----
 .../services/services/RulesServiceImpl.java     |  49 -------
 .../services/services/SegmentServiceImpl.java   |  42 +-----
 .../resources/OSGI-INF/blueprint/blueprint.xml  |   1 +
 57 files changed, 1274 insertions(+), 1248 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/api/src/main/java/org/apache/unomi/api/actions/Action.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/actions/Action.java b/api/src/main/java/org/apache/unomi/api/actions/Action.java
index 573679c..a66eda6 100644
--- a/api/src/main/java/org/apache/unomi/api/actions/Action.java
+++ b/api/src/main/java/org/apache/unomi/api/actions/Action.java
@@ -67,7 +67,7 @@ public class Action {
      */
     public void setActionType(ActionType actionType) {
         this.actionType = actionType;
-        this.actionTypeId = actionType.getId();
+        this.actionTypeId = actionType.getItemId();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/api/src/main/java/org/apache/unomi/api/actions/ActionType.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/actions/ActionType.java b/api/src/main/java/org/apache/unomi/api/actions/ActionType.java
index ca02623..941e917 100644
--- a/api/src/main/java/org/apache/unomi/api/actions/ActionType.java
+++ b/api/src/main/java/org/apache/unomi/api/actions/ActionType.java
@@ -17,9 +17,7 @@
 
 package org.apache.unomi.api.actions;
 
-import org.apache.unomi.api.Parameter;
-import org.apache.unomi.api.PluginType;
-import org.apache.unomi.api.Tag;
+import org.apache.unomi.api.*;
 
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlTransient;
@@ -29,16 +27,11 @@ import java.util.*;
 /**
  * A type definition for {@link Action}s.
  */
-public class ActionType implements PluginType, Serializable {
+public class ActionType extends MetadataItem {
+    public static final String ITEM_TYPE = "actionType";
 
-    private static final long serialVersionUID = -3522958600710010934L;
-    private String id;
-    private String nameKey;
-    private String descriptionKey;
+    private static final long serialVersionUID = -3522958600710010935L;
     private String actionExecutor;
-    private Set<Tag> tags = new TreeSet<Tag>();
-    private Set<String> tagIds = new LinkedHashSet<String>();
-    private long pluginId;
     private List<Parameter> parameters = new ArrayList<Parameter>();
 
     /**
@@ -49,73 +42,9 @@ public class ActionType implements PluginType, Serializable {
 
     /**
      * Instantiates a new Action type.
-     *
-     * @param id      the id
-     * @param nameKey the name key
-     */
-    public ActionType(String id, String nameKey) {
-        this.id = id;
-        this.nameKey = nameKey;
-    }
-
-    /**
-     * Retrieves the id.
-     *
-     * @return the id
-     */
-    public String getId() {
-        return id;
-    }
-
-    /**
-     * Retrieves the {@link java.util.ResourceBundle} key used to localize this ActionType's name.
-     *
-     * @return the {@link java.util.ResourceBundle} key used to localize this ActionType's name
-     */
-    public String getNameKey() {
-        if (nameKey == null) {
-            nameKey = "action." + id + ".name";
-        }
-        return nameKey;
-    }
-
-    /**
-     * Sets the name key.
-     *
-     * @param nameKey the name key
      */
-    public void setNameKey(String nameKey) {
-        this.nameKey = nameKey;
-    }
-
-    /**
-     * Retrieves the {@link java.util.ResourceBundle} key used to localize this ActionType's description.
-     *
-     * @return the {@link java.util.ResourceBundle} key used to localize this ActionType's name
-     */
-    public String getDescriptionKey() {
-        if (descriptionKey == null) {
-            descriptionKey = "action." + id + ".description";
-        }
-        return descriptionKey;
-    }
-
-    /**
-     * Sets the description key.
-     *
-     * @param descriptionKey the description key
-     */
-    public void setDescriptionKey(String descriptionKey) {
-        this.descriptionKey = descriptionKey;
-    }
-
-    @XmlTransient
-    public long getPluginId() {
-        return pluginId;
-    }
-
-    public void setPluginId(long pluginId) {
-        this.pluginId = pluginId;
+    public ActionType(Metadata metadata) {
+        super(metadata);
     }
 
     /**
@@ -137,44 +66,6 @@ public class ActionType implements PluginType, Serializable {
     }
 
     /**
-     * Retrieves the tags used by this ActionType.
-     *
-     * @return the tags used by this ActionType
-     */
-    @XmlTransient
-    public Set<Tag> getTags() {
-        return tags;
-    }
-
-    /**
-     * Sets the tags used by this ActionType.
-     *
-     * @param tags the tags used by this ActionType
-     */
-    public void setTags(Set<Tag> tags) {
-        this.tags = tags;
-    }
-
-    /**
-     * Retrieves the identifiers of the tags used by this ActionType.
-     *
-     * @return the identifiers of the tags used by this ActionType
-     */
-    @XmlElement(name = "tags")
-    public Set<String> getTagIds() {
-        return tagIds;
-    }
-
-    /**
-     * Sets the identifiers of the tags used by this ActionType.
-     *
-     * @param tagIds the identifiers of the tags used by this ActionType
-     */
-    public void setTagIds(Set<String> tagIds) {
-        this.tagIds = tagIds;
-    }
-
-    /**
      * Retrieves the parameters.
      *
      * @return the parameters
@@ -193,6 +84,7 @@ public class ActionType implements PluginType, Serializable {
     }
 
 
+
     @Override
     public boolean equals(Object o) {
         if (this == o) return true;
@@ -200,12 +92,12 @@ public class ActionType implements PluginType, Serializable {
 
         ActionType that = (ActionType) o;
 
-        return id.equals(that.id);
+        return itemId.equals(that.itemId);
 
     }
 
     @Override
     public int hashCode() {
-        return id.hashCode();
+        return itemId.hashCode();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/api/src/main/java/org/apache/unomi/api/conditions/Condition.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/conditions/Condition.java b/api/src/main/java/org/apache/unomi/api/conditions/Condition.java
index ca3646d..2165f0f 100644
--- a/api/src/main/java/org/apache/unomi/api/conditions/Condition.java
+++ b/api/src/main/java/org/apache/unomi/api/conditions/Condition.java
@@ -65,7 +65,7 @@ public class Condition {
      */
     public void setConditionType(ConditionType conditionType) {
         this.conditionType = conditionType;
-        this.conditionTypeId = conditionType.getId();
+        this.conditionTypeId = conditionType.getItemId();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/api/src/main/java/org/apache/unomi/api/conditions/ConditionType.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/conditions/ConditionType.java b/api/src/main/java/org/apache/unomi/api/conditions/ConditionType.java
index b824af4..b2351c9 100644
--- a/api/src/main/java/org/apache/unomi/api/conditions/ConditionType.java
+++ b/api/src/main/java/org/apache/unomi/api/conditions/ConditionType.java
@@ -17,9 +17,7 @@
 
 package org.apache.unomi.api.conditions;
 
-import org.apache.unomi.api.Parameter;
-import org.apache.unomi.api.PluginType;
-import org.apache.unomi.api.Tag;
+import org.apache.unomi.api.*;
 import org.apache.unomi.api.rules.Rule;
 
 import javax.xml.bind.annotation.XmlElement;
@@ -35,19 +33,14 @@ import java.util.*;
  * parameters may test whether a given property has a specific value: “User property x has value y”.
  */
 @XmlRootElement
-public class ConditionType implements PluginType, Serializable {
-    private static final long serialVersionUID = -6965481691241954968L;
-    private String id;
-    private String nameKey;
-    private String descriptionKey;
-    private long pluginId;
+public class ConditionType extends MetadataItem  {
+    public static final String ITEM_TYPE = "conditionType";
+
+    private static final long serialVersionUID = -6965481691241954969L;
     private String conditionEvaluator;
     private String queryBuilder;
     private Condition parentCondition;
-    private Set<Tag> tags = new TreeSet<Tag>();
-    private Set<String> tagIDs = new LinkedHashSet<String>();
     private List<Parameter> parameters = new ArrayList<Parameter>();
-    private Rule autoCreateRule;
 
     /**
      * Instantiates a new Condition type.
@@ -56,74 +49,10 @@ public class ConditionType implements PluginType, Serializable {
     }
 
     /**
-     * Instantiates a new Condition type with the specified identifier and .
-     *
-     * @param id      the id
-     * @param nameKey the name key
-     */
-    public ConditionType(String id, String nameKey) {
-        this.id = id;
-        this.nameKey = nameKey;
-    }
-
-    /**
-     * Retrieves the id.
-     *
-     * @return the id
-     */
-    public String getId() {
-        return id;
-    }
-
-    /**
-     * Retrieves the name key.
-     *
-     * @return the name key
+     * Instantiates a new Condition type with the specified metadata
      */
-    public String getNameKey() {
-        if (nameKey == null) {
-            nameKey = "condition." + id + ".name";
-        }
-        return nameKey;
-    }
-
-    /**
-     * Sets the name key.
-     *
-     * @param nameKey the name key
-     */
-    public void setNameKey(String nameKey) {
-        this.nameKey = nameKey;
-    }
-
-    /**
-     * Retrieves the description key.
-     *
-     * @return the description key
-     */
-    public String getDescriptionKey() {
-        if (descriptionKey == null) {
-            descriptionKey = "condition." + id + ".description";
-        }
-        return descriptionKey;
-    }
-
-    /**
-     * Sets the description key.
-     *
-     * @param descriptionKey the description key
-     */
-    public void setDescriptionKey(String descriptionKey) {
-        this.descriptionKey = descriptionKey;
-    }
-
-    @XmlTransient
-    public long getPluginId() {
-        return pluginId;
-    }
-
-    public void setPluginId(long pluginId) {
-        this.pluginId = pluginId;
+    public ConditionType(Metadata metadata) {
+        super(metadata);
     }
 
     /**
@@ -181,44 +110,6 @@ public class ConditionType implements PluginType, Serializable {
     }
 
     /**
-     * Retrieves the tags used by this PropertyType.
-     *
-     * @return the tags used by this PropertyType
-     */
-    @XmlTransient
-    public Set<Tag> getTags() {
-        return tags;
-    }
-
-    /**
-     * Sets the tags used by this PropertyType.
-     *
-     * @param tags the tags used by this PropertyType
-     */
-    public void setTags(Set<Tag> tags) {
-        this.tags = tags;
-    }
-
-    /**
-     * Retrieves the identifiers of the tags used by this PropertyType.
-     *
-     * @return the identifiers of the tags used by this PropertyType
-     */
-    @XmlElement(name = "tags")
-    public Set<String> getTagIDs() {
-        return tagIDs;
-    }
-
-    /**
-     * Sets the identifiers of the tags used by this PropertyType.
-     *
-     * @param tagIds the identifiers of the tags used by this PropertyType
-     */
-    public void setTagIDs(Set<String> tagIds) {
-        this.tagIDs = tagIds;
-    }
-
-    /**
      * Retrieves the defined {@link Parameter}s for this ConditionType.
      *
      * @return a List of the defined {@link Parameter}s for this ConditionType
@@ -237,24 +128,6 @@ public class ConditionType implements PluginType, Serializable {
         this.parameters = parameters;
     }
 
-    /**
-     * Retrieves the auto create rule.
-     *
-     * @return the auto create rule
-     */
-    public Rule getAutoCreateRule() {
-        return autoCreateRule;
-    }
-
-    /**
-     * Sets the auto create rule.
-     *
-     * @param autoCreateRule the auto create rule
-     */
-    public void setAutoCreateRule(Rule autoCreateRule) {
-        this.autoCreateRule = autoCreateRule;
-    }
-
     @Override
     public boolean equals(Object o) {
         if (this == o) return true;
@@ -262,12 +135,12 @@ public class ConditionType implements PluginType, Serializable {
 
         ConditionType that = (ConditionType) o;
 
-        return id.equals(that.id);
+        return itemId.equals(that.itemId);
 
     }
 
     @Override
     public int hashCode() {
-        return id.hashCode();
+        return itemId.hashCode();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/api/src/main/java/org/apache/unomi/api/conditions/initializers/I18nSupport.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/conditions/initializers/I18nSupport.java b/api/src/main/java/org/apache/unomi/api/conditions/initializers/I18nSupport.java
deleted file mode 100644
index 2807461..0000000
--- a/api/src/main/java/org/apache/unomi/api/conditions/initializers/I18nSupport.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.api.conditions.initializers;
-
-/**
- * Marker interface implemented by a {@link ChoiceListInitializer} to indicate that its values have to be localized for rendering.
- *
- * @author Sergiy Shyrkov
- */
-public interface I18nSupport {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java b/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java
index 2f23e3e..efd446f 100644
--- a/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java
@@ -81,6 +81,20 @@ public interface DefinitionsService {
     ConditionType getConditionType(String id);
 
     /**
+     * Stores the condition type
+     *
+     * @param conditionType the condition type to store
+     */
+    void setConditionType(ConditionType conditionType);
+
+    /**
+     * Remove the condition type
+     *
+     * @param id the condition type to remove
+     */
+    void removeConditionType(String id);
+
+    /**
      * Retrieves all known action types.
      *
      * @return all known action types
@@ -105,6 +119,20 @@ public interface DefinitionsService {
     ActionType getActionType(String id);
 
     /**
+     * Stores the action type
+     *
+     * @param actionType the action type to store
+     */
+    void setActionType(ActionType actionType);
+
+    /**
+     * Remove the action type
+     *
+     * @param id the action type to remove
+     */
+    void removeActionType(String id);
+
+    /**
      * Retrieves all known value types.
      *
      * @return all known value types

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/actionType.json
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/actionType.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/actionType.json
new file mode 100644
index 0000000..9470350
--- /dev/null
+++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/actionType.json
@@ -0,0 +1,16 @@
+{
+  "actionType": {
+    "dynamic_templates": [
+      {
+        "all": {
+          "match": "*",
+          "match_mapping_type": "string",
+          "mapping": {
+            "type": "string",
+            "analyzer": "folding"
+          }
+        }
+      }
+    ]
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/conditionType.json
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/conditionType.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/conditionType.json
new file mode 100644
index 0000000..73ecac9
--- /dev/null
+++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/conditionType.json
@@ -0,0 +1,16 @@
+{
+  "conditionType": {
+    "dynamic_templates": [
+      {
+        "all": {
+          "match": "*",
+          "match_mapping_type": "string",
+          "mapping": {
+            "type": "string",
+            "analyzer": "folding"
+          }
+        }
+      }
+    ]
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/CustomObjectMapper.java
----------------------------------------------------------------------
diff --git a/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/CustomObjectMapper.java b/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/CustomObjectMapper.java
index f17f8b2..fbbcc14 100644
--- a/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/CustomObjectMapper.java
+++ b/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/CustomObjectMapper.java
@@ -24,9 +24,11 @@ import com.fasterxml.jackson.databind.module.SimpleModule;
 import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
 import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
 import org.apache.unomi.api.*;
+import org.apache.unomi.api.actions.ActionType;
 import org.apache.unomi.api.campaigns.Campaign;
 import org.apache.unomi.api.campaigns.events.CampaignEvent;
 import org.apache.unomi.api.conditions.Condition;
+import org.apache.unomi.api.conditions.ConditionType;
 import org.apache.unomi.api.goals.Goal;
 import org.apache.unomi.api.rules.Rule;
 import org.apache.unomi.api.segments.Scoring;
@@ -51,8 +53,8 @@ public class CustomObjectMapper extends ObjectMapper {
         dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
         setDateFormat(dateFormat);
         SimpleModule deserializerModule =
-              new SimpleModule("PropertyTypedObjectDeserializerModule",
-                      new Version(1, 0, 0, null, "org.apache.unomi.rest", "deserializer"));
+                new SimpleModule("PropertyTypedObjectDeserializerModule",
+                        new Version(1, 0, 0, null, "org.apache.unomi.rest", "deserializer"));
 
         PropertyTypedObjectDeserializer propertyTypedObjectDeserializer = new PropertyTypedObjectDeserializer();
         propertyTypedObjectDeserializer.registerMapping("type=.*Condition", Condition.class);
@@ -62,24 +64,26 @@ public class CustomObjectMapper extends ObjectMapper {
         deserializerModule.addDeserializer(Item.class, itemDeserializer);
 
 
-        Map<String,Class<? extends Item>> classes = new HashMap<>();
-        classes.put(Campaign.ITEM_TYPE,Campaign.class);
-        classes.put(CampaignEvent.ITEM_TYPE,CampaignEvent.class);
-        classes.put(Event.ITEM_TYPE,Event.class);
-        classes.put(Goal.ITEM_TYPE,Goal.class);
-        classes.put(Persona.ITEM_TYPE,Persona.class);
-        classes.put(Rule.ITEM_TYPE,Rule.class);
-        classes.put(Scoring.ITEM_TYPE,Scoring.class);
-        classes.put(Segment.ITEM_TYPE,Segment.class);
+        Map<String, Class<? extends Item>> classes = new HashMap<>();
+        classes.put(Campaign.ITEM_TYPE, Campaign.class);
+        classes.put(CampaignEvent.ITEM_TYPE, CampaignEvent.class);
+        classes.put(Event.ITEM_TYPE, Event.class);
+        classes.put(Goal.ITEM_TYPE, Goal.class);
+        classes.put(Persona.ITEM_TYPE, Persona.class);
+        classes.put(Rule.ITEM_TYPE, Rule.class);
+        classes.put(Scoring.ITEM_TYPE, Scoring.class);
+        classes.put(Segment.ITEM_TYPE, Segment.class);
         classes.put(Session.ITEM_TYPE, Session.class);
+        classes.put(ConditionType.ITEM_TYPE, ConditionType.class);
+        classes.put(ActionType.ITEM_TYPE, ActionType.class);
         for (Map.Entry<String, Class<? extends Item>> entry : classes.entrySet()) {
-            propertyTypedObjectDeserializer.registerMapping("itemType="+entry.getKey(), entry.getValue());
+            propertyTypedObjectDeserializer.registerMapping("itemType=" + entry.getKey(), entry.getValue());
             itemDeserializer.registerMapping(entry.getKey(), entry.getValue());
         }
         propertyTypedObjectDeserializer.registerMapping("itemType=.*", CustomItem.class);
 
 
-       super.registerModule(deserializerModule);
+        super.registerModule(deserializerModule);
     }
 
     public static ObjectMapper getObjectMapper() {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/allEventToProfilePropertiesAction.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/allEventToProfilePropertiesAction.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/allEventToProfilePropertiesAction.json
index a936545..adb62e6 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/allEventToProfilePropertiesAction.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/allEventToProfilePropertiesAction.json
@@ -1,7 +1,14 @@
 {
+  "metadata": {
     "id": "allEventToProfilePropertiesAction",
-    "actionExecutor": "allEventToProfileProperties",
-    "tags": [ "event" ],
-    "parameters": [
-    ]
+    "name": "allEventToProfilePropertiesAction",
+    "description": "",
+    "tags": [
+      "event"
+    ],
+    "readOnly": true
+  },
+  "actionExecutor": "allEventToProfileProperties",
+  "parameters": [
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/evaluateProfileAgeAction.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/evaluateProfileAgeAction.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/evaluateProfileAgeAction.json
index ce34300..553f021 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/evaluateProfileAgeAction.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/evaluateProfileAgeAction.json
@@ -1,7 +1,14 @@
 {
+  "metadata": {
     "id": "evaluateProfileAgeAction",
-    "actionExecutor": "evaluateProfileAge",
-    "tags": [ "event" ],
-    "parameters": [
-    ]
+    "name": "evaluateProfileAgeAction",
+    "description": "",
+    "tags": [
+      "event"
+    ],
+    "readOnly": true
+  },
+  "actionExecutor": "evaluateProfileAge",
+  "parameters": [
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/evaluateProfileSegmentsAction.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/evaluateProfileSegmentsAction.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/evaluateProfileSegmentsAction.json
index 6bad98a..e5a86e2 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/evaluateProfileSegmentsAction.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/evaluateProfileSegmentsAction.json
@@ -1,7 +1,14 @@
 {
+  "metadata": {
     "id": "evaluateProfileSegmentsAction",
-    "actionExecutor": "evaluateProfileSegments",
-    "tags": [ "event" ],
-    "parameters": [
-    ]
+    "name": "evaluateProfileSegmentsAction",
+    "description": "",
+    "tags": [
+      "event"
+    ],
+    "readOnly": true
+  },
+  "actionExecutor": "evaluateProfileSegments",
+  "parameters": [
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/eventToProfilePropertyAction.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/eventToProfilePropertyAction.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/eventToProfilePropertyAction.json
index b3a8977..835f666 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/eventToProfilePropertyAction.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/eventToProfilePropertyAction.json
@@ -1,19 +1,26 @@
 {
+  "metadata": {
     "id": "eventToProfilePropertyAction",
-    "actionExecutor": "eventToProfileProperty",
-    "tags": [ "event" ],
-    "parameters": [
-        {
-            "id": "eventPropertyName",
-            "type": "string",
-            "multivalued": false,
-            "choiceListInitializerFilter": "(initializerId=eventProperty)"
-        },
-        {
-            "id": "profilePropertyName",
-            "type": "string",
-            "multivalued": false,
-            "choiceListInitializerFilter": "(initializerId=propertyType)"
-        }
-    ]
+    "name": "eventToProfilePropertyAction",
+    "description": "",
+    "tags": [
+      "event"
+    ],
+    "readOnly": true
+  },
+  "actionExecutor": "eventToProfileProperty",
+  "parameters": [
+    {
+      "id": "eventPropertyName",
+      "type": "string",
+      "multivalued": false,
+      "choiceListInitializerFilter": "(initializerId=eventProperty)"
+    },
+    {
+      "id": "profilePropertyName",
+      "type": "string",
+      "multivalued": false,
+      "choiceListInitializerFilter": "(initializerId=propertyType)"
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/incrementInterestValuesAction.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/incrementInterestValuesAction.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/incrementInterestValuesAction.json
index 8a0dd5f..824d667 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/incrementInterestValuesAction.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/incrementInterestValuesAction.json
@@ -1,8 +1,14 @@
 {
+  "metadata": {
     "id": "incrementInterestsValuesAction",
-    "actionExecutor": "incrementInterestsValues",
-    "tags": [ "event" ],
-    "parameters": [
-
-    ]
+    "name": "incrementInterestsValuesAction",
+    "description": "",
+    "tags": [
+      "event"
+    ],
+    "readOnly": true
+  },
+  "actionExecutor": "incrementInterestsValues",
+  "parameters": [
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/mergeProfilesOnPropertyAction.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/mergeProfilesOnPropertyAction.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/mergeProfilesOnPropertyAction.json
index 8e4734c..18f90f4 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/mergeProfilesOnPropertyAction.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/mergeProfilesOnPropertyAction.json
@@ -1,13 +1,20 @@
 {
+  "metadata": {
     "id": "mergeProfilesOnPropertyAction",
-    "actionExecutor": "mergeProfilesOnProperty",
-    "tags": [ "demographic" ],
-    "parameters": [
-        {
-            "id": "mergeProfilePropertyName",
-            "type": "string",
-            "multivalued": false,
-            "choiceListInitializerFilter": "(initializerId=propertyType)"
-        }
-    ]
+    "name": "mergeProfilesOnPropertyAction",
+    "description": "",
+    "tags": [
+      "demographic"
+    ],
+    "readOnly": true
+  },
+  "actionExecutor": "mergeProfilesOnProperty",
+  "parameters": [
+    {
+      "id": "mergeProfilePropertyName",
+      "type": "string",
+      "multivalued": false,
+      "choiceListInitializerFilter": "(initializerId=propertyType)"
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/sendEventAction.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/sendEventAction.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/sendEventAction.json
index 389c4b5..ef8535c 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/sendEventAction.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/sendEventAction.json
@@ -1,17 +1,24 @@
 {
+  "metadata": {
     "id": "sendEventAction",
-    "actionExecutor": "sendEvent",
-    "tags": [ "event" ],
-    "parameters": [
-        {
-            "id": "eventType",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "eventProperties",
-            "type": "properties",
-            "multivalued": false
-        }
-    ]
+    "name": "sendEventAction",
+    "description": "",
+    "tags": [
+      "event"
+    ],
+    "readOnly": true
+  },
+  "actionExecutor": "sendEvent",
+  "parameters": [
+    {
+      "id": "eventType",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "eventProperties",
+      "type": "properties",
+      "multivalued": false
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/setEventOccurenceCountAction.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/setEventOccurenceCountAction.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/setEventOccurenceCountAction.json
index 566dc83..9a48874 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/setEventOccurenceCountAction.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/setEventOccurenceCountAction.json
@@ -1,12 +1,19 @@
 {
+  "metadata": {
     "id": "setEventOccurenceCountAction",
-    "actionExecutor": "setEventOccurenceCount",
-    "tags": [ "demographic" ],
-    "parameters": [
-        {
-            "id": "pastEventCondition",
-            "type": "condition",
-            "multivalued": false
-        }
-    ]
+    "name": "setEventOccurenceCountAction",
+    "description": "",
+    "tags": [
+      "demographic"
+    ],
+    "readOnly": true
+  },
+  "actionExecutor": "setEventOccurenceCount",
+  "parameters": [
+    {
+      "id": "pastEventCondition",
+      "type": "condition",
+      "multivalued": false
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/setPropertyAction.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/setPropertyAction.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/setPropertyAction.json
index bce9f76..630f5ac 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/setPropertyAction.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/setPropertyAction.json
@@ -1,32 +1,39 @@
 {
+  "metadata": {
     "id": "setPropertyAction",
-    "actionExecutor": "setProperty",
-    "tags": [ "demographic" ],
-    "parameters": [
-        {
-            "id": "setPropertyName",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-          "id": "setPropertyValue",
-          "type": "string",
-          "multivalued": false
-        },
-        {
-          "id": "setPropertyValueInteger",
-          "type": "integer",
-          "multivalued": false
-        },
-        {
-            "id": "setPropertyStrategy",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "storeInSession",
-            "type": "boolean",
-            "multivalued": false
-        }
-    ]
+    "name": "setPropertyAction",
+    "description": "",
+    "tags": [
+      "demographic"
+    ],
+    "readOnly": true
+  },
+  "actionExecutor": "setProperty",
+  "parameters": [
+    {
+      "id": "setPropertyName",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "setPropertyValue",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "setPropertyValueInteger",
+      "type": "integer",
+      "multivalued": false
+    },
+    {
+      "id": "setPropertyStrategy",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "storeInSession",
+      "type": "boolean",
+      "multivalued": false
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/booleanCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/booleanCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/booleanCondition.json
index 8c11b95..ba3b806 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/booleanCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/booleanCondition.json
@@ -1,19 +1,30 @@
 {
+  "metadata": {
     "id": "booleanCondition",
-    "conditionEvaluator": "booleanConditionEvaluator",
-    "queryBuilder": "booleanConditionESQueryBuilder",
-    "tags": [ "logical", "profileCondition", "eventCondition", "sessionCondition" , "sourceEventCondition"],
-    "parameters": [
-        {
-            "id": "operator",
-            "type": "String",
-            "multivalued": false,
-            "defaultValue": "and"
-        },
-        {
-            "id": "subConditions",
-            "type": "Condition",
-            "multivalued": true
-        }
-    ]
+    "name": "booleanCondition",
+    "description": "",
+    "tags": [
+      "logical",
+      "profileCondition",
+      "eventCondition",
+      "sessionCondition",
+      "sourceEventCondition"
+    ],
+    "readOnly": true
+  },
+  "conditionEvaluator": "booleanConditionEvaluator",
+  "queryBuilder": "booleanConditionESQueryBuilder",
+  "parameters": [
+    {
+      "id": "operator",
+      "type": "String",
+      "multivalued": false,
+      "defaultValue": "and"
+    },
+    {
+      "id": "subConditions",
+      "type": "Condition",
+      "multivalued": true
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/downloadEventCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/downloadEventCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/downloadEventCondition.json
index 9bbf6ee..1b7adcf 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/downloadEventCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/downloadEventCondition.json
@@ -1,37 +1,43 @@
 {
+  "metadata": {
     "id": "downloadEventCondition",
-    "parentCondition": {
-        "type": "booleanCondition",
-        "parameterValues": {
-            "subConditions": [
-                {
-                    "type": "eventTypeCondition",
-                    "parameterValues": {
-                        "eventTypeId": "download"
-                    }
-                },
-                {
-                    "type": "eventPropertyCondition",
-                    "parameterValues": {
-                        "propertyName": "target.properties.path",
-                        "propertyValue": "parameter::filePath",
-                        "comparisonOperator": "equals"
-                    }
-                }
-            ],
-            "operator" : "and"
-        }
-    },
+    "name": "downloadEventCondition",
+    "description": "",
     "tags": [
-        "event",
-        "eventCondition",
-        "usableInPastEventCondition"
+      "event",
+      "eventCondition",
+      "usableInPastEventCondition"
     ],
-    "parameters": [
+    "readOnly": true
+  },
+  "parentCondition": {
+    "type": "booleanCondition",
+    "parameterValues": {
+      "subConditions": [
+        {
+          "type": "eventTypeCondition",
+          "parameterValues": {
+            "eventTypeId": "download"
+          }
+        },
         {
-            "id": "filePath",
-            "type": "String",
-            "multivalued": false
+          "type": "eventPropertyCondition",
+          "parameterValues": {
+            "propertyName": "target.properties.path",
+            "propertyValue": "parameter::filePath",
+            "comparisonOperator": "equals"
+          }
         }
-    ]
+      ],
+      "operator": "and"
+    }
+  },
+
+  "parameters": [
+    {
+      "id": "filePath",
+      "type": "String",
+      "multivalued": false
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/eventPropertyCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/eventPropertyCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/eventPropertyCondition.json
index 128f231..c2112d5 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/eventPropertyCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/eventPropertyCondition.json
@@ -1,60 +1,69 @@
 {
+  "metadata": {
     "id": "eventPropertyCondition",
-    "conditionEvaluator": "propertyConditionEvaluator",
-    "queryBuilder": "propertyConditionESQueryBuilder",
-    "tags": [ "demographic", "eventCondition" ],
-    "parameters": [
-        {
-            "id": "propertyName",
-            "type": "string",
-            "multivalued": false,
-            "choiceListInitializerFilter": "(initializerId=eventProperty)"
-        },
-        {
-            "id": "comparisonOperator",
-            "type": "comparisonOperator",
-            "multivalued": false,
-            "choiceListInitializerFilter": "(initializerId=comparisonOperator)"
-        },
-        {
-            "id": "propertyValue",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "propertyValueInteger",
-            "type": "integer",
-            "multivalued": false
-        },
-        {
-            "id": "propertyValueDate",
-            "type": "date",
-            "multivalued": false
-        },
-        {
-            "id": "propertyValueDateExpr",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "propertyValues",
-            "type": "string",
-            "multivalued": true
-        },
-        {
-            "id": "propertyValuesInteger",
-            "type": "integer",
-            "multivalued": true
-        },
-        {
-            "id": "propertyValuesDate",
-            "type": "date",
-            "multivalued": true
-        },
-        {
-            "id": "propertyValuesDateExpr",
-            "type": "string",
-            "multivalued": true
-        }
-    ]
+    "name": "eventPropertyCondition",
+    "description": "",
+    "tags": [
+      "demographic",
+      "eventCondition"
+    ],
+    "readOnly": true
+  },
+  "conditionEvaluator": "propertyConditionEvaluator",
+  "queryBuilder": "propertyConditionESQueryBuilder",
+
+  "parameters": [
+    {
+      "id": "propertyName",
+      "type": "string",
+      "multivalued": false,
+      "choiceListInitializerFilter": "(initializerId=eventProperty)"
+    },
+    {
+      "id": "comparisonOperator",
+      "type": "comparisonOperator",
+      "multivalued": false,
+      "choiceListInitializerFilter": "(initializerId=comparisonOperator)"
+    },
+    {
+      "id": "propertyValue",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "propertyValueInteger",
+      "type": "integer",
+      "multivalued": false
+    },
+    {
+      "id": "propertyValueDate",
+      "type": "date",
+      "multivalued": false
+    },
+    {
+      "id": "propertyValueDateExpr",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "propertyValues",
+      "type": "string",
+      "multivalued": true
+    },
+    {
+      "id": "propertyValuesInteger",
+      "type": "integer",
+      "multivalued": true
+    },
+    {
+      "id": "propertyValuesDate",
+      "type": "date",
+      "multivalued": true
+    },
+    {
+      "id": "propertyValuesDateExpr",
+      "type": "string",
+      "multivalued": true
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/eventTypeCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/eventTypeCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/eventTypeCondition.json
index dd5b2dd..cf1bcb6 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/eventTypeCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/eventTypeCondition.json
@@ -1,20 +1,28 @@
 {
+  "metadata": {
     "id": "eventTypeCondition",
-    "tags": [ "event", "eventCondition" ],
-    "parentCondition" : {
-        "type": "eventPropertyCondition",
-        "parameterValues": {
-            "propertyName": "eventType",
-            "propertyValue": "parameter::eventTypeId",
-            "comparisonOperator": "equals"
-        }
-    },
-    "parameters": [
-        {
-            "id": "eventTypeId",
-            "type": "String",
-            "multivalued": false,
-            "choiceListInitializerFilter": "(initializerId=eventTypeId)"
-        }
-    ]
+    "name": "eventTypeCondition",
+    "description": "",
+    "tags": [
+      "event",
+      "eventCondition"
+    ],
+    "readOnly": true
+  },
+  "parentCondition": {
+    "type": "eventPropertyCondition",
+    "parameterValues": {
+      "propertyName": "eventType",
+      "propertyValue": "parameter::eventTypeId",
+      "comparisonOperator": "equals"
+    }
+  },
+  "parameters": [
+    {
+      "id": "eventTypeId",
+      "type": "String",
+      "multivalued": false,
+      "choiceListInitializerFilter": "(initializerId=eventTypeId)"
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/formEventCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/formEventCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/formEventCondition.json
index 80944de..e375267 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/formEventCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/formEventCondition.json
@@ -1,5 +1,16 @@
 {
-  "id": "formEventCondition",
+  "metadata": {
+    "id": "formEventCondition",
+    "name": "formEventCondition",
+    "description": "",
+    "tags": [
+      "event",
+      "eventCondition",
+      "usableInPastEventCondition",
+      "trackedCondition"
+    ],
+    "readOnly": true
+  },
   "parentCondition": {
     "type": "booleanCondition",
     "parameterValues": {
@@ -27,15 +38,9 @@
           }
         }
       ],
-      "operator" : "and"
+      "operator": "and"
     }
   },
-  "tags": [
-    "event",
-    "eventCondition",
-    "usableInPastEventCondition",
-    "trackedCondition"
-  ],
   "parameters": [
     {
       "id": "formId",

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/geoLocationByPointSessionCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/geoLocationByPointSessionCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/geoLocationByPointSessionCondition.json
index e132a77..4c77df3 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/geoLocationByPointSessionCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/geoLocationByPointSessionCondition.json
@@ -1,48 +1,57 @@
 {
+  "metadata": {
     "id": "geoLocationByPointSessionCondition",
-    "conditionEvaluator": "geoLocationByPointSessionConditionEvaluator",
-    "queryBuilder": "geoLocationByPointSessionConditionESQueryBuilder",
-    "tags": [ "geographic", "sessionCondition" ],
-    "parameters": [
-        {
-          "id": "type",
-          "type": "string",
-          "multivalued": false
-        },
-        {
-            "id": "rectLatitudeNE",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "rectLongitudeNE",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "rectLatitudeSW",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "rectLongitudeSW",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-          "id": "circleLatitude",
-          "type": "string",
-          "multivalued": false
-        },
-        {
-          "id": "circleLongitude",
-          "type": "string",
-          "multivalued": false
-        },
-        {
-            "id": "distance",
-            "type": "string",
-            "multivalued": false
-        }
-    ]
+    "name": "geoLocationByPointSessionCondition",
+    "description": "",
+    "tags": [
+      "geographic",
+      "sessionCondition"
+    ],
+    "readOnly": true
+  },
+  "conditionEvaluator": "geoLocationByPointSessionConditionEvaluator",
+  "queryBuilder": "geoLocationByPointSessionConditionESQueryBuilder",
+
+  "parameters": [
+    {
+      "id": "type",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "rectLatitudeNE",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "rectLongitudeNE",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "rectLatitudeSW",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "rectLongitudeSW",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "circleLatitude",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "circleLongitude",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "distance",
+      "type": "string",
+      "multivalued": false
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/geoLocationSessionCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/geoLocationSessionCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/geoLocationSessionCondition.json
index b9c81f2..63187e0 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/geoLocationSessionCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/geoLocationSessionCondition.json
@@ -1,38 +1,54 @@
 {
-  "id": "geoLocationSessionCondition",
-  "parentCondition" : {
+  "metadata": {
+    "id": "geoLocationSessionCondition",
+    "name": "geoLocationSessionCondition",
+    "description": "",
+    "tags": [
+      "geographic",
+      "sessionCondition"
+    ],
+    "readOnly": true
+  },
+  "parentCondition": {
     "type": "booleanCondition",
     "parameterValues": {
       "operator": "and",
-      "subConditions" : [
+      "subConditions": [
         {
           "type": "profilePropertyCondition",
-          "parameterValues" : {"propertyName": "properties.sessionCountryCode",
+          "parameterValues": {
+            "propertyName": "properties.sessionCountryCode",
             "propertyValue": "parameter::country",
-            "comparisonOperator": "equals"}
+            "comparisonOperator": "equals"
+          }
         },
         {
           "type": "profilePropertyCondition",
-          "parameterValues" : {"propertyName": "properties.sessionAdminSubDiv1",
+          "parameterValues": {
+            "propertyName": "properties.sessionAdminSubDiv1",
             "propertyValue": "parameter::admin1",
-            "comparisonOperator": "equals"}
+            "comparisonOperator": "equals"
+          }
         },
         {
           "type": "profilePropertyCondition",
-          "parameterValues" : {"propertyName": "properties.sessionAdminSubDiv2",
+          "parameterValues": {
+            "propertyName": "properties.sessionAdminSubDiv2",
             "propertyValue": "parameter::admin2",
-            "comparisonOperator": "equals"}
+            "comparisonOperator": "equals"
+          }
         },
         {
           "type": "profilePropertyCondition",
-          "parameterValues" : {"propertyName": "properties.sessionCityId",
+          "parameterValues": {
+            "propertyName": "properties.sessionCityId",
             "propertyValue": "parameter::city",
-            "comparisonOperator": "equals"}
+            "comparisonOperator": "equals"
+          }
         }
       ]
     }
   },
-  "tags": [ "geographic", "sessionCondition" ],
   "parameters": [
     {
       "id": "country",

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/goalMatchCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/goalMatchCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/goalMatchCondition.json
index a50d507..c7cf678 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/goalMatchCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/goalMatchCondition.json
@@ -1,19 +1,28 @@
 {
+  "metadata": {
     "id": "goalMatchCondition",
-    "parentCondition" : {
-        "type": "profilePropertyCondition",
-        "parameterValues": {
-            "propertyName": "script::'systemProperties.goals.'+goalId+'TargetReached'",
-            "comparisonOperator": "exists"
-        }
-    },
-    "tags": [ "profileCondition", "event" ],
-    "parameters": [
-        {
-            "id": "goalId",
-            "type": "string",
-            "multivalued": false,
-            "choiceListInitializerFilter": "(initializerId=goals)"
-        }
-    ]
+    "name": "goalMatchCondition",
+    "description": "",
+    "tags": [
+      "profileCondition",
+      "event"
+    ],
+    "readOnly": true
+  },
+  "parentCondition": {
+    "type": "profilePropertyCondition",
+    "parameterValues": {
+      "propertyName": "script::'systemProperties.goals.'+goalId+'TargetReached'",
+      "comparisonOperator": "exists"
+    }
+  },
+
+  "parameters": [
+    {
+      "id": "goalId",
+      "type": "string",
+      "multivalued": false,
+      "choiceListInitializerFilter": "(initializerId=goals)"
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/loginEventCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/loginEventCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/loginEventCondition.json
index e3a0ee7..8cfb068 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/loginEventCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/loginEventCondition.json
@@ -1,12 +1,21 @@
 {
+  "metadata": {
     "id": "loginEventCondition",
-    "parentCondition" : {
-        "type": "eventTypeCondition",
-        "parameterValues": {
-            "eventTypeId": "login"
-        }
-    },
-    "tags": [ "event", "eventCondition" ],
-    "parameters": [
-    ]
+    "name": "loginEventCondition",
+    "description": "",
+    "tags": [
+      "event",
+      "eventCondition"
+    ],
+    "readOnly": true
+  },
+  "parentCondition": {
+    "type": "eventTypeCondition",
+    "parameterValues": {
+      "eventTypeId": "login"
+    }
+  },
+
+  "parameters": [
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/matchAllCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/matchAllCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/matchAllCondition.json
index 3b0a1b1..c10446e 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/matchAllCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/matchAllCondition.json
@@ -1,8 +1,20 @@
 {
+  "metadata": {
     "id": "matchAllCondition",
-    "conditionEvaluator": "matchAllConditionEvaluator",
-    "queryBuilder": "matchAllConditionESQueryBuilder",
-    "tags": [ "logical", "profileCondition", "eventCondition", "sessionCondition" , "sourceEventCondition"],
-    "parameters": [
-    ]
+    "name": "matchAllCondition",
+    "description": "",
+    "tags": [
+      "logical",
+      "profileCondition",
+      "eventCondition",
+      "sessionCondition",
+      "sourceEventCondition"
+    ],
+    "readOnly": true
+  },
+  "conditionEvaluator": "matchAllConditionEvaluator",
+  "queryBuilder": "matchAllConditionESQueryBuilder",
+
+  "parameters": [
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/newVisitorCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/newVisitorCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/newVisitorCondition.json
index ffdcce9..27db6f3 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/newVisitorCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/newVisitorCondition.json
@@ -1,10 +1,19 @@
 {
-  "id": "newVisitorCondition",
-  "parentCondition" : {
+  "metadata": {
+    "id": "newVisitorCondition",
+    "name": "newVisitorCondition",
+    "description": "",
+    "tags": [
+      "demographic",
+      "sessionCondition"
+    ],
+    "readOnly": true
+  },
+  "parentCondition": {
     "type": "booleanCondition",
     "parameterValues": {
-      "operator":"or",
-      "subConditions":[
+      "operator": "or",
+      "subConditions": [
         {
           "type": "sessionPropertyCondition",
           "parameterValues": {
@@ -23,7 +32,7 @@
       ]
     }
   },
-  "tags": [ "demographic", "sessionCondition" ],
+
   "parameters": [
     {
       "id": "since",

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/notCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/notCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/notCondition.json
index 6db04ed..4776d4d 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/notCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/notCondition.json
@@ -1,8 +1,20 @@
 {
-  "id": "notCondition",
+  "metadata": {
+    "id": "notCondition",
+    "name": "notCondition",
+    "description": "",
+    "tags": [
+      "logical",
+      "profileCondition",
+      "eventCondition",
+      "sessionCondition",
+      "sourceEventCondition"
+    ],
+    "readOnly": true
+  },
   "conditionEvaluator": "notConditionEvaluator",
   "queryBuilder": "notConditionESQueryBuilder",
-  "tags": [ "logical", "profileCondition", "eventCondition", "sessionCondition" , "sourceEventCondition"],
+
   "parameters": [
     {
       "id": "subCondition",

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/pageViewEventCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/pageViewEventCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/pageViewEventCondition.json
index 1fdc52f..3d003c5 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/pageViewEventCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/pageViewEventCondition.json
@@ -1,51 +1,60 @@
 {
+  "metadata": {
     "id": "pageViewEventCondition",
-    "parentCondition": {
-        "type": "booleanCondition",
-        "parameterValues": {
-            "subConditions": [
-                {
-                    "type": "eventTypeCondition",
-                    "parameterValues": {
-                        "eventTypeId": "view"
-                    }
-                },
-                {
-                    "type": "eventPropertyCondition",
-                    "parameterValues": {
-                        "propertyName": "target.properties.pageInfo.pagePath",
-                        "propertyValue": "parameter::pagePath",
-                        "comparisonOperator": "equals"
-                    }
-                },
-                {
-                    "type": "eventPropertyCondition",
-                    "parameterValues": {
-                        "propertyName": "target.properties.pageInfo.language",
-                        "propertyValue": "parameter::language",
-                        "comparisonOperator": "equals"
-                    }
-                }
-            ],
-            "operator" : "and"
-        }
-    },
-    "tags": [ "event", "eventCondition", "usableInPastEventCondition" ],
-    "parameters": [
+    "name": "pageViewEventCondition",
+    "description": "",
+    "tags": [
+      "event",
+      "eventCondition",
+      "usableInPastEventCondition"
+    ],
+    "readOnly": true
+  },
+  "parentCondition": {
+    "type": "booleanCondition",
+    "parameterValues": {
+      "subConditions": [
         {
-            "id": "url",
-            "type": "string",
-            "multivalued": false
+          "type": "eventTypeCondition",
+          "parameterValues": {
+            "eventTypeId": "view"
+          }
         },
         {
-            "id": "pagePath",
-            "type": "string",
-            "multivalued": false
+          "type": "eventPropertyCondition",
+          "parameterValues": {
+            "propertyName": "target.properties.pageInfo.pagePath",
+            "propertyValue": "parameter::pagePath",
+            "comparisonOperator": "equals"
+          }
         },
         {
-            "id": "language",
-            "type": "string",
-            "multivalued": false
+          "type": "eventPropertyCondition",
+          "parameterValues": {
+            "propertyName": "target.properties.pageInfo.language",
+            "propertyValue": "parameter::language",
+            "comparisonOperator": "equals"
+          }
         }
-    ]
+      ],
+      "operator": "and"
+    }
+  },
+  "parameters": [
+    {
+      "id": "url",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "pagePath",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "language",
+      "type": "string",
+      "multivalued": false
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/pastEventCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/pastEventCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/pastEventCondition.json
index 38e1035..a0e280e 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/pastEventCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/pastEventCondition.json
@@ -1,28 +1,37 @@
 {
+  "metadata": {
     "id": "pastEventCondition",
-    "conditionEvaluator": "pastEventConditionEvaluator",
-    "queryBuilder": "pastEventConditionESQueryBuilder",
-    "tags": [ "event", "profileCondition" ],
-    "parameters": [
-        {
-            "id": "numberOfDays",
-            "type": "integer",
-            "multivalued": false
-        },
-        {
-            "id": "minimumEventCount",
-            "type": "integer",
-            "multivalued": false
-        },
-        {
-            "id": "maximumEventCount",
-            "type": "integer",
-            "multivalued": false
-        },
-        {
-            "id": "eventCondition",
-            "type": "Condition",
-            "multivalued": false
-        }
-    ]
+    "name": "pastEventCondition",
+    "description": "",
+    "tags": [
+      "event",
+      "profileCondition"
+    ],
+    "readOnly": true
+  },
+  "conditionEvaluator": "pastEventConditionEvaluator",
+  "queryBuilder": "pastEventConditionESQueryBuilder",
+
+  "parameters": [
+    {
+      "id": "numberOfDays",
+      "type": "integer",
+      "multivalued": false
+    },
+    {
+      "id": "minimumEventCount",
+      "type": "integer",
+      "multivalued": false
+    },
+    {
+      "id": "maximumEventCount",
+      "type": "integer",
+      "multivalued": false
+    },
+    {
+      "id": "eventCondition",
+      "type": "Condition",
+      "multivalued": false
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileInterestCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileInterestCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileInterestCondition.json
index 22d65a7..088fe03 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileInterestCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileInterestCondition.json
@@ -1,24 +1,33 @@
 {
+  "metadata": {
     "id": "profileInterestCondition",
-    "parentCondition" : {
-        "type": "profilePropertyCondition",
-        "parameterValues": {
-            "propertyName": "script::'properties.interests.'+interestName.toLowerCase()",
-            "propertyValueInteger": "parameter::value",
-            "comparisonOperator": "greaterThan"
-        }
+    "name": "profileInterestCondition",
+    "description": "",
+    "tags": [
+      "demographic",
+      "profileCondition"
+    ],
+    "readOnly": true
+  },
+  "parentCondition": {
+    "type": "profilePropertyCondition",
+    "parameterValues": {
+      "propertyName": "script::'properties.interests.'+interestName.toLowerCase()",
+      "propertyValueInteger": "parameter::value",
+      "comparisonOperator": "greaterThan"
+    }
+  },
+
+  "parameters": [
+    {
+      "id": "interestName",
+      "type": "string",
+      "multivalued": false
     },
-    "tags": [ "demographic", "profileCondition" ],
-    "parameters": [
-        {
-            "id": "interestName",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "value",
-            "type": "integer",
-            "multivalued": false
-        }
-    ]
+    {
+      "id": "value",
+      "type": "integer",
+      "multivalued": false
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profilePropertyCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profilePropertyCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profilePropertyCondition.json
index 78b613e..2d73d95 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profilePropertyCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profilePropertyCondition.json
@@ -1,60 +1,68 @@
 {
+  "metadata": {
     "id": "profilePropertyCondition",
-    "conditionEvaluator": "propertyConditionEvaluator",
-    "queryBuilder": "propertyConditionESQueryBuilder",
-    "tags": [ "demographic", "profileCondition" ],
-    "parameters": [
-        {
-            "id": "propertyName",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "comparisonOperator",
-            "type": "comparisonOperator",
-            "multivalued": false,
-            "choiceListInitializerFilter": "(initializerId=comparisonOperator)"
-        },
-        {
-            "id": "propertyValue",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "propertyValueInteger",
-            "type": "integer",
-            "multivalued": false
-        },
-        {
-            "id": "propertyValueDate",
-            "type": "date",
-            "multivalued": false
-        },
-        {
-            "id": "propertyValueDateExpr",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "propertyValues",
-            "type": "string",
-            "multivalued": true
-        },
-        {
-            "id": "propertyValuesInteger",
-            "type": "integer",
-            "multivalued": true
-        },
-        {
-            "id": "propertyValuesDate",
-            "type": "date",
-            "multivalued": true
-        },
-        {
-            "id": "propertyValuesDateExpr",
-            "type": "string",
-            "multivalued": true
-        }
+    "name": "profilePropertyCondition",
+    "description": "",
+    "tags": [
+      "demographic",
+      "profileCondition"
+    ],
+    "readOnly": true
+  },
+  "conditionEvaluator": "propertyConditionEvaluator",
+  "queryBuilder": "propertyConditionESQueryBuilder",
 
-    ]
+  "parameters": [
+    {
+      "id": "propertyName",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "comparisonOperator",
+      "type": "comparisonOperator",
+      "multivalued": false,
+      "choiceListInitializerFilter": "(initializerId=comparisonOperator)"
+    },
+    {
+      "id": "propertyValue",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "propertyValueInteger",
+      "type": "integer",
+      "multivalued": false
+    },
+    {
+      "id": "propertyValueDate",
+      "type": "date",
+      "multivalued": false
+    },
+    {
+      "id": "propertyValueDateExpr",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "propertyValues",
+      "type": "string",
+      "multivalued": true
+    },
+    {
+      "id": "propertyValuesInteger",
+      "type": "integer",
+      "multivalued": true
+    },
+    {
+      "id": "propertyValuesDate",
+      "type": "date",
+      "multivalued": true
+    },
+    {
+      "id": "propertyValuesDateExpr",
+      "type": "string",
+      "multivalued": true
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileSegmentCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileSegmentCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileSegmentCondition.json
index d033de3..4b7b6ee 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileSegmentCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileSegmentCondition.json
@@ -1,25 +1,34 @@
 {
+  "metadata": {
     "id": "profileSegmentCondition",
-    "parentCondition" : {
-        "type": "profilePropertyCondition",
-        "parameterValues": {
-            "propertyName": "segments",
-            "propertyValues": "parameter::segments",
-            "comparisonOperator": "parameter::matchType"
-        }
+    "name": "profileSegmentCondition",
+    "description": "",
+    "tags": [
+      "demographic",
+      "profileCondition"
+    ],
+    "readOnly": true
+  },
+  "parentCondition": {
+    "type": "profilePropertyCondition",
+    "parameterValues": {
+      "propertyName": "segments",
+      "propertyValues": "parameter::segments",
+      "comparisonOperator": "parameter::matchType"
+    }
+  },
+
+  "parameters": [
+    {
+      "id": "segments",
+      "type": "string",
+      "multivalued": true,
+      "choiceListInitializerFilter": "(initializerId=segments)"
     },
-    "tags": [ "demographic", "profileCondition" ],
-    "parameters": [
-        {
-            "id": "segments",
-            "type": "string",
-            "multivalued": true,
-            "choiceListInitializerFilter": "(initializerId=segments)"
-        },
-        {
-            "id": "matchType",
-            "type": "string",
-            "multivalued": false
-        }
-    ]
+    {
+      "id": "matchType",
+      "type": "string",
+      "multivalued": false
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileUpdatedEventCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileUpdatedEventCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileUpdatedEventCondition.json
index 217cc65..b2efa0b 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileUpdatedEventCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileUpdatedEventCondition.json
@@ -1,12 +1,21 @@
 {
+  "metadata": {
     "id": "profileUpdatedEventCondition",
-    "parentCondition" : {
-        "type": "eventTypeCondition",
-        "parameterValues": {
-            "eventTypeId": "profileUpdated"
-        }
-    },
-    "tags": [ "event", "eventCondition" ],
-    "parameters": [
-    ]
+    "name": "profileUpdatedEventCondition",
+    "description": "",
+    "tags": [
+      "event",
+      "eventCondition"
+    ],
+    "readOnly": true
+  },
+  "parentCondition": {
+    "type": "eventTypeCondition",
+    "parameterValues": {
+      "eventTypeId": "profileUpdated"
+    }
+  },
+
+  "parameters": [
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/returningVisitorCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/returningVisitorCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/returningVisitorCondition.json
index 5b8d1bf..e314241 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/returningVisitorCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/returningVisitorCondition.json
@@ -1,10 +1,19 @@
 {
-  "id": "returningVisitorCondition",
-  "parentCondition" : {
+  "metadata": {
+    "id": "returningVisitorCondition",
+    "name": "returningVisitorCondition",
+    "description": "",
+    "tags": [
+      "demographic",
+      "sessionCondition"
+    ],
+    "readOnly": true
+  },
+  "parentCondition": {
     "type": "booleanCondition",
     "parameterValues": {
-      "operator":"and",
-      "subConditions":[
+      "operator": "and",
+      "subConditions": [
         {
           "type": "sessionPropertyCondition",
           "parameterValues": {
@@ -23,7 +32,6 @@
       ]
     }
   },
-  "tags": [ "demographic", "sessionCondition" ],
   "parameters": [
     {
       "id": "since",

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sessionCreatedEventCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sessionCreatedEventCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sessionCreatedEventCondition.json
index dd1ee10..25f1818 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sessionCreatedEventCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sessionCreatedEventCondition.json
@@ -1,12 +1,20 @@
 {
+  "metadata": {
     "id": "sessionCreatedEventCondition",
-    "parentCondition" : {
-        "type": "eventTypeCondition",
-        "parameterValues": {
-            "eventTypeId": "sessionCreated"
-        }
-    },
-    "tags": [ "event", "eventCondition" ],
-    "parameters": [
-    ]
+    "name": "sessionCreatedEventCondition",
+    "description": "",
+    "tags": [
+      "event",
+      "eventCondition"
+    ],
+    "readOnly": true
+  },
+  "parentCondition": {
+    "type": "eventTypeCondition",
+    "parameterValues": {
+      "eventTypeId": "sessionCreated"
+    }
+  },
+  "parameters": [
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sessionDurationCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sessionDurationCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sessionDurationCondition.json
index f09aa2f..c57d204 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sessionDurationCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sessionDurationCondition.json
@@ -1,27 +1,36 @@
 {
+  "metadata": {
     "id": "sessionDurationCondition",
-    "parentCondition" : {
-        "type": "sessionPropertyCondition",
-        "parameterValues": {
-            "propertyName": "duration",
-            "comparisonOperator": "between",
-            "propertyValuesInteger": [
-                "script::minimumDuration*1000",
-                "script::maximumDuration*1000"
-            ]
-        }
+    "name": "sessionDurationCondition",
+    "description": "",
+    "tags": [
+      "demographic",
+      "sessionCondition"
+    ],
+    "readOnly": true
+  },
+  "parentCondition": {
+    "type": "sessionPropertyCondition",
+    "parameterValues": {
+      "propertyName": "duration",
+      "comparisonOperator": "between",
+      "propertyValuesInteger": [
+        "script::minimumDuration*1000",
+        "script::maximumDuration*1000"
+      ]
+    }
+  },
+
+  "parameters": [
+    {
+      "id": "minimumDuration",
+      "type": "integer",
+      "multivalued": false
     },
-    "tags": [ "demographic", "sessionCondition" ],
-    "parameters": [
-        {
-            "id": "minimumDuration",
-            "type": "integer",
-            "multivalued": false
-        },
-        {
-            "id": "maximumDuration",
-            "type": "integer",
-            "multivalued": false
-        }
-    ]
+    {
+      "id": "maximumDuration",
+      "type": "integer",
+      "multivalued": false
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sessionPropertyCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sessionPropertyCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sessionPropertyCondition.json
index 5b4fca1..6e0cf07 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sessionPropertyCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sessionPropertyCondition.json
@@ -1,59 +1,67 @@
 {
+  "metadata": {
     "id": "sessionPropertyCondition",
-    "conditionEvaluator": "propertyConditionEvaluator",
-    "queryBuilder": "propertyConditionESQueryBuilder",
-    "tags": [ "demographic", "sessionCondition" ],
-    "parameters": [
-        {
-            "id": "propertyName",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "comparisonOperator",
-            "type": "comparisonOperator",
-            "multivalued": false,
-            "choiceListInitializerFilter": "(initializerId=comparisonOperator)"
-        },
-        {
-            "id": "propertyValue",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "propertyValueInteger",
-            "type": "integer",
-            "multivalued": false
-        },
-        {
-            "id": "propertyValueDate",
-            "type": "date",
-            "multivalued": false
-        },
-        {
-            "id": "propertyValueDateExpr",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "propertyValues",
-            "type": "string",
-            "multivalued": true
-        },
-        {
-            "id": "propertyValuesInteger",
-            "type": "integer",
-            "multivalued": true
-        },
-        {
-            "id": "propertyValuesDate",
-            "type": "date",
-            "multivalued": true
-        },
-        {
-            "id": "propertyValuesDateExpr",
-            "type": "string",
-            "multivalued": true
-        }
-    ]
+    "name": "sessionPropertyCondition",
+    "description": "",
+    "tags": [
+      "demographic",
+      "sessionCondition"
+    ],
+    "readOnly": true
+  },
+  "conditionEvaluator": "propertyConditionEvaluator",
+  "queryBuilder": "propertyConditionESQueryBuilder",
+  "parameters": [
+    {
+      "id": "propertyName",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "comparisonOperator",
+      "type": "comparisonOperator",
+      "multivalued": false,
+      "choiceListInitializerFilter": "(initializerId=comparisonOperator)"
+    },
+    {
+      "id": "propertyValue",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "propertyValueInteger",
+      "type": "integer",
+      "multivalued": false
+    },
+    {
+      "id": "propertyValueDate",
+      "type": "date",
+      "multivalued": false
+    },
+    {
+      "id": "propertyValueDateExpr",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "propertyValues",
+      "type": "string",
+      "multivalued": true
+    },
+    {
+      "id": "propertyValuesInteger",
+      "type": "integer",
+      "multivalued": true
+    },
+    {
+      "id": "propertyValuesDate",
+      "type": "date",
+      "multivalued": true
+    },
+    {
+      "id": "propertyValuesDateExpr",
+      "type": "string",
+      "multivalued": true
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ad73b222/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sourceEventPropertyCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sourceEventPropertyCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sourceEventPropertyCondition.json
index 5021d21..d977dbc 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sourceEventPropertyCondition.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/sourceEventPropertyCondition.json
@@ -1,28 +1,36 @@
 {
+  "metadata": {
     "id": "sourceEventPropertyCondition",
-    "conditionEvaluator": "sourceEventPropertyConditionEvaluator",
-    "queryBuilder": "sourceEventPropertyConditionESQueryBuilder",
-    "tags": ["sourceEventCondition"],
-    "parameters": [
-        {
-            "id": "id",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "path",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "scope",
-            "type": "string",
-            "multivalued": false
-        },
-        {
-            "id": "type",
-            "type": "string",
-            "multivalued": false
-        }
-    ]
+    "name": "sourceEventPropertyCondition",
+    "description": "",
+    "tags": [
+      "sourceEventCondition"
+    ],
+    "readOnly": true
+  },
+  "conditionEvaluator": "sourceEventPropertyConditionEvaluator",
+  "queryBuilder": "sourceEventPropertyConditionESQueryBuilder",
+
+  "parameters": [
+    {
+      "id": "id",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "path",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "scope",
+      "type": "string",
+      "multivalued": false
+    },
+    {
+      "id": "type",
+      "type": "string",
+      "multivalued": false
+    }
+  ]
 }
\ No newline at end of file