Repository: incubator-unomi
Updated Branches:
  refs/heads/master 8806c8f92 -> 4f1ed654b


UNOMI-117 deprecate function and class to prepare tags refactoring


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

Branch: refs/heads/master
Commit: 4f1ed654bb0089510d866b77377875e8604cd9b8
Parents: 8806c8f
Author: dgaillard <dgaill...@jahia.com>
Authored: Tue Aug 8 17:37:05 2017 +0200
Committer: dgaillard <dgaill...@jahia.com>
Committed: Tue Aug 8 17:37:13 2017 +0200

----------------------------------------------------------------------
 .../java/org/apache/unomi/api/PropertyType.java |  9 +++++
 api/src/main/java/org/apache/unomi/api/Tag.java |  3 ++
 .../java/org/apache/unomi/api/ValueType.java    |  9 +++++
 .../unomi/api/services/DefinitionsService.java  | 38 +++++++++++++++++++
 .../unomi/api/services/ProfileService.java      | 12 ++++++
 .../unomi/rest/DefinitionsServiceEndPoint.java  | 14 +++++--
 .../unomi/rest/ProfileServiceEndPoint.java      |  2 +-
 .../java/org/apache/unomi/rest/RESTTag.java     |  3 ++
 .../services/DefinitionsServiceImpl.java        | 40 ++++++++++++++++++++
 .../services/services/GoalsServiceImpl.java     | 12 ++++++
 .../services/services/ProfileServiceImpl.java   | 12 ++++++
 11 files changed, 150 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/4f1ed654/api/src/main/java/org/apache/unomi/api/PropertyType.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/PropertyType.java 
b/api/src/main/java/org/apache/unomi/api/PropertyType.java
index 4d5bf6f..8b9a231 100644
--- a/api/src/main/java/org/apache/unomi/api/PropertyType.java
+++ b/api/src/main/java/org/apache/unomi/api/PropertyType.java
@@ -46,6 +46,7 @@ public class PropertyType extends MetadataItem {
     private Set<String> automaticMappingsFrom = new HashSet<>();
     private Double rank;
     private String mergeStrategy;
+    @Deprecated
     private Set<Tag> tags = new TreeSet<Tag>();
     private Set<String> tagIds = new LinkedHashSet<String>();
     private Boolean multivalued;
@@ -132,8 +133,10 @@ public class PropertyType extends MetadataItem {
      * Retrieves the tags used by this PropertyType.
      *
      * @return the tags used by this PropertyType
+     * @deprecated will be removed in next major release as tag become an open 
string
      */
     @XmlTransient
+    @Deprecated
     public Set<Tag> getTags() {
         return tags;
     }
@@ -142,7 +145,9 @@ public class PropertyType extends MetadataItem {
      * Sets the tags used by this PropertyType.
      *
      * @param tags the tags used by this PropertyType
+     * @deprecated will be removed in next major release as tag become an open 
string
      */
+    @Deprecated
     public void setTags(Set<Tag> tags) {
         this.tags = tags;
     }
@@ -151,8 +156,10 @@ public class PropertyType extends MetadataItem {
      * Retrieves the identifiers of the tags used by this PropertyType.
      *
      * @return the identifiers of the tags used by this PropertyType
+     * @deprecated will be rename to getTags() in next major release as tag 
become an open string
      */
     @XmlElement(name = "tags")
+    @Deprecated
     public Set<String> getTagIds() {
         return tagIds;
     }
@@ -161,7 +168,9 @@ public class PropertyType extends MetadataItem {
      * Sets the identifiers of the tags used by this PropertyType.
      *
      * @param tagIds the identifiers of the tags used by this PropertyType
+     * @deprecated will be rename to setTags(Set<String> tags) in next major 
release as tag become an open string
      */
+    @Deprecated
     public void setTagIds(Set<String> tagIds) {
         this.tagIds = tagIds;
     }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/4f1ed654/api/src/main/java/org/apache/unomi/api/Tag.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/Tag.java 
b/api/src/main/java/org/apache/unomi/api/Tag.java
index 8802786..a751336 100644
--- a/api/src/main/java/org/apache/unomi/api/Tag.java
+++ b/api/src/main/java/org/apache/unomi/api/Tag.java
@@ -24,7 +24,10 @@ import java.util.TreeSet;
 
 /**
  * A tag to help categorize entities. A tag can have sub-tags.
+ *
+ * @deprecated tags will be an open string in next major release
  */
+@Deprecated
 public class Tag implements PluginType, Comparable<Tag> {
 
     private Set<Tag> subTags = new TreeSet<>();

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/4f1ed654/api/src/main/java/org/apache/unomi/api/ValueType.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/ValueType.java 
b/api/src/main/java/org/apache/unomi/api/ValueType.java
index b2fa5f1..d56f7aa 100644
--- a/api/src/main/java/org/apache/unomi/api/ValueType.java
+++ b/api/src/main/java/org/apache/unomi/api/ValueType.java
@@ -34,6 +34,7 @@ public class ValueType implements PluginType {
     private String nameKey;
     private String descriptionKey;
     private long pluginId;
+    @Deprecated
     private Set<Tag> tags = new TreeSet<>();
     private Set<String> tagIds = new LinkedHashSet<>();
 
@@ -125,8 +126,10 @@ public class ValueType implements PluginType {
      * Retrieves the tags used by this ValueType.
      *
      * @return the tags used by this ValueType
+     * @deprecated will be removed in next major release as tag become an open 
string
      */
     @XmlTransient
+    @Deprecated
     public Set<Tag> getTags() {
         return tags;
     }
@@ -135,7 +138,9 @@ public class ValueType implements PluginType {
      * Sets the tags used by this ValueType.
      *
      * @param tags the tags used by this ValueType
+     * @deprecated will be removed in next major release as tag become an open 
string
      */
+    @Deprecated
     public void setTags(Set<Tag> tags) {
         this.tags = tags;
     }
@@ -144,8 +149,10 @@ public class ValueType implements PluginType {
      * Retrieves the identifiers of the tags used by this ValueType.
      *
      * @return the identifiers of the tags used by this ValueType
+     * @deprecated will be rename to getTags() in next major release as tag 
become an open string
      */
     @XmlElement(name = "tags")
+    @Deprecated
     public Set<String> getTagIds() {
         return tagIds;
     }
@@ -154,7 +161,9 @@ public class ValueType implements PluginType {
      * Sets the identifiers of the tags used by this ValueType.
      *
      * @param tagIds the identifiers of the tags used by this ValueType
+     * @deprecated will be rename to setTags(Set<String> tags) in next major 
release as tag become an open string
      */
+    @Deprecated
     public void setTagIds(Set<String> tagIds) {
         this.tagIds = tagIds;
     }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/4f1ed654/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java
----------------------------------------------------------------------
diff --git 
a/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java 
b/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java
index 221b3ad..ca1f3da 100644
--- a/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java
@@ -38,14 +38,18 @@ public interface DefinitionsService {
      * Retrieves all known tags.
      *
      * @return the set of all known tags
+     * @deprecated will be removed in next major release as tag become an open 
string
      */
+    @Deprecated
     Set<Tag> getAllTags();
 
     /**
      * Retrieves the set of all root tags from which all other tags are 
derived via sub-tags.
      *
      * @return the set of all root tags
+     * @deprecated will be removed in next major release as tag become an open 
string
      */
+    @Deprecated
     Set<Tag> getRootTags();
 
     /**
@@ -53,13 +57,17 @@ public interface DefinitionsService {
      *
      * @param tagId the identifier of the tag to retrieve
      * @return the tag with the specified identifier
+     * @deprecated will be removed in next major release as tag become an open 
string
      */
+    @Deprecated
     Tag getTag(String tagId);
 
     /**
      * Add a new tag to the list of tags
      * @param tag the tag to add
+     * @deprecated will be removed in next major release as tag become an open 
string
      */
+    @Deprecated
     void addTag(Tag tag);
 
     /**
@@ -75,10 +83,20 @@ public interface DefinitionsService {
      * @param tag                the tag marking the condition types we want 
to retrieve
      * @param includeFromSubtags {@code true} if we want to also include 
condition types marked by sub-tags of the specified tag
      * @return the set of condition types with the specified tag (and its 
sub-tags, if specified)
+     * @deprecated will be replace by {@link #getConditionTypesByTag(String)}
      */
+    @Deprecated
     Set<ConditionType> getConditionTypesByTag(Tag tag, boolean 
includeFromSubtags);
 
     /**
+     * Retrieves the set of condition types with the specified tag also 
retrieving condition types from sub-tags if so specified.
+     *
+     * @param tag                the tag marking the condition types we want 
to retrieve
+     * @return the set of condition types with the specified tag (and its 
sub-tags, if specified)
+     */
+    Set<ConditionType> getConditionTypesByTag(String tag);
+
+    /**
      * Retrieves the condition type associated with the specified identifier.
      *
      * @param id the identifier of the condition type to retrieve
@@ -113,10 +131,20 @@ public interface DefinitionsService {
      * @param tag                the tag marking the action types we want to 
retrieve
      * @param includeFromSubtags {@code true} if we want to also include 
action types marked by sub-tags of the specified tag
      * @return the set of action types with the specified tag (and its 
sub-tags, if specified)
+     * @deprecated will be replace by {@link #getActionTypeByTag(String)}
      */
+    @Deprecated
     Set<ActionType> getActionTypeByTag(Tag tag, boolean includeFromSubtags);
 
     /**
+     * Retrieves the set of action types with the specified tag also 
retrieving action types from sub-tags if so specified.
+     *
+     * @param tag                the tag marking the action types we want to 
retrieve
+     * @return the set of action types with the specified tag (and its 
sub-tags, if specified)
+     */
+    Set<ActionType> getActionTypeByTag(String tag);
+
+    /**
      * Retrieves the action type associated with the specified identifier.
      *
      * @param id the identifier of the action type to retrieve
@@ -151,10 +179,20 @@ public interface DefinitionsService {
      * @param tag                the tag marking the value types we want to 
retrieve
      * @param includeFromSubtags {@code true} if we want to also include value 
types marked by sub-tags of the specified tag
      * @return the set of value types with the specified tag (and its 
sub-tags, if specified)
+     * @deprecated will be replace by {@link #getValueTypeByTag(String)}
      */
+    @Deprecated
     Set<ValueType> getValueTypeByTag(Tag tag, boolean includeFromSubtags);
 
     /**
+     * Retrieves the set of value types with the specified tag also retrieving 
value types from sub-tags if so specified.
+     *
+     * @param tag                the tag marking the value types we want to 
retrieve
+     * @return the set of value types with the specified tag (and its 
sub-tags, if specified)
+     */
+    Set<ValueType> getValueTypeByTag(String tag);
+
+    /**
      * Retrieves the value type associated with the specified identifier.
      *
      * @param id the identifier of the value type to retrieve

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/4f1ed654/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
----------------------------------------------------------------------
diff --git 
a/api/src/main/java/org/apache/unomi/api/services/ProfileService.java 
b/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
index f400746..e7e2369 100644
--- a/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
@@ -262,10 +262,22 @@ public interface ProfileService {
      * @param tag                the tag name marking property types we want 
to retrieve
      * @param includeFromSubtags {@code true} if sub-tags of the specified tag 
should also be considered, {@code false} otherwise
      * @return a Set of the property types with the specified tag
+     * @deprecated will be replace by {@link #getPropertyTypeByTag(String)} in 
next major release
      */
+    @Deprecated
     Set<PropertyType> getPropertyTypeByTag(String tag, boolean 
includeFromSubtags);
 
     /**
+     * Retrieves all property types with the specified tag also retrieving 
property types with sub-tags of the specified tag if so specified.
+     *
+     * TODO: move to a different class
+     *
+     * @param tag                the tag name marking property types we want 
to retrieve
+     * @return a Set of the property types with the specified tag
+     */
+    Set<PropertyType> getPropertyTypeByTag(String tag);
+
+    /**
      * TODO
      */
     String getPropertyTypeMapping(String fromPropertyTypeId);

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/4f1ed654/rest/src/main/java/org/apache/unomi/rest/DefinitionsServiceEndPoint.java
----------------------------------------------------------------------
diff --git 
a/rest/src/main/java/org/apache/unomi/rest/DefinitionsServiceEndPoint.java 
b/rest/src/main/java/org/apache/unomi/rest/DefinitionsServiceEndPoint.java
index ae660ea..4337ccd 100644
--- a/rest/src/main/java/org/apache/unomi/rest/DefinitionsServiceEndPoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/DefinitionsServiceEndPoint.java
@@ -64,9 +64,11 @@ public class DefinitionsServiceEndPoint {
      *
      * @param language the language to use to localize
      * @return the set of all known tags
+     * @deprecated will be removed in next major release as tag become an open 
string
      */
     @GET
     @Path("/tags")
+    @Deprecated
     public Collection<RESTTag> getAllTags(@HeaderParam("Accept-Language") 
String language) {
         return 
localizationHelper.generateTags(definitionsService.getAllTags(), language);
     }
@@ -76,9 +78,11 @@ public class DefinitionsServiceEndPoint {
      *
      * @param language the language to use to localize.
      * @return the set of all root tags
+     * @deprecated will be removed in next major release as tag become an open 
string
      */
     @GET
     @Path("/rootTags")
+    @Deprecated
     public Collection<RESTTag> getRootTags(@HeaderParam("Accept-Language") 
String language) {
         return 
localizationHelper.generateTags(definitionsService.getRootTags(), language);
     }
@@ -90,9 +94,11 @@ public class DefinitionsServiceEndPoint {
      * @param tagId          the identifier of the tag to retrieve
      * @param filterHidden {@code true} if hidden sub-tags should be filtered 
out, {@code false} otherwise
      * @return the tag with the specified identifier
+     * @deprecated will be removed in next major release as tag become an open 
string
      */
     @GET
     @Path("/tags/{tagId}")
+    @Deprecated
     public RESTTag getTag(@PathParam("tagId") String tagId, 
@QueryParam("filterHidden") @DefaultValue("false") boolean filterHidden, 
@HeaderParam("Accept-Language") String language) {
         Tag tag = definitionsService.getTag(tagId);
         if (tag == null) {
@@ -104,9 +110,11 @@ public class DefinitionsServiceEndPoint {
     /**
      * Add a new tag to the list of tags
      * @param tag the tag to add
+     * @deprecated will be removed in next major release as tag become an open 
string
      */
     @POST
     @Path("/tags")
+    @Deprecated
     public void addTag(Tag tag) {
         definitionsService.addTag(tag);
     }
@@ -134,7 +142,7 @@ public class DefinitionsServiceEndPoint {
      */
     @GET
     @Path("/conditions/tags/{tagId}")
-    public Collection<RESTConditionType> 
getConditionTypesByTag(@PathParam("tagId") String tags, 
@QueryParam("recursive") @DefaultValue("false") boolean recursive, 
@HeaderParam("Accept-Language") String language) {
+    public Collection<RESTConditionType> 
getConditionTypesByTag(@PathParam("tagId") String tags, @Deprecated 
@QueryParam("recursive") @DefaultValue("false") boolean recursive, 
@HeaderParam("Accept-Language") String language) {
         String[] tagsArray = tags.split(",");
         Set<ConditionType> results = new LinkedHashSet<>();
         for (String s : tagsArray) {
@@ -205,7 +213,7 @@ public class DefinitionsServiceEndPoint {
      */
     @GET
     @Path("/actions/tags/{tagId}")
-    public Collection<RESTActionType> getActionTypeByTag(@PathParam("tagId") 
String tags, @QueryParam("recursive") @DefaultValue("false") boolean recursive, 
@HeaderParam("Accept-Language") String language) {
+    public Collection<RESTActionType> getActionTypeByTag(@PathParam("tagId") 
String tags, @Deprecated @QueryParam("recursive") @DefaultValue("false") 
boolean recursive, @HeaderParam("Accept-Language") String language) {
         String[] tagsArray = tags.split(",");
         Set<ActionType> results = new LinkedHashSet<>();
         for (String s : tagsArray) {
@@ -275,7 +283,7 @@ public class DefinitionsServiceEndPoint {
      */
     @GET
     @Path("/values/tags/{tagId}")
-    public Collection<RESTValueType> getValueTypeByTag(@PathParam("tagId") 
String tags, @QueryParam("recursive") @DefaultValue("false") boolean recursive, 
@HeaderParam("Accept-Language") String language) {
+    public Collection<RESTValueType> getValueTypeByTag(@PathParam("tagId") 
String tags, @Deprecated @QueryParam("recursive") @DefaultValue("false") 
boolean recursive, @HeaderParam("Accept-Language") String language) {
         String[] tagsArray = tags.split(",");
         Set<ValueType> results = new LinkedHashSet<>();
         for (String s : tagsArray) {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/4f1ed654/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java
----------------------------------------------------------------------
diff --git 
a/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java 
b/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java
index 3b234b2..1454afe 100644
--- a/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java
@@ -497,7 +497,7 @@ public class ProfileServiceEndPoint {
      */
     @GET
     @Path("/properties/tags/{tagId}")
-    public Collection<PropertyType> getPropertyTypeByTag(@PathParam("tagId") 
String tags, @QueryParam("recursive") @DefaultValue("false") boolean recursive, 
@HeaderParam("Accept-Language") String language) {
+    public Collection<PropertyType> getPropertyTypeByTag(@PathParam("tagId") 
String tags, @Deprecated @QueryParam("recursive") @DefaultValue("false") 
boolean recursive, @HeaderParam("Accept-Language") String language) {
         String[] tagsArray = tags.split(",");
         Set<PropertyType> results = new LinkedHashSet<>();
         for (String s : tagsArray) {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/4f1ed654/rest/src/main/java/org/apache/unomi/rest/RESTTag.java
----------------------------------------------------------------------
diff --git a/rest/src/main/java/org/apache/unomi/rest/RESTTag.java 
b/rest/src/main/java/org/apache/unomi/rest/RESTTag.java
index 07cf11c..da1c394 100644
--- a/rest/src/main/java/org/apache/unomi/rest/RESTTag.java
+++ b/rest/src/main/java/org/apache/unomi/rest/RESTTag.java
@@ -24,7 +24,10 @@ import java.util.TreeSet;
 
 /**
  * A representation of a {@link Tag} better suited for definitions.
+ *
+ * @deprecated tags will be an open string in next major release
  */
+@Deprecated
 public class RESTTag {
     private String id;
     private String name;

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/4f1ed654/services/src/main/java/org/apache/unomi/services/services/DefinitionsServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/services/src/main/java/org/apache/unomi/services/services/DefinitionsServiceImpl.java
 
b/services/src/main/java/org/apache/unomi/services/services/DefinitionsServiceImpl.java
index caaadf5..4771eee 100644
--- 
a/services/src/main/java/org/apache/unomi/services/services/DefinitionsServiceImpl.java
+++ 
b/services/src/main/java/org/apache/unomi/services/services/DefinitionsServiceImpl.java
@@ -122,6 +122,7 @@ public class DefinitionsServiceImpl implements 
DefinitionsService, SynchronousBu
         logger.info("Definitions service shutdown.");
     }
 
+    @Deprecated
     private void loadPredefinedTags(BundleContext bundleContext) {
         Enumeration<URL> predefinedTagEntries = 
bundleContext.getBundle().findEntries("META-INF/cxs/tags", "*.json", true);
         if (predefinedTagEntries == null) {
@@ -233,19 +234,23 @@ public class DefinitionsServiceImpl implements 
DefinitionsService, SynchronousBu
 
     }
 
+    @Deprecated
     public Set<Tag> getAllTags() {
         return new HashSet<Tag>(tags.values());
     }
 
+    @Deprecated
     public Set<Tag> getRootTags() {
         return rootTags;
     }
 
+    @Deprecated
     public Tag getTag(String tagId) {
         Tag completeTag = tags.get(tagId);
         return completeTag;
     }
 
+    @Deprecated
     public void addTag(Tag tag) {
         tag.setPluginId(bundleContext.getBundle().getBundleId());
         tags.put(tag.getId(), tag);
@@ -267,6 +272,7 @@ public class DefinitionsServiceImpl implements 
DefinitionsService, SynchronousBu
         return all;
     }
 
+    @Deprecated
     public Set<ConditionType> getConditionTypesByTag(Tag tag, boolean 
includeFromSubtags) {
         Set<ConditionType> conditionTypes = new LinkedHashSet<ConditionType>();
         List<ConditionType> directConditionTypes = 
persistenceService.query("metadata.tags",tag.getId(),null, ConditionType.class);
@@ -285,6 +291,19 @@ public class DefinitionsServiceImpl implements 
DefinitionsService, SynchronousBu
         return conditionTypes;
     }
 
+    public Set<ConditionType> getConditionTypesByTag(String tag) {
+        Set<ConditionType> conditionTypes = new LinkedHashSet<ConditionType>();
+        List<ConditionType> directConditionTypes = 
persistenceService.query("metadata.tags", tag,null, ConditionType.class);
+        for (ConditionType type : directConditionTypes) {
+            if (type.getParentCondition() != null) {
+                ParserHelper.resolveConditionType(this, 
type.getParentCondition());
+            }
+        }
+        conditionTypes.addAll(directConditionTypes);
+
+        return conditionTypes;
+    }
+
     public ConditionType getConditionType(String id) {
         if (id == null) {
             return null;
@@ -314,6 +333,7 @@ public class DefinitionsServiceImpl implements 
DefinitionsService, SynchronousBu
         return persistenceService.getAllItems(ActionType.class);
     }
 
+    @Deprecated
     public Set<ActionType> getActionTypeByTag(Tag tag, boolean 
includeFromSubtags) {
         Set<ActionType> actionTypes = new LinkedHashSet<ActionType>();
         List<ActionType> directActionTypes = 
persistenceService.query("metadata.tags",tag.getId(),null, ActionType.class);
@@ -327,6 +347,14 @@ public class DefinitionsServiceImpl implements 
DefinitionsService, SynchronousBu
         return actionTypes;
     }
 
+    public Set<ActionType> getActionTypeByTag(String tag) {
+        Set<ActionType> actionTypes = new LinkedHashSet<ActionType>();
+        List<ActionType> directActionTypes = 
persistenceService.query("metadata.tags", tag,null, ActionType.class);
+        actionTypes.addAll(directActionTypes);
+
+        return actionTypes;
+    }
+
     public ActionType getActionType(String id) {
         ActionType type = actionTypeById.get(id);
         if (type == null) {
@@ -350,6 +378,7 @@ public class DefinitionsServiceImpl implements 
DefinitionsService, SynchronousBu
         return valueTypeById.values();
     }
 
+    @Deprecated
     public Set<ValueType> getValueTypeByTag(Tag tag, boolean 
includeFromSubtags) {
         Set<ValueType> valueTypes = new LinkedHashSet<ValueType>();
         Set<ValueType> directValueTypes = valueTypeByTag.get(tag);
@@ -365,6 +394,17 @@ public class DefinitionsServiceImpl implements 
DefinitionsService, SynchronousBu
         return valueTypes;
     }
 
+    public Set<ValueType> getValueTypeByTag(String tag) {
+        Set<ValueType> valueTypes = new LinkedHashSet<ValueType>();
+        for (Tag legacyTag : valueTypeByTag.keySet()) {
+            if (legacyTag.getId().equals(tag)) {
+                valueTypes.addAll(valueTypeByTag.get(legacyTag));
+            }
+        }
+
+        return valueTypes;
+    }
+
     public ValueType getValueType(String id) {
         return valueTypeById.get(id);
     }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/4f1ed654/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java
 
b/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java
index ac6a9d2..e67d534 100644
--- 
a/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java
+++ 
b/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java
@@ -540,6 +540,7 @@ public class GoalsServiceImpl implements GoalsService, 
SynchronousBundleListener
         return report;
     }
 
+    @Deprecated
     public Set<Goal> getGoalByTag(Tag tag, boolean recursive) {
         Set<Goal> goals = new LinkedHashSet<>();
         Set<Goal> directGoals = goalByTag.get(tag);
@@ -555,6 +556,17 @@ public class GoalsServiceImpl implements GoalsService, 
SynchronousBundleListener
         return goals;
     }
 
+    public Set<Goal> getGoalByTag(String tag) {
+        Set<Goal> goals = new LinkedHashSet<>();
+        for (Tag legacyTag : goalByTag.keySet()) {
+            if (legacyTag.getId().equals(tag)) {
+                goals.addAll(goalByTag.get(legacyTag));
+            }
+        }
+
+        return goals;
+    }
+
     // Campaign Event management methods
     @Override
     public PartialList<CampaignEvent> getEvents(Query query) {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/4f1ed654/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java
 
b/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java
index 4aed515..111ffca 100644
--- 
a/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java
+++ 
b/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java
@@ -634,6 +634,7 @@ public class ProfileServiceImpl implements ProfileService, 
SynchronousBundleList
         return propertyTypes;
     }
 
+    @Deprecated
     public Set<PropertyType> getPropertyTypeByTag(String tagId, boolean 
includeFromSubtags) {
         Set<PropertyType> propertyTypes = new LinkedHashSet<PropertyType>();
         Collection<PropertyType> directPropertyTypes = 
persistenceService.query("tags", tagId, "rank", PropertyType.class);
@@ -653,6 +654,17 @@ public class ProfileServiceImpl implements ProfileService, 
SynchronousBundleList
         return propertyTypes;
     }
 
+    public Set<PropertyType> getPropertyTypeByTag(String tag) {
+        Set<PropertyType> propertyTypes = new LinkedHashSet<PropertyType>();
+        Collection<PropertyType> directPropertyTypes = 
persistenceService.query("tags", tag, "rank", PropertyType.class);
+
+        if (directPropertyTypes != null) {
+            propertyTypes.addAll(directPropertyTypes);
+        }
+
+        return propertyTypes;
+    }
+
     public Collection<PropertyType> getPropertyTypeByMapping(String 
propertyName) {
         Collection<PropertyType> l = new TreeSet<PropertyType>(new 
Comparator<PropertyType>() {
             @Override

Reply via email to