[ 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();
|
setupHandlers();
|
||||||
} else {
|
} else {
|
||||||
Element e = stack.pop();
|
Element e = stack.pop();
|
||||||
ElementHandler handler = handlers.get(elementValue);
|
if (e.defer) {
|
||||||
if (handler != null)
|
defer.add(new DeferEntry(e, false));
|
||||||
handler.endElement(m_ctx, e);
|
} else {
|
||||||
if (e.defer)
|
ElementHandler handler = handlers.get(elementValue);
|
||||||
defer.add(new DeferEntry(e, false));
|
if (handler != null)
|
||||||
else if (!e.skip)
|
handler.endElement(m_ctx, e);
|
||||||
System.out.println("Processed: " + e.getElementValue() + " - " + e.attributes.getValue(0));
|
if (e.defer)
|
||||||
|
defer.add(new DeferEntry(e, false));
|
||||||
|
else if (!e.skip)
|
||||||
|
System.out.println("Processed: " + e.getElementValue() + " - " + e.attributes.getValue(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // endElement
|
} // endElement
|
||||||
|
|
||||||
|
@ -666,12 +670,24 @@ public class PackInHandler extends DefaultHandler {
|
||||||
do {
|
do {
|
||||||
int startSize = defer.size();
|
int startSize = defer.size();
|
||||||
List<DeferEntry> tmp = new ArrayList<DeferEntry>(defer);
|
List<DeferEntry> tmp = new ArrayList<DeferEntry>(defer);
|
||||||
|
List<Element> startElements = new ArrayList<Element>();
|
||||||
defer.clear();
|
defer.clear();
|
||||||
for (DeferEntry d : tmp) {
|
for (DeferEntry d : tmp) {
|
||||||
if (d.startElement) {
|
if (d.startElement) {
|
||||||
d.element.defer = false;
|
d.element.defer = false;
|
||||||
d.element.unresolved = "";
|
d.element.unresolved = "";
|
||||||
d.element.pass++;
|
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());
|
ElementHandler handler = handlers.get(d.element.getElementValue());
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
|
|
|
@ -178,8 +178,8 @@ public class WorkflowElementHandler extends AbstractElementHandler {
|
||||||
MWorkflow m_Workflow = new MWorkflow(ctx, element.recordId, getTrxName(ctx));
|
MWorkflow m_Workflow = new MWorkflow(ctx, element.recordId, getTrxName(ctx));
|
||||||
int id = get_IDWithColumn(ctx, "AD_WF_Node", "Name", name);
|
int id = get_IDWithColumn(ctx, "AD_WF_Node", "Name", name);
|
||||||
if (id <= 0) {
|
if (id <= 0) {
|
||||||
log.warning("Failed to resolve start node reference for workflow element. Workflow="
|
element.defer = true;
|
||||||
+ m_Workflow.getName() + " StartNode=" + name);
|
element.unresolved = "AD_WF_Node=" + name;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_Workflow.setAD_WF_Node_ID(id);
|
m_Workflow.setAD_WF_Node_ID(id);
|
||||||
|
|
|
@ -65,6 +65,7 @@ public class WorkflowNodeNextConditionElementHandler extends
|
||||||
int wfNodeId = DB.getSQLValue(getTrxName(ctx), sqlB.toString(),
|
int wfNodeId = DB.getSQLValue(getTrxName(ctx), sqlB.toString(),
|
||||||
workflowId, workflowNodeName);
|
workflowId, workflowNodeName);
|
||||||
if (wfNodeId <= 0) {
|
if (wfNodeId <= 0) {
|
||||||
|
element.unresolved = "AD_WF_Node=" + workflowNodeName;
|
||||||
element.defer = true;
|
element.defer = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -72,6 +73,7 @@ public class WorkflowNodeNextConditionElementHandler extends
|
||||||
int wfNodeNextId = DB.getSQLValue(getTrxName(ctx), sqlB.toString(),
|
int wfNodeNextId = DB.getSQLValue(getTrxName(ctx), sqlB.toString(),
|
||||||
workflowId, workflowNodeNextName);
|
workflowId, workflowNodeNextName);
|
||||||
if (wfNodeNextId <= 0) {
|
if (wfNodeNextId <= 0) {
|
||||||
|
element.unresolved = "AD_WF_Node=" + workflowNodeNextName;
|
||||||
element.defer = true;
|
element.defer = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue