Skip navigation links
Project Wonder 7.5-SNAPSHOT

Package er.taggable

ERTaggable is a fairly direct port of the acts_as_taggable Rails mixin to EOF, the framework provides a very easy method of integrating delicious-style tagging support into arbitrary entities in your applications.

See: Description

Package er.taggable Description

ERTaggable is a fairly direct port of the acts_as_taggable Rails mixin to EOF, the framework provides a very easy method of integrating delicious-style tagging support into arbitrary entities in your applications.

Quick Start

Lets take the example where your model "MyModel" has a "Person" entity that you want to support tagging on.

  1. Create a migration using the helper superclass:
    public class MyModel0 extends ERTaggableEntity0 {
            public MyModel0() {
                    super(Person.ENTITY_NAME);
            }
    }
                    
  2. Register the taggable in your Application constructor or framework principal:
    ERTaggableEntity.registerTaggable(Person.ENTITY_NAME);
                    
  3. Add convenience methods onto your Person class (optional, but handy):
    public ERTaggable<Person> taggable() {
            return ERTaggable.taggable(this);
    }
    
    public static ERTaggableEntity<Person> taggableEntity() {
            return ERTaggableEntity.taggableEntity(Person.ENTITY_NAME);
    }
        
  4. Tag like the wind:
    Person mike = Person.createPerson(editingContext, "Mike Schrag");
    ERTaggable<Person> taggableMike = mike.taggable();
    taggableMike.addTags("mike employee important");
    
    NSArray<Person> matchingPeople = Person.taggableEntity().fetchTaggedWith(editingContext, "employee");
            
    NSDictionary<EOEntity, NSArray<? extends ERXGenericRecord>> matchingItems = ERTaggableEntity.fetchAllTaggedWith(editingContext, "mike");
                    

Nitty Gritty

If you choose to deviate from the "magical" route described above, you can provide several override hooks:

Skip navigation links
Last updated: Fri, Nov 22, 2024 • 08:08 AM CET

Copyright © 2002 – 2024 Project Wonder.