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
|
@ -52,7 +52,7 @@ public class FieldElementHandler extends AbstractElementHandler {
|
|||
element.defer = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
List<String>excludes = defaultExcludeList(X_AD_Field.Table_Name);
|
||||
|
||||
int tabid = getParentId(element, I_AD_Tab.Table_Name) ;
|
||||
|
@ -64,20 +64,20 @@ 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
|
||||
{
|
||||
String colname = getStringValue(element, "AD_Column_ID", excludes);
|
||||
AD_Column_ID = findIdByColumnAndParentId(ctx, "AD_Column", "ColumnName", colname, "AD_Table", AD_Table_ID);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
StringBuffer sqlB = new StringBuffer(
|
||||
"select AD_Field_ID from AD_Field where AD_Column_ID = ")
|
||||
.append(AD_Column_ID)
|
||||
|
@ -112,7 +112,7 @@ public class FieldElementHandler extends AbstractElementHandler {
|
|||
else{
|
||||
action = "New";
|
||||
}
|
||||
|
||||
|
||||
if (mField.save(getTrxName(ctx)) == true) {
|
||||
logImportDetail(ctx, impDetail, 1, mField.getName(), mField
|
||||
.get_ID(), action);
|
||||
|
|
|
@ -49,21 +49,21 @@ 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)
|
||||
{
|
||||
element.defer = true;
|
||||
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;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Query query = new Query(ctx, "AD_Form_Access", "AD_Form_ID = ? AND AD_Role_ID = ?", getTrxName(ctx));
|
||||
po = query.setParameters(new Object[]{AD_Form_ID, AD_Role_ID})
|
||||
.setClient_ID()
|
||||
|
@ -72,9 +72,9 @@ public class FormAccessElementHandler extends AbstractElementHandler {
|
|||
{
|
||||
po = new MFormAccess(ctx, 0, null);
|
||||
po.setAD_Form_ID(AD_Form_ID);
|
||||
po.setAD_Role_ID(AD_Role_ID);
|
||||
po.setAD_Role_ID(AD_Role_ID);
|
||||
}
|
||||
|
||||
|
||||
excludes.add("AD_Form_ID");
|
||||
excludes.add("AD_Role_ID");
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public class FormAccessElementHandler extends AbstractElementHandler {
|
|||
TransformerHandler docHandler,
|
||||
int recordId) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,58 +51,58 @@ public class ImpFormatRowElementHandler extends AbstractElementHandler {
|
|||
|
||||
X_AD_ImpFormat_Row mImpFormatRow = findPO(ctx, element);
|
||||
if (mImpFormatRow == null) {
|
||||
int impFormatId = 0;
|
||||
int impFormatId = 0;
|
||||
if (getParentId(element, I_AD_ImpFormat.Table_Name) > 0) {
|
||||
impFormatId = getParentId(element, I_AD_ImpFormat.Table_Name);
|
||||
} 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());
|
||||
}
|
||||
|
||||
|
||||
if (impFormatId <= 0) {
|
||||
element.defer = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
if (tableName != null && tableName.trim().length() > 0) {
|
||||
tableId = findIdByColumn(ctx, "AD_Table", "TableName", tableName);
|
||||
tableId = findIdByColumn(ctx, "AD_Table", "TableName", tableName);
|
||||
}
|
||||
if (tableId <= 0) {
|
||||
element.defer = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
if (columnName != null && columnName.trim().length() > 0) {
|
||||
columnId = findIdByColumnAndParentId (ctx, "AD_Column","ColumnName", columnName, "AD_Table", tableId);
|
||||
columnId = findIdByColumnAndParentId (ctx, "AD_Column","ColumnName", columnName, "AD_Table", tableId);
|
||||
}
|
||||
if (columnId <= 0) {
|
||||
element.defer = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StringBuffer sqlB = new StringBuffer ("SELECT AD_ImpFormat_Row_ID FROM AD_ImpFormat_Row WHERE AD_Column_ID=? AND AD_ImpFormat_ID=?");
|
||||
int id = DB.getSQLValue(getTrxName(ctx),sqlB.toString(),columnId,impFormatId);
|
||||
mImpFormatRow = new X_AD_ImpFormat_Row(ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||
|
||||
|
||||
mImpFormatRow.setAD_Column_ID(columnId);
|
||||
mImpFormatRow.setAD_ImpFormat_ID(impFormatId);
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public class ImpFormatRowElementHandler extends AbstractElementHandler {
|
|||
element.defer = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (mImpFormatRow.is_new() || mImpFormatRow.is_Changed()) {
|
||||
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_ImpFormat_Row.Table_Name,
|
||||
X_AD_ImpFormat_Row.Table_ID);
|
||||
|
|
|
@ -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})
|
||||
|
@ -63,7 +63,7 @@ public class OrgRoleElementHandler extends AbstractElementHandler {
|
|||
po = new X_AD_Role_OrgAccess(ctx, 0, getTrxName(ctx));
|
||||
po.setAD_Org_ID(orgId);
|
||||
po.setAD_Role_ID(roleId);
|
||||
}
|
||||
}
|
||||
excludes.add("AD_Org_ID");
|
||||
excludes.add("AD_Role_ID");
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler {
|
|||
|
||||
public void startElement(Properties ctx, Element element)
|
||||
throws SAXException {
|
||||
|
||||
|
||||
List<String> excludes = defaultExcludeList(X_AD_PrintFormatItem.Table_Name);
|
||||
|
||||
if (isParentDefer(element, I_AD_PrintFormatItem.Table_Name)) {
|
||||
|
@ -50,21 +50,21 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler {
|
|||
}
|
||||
|
||||
X_AD_PrintFormatItem mPrintFormatItem = findPO(ctx, element);
|
||||
if (mPrintFormatItem == null) {
|
||||
if (mPrintFormatItem == null) {
|
||||
int parentId = 0;
|
||||
if (getParentId(element, I_AD_PrintFormatItem.Table_Name) > 0) {
|
||||
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;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String name = getStringValue(element, "Name");
|
||||
int id = findIdByNameAndParentId(ctx, "AD_PrintFormatItem", name, "AD_PrintFormat", parentId);
|
||||
int id = findIdByNameAndParentId(ctx, "AD_PrintFormatItem", name, "AD_PrintFormat", parentId);
|
||||
mPrintFormatItem = new X_AD_PrintFormatItem(ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||
mPrintFormatItem.setAD_PrintFormat_ID(parentId);
|
||||
excludes.add(I_AD_PrintFormatItem.COLUMNNAME_AD_PrintFormat_ID);
|
||||
|
@ -73,33 +73,33 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler {
|
|||
|
||||
if (mPrintFormatItem.getAD_PrintFormatItem_ID() == 0 && isOfficialId(element, "AD_PrintFormatItem_ID"))
|
||||
filler.setInteger("AD_PrintFormatItem_ID");
|
||||
|
||||
|
||||
excludes.add("AD_Table_ID");
|
||||
excludes.add("AD_Column_ID");
|
||||
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);
|
||||
}
|
||||
}
|
||||
if (columnId > 0)
|
||||
mPrintFormatItem.setAD_Column_ID(columnId);
|
||||
|
||||
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) {
|
||||
element.defer = true;
|
||||
element.unresolved = "AD_PrintFormat: " + pfchildElement.contents;
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
List<String> notfounds = filler.autoFill(excludes);
|
||||
|
|
|
@ -50,12 +50,12 @@ 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();
|
||||
if (po == null)
|
||||
|
|
|
@ -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;
|
||||
|
@ -75,12 +75,12 @@ public class ProcessParaElementHandler extends AbstractElementHandler {
|
|||
mProcessPara.setAD_Process_ID(masterId);
|
||||
excludes.add(I_AD_Process_Para.COLUMNNAME_AD_Process_ID);
|
||||
}
|
||||
|
||||
|
||||
if (mProcessPara.getAD_Process_Para_ID() == 0 && isOfficialId(element, "AD_Process_Para_ID"))
|
||||
mProcessPara.setAD_Process_Para_ID(Integer.parseInt(getStringValue(element, "AD_Process_Para_ID")));
|
||||
|
||||
|
||||
PoFiller filler = new PoFiller(ctx, mProcessPara, element, this);
|
||||
|
||||
|
||||
List<String> notfounds = filler.autoFill(excludes);
|
||||
if (notfounds.size() > 0) {
|
||||
element.defer = true;
|
||||
|
|
|
@ -40,7 +40,7 @@ public class ReferenceListElementHandler extends AbstractElementHandler {
|
|||
|
||||
public void startElement(Properties ctx, Element element)
|
||||
throws SAXException {
|
||||
|
||||
|
||||
String entitytype = getStringValue(element, "EntityType");
|
||||
if (isProcessElement(ctx, entitytype)) {
|
||||
if (isParentSkip(element, null)) {
|
||||
|
@ -56,16 +56,16 @@ 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);
|
||||
mRefList = new X_AD_Ref_List(ctx, AD_Ref_List_ID, getTrxName(ctx));
|
||||
}
|
||||
|
||||
|
||||
if (mRefList.getAD_Ref_List_ID() == 0 && isOfficialId(element, "AD_Ref_List_ID"))
|
||||
mRefList.setAD_Ref_List_ID(getIntValue(element, "AD_Ref_List_ID"));
|
||||
|
||||
|
||||
PoFiller filler = new PoFiller(ctx, mRefList, element, this);
|
||||
List<String> excludes = defaultExcludeList(X_AD_Ref_List.Table_Name);
|
||||
List<String> notfounds = filler.autoFill(excludes);
|
||||
|
|
|
@ -61,11 +61,11 @@ 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");
|
||||
|
||||
|
||||
String sql = "SELECT * FROM AD_Ref_Table WHERE AD_Reference_ID = ?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
@ -77,7 +77,7 @@ public class ReferenceTableElementHandler extends AbstractElementHandler {
|
|||
refTable = new X_AD_Ref_Table(ctx, rs, getTrxName(ctx));
|
||||
} else {
|
||||
refTable = new X_AD_Ref_Table(ctx, 0, getTrxName(ctx));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new DatabaseAccessException(e.getLocalizedMessage(), e);
|
||||
} finally {
|
||||
|
@ -95,28 +95,28 @@ 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);
|
||||
}
|
||||
}
|
||||
refTable.setAD_Display(displayColumnId);
|
||||
|
||||
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
refTable.setAD_Key(keyColumnId);
|
||||
|
||||
|
||||
if (refTable.is_new() || refTable.is_Changed()) {
|
||||
refTable.saveEx();
|
||||
|
||||
|
||||
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Ref_Table.Table_Name,
|
||||
X_AD_Ref_Table.Table_ID);
|
||||
|
||||
|
||||
logImportDetail(ctx, impDetail, 1, refTable.getAD_Reference().getName(), refTable.getAD_Reference_ID(), action);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -40,7 +40,7 @@ import org.xml.sax.helpers.AttributesImpl;
|
|||
public class ReportViewColElementHandler extends AbstractElementHandler {
|
||||
|
||||
public void startElement(Properties ctx, Element element)
|
||||
throws SAXException {
|
||||
throws SAXException {
|
||||
List<String> excludes = defaultExcludeList(X_AD_ReportView_Col.Table_Name);
|
||||
|
||||
String entitytype = getStringValue(element,"EntityType");
|
||||
|
@ -53,22 +53,22 @@ 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;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
AD_Column_ID = findIdByColumnAndParentId(ctx, "AD_Column", "ColumnName", columnElement.contents.toString(),
|
||||
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) {
|
||||
element.defer = true;
|
||||
|
@ -76,7 +76,7 @@ public class ReportViewColElementHandler extends AbstractElementHandler {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String functionColumn = getStringValue(element, "FunctionColumn");
|
||||
StringBuffer sql = new StringBuffer("SELECT AD_Reportview_Col_ID FROM AD_Reportview_Col ")
|
||||
.append(" WHERE AD_Column_ID ");
|
||||
|
@ -86,7 +86,7 @@ public class ReportViewColElementHandler extends AbstractElementHandler {
|
|||
sql.append(" IS NULL ");
|
||||
sql.append(" AND FunctionColumn = ?");
|
||||
sql.append(" AND AD_ReportView_ID = ?");
|
||||
|
||||
|
||||
int id = DB.getSQLValue(getTrxName(ctx), sql.toString(), functionColumn, AD_ReportView_ID);
|
||||
mReportviewCol = new X_AD_ReportView_Col(ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||
mReportviewCol.setAD_ReportView_ID(AD_ReportView_ID);
|
||||
|
@ -98,10 +98,10 @@ public class ReportViewColElementHandler extends AbstractElementHandler {
|
|||
excludes.add("AD_ReportView_ID");
|
||||
excludes.add("AD_Column_ID");
|
||||
}
|
||||
|
||||
|
||||
if (mReportviewCol.getAD_ReportView_Col_ID() == 0 && isOfficialId(element, "AD_ReportView_Col_ID"))
|
||||
mReportviewCol.setAD_ReportView_Col_ID(getIntValue(element, "AD_ReportView_Col_ID"));
|
||||
|
||||
|
||||
PoFiller filler = new PoFiller(ctx, mReportviewCol, element, this);
|
||||
List<String> notfounds = filler.autoFill(excludes);
|
||||
if (notfounds.size() > 0) {
|
||||
|
@ -157,7 +157,7 @@ public class ReportViewColElementHandler extends AbstractElementHandler {
|
|||
List<String> excludes = defaultExcludeList(X_AD_ReportView_Col.Table_Name);
|
||||
if (m_Reportview_Col.getAD_ReportView_Col_ID() <= PackOut.MAX_OFFICIAL_ID)
|
||||
filler.add("AD_ReportView_Col_ID", new AttributesImpl());
|
||||
|
||||
|
||||
if (m_Reportview_Col.getAD_Column_ID() > 0) {
|
||||
int AD_Table_ID = m_Reportview_Col.getAD_Column().getAD_Table_ID();
|
||||
AttributesImpl tableAtts = new AttributesImpl();
|
||||
|
|
|
@ -59,71 +59,71 @@ public class TabElementHandler extends AbstractElementHandler {
|
|||
element.defer = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
MTab mTab = findPO(ctx, element);
|
||||
if (mTab == null) {
|
||||
String name = getStringValue(element, "Name", excludes);
|
||||
|
||||
|
||||
int windowId = 0;
|
||||
if (getParentId(element, I_AD_Window.Table_Name) > 0) {
|
||||
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;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
String sql = "SELECT AD_Tab_ID FROM AD_Tab where AD_Window_ID = ? "
|
||||
+ " AND Name = ?"
|
||||
+ " AND AD_Table_ID = ?";
|
||||
|
||||
|
||||
int id = DB.getSQLValue(getTrxName(ctx), sql, windowId, name, tableId);
|
||||
mTab = new MTab(ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||
mTab.setAD_Table_ID(tableId);
|
||||
mTab.setName(name);
|
||||
mTab.setAD_Window_ID(windowId);
|
||||
}
|
||||
|
||||
|
||||
PoFiller filler = new PoFiller(ctx, mTab, element, this);
|
||||
if (mTab.getAD_Tab_ID() == 0 && isOfficialId(element, "AD_Tab_ID"))
|
||||
mTab.setAD_Tab_ID(getIntValue(element, "AD_Tab_ID"));
|
||||
|
||||
|
||||
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());
|
||||
AD_Column_ID = findIdByColumnAndParentId (ctx, "AD_Column","ColumnName", columnElement.contents.toString(),
|
||||
"AD_Table", mTab.getAD_Table_ID());
|
||||
}
|
||||
mTab.setAD_Column_ID(AD_Column_ID);
|
||||
|
||||
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_Column_ID = findIdByColumnAndParentId (ctx, "AD_Column","ColumnName", columnElement.contents.toString(),
|
||||
"AD_Table", mTab.getAD_Table_ID());
|
||||
}
|
||||
mTab.setAD_ColumnSortOrder_ID(AD_Column_ID);
|
||||
|
||||
|
||||
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_Column_ID = findIdByColumnAndParentId (ctx, "AD_Column","ColumnName", columnElement.contents.toString(),
|
||||
"AD_Table", mTab.getAD_Table_ID());
|
||||
}
|
||||
mTab.setAD_ColumnSortYesNo_ID(AD_Column_ID);
|
||||
|
@ -133,7 +133,7 @@ public class TabElementHandler extends AbstractElementHandler {
|
|||
element.defer = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (mTab.is_new() || mTab.is_Changed()) {
|
||||
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Tab.Table_Name,
|
||||
X_AD_Tab.Table_ID);
|
||||
|
|
|
@ -50,12 +50,12 @@ 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();
|
||||
if (po == null){
|
||||
|
|
|
@ -48,25 +48,25 @@ 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();
|
||||
if (po == null) {
|
||||
po = new X_AD_User_Roles(ctx, 0, getTrxName(ctx));
|
||||
po.setAD_Org_ID(orgid);
|
||||
po.setAD_Role_ID(roleid);
|
||||
po.setAD_User_ID(userid);
|
||||
po.setAD_User_ID(userid);
|
||||
}
|
||||
excludes.add(I_AD_User_Roles.COLUMNNAME_AD_User_ID);
|
||||
excludes.add(I_AD_User_Roles.COLUMNNAME_AD_Role_ID);
|
||||
|
|
|
@ -45,25 +45,25 @@ public class WindowAccessElementHandler extends AbstractElementHandler {
|
|||
List<String> excludes = defaultExcludeList(X_AD_Window_Access.Table_Name);
|
||||
|
||||
X_AD_Window_Access po = findPO(ctx, element);
|
||||
if (po == null) {
|
||||
if (po == null) {
|
||||
if (getParentId(element, I_AD_Role.Table_Name) > 0) {
|
||||
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;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Query query = new Query(ctx, "AD_Window_Access", "AD_Role_ID=? and AD_Window_ID=?", getTrxName(ctx));
|
||||
po = query.setParameters(new Object[]{roleid, windowid}).first();
|
||||
if (po == null) {
|
||||
|
|
|
@ -50,12 +50,12 @@ 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();
|
||||
if (po == null) {
|
||||
|
|
|
@ -62,34 +62,34 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler {
|
|||
Element wfElement = element.properties.get(I_AD_WF_Node.COLUMNNAME_AD_Workflow_ID);
|
||||
if (getParentId(element, I_AD_Workflow.Table_Name) > 0) {
|
||||
workflowId = getParentId(element, I_AD_Workflow.Table_Name);
|
||||
} else {
|
||||
workflowId = ReferenceUtils.resolveReference(ctx, wfElement);
|
||||
} else {
|
||||
workflowId = ReferenceUtils.resolveReference(ctx, wfElement, getTrxName(ctx));
|
||||
}
|
||||
if (workflowId <= 0) {
|
||||
element.defer = true;
|
||||
element.unresolved = "AD_Workflow: " + wfElement.contents;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String workflowNodeValue = getStringValue(element, "Value", excludes);
|
||||
StringBuffer sqlB = new StringBuffer(
|
||||
"SELECT AD_WF_Node_ID FROM AD_WF_Node WHERE AD_Workflow_ID=? and Value =?");
|
||||
|
||||
int id = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), workflowId, workflowNodeValue);
|
||||
|
||||
int id = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), workflowId, workflowNodeValue);
|
||||
mWFNode = new X_AD_WF_Node(ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||
mWFNode.setValue(workflowNodeValue);
|
||||
mWFNode.setAD_Workflow_ID(workflowId);
|
||||
excludes.add(I_AD_WF_Node.COLUMNNAME_AD_Workflow_ID);
|
||||
excludes.add("Value");
|
||||
}
|
||||
|
||||
|
||||
PoFiller filler = new PoFiller(ctx, mWFNode, element, this);
|
||||
List<String> notfounds = filler.autoFill(excludes);
|
||||
if (notfounds.size() > 0) {
|
||||
element.defer = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (mWFNode.is_new() || mWFNode.is_Changed()) {
|
||||
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_WF_Node.Table_Name,
|
||||
X_AD_WF_Node.Table_ID);
|
||||
|
|
|
@ -59,47 +59,47 @@ 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;
|
||||
element.unresolved = "AD_Workflow: " + wfElement.contents;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String sql = "SELECT AD_WF_NodeNext_ID FROM AD_WF_NodeNext WHERE AD_WF_Node_ID =? and AD_WF_Next_ID =?";
|
||||
AD_WF_NodeNext_ID = DB.getSQLValue(getTrxName(ctx), sql, wfNodeId, wfNodeNextId);
|
||||
}
|
||||
|
||||
|
||||
String sql = "SELECT AD_WF_NextCondition_ID FROM AD_WF_NextCondition WHERE AD_WF_NodeNext_ID =?";
|
||||
int id = DB.getSQLValue(getTrxName(ctx), sql, AD_WF_NodeNext_ID);
|
||||
|
||||
|
||||
mWFNodeNextCondition = new MWFNextCondition(ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||
mWFNodeNextCondition.setAD_WF_NodeNext_ID(AD_WF_NodeNext_ID);
|
||||
}
|
||||
|
||||
PoFiller filler = new PoFiller(ctx, mWFNodeNextCondition, element, this);
|
||||
|
||||
PoFiller filler = new PoFiller(ctx, mWFNodeNextCondition, element, this);
|
||||
if (mWFNodeNextCondition.get_ID() == 0 && isOfficialId(element, "AD_WF_NextCondition_ID"))
|
||||
filler.setInteger("AD_WF_NextCondition_ID");
|
||||
|
||||
|
@ -107,19 +107,19 @@ 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);
|
||||
|
||||
|
||||
List<String> notfounds = filler.autoFill(excludes);
|
||||
if (notfounds.size() > 0) {
|
||||
element.defer = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (mWFNodeNextCondition.is_new() || mWFNodeNextCondition.is_Changed()) {
|
||||
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_WF_NextCondition.Table_Name,
|
||||
X_AD_WF_NextCondition.Table_ID);
|
||||
|
@ -200,7 +200,7 @@ public class WorkflowNodeNextConditionElementHandler extends
|
|||
AttributesImpl tableAttributes = new AttributesImpl();
|
||||
value = ReferenceUtils.getTableReference("AD_Table", "TableName", AD_Table_ID, tableAttributes);
|
||||
filler.addString("AD_Table_ID", value, tableAttributes);
|
||||
}
|
||||
}
|
||||
|
||||
filler.export(excludes);
|
||||
}
|
||||
|
|
|
@ -57,21 +57,21 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
|
|||
Element wfElement = element.properties.get(I_AD_WF_Node.COLUMNNAME_AD_Workflow_ID);
|
||||
if (getParentId(element, I_AD_Workflow.Table_Name) > 0) {
|
||||
workflowId = getParentId(element, I_AD_Workflow.Table_Name);
|
||||
} else {
|
||||
workflowId = ReferenceUtils.resolveReference(ctx, wfElement);
|
||||
} else {
|
||||
workflowId = ReferenceUtils.resolveReference(ctx, wfElement, getTrxName(ctx));
|
||||
}
|
||||
if (workflowId <= 0) {
|
||||
element.defer = true;
|
||||
element.unresolved = "AD_Workflow: " + wfElement.contents;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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=?",
|
||||
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));
|
||||
}
|
||||
if (wfNodeId <= 0) {
|
||||
|
@ -83,9 +83,9 @@ 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=?",
|
||||
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));
|
||||
}
|
||||
if (AD_WF_Next_ID <= 0) {
|
||||
|
@ -93,15 +93,15 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
|
|||
element.unresolved = "AD_WF_Node: " + nextElement.contents;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int AD_WF_NodeNext_ID = DB.getSQLValue(getTrxName(ctx), "SELECT AD_WF_NodeNext_ID FROM AD_WF_NodeNext WHERE AD_WF_Node_ID=? and AD_WF_NEXT_ID =?", wfNodeId, AD_WF_Next_ID);
|
||||
|
||||
|
||||
mWFNodeNext = new MWFNodeNext(ctx, AD_WF_NodeNext_ID, getTrxName(ctx));
|
||||
mWFNodeNext.setAD_WF_Node_ID(wfNodeId);
|
||||
mWFNodeNext.setAD_WF_Next_ID(AD_WF_Next_ID);
|
||||
}
|
||||
|
||||
PoFiller filler = new PoFiller(ctx, mWFNodeNext, element, this);
|
||||
|
||||
PoFiller filler = new PoFiller(ctx, mWFNodeNext, element, this);
|
||||
if (mWFNodeNext.getAD_WF_NodeNext_ID() == 0 && isOfficialId(element, "AD_WF_NodeNext_ID"))
|
||||
mWFNodeNext.setAD_WF_NodeNext_ID(getIntValue(element, "AD_WF_NodeNext_ID"));
|
||||
|
||||
|
@ -110,7 +110,7 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
|
|||
element.defer = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (mWFNodeNext.is_new() || mWFNodeNext.is_Changed()) {
|
||||
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_WF_NodeNext.Table_Name,
|
||||
X_AD_WF_NodeNext.Table_ID);
|
||||
|
|
|
@ -275,21 +275,21 @@ public class PackInHandler extends DefaultHandler {
|
|||
for (Element childElement : element.childrens)
|
||||
{
|
||||
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 {
|
||||
|
|
|
@ -138,11 +138,11 @@ public class PoFiller{
|
|||
Element e = element.properties.get(qName);
|
||||
if (e == null)
|
||||
return 0;
|
||||
|
||||
|
||||
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;
|
||||
|
@ -153,7 +153,7 @@ public class PoFiller{
|
|||
po.set_ValueOfColumn(columnName, id);
|
||||
return id;
|
||||
}
|
||||
return -1;
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -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