IDEMPIERE-1025 Improve translation for custom tables / failing on new as recordid was being set before savinb

This commit is contained in:
Carlos Ruiz 2013-08-08 16:29:52 -05:00
parent b67f23135c
commit fad6179c03
17 changed files with 17 additions and 3 deletions

View File

@ -78,7 +78,6 @@ public class AdElementHandler extends AbstractElementHandler {
element.unresolved = notfounds.toString(); element.unresolved = notfounds.toString();
return; return;
} }
element.recordId = mElement.getAD_Element_ID();
if (mElement.is_new() || mElement.is_Changed()) { if (mElement.is_new() || mElement.is_Changed()) {
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Element.Table_Name, X_AD_Element.Table_ID); X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Element.Table_Name, X_AD_Element.Table_ID);
if (!mElement.is_new()) { if (!mElement.is_new()) {
@ -100,6 +99,7 @@ public class AdElementHandler extends AbstractElementHandler {
throw new POSaveFailedException("Failed to save Element " + mElement.getName()); throw new POSaveFailedException("Failed to save Element " + mElement.getName());
} }
} }
element.recordId = mElement.getAD_Element_ID();
} else { } else {
element.skip = true; element.skip = true;
} }

View File

@ -151,6 +151,7 @@ public class FieldElementHandler extends AbstractElementHandler {
if (mField.save(getTrxName(ctx)) == true) { if (mField.save(getTrxName(ctx)) == true) {
logImportDetail(ctx, impDetail, 1, mField.getName(), mField logImportDetail(ctx, impDetail, 1, mField.getName(), mField
.get_ID(), action); .get_ID(), action);
element.recordId = mField.getAD_Field_ID();
} else { } else {
logImportDetail(ctx, impDetail, 0, mField.getName(), mField logImportDetail(ctx, impDetail, 0, mField.getName(), mField
.get_ID(), action); .get_ID(), action);

View File

@ -99,6 +99,7 @@ public class FieldGroupElementHandler extends AbstractElementHandler {
logImportDetail(ctx, impDetail, 1, fieldGroup.getName(), logImportDetail(ctx, impDetail, 1, fieldGroup.getName(),
fieldGroup.get_ID(), action); fieldGroup.get_ID(), action);
processedFieldGroups.add(fieldGroup.getAD_FieldGroup_ID()); processedFieldGroups.add(fieldGroup.getAD_FieldGroup_ID());
element.recordId = fieldGroup.getAD_FieldGroup_ID();
} else { } else {
logImportDetail(ctx, impDetail, 0, fieldGroup.getName(), logImportDetail(ctx, impDetail, 0, fieldGroup.getName(),

View File

@ -82,6 +82,7 @@ public class FormElementHandler extends AbstractElementHandler {
if (mForm.save(getTrxName(ctx)) == true){ if (mForm.save(getTrxName(ctx)) == true){
logImportDetail (ctx, impDetail, 1, mForm.getName(), mForm.get_ID(), action); logImportDetail (ctx, impDetail, 1, mForm.getName(), mForm.get_ID(), action);
element.recordId = mForm.get_ID();
} }
else{ else{
logImportDetail (ctx, impDetail, 0, mForm.getName(), mForm.get_ID(), action); logImportDetail (ctx, impDetail, 0, mForm.getName(), mForm.get_ID(), action);

View File

@ -96,6 +96,7 @@ public class MenuElementHandler extends AbstractElementHandler {
try { try {
logImportDetail(ctx, impDetail, 1, mMenu.getName(), mMenu logImportDetail(ctx, impDetail, 1, mMenu.getName(), mMenu
.get_ID(), action); .get_ID(), action);
element.recordId = mMenu.get_ID();
} catch (SAXException e) { } catch (SAXException e) {
if (log.isLoggable(Level.INFO)) log.info("setmenu:" + e); if (log.isLoggable(Level.INFO)) log.info("setmenu:" + e);
} }

View File

@ -86,6 +86,7 @@ public class MessageElementHandler extends AbstractElementHandler {
if (mMessage.save(getTrxName(ctx)) == true){ if (mMessage.save(getTrxName(ctx)) == true){
logImportDetail (ctx, impDetail, 1, mMessage.getValue(), mMessage.get_ID(),action); logImportDetail (ctx, impDetail, 1, mMessage.getValue(), mMessage.get_ID(),action);
messages.add(mMessage.getAD_Message_ID()); messages.add(mMessage.getAD_Message_ID());
element.recordId = mMessage.getAD_Message_ID();
} }
else{ else{
logImportDetail (ctx, impDetail, 0, mMessage.getValue(), mMessage.get_ID(),action); logImportDetail (ctx, impDetail, 0, mMessage.getValue(), mMessage.get_ID(),action);

View File

@ -128,6 +128,7 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler {
if (mPrintFormatItem.save(getTrxName(ctx)) == true) { if (mPrintFormatItem.save(getTrxName(ctx)) == true) {
logImportDetail(ctx, impDetail, 1, mPrintFormatItem.getName(), logImportDetail(ctx, impDetail, 1, mPrintFormatItem.getName(),
mPrintFormatItem.get_ID(), action); mPrintFormatItem.get_ID(), action);
element.recordId = mPrintFormatItem.get_ID();
} else { } else {
logImportDetail(ctx, impDetail, 0, mPrintFormatItem.getName(), logImportDetail(ctx, impDetail, 0, mPrintFormatItem.getName(),
mPrintFormatItem.get_ID(), action); mPrintFormatItem.get_ID(), action);

View File

@ -95,6 +95,7 @@ public class ProcessElementHandler extends AbstractElementHandler {
if (mProcess.save(getTrxName(ctx)) == true) { if (mProcess.save(getTrxName(ctx)) == true) {
logImportDetail(ctx, impDetail, 1, mProcess.getName(), mProcess logImportDetail(ctx, impDetail, 1, mProcess.getName(), mProcess
.get_ID(), action); .get_ID(), action);
element.recordId = mProcess.get_ID();
} else { } else {
logImportDetail(ctx, impDetail, 0, mProcess.getName(), mProcess logImportDetail(ctx, impDetail, 0, mProcess.getName(), mProcess
.get_ID(), action); .get_ID(), action);

View File

@ -105,6 +105,7 @@ public class ProcessParaElementHandler extends AbstractElementHandler {
if (mProcessPara.save(getTrxName(ctx)) == true) { if (mProcessPara.save(getTrxName(ctx)) == true) {
logImportDetail(ctx, impDetail, 1, mProcessPara.getColumnName(), logImportDetail(ctx, impDetail, 1, mProcessPara.getColumnName(),
mProcessPara.get_ID(), action); mProcessPara.get_ID(), action);
element.recordId = mProcessPara.get_ID();
} else { } else {
logImportDetail(ctx, impDetail, 0, mProcessPara.getColumnName(), logImportDetail(ctx, impDetail, 0, mProcessPara.getColumnName(),
mProcessPara.get_ID(), action); mProcessPara.get_ID(), action);

View File

@ -96,6 +96,7 @@ public class ReferenceElementHandler extends AbstractElementHandler {
logImportDetail(ctx, impDetail, 1, mReference.getName(), logImportDetail(ctx, impDetail, 1, mReference.getName(),
mReference.get_ID(), action); mReference.get_ID(), action);
references.add(mReference.getAD_Reference_ID()); references.add(mReference.getAD_Reference_ID());
element.recordId = mReference.getAD_Reference_ID();
} else { } else {
logImportDetail(ctx, impDetail, 0, mReference.getName(), logImportDetail(ctx, impDetail, 0, mReference.getName(),
mReference.get_ID(), action); mReference.get_ID(), action);

View File

@ -92,6 +92,7 @@ public class ReferenceListElementHandler extends AbstractElementHandler {
if (mRefList.save(getTrxName(ctx)) == true) { if (mRefList.save(getTrxName(ctx)) == true) {
logImportDetail(ctx, impDetail, 1, mRefList.getName(), logImportDetail(ctx, impDetail, 1, mRefList.getName(),
mRefList.get_ID(), action); mRefList.get_ID(), action);
element.recordId = mRefList.get_ID();
} else { } else {
logImportDetail(ctx, impDetail, 0, mRefList.getName(), logImportDetail(ctx, impDetail, 0, mRefList.getName(),
mRefList.get_ID(), action); mRefList.get_ID(), action);

View File

@ -51,7 +51,7 @@ public class SQLStatementElementHandler extends AbstractElementHandler {
// NOTE Postgres needs to commit DDL statements // NOTE Postgres needs to commit DDL statements
// add a SQL command just with COMMIT if you want to simulate the Oracle behavior (commit on DDL) // add a SQL command just with COMMIT if you want to simulate the Oracle behavior (commit on DDL)
// It is also recommended on postgres to add a COMMIT before any SQL statement that can fail // It is also necessary on postgres to add a COMMIT before any SQL statement that can fail
// for example a create index where is possible the index already exists // for example a create index where is possible the index already exists
pstmt = DB.prepareStatement(sql, getTrxName(ctx)); pstmt = DB.prepareStatement(sql, getTrxName(ctx));

View File

@ -154,7 +154,7 @@ public class TabElementHandler extends AbstractElementHandler {
} }
if (mTab.save(getTrxName(ctx)) == true){ if (mTab.save(getTrxName(ctx)) == true){
logImportDetail (ctx, impDetail, 1, mTab.getName(), mTab.get_ID(),action); logImportDetail (ctx, impDetail, 1, mTab.getName(), mTab.get_ID(),action);
element.recordId = mTab.getAD_Tab_ID(); element.recordId = mTab.get_ID();
} else { } else {
logImportDetail (ctx, impDetail, 0, mTab.getName(), mTab.get_ID(),action); logImportDetail (ctx, impDetail, 0, mTab.getName(), mTab.get_ID(),action);
throw new POSaveFailedException("Failed to save Tab " + mTab.getName()); throw new POSaveFailedException("Failed to save Tab " + mTab.getName());

View File

@ -81,6 +81,7 @@ public class TaskElementHandler extends AbstractElementHandler {
if (mTask.save(getTrxName(ctx)) == true) { if (mTask.save(getTrxName(ctx)) == true) {
logImportDetail(ctx, impDetail, 1, mTask.getName(), mTask.get_ID(), logImportDetail(ctx, impDetail, 1, mTask.getName(), mTask.get_ID(),
action); action);
element.recordId = mTask.get_ID();
} else { } else {
logImportDetail(ctx, impDetail, 0, mTask.getName(), mTask.get_ID(), logImportDetail(ctx, impDetail, 0, mTask.getName(), mTask.get_ID(),
action); action);

View File

@ -105,6 +105,7 @@ public class WindowElementHandler extends AbstractElementHandler {
logImportDetail(ctx, impDetail, 1, mWindow.getName(), mWindow logImportDetail(ctx, impDetail, 1, mWindow.getName(), mWindow
.get_ID(), action); .get_ID(), action);
windows.add(mWindow.getAD_Window_ID()); windows.add(mWindow.getAD_Window_ID());
element.recordId = mWindow.get_ID();
} else { } else {
logImportDetail(ctx, impDetail, 0, mWindow.getName(), mWindow logImportDetail(ctx, impDetail, 0, mWindow.getName(), mWindow
.get_ID(), action); .get_ID(), action);

View File

@ -103,6 +103,7 @@ public class WorkflowElementHandler extends AbstractElementHandler {
logImportDetail(ctx,impDetail, 1, mWorkflow.getName(), mWorkflow logImportDetail(ctx,impDetail, 1, mWorkflow.getName(), mWorkflow
.get_ID(), action); .get_ID(), action);
workflows.add(mWorkflow.getAD_Workflow_ID()); workflows.add(mWorkflow.getAD_Workflow_ID());
element.recordId = mWorkflow.get_ID();
} else { } else {
log.info("m_Workflow save failure"); log.info("m_Workflow save failure");
logImportDetail(ctx, impDetail, 0, mWorkflow.getName(), mWorkflow logImportDetail(ctx, impDetail, 0, mWorkflow.getName(), mWorkflow

View File

@ -112,6 +112,7 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler {
log.info("m_WFNode save success"); log.info("m_WFNode save success");
logImportDetail(ctx, impDetail, 1, mWFNode.getName(), mWFNode logImportDetail(ctx, impDetail, 1, mWFNode.getName(), mWFNode
.get_ID(), action); .get_ID(), action);
element.recordId = mWFNode.get_ID();
} else { } else {
log.info("m_WFNode save failure"); log.info("m_WFNode save failure");
logImportDetail(ctx, impDetail, 0, mWFNode.getName(), mWFNode logImportDetail(ctx, impDetail, 0, mWFNode.getName(), mWFNode