ch.hsr.bieridee.models
Class TagModel

java.lang.Object
  extended by ch.hsr.bieridee.models.AbstractModel
      extended by ch.hsr.bieridee.models.TagModel

public class TagModel
extends AbstractModel

Model to work with and persist the tag obejct.


Constructor Summary
TagModel(long id)
          Creates a TagModel form a node id.
TagModel(org.neo4j.graphdb.Node tagNode)
          Creates a TagModel from a tag node.
 
Method Summary
static TagModel create(java.lang.String name)
          Creates an new Tag.
 boolean equals(java.lang.Object o)
           
static java.util.List<TagModel> getAll()
          Gets a list of all tags as TagModels.
static TagModel getByName(java.lang.String name)
           
 Tag getDomainObject()
           
 long getId()
           
 java.lang.String getName()
           
 org.neo4j.graphdb.Node getNode()
           
 int hashCode()
           
 void setName(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TagModel

public TagModel(long id)
         throws WrongNodeTypeException,
                org.neo4j.graphdb.NotFoundException
Creates a TagModel form a node id.

Parameters:
id - The id of the desired tag
Throws:
WrongNodeTypeException - Thrown if the node with the given name is not of type tag
org.neo4j.graphdb.NotFoundException - Thrown if the node with the given name is not existing

TagModel

public TagModel(org.neo4j.graphdb.Node tagNode)
         throws WrongNodeTypeException,
                org.neo4j.graphdb.NotFoundException
Creates a TagModel from a tag node.

Parameters:
tagNode - The tag node
Throws:
WrongNodeTypeException - Thrown if the given node is not of type tag
org.neo4j.graphdb.NotFoundException - Thrown if the given node has not been found
Method Detail

getId

public long getId()

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getDomainObject

public Tag getDomainObject()
Specified by:
getDomainObject in class AbstractModel

getNode

public org.neo4j.graphdb.Node getNode()
Overrides:
getNode in class AbstractModel

hashCode

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

equals

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

getAll

public static java.util.List<TagModel> getAll()
                                       throws org.neo4j.graphdb.NotFoundException,
                                              WrongNodeTypeException
Gets a list of all tags as TagModels.

Returns:
The list of TagModels
Throws:
org.neo4j.graphdb.NotFoundException - Thrown if a node is not existant
WrongNodeTypeException - Thrown if a node is not of the desired type

create

public static TagModel create(java.lang.String name)
Creates an new Tag.

Parameters:
name - Name of the new Tag
Returns:
TagModel representing the new Tag

getByName

public static TagModel getByName(java.lang.String name)
                          throws org.neo4j.graphdb.NotFoundException,
                                 WrongNodeTypeException
Throws:
org.neo4j.graphdb.NotFoundException
WrongNodeTypeException