Project Wonder 5.0

er.taggable
Class ERTaggableEntity<T extends ERXGenericRecord>

java.lang.Object
  extended by er.taggable.ERTaggableEntity<T>
Type Parameters:
T - the java class of the entity that this ERTaggableEntity is associated with

public class ERTaggableEntity<T extends ERXGenericRecord>
extends java.lang.Object

ERTaggableEntity provides entity-level tag management and fetching methods. Typically you would provide a cover method from your entity class to an instance of an ERTaggableEntity: public class Person extends _Person { ... public static ERTaggableEntity taggableEntity() { return ERTaggableEntity.taggableEntity(Person.ENTITY_NAME); } }

Author:
mschrag

Field Summary
static java.lang.String DEFAULT_TAGS_RELATIONSHIP_NAME
          The default name of the flattened to-many relationship to the tag entity.
static java.lang.String ERTAGGABLE_KEY
          The key stored in entity userInfo that flags an entity as taggable.
static java.lang.String ERTAGGABLE_TAG_ENTITY_KEY
          The key stored in entity userInfo that specifies the name of the tag entity.
static java.lang.String ERTAGGABLE_TAG_RELATIONSHIP_KEY
          The key stored in entity userInfo that specifies the name of the tag relationship.
 
Constructor Summary
protected ERTaggableEntity(com.webobjects.eoaccess.EOEntity entity)
          Constructs an ERTaggableEntity.
 
Method Summary
protected  com.webobjects.eocontrol.EOQualifier additionalTagCountQualifier()
           
<U> com.webobjects.foundation.NSDictionary<java.lang.String,U>
cloud(com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.foundation.NSArray<U> categoryList)
          Takes the result of a tagCount call and an array of categories and distributes the entries in the tagCount hash evenly across the categories based on the count value for each tag.
<U> com.webobjects.foundation.NSDictionary<java.lang.String,U>
cloud(com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Integer> tagHash, com.webobjects.foundation.NSArray<U> categoryList)
          Takes the result of a tagCount call and an array of categories and distributes the entries in the tagCount hash evenly across the categories based on the count value for each tag.
 int countUniqueTaggedWith(com.webobjects.eocontrol.EOEditingContext editingContext, ERTag.Inclusion inclusion, java.lang.Object tags)
          This method returns a simple count of the number of distinct objects which match the tags provided.
 ERTag createTagNamed(com.webobjects.eocontrol.EOEditingContext editingContext, java.lang.String tagName)
          Creates a tag with the given name.
 boolean equals(java.lang.Object obj)
           
static com.webobjects.foundation.NSDictionary<com.webobjects.eoaccess.EOEntity,com.webobjects.foundation.NSArray<? extends ERXGenericRecord>> fetchAllTaggedWith(com.webobjects.eocontrol.EOEditingContext editingContext, ERTag.Inclusion inclusion, int limit, java.lang.Object tags)
          Fetches all the EOs of all taggable entities that are associated with the given tags.
static com.webobjects.foundation.NSDictionary<com.webobjects.eoaccess.EOEntity,com.webobjects.foundation.NSArray<? extends ERXGenericRecord>> fetchAllTaggedWith(com.webobjects.eocontrol.EOEditingContext editingContext, ERTag.Inclusion inclusion, java.lang.Object tags)
          Fetches all the EOs of all taggable entities that are associated with the given tags (unlimited).
static com.webobjects.foundation.NSDictionary<com.webobjects.eoaccess.EOEntity,com.webobjects.foundation.NSArray<? extends ERXGenericRecord>> fetchAllTaggedWith(com.webobjects.eocontrol.EOEditingContext editingContext, java.lang.Object tags)
          Fetches all the EOs of all taggable entities that are associated with all of the given tags (unlimited).
 com.webobjects.foundation.NSArray<java.lang.String> fetchAllTags(com.webobjects.eocontrol.EOEditingContext editingContext)
          Returns an array of all of the available tags in the system.
 com.webobjects.foundation.NSArray<java.lang.String> fetchRelatedTags(com.webobjects.eocontrol.EOEditingContext editingContext, java.lang.Object tags)
          Finds other tags that are related to the tags passed through the tags parameter, by finding common records that share similar sets of tags.
 com.webobjects.foundation.NSArray<T> fetchTaggedWith(com.webobjects.eocontrol.EOEditingContext editingContext, ERTag.Inclusion inclusion, int limit, java.lang.Object tags)
          Fetches the list of objects of this entity type that are tagged with the given tags.
 com.webobjects.foundation.NSArray<T> fetchTaggedWith(com.webobjects.eocontrol.EOEditingContext editingContext, ERTag.Inclusion inclusion, int limit, java.lang.Object tags, com.webobjects.eocontrol.EOQualifier additionalQualifier)
          Fetches the list of objects of this entity type that are tagged with the given tags.
 com.webobjects.foundation.NSArray<T> fetchTaggedWith(com.webobjects.eocontrol.EOEditingContext editingContext, ERTag.Inclusion inclusion, java.lang.Object tags)
          Fetches the list of objects of this entity type that are tagged with the given tags with unlimited results.
 com.webobjects.foundation.NSArray<T> fetchTaggedWith(com.webobjects.eocontrol.EOEditingContext editingContext, java.lang.Object tags)
          Fetches the list of objects of this entity type that are tagged with all of the given tags with unlimited results.
 ERTag fetchTagNamed(com.webobjects.eocontrol.EOEditingContext editingContext, java.lang.String tagName, boolean createIfMissing)
          Fetches the tag with the given name.
 com.webobjects.foundation.NSArray<java.lang.String> fetchTagsLike(com.webobjects.eocontrol.EOEditingContext editingContext, java.lang.String startsWith)
          Returns an array of all of the available tags in the system that start with the given string.
 int hashCode()
           
static boolean isTaggable(com.webobjects.eoaccess.EOEntity entity)
          Returns whether or not the given entity has been registered as taggable.
static boolean isWhitespaceSeparator(java.lang.String separator)
          Returns whether or not the given separator contains whitespace (and should be escaped).
 ERTagNormalizer normalizer()
          Returns the tag normalizer for this entity.
static com.webobjects.eoaccess.EOEntity registerTaggable(com.webobjects.eoaccess.EOEntity entity)
          Registers the given entity as taggable.
static com.webobjects.eoaccess.EOEntity registerTaggable(com.webobjects.eoaccess.EOEntity entity, java.lang.String tagsRelationshipName)
          Registers the given entity as taggable.
static com.webobjects.eoaccess.EOEntity registerTaggable(com.webobjects.eoaccess.EOEntity entity, java.lang.String tagsRelationshipName, com.webobjects.eoaccess.EOEntity tagEntity, java.lang.Class<? extends ERTaggableEntity<?>> taggableEntity)
          Registers the given entity as taggable.
static com.webobjects.eoaccess.EOEntity registerTaggable(java.lang.String entityName)
          Registers the given entity name in the default model group as taggable.
static com.webobjects.eoaccess.EOEntity registerTaggable(java.lang.String entityName, java.lang.Class<? extends ERTaggableEntity<?>> taggableEntity)
          Registers the given entity name in the default model group as taggable.
 void removeTags(com.webobjects.eocontrol.EOEditingContext editingContext, java.lang.Object tags)
          Remove all of the tags from instances of this entity type.
 void replaceTags(com.webobjects.eocontrol.EOEditingContext editingContext, ERTag.Inclusion inclusion, java.lang.Object oldTags, java.lang.Object newTags)
          Looks for items with oldTags and replaces them with all of newTags.
 void setNormalizer(ERTagNormalizer normalizer)
          Sets the tag normalizer for this entity.
static void setTaggableEntityForEntityNamed(java.lang.Class<? extends ERTaggableEntity<?>> taggableEntity, java.lang.String entityName)
          Sets the taggable entity class for the given entity name.
 com.webobjects.foundation.NSArray<java.lang.String> splitTagNames(java.lang.Object tags)
          Splits the given "tags" object (String, array of Strings, etc) into an array of normalized tag strings.
 com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Integer> tagCount(com.webobjects.eocontrol.EOEditingContext editingContext)
          This method counts the number of times the tags have been applied to your objects and, by default, returns a dictionary in the form of { 'tag_name' => count, ...
 com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Integer> tagCount(com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.eocontrol.EOQualifier additionalQualifier)
          This method counts the number of times the tags have been applied to your objects and, by default, returns a dictionary in the form of { 'tag_name' => count, ...
 com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Integer> tagCount(com.webobjects.eocontrol.EOEditingContext editingContext, int limit)
          This method counts the number of times the tags have been applied to your objects and, by default, returns a dictionary in the form of { 'tag_name' => count, ...
 com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Integer> tagCount(com.webobjects.eocontrol.EOEditingContext editingContext, int limit, com.webobjects.eocontrol.EOQualifier additionalQualifier)
          This method counts the number of times the tags have been applied to your objects and, by default, returns a dictionary in the form of { 'tag_name' => count, ...
 com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Integer> tagCount(com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.foundation.NSSelector selector, int count, int limit)
          This method counts the number of times the tags have been applied to your objects and, by default, returns a dictionary in the form of { 'tag_name' => count, ...
 com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Integer> tagCount(com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.foundation.NSSelector selector, int count, int limit, com.webobjects.eocontrol.EOQualifier additionalQualifier)
          This method counts the number of times the tags have been applied to your objects and, by default, returns a dictionary in the form of { 'tag_name' => count, ...
 ERTaggable<T> taggable(T eo)
          Factory method for generating an ERTaggable wrapper for an EO.
static com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOEntity> taggableEntities()
          Returns an array of taggable entities.
static
<T extends ERXGenericRecord>
ERTaggableEntity<T>
taggableEntity(com.webobjects.eoaccess.EOEntity entity)
          Constructs an ERTaggableEntity.
static
<T extends ERXGenericRecord>
ERTaggableEntity<T>
taggableEntity(java.lang.String entityName)
          Constructs an ERTaggableEntity.
static
<T extends ERXGenericRecord>
ERTaggableEntity<T>
taggableEntity(T eo)
          Shortcut for getting an ERTaggableEntity for an EO.
 com.webobjects.eoaccess.EORelationship tagsRelationship()
          Returns the tags relationship for this entity.
static com.webobjects.eoaccess.EORelationship tagsRelationshipForEntity(com.webobjects.eoaccess.EOEntity entity, com.webobjects.eoaccess.EOEntity tagEntity)
          Returns the flattened to-many relationship from the taggable entity to the given tag entity.
 java.lang.String tagsRelationshipName()
          Returns the name of the tags relationship for this entity.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERTAGGABLE_KEY

public static final java.lang.String ERTAGGABLE_KEY
The key stored in entity userInfo that flags an entity as taggable.

See Also:
Constant Field Values

ERTAGGABLE_TAG_ENTITY_KEY

public static final java.lang.String ERTAGGABLE_TAG_ENTITY_KEY
The key stored in entity userInfo that specifies the name of the tag entity.

See Also:
Constant Field Values

ERTAGGABLE_TAG_RELATIONSHIP_KEY

public static final java.lang.String ERTAGGABLE_TAG_RELATIONSHIP_KEY
The key stored in entity userInfo that specifies the name of the tag relationship.

See Also:
Constant Field Values

DEFAULT_TAGS_RELATIONSHIP_NAME

public static final java.lang.String DEFAULT_TAGS_RELATIONSHIP_NAME
The default name of the flattened to-many relationship to the tag entity.

See Also:
Constant Field Values
Constructor Detail

ERTaggableEntity

protected ERTaggableEntity(com.webobjects.eoaccess.EOEntity entity)
Constructs an ERTaggableEntity.

Parameters:
entity - the entity to tag
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

setTaggableEntityForEntityNamed

public static void setTaggableEntityForEntityNamed(java.lang.Class<? extends ERTaggableEntity<?>> taggableEntity,
                                                   java.lang.String entityName)
Sets the taggable entity class for the given entity name. This allows you to override the taggable entity that will be used throughout the framework for any particular entity.

Parameters:
taggableEntity - the taggable entity class
entityName - the name of the entity to associate with

taggableEntity

public static <T extends ERXGenericRecord> ERTaggableEntity<T> taggableEntity(com.webobjects.eoaccess.EOEntity entity)
Constructs an ERTaggableEntity.

Parameters:
entity - the entity to tag

taggableEntity

public static <T extends ERXGenericRecord> ERTaggableEntity<T> taggableEntity(java.lang.String entityName)
Constructs an ERTaggableEntity.

Parameters:
entityName - the name of the entity to tag

taggableEntity

public static <T extends ERXGenericRecord> ERTaggableEntity<T> taggableEntity(T eo)
Shortcut for getting an ERTaggableEntity for an EO.

Type Parameters:
T - the type of the entity
Parameters:
eo - the EO
Returns:
an ERTaggableEntity corresponding to the entity of the EO

fetchAllTaggedWith

public static com.webobjects.foundation.NSDictionary<com.webobjects.eoaccess.EOEntity,com.webobjects.foundation.NSArray<? extends ERXGenericRecord>> fetchAllTaggedWith(com.webobjects.eocontrol.EOEditingContext editingContext,
                                                                                                                                                                        java.lang.Object tags)
Fetches all the EOs of all taggable entities that are associated with all of the given tags (unlimited).

Parameters:
editingContext - the editing context to fetch into
tags - the tags to search (String to tokenize, NSArray, etc)
Returns:
a dictionary mapping entities to an array of matching EO's

fetchAllTaggedWith

public static com.webobjects.foundation.NSDictionary<com.webobjects.eoaccess.EOEntity,com.webobjects.foundation.NSArray<? extends ERXGenericRecord>> fetchAllTaggedWith(com.webobjects.eocontrol.EOEditingContext editingContext,
                                                                                                                                                                        ERTag.Inclusion inclusion,
                                                                                                                                                                        java.lang.Object tags)
Fetches all the EOs of all taggable entities that are associated with the given tags (unlimited).

Parameters:
editingContext - the editing context to fetch into
tags - the tags to search (String to tokenize, NSArray, etc)
inclusion - find matches for ANY tags or ALL tags provided
Returns:
a dictionary mapping entities to an array of matching EO's

fetchAllTaggedWith

public static com.webobjects.foundation.NSDictionary<com.webobjects.eoaccess.EOEntity,com.webobjects.foundation.NSArray<? extends ERXGenericRecord>> fetchAllTaggedWith(com.webobjects.eocontrol.EOEditingContext editingContext,
                                                                                                                                                                        ERTag.Inclusion inclusion,
                                                                                                                                                                        int limit,
                                                                                                                                                                        java.lang.Object tags)
Fetches all the EOs of all taggable entities that are associated with the given tags.

Parameters:
editingContext - the editing context to fetch into
tags - the tags to search (String to tokenize, NSArray, etc)
inclusion - find matches for ANY tags or ALL tags provided
limit - the limit of the number of objects to return (or -1 for unlimited)
Returns:
a dictionary mapping entities to an array of matching EO's

isTaggable

public static boolean isTaggable(com.webobjects.eoaccess.EOEntity entity)
Returns whether or not the given entity has been registered as taggable.

Parameters:
entity - the entity to check
Returns:
true if the entity is taggable, false if not

taggableEntities

public static com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOEntity> taggableEntities()
Returns an array of taggable entities.

Returns:
an array of taggable entities

tagsRelationshipForEntity

public static com.webobjects.eoaccess.EORelationship tagsRelationshipForEntity(com.webobjects.eoaccess.EOEntity entity,
                                                                               com.webobjects.eoaccess.EOEntity tagEntity)
Returns the flattened to-many relationship from the taggable entity to the given tag entity.

Parameters:
entity - the taggable entity
tagEntity - the tag entity
Returns:
the flattened to-many relationship between them (or null if there isn't one)

registerTaggable

public static com.webobjects.eoaccess.EOEntity registerTaggable(java.lang.String entityName,
                                                                java.lang.Class<? extends ERTaggableEntity<?>> taggableEntity)
Registers the given entity name in the default model group as taggable. An entity must be registered as taggable prior to attempting any tagging operations on it. The application constructor is an obvious place to register an entity as taggable. If the entity does not contain a flattened to-many tags relationship, a join entity (between your entity and "ERTag") and a flattened tags relationship (named "tags") will be automatically generated.

Parameters:
entityName - the name of the entity to lookup
taggableEntity - the taggable entity to associate with this taggable
Returns:
the join entity (you can probably ignore this)

registerTaggable

public static com.webobjects.eoaccess.EOEntity registerTaggable(java.lang.String entityName)
Registers the given entity name in the default model group as taggable. An entity must be registered as taggable prior to attempting any tagging operations on it. The application constructor is an obvious place to register an entity as taggable. If the entity does not contain a flattened to-many tags relationship, a join entity (between your entity and "ERTag") and a flattened tags relationship (named "tags") will be automatically generated.

Parameters:
entityName - the name of the entity to lookup
Returns:
the join entity (you can probably ignore this)

registerTaggable

public static com.webobjects.eoaccess.EOEntity registerTaggable(com.webobjects.eoaccess.EOEntity entity)
Registers the given entity as taggable. An entity must be registered as taggable prior to attempting any tagging operations on it. The application constructor is an obvious place to register an entity as taggable. If the entity does not contain a flattened to-many tags relationship, a join entity (between your entity and "ERTag") and a flattened tags relationship (named "tags") will be automatically generated.

Parameters:
entity - the entity to register
Returns:
the join entity (you can probably ignore this)

registerTaggable

public static com.webobjects.eoaccess.EOEntity registerTaggable(com.webobjects.eoaccess.EOEntity entity,
                                                                java.lang.String tagsRelationshipName)
Registers the given entity as taggable. An entity must be registered as taggable prior to attempting any tagging operations on it. The application constructor is an obvious place to register an entity as taggable. If the entity does not contain a flattened to-many tags relationship, a join entity and a flattened tags relationship will be automatically generated.

Parameters:
entity - the entity to register
tagsRelationshipName - the name of the flattened to-many tags relationship
Returns:
the join entity (you can probably ignore this)

registerTaggable

public static com.webobjects.eoaccess.EOEntity registerTaggable(com.webobjects.eoaccess.EOEntity entity,
                                                                java.lang.String tagsRelationshipName,
                                                                com.webobjects.eoaccess.EOEntity tagEntity,
                                                                java.lang.Class<? extends ERTaggableEntity<?>> taggableEntity)
Registers the given entity as taggable. An entity must be registered as taggable prior to attempting any tagging operations on it. The application constructor is an obvious place to register an entity as taggable. If the entity does not contain a flattened to-many tags relationship, a join entity and a flattened tags relationship will be automatically generated.

Parameters:
entity - the entity to register
tagsRelationshipName - the name of the flattened to-many tags relationship
tagEntity - the ERTag entity that contains the tags for this entity
taggableEntity - the taggable entity to associate with this taggable
Returns:
the join entity (you can probably ignore this)

normalizer

public ERTagNormalizer normalizer()
Returns the tag normalizer for this entity.

Returns:
the tag normalizer for this entity

setNormalizer

public void setNormalizer(ERTagNormalizer normalizer)
Sets the tag normalizer for this entity.

Parameters:
normalizer - the tag normalizer for this entity

fetchTagNamed

public ERTag fetchTagNamed(com.webobjects.eocontrol.EOEditingContext editingContext,
                           java.lang.String tagName,
                           boolean createIfMissing)
Fetches the tag with the given name. If that tag doesn't exist and createIfMissing is true, a tag with that name will be created (otherwise null will be returned). Tags are created in a separate transaction to prevent race conditions with duplicate tag names from rolling back your primary editing context, which means that even if you rollback your editingContext, any tags created during its lifetime will remain.

Parameters:
editingContext - the editing context to fetch into
tagName - the name of the tag to lookup
createIfMissing - if true, missing tags will be created
Returns:
the corresponding ERTag (or null if not found)

createTagNamed

public ERTag createTagNamed(com.webobjects.eocontrol.EOEditingContext editingContext,
                            java.lang.String tagName)
Creates a tag with the given name.

Parameters:
editingContext - the editing context to create within
tagName - the new tag name
Returns:
the created tag

taggable

public ERTaggable<T> taggable(T eo)
Factory method for generating an ERTaggable wrapper for an EO.

Parameters:
eo - the EO to wrap
Returns:
an ERTaggable wrapper

tagsRelationshipName

public java.lang.String tagsRelationshipName()
Returns the name of the tags relationship for this entity.

Returns:
the name of the tags relationship for this entity

tagsRelationship

public com.webobjects.eoaccess.EORelationship tagsRelationship()
Returns the tags relationship for this entity.

Returns:
the tags relationship for this entity

isWhitespaceSeparator

public static boolean isWhitespaceSeparator(java.lang.String separator)
Returns whether or not the given separator contains whitespace (and should be escaped).

Returns:
true if the given separator contains whitespace

splitTagNames

public com.webobjects.foundation.NSArray<java.lang.String> splitTagNames(java.lang.Object tags)
Splits the given "tags" object (String, array of Strings, etc) into an array of normalized tag strings.

Parameters:
tags - the object that contains the tags to split
Returns:
the list of split tag names

fetchTaggedWith

public com.webobjects.foundation.NSArray<T> fetchTaggedWith(com.webobjects.eocontrol.EOEditingContext editingContext,
                                                            java.lang.Object tags)
Fetches the list of objects of this entity type that are tagged with all of the given tags with unlimited results.

Parameters:
editingContext - the editing context to fetch into
tags - the tags to search (String to tokenize, NSArray, etc)
Returns:
the array of matching eos

fetchTaggedWith

public com.webobjects.foundation.NSArray<T> fetchTaggedWith(com.webobjects.eocontrol.EOEditingContext editingContext,
                                                            ERTag.Inclusion inclusion,
                                                            java.lang.Object tags)
Fetches the list of objects of this entity type that are tagged with the given tags with unlimited results.

Parameters:
editingContext - the editing context to fetch into
tags - the tags to search (String to tokenize, NSArray, etc)
inclusion - find matches for ANY tags or ALL tags provided
Returns:
the array of matching eos

fetchTaggedWith

public com.webobjects.foundation.NSArray<T> fetchTaggedWith(com.webobjects.eocontrol.EOEditingContext editingContext,
                                                            ERTag.Inclusion inclusion,
                                                            int limit,
                                                            java.lang.Object tags)
Fetches the list of objects of this entity type that are tagged with the given tags.

Parameters:
editingContext - the editing context to fetch into
tags - the tags to search (String to tokenize, NSArray, etc)
inclusion - find matches for ANY tags or ALL tags provided
limit - limit the number of results to be returned (-1 for unlimited)
Returns:
the array of matching eos

fetchTaggedWith

public com.webobjects.foundation.NSArray<T> fetchTaggedWith(com.webobjects.eocontrol.EOEditingContext editingContext,
                                                            ERTag.Inclusion inclusion,
                                                            int limit,
                                                            java.lang.Object tags,
                                                            com.webobjects.eocontrol.EOQualifier additionalQualifier)
Fetches the list of objects of this entity type that are tagged with the given tags.

Parameters:
editingContext - the editing context to fetch into
tags - the tags to search (String to tokenize, NSArray, etc)
inclusion - find matches for ANY tags or ALL tags provided
limit - limit the number of results to be returned (-1 for unlimited)
additionalQualifier - an additional qualifier to chain in
Returns:
the array of matching eos

removeTags

public void removeTags(com.webobjects.eocontrol.EOEditingContext editingContext,
                       java.lang.Object tags)
Remove all of the tags from instances of this entity type.

Parameters:
editingContext - the editing context to fetch into
tags - the tags to remove (String to tokenize, NSArray, etc)

replaceTags

public void replaceTags(com.webobjects.eocontrol.EOEditingContext editingContext,
                        ERTag.Inclusion inclusion,
                        java.lang.Object oldTags,
                        java.lang.Object newTags)
Looks for items with oldTags and replaces them with all of newTags.

Parameters:
editingContext - the editing context to remove with
oldTags - the tags to find and remove (String to tokenize, NSArray, etc)
newTags - the tags to add
inclusion - if ANY, finds any tags that match, removes them all, and adds newTags; if all, requires all tags to match before replacing

tagCount

public com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Integer> tagCount(com.webobjects.eocontrol.EOEditingContext editingContext)
This method counts the number of times the tags have been applied to your objects and, by default, returns a dictionary in the form of { 'tag_name' => count, ... }. This does not include any restriction on the count required for results to be returned nor does it limit the number of results returned.

Parameters:
editingContext - the editing context to fetch into
Returns:
a dictionary of tags and their occurrence count

tagCount

public com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Integer> tagCount(com.webobjects.eocontrol.EOEditingContext editingContext,
                                                                                           com.webobjects.eocontrol.EOQualifier additionalQualifier)
This method counts the number of times the tags have been applied to your objects and, by default, returns a dictionary in the form of { 'tag_name' => count, ... }. This does not include any restriction on the count required for results to be returned nor does it limit the number of results returned.

Parameters:
editingContext - the editing context to fetch into
additionalQualifier - an optional restrictingQualifier
Returns:
a dictionary of tags and their occurrence count

tagCount

public com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Integer> tagCount(com.webobjects.eocontrol.EOEditingContext editingContext,
                                                                                           int limit)
This method counts the number of times the tags have been applied to your objects and, by default, returns a dictionary in the form of { 'tag_name' => count, ... }. This does not include any restriction on the count required for results to be returned.

Parameters:
editingContext - the editing context to fetch into
limit - the limit of the number of results to return (ordered by count DESC)
Returns:
a dictionary of tags and their occurrence count

tagCount

public com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Integer> tagCount(com.webobjects.eocontrol.EOEditingContext editingContext,
                                                                                           int limit,
                                                                                           com.webobjects.eocontrol.EOQualifier additionalQualifier)
This method counts the number of times the tags have been applied to your objects and, by default, returns a dictionary in the form of { 'tag_name' => count, ... }. This does not include any restriction on the count required for results to be returned.

Parameters:
editingContext - the editing context to fetch into
limit - the limit of the number of results to return (ordered by count DESC)
additionalQualifier - an optional restrictingQualifier
Returns:
a dictionary of tags and their occurrence count

tagCount

public com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Integer> tagCount(com.webobjects.eocontrol.EOEditingContext editingContext,
                                                                                           com.webobjects.foundation.NSSelector selector,
                                                                                           int count,
                                                                                           int limit)
This method counts the number of times the tags have been applied to your objects and, by default, returns a dictionary in the form of { 'tag_name' => count, ... }. Providing a selector and count allows you to add a restriction on, for instance, the minimum number of occurrences required for a result to appear. As an example, you might have selector = EOQualifier.QualifierOperatorGreaterThan, count = 1 to only return tags with more than one occurrence.

Parameters:
editingContext - the editing context to fetch into
selector - a selector for the count restriction (see EOQualifier.QualifierOperators)
count - the count restriction required for the result to be returned
limit - the limit of the number of results to return (ordered by count DESC)
Returns:
a dictionary of tags and their occurrence count

tagCount

public com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Integer> tagCount(com.webobjects.eocontrol.EOEditingContext editingContext,
                                                                                           com.webobjects.foundation.NSSelector selector,
                                                                                           int count,
                                                                                           int limit,
                                                                                           com.webobjects.eocontrol.EOQualifier additionalQualifier)
This method counts the number of times the tags have been applied to your objects and, by default, returns a dictionary in the form of { 'tag_name' => count, ... }. Providing a selector and count allows you to add a restriction on, for instance, the minimum number of occurrences required for a result to appear. As an example, you might have selector = EOQualifier.QualifierOperatorGreaterThan, count = 1 to only return tags with more than one occurrence.

Parameters:
editingContext - the editing context to fetch into
selector - a selector for the count restriction (see EOQualifier.QualifierOperators)
count - the count restriction required for the result to be returned
limit - the limit of the number of results to return (ordered by count DESC)
additionalQualifier - an optional restrictingQualifier. This is combined with the qualifier returned by additionalTagCountQualifier()
Returns:
a dictionary of tags and their occurrence count

countUniqueTaggedWith

public int countUniqueTaggedWith(com.webobjects.eocontrol.EOEditingContext editingContext,
                                 ERTag.Inclusion inclusion,
                                 java.lang.Object tags)
This method returns a simple count of the number of distinct objects which match the tags provided.

Parameters:
editingContext - the editing context to fetch into
tags - the tags to search (String to tokenize, NSArray, etc)
inclusion - find matches for ANY tags or ALL tags provided
Returns:
the count of distinct objects for the given tags

fetchRelatedTags

public com.webobjects.foundation.NSArray<java.lang.String> fetchRelatedTags(com.webobjects.eocontrol.EOEditingContext editingContext,
                                                                            java.lang.Object tags)
Finds other tags that are related to the tags passed through the tags parameter, by finding common records that share similar sets of tags. Useful for constructing 'Related tags' lists.

Parameters:
tags - the tags to search (String to tokenize, NSArray, etc)

cloud

public <U> com.webobjects.foundation.NSDictionary<java.lang.String,U> cloud(com.webobjects.eocontrol.EOEditingContext editingContext,
                                                                            com.webobjects.foundation.NSArray<U> categoryList)
Takes the result of a tagCount call and an array of categories and distributes the entries in the tagCount hash evenly across the categories based on the count value for each tag. Typically, this is used to display a 'tag cloud' in your UI.

Parameters:
categoryList - An array containing the categories to split the tags
Returns:
a dictionary mapping each tag name to its corresponding category

cloud

public <U> com.webobjects.foundation.NSDictionary<java.lang.String,U> cloud(com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Integer> tagHash,
                                                                            com.webobjects.foundation.NSArray<U> categoryList)
Takes the result of a tagCount call and an array of categories and distributes the entries in the tagCount hash evenly across the categories based on the count value for each tag. Typically, this is used to display a 'tag cloud' in your UI.

Parameters:
tagHash - the tag dictionary returned from a tagCount call
categoryList - An array containing the categories to split the tags
Returns:
a dictionary mapping each tag name to its corresponding category

fetchAllTags

public com.webobjects.foundation.NSArray<java.lang.String> fetchAllTags(com.webobjects.eocontrol.EOEditingContext editingContext)
Returns an array of all of the available tags in the system.

Parameters:
editingContext - the editing context to fetch into
Returns:
an array of matching tags

fetchTagsLike

public com.webobjects.foundation.NSArray<java.lang.String> fetchTagsLike(com.webobjects.eocontrol.EOEditingContext editingContext,
                                                                         java.lang.String startsWith)
Returns an array of all of the available tags in the system that start with the given string.

Parameters:
startsWith - the prefix to lookup
editingContext - the editing context to fetch into
Returns:
an array of matching tags

additionalTagCountQualifier

protected com.webobjects.eocontrol.EOQualifier additionalTagCountQualifier()

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.