Added Javadocs, minor code reformatting, removed unused method.
This commit is contained in:
parent
732fab12b8
commit
b21a0d8ddb
1 changed files with 60 additions and 78 deletions
|
@ -39,23 +39,21 @@ public final class WrappedNodeManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get a node given its id and DbMapping
|
||||||
*
|
*
|
||||||
*
|
* @param id
|
||||||
* @param id ...
|
* @param dbmap
|
||||||
* @param dbmap ...
|
* @return
|
||||||
*
|
|
||||||
* @return ...
|
|
||||||
*/
|
*/
|
||||||
public Node getNode(String id, DbMapping dbmap) {
|
public Node getNode(String id, DbMapping dbmap) {
|
||||||
return getNode(new DbKey(dbmap, id));
|
return getNode(new DbKey(dbmap, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get a node given its key
|
||||||
*
|
*
|
||||||
*
|
* @param key
|
||||||
* @param key ...
|
* @return
|
||||||
*
|
|
||||||
* @return ...
|
|
||||||
*/
|
*/
|
||||||
public Node getNode(Key key) {
|
public Node getNode(Key key) {
|
||||||
try {
|
try {
|
||||||
|
@ -74,13 +72,12 @@ public final class WrappedNodeManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get the node specified by the given id and Relation.
|
||||||
*
|
*
|
||||||
*
|
* @param home
|
||||||
* @param home ...
|
* @param id
|
||||||
* @param id ...
|
* @param rel
|
||||||
* @param rel ...
|
* @return
|
||||||
*
|
|
||||||
* @return ...
|
|
||||||
*/
|
*/
|
||||||
public Node getNode(Node home, String id, Relation rel) {
|
public Node getNode(Node home, String id, Relation rel) {
|
||||||
try {
|
try {
|
||||||
|
@ -100,12 +97,12 @@ public final class WrappedNodeManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get the list of nodes contained in the collection of the given
|
||||||
|
* Node specified by the given Relation.
|
||||||
*
|
*
|
||||||
*
|
* @param home
|
||||||
* @param home ...
|
* @param rel
|
||||||
* @param rel ...
|
* @return
|
||||||
*
|
|
||||||
* @return ...
|
|
||||||
*/
|
*/
|
||||||
public List getNodes(Node home, Relation rel) {
|
public List getNodes(Node home, Relation rel) {
|
||||||
try {
|
try {
|
||||||
|
@ -120,12 +117,12 @@ public final class WrappedNodeManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get a list of IDs of nodes contained in the given Node's
|
||||||
|
* collection specified by the given Relation.
|
||||||
*
|
*
|
||||||
*
|
* @param home
|
||||||
* @param home ...
|
* @param rel
|
||||||
* @param rel ...
|
* @return
|
||||||
*
|
|
||||||
* @return ...
|
|
||||||
*/
|
*/
|
||||||
public List getNodeIDs(Node home, Relation rel) {
|
public List getNodeIDs(Node home, Relation rel) {
|
||||||
try {
|
try {
|
||||||
|
@ -140,12 +137,12 @@ public final class WrappedNodeManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Count the nodes contained in the given Node's collection
|
||||||
|
* specified by the given Relation.
|
||||||
*
|
*
|
||||||
*
|
* @param home
|
||||||
* @param home ...
|
* @param rel
|
||||||
* @param rel ...
|
* @return
|
||||||
*
|
|
||||||
* @return ...
|
|
||||||
*/
|
*/
|
||||||
public int countNodes(Node home, Relation rel) {
|
public int countNodes(Node home, Relation rel) {
|
||||||
try {
|
try {
|
||||||
|
@ -160,9 +157,9 @@ public final class WrappedNodeManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Delete a node from the database
|
||||||
*
|
*
|
||||||
*
|
* @param node
|
||||||
* @param node ...
|
|
||||||
*/
|
*/
|
||||||
public void deleteNode(Node node) {
|
public void deleteNode(Node node) {
|
||||||
try {
|
try {
|
||||||
|
@ -177,12 +174,12 @@ public final class WrappedNodeManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get a list of property names from the given node.
|
||||||
|
* TODO: this retrieves access names of child nodes, not property names
|
||||||
*
|
*
|
||||||
*
|
* @param home
|
||||||
* @param home ...
|
* @param rel
|
||||||
* @param rel ...
|
* @return
|
||||||
*
|
|
||||||
* @return ...
|
|
||||||
*/
|
*/
|
||||||
public Vector getPropertyNames(Node home, Relation rel) {
|
public Vector getPropertyNames(Node home, Relation rel) {
|
||||||
try {
|
try {
|
||||||
|
@ -197,115 +194,100 @@ public final class WrappedNodeManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Register a node with the object cache using its primary key.
|
||||||
*
|
*
|
||||||
*
|
* @param node
|
||||||
* @param node ...
|
|
||||||
*/
|
*/
|
||||||
public void registerNode(Node node) {
|
public void registerNode(Node node) {
|
||||||
nmgr.registerNode(node);
|
nmgr.registerNode(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Register a node with the object cache using the given key.
|
||||||
*
|
*
|
||||||
*
|
* @param node
|
||||||
* @param node ...
|
|
||||||
*/
|
*/
|
||||||
public void registerNode(Node node, Key key) {
|
public void registerNode(Node node, Key key) {
|
||||||
nmgr.registerNode(node, key);
|
nmgr.registerNode(node, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Evict a node from the object cache
|
||||||
*
|
*
|
||||||
*
|
* @param node
|
||||||
* @param node ...
|
|
||||||
*/
|
*/
|
||||||
public void evictNode(Node node) {
|
public void evictNode(Node node) {
|
||||||
nmgr.evictNode(node);
|
nmgr.evictNode(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Completely evict the object with the given key from the object cache
|
||||||
*
|
*
|
||||||
*
|
* @param key
|
||||||
* @param key ...
|
|
||||||
*/
|
*/
|
||||||
public void evictNodeByKey(Key key) {
|
public void evictNodeByKey(Key key) {
|
||||||
nmgr.evictNodeByKey(key);
|
nmgr.evictNodeByKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Evict the object with the given key from the object cache
|
||||||
*
|
*
|
||||||
*
|
* @param key
|
||||||
* @param key ...
|
|
||||||
*/
|
*/
|
||||||
public void evictKey(Key key) {
|
public void evictKey(Key key) {
|
||||||
nmgr.evictKey(key);
|
nmgr.evictKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Generate a new id for an object specified by the DbMapping
|
||||||
*
|
*
|
||||||
*
|
* @param map the DbMapping to generate an id for
|
||||||
* @return ...
|
* @return a new unique id
|
||||||
*/
|
|
||||||
public String generateID() {
|
|
||||||
return nmgr.idgen.newID();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param map ...
|
|
||||||
*
|
|
||||||
* @return ...
|
|
||||||
*/
|
*/
|
||||||
public String generateID(DbMapping map) {
|
public String generateID(DbMapping map) {
|
||||||
try {
|
try {
|
||||||
// check if we use internal id generator
|
|
||||||
if ((map == null) || !map.isRelational() ||
|
if ((map == null) || !map.isRelational() ||
|
||||||
"[hop]".equalsIgnoreCase(map.getIDgen())) {
|
"[hop]".equalsIgnoreCase(map.getIDgen())) {
|
||||||
return nmgr.idgen.newID();
|
// use embedded db id generator
|
||||||
}
|
return nmgr.db.nextID();
|
||||||
// or if we query max key value
|
} else if ((map.getIDgen() == null) ||
|
||||||
else if ((map.getIDgen() == null) ||
|
"[max]".equalsIgnoreCase(map.getIDgen())) {
|
||||||
"[max]".equalsIgnoreCase(map.getIDgen())) {
|
// use select max as id generator
|
||||||
return nmgr.generateMaxID(map);
|
return nmgr.generateMaxID(map);
|
||||||
} else {
|
} else {
|
||||||
|
// use db sequence as id generator
|
||||||
return nmgr.generateID(map);
|
return nmgr.generateID(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise, we use an oracle sequence
|
|
||||||
} catch (Exception x) {
|
} catch (Exception x) {
|
||||||
if (nmgr.app.debug()) {
|
if (nmgr.app.debug()) {
|
||||||
x.printStackTrace();
|
x.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new RuntimeException(x.toString());
|
throw new RuntimeException(x.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Get an array of all objects in the object cache
|
||||||
*
|
|
||||||
* @return ...
|
|
||||||
*/
|
*/
|
||||||
public Object[] getCacheEntries() {
|
public Object[] getCacheEntries() {
|
||||||
return nmgr.getCacheEntries();
|
return nmgr.getCacheEntries();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Write an entry to the application's event log
|
||||||
*
|
*
|
||||||
*
|
* @param msg event message
|
||||||
* @param msg ...
|
|
||||||
*/
|
*/
|
||||||
public void logEvent(String msg) {
|
public void logEvent(String msg) {
|
||||||
nmgr.app.logEvent(msg);
|
nmgr.app.logEvent(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get the DbMapping corresponding to a type name
|
||||||
*
|
*
|
||||||
*
|
* @param name a type name
|
||||||
* @param name ...
|
* @return the corresponding DbMapping
|
||||||
*
|
|
||||||
* @return ...
|
|
||||||
*/
|
*/
|
||||||
public DbMapping getDbMapping(String name) {
|
public DbMapping getDbMapping(String name) {
|
||||||
return nmgr.app.getDbMapping(name);
|
return nmgr.app.getDbMapping(name);
|
||||||
|
|
Loading…
Add table
Reference in a new issue