http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/EvaluateProfileAgeAction.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/EvaluateProfileAgeAction.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/EvaluateProfileAgeAction.java
deleted file mode 100644
index 3d80593..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/EvaluateProfileAgeAction.java
+++ /dev/null
@@ -1,44 +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.oasis_open.contextserver.plugins.baseplugin.actions;
-
-import org.joda.time.DateTime;
-import org.joda.time.Years;
-import org.oasis_open.contextserver.api.Event;
-import org.oasis_open.contextserver.api.actions.Action;
-import org.oasis_open.contextserver.api.actions.ActionExecutor;
-import org.oasis_open.contextserver.api.services.EventService;
-
-/**
- * Created by kevan on 11/08/15.
- */
-public class EvaluateProfileAgeAction implements ActionExecutor {
-
-    @Override
-    public int execute(Action action, Event event) {
-        boolean updated = false;
-        if(event.getProfile().getProperty("birthDate") != null) {
-            Integer y = Years.yearsBetween(new 
DateTime(event.getProfile().getProperty("birthDate")), new 
DateTime()).getYears();
-            if(event.getProfile().getProperty("age") == null || 
event.getProfile().getProperty("age") != y){
-                updated = true;
-                event.getProfile().setProperty("age", y);
-            }
-        }
-        return updated ? EventService.PROFILE_UPDATED : EventService.NO_CHANGE;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/EvaluateProfileSegmentsAction.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/EvaluateProfileSegmentsAction.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/EvaluateProfileSegmentsAction.java
deleted file mode 100644
index f9ef153..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/EvaluateProfileSegmentsAction.java
+++ /dev/null
@@ -1,58 +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.oasis_open.contextserver.plugins.baseplugin.actions;
-
-import org.oasis_open.contextserver.api.Event;
-import org.oasis_open.contextserver.api.actions.Action;
-import org.oasis_open.contextserver.api.actions.ActionExecutor;
-import org.oasis_open.contextserver.api.services.EventService;
-import org.oasis_open.contextserver.api.services.SegmentService;
-import org.oasis_open.contextserver.api.segments.SegmentsAndScores;
-
-import java.util.Map;
-import java.util.Set;
-
-public class EvaluateProfileSegmentsAction implements ActionExecutor {
-
-    private SegmentService segmentService;
-
-    public SegmentService getSegmentService() {
-        return segmentService;
-    }
-
-    public void setSegmentService(SegmentService segmentService) {
-        this.segmentService = segmentService;
-    }
-
-    @Override
-    public int execute(Action action, Event event) {
-        boolean updated = false;
-        SegmentsAndScores segmentsAndScoringForProfile = 
segmentService.getSegmentsAndScoresForProfile(event.getProfile());
-        Set<String> segments = segmentsAndScoringForProfile.getSegments();
-        if (!segments.equals(event.getProfile().getSegments())) {
-            event.getProfile().setSegments(segments);
-            updated = true;
-        }
-        Map<String, Integer> scores = segmentsAndScoringForProfile.getScores();
-        if (!scores.equals(event.getProfile().getScores())) {
-            event.getProfile().setScores(scores);
-            updated = true;
-        }
-        return updated ? EventService.PROFILE_UPDATED : EventService.NO_CHANGE;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/EventToProfilePropertyAction.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/EventToProfilePropertyAction.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/EventToProfilePropertyAction.java
deleted file mode 100644
index 5378e5b..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/EventToProfilePropertyAction.java
+++ /dev/null
@@ -1,39 +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.oasis_open.contextserver.plugins.baseplugin.actions;
-
-import org.oasis_open.contextserver.api.Event;
-import org.oasis_open.contextserver.api.actions.Action;
-import org.oasis_open.contextserver.api.actions.ActionExecutor;
-import org.oasis_open.contextserver.api.services.EventService;
-
-/**
- * A action to copy an event property to a profile property
- */
-public class EventToProfilePropertyAction implements ActionExecutor {
-
-    public int execute(Action action, Event event) {
-        String eventPropertyName = (String) 
action.getParameterValues().get("eventPropertyName");
-        String profilePropertyName = (String) 
action.getParameterValues().get("profilePropertyName");
-        if (event.getProfile().getProperty(profilePropertyName) == null || 
!event.getProfile().getProperty(profilePropertyName).equals(event.getProperty(eventPropertyName)))
 {
-            event.getProfile().setProperty(profilePropertyName, 
event.getProperty(eventPropertyName));
-            return EventService.PROFILE_UPDATED;
-        }
-        return EventService.NO_CHANGE;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/IncrementInterestsValuesAction.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/IncrementInterestsValuesAction.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/IncrementInterestsValuesAction.java
deleted file mode 100644
index 3e4406e..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/IncrementInterestsValuesAction.java
+++ /dev/null
@@ -1,63 +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.oasis_open.contextserver.plugins.baseplugin.actions;
-
-import org.apache.commons.beanutils.PropertyUtils;
-import org.oasis_open.contextserver.api.Event;
-import org.oasis_open.contextserver.api.actions.Action;
-import org.oasis_open.contextserver.api.actions.ActionExecutor;
-import org.oasis_open.contextserver.api.services.EventService;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class IncrementInterestsValuesAction implements ActionExecutor {
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public int execute(Action action, Event event) {
-        boolean modified = false;
-
-        try {
-            Map<String, Object> interests = (Map<String, Object>) 
PropertyUtils.getProperty(event, "target.properties.interests");
-            if (interests != null) {
-                for (Map.Entry<String, Object> s : interests.entrySet()) {
-                    int value = (Integer) s.getValue();
-
-                    HashMap<String, Object> profileInterests = 
(HashMap<String, Object>) event.getProfile().getProperty("interests");
-                    if(profileInterests != null){
-                        profileInterests = new HashMap<String, 
Object>(profileInterests);
-                        int oldValue = 
(profileInterests.containsKey(s.getKey())) ? (Integer) 
profileInterests.get(s.getKey()) : 0;
-                        profileInterests.put(s.getKey(), value + oldValue);
-                    }else {
-                        profileInterests = new HashMap<String, Object>();
-                        profileInterests.put(s.getKey(), value);
-                    }
-                    event.getProfile().setProperty("interests", 
profileInterests);
-                    modified = true;
-                }
-            }
-        } catch (UnsupportedOperationException e) {
-            throw e;
-        } catch (Exception e) {
-            throw new UnsupportedOperationException(e);
-        }
-
-        return modified ? EventService.PROFILE_UPDATED : 
EventService.NO_CHANGE;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/MergeProfilesOnPropertyAction.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/MergeProfilesOnPropertyAction.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/MergeProfilesOnPropertyAction.java
deleted file mode 100644
index bfcb1b3..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/MergeProfilesOnPropertyAction.java
+++ /dev/null
@@ -1,200 +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.oasis_open.contextserver.plugins.baseplugin.actions;
-
-import org.apache.commons.lang3.StringUtils;
-import org.oasis_open.contextserver.api.Event;
-import org.oasis_open.contextserver.api.Persona;
-import org.oasis_open.contextserver.api.Profile;
-import org.oasis_open.contextserver.api.Session;
-import org.oasis_open.contextserver.api.actions.Action;
-import org.oasis_open.contextserver.api.actions.ActionExecutor;
-import org.oasis_open.contextserver.api.actions.ActionPostExecutor;
-import org.oasis_open.contextserver.api.conditions.Condition;
-import org.oasis_open.contextserver.api.services.DefinitionsService;
-import org.oasis_open.contextserver.api.services.EventService;
-import org.oasis_open.contextserver.api.services.ProfileService;
-import org.oasis_open.contextserver.persistence.spi.PersistenceService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.ServletResponse;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletResponse;
-import java.util.Arrays;
-import java.util.List;
-
-public class MergeProfilesOnPropertyAction implements ActionExecutor {
-
-    private static final Logger logger = 
LoggerFactory.getLogger(MergeProfilesOnPropertyAction.class.getName());
-
-    private final int MAX_COOKIE_AGE_IN_SECONDS = 60 * 60 * 24 * 365 * 10; // 
10-years
-    private int cookieAgeInSeconds = MAX_COOKIE_AGE_IN_SECONDS;
-    private String profileIdCookieName = "context-profile-id";
-
-    private ProfileService profileService;
-
-    private PersistenceService persistenceService;
-
-    private EventService eventService;
-
-    private DefinitionsService definitionsService;
-
-    public void setCookieAgeInSeconds(int cookieAgeInSeconds) {
-        this.cookieAgeInSeconds = cookieAgeInSeconds;
-    }
-
-    public void setProfileIdCookieName(String profileIdCookieName) {
-        this.profileIdCookieName = profileIdCookieName;
-    }
-
-    public void setProfileService(ProfileService profileService) {
-        this.profileService = profileService;
-    }
-
-    public PersistenceService getPersistenceService() {
-        return persistenceService;
-    }
-
-    public void setPersistenceService(PersistenceService persistenceService) {
-        this.persistenceService = persistenceService;
-    }
-
-    public EventService getEventService() {
-        return eventService;
-    }
-
-    public void setEventService(EventService eventService) {
-        this.eventService = eventService;
-    }
-
-    public DefinitionsService getDefinitionsService() {
-        return definitionsService;
-    }
-
-    public void setDefinitionsService(DefinitionsService definitionsService) {
-        this.definitionsService = definitionsService;
-    }
-
-    public int execute(Action action, Event event) {
-
-        final Profile profile = event.getProfile();
-
-        final String mergeProfilePropertyName = (String) 
action.getParameterValues().get("mergeProfilePropertyName");
-        final String mergeProfilePropertyValue = 
profile.getProperty(mergeProfilePropertyName) != null ? 
profile.getProperty(mergeProfilePropertyName).toString() : "";
-        final Session currentSession = event.getSession();
-
-        // store the profile id in case the merge change it to a previous one
-
-        if (profile instanceof Persona) {
-            return EventService.NO_CHANGE;
-        }
-
-        if (StringUtils.isEmpty(mergeProfilePropertyValue)) {
-            return EventService.NO_CHANGE;
-        }
-        String profileId = profile.getItemId();
-
-        Condition propertyCondition = new 
Condition(definitionsService.getConditionType("eventPropertyCondition"));
-        propertyCondition.setParameter("comparisonOperator", "equals");
-        propertyCondition.setParameter("propertyName", 
mergeProfilePropertyName);
-        propertyCondition.setParameter("propertyValue", 
mergeProfilePropertyValue);
-
-        Condition excludeMergedProfilesCondition = new 
Condition(definitionsService.getConditionType("eventPropertyCondition"));
-        excludeMergedProfilesCondition.setParameter("comparisonOperator", 
"missing");
-        excludeMergedProfilesCondition.setParameter("propertyName", 
"mergedWith");
-
-        Condition c = new 
Condition(definitionsService.getConditionType("booleanCondition"));
-        c.setParameter("operator", "and");
-        c.setParameter("subConditions", Arrays.asList(propertyCondition, 
excludeMergedProfilesCondition));
-
-        final List<Profile> profiles = persistenceService.query(c, 
"properties.firstVisit", Profile.class);
-
-        // add current Profile to profiles to be merged
-        boolean add = true;
-        for (Profile p : profiles) {
-            add = add && !StringUtils.equals(p.getItemId(), 
profile.getItemId());
-        }
-        if (add) {
-            profiles.add(profile);
-        }
-
-        if (profiles.size() == 1) {
-            return EventService.NO_CHANGE;
-        }
-
-        Profile masterProfile = profileService.mergeProfiles(profiles.get(0), 
profiles);
-
-        if (!masterProfile.getItemId().equals(profileId)) {
-            HttpServletResponse httpServletResponse = (HttpServletResponse) 
event.getAttributes().get(Event.HTTP_RESPONSE_ATTRIBUTE);
-            sendProfileCookie(event.getSession().getProfile(), 
httpServletResponse);
-            final String masterProfileId = masterProfile.getItemId();
-
-            // At the end of the merge, we must set the merged profile as 
profile event to process other Actions
-            event.setProfileId(masterProfileId);
-            event.setProfile(masterProfile);
-
-            event.getActionPostExecutors().add(new ActionPostExecutor() {
-                @Override
-                public boolean execute() {
-                    try {
-                        for (Profile profile : profiles) {
-                            String profileId = profile.getItemId();
-                            if (!StringUtils.equals(profileId, 
masterProfileId)) {
-                                List<Session> sessions = 
persistenceService.query("profileId", profileId, null, Session.class);
-                                if 
(currentSession.getProfileId().equals(profileId) && 
!sessions.contains(currentSession)) {
-                                    sessions.add(currentSession);
-                                }
-                                for (Session session : sessions) {
-                                    
persistenceService.update(session.getItemId(), session.getTimeStamp(), 
Session.class, "profileId", masterProfileId);
-                                }
-
-                                List<Event> events = 
persistenceService.query("profileId", profileId, null, Event.class);
-                                for (Event event : events) {
-                                    
persistenceService.update(event.getItemId(), event.getTimeStamp(), Event.class, 
"profileId", masterProfileId);
-                                }
-                                // we must mark all the profiles that we 
merged into the master as merged with the master, and they will
-                                // be deleted upon next load
-                                profile.setMergedWith(masterProfileId);
-                                persistenceService.update(profile.getItemId(), 
null, Profile.class, "mergedWith", masterProfileId);
-                            }
-                        }
-                    } catch (Exception e) {
-                        logger.error("unable to execute callback action, 
profile and session will not be saved", e);
-                        return false;
-                    }
-                    return true;
-                }
-            });
-            return EventService.PROFILE_UPDATED;
-        }
-
-        return EventService.NO_CHANGE;
-    }
-
-    public void sendProfileCookie(Profile profile, ServletResponse response) {
-        if (response instanceof HttpServletResponse) {
-            HttpServletResponse httpServletResponse = (HttpServletResponse) 
response;
-            Cookie profileIdCookie = new Cookie(profileIdCookieName, 
profile.getItemId());
-            profileIdCookie.setPath("/");
-            profileIdCookie.setMaxAge(cookieAgeInSeconds);
-            httpServletResponse.addCookie(profileIdCookie);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/SendEventAction.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/SendEventAction.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/SendEventAction.java
deleted file mode 100644
index c18e317..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/SendEventAction.java
+++ /dev/null
@@ -1,51 +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.oasis_open.contextserver.plugins.baseplugin.actions;
-
-import org.oasis_open.contextserver.api.*;
-import org.oasis_open.contextserver.api.actions.Action;
-import org.oasis_open.contextserver.api.actions.ActionExecutor;
-import org.oasis_open.contextserver.api.services.EventService;
-import java.util.Map;
-
-public class SendEventAction implements ActionExecutor {
-
-    private EventService eventService;
-
-    public void setEventService(EventService eventService) {
-        this.eventService = eventService;
-    }
-
-    @Override
-    public int execute(Action action, Event event) {
-        String eventType = (String) 
action.getParameterValues().get("eventType");
-        @SuppressWarnings("unchecked")
-        Map<String, Object> eventProperties = (Map<String, Object>) 
action.getParameterValues().get("eventProperties");
-        Item target = (Item) action.getParameterValues().get("eventTarget");
-//        String type = (String) target.get("type");
-
-//            Item targetItem = new CustomItem();
-//            BeanUtils.populate(targetItem, target);
-
-        Event subEvent = new Event(eventType, event.getSession(), 
event.getProfile(), event.getScope(), event, target, event.getTimeStamp());
-        subEvent.getAttributes().putAll(event.getAttributes());
-        subEvent.getProperties().putAll(eventProperties);
-
-        return eventService.send(subEvent);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/SetEventOccurenceCountAction.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/SetEventOccurenceCountAction.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/SetEventOccurenceCountAction.java
deleted file mode 100644
index 019b838..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/SetEventOccurenceCountAction.java
+++ /dev/null
@@ -1,87 +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.oasis_open.contextserver.plugins.baseplugin.actions;
-
-import org.oasis_open.contextserver.api.Event;
-import org.oasis_open.contextserver.api.actions.Action;
-import org.oasis_open.contextserver.api.actions.ActionExecutor;
-import org.oasis_open.contextserver.api.conditions.Condition;
-import org.oasis_open.contextserver.api.services.DefinitionsService;
-import org.oasis_open.contextserver.api.services.EventService;
-import org.oasis_open.contextserver.persistence.spi.PersistenceService;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-public class SetEventOccurenceCountAction implements ActionExecutor {
-    private DefinitionsService definitionsService;
-
-    private PersistenceService persistenceService;
-
-    public void setDefinitionsService(DefinitionsService definitionsService) {
-        this.definitionsService = definitionsService;
-    }
-
-    public void setPersistenceService(PersistenceService persistenceService) {
-        this.persistenceService = persistenceService;
-    }
-
-    @Override
-    public int execute(Action action, Event event) {
-        final Condition pastEventCondition = (Condition) 
action.getParameterValues().get("pastEventCondition");
-
-        Condition andCondition = new 
Condition(definitionsService.getConditionType("booleanCondition"));
-        andCondition.setParameter("operator", "and");
-        ArrayList<Condition> conditions = new ArrayList<Condition>();
-
-        Condition eventCondition = (Condition) 
pastEventCondition.getParameter("eventCondition");
-        definitionsService.resolveConditionType(eventCondition);
-        conditions.add(eventCondition);
-
-        Condition c = new 
Condition(definitionsService.getConditionType("eventPropertyCondition"));
-        c.setParameter("propertyName","profileId");
-        c.setParameter("comparisonOperator", "equals");
-        c.setParameter("propertyValue",event.getProfileId());
-        conditions.add(c);
-
-        if (pastEventCondition.getParameter("numberOfDays") != null) {
-            int i = (Integer) pastEventCondition.getParameter("numberOfDays");
-
-            Condition timeCondition = new 
Condition(definitionsService.getConditionType("eventPropertyCondition"));
-            timeCondition.setParameter("propertyName","timeStamp");
-            timeCondition.setParameter("comparisonOperator","greaterThan");
-            timeCondition.setParameter("propertyValueDateExpr","now-"+i+"d");
-
-            conditions.add(timeCondition);
-        }
-
-        andCondition.setParameter("subConditions", conditions);
-
-        long count = persistenceService.queryCount(andCondition, 
Event.ITEM_TYPE);
-
-        Map<String,Object> pastEvents = (Map<String,Object>) 
event.getProfile().getSystemProperties().get("pastEvents");
-        if (pastEvents == null) {
-            pastEvents = new LinkedHashMap<>();
-            event.getProfile().getSystemProperties().put("pastEvents", 
pastEvents);
-        }
-        pastEvents.put((String) 
pastEventCondition.getParameter("generatedPropertyKey"), count + 1);
-
-        return EventService.PROFILE_UPDATED;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/SetPropertyAction.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/SetPropertyAction.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/SetPropertyAction.java
deleted file mode 100644
index c7a074f..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/actions/SetPropertyAction.java
+++ /dev/null
@@ -1,63 +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.oasis_open.contextserver.plugins.baseplugin.actions;
-
-import org.oasis_open.contextserver.api.Event;
-import org.oasis_open.contextserver.api.actions.Action;
-import org.oasis_open.contextserver.api.actions.ActionExecutor;
-import org.oasis_open.contextserver.api.services.EventService;
-import org.oasis_open.contextserver.persistence.spi.PropertyHelper;
-
-import java.text.SimpleDateFormat;
-import java.util.*;
-
-public class SetPropertyAction implements ActionExecutor {
-
-    public SetPropertyAction() {
-    }
-
-    public String getActionId() {
-        return "setPropertyAction";
-    }
-
-    public int execute(Action action, Event event) {
-        Object propertyValue = 
action.getParameterValues().get("setPropertyValue");
-        Object propertyValueInteger = 
action.getParameterValues().get("setPropertyValueInteger");
-
-        if(propertyValueInteger != null && propertyValue == null) {
-            propertyValue = PropertyHelper.getInteger(propertyValueInteger);
-        }
-
-        if (propertyValue != null && propertyValue.equals("now")) {
-            SimpleDateFormat format = new 
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
-            format.setTimeZone(TimeZone.getTimeZone("UTC"));
-            propertyValue = format.format(event.getTimeStamp());
-        }
-        String propertyName = (String) 
action.getParameterValues().get("setPropertyName");
-
-        boolean storeInSession = 
Boolean.TRUE.equals(action.getParameterValues().get("storeInSession"));
-
-        Object target = storeInSession ? event.getSession() : 
event.getProfile();
-
-        if (PropertyHelper.setProperty(target, propertyName, propertyValue, 
(String) action.getParameterValues().get("setPropertyStrategy"))) {
-            return storeInSession ? EventService.SESSION_UPDATED : 
EventService.PROFILE_UPDATED;
-        }
-        return EventService.NO_CHANGE;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/BooleanConditionESQueryBuilder.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/BooleanConditionESQueryBuilder.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/BooleanConditionESQueryBuilder.java
deleted file mode 100644
index 635b77a..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/BooleanConditionESQueryBuilder.java
+++ /dev/null
@@ -1,54 +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.oasis_open.contextserver.plugins.baseplugin.conditions;
-
-import org.elasticsearch.index.query.FilterBuilder;
-import org.elasticsearch.index.query.FilterBuilders;
-import org.oasis_open.contextserver.api.conditions.Condition;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilder;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilderDispatcher;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * ES query builder for boolean conditions.
- */
-public class BooleanConditionESQueryBuilder implements ConditionESQueryBuilder 
{
-
-    @Override
-    public FilterBuilder buildFilter(Condition condition, Map<String, Object> 
context,
-            ConditionESQueryBuilderDispatcher dispatcher) {
-        boolean isAndOperator = "and".equalsIgnoreCase((String) 
condition.getParameter("operator"));
-        @SuppressWarnings("unchecked")
-        List<Condition> conditions = (List<Condition>) 
condition.getParameter("subConditions");
-
-        int conditionCount = conditions.size();
-
-        if (conditionCount == 1) {
-            return dispatcher.buildFilter(conditions.get(0), context);
-        }
-
-        FilterBuilder[] l = new FilterBuilder[conditionCount];
-        for (int i = 0; i < conditionCount; i++) {
-            l[i] = dispatcher.buildFilter(conditions.get(i), context);
-        }
-
-        return isAndOperator ? FilterBuilders.andFilter(l) : 
FilterBuilders.orFilter(l);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/BooleanConditionEvaluator.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/BooleanConditionEvaluator.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/BooleanConditionEvaluator.java
deleted file mode 100644
index 2f59124..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/BooleanConditionEvaluator.java
+++ /dev/null
@@ -1,51 +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.oasis_open.contextserver.plugins.baseplugin.conditions;
-
-import org.oasis_open.contextserver.api.Item;
-import org.oasis_open.contextserver.api.conditions.Condition;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluator;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluatorDispatcher;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Evaluator for AND and OR conditions.
- */
-public class BooleanConditionEvaluator implements ConditionEvaluator {
-
-    @Override
-    public boolean eval(Condition condition, Item item, Map<String, Object> 
context,
-            ConditionEvaluatorDispatcher dispatcher) {
-        boolean isAnd = "and".equalsIgnoreCase((String) 
condition.getParameter("operator"));
-        @SuppressWarnings("unchecked")
-        List<Condition> conditions = (List<Condition>) 
condition.getParameter("subConditions");
-        for (Condition sub : conditions) {
-            boolean eval = dispatcher.eval(sub, item, context);
-            if (!eval && isAnd) {
-                // And
-                return false;
-            } else if (eval && !isAnd) {
-                // Or
-                return true;
-            }
-        }
-        return isAnd;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/GeoLocationByPointSessionConditionESQueryBuilder.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/GeoLocationByPointSessionConditionESQueryBuilder.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/GeoLocationByPointSessionConditionESQueryBuilder.java
deleted file mode 100644
index b0ceddd..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/GeoLocationByPointSessionConditionESQueryBuilder.java
+++ /dev/null
@@ -1,60 +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.oasis_open.contextserver.plugins.baseplugin.conditions;
-
-import org.elasticsearch.index.query.FilterBuilder;
-import org.elasticsearch.index.query.FilterBuilders;
-import org.oasis_open.contextserver.api.conditions.Condition;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilder;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilderDispatcher;
-
-import java.util.Map;
-
-public class GeoLocationByPointSessionConditionESQueryBuilder implements 
ConditionESQueryBuilder {
-    @Override
-    public FilterBuilder buildFilter(Condition condition, Map<String, Object> 
context, ConditionESQueryBuilderDispatcher dispatcher) {
-        String type = (String) condition.getParameter("type");
-
-        if("circle".equals(type)) {
-            Double circleLatitude = (Double) 
condition.getParameter("circleLatitude");
-            Double circleLongitude = (Double) 
condition.getParameter("circleLongitude");
-            String distance = condition.getParameter("distance").toString();
-
-            if(circleLatitude != null && circleLongitude != null && distance 
!= null) {
-                return FilterBuilders.geoDistanceFilter("location")
-                        .lat(circleLatitude)
-                        .lon(circleLongitude)
-                        .distance(distance);
-            }
-        } else if("rectangle".equals(type)) {
-            Double rectLatitudeNE = (Double) 
condition.getParameter("rectLatitudeNE");
-            Double rectLongitudeNE = (Double) 
condition.getParameter("rectLongitudeNE");
-            Double rectLatitudeSW = (Double) 
condition.getParameter("rectLatitudeSW");
-            Double rectLongitudeSW = (Double) 
condition.getParameter("rectLongitudeSW");
-
-            if(rectLatitudeNE != null && rectLongitudeNE != null && 
rectLatitudeSW != null && rectLongitudeSW != null) {
-                return FilterBuilders.geoBoundingBoxFilter("location")
-                        .topLeft(rectLatitudeNE, rectLongitudeNE)
-                        .bottomRight(rectLatitudeSW, rectLongitudeSW);
-            }
-        }
-
-        return null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/GeoLocationByPointSessionConditionEvaluator.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/GeoLocationByPointSessionConditionEvaluator.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/GeoLocationByPointSessionConditionEvaluator.java
deleted file mode 100644
index e4f3b06..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/GeoLocationByPointSessionConditionEvaluator.java
+++ /dev/null
@@ -1,70 +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.oasis_open.contextserver.plugins.baseplugin.conditions;
-
-import org.apache.commons.beanutils.BeanUtils;
-import org.elasticsearch.common.geo.GeoDistance;
-import org.elasticsearch.common.unit.DistanceUnit;
-import org.oasis_open.contextserver.api.Item;
-import org.oasis_open.contextserver.api.conditions.Condition;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluator;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluatorDispatcher;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Map;
-
-public class GeoLocationByPointSessionConditionEvaluator implements 
ConditionEvaluator {
-
-    private static final Logger logger = 
LoggerFactory.getLogger(GeoLocationByPointSessionConditionEvaluator.class.getName());
-
-    @Override
-    public boolean eval(Condition condition, Item item, Map<String, Object> 
context, ConditionEvaluatorDispatcher dispatcher) {
-        try {
-            String type = (String) condition.getParameter("type");
-            Double latitudeProperty = 
Double.parseDouble(BeanUtils.getProperty(item, "properties.location.lat"));
-            Double longitudeProperty = 
Double.parseDouble(BeanUtils.getProperty(item, "properties.location.lon"));
-
-            if("circle".equals(type)) {
-                Double circleLatitude = (Double) 
condition.getParameter("circleLatitude");
-                Double circleLongitude = (Double) 
condition.getParameter("circleLongitude");
-                DistanceUnit.Distance distance = 
DistanceUnit.Distance.parseDistance(condition.getParameter("distance").toString());
-
-                double d = GeoDistance.DEFAULT.calculate(circleLatitude, 
circleLongitude, latitudeProperty, longitudeProperty, distance.unit);
-                return d < distance.value;
-            } else if("rectangle".equals(type)) {
-                Double rectLatitudeNE = (Double) 
condition.getParameter("rectLatitudeNE");
-                Double rectLongitudeNE = (Double) 
condition.getParameter("rectLongitudeNE");
-                Double rectLatitudeSW = (Double) 
condition.getParameter("rectLatitudeSW");
-                Double rectLongitudeSW = (Double) 
condition.getParameter("rectLongitudeSW");
-
-                if(rectLatitudeNE != null && rectLongitudeNE != null && 
rectLatitudeSW != null && rectLongitudeSW != null) {
-                    return latitudeProperty < Math.max(rectLatitudeNE, 
rectLatitudeSW)  &&
-                            latitudeProperty > Math.min(rectLatitudeNE, 
rectLatitudeSW) &&
-                            longitudeProperty < Math.max(rectLongitudeNE, 
rectLongitudeSW) &&
-                            longitudeProperty > Math.min(rectLongitudeNE, 
rectLongitudeSW);
-                }
-            }
-        } catch (Exception e) {
-            logger.debug("Cannot get properties", e);
-        }
-        return false;
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/MatchAllConditionESQueryBuilder.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/MatchAllConditionESQueryBuilder.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/MatchAllConditionESQueryBuilder.java
deleted file mode 100644
index 00975e3..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/MatchAllConditionESQueryBuilder.java
+++ /dev/null
@@ -1,34 +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.oasis_open.contextserver.plugins.baseplugin.conditions;
-
-import org.elasticsearch.index.query.FilterBuilder;
-import org.elasticsearch.index.query.FilterBuilders;
-import org.oasis_open.contextserver.api.conditions.Condition;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilder;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilderDispatcher;
-
-import java.util.Map;
-
-public class MatchAllConditionESQueryBuilder implements 
ConditionESQueryBuilder {
-
-    @Override
-    public FilterBuilder buildFilter(Condition condition, Map<String, Object> 
context, ConditionESQueryBuilderDispatcher dispatcher) {
-        return FilterBuilders.matchAllFilter();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/MatchAllConditionEvaluator.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/MatchAllConditionEvaluator.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/MatchAllConditionEvaluator.java
deleted file mode 100644
index aeed22d..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/MatchAllConditionEvaluator.java
+++ /dev/null
@@ -1,33 +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.oasis_open.contextserver.plugins.baseplugin.conditions;
-
-import org.oasis_open.contextserver.api.Item;
-import org.oasis_open.contextserver.api.conditions.Condition;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluator;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluatorDispatcher;
-
-import java.util.Map;
-
-public class MatchAllConditionEvaluator implements ConditionEvaluator {
-
-    @Override
-    public boolean eval(Condition condition, Item item, Map<String, Object> 
context, ConditionEvaluatorDispatcher dispatcher) {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/NotConditionESQueryBuilder.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/NotConditionESQueryBuilder.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/NotConditionESQueryBuilder.java
deleted file mode 100644
index 5de891c..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/NotConditionESQueryBuilder.java
+++ /dev/null
@@ -1,37 +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.oasis_open.contextserver.plugins.baseplugin.conditions;
-
-import org.elasticsearch.index.query.FilterBuilder;
-import org.elasticsearch.index.query.FilterBuilders;
-import org.oasis_open.contextserver.api.conditions.Condition;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilder;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilderDispatcher;
-
-import java.util.Map;
-
-/**
- * Builder for NOT condition.
- */
-public class NotConditionESQueryBuilder implements ConditionESQueryBuilder {
-
-    public FilterBuilder buildFilter(Condition condition, Map<String, Object> 
context, ConditionESQueryBuilderDispatcher dispatcher) {
-        Condition subCondition = (Condition) 
condition.getParameter("subCondition");
-        return FilterBuilders.notFilter(dispatcher.buildFilter(subCondition, 
context));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/NotConditionEvaluator.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/NotConditionEvaluator.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/NotConditionEvaluator.java
deleted file mode 100644
index 5d7c100..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/NotConditionEvaluator.java
+++ /dev/null
@@ -1,37 +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.oasis_open.contextserver.plugins.baseplugin.conditions;
-
-import org.oasis_open.contextserver.api.Item;
-import org.oasis_open.contextserver.api.conditions.Condition;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluator;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluatorDispatcher;
-
-import java.util.Map;
-
-/**
- * Evaluator for NOT condition.
- */
-public class NotConditionEvaluator implements ConditionEvaluator {
-
-    @Override
-    public boolean eval(Condition condition, Item item, Map<String, Object> 
context, ConditionEvaluatorDispatcher dispatcher) {
-        Condition subCondition = (Condition) 
condition.getParameter("subCondition");
-        return !dispatcher.eval(subCondition, item, context);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/PastEventConditionESQueryBuilder.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/PastEventConditionESQueryBuilder.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/PastEventConditionESQueryBuilder.java
deleted file mode 100644
index 618c909..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/PastEventConditionESQueryBuilder.java
+++ /dev/null
@@ -1,88 +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.oasis_open.contextserver.plugins.baseplugin.conditions;
-
-import org.elasticsearch.index.query.FilterBuilder;
-import org.elasticsearch.index.query.FilterBuilders;
-import org.oasis_open.contextserver.api.Event;
-import org.oasis_open.contextserver.api.Profile;
-import org.oasis_open.contextserver.api.conditions.Condition;
-import org.oasis_open.contextserver.api.services.DefinitionsService;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilder;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilderDispatcher;
-import org.oasis_open.contextserver.persistence.spi.PersistenceService;
-import org.oasis_open.contextserver.persistence.spi.aggregate.TermsAggregate;
-
-import java.util.*;
-
-public class PastEventConditionESQueryBuilder implements 
ConditionESQueryBuilder {
-    private DefinitionsService definitionsService;
-    private PersistenceService persistenceService;
-
-    public void setDefinitionsService(DefinitionsService definitionsService) {
-        this.definitionsService = definitionsService;
-    }
-
-    public void setPersistenceService(PersistenceService persistenceService) {
-        this.persistenceService = persistenceService;
-    }
-
-    public FilterBuilder buildFilter(Condition condition, Map<String, Object> 
context, ConditionESQueryBuilderDispatcher dispatcher) {
-        Condition eventCondition;
-        try {
-            eventCondition = (Condition) 
condition.getParameter("eventCondition");
-        } catch (ClassCastException e) {
-            throw new IllegalArgumentException("Empty eventCondition");
-        }
-        if (eventCondition == null) {
-            throw new IllegalArgumentException("No eventCondition");
-        }
-        List<Condition> l = new ArrayList<Condition>();
-        Condition andCondition = new Condition();
-        
andCondition.setConditionType(definitionsService.getConditionType("booleanCondition"));
-        andCondition.setParameter("operator", "and");
-        andCondition.setParameter("subConditions", l);
-
-        l.add(eventCondition);
-
-        Integer numberOfDays = (Integer) 
condition.getParameter("numberOfDays");
-        if (numberOfDays != null) {
-            Condition numberOfDaysCondition = new Condition();
-            
numberOfDaysCondition.setConditionType(definitionsService.getConditionType("sessionPropertyCondition"));
-            numberOfDaysCondition.setParameter("propertyName", "timeStamp");
-            numberOfDaysCondition.setParameter("comparisonOperator", 
"greaterThan");
-            numberOfDaysCondition.setParameter("propertyValueDateExpr", "now-" 
+ numberOfDays + "d");
-            l.add(numberOfDaysCondition);
-        }
-        //todo : Check behaviour with important number of profiles
-        Set<String> ids = new HashSet<String>();
-        Integer minimumEventCount = 
condition.getParameter("minimumEventCount") == null ? 0 : (Integer) 
condition.getParameter("minimumEventCount");
-        Integer maximumEventCount = 
condition.getParameter("maximumEventCount") == null  ? Integer.MAX_VALUE : 
(Integer) condition.getParameter("maximumEventCount");
-
-        Map<String, Long> res = 
persistenceService.aggregateQuery(andCondition, new 
TermsAggregate("profileId"), Event.ITEM_TYPE);
-        for (Map.Entry<String, Long> entry : res.entrySet()) {
-            if (!entry.getKey().startsWith("_")) {
-                if (entry.getValue() >= minimumEventCount && entry.getValue() 
<= maximumEventCount) {
-                    ids.add(entry.getKey());
-                }
-            }
-        }
-
-        return 
FilterBuilders.idsFilter(Profile.ITEM_TYPE).addIds(ids.toArray(new 
String[ids.size()]));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/PastEventConditionEvaluator.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/PastEventConditionEvaluator.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/PastEventConditionEvaluator.java
deleted file mode 100644
index c61f430..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/PastEventConditionEvaluator.java
+++ /dev/null
@@ -1,104 +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.oasis_open.contextserver.plugins.baseplugin.conditions;
-
-import org.oasis_open.contextserver.api.Event;
-import org.oasis_open.contextserver.api.Item;
-import org.oasis_open.contextserver.api.Profile;
-import org.oasis_open.contextserver.api.conditions.Condition;
-import org.oasis_open.contextserver.api.services.DefinitionsService;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluator;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluatorDispatcher;
-import org.oasis_open.contextserver.persistence.spi.PersistenceService;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public class PastEventConditionEvaluator implements ConditionEvaluator {
-
-    private PersistenceService persistenceService;
-
-    private DefinitionsService definitionsService;
-
-    public void setPersistenceService(PersistenceService persistenceService) {
-        this.persistenceService = persistenceService;
-    }
-
-    public void setDefinitionsService(DefinitionsService definitionsService) {
-        this.definitionsService = definitionsService;
-    }
-
-    @Override
-    public boolean eval(Condition condition, Item item, Map<String, Object> 
context, ConditionEvaluatorDispatcher dispatcher) {
-
-        final Map<String, Object> parameters = condition.getParameterValues();
-
-        Condition eventCondition = (Condition) 
parameters.get("eventCondition");
-
-        long count;
-
-        if (parameters.containsKey("generatedPropertyKey")) {
-            String key = (String) parameters.get("generatedPropertyKey");
-            Profile profile = (Profile) item;
-            Map<String,Object> pastEvents = (Map<String, Object>) 
profile.getSystemProperties().get("pastEvents");
-            if (pastEvents != null) {
-                Number l = (Number) pastEvents.get(key);
-                count = l != null ? l.longValue() : 0L;
-            } else {
-                count = 0;
-            }
-
-        } else {
-            if (eventCondition == null) {
-                throw new IllegalArgumentException("No eventCondition");
-            }
-
-            List<Condition> l = new ArrayList<Condition>();
-            Condition andCondition = new Condition();
-            
andCondition.setConditionType(definitionsService.getConditionType("booleanCondition"));
-            andCondition.setParameter("operator", "and");
-            andCondition.setParameter("subConditions", l);
-
-            l.add(eventCondition);
-
-            Condition profileCondition = new Condition();
-            
profileCondition.setConditionType(definitionsService.getConditionType("sessionPropertyCondition"));
-            profileCondition.setParameter("propertyName", "profileId");
-            profileCondition.setParameter("comparisonOperator", "equals");
-            profileCondition.setParameter("propertyValue", item.getItemId());
-            l.add(profileCondition);
-
-            Integer numberOfDays = (Integer) 
condition.getParameter("numberOfDays");
-            if (numberOfDays != null) {
-                Condition numberOfDaysCondition = new Condition();
-                
numberOfDaysCondition.setConditionType(definitionsService.getConditionType("sessionPropertyCondition"));
-                numberOfDaysCondition.setParameter("propertyName", 
"timeStamp");
-                numberOfDaysCondition.setParameter("comparisonOperator", 
"greaterThan");
-                numberOfDaysCondition.setParameter("propertyValueDateExpr", 
"now-" + numberOfDays + "d");
-                l.add(numberOfDaysCondition);
-            }
-            count = persistenceService.queryCount(andCondition, 
Event.ITEM_TYPE);
-        }
-
-        Integer minimumEventCount = parameters.get("minimumEventCount") == 
null  ? 0 : (Integer) parameters.get("minimumEventCount");
-        Integer maximumEventCount = parameters.get("maximumEventCount") == 
null  ? Integer.MAX_VALUE : (Integer) parameters.get("maximumEventCount");
-
-        return count > 0 && (count >= minimumEventCount && count <= 
maximumEventCount);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
deleted file mode 100644
index 2c082fa..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
+++ /dev/null
@@ -1,137 +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.oasis_open.contextserver.plugins.baseplugin.conditions;
-
-import org.apache.commons.lang3.ObjectUtils;
-import org.elasticsearch.common.base.Function;
-import org.elasticsearch.common.collect.Lists;
-import org.elasticsearch.common.joda.time.DateTime;
-import org.elasticsearch.index.query.FilterBuilder;
-import org.elasticsearch.index.query.FilterBuilders;
-import org.oasis_open.contextserver.api.conditions.Condition;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionContextHelper;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilder;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilderDispatcher;
-
-import java.util.List;
-import java.util.Map;
-
-public class PropertyConditionESQueryBuilder implements 
ConditionESQueryBuilder {
-
-    public PropertyConditionESQueryBuilder() {
-    }
-
-    @Override
-    public FilterBuilder buildFilter(Condition condition, Map<String, Object> 
context, ConditionESQueryBuilderDispatcher dispatcher) {
-        String op = (String) condition.getParameter("comparisonOperator");
-        String name = (String) condition.getParameter("propertyName");
-
-        if(op == null || name == null){
-            throw new IllegalArgumentException("Impossible to build ES filter, 
condition is not valid, comparisonOperator and propertyName properties should 
be provided");
-        }
-
-        String expectedValue = ConditionContextHelper.foldToASCII((String) 
condition.getParameter("propertyValue"));
-        Object expectedValueInteger = 
condition.getParameter("propertyValueInteger");
-        Object expectedValueDate = condition.getParameter("propertyValueDate");
-        Object expectedValueDateExpr = 
condition.getParameter("propertyValueDateExpr");
-
-        List<?> expectedValues = ConditionContextHelper.foldToASCII((List<?>) 
condition.getParameter("propertyValues"));
-        List<?> expectedValuesInteger = (List<?>) 
condition.getParameter("propertyValuesInteger");
-        List<?> expectedValuesDate = (List<?>) 
condition.getParameter("propertyValuesDate");
-        List<?> expectedValuesDateExpr = (List<?>) 
condition.getParameter("propertyValuesDateExpr");
-
-        Object value = 
ObjectUtils.firstNonNull(expectedValue,expectedValueInteger,expectedValueDate,expectedValueDateExpr);
-        @SuppressWarnings("unchecked")
-        List<?> values = 
ObjectUtils.firstNonNull(expectedValues,expectedValuesInteger,expectedValuesDate,expectedValuesDateExpr);
-
-        switch (op) {
-            case "equals":
-                checkRequiredValue(value, name, op, false);
-                return FilterBuilders.termFilter(name, value);
-            case "notEquals":
-                checkRequiredValue(value, name, op, false);
-                return 
FilterBuilders.notFilter(FilterBuilders.termFilter(name, value));
-            case "greaterThan":
-                checkRequiredValue(value, name, op, false);
-                return FilterBuilders.rangeFilter(name).gt(value);
-            case "greaterThanOrEqualTo":
-                checkRequiredValue(value, name, op, false);
-                return FilterBuilders.rangeFilter(name).gte(value);
-            case "lessThan":
-                checkRequiredValue(value, name, op, false);
-                return FilterBuilders.rangeFilter(name).lt(value);
-            case "lessThanOrEqualTo":
-                checkRequiredValue(value, name, op, false);
-                return FilterBuilders.rangeFilter(name).lte(value);
-            case "between":
-                checkRequiredValuesSize(values, name, op, 2);
-                return 
FilterBuilders.rangeFilter(name).gte(values.get(0)).lte(values.get(1));
-            case "exists":
-                return FilterBuilders.existsFilter(name);
-            case "missing":
-                return FilterBuilders.missingFilter(name);
-            case "contains":
-                checkRequiredValue(expectedValue, name, op, false);
-                return FilterBuilders.regexpFilter(name, ".*" + expectedValue 
+ ".*");
-            case "startsWith":
-                checkRequiredValue(expectedValue, name, op, false);
-                return FilterBuilders.prefixFilter(name, expectedValue);
-            case "endsWith":
-                checkRequiredValue(expectedValue, name, op, false);
-                return FilterBuilders.regexpFilter(name, ".*" + expectedValue);
-            case "matchesRegex":
-                checkRequiredValue(expectedValue, name, op, false);
-                return FilterBuilders.regexpFilter(name, expectedValue);
-            case "in":
-                checkRequiredValue(values, name, op, true);
-                return FilterBuilders.inFilter(name, values.toArray());
-            case "notIn":
-                checkRequiredValue(values, name, op, true);
-                return FilterBuilders.notFilter(FilterBuilders.inFilter(name, 
values.toArray()));
-            case "all":
-                checkRequiredValue(values, name, op, true);
-                return FilterBuilders.termsFilter(name, 
values.toArray()).execution("and");
-            case "isDay":
-                checkRequiredValue(value, name, op, false);
-                return getIsSameDayRange(value, name);
-            case "isNotDay":
-                checkRequiredValue(value, name, op, false);
-                return FilterBuilders.notFilter(getIsSameDayRange(value, 
name));
-        }
-        return null;
-    }
-
-    private void checkRequiredValuesSize(List<?> values, String name, String 
operator, int expectedSize) {
-        if(values == null || values.size() != expectedSize) {
-            throw new IllegalArgumentException("Impossible to build ES filter, 
missing " + expectedSize + " values for a condition using comparisonOperator: " 
+ operator + ", and propertyName: " + name);
-        }
-    }
-
-    private void checkRequiredValue(Object value, String name, String 
operator, boolean multiple) {
-        if(value == null) {
-            throw new IllegalArgumentException("Impossible to build ES filter, 
missing value" + (multiple ? "s" : "") + " for condition using 
comparisonOperator: " + operator + ", and propertyName: " + name);
-        }
-    }
-
-    private FilterBuilder getIsSameDayRange (Object value, String name) {
-        DateTime date = new DateTime(value);
-        DateTime dayStart = date.withTimeAtStartOfDay();
-        DateTime dayAfterStart = date.plusDays(1).withTimeAtStartOfDay();
-        return 
FilterBuilders.rangeFilter(name).gte(dayStart.toDate()).lte(dayAfterStart.toDate());
-    }
-}

Reply via email to