Adapted to change from Hashtable to HashMap in DbMapping. Basically,
an Iterator is used instead of an Enumeration for looping through the mapping tables.
This commit is contained in:
parent
15941ce4f4
commit
14fe874b38
2 changed files with 16 additions and 14 deletions
|
@ -247,9 +247,9 @@ public final class Node implements INode, Serializable {
|
||||||
|
|
||||||
created = lastmodified = System.currentTimeMillis ();
|
created = lastmodified = System.currentTimeMillis ();
|
||||||
|
|
||||||
for (Enumeration e=dbmap.getDB2Prop ().elements (); e.hasMoreElements(); ) {
|
for (Iterator i=dbmap.getDB2Prop().values().iterator(); i.hasNext(); ) {
|
||||||
|
|
||||||
Relation rel = (Relation) e.nextElement ();
|
Relation rel = (Relation) i.next ();
|
||||||
// NOTE: this should never be the case, since we're just looping through
|
// NOTE: this should never be the case, since we're just looping through
|
||||||
// mappnigs with a local db column
|
// mappnigs with a local db column
|
||||||
if (rel.reftype != Relation.PRIMITIVE && rel.reftype != Relation.REFERENCE)
|
if (rel.reftype != Relation.PRIMITIVE && rel.reftype != Relation.REFERENCE)
|
||||||
|
@ -1206,7 +1206,11 @@ public final class Node implements INode, Serializable {
|
||||||
|
|
||||||
if (dbmap != null && dbmap.getProp2DB ().size() > 0)
|
if (dbmap != null && dbmap.getProp2DB ().size() > 0)
|
||||||
// return the properties defined in type.properties, if there are any
|
// return the properties defined in type.properties, if there are any
|
||||||
return dbmap.getProp2DB ().keys();
|
return new Enumeration () {
|
||||||
|
Iterator i = dbmap.getProp2DB().keySet().iterator();
|
||||||
|
public boolean hasMoreElements() {return i.hasNext();}
|
||||||
|
public Object nextElement () {return i.next();}
|
||||||
|
};
|
||||||
|
|
||||||
Relation prel = dbmap == null ? null : dbmap.getPropertyRelation ();
|
Relation prel = dbmap == null ? null : dbmap.getPropertyRelation ();
|
||||||
if (prel != null && prel.accessor != null && !prel.subnodesAreProperties
|
if (prel != null && prel.accessor != null && !prel.subnodesAreProperties
|
||||||
|
|
|
@ -9,11 +9,7 @@ import helma.framework.core.Application;
|
||||||
import com.sleepycat.db.*;
|
import com.sleepycat.db.*;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.Vector;
|
|
||||||
import java.util.Enumeration;
|
|
||||||
import com.workingdogs.village.*;
|
import com.workingdogs.village.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -385,10 +381,11 @@ public final class NodeManager {
|
||||||
if (nameField != null)
|
if (nameField != null)
|
||||||
rec.setValue (nameField, node.getName ());
|
rec.setValue (nameField, node.getName ());
|
||||||
|
|
||||||
for (Enumeration e=dbm.getProp2DB ().keys(); e.hasMoreElements(); ) {
|
for (Iterator i=dbm.getProp2DB().entrySet().iterator(); i.hasNext(); ) {
|
||||||
String propname = (String) e.nextElement ();
|
Map.Entry e = (Map.Entry) i.next ();
|
||||||
|
String propname = (String) e.getKey ();
|
||||||
|
Relation rel = (Relation) e.getValue ();
|
||||||
Property p = node.getProperty (propname, false);
|
Property p = node.getProperty (propname, false);
|
||||||
Relation rel = dbm.propertyToRelation (propname);
|
|
||||||
|
|
||||||
if (p != null && rel != null) {
|
if (p != null && rel != null) {
|
||||||
switch (p.getType ()) {
|
switch (p.getType ()) {
|
||||||
|
@ -460,9 +457,10 @@ public final class NodeManager {
|
||||||
|
|
||||||
int updated = 0;
|
int updated = 0;
|
||||||
|
|
||||||
for (Enumeration e=dbm.getProp2DB ().keys(); e.hasMoreElements(); ) {
|
for (Iterator i=dbm.getProp2DB().entrySet().iterator(); i.hasNext(); ) {
|
||||||
String propname = (String) e.nextElement ();
|
Map.Entry e = (Map.Entry) i.next ();
|
||||||
Relation rel = dbm.propertyToRelation (propname);
|
String propname = (String) e.getKey ();
|
||||||
|
Relation rel = (Relation) e.getValue ();
|
||||||
|
|
||||||
// skip properties that don't need to be updated before fetching them
|
// skip properties that don't need to be updated before fetching them
|
||||||
if (rel != null && (rel.readonly || rel.virtual ||
|
if (rel != null && (rel.readonly || rel.virtual ||
|
||||||
|
|
Loading…
Add table
Reference in a new issue