You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2021/04/19 11:40:07 UTC
[unomi] branch unomi-1.5.x updated: Configure max profiles to merge
instead use max size (#247)
This is an automated email from the ASF dual-hosted git repository.
shuber pushed a commit to branch unomi-1.5.x
in repository https://gitbox.apache.org/repos/asf/unomi.git
The following commit(s) were added to refs/heads/unomi-1.5.x by this push:
new 5dc89e4 Configure max profiles to merge instead use max size (#247)
5dc89e4 is described below
commit 5dc89e4ff974ed7aad7e2599a79145c587139c52
Author: liatiusim <62...@users.noreply.github.com>
AuthorDate: Mon Apr 19 10:19:44 2021 +0200
Configure max profiles to merge instead use max size (#247)
(cherry picked from commit 16fea156f048e272f404e1fec4fca232743d394f)
---
kar/src/main/feature/feature.xml | 1 +
package/pom.xml | 11 ++++++++++
.../main/resources/etc/custom.system.properties | 5 +++++
plugins/baseplugin/pom.xml | 24 ++++++++++++++++++++++
.../actions/MergeProfilesOnPropertyAction.java | 7 ++++++-
.../resources/OSGI-INF/blueprint/blueprint.xml | 2 ++
.../resources/org.apache.unomi.plugins.base.cfg | 18 ++++++++++++++++
7 files changed, 67 insertions(+), 1 deletion(-)
diff --git a/kar/src/main/feature/feature.xml b/kar/src/main/feature/feature.xml
index 6efda88..6f73669 100644
--- a/kar/src/main/feature/feature.xml
+++ b/kar/src/main/feature/feature.xml
@@ -37,6 +37,7 @@
<configfile finalname="/etc/org.apache.unomi.web.cfg">mvn:org.apache.unomi/unomi-wab/${project.version}/cfg/unomicfg</configfile>
<configfile finalname="/etc/org.apache.unomi.persistence.elasticsearch.cfg">mvn:org.apache.unomi/unomi-persistence-elasticsearch-core/${project.version}/cfg/elasticsearchcfg</configfile>
<configfile finalname="/etc/org.apache.unomi.plugins.request.cfg">mvn:org.apache.unomi/unomi-plugins-request/${project.version}/cfg/requestcfg</configfile>
+ <configfile finalname="/etc/org.apache.unomi.plugins.base.cfg">mvn:org.apache.unomi/unomi-plugins-base/${project.version}/cfg/pluginsbasecfg</configfile>
<configfile finalname="/etc/org.apache.unomi.services.cfg">mvn:org.apache.unomi/unomi-services/${project.version}/cfg/servicescfg</configfile>
<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>
diff --git a/package/pom.xml b/package/pom.xml
index 4c7e59e..ffb9f06 100644
--- a/package/pom.xml
+++ b/package/pom.xml
@@ -229,6 +229,17 @@
</artifactItem>
<artifactItem>
<groupId>org.apache.unomi</groupId>
+ <artifactId>unomi-plugins-base</artifactId>
+ <version>${project.version}</version>
+ <classifier>pluginsbasecfg</classifier>
+ <type>cfg</type>
+ <outputDirectory>
+ ${project.build.directory}/assembly/etc
+ </outputDirectory>
+ <destFileName>org.apache.unomi.plugins.base.cfg</destFileName>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.unomi</groupId>
<artifactId>unomi-plugins-mail</artifactId>
<version>${project.version}</version>
<classifier>mailcfg</classifier>
diff --git a/package/src/main/resources/etc/custom.system.properties b/package/src/main/resources/etc/custom.system.properties
index 924cc07..6521528 100644
--- a/package/src/main/resources/etc/custom.system.properties
+++ b/package/src/main/resources/etc/custom.system.properties
@@ -286,6 +286,11 @@ org.apache.unomi.mail.server.password=${env:UNOMI_MAIL_PASSWORD:-}
org.apache.unomi.mail.server.sslOnConnect=${env:UNOMI_MAIL_SSLONCONNECT:-true}
#######################################################################################################################
+## baseplugin settings ##
+#######################################################################################################################
+org.apache.unomi.plugins.base.maxProfilesInOneMerge=${env:UNOMI_MAX_PROFILES_IN_ONE_MERGE:--1}
+
+#######################################################################################################################
## Security settings ##
#######################################################################################################################
org.apache.unomi.security.encryption.enabled=${env:UNOMI_ENCRYPTION_ENABLED:-false}
diff --git a/plugins/baseplugin/pom.xml b/plugins/baseplugin/pom.xml
index f6a443a..2810a20 100644
--- a/plugins/baseplugin/pom.xml
+++ b/plugins/baseplugin/pom.xml
@@ -132,6 +132,30 @@
</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.plugins.base.cfg
+ </file>
+ <type>cfg</type>
+ <classifier>pluginsbasecfg</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
</project>
diff --git a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/MergeProfilesOnPropertyAction.java b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/MergeProfilesOnPropertyAction.java
index 93036d7..cfe04df 100644
--- a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/MergeProfilesOnPropertyAction.java
+++ b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/MergeProfilesOnPropertyAction.java
@@ -45,6 +45,7 @@ public class MergeProfilesOnPropertyAction implements ActionExecutor {
private DefinitionsService definitionsService;
private PrivacyService privacyService;
private ConfigSharingService configSharingService;
+ private int maxProfilesInOneMerge = -1;
public int execute(Action action, Event event) {
String profileIdCookieName = (String) configSharingService.getProperty("profileIdCookieName");
@@ -89,7 +90,7 @@ public class MergeProfilesOnPropertyAction implements ActionExecutor {
c.setParameter("operator", "and");
c.setParameter("subConditions", Arrays.asList(propertyCondition, excludeMergedProfilesCondition));
- final List<Profile> profiles = persistenceService.query(c, "properties.firstVisit", Profile.class);
+ final List<Profile> profiles = persistenceService.query(c, "properties.firstVisit", Profile.class, 0, maxProfilesInOneMerge).getList();
// Check if the user switched to another profile
if (StringUtils.isNotEmpty(mergeProfilePreviousPropertyValue) && !mergeProfilePreviousPropertyValue.equals(mergeProfilePropertyValue)) {
@@ -266,4 +267,8 @@ public class MergeProfilesOnPropertyAction implements ActionExecutor {
this.configSharingService = configSharingService;
}
+ public void setMaxProfilesInOneMerge(String maxProfilesInOneMerge) {
+ this.maxProfilesInOneMerge = Integer.parseInt(maxProfilesInOneMerge);
+ }
+
}
diff --git a/plugins/baseplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/plugins/baseplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index a11d952..53fb4e6 100644
--- a/plugins/baseplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/plugins/baseplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -26,6 +26,7 @@
<cm:default-properties>
<cm:property name="useEventToUpdateProfile" value="false" />
<cm:property name="usePropertyConditionOptimizations" value="true" />
+ <cm:property name="maxProfilesInOneMerge" value="-1"/>
</cm:default-properties>
</cm:property-placeholder>
@@ -273,6 +274,7 @@
<property name="definitionsService" ref="definitionsService"/>
<property name="privacyService" ref="privacyService"/>
<property name="configSharingService" ref="configSharingService" />
+ <property name="maxProfilesInOneMerge" value="${base.maxProfilesInOneMerge}"/>
</bean>
</service>
diff --git a/plugins/baseplugin/src/main/resources/org.apache.unomi.plugins.base.cfg b/plugins/baseplugin/src/main/resources/org.apache.unomi.plugins.base.cfg
new file mode 100644
index 0000000..41f80a9
--- /dev/null
+++ b/plugins/baseplugin/src/main/resources/org.apache.unomi.plugins.base.cfg
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+maxProfilesInOneMerge=${org.apache.unomi.plugins.base.maxProfilesInOneMerge:--1}