Fixed a handler's endElement method is call multiple time if there are child elements. Fixed transaction name not use for reference lookup.
This commit is contained in:
parent
a32ef3df47
commit
f552160532
|
@ -64,12 +64,12 @@ public class FieldElementHandler extends AbstractElementHandler {
|
|||
MField mField = findPO(ctx, element);
|
||||
if (mField == null)
|
||||
{
|
||||
int AD_Table_ID = ReferenceUtils.resolveReference(ctx, element.parent.properties.get("AD_Table_ID"));
|
||||
int AD_Table_ID = ReferenceUtils.resolveReference(ctx, element.parent.properties.get("AD_Table_ID"), getTrxName(ctx));
|
||||
Element columnElement = element.parent.properties.get("AD_Column_ID");
|
||||
int AD_Column_ID = 0;
|
||||
if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement))
|
||||
{
|
||||
AD_Column_ID = ReferenceUtils.resolveReference(ctx, columnElement);
|
||||
AD_Column_ID = ReferenceUtils.resolveReference(ctx, columnElement, getTrxName(ctx));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ public class FormAccessElementHandler extends AbstractElementHandler {
|
|||
if (getParentId(element, I_AD_Role.Table_Name) > 0) {
|
||||
AD_Role_ID = getParentId(element, I_AD_Role.Table_Name);
|
||||
} else {
|
||||
AD_Role_ID = ReferenceUtils.resolveReference(ctx, element.properties.get("AD_Role_ID"));
|
||||
AD_Role_ID = ReferenceUtils.resolveReference(ctx, element.properties.get("AD_Role_ID"), getTrxName(ctx));
|
||||
}
|
||||
if (AD_Role_ID <= 0)
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ public class FormAccessElementHandler extends AbstractElementHandler {
|
|||
return;
|
||||
}
|
||||
|
||||
int AD_Form_ID = ReferenceUtils.resolveReference(ctx, element.properties.get("AD_Form_ID"));
|
||||
int AD_Form_ID = ReferenceUtils.resolveReference(ctx, element.properties.get("AD_Form_ID"), getTrxName(ctx));
|
||||
if (AD_Form_ID <= 0)
|
||||
{
|
||||
element.defer = true;
|
||||
|
|
|
@ -57,7 +57,7 @@ public class ImpFormatRowElementHandler extends AbstractElementHandler {
|
|||
} else {
|
||||
Element e = element.properties.get(I_AD_ImpFormat_Row.COLUMNNAME_AD_ImpFormat_ID);
|
||||
if (ReferenceUtils.isIDLookup(e) || ReferenceUtils.isUUIDLookup(e))
|
||||
impFormatId = ReferenceUtils.resolveReference(ctx, e);
|
||||
impFormatId = ReferenceUtils.resolveReference(ctx, e, getTrxName(ctx));
|
||||
else
|
||||
impFormatId = findIdByName(ctx, "AD_ImpFormat", e.contents.toString());
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class ImpFormatRowElementHandler extends AbstractElementHandler {
|
|||
Element tableElement = element.properties.get(I_AD_ImpFormat.COLUMNNAME_AD_Table_ID);
|
||||
int tableId = 0;
|
||||
if (ReferenceUtils.isIDLookup(tableElement) || ReferenceUtils.isUUIDLookup(tableElement)) {
|
||||
tableId = ReferenceUtils.resolveReference(ctx, tableElement);
|
||||
tableId = ReferenceUtils.resolveReference(ctx, tableElement, getTrxName(ctx));
|
||||
} else {
|
||||
String tableName = getStringValue(element, I_AD_ImpFormat.COLUMNNAME_AD_Table_ID, excludes);
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class ImpFormatRowElementHandler extends AbstractElementHandler {
|
|||
Element columnElement = element.properties.get(I_AD_ImpFormat_Row.COLUMNNAME_AD_Column_ID);
|
||||
int columnId = 0;
|
||||
if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) {
|
||||
columnId = ReferenceUtils.resolveReference(ctx, columnElement);
|
||||
columnId = ReferenceUtils.resolveReference(ctx, columnElement, getTrxName(ctx));
|
||||
} else {
|
||||
String columnName = getStringValue(element, I_AD_ImpFormat_Row.COLUMNNAME_AD_Column_ID, excludes);
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ public class MenuElementHandler extends AbstractElementHandler {
|
|||
int parentId = 0;
|
||||
if (parentElement != null) {
|
||||
if (ReferenceUtils.isIDLookup(parentElement) || ReferenceUtils.isUUIDLookup(parentElement)) {
|
||||
parentId = ReferenceUtils.resolveReference(ctx, parentElement);
|
||||
parentId = ReferenceUtils.resolveReference(ctx, parentElement, getTrxName(ctx));
|
||||
} else {
|
||||
String parent = getStringValue(element, "Parent_ID");
|
||||
parentId = findIdByName(ctx, "AD_Menu", parent);
|
||||
|
|
|
@ -48,11 +48,11 @@ public class OrgRoleElementHandler extends AbstractElementHandler {
|
|||
roleId = getParentId(element, I_AD_Role.Table_Name);
|
||||
} else {
|
||||
Element roleElement = element.properties.get("AD_Role_ID");
|
||||
roleId = ReferenceUtils.resolveReference(ctx, roleElement);
|
||||
roleId = ReferenceUtils.resolveReference(ctx, roleElement, getTrxName(ctx));
|
||||
}
|
||||
|
||||
Element orgElement = element.properties.get("AD_Org_ID");
|
||||
int orgId = ReferenceUtils.resolveReference(ctx, orgElement);
|
||||
int orgId = ReferenceUtils.resolveReference(ctx, orgElement, getTrxName(ctx));
|
||||
|
||||
Query query = new Query(ctx, "AD_Role_OrgAccess", "AD_Role_ID=? and AD_Org_ID=?", getTrxName(ctx));
|
||||
po = query.setParameters(new Object[]{roleId, orgId})
|
||||
|
|
|
@ -56,7 +56,7 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler {
|
|||
parentId = getParentId(element, I_AD_PrintFormatItem.Table_Name);
|
||||
} else {
|
||||
Element pfElement = element.properties.get(I_AD_PrintFormatItem.COLUMNNAME_AD_PrintFormat_ID);
|
||||
parentId = ReferenceUtils.resolveReference(ctx, pfElement);
|
||||
parentId = ReferenceUtils.resolveReference(ctx, pfElement, getTrxName(ctx));
|
||||
}
|
||||
if (parentId <= 0) {
|
||||
element.defer = true;
|
||||
|
@ -79,10 +79,10 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler {
|
|||
int columnId = 0;
|
||||
Element columnElement = element.properties.get("AD_Column_ID");
|
||||
if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) {
|
||||
columnId = ReferenceUtils.resolveReference(ctx, columnElement);
|
||||
columnId = ReferenceUtils.resolveReference(ctx, columnElement, getTrxName(ctx));
|
||||
} else {
|
||||
Element tableElement = element.properties.get("AD_Table_ID");
|
||||
int tableId = ReferenceUtils.resolveReference(ctx, tableElement);
|
||||
int tableId = ReferenceUtils.resolveReference(ctx, tableElement, getTrxName(ctx));
|
||||
String columnName = getStringValue(element, "AD_Column_ID");
|
||||
columnId = findIdByColumnAndParentId(ctx, "AD_Column", "ColumnName", columnName,
|
||||
"AD_Table", tableId);
|
||||
|
@ -92,7 +92,7 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler {
|
|||
|
||||
excludes.add("AD_PrintFormatChild_ID");
|
||||
Element pfchildElement = element.properties.get(I_AD_PrintFormatItem.COLUMNNAME_AD_PrintFormatChild_ID);
|
||||
int AD_PrintFormatChild_ID = ReferenceUtils.resolveReference(ctx, pfchildElement);
|
||||
int AD_PrintFormatChild_ID = ReferenceUtils.resolveReference(ctx, pfchildElement, getTrxName(ctx));
|
||||
if (AD_PrintFormatChild_ID > 0) {
|
||||
mPrintFormatItem.setAD_PrintFormatChild_ID(AD_PrintFormatChild_ID);
|
||||
} else if (pfchildElement.contents != null && pfchildElement.contents.length() > 0) {
|
||||
|
|
|
@ -50,11 +50,11 @@ public class ProcessAccessElementHandler extends AbstractElementHandler {
|
|||
roleid = getParentId(element, I_AD_Role.Table_Name);
|
||||
} else {
|
||||
Element roleElement = element.properties.get(I_AD_Process_Access.COLUMNNAME_AD_Role_ID);
|
||||
roleid = ReferenceUtils.resolveReference(ctx, roleElement);
|
||||
roleid = ReferenceUtils.resolveReference(ctx, roleElement, getTrxName(ctx));
|
||||
}
|
||||
|
||||
Element processElement = element.properties.get(I_AD_Process_Access.COLUMNNAME_AD_Process_ID);
|
||||
processid = ReferenceUtils.resolveReference(ctx, processElement);
|
||||
processid = ReferenceUtils.resolveReference(ctx, processElement, getTrxName(ctx));
|
||||
|
||||
Query query = new Query(ctx, "AD_Process_Access", "AD_Role_ID=? and AD_Process_ID=?", getTrxName(ctx));
|
||||
po = query.setParameters(new Object[]{roleid, processid}).first();
|
||||
|
|
|
@ -62,7 +62,7 @@ public class ProcessParaElementHandler extends AbstractElementHandler {
|
|||
masterId = getParentId(element, "process");
|
||||
} else {
|
||||
Element processElement = element.properties.get(I_AD_Process_Para.COLUMNNAME_AD_Process_ID);
|
||||
masterId = ReferenceUtils.resolveReference(ctx, processElement);
|
||||
masterId = ReferenceUtils.resolveReference(ctx, processElement, getTrxName(ctx));
|
||||
}
|
||||
if (masterId <= 0) {
|
||||
element.defer = true;
|
||||
|
|
|
@ -56,7 +56,7 @@ public class ReferenceListElementHandler extends AbstractElementHandler {
|
|||
AD_Reference_ID = getParentId(element, I_AD_Reference.Table_Name);
|
||||
} else {
|
||||
Element referenceElement = element.properties.get(I_AD_Ref_List.COLUMNNAME_AD_Reference_ID);
|
||||
AD_Reference_ID = ReferenceUtils.resolveReference(ctx, referenceElement);
|
||||
AD_Reference_ID = ReferenceUtils.resolveReference(ctx, referenceElement, getTrxName(ctx));
|
||||
}
|
||||
|
||||
int AD_Ref_List_ID = findIdByColumnAndParentId(ctx, "AD_Ref_List", "Value", value, "AD_Reference", AD_Reference_ID);
|
||||
|
|
|
@ -61,7 +61,7 @@ public class ReferenceTableElementHandler extends AbstractElementHandler {
|
|||
AD_Reference_ID = getParentId(element, I_AD_Reference.Table_Name);
|
||||
} else {
|
||||
Element referenceElement = element.properties.get(I_AD_Ref_Table.COLUMNNAME_AD_Reference_ID);
|
||||
AD_Reference_ID = ReferenceUtils.resolveReference(ctx, referenceElement);
|
||||
AD_Reference_ID = ReferenceUtils.resolveReference(ctx, referenceElement, getTrxName(ctx));
|
||||
}
|
||||
if (AD_Reference_ID <= 0 && isOfficialId(element, "AD_Reference_ID"))
|
||||
AD_Reference_ID = getIntValue(element, "AD_Reference_ID");
|
||||
|
@ -95,7 +95,7 @@ public class ReferenceTableElementHandler extends AbstractElementHandler {
|
|||
Element displayElement = element.properties.get("AD_Display");
|
||||
int displayColumnId = 0;
|
||||
if (ReferenceUtils.isIDLookup(displayElement) || ReferenceUtils.isUUIDLookup(displayElement)) {
|
||||
displayColumnId = ReferenceUtils.resolveReference(ctx, displayElement);
|
||||
displayColumnId = ReferenceUtils.resolveReference(ctx, displayElement, getTrxName(ctx));
|
||||
} else {
|
||||
displayColumnId = findIdByColumnAndParentId(ctx, "AD_Column", "ColumnName", displayElement.contents.toString(), "AD_Table", tableId);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class ReferenceTableElementHandler extends AbstractElementHandler {
|
|||
Element keyElement = element.properties.get("AD_Key");
|
||||
int keyColumnId = 0;
|
||||
if (ReferenceUtils.isIDLookup(keyElement) || ReferenceUtils.isUUIDLookup(keyElement)) {
|
||||
keyColumnId = ReferenceUtils.resolveReference(ctx, keyElement);
|
||||
keyColumnId = ReferenceUtils.resolveReference(ctx, keyElement, getTrxName(ctx));
|
||||
} else {
|
||||
keyColumnId = findIdByColumnAndParentId(ctx, "AD_Column", "ColumnName", keyElement.contents.toString(), "AD_Table", tableId);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class ReportViewColElementHandler extends AbstractElementHandler {
|
|||
AD_ReportView_ID = getParentId(element, I_AD_ReportView.Table_Name);
|
||||
} else {
|
||||
Element rvElement = element.properties.get(I_AD_ReportView_Col.COLUMNNAME_AD_ReportView_ID);
|
||||
AD_ReportView_ID = ReferenceUtils.resolveReference(ctx, rvElement);
|
||||
AD_ReportView_ID = ReferenceUtils.resolveReference(ctx, rvElement, getTrxName(ctx));
|
||||
}
|
||||
if (AD_ReportView_ID <= 0) {
|
||||
element.defer = true;
|
||||
|
@ -63,11 +63,11 @@ public class ReportViewColElementHandler extends AbstractElementHandler {
|
|||
int AD_Column_ID = 0;
|
||||
Element columnElement = element.properties.get(I_AD_ReportView_Col.COLUMNNAME_AD_Column_ID);
|
||||
if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) {
|
||||
AD_Column_ID = ReferenceUtils.resolveReference(ctx, columnElement);
|
||||
AD_Column_ID = ReferenceUtils.resolveReference(ctx, columnElement, getTrxName(ctx));
|
||||
} else {
|
||||
if (columnElement.contents != null && columnElement.contents.length() > 0) {
|
||||
Element tableElement = element.properties.get("AD_Table_ID");
|
||||
int AD_Table_ID = ReferenceUtils.resolveReference(ctx, tableElement);
|
||||
int AD_Table_ID = ReferenceUtils.resolveReference(ctx, tableElement, getTrxName(ctx));
|
||||
AD_Column_ID = findIdByColumnAndParentId(ctx, "AD_Column", "ColumnName", columnElement.contents.toString(),
|
||||
"AD_Table", AD_Table_ID);
|
||||
if (AD_Column_ID <= 0) {
|
||||
|
|
|
@ -69,7 +69,7 @@ public class TabElementHandler extends AbstractElementHandler {
|
|||
windowId = getParentId(element, I_AD_Window.Table_Name);
|
||||
} else {
|
||||
Element windowElement = element.properties.get(I_AD_Tab.COLUMNNAME_AD_Window_ID);
|
||||
windowId = ReferenceUtils.resolveReference(ctx, windowElement);
|
||||
windowId = ReferenceUtils.resolveReference(ctx, windowElement, getTrxName(ctx));
|
||||
}
|
||||
if (windowId <= 0) {
|
||||
element.defer = true;
|
||||
|
@ -77,7 +77,7 @@ public class TabElementHandler extends AbstractElementHandler {
|
|||
}
|
||||
|
||||
Element tableElement = element.properties.get(I_AD_Tab.COLUMNNAME_AD_Table_ID);
|
||||
int tableId = ReferenceUtils.resolveReference(ctx, tableElement);
|
||||
int tableId = ReferenceUtils.resolveReference(ctx, tableElement, getTrxName(ctx));
|
||||
if (tableId <= 0) {
|
||||
element.defer = true;
|
||||
return;
|
||||
|
@ -101,7 +101,7 @@ public class TabElementHandler extends AbstractElementHandler {
|
|||
Element columnElement = element.properties.get(I_AD_Tab.COLUMNNAME_AD_Column_ID);
|
||||
int AD_Column_ID = 0;
|
||||
if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) {
|
||||
AD_Column_ID = ReferenceUtils.resolveReference(ctx, columnElement);
|
||||
AD_Column_ID = ReferenceUtils.resolveReference(ctx, columnElement, getTrxName(ctx));
|
||||
} else if (columnElement.contents != null && columnElement.contents.length() > 0){
|
||||
AD_Column_ID = findIdByColumnAndParentId (ctx, "AD_Column","ColumnName", columnElement.contents.toString(),
|
||||
"AD_Table", mTab.getAD_Table_ID());
|
||||
|
@ -111,7 +111,7 @@ public class TabElementHandler extends AbstractElementHandler {
|
|||
columnElement = element.properties.get(I_AD_Tab.COLUMNNAME_AD_ColumnSortOrder_ID);
|
||||
AD_Column_ID = 0;
|
||||
if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) {
|
||||
AD_Column_ID = ReferenceUtils.resolveReference(ctx, columnElement);
|
||||
AD_Column_ID = ReferenceUtils.resolveReference(ctx, columnElement, getTrxName(ctx));
|
||||
} else if (columnElement.contents != null && columnElement.contents.length() > 0){
|
||||
AD_Column_ID = findIdByColumnAndParentId (ctx, "AD_Column","ColumnName", columnElement.contents.toString(),
|
||||
"AD_Table", mTab.getAD_Table_ID());
|
||||
|
@ -121,7 +121,7 @@ public class TabElementHandler extends AbstractElementHandler {
|
|||
columnElement = element.properties.get(I_AD_Tab.COLUMNNAME_AD_ColumnSortYesNo_ID);
|
||||
AD_Column_ID = 0;
|
||||
if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) {
|
||||
AD_Column_ID = ReferenceUtils.resolveReference(ctx, columnElement);
|
||||
AD_Column_ID = ReferenceUtils.resolveReference(ctx, columnElement, getTrxName(ctx));
|
||||
} else if (columnElement.contents != null && columnElement.contents.length() > 0){
|
||||
AD_Column_ID = findIdByColumnAndParentId (ctx, "AD_Column","ColumnName", columnElement.contents.toString(),
|
||||
"AD_Table", mTab.getAD_Table_ID());
|
||||
|
|
|
@ -50,11 +50,11 @@ public class TaskAccessElementHandler extends AbstractElementHandler {
|
|||
roleid = getParentId(element, I_AD_Role.Table_Name);
|
||||
} else {
|
||||
Element roleElement = element.properties.get(I_AD_Task_Access.COLUMNNAME_AD_Role_ID);
|
||||
roleid = ReferenceUtils.resolveReference(ctx, roleElement);
|
||||
roleid = ReferenceUtils.resolveReference(ctx, roleElement, getTrxName(ctx));
|
||||
}
|
||||
|
||||
Element taskElement = element.properties.get(I_AD_Task_Access.COLUMNNAME_AD_Task_ID);
|
||||
taskid = ReferenceUtils.resolveReference(ctx, taskElement);
|
||||
taskid = ReferenceUtils.resolveReference(ctx, taskElement, getTrxName(ctx));
|
||||
|
||||
Query query = new Query(ctx, "AD_Task_Access", "AD_Role_ID=? and AD_Task_ID=?", getTrxName(ctx));
|
||||
po = query.setParameters(new Object[]{roleid, taskid}).first();
|
||||
|
|
|
@ -48,17 +48,17 @@ public class UserRoleElementHandler extends AbstractElementHandler {
|
|||
X_AD_User_Roles po = findPO(ctx, element);
|
||||
if (po == null) {
|
||||
Element userElement = element.properties.get(I_AD_User_Roles.COLUMNNAME_AD_User_ID);
|
||||
userid = ReferenceUtils.resolveReference(ctx, userElement);
|
||||
userid = ReferenceUtils.resolveReference(ctx, userElement, getTrxName(ctx));
|
||||
|
||||
if (getParentId(element, "role") > 0) {
|
||||
roleid = getParentId(element, "role");
|
||||
} else {
|
||||
Element roleElement = element.properties.get(I_AD_User_Roles.COLUMNNAME_AD_Role_ID);
|
||||
roleid = ReferenceUtils.resolveReference(ctx, roleElement);
|
||||
roleid = ReferenceUtils.resolveReference(ctx, roleElement, getTrxName(ctx));
|
||||
}
|
||||
|
||||
Element orgElement = element.properties.get(I_AD_User_Roles.COLUMNNAME_AD_Org_ID);
|
||||
orgid = ReferenceUtils.resolveReference(ctx, orgElement);
|
||||
orgid = ReferenceUtils.resolveReference(ctx, orgElement, getTrxName(ctx));
|
||||
|
||||
Query query = new Query(ctx, "AD_User_Roles", "AD_User_ID = ? AND AD_Role_ID = ? AND AD_Org_ID = ?", getTrxName(ctx));
|
||||
po = query.setParameters(new Object[]{userid, roleid, orgid}).first();
|
||||
|
|
|
@ -50,7 +50,7 @@ public class WindowAccessElementHandler extends AbstractElementHandler {
|
|||
roleid = getParentId(element, I_AD_Role.Table_Name);
|
||||
} else {
|
||||
Element roleElement = element.properties.get(I_AD_Window_Access.COLUMNNAME_AD_Role_ID);
|
||||
roleid = ReferenceUtils.resolveReference(ctx, roleElement);
|
||||
roleid = ReferenceUtils.resolveReference(ctx, roleElement, getTrxName(ctx));
|
||||
}
|
||||
if (roleid <= 0) {
|
||||
element.defer = true;
|
||||
|
@ -58,7 +58,7 @@ public class WindowAccessElementHandler extends AbstractElementHandler {
|
|||
}
|
||||
|
||||
Element windowElement = element.properties.get(I_AD_Window_Access.COLUMNNAME_AD_Window_ID);
|
||||
windowid = ReferenceUtils.resolveReference(ctx, windowElement);
|
||||
windowid = ReferenceUtils.resolveReference(ctx, windowElement, getTrxName(ctx));
|
||||
if (windowid <= 0) {
|
||||
element.defer = true;
|
||||
return;
|
||||
|
|
|
@ -50,11 +50,11 @@ public class WorkflowAccessElementHandler extends AbstractElementHandler {
|
|||
roleid = getParentId(element, I_AD_Role.Table_Name);
|
||||
} else {
|
||||
Element roleElement = element.properties.get(I_AD_Workflow_Access.COLUMNNAME_AD_Role_ID);
|
||||
roleid = ReferenceUtils.resolveReference(ctx, roleElement);
|
||||
roleid = ReferenceUtils.resolveReference(ctx, roleElement, getTrxName(ctx));
|
||||
}
|
||||
|
||||
Element wfElement = element.properties.get(I_AD_Workflow_Access.COLUMNNAME_AD_Workflow_ID);
|
||||
workflowid = ReferenceUtils.resolveReference(ctx, wfElement);
|
||||
workflowid = ReferenceUtils.resolveReference(ctx, wfElement, getTrxName(ctx));
|
||||
|
||||
Query query = new Query(ctx, "AD_Workflow_Access", "AD_Role_ID=? and AD_Workflow_ID=?", getTrxName(ctx));
|
||||
po = query.setParameters(new Object[]{roleid, workflowid}).first();
|
||||
|
|
|
@ -63,7 +63,7 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler {
|
|||
if (getParentId(element, I_AD_Workflow.Table_Name) > 0) {
|
||||
workflowId = getParentId(element, I_AD_Workflow.Table_Name);
|
||||
} else {
|
||||
workflowId = ReferenceUtils.resolveReference(ctx, wfElement);
|
||||
workflowId = ReferenceUtils.resolveReference(ctx, wfElement, getTrxName(ctx));
|
||||
}
|
||||
if (workflowId <= 0) {
|
||||
element.defer = true;
|
||||
|
|
|
@ -59,7 +59,7 @@ public class WorkflowNodeNextConditionElementHandler extends
|
|||
if (getParentId(element, I_AD_Workflow.Table_Name) > 0) {
|
||||
workflowId = getParentId(element, I_AD_Workflow.Table_Name);
|
||||
} else {
|
||||
workflowId = ReferenceUtils.resolveReference(ctx, wfElement);
|
||||
workflowId = ReferenceUtils.resolveReference(ctx, wfElement, getTrxName(ctx));
|
||||
}
|
||||
if (workflowId <= 0) {
|
||||
element.defer = true;
|
||||
|
@ -70,10 +70,10 @@ public class WorkflowNodeNextConditionElementHandler extends
|
|||
int AD_WF_NodeNext_ID = 0;
|
||||
Element nodeNextElement = element.properties.get(I_AD_WF_NextCondition.COLUMNNAME_AD_WF_NodeNext_ID);
|
||||
if (ReferenceUtils.isIDLookup(nodeNextElement) || ReferenceUtils.isUUIDLookup(nodeNextElement)) {
|
||||
AD_WF_NodeNext_ID = ReferenceUtils.resolveReference(ctx, nodeNextElement);
|
||||
AD_WF_NodeNext_ID = ReferenceUtils.resolveReference(ctx, nodeNextElement, getTrxName(ctx));
|
||||
} else {
|
||||
Element wfnElement = element.properties.get("AD_WF_Node_ID");
|
||||
int wfNodeId = ReferenceUtils.resolveReference(ctx, wfnElement);
|
||||
int wfNodeId = ReferenceUtils.resolveReference(ctx, wfnElement, getTrxName(ctx));
|
||||
if (wfNodeId <= 0) {
|
||||
element.unresolved = "AD_WF_Node=" + wfnElement.contents;
|
||||
element.defer = true;
|
||||
|
@ -81,7 +81,7 @@ public class WorkflowNodeNextConditionElementHandler extends
|
|||
}
|
||||
|
||||
Element nextElement = element.properties.get("AD_WF_Next_ID");
|
||||
int wfNodeNextId = ReferenceUtils.resolveReference(ctx, nextElement);
|
||||
int wfNodeNextId = ReferenceUtils.resolveReference(ctx, nextElement, getTrxName(ctx));
|
||||
if (wfNodeNextId <= 0) {
|
||||
element.unresolved = "AD_WF_Node=" + nextElement.contents;
|
||||
element.defer = true;
|
||||
|
@ -107,9 +107,9 @@ public class WorkflowNodeNextConditionElementHandler extends
|
|||
Element columnElement = element.properties.get("AD_Column_ID");
|
||||
int columnId = 0;
|
||||
if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) {
|
||||
columnId = ReferenceUtils.resolveReference(ctx, columnElement);
|
||||
columnId = ReferenceUtils.resolveReference(ctx, columnElement, getTrxName(ctx));
|
||||
} else {
|
||||
int AD_Table_ID = ReferenceUtils.resolveReference(ctx, tableElement);
|
||||
int AD_Table_ID = ReferenceUtils.resolveReference(ctx, tableElement, getTrxName(ctx));
|
||||
columnId = findIdByColumnAndParentId(ctx, "AD_Column", "ColumnName", columnElement.contents.toString(), "AD_Table", AD_Table_ID);
|
||||
}
|
||||
mWFNodeNextCondition.setAD_Column_ID(columnId);
|
||||
|
|
|
@ -58,7 +58,7 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
|
|||
if (getParentId(element, I_AD_Workflow.Table_Name) > 0) {
|
||||
workflowId = getParentId(element, I_AD_Workflow.Table_Name);
|
||||
} else {
|
||||
workflowId = ReferenceUtils.resolveReference(ctx, wfElement);
|
||||
workflowId = ReferenceUtils.resolveReference(ctx, wfElement, getTrxName(ctx));
|
||||
}
|
||||
if (workflowId <= 0) {
|
||||
element.defer = true;
|
||||
|
@ -69,7 +69,7 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
|
|||
int wfNodeId = 0;
|
||||
Element wfnElement = element.properties.get(I_AD_WF_NodeNext.COLUMNNAME_AD_WF_Node_ID);
|
||||
if (ReferenceUtils.isIDLookup(wfnElement) || ReferenceUtils.isUUIDLookup(wfnElement)) {
|
||||
wfNodeId = ReferenceUtils.resolveReference(ctx, wfnElement);
|
||||
wfNodeId = ReferenceUtils.resolveReference(ctx, wfnElement, getTrxName(ctx));
|
||||
} else {
|
||||
wfNodeId = DB.getSQLValue(getTrxName(ctx), "SELECT AD_WF_Node_Id FROM AD_WF_Node WHERE AD_Workflow_ID=? AND Value=? AND AD_Client_ID=?",
|
||||
workflowId, wfnElement.contents.toString(), Env.getAD_Client_ID(ctx));
|
||||
|
@ -83,7 +83,7 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
|
|||
int AD_WF_Next_ID = 0;
|
||||
Element nextElement = element.properties.get(I_AD_WF_NodeNext.COLUMNNAME_AD_WF_Next_ID);
|
||||
if (ReferenceUtils.isIDLookup(nextElement) || ReferenceUtils.isUUIDLookup(nextElement)) {
|
||||
AD_WF_Next_ID = ReferenceUtils.resolveReference(ctx, nextElement);
|
||||
AD_WF_Next_ID = ReferenceUtils.resolveReference(ctx, nextElement, getTrxName(ctx));
|
||||
} else {
|
||||
AD_WF_Next_ID = DB.getSQLValue(getTrxName(ctx), "SELECT AD_WF_Node_Id FROM AD_WF_Node WHERE AD_Workflow_ID=? AND Value=? AND AD_Client_ID=?",
|
||||
workflowId, nextElement.contents.toString(), Env.getAD_Client_ID(ctx));
|
||||
|
|
|
@ -275,6 +275,8 @@ public class PackInHandler extends DefaultHandler {
|
|||
for (Element childElement : element.childrens)
|
||||
{
|
||||
processElement(childElement);
|
||||
}
|
||||
|
||||
if (element.defer) {
|
||||
defer.add(new DeferEntry(element, false));
|
||||
} else {
|
||||
|
@ -290,8 +292,6 @@ public class PackInHandler extends DefaultHandler {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void createLogHeader(Attributes atts) throws SAXException {
|
||||
AttributesImpl attsOut = new AttributesImpl();
|
||||
logDocument.startElement("","","adempiereDocument",attsOut);
|
||||
|
|
|
@ -142,7 +142,7 @@ public class PoFiller{
|
|||
String value = e.contents.toString();
|
||||
String columnName = qName;
|
||||
if (value != null && value.trim().length() > 0) {
|
||||
int id = ReferenceUtils.resolveReference(ctx, e);
|
||||
int id = ReferenceUtils.resolveReference(ctx, e, po.get_TrxName());
|
||||
if (columnName.equals("AD_Client_ID") && id > 0) {
|
||||
if (id != Env.getAD_Client_ID(ctx)) {
|
||||
return -1;
|
||||
|
|
|
@ -9,7 +9,14 @@ import org.xml.sax.helpers.AttributesImpl;
|
|||
|
||||
public class ReferenceUtils {
|
||||
|
||||
public static int resolveReference(Properties ctx, Element e)
|
||||
/**
|
||||
*
|
||||
* @param ctx
|
||||
* @param e
|
||||
* @param trxName
|
||||
* @return positive id if found
|
||||
*/
|
||||
public static int resolveReference(Properties ctx, Element e, String trxName)
|
||||
{
|
||||
String value = e.contents.toString();
|
||||
String referenceKey = e.attributes.getValue("reference-key");
|
||||
|
@ -23,7 +30,7 @@ public class ReferenceUtils {
|
|||
String tableName = names[0];
|
||||
String searchColumn = names[1];
|
||||
|
||||
return IDFinder.findIdByColumn(tableName, searchColumn, value.trim(), Env.getAD_Client_ID(ctx), null);
|
||||
return IDFinder.findIdByColumn(tableName, searchColumn, value.trim(), Env.getAD_Client_ID(ctx), trxName);
|
||||
}
|
||||
else if (isIDLookup(e))
|
||||
{
|
||||
|
@ -32,7 +39,7 @@ public class ReferenceUtils {
|
|||
}
|
||||
else if (isUUIDLookup(e))
|
||||
{
|
||||
return IDFinder.findIdByColumn(referenceKey, referenceKey + "_UU", value.trim(), Env.getAD_Client_ID(ctx), null);
|
||||
return IDFinder.findIdByColumn(referenceKey, referenceKey + "_UU", value.trim(), Env.getAD_Client_ID(ctx), trxName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue