|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpl.edu.agh.cast.model.mapper.Node
public class Node
Metamodel node.
Metamodel consists of nodes and links. It allows any upper-level data structure to be stored in the DB, without modifying its scheme or data warehouse interface.
Nodes represents any meaningful element of the model, i.e. object or value of the object. Relations between these elements are stored in the Link class
Constructor Summary | |
---|---|
Node(Map args)
Parameterized constructor. |
|
Node(String typeName)
Parameterized constructor. |
|
Node(String typeName,
Object value)
Parameterized constructor. |
Method Summary | |
---|---|
Link |
addDependent(Node node,
String linkName)
Add dependent node. |
void |
addDstLink(Link link)
Add destination link. |
void |
addLink(Link link)
Add link to this node. |
void |
addSrcLink(Link link)
Add source link. |
boolean |
equals(Object other)
|
static Node |
find(long nodeId)
Returns node with given id or null if not found. |
static Node |
find(Mappable object)
Finds metamodel node for given model object. |
static Node |
find(Node node)
Find node which is the same as the given node in terms of their id. |
static List<Node> |
find(String typeName)
Find all nodes with given type name. |
static List<Node> |
find(String typeName,
SortedMap<String,Object> conditions)
Find all nodes with given type name which satisfy given set of conditions. |
static List<Node> |
findAllByTypeName(String typeName)
Finds all nodes with given type name. |
Boolean |
getBooleanValue()
Typed value getter. |
Date |
getDateValue()
Type value getter. |
Double |
getDoubleValue()
Typed value getter. |
List<Link> |
getDstLinks()
The target links getter. |
long |
getId()
DB identifier getter. |
Long |
getLongValue()
The value getter. |
List<Link> |
getSrcLinks()
|
String |
getStringValue()
Typed value getter. |
String |
getTypeName()
Type name getter. |
Object |
getValue()
Node value getter. |
int |
hashCode()
|
void |
link(Node node,
Direction direction,
String name,
Priority priority)
Links this node with given node. |
void |
link(Node node,
Object direction,
String name)
Link creator. |
List<Link> |
links(String name)
Returns links with given name. |
List<Link> |
links(String name,
Direction direction)
Find all links with given name, with direction direction. |
List<Link> |
links(String name,
Object directionObj)
Links accessor. |
void |
reloadLinks()
Reloads links of given node from DB. |
boolean |
save()
Save metamodel node in the DB. |
void |
setDstLinks(Set<Link> links)
The target links setter. |
void |
setSaved(boolean saved)
Saved flag setter. |
void |
setSrcLinks(Set<Link> links)
The source links setter. |
void |
setValue(boolean value)
The value setter. |
void |
setValue(Date value)
The value setter. |
void |
setValue(double newValue)
The value setter. |
void |
setValue(int newValue)
|
void |
setValue(long newValue)
|
void |
setValue(Object newValue)
Node value setter. |
void |
setValue(String value)
The value setter. |
static void |
stats()
Prints the cache status. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Node(Map args)
args
- The map of attributes.public Node(String typeName)
typeName
- The name of the type of node.public Node(String typeName, Object value)
typeName
- The name of the type of the node.value
- The value of the node.Method Detail |
---|
public String getTypeName()
public Object getValue()
public void setValue(Object newValue)
newValue
- The value to be setpublic void setValue(long newValue)
public void setValue(int newValue)
public Long getLongValue()
public void setValue(double newValue)
newValue
- The valuepublic Double getDoubleValue()
public void setValue(boolean value)
value
- The value to set.public Boolean getBooleanValue()
public void setValue(String value)
value
- The value as string.public String getStringValue()
public void setValue(Date value)
value
- The value as date.public Date getDateValue()
public List<Link> getSrcLinks()
public void setSrcLinks(Set<Link> links)
links
- Links to set.public List<Link> getDstLinks()
public void setDstLinks(Set<Link> links)
links
- Links to setpublic void link(Node node, Object direction, String name)
node
- The node to link.direction
- The direction of the link (as seen form "this" node).name
- The name of the link.public void link(Node node, Direction direction, String name, Priority priority)
node
- The node to be linkeddirection
- The direction of the linkname
- The name of the linkpriority
- The priority of the linkpublic List<Link> links(String name, Object directionObj)
name
- The name of the linksdirectionObj
- The direction of the links
public List<Link> links(String name)
name
- The name of links
public List<Link> links(String name, Direction direction)
name
- The name of linksdirection
- The direction of links
public Link addDependent(Node node, String linkName)
node
- The node to be linkedlinkName
- The name of the link
public String toString()
toString
in class Object
Object.toString()
public boolean save()
The saving process is recursive. The node is saved first and then all source and destination links are saved.
TODO implement transactions
public static Node find(long nodeId)
nodeId
- The id of the node
public static List<Node> find(String typeName)
typeName
- The name of the type
public static List<Node> find(String typeName, SortedMap<String,Object> conditions)
typeName
- The name of the typeconditions
- Map containing pairs: attribute name => value defining conditions which must be met for model
object for metamodel node to be loaded.
public void reloadLinks() throws SQLException
SQLException
public static Node find(Mappable object)
object
- The object for which the node is found
public void setSaved(boolean saved)
saved
- The saved flagpublic static Node find(Node node)
node
- The node to find.
public static List<Node> findAllByTypeName(String typeName)
typeName
- The type name of the node.
public long getId()
public boolean equals(Object other)
equals
in class Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public void addSrcLink(Link link)
link
- Link to addpublic void addDstLink(Link link)
link
- Link to addpublic void addLink(Link link)
link
- Link to addpublic static void stats()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |