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:
Heng Sin Low 2010-12-26 10:19:53 +08:00
parent a32ef3df47
commit f552160532
22 changed files with 176 additions and 169 deletions

View File

@ -64,12 +64,12 @@ public class FieldElementHandler extends AbstractElementHandler {
MField mField = findPO(ctx, element); MField mField = findPO(ctx, element);
if (mField == null) 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"); Element columnElement = element.parent.properties.get("AD_Column_ID");
int AD_Column_ID = 0; int AD_Column_ID = 0;
if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement))
{ {
AD_Column_ID = ReferenceUtils.resolveReference(ctx, columnElement); AD_Column_ID = ReferenceUtils.resolveReference(ctx, columnElement, getTrxName(ctx));
} }
else else
{ {

View File

@ -49,7 +49,7 @@ public class FormAccessElementHandler extends AbstractElementHandler {
if (getParentId(element, I_AD_Role.Table_Name) > 0) { if (getParentId(element, I_AD_Role.Table_Name) > 0) {
AD_Role_ID = getParentId(element, I_AD_Role.Table_Name); AD_Role_ID = getParentId(element, I_AD_Role.Table_Name);
} else { } 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) if (AD_Role_ID <= 0)
{ {
@ -57,7 +57,7 @@ public class FormAccessElementHandler extends AbstractElementHandler {
return; 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) if (AD_Form_ID <= 0)
{ {
element.defer = true; element.defer = true;

View File

@ -57,7 +57,7 @@ public class ImpFormatRowElementHandler extends AbstractElementHandler {
} else { } else {
Element e = element.properties.get(I_AD_ImpFormat_Row.COLUMNNAME_AD_ImpFormat_ID); Element e = element.properties.get(I_AD_ImpFormat_Row.COLUMNNAME_AD_ImpFormat_ID);
if (ReferenceUtils.isIDLookup(e) || ReferenceUtils.isUUIDLookup(e)) if (ReferenceUtils.isIDLookup(e) || ReferenceUtils.isUUIDLookup(e))
impFormatId = ReferenceUtils.resolveReference(ctx, e); impFormatId = ReferenceUtils.resolveReference(ctx, e, getTrxName(ctx));
else else
impFormatId = findIdByName(ctx, "AD_ImpFormat", e.contents.toString()); 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); Element tableElement = element.properties.get(I_AD_ImpFormat.COLUMNNAME_AD_Table_ID);
int tableId = 0; int tableId = 0;
if (ReferenceUtils.isIDLookup(tableElement) || ReferenceUtils.isUUIDLookup(tableElement)) { if (ReferenceUtils.isIDLookup(tableElement) || ReferenceUtils.isUUIDLookup(tableElement)) {
tableId = ReferenceUtils.resolveReference(ctx, tableElement); tableId = ReferenceUtils.resolveReference(ctx, tableElement, getTrxName(ctx));
} else { } else {
String tableName = getStringValue(element, I_AD_ImpFormat.COLUMNNAME_AD_Table_ID, excludes); 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); Element columnElement = element.properties.get(I_AD_ImpFormat_Row.COLUMNNAME_AD_Column_ID);
int columnId = 0; int columnId = 0;
if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) { if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) {
columnId = ReferenceUtils.resolveReference(ctx, columnElement); columnId = ReferenceUtils.resolveReference(ctx, columnElement, getTrxName(ctx));
} else { } else {
String columnName = getStringValue(element, I_AD_ImpFormat_Row.COLUMNNAME_AD_Column_ID, excludes); String columnName = getStringValue(element, I_AD_ImpFormat_Row.COLUMNNAME_AD_Column_ID, excludes);

View File

@ -108,7 +108,7 @@ public class MenuElementHandler extends AbstractElementHandler {
int parentId = 0; int parentId = 0;
if (parentElement != null) { if (parentElement != null) {
if (ReferenceUtils.isIDLookup(parentElement) || ReferenceUtils.isUUIDLookup(parentElement)) { if (ReferenceUtils.isIDLookup(parentElement) || ReferenceUtils.isUUIDLookup(parentElement)) {
parentId = ReferenceUtils.resolveReference(ctx, parentElement); parentId = ReferenceUtils.resolveReference(ctx, parentElement, getTrxName(ctx));
} else { } else {
String parent = getStringValue(element, "Parent_ID"); String parent = getStringValue(element, "Parent_ID");
parentId = findIdByName(ctx, "AD_Menu", parent); parentId = findIdByName(ctx, "AD_Menu", parent);

View File

@ -48,11 +48,11 @@ public class OrgRoleElementHandler extends AbstractElementHandler {
roleId = getParentId(element, I_AD_Role.Table_Name); roleId = getParentId(element, I_AD_Role.Table_Name);
} else { } else {
Element roleElement = element.properties.get("AD_Role_ID"); 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"); 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)); Query query = new Query(ctx, "AD_Role_OrgAccess", "AD_Role_ID=? and AD_Org_ID=?", getTrxName(ctx));
po = query.setParameters(new Object[]{roleId, orgId}) po = query.setParameters(new Object[]{roleId, orgId})

View File

@ -56,7 +56,7 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler {
parentId = getParentId(element, I_AD_PrintFormatItem.Table_Name); parentId = getParentId(element, I_AD_PrintFormatItem.Table_Name);
} else { } else {
Element pfElement = element.properties.get(I_AD_PrintFormatItem.COLUMNNAME_AD_PrintFormat_ID); 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) { if (parentId <= 0) {
element.defer = true; element.defer = true;
@ -79,10 +79,10 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler {
int columnId = 0; int columnId = 0;
Element columnElement = element.properties.get("AD_Column_ID"); Element columnElement = element.properties.get("AD_Column_ID");
if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) { if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) {
columnId = ReferenceUtils.resolveReference(ctx, columnElement); columnId = ReferenceUtils.resolveReference(ctx, columnElement, getTrxName(ctx));
} else { } else {
Element tableElement = element.properties.get("AD_Table_ID"); 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"); String columnName = getStringValue(element, "AD_Column_ID");
columnId = findIdByColumnAndParentId(ctx, "AD_Column", "ColumnName", columnName, columnId = findIdByColumnAndParentId(ctx, "AD_Column", "ColumnName", columnName,
"AD_Table", tableId); "AD_Table", tableId);
@ -92,7 +92,7 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler {
excludes.add("AD_PrintFormatChild_ID"); excludes.add("AD_PrintFormatChild_ID");
Element pfchildElement = element.properties.get(I_AD_PrintFormatItem.COLUMNNAME_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) { if (AD_PrintFormatChild_ID > 0) {
mPrintFormatItem.setAD_PrintFormatChild_ID(AD_PrintFormatChild_ID); mPrintFormatItem.setAD_PrintFormatChild_ID(AD_PrintFormatChild_ID);
} else if (pfchildElement.contents != null && pfchildElement.contents.length() > 0) { } else if (pfchildElement.contents != null && pfchildElement.contents.length() > 0) {

View File

@ -50,11 +50,11 @@ public class ProcessAccessElementHandler extends AbstractElementHandler {
roleid = getParentId(element, I_AD_Role.Table_Name); roleid = getParentId(element, I_AD_Role.Table_Name);
} else { } else {
Element roleElement = element.properties.get(I_AD_Process_Access.COLUMNNAME_AD_Role_ID); 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); 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)); 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(); po = query.setParameters(new Object[]{roleid, processid}).first();

View File

@ -62,7 +62,7 @@ public class ProcessParaElementHandler extends AbstractElementHandler {
masterId = getParentId(element, "process"); masterId = getParentId(element, "process");
} else { } else {
Element processElement = element.properties.get(I_AD_Process_Para.COLUMNNAME_AD_Process_ID); 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) { if (masterId <= 0) {
element.defer = true; element.defer = true;

View File

@ -56,7 +56,7 @@ public class ReferenceListElementHandler extends AbstractElementHandler {
AD_Reference_ID = getParentId(element, I_AD_Reference.Table_Name); AD_Reference_ID = getParentId(element, I_AD_Reference.Table_Name);
} else { } else {
Element referenceElement = element.properties.get(I_AD_Ref_List.COLUMNNAME_AD_Reference_ID); 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); int AD_Ref_List_ID = findIdByColumnAndParentId(ctx, "AD_Ref_List", "Value", value, "AD_Reference", AD_Reference_ID);

View File

@ -61,7 +61,7 @@ public class ReferenceTableElementHandler extends AbstractElementHandler {
AD_Reference_ID = getParentId(element, I_AD_Reference.Table_Name); AD_Reference_ID = getParentId(element, I_AD_Reference.Table_Name);
} else { } else {
Element referenceElement = element.properties.get(I_AD_Ref_Table.COLUMNNAME_AD_Reference_ID); 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")) if (AD_Reference_ID <= 0 && isOfficialId(element, "AD_Reference_ID"))
AD_Reference_ID = getIntValue(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"); Element displayElement = element.properties.get("AD_Display");
int displayColumnId = 0; int displayColumnId = 0;
if (ReferenceUtils.isIDLookup(displayElement) || ReferenceUtils.isUUIDLookup(displayElement)) { if (ReferenceUtils.isIDLookup(displayElement) || ReferenceUtils.isUUIDLookup(displayElement)) {
displayColumnId = ReferenceUtils.resolveReference(ctx, displayElement); displayColumnId = ReferenceUtils.resolveReference(ctx, displayElement, getTrxName(ctx));
} else { } else {
displayColumnId = findIdByColumnAndParentId(ctx, "AD_Column", "ColumnName", displayElement.contents.toString(), "AD_Table", tableId); 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"); Element keyElement = element.properties.get("AD_Key");
int keyColumnId = 0; int keyColumnId = 0;
if (ReferenceUtils.isIDLookup(keyElement) || ReferenceUtils.isUUIDLookup(keyElement)) { if (ReferenceUtils.isIDLookup(keyElement) || ReferenceUtils.isUUIDLookup(keyElement)) {
keyColumnId = ReferenceUtils.resolveReference(ctx, keyElement); keyColumnId = ReferenceUtils.resolveReference(ctx, keyElement, getTrxName(ctx));
} else { } else {
keyColumnId = findIdByColumnAndParentId(ctx, "AD_Column", "ColumnName", keyElement.contents.toString(), "AD_Table", tableId); keyColumnId = findIdByColumnAndParentId(ctx, "AD_Column", "ColumnName", keyElement.contents.toString(), "AD_Table", tableId);
} }

View File

@ -53,7 +53,7 @@ public class ReportViewColElementHandler extends AbstractElementHandler {
AD_ReportView_ID = getParentId(element, I_AD_ReportView.Table_Name); AD_ReportView_ID = getParentId(element, I_AD_ReportView.Table_Name);
} else { } else {
Element rvElement = element.properties.get(I_AD_ReportView_Col.COLUMNNAME_AD_ReportView_ID); 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) { if (AD_ReportView_ID <= 0) {
element.defer = true; element.defer = true;
@ -63,11 +63,11 @@ public class ReportViewColElementHandler extends AbstractElementHandler {
int AD_Column_ID = 0; int AD_Column_ID = 0;
Element columnElement = element.properties.get(I_AD_ReportView_Col.COLUMNNAME_AD_Column_ID); Element columnElement = element.properties.get(I_AD_ReportView_Col.COLUMNNAME_AD_Column_ID);
if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) { if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) {
AD_Column_ID = ReferenceUtils.resolveReference(ctx, columnElement); AD_Column_ID = ReferenceUtils.resolveReference(ctx, columnElement, getTrxName(ctx));
} else { } else {
if (columnElement.contents != null && columnElement.contents.length() > 0) { if (columnElement.contents != null && columnElement.contents.length() > 0) {
Element tableElement = element.properties.get("AD_Table_ID"); 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_Column_ID = findIdByColumnAndParentId(ctx, "AD_Column", "ColumnName", columnElement.contents.toString(),
"AD_Table", AD_Table_ID); "AD_Table", AD_Table_ID);
if (AD_Column_ID <= 0) { if (AD_Column_ID <= 0) {

View File

@ -69,7 +69,7 @@ public class TabElementHandler extends AbstractElementHandler {
windowId = getParentId(element, I_AD_Window.Table_Name); windowId = getParentId(element, I_AD_Window.Table_Name);
} else { } else {
Element windowElement = element.properties.get(I_AD_Tab.COLUMNNAME_AD_Window_ID); 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) { if (windowId <= 0) {
element.defer = true; element.defer = true;
@ -77,7 +77,7 @@ public class TabElementHandler extends AbstractElementHandler {
} }
Element tableElement = element.properties.get(I_AD_Tab.COLUMNNAME_AD_Table_ID); 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) { if (tableId <= 0) {
element.defer = true; element.defer = true;
return; return;
@ -101,7 +101,7 @@ public class TabElementHandler extends AbstractElementHandler {
Element columnElement = element.properties.get(I_AD_Tab.COLUMNNAME_AD_Column_ID); Element columnElement = element.properties.get(I_AD_Tab.COLUMNNAME_AD_Column_ID);
int AD_Column_ID = 0; int AD_Column_ID = 0;
if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) { 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){ } else if (columnElement.contents != null && columnElement.contents.length() > 0){
AD_Column_ID = findIdByColumnAndParentId (ctx, "AD_Column","ColumnName", columnElement.contents.toString(), AD_Column_ID = findIdByColumnAndParentId (ctx, "AD_Column","ColumnName", columnElement.contents.toString(),
"AD_Table", mTab.getAD_Table_ID()); "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); columnElement = element.properties.get(I_AD_Tab.COLUMNNAME_AD_ColumnSortOrder_ID);
AD_Column_ID = 0; AD_Column_ID = 0;
if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) { 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){ } else if (columnElement.contents != null && columnElement.contents.length() > 0){
AD_Column_ID = findIdByColumnAndParentId (ctx, "AD_Column","ColumnName", columnElement.contents.toString(), AD_Column_ID = findIdByColumnAndParentId (ctx, "AD_Column","ColumnName", columnElement.contents.toString(),
"AD_Table", mTab.getAD_Table_ID()); "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); columnElement = element.properties.get(I_AD_Tab.COLUMNNAME_AD_ColumnSortYesNo_ID);
AD_Column_ID = 0; AD_Column_ID = 0;
if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) { 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){ } else if (columnElement.contents != null && columnElement.contents.length() > 0){
AD_Column_ID = findIdByColumnAndParentId (ctx, "AD_Column","ColumnName", columnElement.contents.toString(), AD_Column_ID = findIdByColumnAndParentId (ctx, "AD_Column","ColumnName", columnElement.contents.toString(),
"AD_Table", mTab.getAD_Table_ID()); "AD_Table", mTab.getAD_Table_ID());

View File

@ -50,11 +50,11 @@ public class TaskAccessElementHandler extends AbstractElementHandler {
roleid = getParentId(element, I_AD_Role.Table_Name); roleid = getParentId(element, I_AD_Role.Table_Name);
} else { } else {
Element roleElement = element.properties.get(I_AD_Task_Access.COLUMNNAME_AD_Role_ID); 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); 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)); 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(); po = query.setParameters(new Object[]{roleid, taskid}).first();

View File

@ -48,17 +48,17 @@ public class UserRoleElementHandler extends AbstractElementHandler {
X_AD_User_Roles po = findPO(ctx, element); X_AD_User_Roles po = findPO(ctx, element);
if (po == null) { if (po == null) {
Element userElement = element.properties.get(I_AD_User_Roles.COLUMNNAME_AD_User_ID); 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) { if (getParentId(element, "role") > 0) {
roleid = getParentId(element, "role"); roleid = getParentId(element, "role");
} else { } else {
Element roleElement = element.properties.get(I_AD_User_Roles.COLUMNNAME_AD_Role_ID); 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); 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)); 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(); po = query.setParameters(new Object[]{userid, roleid, orgid}).first();

View File

@ -50,7 +50,7 @@ public class WindowAccessElementHandler extends AbstractElementHandler {
roleid = getParentId(element, I_AD_Role.Table_Name); roleid = getParentId(element, I_AD_Role.Table_Name);
} else { } else {
Element roleElement = element.properties.get(I_AD_Window_Access.COLUMNNAME_AD_Role_ID); 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) { if (roleid <= 0) {
element.defer = true; 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); 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) { if (windowid <= 0) {
element.defer = true; element.defer = true;
return; return;

View File

@ -50,11 +50,11 @@ public class WorkflowAccessElementHandler extends AbstractElementHandler {
roleid = getParentId(element, I_AD_Role.Table_Name); roleid = getParentId(element, I_AD_Role.Table_Name);
} else { } else {
Element roleElement = element.properties.get(I_AD_Workflow_Access.COLUMNNAME_AD_Role_ID); 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); 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)); 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(); po = query.setParameters(new Object[]{roleid, workflowid}).first();

View File

@ -63,7 +63,7 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler {
if (getParentId(element, I_AD_Workflow.Table_Name) > 0) { if (getParentId(element, I_AD_Workflow.Table_Name) > 0) {
workflowId = getParentId(element, I_AD_Workflow.Table_Name); workflowId = getParentId(element, I_AD_Workflow.Table_Name);
} else { } else {
workflowId = ReferenceUtils.resolveReference(ctx, wfElement); workflowId = ReferenceUtils.resolveReference(ctx, wfElement, getTrxName(ctx));
} }
if (workflowId <= 0) { if (workflowId <= 0) {
element.defer = true; element.defer = true;

View File

@ -59,7 +59,7 @@ public class WorkflowNodeNextConditionElementHandler extends
if (getParentId(element, I_AD_Workflow.Table_Name) > 0) { if (getParentId(element, I_AD_Workflow.Table_Name) > 0) {
workflowId = getParentId(element, I_AD_Workflow.Table_Name); workflowId = getParentId(element, I_AD_Workflow.Table_Name);
} else { } else {
workflowId = ReferenceUtils.resolveReference(ctx, wfElement); workflowId = ReferenceUtils.resolveReference(ctx, wfElement, getTrxName(ctx));
} }
if (workflowId <= 0) { if (workflowId <= 0) {
element.defer = true; element.defer = true;
@ -70,10 +70,10 @@ public class WorkflowNodeNextConditionElementHandler extends
int AD_WF_NodeNext_ID = 0; int AD_WF_NodeNext_ID = 0;
Element nodeNextElement = element.properties.get(I_AD_WF_NextCondition.COLUMNNAME_AD_WF_NodeNext_ID); Element nodeNextElement = element.properties.get(I_AD_WF_NextCondition.COLUMNNAME_AD_WF_NodeNext_ID);
if (ReferenceUtils.isIDLookup(nodeNextElement) || ReferenceUtils.isUUIDLookup(nodeNextElement)) { 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 { } else {
Element wfnElement = element.properties.get("AD_WF_Node_ID"); 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) { if (wfNodeId <= 0) {
element.unresolved = "AD_WF_Node=" + wfnElement.contents; element.unresolved = "AD_WF_Node=" + wfnElement.contents;
element.defer = true; element.defer = true;
@ -81,7 +81,7 @@ public class WorkflowNodeNextConditionElementHandler extends
} }
Element nextElement = element.properties.get("AD_WF_Next_ID"); 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) { if (wfNodeNextId <= 0) {
element.unresolved = "AD_WF_Node=" + nextElement.contents; element.unresolved = "AD_WF_Node=" + nextElement.contents;
element.defer = true; element.defer = true;
@ -107,9 +107,9 @@ public class WorkflowNodeNextConditionElementHandler extends
Element columnElement = element.properties.get("AD_Column_ID"); Element columnElement = element.properties.get("AD_Column_ID");
int columnId = 0; int columnId = 0;
if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) { if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) {
columnId = ReferenceUtils.resolveReference(ctx, columnElement); columnId = ReferenceUtils.resolveReference(ctx, columnElement, getTrxName(ctx));
} else { } 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); columnId = findIdByColumnAndParentId(ctx, "AD_Column", "ColumnName", columnElement.contents.toString(), "AD_Table", AD_Table_ID);
} }
mWFNodeNextCondition.setAD_Column_ID(columnId); mWFNodeNextCondition.setAD_Column_ID(columnId);

View File

@ -58,7 +58,7 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
if (getParentId(element, I_AD_Workflow.Table_Name) > 0) { if (getParentId(element, I_AD_Workflow.Table_Name) > 0) {
workflowId = getParentId(element, I_AD_Workflow.Table_Name); workflowId = getParentId(element, I_AD_Workflow.Table_Name);
} else { } else {
workflowId = ReferenceUtils.resolveReference(ctx, wfElement); workflowId = ReferenceUtils.resolveReference(ctx, wfElement, getTrxName(ctx));
} }
if (workflowId <= 0) { if (workflowId <= 0) {
element.defer = true; element.defer = true;
@ -69,7 +69,7 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
int wfNodeId = 0; int wfNodeId = 0;
Element wfnElement = element.properties.get(I_AD_WF_NodeNext.COLUMNNAME_AD_WF_Node_ID); Element wfnElement = element.properties.get(I_AD_WF_NodeNext.COLUMNNAME_AD_WF_Node_ID);
if (ReferenceUtils.isIDLookup(wfnElement) || ReferenceUtils.isUUIDLookup(wfnElement)) { if (ReferenceUtils.isIDLookup(wfnElement) || ReferenceUtils.isUUIDLookup(wfnElement)) {
wfNodeId = ReferenceUtils.resolveReference(ctx, wfnElement); wfNodeId = ReferenceUtils.resolveReference(ctx, wfnElement, getTrxName(ctx));
} else { } 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=?", 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)); workflowId, wfnElement.contents.toString(), Env.getAD_Client_ID(ctx));
@ -83,7 +83,7 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
int AD_WF_Next_ID = 0; int AD_WF_Next_ID = 0;
Element nextElement = element.properties.get(I_AD_WF_NodeNext.COLUMNNAME_AD_WF_Next_ID); Element nextElement = element.properties.get(I_AD_WF_NodeNext.COLUMNNAME_AD_WF_Next_ID);
if (ReferenceUtils.isIDLookup(nextElement) || ReferenceUtils.isUUIDLookup(nextElement)) { 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 { } 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=?", 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)); workflowId, nextElement.contents.toString(), Env.getAD_Client_ID(ctx));

View File

@ -275,21 +275,21 @@ public class PackInHandler extends DefaultHandler {
for (Element childElement : element.childrens) for (Element childElement : element.childrens)
{ {
processElement(childElement); processElement(childElement);
if (element.defer) {
defer.add(new DeferEntry(element, false));
} else {
if (handler != null)
handler.endElement(m_ctx, element);
if (element.defer || element.deferEnd)
defer.add(new DeferEntry(element, false));
else if (!element.skip) {
if (log.isLoggable(Level.INFO))
log.info("Processed: " + element.getElementValue() + " - " + element.attributes.getValue(0));
elementProcessed++;
}
}
} }
if (element.defer) {
defer.add(new DeferEntry(element, false));
} else {
if (handler != null)
handler.endElement(m_ctx, element);
if (element.defer || element.deferEnd)
defer.add(new DeferEntry(element, false));
else if (!element.skip) {
if (log.isLoggable(Level.INFO))
log.info("Processed: " + element.getElementValue() + " - " + element.attributes.getValue(0));
elementProcessed++;
}
}
} }
private void createLogHeader(Attributes atts) throws SAXException { private void createLogHeader(Attributes atts) throws SAXException {

View File

@ -142,7 +142,7 @@ public class PoFiller{
String value = e.contents.toString(); String value = e.contents.toString();
String columnName = qName; String columnName = qName;
if (value != null && value.trim().length() > 0) { 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 (columnName.equals("AD_Client_ID") && id > 0) {
if (id != Env.getAD_Client_ID(ctx)) { if (id != Env.getAD_Client_ID(ctx)) {
return -1; return -1;

View File

@ -9,7 +9,14 @@ import org.xml.sax.helpers.AttributesImpl;
public class ReferenceUtils { 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 value = e.contents.toString();
String referenceKey = e.attributes.getValue("reference-key"); String referenceKey = e.attributes.getValue("reference-key");
@ -23,7 +30,7 @@ public class ReferenceUtils {
String tableName = names[0]; String tableName = names[0];
String searchColumn = names[1]; 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)) else if (isIDLookup(e))
{ {
@ -32,7 +39,7 @@ public class ReferenceUtils {
} }
else if (isUUIDLookup(e)) 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 else
{ {