* Use specific methods when reading a Date or Time
column from a ResultSet in the constructor * Add set() method that allows to directly set the value and type of a property * Change the return type for getNonVirtualParent from INode to Node.
This commit is contained in:
parent
4e47de9963
commit
4501c5cf50
1 changed files with 46 additions and 3 deletions
|
@ -277,7 +277,15 @@ public final class Node implements INode, Serializable {
|
|||
break;
|
||||
|
||||
case Types.DATE:
|
||||
newprop.setDateValue(rs.getDate(columns[i].getName()));
|
||||
|
||||
break;
|
||||
|
||||
case Types.TIME:
|
||||
newprop.setDateValue(rs.getTime(columns[i].getName()));
|
||||
|
||||
break;
|
||||
|
||||
case Types.TIMESTAMP:
|
||||
newprop.setDateValue(rs.getTimestamp(columns[i].getName()));
|
||||
|
||||
|
@ -1985,6 +1993,41 @@ public final class Node implements INode, Serializable {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Directly set a property on this node
|
||||
*
|
||||
* @param propname ...
|
||||
* @param value ...
|
||||
*/
|
||||
protected void set(String propname, Object value, int type) {
|
||||
checkWriteLock();
|
||||
|
||||
if (propMap == null) {
|
||||
propMap = new Hashtable();
|
||||
}
|
||||
|
||||
propname = propname.trim();
|
||||
|
||||
String p2 = propname.toLowerCase();
|
||||
|
||||
Property prop = (Property) propMap.get(p2);
|
||||
|
||||
if (prop != null) {
|
||||
prop.setValue(value, type);
|
||||
} else {
|
||||
prop = new Property(propname, this);
|
||||
prop.setValue(value, type);
|
||||
propMap.put(p2, prop);
|
||||
}
|
||||
|
||||
// Server.throwNodeEvent (new NodeEvent (this, NodeEvent.PROPERTIES_CHANGED));
|
||||
lastmodified = System.currentTimeMillis();
|
||||
|
||||
if (state == CLEAN) {
|
||||
markAs(MODIFIED);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
|
@ -2538,8 +2581,8 @@ public final class Node implements INode, Serializable {
|
|||
* This method walks down node path to the first non-virtual node and return it.
|
||||
* limit max depth to 3, since there shouldn't be more then 2 layers of virtual nodes.
|
||||
*/
|
||||
public INode getNonVirtualParent() {
|
||||
INode node = this;
|
||||
public Node getNonVirtualParent() {
|
||||
Node node = this;
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (node == null) {
|
||||
|
@ -2550,7 +2593,7 @@ public final class Node implements INode, Serializable {
|
|||
return node;
|
||||
}
|
||||
|
||||
node = node.getParent();
|
||||
node = (Node) node.getParent();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
Loading…
Add table
Reference in a new issue