|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch.hsr.bieridee.utils.DBUtil
public final class DBUtil
Utility to work with the neo4J graph-db.
Method Summary | |
---|---|
static void |
addToRatingIndex(org.neo4j.graphdb.Node node,
BeerModel beerModel,
UserModel userModel)
|
static void |
addToTimeLine(org.neo4j.graphdb.Node node)
Adds a new Action to the Timeline. |
static org.neo4j.graphdb.Node |
createNode(java.lang.String type)
|
static org.neo4j.graphdb.Relationship |
createRelationship(org.neo4j.graphdb.Node startNode,
org.neo4j.graphdb.RelationshipType relType,
org.neo4j.graphdb.Node endNode)
Creates a bidirectional relationship between the given Nodes. |
static void |
deleteRelationship(org.neo4j.graphdb.Node startNode,
RelType hasBeertype,
org.neo4j.graphdb.Node endNode,
org.neo4j.graphdb.Direction direction)
|
static boolean |
doesUserExist(java.lang.String username)
Checks whether a usernode is existing or not. |
static org.neo4j.graphdb.Node |
getActiveUserRatingForBeer(long beerId,
java.lang.String username)
|
static java.util.List<java.lang.String> |
getAllBrands()
|
static org.neo4j.graphdb.Node |
getBeerByBarcode(java.lang.String barcode)
Gets a neo4j beer node by the barcode. |
static org.neo4j.graphdb.Node |
getBeerByName(java.lang.String name)
Gets a neo4j beer node by the name of the beer. |
static java.util.List<org.neo4j.graphdb.Node> |
getBeerNodeList()
Gets a list of all beer nodes from the database. |
static java.util.List<org.neo4j.graphdb.Node> |
getBeerNodeList(int items,
int skip)
|
static java.util.List<org.neo4j.graphdb.Node> |
getBeerNodeList(long tagId)
Gets a list of all tags with the given tag. |
static java.util.List<org.neo4j.graphdb.Node> |
getBeerNodeList(long tagId,
int items,
int skip)
|
static java.util.List<org.neo4j.graphdb.Node> |
getBeersRatedByUser(java.lang.String username)
|
static java.util.List<org.neo4j.graphdb.Node> |
getBeertypeNodeList()
Gets a list of all beertype nodes from the database. |
static java.util.List<org.neo4j.graphdb.Node> |
getBreweryNodeList()
Gets a list of all brewery nodes from the database. |
static java.util.List<org.neo4j.graphdb.Node> |
getBreweryNodeList(int items,
int skip)
|
static java.util.List<org.neo4j.graphdb.Node> |
getBreweryNodeList(java.lang.String brewerySize)
Gets a list of all brewery nodes filtered by size. |
static java.util.List<org.neo4j.graphdb.Node> |
getBreweryNodeList(java.lang.String brewerySize,
int items,
int skip)
|
static java.util.List<org.neo4j.graphdb.Node> |
getConsumptionsByBeer(long beerId)
Gets a list of all consuptions nodes for the given beer. |
static java.util.List<org.neo4j.graphdb.Node> |
getConsumptionsForUserByBeer(java.lang.String username,
long beerId)
Gets a list of consumption nodes for the user and the beer. |
static org.neo4j.graphdb.Node |
getNodeByBarcode(java.lang.String code)
Gets a beer node by barcode. |
static org.neo4j.graphdb.Node |
getNodeById(long id)
Gets the neo4j node by the absolute node id. |
static org.neo4j.graphdb.Node |
getOrCreateBarcodeNode(java.lang.String code)
Get or create a barcode. |
static org.neo4j.graphdb.Node |
getOrCreateBarcodeNode(java.lang.String code,
java.lang.String format)
Get or create a barcode. |
static org.neo4j.graphdb.Node |
getTagByName(java.lang.String name)
Gets a neo4j tag node by the name of the tag. |
static java.util.List<org.neo4j.graphdb.Node> |
getTagNodeList()
|
static java.util.List<org.neo4j.graphdb.Node> |
getTimeLine(int maxNumberOfItems,
int skipCount)
|
static java.util.List<org.neo4j.graphdb.Node> |
getTimeLineForUser(java.lang.String username,
int maxNumberOfItems,
int skipCount)
|
static org.neo4j.graphdb.Node |
getUnknownNode(java.lang.String type)
Gets the "Unknown-Node" for a specific type. |
static org.neo4j.graphdb.Node |
getUserByName(java.lang.String name)
Gets a neo4j node by the username of the user. |
static java.util.List<org.neo4j.graphdb.Node> |
getUserNodeList()
Gets a list of all user nodes from the database. |
static void |
setDB(org.neo4j.kernel.EmbeddedGraphDatabase db)
|
static void |
setProperty(org.neo4j.graphdb.Node node,
java.lang.String key,
java.lang.Object value)
Adds or updates the given property with the given value on the given node. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void setDB(org.neo4j.kernel.EmbeddedGraphDatabase db)
public static org.neo4j.graphdb.Node getNodeById(long id)
id
- The id of the neo4j node
public static java.util.List<org.neo4j.graphdb.Node> getBeerNodeList()
public static java.util.List<org.neo4j.graphdb.Node> getBeerNodeList(int items, int skip)
public static java.util.List<org.neo4j.graphdb.Node> getBeerNodeList(long tagId)
tagId
- Id of a Tag which is used as a filter.
public static java.util.List<org.neo4j.graphdb.Node> getBeerNodeList(long tagId, int items, int skip)
public static java.util.List<org.neo4j.graphdb.Node> getBeertypeNodeList()
public static java.util.List<org.neo4j.graphdb.Node> getBreweryNodeList()
public static java.util.List<org.neo4j.graphdb.Node> getBreweryNodeList(int items, int skip)
public static java.util.List<org.neo4j.graphdb.Node> getBreweryNodeList(java.lang.String brewerySize)
brewerySize
- Brewery size which is used as a filter.
public static java.util.List<org.neo4j.graphdb.Node> getBreweryNodeList(java.lang.String brewerySize, int items, int skip)
public static java.util.List<org.neo4j.graphdb.Node> getUserNodeList()
public static java.util.List<org.neo4j.graphdb.Node> getTagNodeList()
public static org.neo4j.graphdb.Node getBeerByName(java.lang.String name)
name
- The name (name property) of the beer
null
if not foundpublic static org.neo4j.graphdb.Node getBeerByBarcode(java.lang.String barcode)
barcode
- A barcode of the beer
null
if not foundpublic static org.neo4j.graphdb.Node getTagByName(java.lang.String name)
name
- The name (name property) of the tag
null
if not foundpublic static org.neo4j.graphdb.Node getUserByName(java.lang.String name)
name
- Username
public static org.neo4j.graphdb.Relationship createRelationship(org.neo4j.graphdb.Node startNode, org.neo4j.graphdb.RelationshipType relType, org.neo4j.graphdb.Node endNode)
startNode
- Start Node of the Relationship.relType
- Type of the Relation to be created.endNode
- End Node of the Relationship.
public static org.neo4j.graphdb.Node createNode(java.lang.String type)
type
- String with type
public static void setProperty(org.neo4j.graphdb.Node node, java.lang.String key, java.lang.Object value)
node
- Node on which the property is set.key
- Key of the Propertyvalue
- Value of the Property,public static boolean doesUserExist(java.lang.String username)
username
- Username of the user to be checked
public static java.util.List<org.neo4j.graphdb.Node> getTimeLineForUser(java.lang.String username, int maxNumberOfItems, int skipCount)
username
- Username used to filter the timeline.maxNumberOfItems
- number of max. Items (actions) returned. Pass 0 for all Items.skipCount
- Number of elements to be skipped for paging.
public static java.util.List<org.neo4j.graphdb.Node> getTimeLine(int maxNumberOfItems, int skipCount)
maxNumberOfItems
- number of max. Items (actions) returned. Pass 0 for all Items.skipCount
- Number of Elements to be skipped for paging.
public static void addToTimeLine(org.neo4j.graphdb.Node node)
node
- the action node to be added.public static org.neo4j.graphdb.Node getActiveUserRatingForBeer(long beerId, java.lang.String username)
beerId
- ID of the beer.username
- Username of the user.
public static void addToRatingIndex(org.neo4j.graphdb.Node node, BeerModel beerModel, UserModel userModel)
node
- Rating node.beerModel
- BeerModel rated by the ratinguserModel
- UserModel that rates the beer.public static java.util.List<org.neo4j.graphdb.Node> getConsumptionsByBeer(long beerId)
beerId
- The id of the beer
public static java.util.List<org.neo4j.graphdb.Node> getConsumptionsForUserByBeer(java.lang.String username, long beerId)
username
- The userbeerId
- The beer
public static java.util.List<org.neo4j.graphdb.Node> getBeersRatedByUser(java.lang.String username)
username
- username of the user
public static java.util.List<java.lang.String> getAllBrands()
public static org.neo4j.graphdb.Node getUnknownNode(java.lang.String type)
type
- Nodetype
public static org.neo4j.graphdb.Node getNodeByBarcode(java.lang.String code)
code
- The barcode
public static org.neo4j.graphdb.Node getOrCreateBarcodeNode(java.lang.String code)
code
- The barcode
public static org.neo4j.graphdb.Node getOrCreateBarcodeNode(java.lang.String code, java.lang.String format)
code
- The barcode valueformat
- The barcode format
public static void deleteRelationship(org.neo4j.graphdb.Node startNode, RelType hasBeertype, org.neo4j.graphdb.Node endNode, org.neo4j.graphdb.Direction direction)
startNode
- Start nodehasBeertype
- Relationship type (edge)endNode
- end nodedirection
- Direction in which the node is connected to node2 via RelType. From the point of view of first node.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |