Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
Java-DAS-beta1
-
None
Description
I am not patch savvy, but here is the 'new' getInsertOrder I am using to support multiple parent-child relationships WRT insert/delete ordering:
// TODO optimize
public List getInsertOrder() {
if (this.logger.isDebugEnabled())
List inserts = new ArrayList();
// JMC - this must allow multiple children per parent
Map<String,List<String>> parentToChildren = new HashMap<String,List<String>>();
//Map parentToChild = new HashMap();
List parents = new ArrayList();
List children = new ArrayList();
if (config != null) {
Iterator i = getConfig().getRelationship().iterator();
while (i.hasNext())
while (parents.size() > 0) {
String parent = (String) parents.get(0);
if (!children.contains(parent)) {
if (!inserts.contains(parent))
// JMC - Deal with ALL relationships
//String child = (String) parentToChild.get(parent);
List<String> rchildren = parentToChildren.get(parent);
Iterator<String> it = rchildren.iterator();
while(it.hasNext()) {
String child = it.next();
if (!inserts.contains(child))
}
parents.remove(parent);
} else
{ parents.add(parents.remove(0)); } }
inserts.addAll(children);
}
if (this.logger.isDebugEnabled())
{ this.logger.debug(inserts); } return inserts;
}