[ 1846595 ] 2pack do not set the start node in a workflow after import
- Added proper defer endElement processing handling.
This commit is contained in:
parent
6c301fe4cf
commit
e23c51352e
|
@ -640,13 +640,17 @@ public class PackInHandler extends DefaultHandler {
|
|||
setupHandlers();
|
||||
} else {
|
||||
Element e = stack.pop();
|
||||
ElementHandler handler = handlers.get(elementValue);
|
||||
if (handler != null)
|
||||
handler.endElement(m_ctx, e);
|
||||
if (e.defer)
|
||||
defer.add(new DeferEntry(e, false));
|
||||
else if (!e.skip)
|
||||
System.out.println("Processed: " + e.getElementValue() + " - " + e.attributes.getValue(0));
|
||||
if (e.defer) {
|
||||
defer.add(new DeferEntry(e, false));
|
||||
} else {
|
||||
ElementHandler handler = handlers.get(elementValue);
|
||||
if (handler != null)
|
||||
handler.endElement(m_ctx, e);
|
||||
if (e.defer)
|
||||
defer.add(new DeferEntry(e, false));
|
||||
else if (!e.skip)
|
||||
System.out.println("Processed: " + e.getElementValue() + " - " + e.attributes.getValue(0));
|
||||
}
|
||||
}
|
||||
} // endElement
|
||||
|
||||
|
@ -666,12 +670,24 @@ public class PackInHandler extends DefaultHandler {
|
|||
do {
|
||||
int startSize = defer.size();
|
||||
List<DeferEntry> tmp = new ArrayList<DeferEntry>(defer);
|
||||
List<Element> startElements = new ArrayList<Element>();
|
||||
defer.clear();
|
||||
for (DeferEntry d : tmp) {
|
||||
if (d.startElement) {
|
||||
d.element.defer = false;
|
||||
d.element.unresolved = "";
|
||||
d.element.pass++;
|
||||
startElements.add(d.element);
|
||||
} else {
|
||||
if (d.element.defer && startElements.contains(d.element)) {
|
||||
defer.add(d);
|
||||
continue;
|
||||
} else {
|
||||
//only defer endElement
|
||||
d.element.defer = false;
|
||||
d.element.unresolved = "";
|
||||
d.element.pass++;
|
||||
}
|
||||
}
|
||||
ElementHandler handler = handlers.get(d.element.getElementValue());
|
||||
if (handler != null) {
|
||||
|
|
|
@ -178,8 +178,8 @@ public class WorkflowElementHandler extends AbstractElementHandler {
|
|||
MWorkflow m_Workflow = new MWorkflow(ctx, element.recordId, getTrxName(ctx));
|
||||
int id = get_IDWithColumn(ctx, "AD_WF_Node", "Name", name);
|
||||
if (id <= 0) {
|
||||
log.warning("Failed to resolve start node reference for workflow element. Workflow="
|
||||
+ m_Workflow.getName() + " StartNode=" + name);
|
||||
element.defer = true;
|
||||
element.unresolved = "AD_WF_Node=" + name;
|
||||
return;
|
||||
}
|
||||
m_Workflow.setAD_WF_Node_ID(id);
|
||||
|
|
|
@ -65,6 +65,7 @@ public class WorkflowNodeNextConditionElementHandler extends
|
|||
int wfNodeId = DB.getSQLValue(getTrxName(ctx), sqlB.toString(),
|
||||
workflowId, workflowNodeName);
|
||||
if (wfNodeId <= 0) {
|
||||
element.unresolved = "AD_WF_Node=" + workflowNodeName;
|
||||
element.defer = true;
|
||||
return;
|
||||
}
|
||||
|
@ -72,6 +73,7 @@ public class WorkflowNodeNextConditionElementHandler extends
|
|||
int wfNodeNextId = DB.getSQLValue(getTrxName(ctx), sqlB.toString(),
|
||||
workflowId, workflowNodeNextName);
|
||||
if (wfNodeNextId <= 0) {
|
||||
element.unresolved = "AD_WF_Node=" + workflowNodeNextName;
|
||||
element.defer = true;
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue