T
- the java class of the entity that this ERTaggableEntity is associated withpublic class ERTaggableEntity<T extends ERXGenericRecord> extends Object
public class Person extends _Person {
...
public static ERTaggableEntity<Person> taggableEntity() {
return ERTaggableEntity.taggableEntity(Person.ENTITY_NAME);
}
}
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_TAGS_RELATIONSHIP_NAME
The default name of the flattened to-many relationship to the tag entity.
|
static String |
ERTAGGABLE_KEY
The key stored in entity userInfo that flags an entity as taggable.
|
static String |
ERTAGGABLE_TAG_ENTITY_KEY
The key stored in entity userInfo that specifies the name of the tag entity.
|
static String |
ERTAGGABLE_TAG_RELATIONSHIP_KEY
The key stored in entity userInfo that specifies the name of the tag relationship.
|
Modifier | Constructor and Description |
---|---|
protected |
ERTaggableEntity(EOEntity entity)
Constructs an ERTaggableEntity.
|
Modifier and Type | Method and Description |
---|---|
protected EOQualifier |
additionalTagCountQualifier() |
<U> NSDictionary<String,U> |
cloud(EOEditingContext editingContext,
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> NSDictionary<String,U> |
cloud(NSDictionary<String,Integer> tagHash,
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(EOEditingContext editingContext,
ERTag.Inclusion inclusion,
Object tags)
This method returns a simple count of the number of distinct objects which match the tags provided.
|
ERTag |
createTagNamed(EOEditingContext editingContext,
String tagName)
Creates a tag with the given name.
|
boolean |
equals(Object obj) |
static NSDictionary<EOEntity,NSArray<? extends ERXGenericRecord>> |
fetchAllTaggedWith(EOEditingContext editingContext,
ERTag.Inclusion inclusion,
int limit,
Object tags)
Fetches all the EOs of all taggable entities that are associated with the given tags.
|
static NSDictionary<EOEntity,NSArray<? extends ERXGenericRecord>> |
fetchAllTaggedWith(EOEditingContext editingContext,
ERTag.Inclusion inclusion,
Object tags)
Fetches all the EOs of all taggable entities that are associated with the given tags (unlimited).
|
static NSDictionary<EOEntity,NSArray<? extends ERXGenericRecord>> |
fetchAllTaggedWith(EOEditingContext editingContext,
Object tags)
Fetches all the EOs of all taggable entities that are associated with all of the given tags (unlimited).
|
NSArray<String> |
fetchAllTags(EOEditingContext editingContext)
Returns an array of all of the available tags in the system.
|
NSArray<String> |
fetchRelatedTags(EOEditingContext editingContext,
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.
|
NSArray<T> |
fetchTaggedWith(EOEditingContext editingContext,
ERTag.Inclusion inclusion,
int limit,
Object tags)
Fetches the list of objects of this entity type that are tagged
with the given tags.
|
NSArray<T> |
fetchTaggedWith(EOEditingContext editingContext,
ERTag.Inclusion inclusion,
int limit,
Object tags,
EOQualifier additionalQualifier)
Fetches the list of objects of this entity type that are tagged
with the given tags.
|
NSArray<T> |
fetchTaggedWith(EOEditingContext editingContext,
ERTag.Inclusion inclusion,
int limit,
Object tags,
EOQualifier additionalQualifier,
NSArray<EOSortOrdering> sortOrderings)
Fetches the sorted list of objects of this entity type that are tagged
with the given tags.
|
NSArray<T> |
fetchTaggedWith(EOEditingContext editingContext,
ERTag.Inclusion inclusion,
Object tags)
Fetches the list of objects of this entity type that are tagged
with the given tags with unlimited results.
|
NSArray<T> |
fetchTaggedWith(EOEditingContext editingContext,
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(EOEditingContext editingContext,
String tagName,
boolean createIfMissing)
Fetches the tag with the given name.
|
NSArray<String> |
fetchTagsLike(EOEditingContext editingContext,
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(EOEntity entity)
Returns whether or not the given entity has been registered as taggable.
|
static boolean |
isWhitespaceSeparator(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 EOEntity |
registerTaggable(EOEntity entity)
Registers the given entity as taggable.
|
static EOEntity |
registerTaggable(EOEntity entity,
String tagsRelationshipName)
Registers the given entity as taggable.
|
static EOEntity |
registerTaggable(EOEntity entity,
String tagsRelationshipName,
EOEntity tagEntity,
Class<? extends ERTaggableEntity<?>> taggableEntity)
Registers the given entity as taggable.
|
static EOEntity |
registerTaggable(String entityName)
Registers the given entity name in the default model group as taggable.
|
static EOEntity |
registerTaggable(String entityName,
Class<? extends ERTaggableEntity<?>> taggableEntity)
Registers the given entity name in the default model group as taggable.
|
void |
removeTags(EOEditingContext editingContext,
Object tags)
Remove all of the tags from instances of this entity type.
|
void |
replaceTags(EOEditingContext editingContext,
ERTag.Inclusion inclusion,
Object oldTags,
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(Class<? extends ERTaggableEntity<?>> taggableEntity,
String entityName)
Sets the taggable entity class for the given entity name.
|
NSArray<String> |
splitTagNames(Object tags)
Splits the given "tags" object (String, array of Strings, etc) into an array of normalized tag strings.
|
NSDictionary<String,Integer> |
tagCount(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, ...
|
NSDictionary<String,Integer> |
tagCount(EOEditingContext editingContext,
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, ...
|
NSDictionary<String,Integer> |
tagCount(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, ...
|
NSDictionary<String,Integer> |
tagCount(EOEditingContext editingContext,
int limit,
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, ...
|
NSDictionary<String,Integer> |
tagCount(EOEditingContext editingContext,
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, ...
|
NSDictionary<String,Integer> |
tagCount(EOEditingContext editingContext,
NSSelector selector,
int count,
int limit,
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 NSArray<EOEntity> |
taggableEntities()
Returns an array of taggable entities.
|
static <T extends ERXGenericRecord> |
taggableEntity(EOEntity entity)
Constructs an ERTaggableEntity.
|
static <T extends ERXGenericRecord> |
taggableEntity(String entityName)
Constructs an ERTaggableEntity.
|
static <T extends ERXGenericRecord> |
taggableEntity(T eo)
Shortcut for getting an ERTaggableEntity for an EO.
|
EORelationship |
tagsRelationship()
Returns the tags relationship for this entity.
|
static EORelationship |
tagsRelationshipForEntity(EOEntity entity,
EOEntity tagEntity)
Returns the flattened to-many relationship from the taggable entity to the given tag entity.
|
String |
tagsRelationshipName()
Returns the name of the tags relationship for this entity.
|
public static final String ERTAGGABLE_KEY
public static final String ERTAGGABLE_TAG_ENTITY_KEY
public static final String ERTAGGABLE_TAG_RELATIONSHIP_KEY
public static final String DEFAULT_TAGS_RELATIONSHIP_NAME
protected ERTaggableEntity(EOEntity entity)
entity
- the entity to tagpublic static void setTaggableEntityForEntityNamed(Class<? extends ERTaggableEntity<?>> taggableEntity, String entityName)
taggableEntity
- the taggable entity classentityName
- the name of the entity to associate withpublic static <T extends ERXGenericRecord> ERTaggableEntity<T> taggableEntity(EOEntity entity)
entity
- the entity to tagpublic static <T extends ERXGenericRecord> ERTaggableEntity<T> taggableEntity(String entityName)
entityName
- the name of the entity to tagpublic static <T extends ERXGenericRecord> ERTaggableEntity<T> taggableEntity(T eo)
T
- the type of the entityeo
- the EOpublic static NSDictionary<EOEntity,NSArray<? extends ERXGenericRecord>> fetchAllTaggedWith(EOEditingContext editingContext, Object tags)
editingContext
- the editing context to fetch intotags
- the tags to search (String to tokenize, NSArray<String>, etc)public static NSDictionary<EOEntity,NSArray<? extends ERXGenericRecord>> fetchAllTaggedWith(EOEditingContext editingContext, ERTag.Inclusion inclusion, Object tags)
editingContext
- the editing context to fetch intotags
- the tags to search (String to tokenize, NSArray<String>, etc)inclusion
- find matches for ANY tags or ALL tags providedpublic static NSDictionary<EOEntity,NSArray<? extends ERXGenericRecord>> fetchAllTaggedWith(EOEditingContext editingContext, ERTag.Inclusion inclusion, int limit, Object tags)
editingContext
- the editing context to fetch intotags
- the tags to search (String to tokenize, NSArray<String>, etc)inclusion
- find matches for ANY tags or ALL tags providedlimit
- the limit of the number of objects to return (or -1 for unlimited)public static boolean isTaggable(EOEntity entity)
entity
- the entity to checkpublic static NSArray<EOEntity> taggableEntities()
public static EORelationship tagsRelationshipForEntity(EOEntity entity, EOEntity tagEntity)
entity
- the taggable entitytagEntity
- the tag entitypublic static EOEntity registerTaggable(String entityName, Class<? extends ERTaggableEntity<?>> taggableEntity)
entityName
- the name of the entity to lookuptaggableEntity
- the taggable entity to associate with this taggablepublic static EOEntity registerTaggable(String entityName)
entityName
- the name of the entity to lookuppublic static EOEntity registerTaggable(EOEntity entity)
entity
- the entity to registerpublic static EOEntity registerTaggable(EOEntity entity, String tagsRelationshipName)
entity
- the entity to registertagsRelationshipName
- the name of the flattened to-many tags relationshippublic static EOEntity registerTaggable(EOEntity entity, String tagsRelationshipName, EOEntity tagEntity, Class<? extends ERTaggableEntity<?>> taggableEntity)
entity
- the entity to registertagsRelationshipName
- the name of the flattened to-many tags relationshiptagEntity
- the ERTag entity that contains the tags for this entitytaggableEntity
- the taggable entity to associate with this taggablepublic ERTagNormalizer normalizer()
public void setNormalizer(ERTagNormalizer normalizer)
normalizer
- the tag normalizer for this entitypublic ERTag fetchTagNamed(EOEditingContext editingContext, String tagName, boolean createIfMissing)
editingContext
- the editing context to fetch intotagName
- the name of the tag to lookupcreateIfMissing
- if true, missing tags will be createdpublic ERTag createTagNamed(EOEditingContext editingContext, String tagName)
editingContext
- the editing context to create withintagName
- the new tag namepublic ERTaggable<T> taggable(T eo)
eo
- the EO to wrappublic String tagsRelationshipName()
public EORelationship tagsRelationship()
public static boolean isWhitespaceSeparator(String separator)
public NSArray<String> splitTagNames(Object tags)
tags
- the object that contains the tags to splitpublic NSArray<T> fetchTaggedWith(EOEditingContext editingContext, Object tags)
editingContext
- the editing context to fetch intotags
- the tags to search (String to tokenize, NSArray<String>, etc)public NSArray<T> fetchTaggedWith(EOEditingContext editingContext, ERTag.Inclusion inclusion, Object tags)
editingContext
- the editing context to fetch intotags
- the tags to search (String to tokenize, NSArray<String>, etc)inclusion
- find matches for ANY tags or ALL tags providedpublic NSArray<T> fetchTaggedWith(EOEditingContext editingContext, ERTag.Inclusion inclusion, int limit, Object tags)
editingContext
- the editing context to fetch intotags
- the tags to search (String to tokenize, NSArray<String>, etc)inclusion
- find matches for ANY tags or ALL tags providedlimit
- limit the number of results to be returned (-1 for unlimited)public NSArray<T> fetchTaggedWith(EOEditingContext editingContext, ERTag.Inclusion inclusion, int limit, Object tags, EOQualifier additionalQualifier)
editingContext
- the editing context to fetch intotags
- the tags to search (String to tokenize, NSArray<String>, etc)inclusion
- find matches for ANY tags or ALL tags providedlimit
- limit the number of results to be returned (-1 for unlimited)additionalQualifier
- an additional qualifier to chain inpublic NSArray<T> fetchTaggedWith(EOEditingContext editingContext, ERTag.Inclusion inclusion, int limit, Object tags, EOQualifier additionalQualifier, NSArray<EOSortOrdering> sortOrderings)
editingContext
- the editing context to fetch intotags
- the tags to search (String to tokenize, NSArray<String>, etc)inclusion
- find matches for ANY tags or ALL tags providedlimit
- limit the number of results to be returned (-1 for unlimited)additionalQualifier
- an additional qualifier to chain insortOrderings
- sort orderings for the fetch specpublic void removeTags(EOEditingContext editingContext, Object tags)
editingContext
- the editing context to fetch intotags
- the tags to remove (String to tokenize, NSArray<String>, etc)public void replaceTags(EOEditingContext editingContext, ERTag.Inclusion inclusion, Object oldTags, Object newTags)
editingContext
- the editing context to remove witholdTags
- the tags to find and remove (String to tokenize, NSArray<String>, etc)newTags
- the tags to addinclusion
- if ANY, finds any tags that match, removes them all, and adds newTags; if all, requires all tags to match before replacingpublic NSDictionary<String,Integer> tagCount(EOEditingContext editingContext)
editingContext
- the editing context to fetch intopublic NSDictionary<String,Integer> tagCount(EOEditingContext editingContext, EOQualifier additionalQualifier)
editingContext
- the editing context to fetch intoadditionalQualifier
- an optional restrictingQualifierpublic NSDictionary<String,Integer> tagCount(EOEditingContext editingContext, int limit)
editingContext
- the editing context to fetch intolimit
- the limit of the number of results to return (ordered by count DESC)public NSDictionary<String,Integer> tagCount(EOEditingContext editingContext, int limit, EOQualifier additionalQualifier)
editingContext
- the editing context to fetch intolimit
- the limit of the number of results to return (ordered by count DESC)additionalQualifier
- an optional restrictingQualifierpublic NSDictionary<String,Integer> tagCount(EOEditingContext editingContext, NSSelector selector, int count, int limit)
editingContext
- the editing context to fetch intoselector
- a selector for the count restriction (see EOQualifier.QualifierOperators)count
- the count restriction required for the result to be returnedlimit
- the limit of the number of results to return (ordered by count DESC)public NSDictionary<String,Integer> tagCount(EOEditingContext editingContext, NSSelector selector, int count, int limit, EOQualifier additionalQualifier)
editingContext
- the editing context to fetch intoselector
- a selector for the count restriction (see EOQualifier.QualifierOperators)count
- the count restriction required for the result to be returnedlimit
- 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()public int countUniqueTaggedWith(EOEditingContext editingContext, ERTag.Inclusion inclusion, Object tags)
editingContext
- the editing context to fetch intotags
- the tags to search (String to tokenize, NSArray<String>, etc)inclusion
- find matches for ANY tags or ALL tags providedpublic NSArray<String> fetchRelatedTags(EOEditingContext editingContext, Object tags)
tags
- the tags to search (String to tokenize, NSArray<String>, etc)public <U> NSDictionary<String,U> cloud(EOEditingContext editingContext, NSArray<U> categoryList)
categoryList
- An array containing the categories to split the tagspublic <U> NSDictionary<String,U> cloud(NSDictionary<String,Integer> tagHash, NSArray<U> categoryList)
tagHash
- the tag dictionary returned from a tagCount callcategoryList
- An array containing the categories to split the tagspublic NSArray<String> fetchAllTags(EOEditingContext editingContext)
editingContext
- the editing context to fetch intopublic NSArray<String> fetchTagsLike(EOEditingContext editingContext, String startsWith)
startsWith
- the prefix to lookupeditingContext
- the editing context to fetch intoprotected EOQualifier additionalTagCountQualifier()
Copyright © 2002 – 2024 Project Wonder.