You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by ql...@apache.org on 2016/08/09 12:21:39 UTC

[1/2] incubator-unomi git commit: UNOMI-49 : Add "aggregated" tag

Repository: incubator-unomi
Updated Branches:
  refs/heads/master 7742b30ae -> 1c5d74aa5


UNOMI-49 : Add "aggregated" tag


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

Branch: refs/heads/master
Commit: b6410c1488950d420950f7b3a80a5e6eace6ae73
Parents: 7742b30
Author: Abdelkader Midani <am...@jahia.com>
Authored: Mon Aug 8 15:49:32 2016 +0200
Committer: Abdelkader Midani <am...@jahia.com>
Committed: Mon Aug 8 15:49:32 2016 +0200

----------------------------------------------------------------------
 .../META-INF/cxs/conditions/profileSegmentCondition.json         | 2 +-
 services/src/main/resources/META-INF/cxs/tags/aggregated.json    | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b6410c14/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 09b7e18..40235e0 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
@@ -4,7 +4,7 @@
     "name": "profileSegmentCondition",
     "description": "",
     "tags": [
-      "demographic",
+      "aggregated",
       "profileCondition"
     ],
     "readOnly": true

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b6410c14/services/src/main/resources/META-INF/cxs/tags/aggregated.json
----------------------------------------------------------------------
diff --git a/services/src/main/resources/META-INF/cxs/tags/aggregated.json b/services/src/main/resources/META-INF/cxs/tags/aggregated.json
new file mode 100644
index 0000000..83f417c
--- /dev/null
+++ b/services/src/main/resources/META-INF/cxs/tags/aggregated.json
@@ -0,0 +1,4 @@
+{
+    "id": "aggregated",
+    "parent": "profileTags"
+}
\ No newline at end of file


[2/2] incubator-unomi git commit: UNOMI-47 : Check if the nested property is present on the profile

Posted by ql...@apache.org.
UNOMI-47 : Check if the nested property is present on the profile


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

Branch: refs/heads/master
Commit: 1c5d74aa5c2f98af8a632eb9be603e168f6df1be
Parents: b6410c1
Author: Abdelkader Midani <am...@jahia.com>
Authored: Tue Aug 9 13:36:12 2016 +0200
Committer: Abdelkader Midani <am...@jahia.com>
Committed: Tue Aug 9 13:36:12 2016 +0200

----------------------------------------------------------------------
 .../unomi/persistence/spi/PropertyHelper.java       | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/1c5d74aa/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PropertyHelper.java
----------------------------------------------------------------------
diff --git a/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PropertyHelper.java b/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PropertyHelper.java
index 0f839db..e70a09f 100644
--- a/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PropertyHelper.java
+++ b/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PropertyHelper.java
@@ -18,6 +18,7 @@
 package org.apache.unomi.persistence.spi;
 
 import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.beanutils.NestedNullException;
 import org.apache.commons.beanutils.PropertyUtils;
 import org.apache.commons.beanutils.expression.DefaultResolver;
 import org.slf4j.Logger;
@@ -44,12 +45,17 @@ public class PropertyHelper {
             if(setPropertyStrategy!=null && setPropertyStrategy.equals("remove")){
                 if(resolver.hasNested(propertyName)) {
                     parentPropertyName = propertyName.substring(0, propertyName.lastIndexOf('.'));
-                    Object parentPropertyValue = PropertyUtils.getNestedProperty(target, parentPropertyName);
-                    if(parentPropertyValue instanceof HashMap){
-                        ((HashMap)parentPropertyValue).remove(propertyName.substring(propertyName.lastIndexOf('.')+1));
-                        PropertyUtils.setNestedProperty(target, parentPropertyName, parentPropertyValue);
-                        return true;
+                    try{
+                        Object parentPropertyValue = PropertyUtils.getNestedProperty(target, parentPropertyName);
+                        if(parentPropertyValue instanceof HashMap){
+                            ((HashMap)parentPropertyValue).remove(propertyName.substring(propertyName.lastIndexOf('.')+1));
+                            PropertyUtils.setNestedProperty(target, parentPropertyName, parentPropertyValue);
+                            return true;
+                        }
+                    } catch(NestedNullException ex){
+                        return false;
                     }
+
                 }
                 return false;
             }