incubator-unomi git commit: UNOMI-102 : Recurrent to Oneshot export update
Repository: incubator-unomi Updated Branches: refs/heads/master efc4a9ce3 -> cf27900b9 UNOMI-102 : Recurrent to Oneshot export update Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/cf27900b Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/cf27900b Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/cf27900b Branch: refs/heads/master Commit: cf27900b9dd0d946d2a05fbfe970cc147a736014 Parents: efc4a9c Author: Abdelkader MidaniAuthored: Fri Jul 7 16:53:41 2017 +0200 Committer: Abdelkader Midani Committed: Fri Jul 7 16:54:04 2017 +0200 -- .../ExportConfigurationServiceEndPoint.java | 38 +--- .../ImportConfigurationServiceEndPoint.java | 35 +- 2 files changed, 34 insertions(+), 39 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/cf27900b/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ExportConfigurationServiceEndPoint.java -- diff --git a/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ExportConfigurationServiceEndPoint.java b/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ExportConfigurationServiceEndPoint.java index 35d4f34..9e52c05 100644 --- a/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ExportConfigurationServiceEndPoint.java +++ b/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ExportConfigurationServiceEndPoint.java @@ -24,7 +24,6 @@ import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.unomi.router.api.ExportConfiguration; -import org.apache.unomi.router.api.RouterConstants; import org.apache.unomi.router.api.services.ImportExportConfigurationService; import org.apache.unomi.router.api.services.ProfileExportService; import org.slf4j.Logger; @@ -76,28 +75,26 @@ public class ExportConfigurationServiceEndPoint extends AbstractConfigurationSer */ public ExportConfiguration saveConfiguration(ExportConfiguration exportConfiguration) { ExportConfiguration exportConfigSaved = configurationService.save(exportConfiguration); -if (RouterConstants.IMPORT_EXPORT_CONFIG_TYPE_RECURRENT.equals(exportConfigSaved.getConfigType())) { -CloseableHttpClient httpClient = HttpClients.createDefault(); -try { -HttpPut httpPut = new HttpPut("http://localhost:; + configSharingService.getProperty("internalServerPort") + "/configUpdate/exportConfigAdmin"); -StringEntity input = new StringEntity(new ObjectMapper().writeValueAsString(exportConfigSaved)); -input.setContentType(MediaType.APPLICATION_JSON); -httpPut.setEntity(input); +CloseableHttpClient httpClient = HttpClients.createDefault(); +try { +HttpPut httpPut = new HttpPut("http://localhost:; + configSharingService.getProperty("internalServerPort") + "/configUpdate/exportConfigAdmin"); +StringEntity input = new StringEntity(new ObjectMapper().writeValueAsString(exportConfigSaved)); +input.setContentType(MediaType.APPLICATION_JSON); +httpPut.setEntity(input); -HttpResponse response = httpClient.execute(httpPut); +HttpResponse response = httpClient.execute(httpPut); -if (response.getStatusLine().getStatusCode() != 200) { -logger.error("Failed to update the running config: Please check the acceccibilty to the URI: \n{}", -"http://localhost:; + configSharingService.getProperty("internalServerPort") + "/configUpdate/importConfigAdmin"); -logger.error("HTTP Status code returned {}", response.getStatusLine().getStatusCode()); -throw new PartialContentException("RUNNING_CONFIG_UPDATE_FAILED"); -} -} catch (Exception e) { -logger.warn("Unable to update Camel route [{}]", exportConfiguration.getItemId()); -e.printStackTrace(); +if (response.getStatusLine().getStatusCode() != 200) { +logger.error("Failed to update the running config: Please check the acceccibilty to the URI: \n{}", +"http://localhost:; + configSharingService.getProperty("internalServerPort") + "/configUpdate/importConfigAdmin"); +logger.error("HTTP Status code returned {}", response.getStatusLine().getStatusCode()); throw new
incubator-unomi git commit: UNOMI-87 fix issue when removing scoring plan
Repository: incubator-unomi Updated Branches: refs/heads/master bb96940da -> efc4a9ce3 UNOMI-87 fix issue when removing scoring plan Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/efc4a9ce Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/efc4a9ce Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/efc4a9ce Branch: refs/heads/master Commit: efc4a9ce310a129644f744199f97d00d5cd06aac Parents: bb96940 Author: dgaillardAuthored: Fri Jul 7 16:31:04 2017 +0200 Committer: dgaillard Committed: Fri Jul 7 16:31:04 2017 +0200 -- .../ElasticSearchPersistenceServiceImpl.java| 3 +-- .../unomi/services/services/SegmentServiceImpl.java | 16 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/efc4a9ce/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java -- diff --git a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java index 8bf6024..1e601a8 100644 --- a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java +++ b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java @@ -842,8 +842,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, .execute() .actionGet(); } else { -UpdateRequest updateRequest = client.prepareUpdate(index, itemType, itemId).setScript(actualScript). - setRefreshPolicy(WriteRequest.RefreshPolicy.WAIT_UNTIL).request(); +UpdateRequest updateRequest = client.prepareUpdate(index, itemType, itemId).setScript(actualScript).request(); bulkProcessor.add(updateRequest); } return true; http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/efc4a9ce/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 979c3cb..47eda18 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 @@ -936,14 +936,18 @@ public class SegmentServiceImpl extends AbstractServiceImpl implements SegmentSe scoringCondition.setConditionType(definitionsService.getConditionType("profilePropertyCondition")); scoringCondition.setParameter("propertyName", "scores." + scoringId); scoringCondition.setParameter("comparisonOperator", "exists"); -List previousProfiles = persistenceService.query(scoringCondition, null, Profile.class); +Condition[] conditions = new Condition[1]; +conditions[0] = scoringCondition; -HashMap scriptParams = new HashMap<>(); -scriptParams.put("scoringId", scoringId); +HashMap [] scriptParams = new HashMap[1]; +scriptParams[0] = new HashMap (); +scriptParams[0].put("scoringId", scoringId); + +String[] script = new String[1]; +script[0] = "ctx._source.scores.remove(params.scoringId)"; + +persistenceService.updateWithQueryAndScript(null, Profile.class, script, scriptParams, conditions); -for (Profile profileToRemove : previousProfiles) { -persistenceService.updateWithScript(profileToRemove.getItemId(), null, Profile.class, "ctx._source.scores.remove(scoringId)", scriptParams); -} logger.info("Profiles updated in {}ms", System.currentTimeMillis() - t); }
Campaigns and profiles
Hi, I'm working on proof of concept based on Unomi. I'm having difficulty to find API endpoint which can provide me relation between campaigns and profiles. In my setup I created 1M profiles, couple of segments and campaigns and then I have created sessions for one profile. I was expecting to find relation between campaign and profile (direct or through sessions) but I cannot find. Campaign entry condition should be correct. How should I use campaigns? Can you point me in correct direction? note: I'm using snapshot version from the master branch. Kind regards, Stevan Bogdanovic