Repository: incubator-unomi
Updated Branches:
  refs/heads/master be70e6952 -> 67055a778


UNOMI-140 : Use system tag "personalIdentifierProperties" in privacy service


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

Branch: refs/heads/master
Commit: 67055a778e3c26f87b95a455de69d8bed808e2f5
Parents: be70e69
Author: Abdelkader Midani <[email protected]>
Authored: Wed Nov 22 12:27:49 2017 +0100
Committer: Abdelkader Midani <[email protected]>
Committed: Wed Nov 22 12:28:10 2017 +0100

----------------------------------------------------------------------
 .../unomi/api/services/ProfileService.java      |  2 ++
 extensions/privacy-extension/services/pom.xml   | 26 ----------------
 .../privacy/internal/PrivacyServiceImpl.java    | 31 ++++++++++++--------
 .../resources/OSGI-INF/blueprint/blueprint.xml  | 10 +------
 .../main/resources/org.apache.unomi.privacy.cfg | 18 ------------
 .../AbstractConfigurationServiceEndpoint.java   |  1 -
 kar/src/main/feature/feature.xml                |  1 -
 .../services/services/ProfileServiceImpl.java   |  2 --
 8 files changed, 21 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/67055a77/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
----------------------------------------------------------------------
diff --git 
a/api/src/main/java/org/apache/unomi/api/services/ProfileService.java 
b/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
index 30518a8..25c5753 100644
--- a/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
@@ -28,6 +28,8 @@ import java.util.*;
  */
 public interface ProfileService {
 
+    String PERSONAL_IDENTIFIER_TAG_NAME = "personalIdentifierProperties";
+
     /**
      * Retrieves the number of unique profiles.
      *

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/67055a77/extensions/privacy-extension/services/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/privacy-extension/services/pom.xml 
b/extensions/privacy-extension/services/pom.xml
index 3b72da7..630230b 100644
--- a/extensions/privacy-extension/services/pom.xml
+++ b/extensions/privacy-extension/services/pom.xml
@@ -71,32 +71,6 @@
                     </instructions>
                 </configuration>
             </plugin>
-
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>build-helper-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>attach-artifacts</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>attach-artifact</goal>
-                        </goals>
-                        <configuration>
-                            <artifacts>
-                                <artifact>
-                                    <file>
-                                        
src/main/resources/org.apache.unomi.privacy.cfg
-                                    </file>
-                                    <type>cfg</type>
-                                    <classifier>privacycfg</classifier>
-                                </artifact>
-                            </artifacts>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-
         </plugins>
     </build>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/67055a77/extensions/privacy-extension/services/src/main/java/org/apache/unomi/privacy/internal/PrivacyServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/extensions/privacy-extension/services/src/main/java/org/apache/unomi/privacy/internal/PrivacyServiceImpl.java
 
b/extensions/privacy-extension/services/src/main/java/org/apache/unomi/privacy/internal/PrivacyServiceImpl.java
index 2686848..c8fc430 100644
--- 
a/extensions/privacy-extension/services/src/main/java/org/apache/unomi/privacy/internal/PrivacyServiceImpl.java
+++ 
b/extensions/privacy-extension/services/src/main/java/org/apache/unomi/privacy/internal/PrivacyServiceImpl.java
@@ -24,6 +24,8 @@ import org.apache.unomi.api.services.ProfileService;
 import org.apache.unomi.persistence.spi.PersistenceService;
 import org.apache.unomi.persistence.spi.aggregate.TermsAggregate;
 import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.*;
 
@@ -32,12 +34,23 @@ import java.util.*;
  */
 public class PrivacyServiceImpl implements PrivacyService {
 
+    private static final Logger logger = 
LoggerFactory.getLogger(PrivacyServiceImpl.class);
+
     private PersistenceService persistenceService;
     private ProfileService profileService;
     private EventService eventService;
-    private List<String> defaultDeniedProperties;
+    private List deniedProperties = new ArrayList<String>();
     private BundleContext bundleContext;
 
+    public PrivacyServiceImpl() {
+        logger.info("Initializing privacy service...");
+    }
+
+    public void initService() {
+        Set<PropertyType> personalIdsProps = 
profileService.getPropertyTypeBySystemTag(ProfileService.PERSONAL_IDENTIFIER_TAG_NAME);
+        personalIdsProps.forEach(propType -> 
deniedProperties.add(propType.getMetadata().getId()));
+    }
+
     public void setPersistenceService(PersistenceService persistenceService) {
         this.persistenceService = persistenceService;
     }
@@ -50,14 +63,6 @@ public class PrivacyServiceImpl implements PrivacyService {
         this.eventService = eventService;
     }
 
-    public void setDefaultDeniedProperties(List<String> 
defaultDeniedProperties) {
-        this.defaultDeniedProperties = defaultDeniedProperties;
-    }
-
-    public void setDefaultDeniedProperties(String defaultDeniedProperties) {
-        this.defaultDeniedProperties = 
Arrays.asList(defaultDeniedProperties.split(","));
-    }
-
     public void setBundleContext(BundleContext bundleContext) {
         this.bundleContext = bundleContext;
     }
@@ -69,9 +74,9 @@ public class PrivacyServiceImpl implements PrivacyService {
         
serverInfo.setServerVersion(bundleContext.getBundle().getVersion().toString());
 
         // let's retrieve all the event types the server has seen.
-        Map<String,Long> eventTypeCounts = 
persistenceService.aggregateQuery(null, new TermsAggregate("eventType"), 
Event.ITEM_TYPE);
+        Map<String, Long> eventTypeCounts = 
persistenceService.aggregateQuery(null, new TermsAggregate("eventType"), 
Event.ITEM_TYPE);
         List<EventInfo> eventTypes = new ArrayList<EventInfo>();
-        for (Map.Entry<String,Long> eventTypeEntry : 
eventTypeCounts.entrySet()) {
+        for (Map.Entry<String, Long> eventTypeEntry : 
eventTypeCounts.entrySet()) {
             EventInfo eventInfo = new EventInfo();
             eventInfo.setName(eventTypeEntry.getKey());
             eventInfo.setOccurences(eventTypeEntry.getValue());
@@ -79,7 +84,7 @@ public class PrivacyServiceImpl implements PrivacyService {
         }
         serverInfo.setEventTypes(eventTypes);
 
-        serverInfo.setCapabilities(new HashMap<String,String>());
+        serverInfo.setCapabilities(new HashMap<String, String>());
         return serverInfo;
     }
 
@@ -208,7 +213,7 @@ public class PrivacyServiceImpl implements PrivacyService {
 
     @Override
     public List<String> getDeniedProperties(String profileId) {
-        return defaultDeniedProperties;
+        return deniedProperties;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/67055a77/extensions/privacy-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git 
a/extensions/privacy-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
 
b/extensions/privacy-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 2755772..294909b 100644
--- 
a/extensions/privacy-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ 
b/extensions/privacy-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -20,13 +20,6 @@
            
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0";
            xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";>
 
-    <cm:property-placeholder persistent-id="org.apache.unomi.privacy"
-                             update-strategy="reload">
-        <cm:default-properties>
-            <cm:property name="defaultDeniedProperties" 
value="firstName,lastName"/>
-        </cm:default-properties>
-    </cm:property-placeholder>
-
     <reference id="persistenceService"
                
interface="org.apache.unomi.persistence.spi.PersistenceService"/>
 
@@ -38,11 +31,10 @@
 
     <!-- Privacy service -->
 
-    <bean id="privacyServiceImpl" 
class="org.apache.unomi.privacy.internal.PrivacyServiceImpl">
+    <bean id="privacyServiceImpl" 
class="org.apache.unomi.privacy.internal.PrivacyServiceImpl" 
init-method="initService">
         <property name="persistenceService" ref="persistenceService"/>
         <property name="eventService" ref="eventService" />
         <property name="profileService" ref="profileService" />
-        <property name="defaultDeniedProperties" 
value="${defaultDeniedProperties}" />
         <property name="bundleContext" ref="blueprintBundleContext"/>
     </bean>
     <service id="privacyService" ref="privacyServiceImpl" 
auto-export="interfaces"/>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/67055a77/extensions/privacy-extension/services/src/main/resources/org.apache.unomi.privacy.cfg
----------------------------------------------------------------------
diff --git 
a/extensions/privacy-extension/services/src/main/resources/org.apache.unomi.privacy.cfg
 
b/extensions/privacy-extension/services/src/main/resources/org.apache.unomi.privacy.cfg
deleted file mode 100644
index 4d4f3da..0000000
--- 
a/extensions/privacy-extension/services/src/main/resources/org.apache.unomi.privacy.cfg
+++ /dev/null
@@ -1,18 +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.
-#
-
-defaultDeniedProperties=firstName,lastName,email,phoneNumber,address,facebookId,googleId,linkedInId,twitterId

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/67055a77/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/AbstractConfigurationServiceEndpoint.java
----------------------------------------------------------------------
diff --git 
a/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/AbstractConfigurationServiceEndpoint.java
 
b/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/AbstractConfigurationServiceEndpoint.java
index 8875294..54d72ab 100644
--- 
a/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/AbstractConfigurationServiceEndpoint.java
+++ 
b/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/AbstractConfigurationServiceEndpoint.java
@@ -37,7 +37,6 @@ public abstract class AbstractConfigurationServiceEndpoint<T> 
{
 
     protected ImportExportConfigurationService<T> configurationService;
     protected ConfigSharingService configSharingService;
-    protected CloseableHttpClient httpClient;
 
     @WebMethod(exclude = true)
     public void setConfigSharingService(ConfigSharingService 
configSharingService) {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/67055a77/kar/src/main/feature/feature.xml
----------------------------------------------------------------------
diff --git a/kar/src/main/feature/feature.xml b/kar/src/main/feature/feature.xml
index 0ef512c..b4bdd90 100644
--- a/kar/src/main/feature/feature.xml
+++ b/kar/src/main/feature/feature.xml
@@ -30,7 +30,6 @@
         <configfile 
finalname="/etc/org.apache.unomi.thirdparty.cfg">mvn:org.apache.unomi/unomi-services/${project.version}/cfg/thirdpartycfg</configfile>
         <configfile 
finalname="/etc/org.apache.unomi.cluster.cfg">mvn:org.apache.unomi/unomi-services/${project.version}/cfg/clustercfg</configfile>
         <configfile 
finalname="/etc/hazelcast.xml">mvn:org.apache.unomi/unomi-services/${project.version}/xml/hazelcastconfig</configfile>
-        <configfile 
finalname="/etc/org.apache.unomi.privacy.cfg">mvn:org.apache.unomi/cxs-privacy-extension-services/${project.version}/cfg/privacycfg</configfile>
         <configfile 
finalname="/etc/org.apache.unomi.geonames.cfg">mvn:org.apache.unomi/cxs-geonames-services/${project.version}/cfg/geonamescfg</configfile>
         <bundle start-level="75">mvn:commons-io/commons-io/2.4</bundle>
         <bundle 
start-level="75">mvn:com.fasterxml.jackson.core/jackson-core/${version.jackson.core}</bundle>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/67055a77/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java
 
b/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java
index 1c8747a..abd5196 100644
--- 
a/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java
+++ 
b/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java
@@ -66,8 +66,6 @@ public class ProfileServiceImpl implements ProfileService, 
SynchronousBundleList
 
     private List<PropertyType> allPropertyTypes;
 
-    private final String PERSONAL_IDENTIFIER_TAG_NAME = 
"personalIdentifierProperties";
-
     public ProfileServiceImpl() {
         logger.info("Initializing profile service...");
     }

Reply via email to