ch.hsr.bieridee.models
Class BeertypeModel

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

public class BeertypeModel
extends AbstractModel

Model to work and persist the beertype object.


Constructor Summary
BeertypeModel(long beertypeId)
          Creates a BeertypeModel.
BeertypeModel(org.neo4j.graphdb.Node node)
          Creates a BeertypeModel.
 
Method Summary
static BeertypeModel create(java.lang.String name, java.lang.String description)
           
 boolean equals(java.lang.Object obj)
           
static java.util.List<BeertypeModel> getAll()
          Gets a list of all beertypes as beertypeModel.
 java.lang.String getDescription()
           
 Beertype getDomainObject()
           
 long getId()
           
 java.lang.String getName()
           
 org.neo4j.graphdb.Node getNode()
           
static BeertypeModel getUnknown()
          Gets the BeertypeModel for an unknown beertype.
 int hashCode()
           
 boolean isUnknown()
           
 void setDescription(java.lang.String description)
           
 void setId(long id)
           
 void setName(java.lang.String name)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BeertypeModel

public BeertypeModel(long beertypeId)
              throws WrongNodeTypeException,
                     org.neo4j.graphdb.NotFoundException
Creates a BeertypeModel.

Parameters:
beertypeId - The id of the desired beertype
Throws:
WrongNodeTypeException - Thrown when the given id does not reference a beertype node
org.neo4j.graphdb.NotFoundException - Thrown when the given id does not reference an existing node

BeertypeModel

public BeertypeModel(org.neo4j.graphdb.Node node)
              throws WrongNodeTypeException,
                     org.neo4j.graphdb.NotFoundException
Creates a BeertypeModel.

Parameters:
node - the node containing Beertype properties.
Throws:
WrongNodeTypeException - Thrown when the given node is not of type beertype
org.neo4j.graphdb.NotFoundException - Thrown if the node does not exist
Method Detail

isUnknown

public boolean isUnknown()

getDomainObject

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

getNode

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

getDescription

public java.lang.String getDescription()

getName

public java.lang.String getName()

getId

public long getId()

setId

public void setId(long id)

setName

public void setName(java.lang.String name)

setDescription

public void setDescription(java.lang.String description)

getAll

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

Returns:
The beertyeModel list
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 BeertypeModel create(java.lang.String name,
                                   java.lang.String description)
Parameters:
name - name of the beertype.
description - detailed description of the beertype.
Returns:
a new BeertypeModel representing the beertype.

getUnknown

public static BeertypeModel getUnknown()
                                throws org.neo4j.graphdb.NotFoundException,
                                       WrongNodeTypeException
Gets the BeertypeModel for an unknown beertype.

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

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object