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:
hns 2001-12-13 11:54:48 +00:00
parent 15941ce4f4
commit 14fe874b38
2 changed files with 16 additions and 14 deletions

View file

@ -247,9 +247,9 @@ public final class Node implements INode, Serializable {
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
// mappnigs with a local db column
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)
// 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 ();
if (prel != null && prel.accessor != null && !prel.subnodesAreProperties

View file

@ -9,11 +9,7 @@ import helma.framework.core.Application;
import com.sleepycat.db.*;
import java.sql.*;
import java.io.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Properties;
import java.util.Vector;
import java.util.Enumeration;
import java.util.*;
import com.workingdogs.village.*;
/**
@ -385,10 +381,11 @@ public final class NodeManager {
if (nameField != null)
rec.setValue (nameField, node.getName ());
for (Enumeration e=dbm.getProp2DB ().keys(); e.hasMoreElements(); ) {
String propname = (String) e.nextElement ();
for (Iterator i=dbm.getProp2DB().entrySet().iterator(); i.hasNext(); ) {
Map.Entry e = (Map.Entry) i.next ();
String propname = (String) e.getKey ();
Relation rel = (Relation) e.getValue ();
Property p = node.getProperty (propname, false);
Relation rel = dbm.propertyToRelation (propname);
if (p != null && rel != null) {
switch (p.getType ()) {
@ -460,9 +457,10 @@ public final class NodeManager {
int updated = 0;
for (Enumeration e=dbm.getProp2DB ().keys(); e.hasMoreElements(); ) {
String propname = (String) e.nextElement ();
Relation rel = dbm.propertyToRelation (propname);
for (Iterator i=dbm.getProp2DB().entrySet().iterator(); i.hasNext(); ) {
Map.Entry e = (Map.Entry) i.next ();
String propname = (String) e.getKey ();
Relation rel = (Relation) e.getValue ();
// skip properties that don't need to be updated before fetching them
if (rel != null && (rel.readonly || rel.virtual ||