|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch.hsr.bieridee.models.AbstractModel
ch.hsr.bieridee.models.BeerModel
public class BeerModel
Model to work and persist the beer object.
Constructor Summary | |
---|---|
BeerModel(long beerId)
Creates a BeerModel for the desired beer. |
|
BeerModel(org.neo4j.graphdb.Node node)
|
Method Summary | |
---|---|
void |
addBarcode(BarcodeModel b)
Add barcode to BeerModel. |
void |
addTag(TagModel t)
Links this Beer to the desired TagModel. |
void |
calculateAndUpdateAverageRating()
calculates the average rating and saves the value in the database. |
static BeerModel |
create(java.lang.String name,
java.lang.String brand,
BeertypeModel beertypeModel,
BreweryModel breweryModel)
Create a new Beer! Including a fresh node and a delicious domain object. |
static java.util.List<BeerModel> |
createModelsFromNodes(java.util.List<org.neo4j.graphdb.Node> beerNodes)
Creates models from nodes. |
boolean |
equals(java.lang.Object o)
|
static java.util.List<BeerModel> |
getAll()
Gets a list of all beers as BeerModel s. |
static java.util.List<BeerModel> |
getAll(int items,
int skip)
Gets a list of all beers as BeerModel s. |
static java.util.List<BeerModel> |
getAllByBarcode(java.lang.String filterBarcode)
Gets a list of beers as BeerModel s filtered by a barcode. |
static java.util.List<BeerModel> |
getAllByTag(long filterTag)
Gets a list of beers as BeerModel s filtered by a tag. |
static java.util.List<BeerModel> |
getAllByTag(long filterTag,
int items,
int skip)
Gets a list of beers as BeerModel s filtered by a tag. |
double |
getAverageRating()
|
double |
getAverageRatingShortened()
|
BeertypeModel |
getBeertype()
|
java.lang.String |
getBrand()
|
BreweryModel |
getBrewery()
|
Beer |
getDomainObject()
|
long |
getId()
|
java.lang.String |
getName()
|
org.neo4j.graphdb.Node |
getNode()
|
java.lang.String |
getPicture()
|
java.util.List<TagModel> |
getTagModels()
|
java.util.List<Tag> |
getTags()
|
int |
hashCode()
|
void |
setBeertype(BeertypeModel beertypeModel)
|
void |
setBrand(java.lang.String brand)
|
void |
setBrewery(BreweryModel breweryModel)
|
void |
setImage(java.lang.String path)
|
void |
setName(java.lang.String name)
|
void |
setTags(java.lang.Iterable<TagModel> tags)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BeerModel(long beerId) throws WrongNodeTypeException, org.neo4j.graphdb.NotFoundException
beerId
- The node id of the desired beer
WrongNodeTypeException
- Thrown when the given id does not reference a beer node
org.neo4j.graphdb.NotFoundException
- Thrown when the given ide does not reference an existing nodepublic BeerModel(org.neo4j.graphdb.Node node) throws WrongNodeTypeException, org.neo4j.graphdb.NotFoundException
node
- Node containing Properties of the Beer.
WrongNodeTypeException
- Thrown when the given node is not a beer node
org.neo4j.graphdb.NotFoundException
- Thrown when the given node is not existingMethod Detail |
---|
public org.neo4j.graphdb.Node getNode()
getNode
in class AbstractModel
public Beer getDomainObject()
getDomainObject
in class AbstractModel
public long getId()
public void calculateAndUpdateAverageRating()
public BeertypeModel getBeertype() throws org.neo4j.graphdb.NotFoundException, WrongNodeTypeException
org.neo4j.graphdb.NotFoundException
WrongNodeTypeException
public java.lang.String getBrand()
public BreweryModel getBrewery() throws org.neo4j.graphdb.NotFoundException, WrongNodeTypeException
org.neo4j.graphdb.NotFoundException
WrongNodeTypeException
public java.lang.String getName()
public java.lang.String getPicture()
public java.util.List<Tag> getTags()
public java.util.List<TagModel> getTagModels() throws org.neo4j.graphdb.NotFoundException, WrongNodeTypeException
org.neo4j.graphdb.NotFoundException
WrongNodeTypeException
public double getAverageRating()
public double getAverageRatingShortened()
public void setBeertype(BeertypeModel beertypeModel)
public void setBrand(java.lang.String brand)
public void setBrewery(BreweryModel breweryModel)
public void setName(java.lang.String name)
public void setImage(java.lang.String path)
public void addTag(TagModel t)
t
- TagModel to add.public void addBarcode(BarcodeModel b)
b
- BarcodeModelpublic void setTags(java.lang.Iterable<TagModel> tags)
public static BeerModel create(java.lang.String name, java.lang.String brand, BeertypeModel beertypeModel, BreweryModel breweryModel)
name
- Name of the new beerbrand
- Brand of the new beerbeertypeModel
- The beertype of the new beerbreweryModel
- The the sacred place where this beer was brewn
public static java.util.List<BeerModel> getAll() throws org.neo4j.graphdb.NotFoundException, WrongNodeTypeException
BeerModel
s.
BeerModel
org.neo4j.graphdb.NotFoundException
- Thrown if a node is not existing
WrongNodeTypeException
- Thrown if a node is not of the desired typepublic static java.util.List<BeerModel> getAll(int items, int skip) throws org.neo4j.graphdb.NotFoundException, WrongNodeTypeException
BeerModel
s.
items
- Number of items to be displayedskip
- Number of items to be skipped
BeerModel
org.neo4j.graphdb.NotFoundException
- Thrown if a node is not existsing
WrongNodeTypeException
- Thrown if a node is not of the desired typepublic static java.util.List<BeerModel> getAllByTag(long filterTag) throws org.neo4j.graphdb.NotFoundException, WrongNodeTypeException
BeerModel
s filtered by a tag.
filterTag
- Tag to be filterd with
org.neo4j.graphdb.NotFoundException
- Thrown if a node is not existing
WrongNodeTypeException
- Thrown if a node is not of the desired typepublic static java.util.List<BeerModel> getAllByTag(long filterTag, int items, int skip) throws org.neo4j.graphdb.NotFoundException, WrongNodeTypeException
BeerModel
s filtered by a tag.
filterTag
- Tag to be filterd withitems
- Number of items to be displayedskip
- Number of items to be skipped
org.neo4j.graphdb.NotFoundException
- Thrown if a node is not existant
WrongNodeTypeException
- Thrown if a node is not of the desired typepublic static java.util.List<BeerModel> createModelsFromNodes(java.util.List<org.neo4j.graphdb.Node> beerNodes) throws org.neo4j.graphdb.NotFoundException, WrongNodeTypeException
beerNodes
- Beernodes
org.neo4j.graphdb.NotFoundException
- Thrown if a node is not existing
WrongNodeTypeException
- Thrown if a node is not of the desired typepublic static java.util.List<BeerModel> getAllByBarcode(java.lang.String filterBarcode) throws org.neo4j.graphdb.NotFoundException, WrongNodeTypeException
BeerModel
s filtered by a barcode. Should just return one beer.
filterBarcode
- Barcode to be filterd with
org.neo4j.graphdb.NotFoundException
- Thrown if a node is not existant
WrongNodeTypeException
- Thrown if a node is not of the desired typepublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |