IDEMPIERE-1136 2Pack: Prevent unwanted overwrite of UUID key during pack in
This commit is contained in:
parent
1727029c25
commit
26fe7cf2bc
|
@ -56,7 +56,10 @@ public class AdElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
M_Element mElement = findPO(ctx, element);
|
M_Element mElement = findPO(ctx, element);
|
||||||
if (mElement == null) {
|
if (mElement == null) {
|
||||||
int id = findIdByColumn(ctx, X_AD_Element.Table_Name, X_AD_Element.COLUMNNAME_ColumnName, ColumnName, /*ignorecase=*/true);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByColumn(ctx, X_AD_Element.Table_Name, X_AD_Element.COLUMNNAME_ColumnName, ColumnName, /*ignorecase=*/true);
|
||||||
|
}
|
||||||
mElement = new M_Element(ctx.ctx, id, getTrxName(ctx));
|
mElement = new M_Element(ctx.ctx, id, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
List<String> excludes = defaultExcludeList(X_AD_Element.Table_Name);
|
List<String> excludes = defaultExcludeList(X_AD_Element.Table_Name);
|
||||||
|
|
|
@ -64,7 +64,10 @@ public class AttachmentElementHandler extends AbstractElementHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int id = DB.getSQLValue(getTrxName(ctx), "SELECT AD_Attachment_ID FROM AD_Attachment WHERE Record_ID="+Record_ID+" AND AD_Table_ID="+AD_Table_ID);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
DB.getSQLValue(getTrxName(ctx), "SELECT AD_Attachment_ID FROM AD_Attachment WHERE Record_ID="+Record_ID+" AND AD_Table_ID="+AD_Table_ID);
|
||||||
|
}
|
||||||
mAttachment = new MAttachment(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mAttachment = new MAttachment(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
if (mAttachment.is_new()) {
|
if (mAttachment.is_new()) {
|
||||||
mAttachment.setAD_Table_ID(AD_Table_ID);
|
mAttachment.setAD_Table_ID(AD_Table_ID);
|
||||||
|
|
|
@ -73,7 +73,10 @@ public class ColumnElementHandler extends AbstractElementHandler {
|
||||||
filler.setTableReference("AD_Table_ID");
|
filler.setTableReference("AD_Table_ID");
|
||||||
tableid = mColumn.getAD_Table_ID();
|
tableid = mColumn.getAD_Table_ID();
|
||||||
}
|
}
|
||||||
int AD_Column_ID = findIdByColumnAndParentId(ctx, "AD_Column", "ColumnName", columnName, "AD_Table", tableid, /*ignorecase=*/true);
|
int AD_Column_ID = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
AD_Column_ID = findIdByColumnAndParentId(ctx, "AD_Column", "ColumnName", columnName, "AD_Table", tableid, /*ignorecase=*/true);
|
||||||
|
}
|
||||||
mColumn = new MColumn(ctx.ctx, AD_Column_ID > 0 ? AD_Column_ID : 0, getTrxName(ctx));
|
mColumn = new MColumn(ctx.ctx, AD_Column_ID > 0 ? AD_Column_ID : 0, getTrxName(ctx));
|
||||||
if (mColumn.getAD_Column_ID() == 0 && isOfficialId(element, "AD_Column_ID")) {
|
if (mColumn.getAD_Column_ID() == 0 && isOfficialId(element, "AD_Column_ID")) {
|
||||||
mColumn.setAD_Column_ID(getIntValue(element, "AD_Column_ID"));
|
mColumn.setAD_Column_ID(getIntValue(element, "AD_Column_ID"));
|
||||||
|
|
|
@ -48,7 +48,10 @@ public class DynValRuleElementHandler extends AbstractElementHandler {
|
||||||
X_AD_Val_Rule mValRule = findPO(ctx, element);
|
X_AD_Val_Rule mValRule = findPO(ctx, element);
|
||||||
if (mValRule == null)
|
if (mValRule == null)
|
||||||
{
|
{
|
||||||
int id = findIdByColumn(ctx, "AD_Val_Rule", "Name", name);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByColumn(ctx, "AD_Val_Rule", "Name", name);
|
||||||
|
}
|
||||||
mValRule = new X_AD_Val_Rule(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mValRule = new X_AD_Val_Rule(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
if (mValRule.getAD_Val_Rule_ID() == 0 && isOfficialId(element, "AD_Val_Rule_ID"))
|
if (mValRule.getAD_Val_Rule_ID() == 0 && isOfficialId(element, "AD_Val_Rule_ID"))
|
||||||
|
|
|
@ -61,7 +61,10 @@ public class EntityTypeElementHandler extends AbstractElementHandler{
|
||||||
X_AD_EntityType m_EntityType = findPO(ctx, element);
|
X_AD_EntityType m_EntityType = findPO(ctx, element);
|
||||||
|
|
||||||
if (m_EntityType == null) {
|
if (m_EntityType == null) {
|
||||||
int id = findIdByColumn(ctx, X_AD_EntityType.Table_Name, X_AD_EntityType.COLUMNNAME_Name, name, /*ignorecase=*/true);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByColumn(ctx, X_AD_EntityType.Table_Name, X_AD_EntityType.COLUMNNAME_Name, name, /*ignorecase=*/true);
|
||||||
|
}
|
||||||
m_EntityType = new X_AD_EntityType(ctx.ctx, id, getTrxName(ctx));
|
m_EntityType = new X_AD_EntityType(ctx.ctx, id, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,11 +100,14 @@ public class FieldElementHandler extends AbstractElementHandler {
|
||||||
MField mField = findPO(ctx, element);
|
MField mField = findPO(ctx, element);
|
||||||
if (mField == null)
|
if (mField == null)
|
||||||
{
|
{
|
||||||
StringBuffer sqlB = new StringBuffer(
|
int id = 0;
|
||||||
"select AD_Field_ID from AD_Field where AD_Column_ID = ")
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
.append(AD_Column_ID)
|
StringBuffer sqlB = new StringBuffer(
|
||||||
.append(" and AD_Tab_ID = ?");
|
"select AD_Field_ID from AD_Field where AD_Column_ID = ")
|
||||||
int id = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), tabid);
|
.append(AD_Column_ID)
|
||||||
|
.append(" and AD_Tab_ID = ?");
|
||||||
|
id = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), tabid);
|
||||||
|
}
|
||||||
mField = new MField(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mField = new MField(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
if (mField.is_new()) {
|
if (mField.is_new()) {
|
||||||
mField.setAD_Column_ID(AD_Column_ID);
|
mField.setAD_Column_ID(AD_Column_ID);
|
||||||
|
|
|
@ -58,7 +58,10 @@ public class FieldGroupElementHandler extends AbstractElementHandler {
|
||||||
X_AD_FieldGroup fieldGroup = findPO(ctx, element);
|
X_AD_FieldGroup fieldGroup = findPO(ctx, element);
|
||||||
if (fieldGroup == null)
|
if (fieldGroup == null)
|
||||||
{
|
{
|
||||||
int id = findIdByColumn(ctx, X_AD_FieldGroup.Table_Name, X_AD_FieldGroup.COLUMNNAME_Name, name);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByColumn(ctx, X_AD_FieldGroup.Table_Name, X_AD_FieldGroup.COLUMNNAME_Name, name);
|
||||||
|
}
|
||||||
fieldGroup = new X_AD_FieldGroup(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
fieldGroup = new X_AD_FieldGroup(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
PoFiller pf = new PoFiller(ctx, fieldGroup, element, this);
|
PoFiller pf = new PoFiller(ctx, fieldGroup, element, this);
|
||||||
|
|
|
@ -66,10 +66,12 @@ public class FormAccessElementHandler extends AbstractElementHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Query query = new Query(ctx.ctx, "AD_Form_Access", "AD_Form_ID = ? AND AD_Role_ID = ?", getTrxName(ctx));
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
po = query.setParameters(new Object[]{AD_Form_ID, AD_Role_ID})
|
Query query = new Query(ctx.ctx, "AD_Form_Access", "AD_Form_ID = ? AND AD_Role_ID = ?", getTrxName(ctx));
|
||||||
.setClient_ID()
|
po = query.setParameters(new Object[]{AD_Form_ID, AD_Role_ID})
|
||||||
.<MFormAccess>first();
|
.setClient_ID()
|
||||||
|
.<MFormAccess>first();
|
||||||
|
}
|
||||||
if (po == null)
|
if (po == null)
|
||||||
{
|
{
|
||||||
po = new MFormAccess(ctx.ctx, 0, getTrxName(ctx));
|
po = new MFormAccess(ctx.ctx, 0, getTrxName(ctx));
|
||||||
|
|
|
@ -50,7 +50,10 @@ public class FormElementHandler extends AbstractElementHandler {
|
||||||
MForm mForm = findPO(ctx, element);
|
MForm mForm = findPO(ctx, element);
|
||||||
if (mForm == null) {
|
if (mForm == null) {
|
||||||
String name = getStringValue(element, "Name");
|
String name = getStringValue(element, "Name");
|
||||||
int id = findIdByName(ctx, "AD_Form", name);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByName(ctx, "AD_Form", name);
|
||||||
|
}
|
||||||
mForm = new MForm(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mForm = new MForm(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
PoFiller filler = new PoFiller(ctx, mForm, element, this);
|
PoFiller filler = new PoFiller(ctx, mForm, element, this);
|
||||||
|
|
|
@ -56,7 +56,10 @@ public class ImpFormatElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
X_AD_ImpFormat mImpFormat = findPO(ctx, element);
|
X_AD_ImpFormat mImpFormat = findPO(ctx, element);
|
||||||
if (mImpFormat == null) {
|
if (mImpFormat == null) {
|
||||||
int id = findIdByName(ctx, "AD_ImpFormat", name);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByName(ctx, "AD_ImpFormat", name);
|
||||||
|
}
|
||||||
mImpFormat = new X_AD_ImpFormat(ctx.ctx, id > 0 ? id : 0,
|
mImpFormat = new X_AD_ImpFormat(ctx.ctx, id > 0 ? id : 0,
|
||||||
getTrxName(ctx));
|
getTrxName(ctx));
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,8 +102,11 @@ public class ImpFormatRowElementHandler extends AbstractElementHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder sqlB = new StringBuilder ("SELECT AD_ImpFormat_Row_ID FROM AD_ImpFormat_Row WHERE AD_Column_ID=? AND AD_ImpFormat_ID=?");
|
int id = 0;
|
||||||
int id = DB.getSQLValue(getTrxName(ctx),sqlB.toString(),columnId,impFormatId);
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
StringBuilder sqlB = new StringBuilder ("SELECT AD_ImpFormat_Row_ID FROM AD_ImpFormat_Row WHERE AD_Column_ID=? AND AD_ImpFormat_ID=?");
|
||||||
|
id = DB.getSQLValue(getTrxName(ctx),sqlB.toString(),columnId,impFormatId);
|
||||||
|
}
|
||||||
mImpFormatRow = new X_AD_ImpFormat_Row(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mImpFormatRow = new X_AD_ImpFormat_Row(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
|
|
||||||
mImpFormatRow.setAD_Column_ID(columnId);
|
mImpFormatRow.setAD_Column_ID(columnId);
|
||||||
|
|
|
@ -59,8 +59,11 @@ public class MenuElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
X_AD_Menu mMenu = findPO(ctx, element);
|
X_AD_Menu mMenu = findPO(ctx, element);
|
||||||
if (mMenu == null) {
|
if (mMenu == null) {
|
||||||
String menuName = getStringValue(element, "Name");
|
int menuId = 0;
|
||||||
int menuId = findIdByColumn(ctx, "AD_Menu", "Name", menuName);
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
String menuName = getStringValue(element, "Name");
|
||||||
|
menuId = findIdByColumn(ctx, "AD_Menu", "Name", menuName);
|
||||||
|
}
|
||||||
mMenu = new X_AD_Menu(ctx.ctx, menuId > 0 ? menuId : 0, getTrxName(ctx));
|
mMenu = new X_AD_Menu(ctx.ctx, menuId > 0 ? menuId : 0, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
PoFiller filler = new PoFiller(ctx, mMenu, element, this);
|
PoFiller filler = new PoFiller(ctx, mMenu, element, this);
|
||||||
|
|
|
@ -46,9 +46,11 @@ public class MessageElementHandler extends AbstractElementHandler {
|
||||||
if (isProcessElement(ctx.ctx, entitytype)) {
|
if (isProcessElement(ctx.ctx, entitytype)) {
|
||||||
MMessage mMessage = findPO(ctx, element);
|
MMessage mMessage = findPO(ctx, element);
|
||||||
if (mMessage == null) {
|
if (mMessage == null) {
|
||||||
String value = getStringValue(element, "Value");
|
int id = 0;
|
||||||
int id = findIdByColumn(ctx, "AD_Message", "value", value);
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
String value = getStringValue(element, "Value");
|
||||||
|
id = findIdByColumn(ctx, "AD_Message", "value", value);
|
||||||
|
}
|
||||||
mMessage = new MMessage(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mMessage = new MMessage(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
PoFiller filler = new PoFiller(ctx, mMessage, element, this);
|
PoFiller filler = new PoFiller(ctx, mMessage, element, this);
|
||||||
|
|
|
@ -37,7 +37,10 @@ public class ModelValidatorElementHandler extends AbstractElementHandler{
|
||||||
|
|
||||||
X_AD_ModelValidator validator = findPO(ctx, element);
|
X_AD_ModelValidator validator = findPO(ctx, element);
|
||||||
if (validator == null) {
|
if (validator == null) {
|
||||||
int id = findIdByColumn(ctx, X_AD_ModelValidator.Table_Name, X_AD_ModelValidator.COLUMNNAME_Name, name, /*ignorecase=*/true);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByColumn(ctx, X_AD_ModelValidator.Table_Name, X_AD_ModelValidator.COLUMNNAME_Name, name, /*ignorecase=*/true);
|
||||||
|
}
|
||||||
validator = new X_AD_ModelValidator(ctx.ctx, id, getTrxName(ctx));
|
validator = new X_AD_ModelValidator(ctx.ctx, id, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
List<String> excludes = defaultExcludeList(X_AD_ModelValidator.Table_Name);
|
List<String> excludes = defaultExcludeList(X_AD_ModelValidator.Table_Name);
|
||||||
|
|
|
@ -52,7 +52,10 @@ public class ModificationElementHandler extends AbstractElementHandler{
|
||||||
|
|
||||||
X_AD_Modification modification = findPO(ctx, element);
|
X_AD_Modification modification = findPO(ctx, element);
|
||||||
if (modification == null) {
|
if (modification == null) {
|
||||||
int id = findIdByColumn(ctx, X_AD_Modification.Table_Name, X_AD_Modification.COLUMNNAME_Name, name, /*ignorecase=*/true);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByColumn(ctx, X_AD_Modification.Table_Name, X_AD_Modification.COLUMNNAME_Name, name, /*ignorecase=*/true);
|
||||||
|
}
|
||||||
modification = new X_AD_Modification(ctx.ctx, id, getTrxName(ctx));
|
modification = new X_AD_Modification(ctx.ctx, id, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
List<String> excludes = defaultExcludeList(X_AD_Modification.Table_Name);
|
List<String> excludes = defaultExcludeList(X_AD_Modification.Table_Name);
|
||||||
|
|
|
@ -60,10 +60,12 @@ public class OrgRoleElementHandler extends AbstractElementHandler {
|
||||||
Element orgElement = element.properties.get("AD_Org_ID");
|
Element orgElement = element.properties.get("AD_Org_ID");
|
||||||
int orgId = ReferenceUtils.resolveReference(ctx.ctx, orgElement, getTrxName(ctx));
|
int orgId = ReferenceUtils.resolveReference(ctx.ctx, orgElement, getTrxName(ctx));
|
||||||
|
|
||||||
Query query = new Query(ctx.ctx, "AD_Role_OrgAccess", "AD_Role_ID=? and AD_Org_ID=?", getTrxName(ctx));
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
po = query.setParameters(new Object[]{roleId, orgId})
|
Query query = new Query(ctx.ctx, "AD_Role_OrgAccess", "AD_Role_ID=? and AD_Org_ID=?", getTrxName(ctx));
|
||||||
.setClient_ID()
|
po = query.setParameters(new Object[]{roleId, orgId})
|
||||||
.<X_AD_Role_OrgAccess>first();
|
.setClient_ID()
|
||||||
|
.<X_AD_Role_OrgAccess>first();
|
||||||
|
}
|
||||||
|
|
||||||
if (po == null) {
|
if (po == null) {
|
||||||
po = new X_AD_Role_OrgAccess(ctx.ctx, 0, getTrxName(ctx));
|
po = new X_AD_Role_OrgAccess(ctx.ctx, 0, getTrxName(ctx));
|
||||||
|
|
|
@ -55,8 +55,11 @@ public class PrintFormatElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
X_AD_PrintFormat mPrintFormat = findPO(ctx, element);
|
X_AD_PrintFormat mPrintFormat = findPO(ctx, element);
|
||||||
if (mPrintFormat == null) {
|
if (mPrintFormat == null) {
|
||||||
String name = getStringValue(element, "Name");
|
int id = 0;
|
||||||
int id = findIdByColumn(ctx, "AD_PrintFormat", "Name", name);
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
String name = getStringValue(element, "Name");
|
||||||
|
id = findIdByColumn(ctx, "AD_PrintFormat", "Name", name);
|
||||||
|
}
|
||||||
mPrintFormat = new X_AD_PrintFormat(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mPrintFormat = new X_AD_PrintFormat(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
PoFiller filler = new PoFiller(ctx, mPrintFormat, element, this);
|
PoFiller filler = new PoFiller(ctx, mPrintFormat, element, this);
|
||||||
|
|
|
@ -64,8 +64,11 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String name = getStringValue(element, "Name");
|
int id = 0;
|
||||||
int id = findIdByNameAndParentId(ctx, "AD_PrintFormatItem", name, "AD_PrintFormat", parentId);
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
String name = getStringValue(element, "Name");
|
||||||
|
id = findIdByNameAndParentId(ctx, "AD_PrintFormatItem", name, "AD_PrintFormat", parentId);
|
||||||
|
}
|
||||||
mPrintFormatItem = new X_AD_PrintFormatItem(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mPrintFormatItem = new X_AD_PrintFormatItem(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
mPrintFormatItem.setAD_PrintFormat_ID(parentId);
|
mPrintFormatItem.setAD_PrintFormat_ID(parentId);
|
||||||
excludes.add(I_AD_PrintFormatItem.COLUMNNAME_AD_PrintFormat_ID);
|
excludes.add(I_AD_PrintFormatItem.COLUMNNAME_AD_PrintFormat_ID);
|
||||||
|
|
|
@ -46,8 +46,10 @@ public class PrintPaperElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
if (printPaper == null) {
|
if (printPaper == null) {
|
||||||
String printPaperName = getStringValue(element, "Name", excludes);
|
String printPaperName = getStringValue(element, "Name", excludes);
|
||||||
int id = findIdByName(ctx, "AD_PrintPaper", printPaperName);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByName(ctx, "AD_PrintPaper", printPaperName);
|
||||||
|
}
|
||||||
printPaper = new X_AD_PrintPaper(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
printPaper = new X_AD_PrintPaper(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
printPaper.setName(printPaperName);
|
printPaper.setName(printPaperName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,9 +66,11 @@ public class ProcessAccessElementHandler extends AbstractElementHandler {
|
||||||
element.unresolved = "AD_Process_ID " + (processElement.contents != null ? processElement.contents.toString() : "");
|
element.unresolved = "AD_Process_ID " + (processElement.contents != null ? processElement.contents.toString() : "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Query query = new Query(ctx.ctx, "AD_Process_Access", "AD_Role_ID=? and AD_Process_ID=?", getTrxName(ctx));
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
po = query.setParameters(new Object[]{roleid, processid}).first();
|
Query query = new Query(ctx.ctx, "AD_Process_Access", "AD_Role_ID=? and AD_Process_ID=?", getTrxName(ctx));
|
||||||
|
po = query.setParameters(new Object[]{roleid, processid}).first();
|
||||||
|
}
|
||||||
if (po == null)
|
if (po == null)
|
||||||
{
|
{
|
||||||
po = new X_AD_Process_Access(ctx.ctx, 0, getTrxName(ctx));
|
po = new X_AD_Process_Access(ctx.ctx, 0, getTrxName(ctx));
|
||||||
|
|
|
@ -62,7 +62,10 @@ public class ProcessElementHandler extends AbstractElementHandler {
|
||||||
String value = getStringValue(element, "Value");
|
String value = getStringValue(element, "Value");
|
||||||
|
|
||||||
// Get New process.
|
// Get New process.
|
||||||
int id = findIdByColumn(ctx, "AD_Process", "Value", value);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByColumn(ctx, "AD_Process", "Value", value);
|
||||||
|
}
|
||||||
mProcess = new X_AD_Process(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mProcess = new X_AD_Process(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,9 @@ public class ProcessParaElementHandler extends AbstractElementHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
id = findIdByColumnAndParentId(ctx, "AD_Process_Para", "ColumnName", name, "AD_Process", masterId);
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByColumnAndParentId(ctx, "AD_Process_Para", "ColumnName", name, "AD_Process", masterId);
|
||||||
|
}
|
||||||
mProcessPara = new X_AD_Process_Para(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mProcessPara = new X_AD_Process_Para(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
mProcessPara.setAD_Process_ID(masterId);
|
mProcessPara.setAD_Process_ID(masterId);
|
||||||
excludes.add(I_AD_Process_Para.COLUMNNAME_AD_Process_ID);
|
excludes.add(I_AD_Process_Para.COLUMNNAME_AD_Process_ID);
|
||||||
|
|
|
@ -60,7 +60,10 @@ public class ReferenceElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
X_AD_Reference mReference = findPO(ctx, element);
|
X_AD_Reference mReference = findPO(ctx, element);
|
||||||
if (mReference == null) {
|
if (mReference == null) {
|
||||||
int id = findIdByName(ctx, "AD_Reference", name);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByName(ctx, "AD_Reference", name);
|
||||||
|
}
|
||||||
mReference = new X_AD_Reference(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mReference = new X_AD_Reference(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
List<String> excludes = defaultExcludeList(X_AD_Reference.Table_Name);
|
List<String> excludes = defaultExcludeList(X_AD_Reference.Table_Name);
|
||||||
|
|
|
@ -59,7 +59,10 @@ public class ReferenceListElementHandler extends AbstractElementHandler {
|
||||||
AD_Reference_ID = ReferenceUtils.resolveReference(ctx.ctx, referenceElement, getTrxName(ctx));
|
AD_Reference_ID = ReferenceUtils.resolveReference(ctx.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 = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
AD_Ref_List_ID = findIdByColumnAndParentId(ctx, "AD_Ref_List", "Value", value, "AD_Reference", AD_Reference_ID);
|
||||||
|
}
|
||||||
mRefList = new X_AD_Ref_List(ctx.ctx, AD_Ref_List_ID, getTrxName(ctx));
|
mRefList = new X_AD_Ref_List(ctx.ctx, AD_Ref_List_ID, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,22 +67,26 @@ public class ReferenceTableElementHandler extends AbstractElementHandler {
|
||||||
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");
|
||||||
|
|
||||||
String sql = "SELECT * FROM AD_Ref_Table WHERE AD_Reference_ID = ?";
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
PreparedStatement pstmt = null;
|
String sql = "SELECT * FROM AD_Ref_Table WHERE AD_Reference_ID = ?";
|
||||||
ResultSet rs = null;
|
PreparedStatement pstmt = null;
|
||||||
try {
|
ResultSet rs = null;
|
||||||
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
|
try {
|
||||||
pstmt.setInt(1, AD_Reference_ID);
|
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
|
||||||
rs = pstmt.executeQuery();
|
pstmt.setInt(1, AD_Reference_ID);
|
||||||
if (rs.next()) {
|
rs = pstmt.executeQuery();
|
||||||
refTable = new X_AD_Ref_Table(ctx.ctx, rs, getTrxName(ctx));
|
if (rs.next()) {
|
||||||
} else {
|
refTable = new X_AD_Ref_Table(ctx.ctx, rs, getTrxName(ctx));
|
||||||
refTable = new X_AD_Ref_Table(ctx.ctx, 0, getTrxName(ctx));
|
} else {
|
||||||
|
refTable = new X_AD_Ref_Table(ctx.ctx, 0, getTrxName(ctx));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new DatabaseAccessException(e.getLocalizedMessage(), e);
|
||||||
|
} finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} else {
|
||||||
throw new DatabaseAccessException(e.getLocalizedMessage(), e);
|
refTable = new X_AD_Ref_Table(ctx.ctx, 0, getTrxName(ctx));
|
||||||
} finally {
|
|
||||||
DB.close(rs, pstmt);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String action = refTable.is_new() ? "New" : "Update";
|
String action = refTable.is_new() ? "New" : "Update";
|
||||||
|
|
|
@ -90,7 +90,10 @@ public class ReportViewColElementHandler extends AbstractElementHandler {
|
||||||
sql.append(" AND FunctionColumn = ?");
|
sql.append(" AND FunctionColumn = ?");
|
||||||
sql.append(" AND AD_ReportView_ID = ?");
|
sql.append(" AND AD_ReportView_ID = ?");
|
||||||
|
|
||||||
int id = DB.getSQLValue(getTrxName(ctx), sql.toString(), functionColumn, AD_ReportView_ID);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = DB.getSQLValue(getTrxName(ctx), sql.toString(), functionColumn, AD_ReportView_ID);
|
||||||
|
}
|
||||||
mReportviewCol = new X_AD_ReportView_Col(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mReportviewCol = new X_AD_ReportView_Col(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
mReportviewCol.setAD_ReportView_ID(AD_ReportView_ID);
|
mReportviewCol.setAD_ReportView_ID(AD_ReportView_ID);
|
||||||
if (AD_Column_ID > 0) {
|
if (AD_Column_ID > 0) {
|
||||||
|
|
|
@ -57,8 +57,11 @@ public class ReportViewElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
X_AD_ReportView mReportview = findPO(ctx, element);
|
X_AD_ReportView mReportview = findPO(ctx, element);
|
||||||
if (mReportview == null) {
|
if (mReportview == null) {
|
||||||
String name = getStringValue(element, "Name");
|
int id = 0;
|
||||||
int id = findIdByName(ctx, "AD_ReportView", name);
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
String name = getStringValue(element, "Name");
|
||||||
|
id = findIdByName(ctx, "AD_ReportView", name);
|
||||||
|
}
|
||||||
mReportview = new X_AD_ReportView(ctx.ctx, id, getTrxName(ctx));
|
mReportview = new X_AD_ReportView(ctx.ctx, id, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
PoFiller filler = new PoFiller(ctx, mReportview, element, this);
|
PoFiller filler = new PoFiller(ctx, mReportview, element, this);
|
||||||
|
|
|
@ -69,7 +69,10 @@ public class RoleElementHandler extends AbstractElementHandler {
|
||||||
MRole mRole = findPO(ctx, element);
|
MRole mRole = findPO(ctx, element);
|
||||||
if (mRole == null) {
|
if (mRole == null) {
|
||||||
String name = getStringValue(element, "Name", excludes);
|
String name = getStringValue(element, "Name", excludes);
|
||||||
int id = findIdByName(ctx, "AD_Role", name);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByName(ctx, "AD_Role", name);
|
||||||
|
}
|
||||||
mRole = new MRole(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mRole = new MRole(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
mRole.setName(name);
|
mRole.setName(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,11 +85,14 @@ public class TabElementHandler extends AbstractElementHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String sql = "SELECT AD_Tab_ID FROM AD_Tab where AD_Window_ID = ? "
|
int id = 0;
|
||||||
+ " AND Name = ?"
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
+ " AND AD_Table_ID = ?";
|
String sql = "SELECT AD_Tab_ID FROM AD_Tab where AD_Window_ID = ? "
|
||||||
|
+ " AND Name = ?"
|
||||||
int id = DB.getSQLValue(getTrxName(ctx), sql, windowId, name, tableId);
|
+ " AND AD_Table_ID = ?";
|
||||||
|
|
||||||
|
id = DB.getSQLValue(getTrxName(ctx), sql, windowId, name, tableId);
|
||||||
|
}
|
||||||
mTab = new MTab(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mTab = new MTab(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
mTab.setAD_Table_ID(tableId);
|
mTab.setAD_Table_ID(tableId);
|
||||||
mTab.setName(name);
|
mTab.setName(name);
|
||||||
|
|
|
@ -58,16 +58,18 @@ public class TableElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
MTable mTable = findPO(ctx, element);
|
MTable mTable = findPO(ctx, element);
|
||||||
if (mTable == null) {
|
if (mTable == null) {
|
||||||
|
int id = 0;
|
||||||
String tableName = getStringValue(element, "TableName", excludes);
|
String tableName = getStringValue(element, "TableName", excludes);
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
int id = packIn.getTableId(tableName);
|
id = packIn.getTableId(tableName);
|
||||||
if (id <= 0) {
|
if (id <= 0) {
|
||||||
id = findIdByColumn(ctx, "AD_Table", "TableName", tableName);
|
id = findIdByColumn(ctx, "AD_Table", "TableName", tableName);
|
||||||
if (id > 0)
|
if (id > 0)
|
||||||
packIn.addTable(tableName, id);
|
packIn.addTable(tableName, id);
|
||||||
}
|
}
|
||||||
if (id > 0 && isTableProcess(ctx, id)) {
|
if (id > 0 && isTableProcess(ctx, id)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mTable = new MTable(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mTable = new MTable(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
|
|
|
@ -67,8 +67,10 @@ public class TaskAccessElementHandler extends AbstractElementHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Query query = new Query(ctx.ctx, "AD_Task_Access", "AD_Role_ID=? and AD_Task_ID=?", getTrxName(ctx));
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
po = query.setParameters(new Object[]{roleid, taskid}).first();
|
Query query = new Query(ctx.ctx, "AD_Task_Access", "AD_Role_ID=? and AD_Task_ID=?", getTrxName(ctx));
|
||||||
|
po = query.setParameters(new Object[]{roleid, taskid}).first();
|
||||||
|
}
|
||||||
if (po == null){
|
if (po == null){
|
||||||
po = new X_AD_Task_Access(ctx.ctx, 0, getTrxName(ctx));
|
po = new X_AD_Task_Access(ctx.ctx, 0, getTrxName(ctx));
|
||||||
po.setAD_Role_ID(roleid);
|
po.setAD_Role_ID(roleid);
|
||||||
|
|
|
@ -50,8 +50,11 @@ public class TaskElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
MTask mTask = findPO(ctx, element);
|
MTask mTask = findPO(ctx, element);
|
||||||
if (mTask == null) {
|
if (mTask == null) {
|
||||||
String name = getStringValue(element, "Name");
|
int id = 0;
|
||||||
int id = findIdByName(ctx, "AD_Task", name);
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
String name = getStringValue(element, "Name");
|
||||||
|
id = findIdByName(ctx, "AD_Task", name);
|
||||||
|
}
|
||||||
mTask = new MTask(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mTask = new MTask(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,10 @@ public class UserRoleElementHandler extends AbstractElementHandler {
|
||||||
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.ctx, orgElement, getTrxName(ctx));
|
orgid = ReferenceUtils.resolveReference(ctx.ctx, orgElement, getTrxName(ctx));
|
||||||
|
|
||||||
Query query = new Query(ctx.ctx, "AD_User_Roles", "AD_User_ID = ? AND AD_Role_ID = ? AND AD_Org_ID = ?", getTrxName(ctx));
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
po = query.setParameters(new Object[]{userid, roleid, orgid}).first();
|
Query query = new Query(ctx.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) {
|
if (po == null) {
|
||||||
po = new X_AD_User_Roles(ctx.ctx, 0, getTrxName(ctx));
|
po = new X_AD_User_Roles(ctx.ctx, 0, getTrxName(ctx));
|
||||||
po.setAD_Org_ID(orgid);
|
po.setAD_Org_ID(orgid);
|
||||||
|
|
|
@ -66,8 +66,10 @@ public class WindowAccessElementHandler extends AbstractElementHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Query query = new Query(ctx.ctx, "AD_Window_Access", "AD_Role_ID=? and AD_Window_ID=?", getTrxName(ctx));
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
po = query.setParameters(new Object[]{roleid, windowid}).first();
|
Query query = new Query(ctx.ctx, "AD_Window_Access", "AD_Role_ID=? and AD_Window_ID=?", getTrxName(ctx));
|
||||||
|
po = query.setParameters(new Object[]{roleid, windowid}).first();
|
||||||
|
}
|
||||||
if (po == null) {
|
if (po == null) {
|
||||||
po = new X_AD_Window_Access(ctx.ctx, 0, getTrxName(ctx));
|
po = new X_AD_Window_Access(ctx.ctx, 0, getTrxName(ctx));
|
||||||
po.setAD_Role_ID(roleid);
|
po.setAD_Role_ID(roleid);
|
||||||
|
|
|
@ -63,12 +63,14 @@ public class WindowElementHandler extends AbstractElementHandler {
|
||||||
if (isProcessElement(ctx.ctx, entitytype)) {
|
if (isProcessElement(ctx.ctx, entitytype)) {
|
||||||
MWindow mWindow = findPO(ctx, element);
|
MWindow mWindow = findPO(ctx, element);
|
||||||
if (mWindow == null) {
|
if (mWindow == null) {
|
||||||
|
int id = 0;
|
||||||
String name = getStringValue(element, "Name", excludes);
|
String name = getStringValue(element, "Name", excludes);
|
||||||
int id = findIdByName(ctx, "AD_Window", name);
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
if (id > 0 && windows.contains(id)) {
|
id = findIdByName(ctx, "AD_Window", name);
|
||||||
return;
|
if (id > 0 && windows.contains(id)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mWindow = new MWindow(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mWindow = new MWindow(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
mWindow.setName(name);
|
mWindow.setName(name);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -67,8 +67,10 @@ public class WorkflowAccessElementHandler extends AbstractElementHandler {
|
||||||
element.unresolved = "AD_Workflow_ID";
|
element.unresolved = "AD_Workflow_ID";
|
||||||
}
|
}
|
||||||
|
|
||||||
Query query = new Query(ctx.ctx, "AD_Workflow_Access", "AD_Role_ID=? and AD_Workflow_ID=?", getTrxName(ctx));
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
po = query.setParameters(new Object[]{roleid, workflowid}).first();
|
Query query = new Query(ctx.ctx, "AD_Workflow_Access", "AD_Role_ID=? and AD_Workflow_ID=?", getTrxName(ctx));
|
||||||
|
po = query.setParameters(new Object[]{roleid, workflowid}).first();
|
||||||
|
}
|
||||||
if (po == null) {
|
if (po == null) {
|
||||||
po = new MWorkflowAccess(ctx.ctx, 0, getTrxName(ctx));
|
po = new MWorkflowAccess(ctx.ctx, 0, getTrxName(ctx));
|
||||||
po.setAD_Role_ID(roleid);
|
po.setAD_Role_ID(roleid);
|
||||||
|
|
|
@ -63,11 +63,14 @@ public class WorkflowElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
MWorkflow mWorkflow = findPO(ctx, element);
|
MWorkflow mWorkflow = findPO(ctx, element);
|
||||||
if (mWorkflow == null) {
|
if (mWorkflow == null) {
|
||||||
|
int id = 0;
|
||||||
String workflowValue = getStringValue(element, "Value", excludes);
|
String workflowValue = getStringValue(element, "Value", excludes);
|
||||||
int id = findIdByColumn(ctx, "AD_Workflow", "Value", workflowValue);
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
if (id > 0 && workflows.contains(id)) {
|
id = findIdByColumn(ctx, "AD_Workflow", "Value", workflowValue);
|
||||||
element.skip = true;
|
if (id > 0 && workflows.contains(id)) {
|
||||||
return;
|
element.skip = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mWorkflow = new MWorkflow(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mWorkflow = new MWorkflow(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
|
|
|
@ -74,10 +74,12 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
String workflowNodeValue = getStringValue(element, "Value", excludes);
|
String workflowNodeValue = getStringValue(element, "Value", excludes);
|
||||||
StringBuilder sqlB = new StringBuilder(
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
StringBuilder sqlB = new StringBuilder(
|
||||||
"SELECT AD_WF_Node_ID FROM AD_WF_Node WHERE AD_Workflow_ID=? and Value =?");
|
"SELECT AD_WF_Node_ID FROM AD_WF_Node WHERE AD_Workflow_ID=? and Value =?");
|
||||||
|
id = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), workflowId, workflowNodeValue);
|
||||||
int id = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), workflowId, workflowNodeValue);
|
}
|
||||||
mWFNode = new MWFNode(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mWFNode = new MWFNode(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
mWFNode.setValue(workflowNodeValue);
|
mWFNode.setValue(workflowNodeValue);
|
||||||
mWFNode.setAD_Workflow_ID(workflowId);
|
mWFNode.setAD_Workflow_ID(workflowId);
|
||||||
|
|
|
@ -78,9 +78,12 @@ public class WorkflowNodeNextConditionElementHandler extends
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int seqNo = getIntValue(element, "SeqNo");
|
int id = 0;
|
||||||
String sql = "SELECT AD_WF_NextCondition_ID FROM AD_WF_NextCondition WHERE AD_WF_NodeNext_ID =? AND SeqNo=?";
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
int id = DB.getSQLValue(getTrxName(ctx), sql, new Object[] {wfNodeNextId, seqNo});
|
int seqNo = getIntValue(element, "SeqNo");
|
||||||
|
String sql = "SELECT AD_WF_NextCondition_ID FROM AD_WF_NextCondition WHERE AD_WF_NodeNext_ID =? AND SeqNo=?";
|
||||||
|
id = DB.getSQLValue(getTrxName(ctx), sql, new Object[] {wfNodeNextId, seqNo});
|
||||||
|
}
|
||||||
|
|
||||||
mWFNodeNextCondition = new MWFNextCondition(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mWFNodeNextCondition = new MWFNextCondition(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
mWFNodeNextCondition.setAD_WF_NodeNext_ID(wfNodeNextId);
|
mWFNodeNextCondition.setAD_WF_NodeNext_ID(wfNodeNextId);
|
||||||
|
|
|
@ -94,7 +94,10 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
|
||||||
return;
|
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);
|
int AD_WF_NodeNext_ID = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
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.ctx, AD_WF_NodeNext_ID, getTrxName(ctx));
|
mWFNodeNext = new MWFNodeNext(ctx.ctx, AD_WF_NodeNext_ID, getTrxName(ctx));
|
||||||
mWFNodeNext.setAD_WF_Node_ID(wfNodeId);
|
mWFNodeNext.setAD_WF_Node_ID(wfNodeId);
|
||||||
|
|
|
@ -574,7 +574,25 @@ public abstract class AbstractElementHandler implements ElementHandler {
|
||||||
}
|
}
|
||||||
return po;
|
return po;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean hasUUIDKey(PIPOContext ctx, Element element) {
|
||||||
|
String tableName = element.getElementValue();
|
||||||
|
String uuidColumn = PO.getUUIDColumnName(tableName);
|
||||||
|
String uuid = element.properties.get(uuidColumn).contents.toString();
|
||||||
|
return (uuid != null && uuid.trim().length() == 36);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getUUIDKey(PIPOContext ctx, Element element) {
|
||||||
|
String tableName = element.getElementValue();
|
||||||
|
String uuidColumn = PO.getUUIDColumnName(tableName);
|
||||||
|
if (element.properties.containsKey(uuidColumn)) {
|
||||||
|
String uuid = element.properties.get(uuidColumn).contents.toString();
|
||||||
|
if (uuid != null && uuid.trim().length() == 36)
|
||||||
|
return uuid.trim();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param atts
|
* @param atts
|
||||||
|
|
Loading…
Reference in New Issue