Fix [2889652] - Synchronize terminology fails

solving the root problem I changed the element index from columnname to upper(columnname)
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2889652
This commit is contained in:
Carlos Ruiz 2010-03-22 19:50:53 +00:00
parent 91b2eca6b3
commit 71fa1d0ad8
3 changed files with 60 additions and 8 deletions

View File

@ -23,6 +23,7 @@ import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Trx;
/** /**
* Synchronize Column with Database * Synchronize Column with Database
@ -52,6 +53,8 @@ public class SynchronizeTerminology extends SvrProcess
String sql = null; String sql = null;
try { try {
int no; int no;
Trx trx = Trx.get(get_TrxName(), false);
// Create Elements from ColumnNames
sql="SELECT DISTINCT ColumnName, Name, Description, Help, EntityType " sql="SELECT DISTINCT ColumnName, Name, Description, Help, EntityType "
+"FROM AD_COLUMN c WHERE NOT EXISTS " +"FROM AD_COLUMN c WHERE NOT EXISTS "
+"(SELECT 1 FROM AD_ELEMENT e " +"(SELECT 1 FROM AD_ELEMENT e "
@ -72,6 +75,8 @@ public class SynchronizeTerminology extends SvrProcess
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
trx.commit(true);
// Create Elements from Process Parameters
sql="SELECT DISTINCT ColumnName, Name, Description, Help, EntityType " sql="SELECT DISTINCT ColumnName, Name, Description, Help, EntityType "
+" FROM AD_PROCESS_PARA p " +" FROM AD_PROCESS_PARA p "
+" WHERE NOT EXISTS " +" WHERE NOT EXISTS "
@ -94,6 +99,7 @@ public class SynchronizeTerminology extends SvrProcess
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
trx.commit(true);
log.info("Adding missing Element Translations"); log.info("Adding missing Element Translations");
sql="INSERT INTO AD_ELEMENT_TRL (AD_Element_ID, AD_LANGUAGE, AD_Client_ID, AD_Org_ID," sql="INSERT INTO AD_ELEMENT_TRL (AD_Element_ID, AD_LANGUAGE, AD_Client_ID, AD_Org_ID,"
+" IsActive, Created, CreatedBy, Updated, UpdatedBy," +" IsActive, Created, CreatedBy, Updated, UpdatedBy,"
@ -107,7 +113,7 @@ public class SynchronizeTerminology extends SvrProcess
+" (SELECT AD_Element_ID || AD_LANGUAGE FROM AD_ELEMENT_TRL)"; +" (SELECT AD_Element_ID || AD_LANGUAGE FROM AD_ELEMENT_TRL)";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
log.info("Creating link from Element to Column"); log.info("Creating link from Element to Column");
sql="UPDATE AD_COLUMN c" sql="UPDATE AD_COLUMN c"
@ -117,7 +123,7 @@ public class SynchronizeTerminology extends SvrProcess
+" WHERE AD_Element_ID IS NULL"; +" WHERE AD_Element_ID IS NULL";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
log.info("Deleting unused Elements"); log.info("Deleting unused Elements");
sql="DELETE AD_ELEMENT_TRL" sql="DELETE AD_ELEMENT_TRL"
@ -129,6 +135,7 @@ public class SynchronizeTerminology extends SvrProcess
+" (SELECT 1 FROM AD_PROCESS_PARA p WHERE UPPER(e.ColumnName)=UPPER(p.ColumnName)))"; +" (SELECT 1 FROM AD_PROCESS_PARA p WHERE UPPER(e.ColumnName)=UPPER(p.ColumnName)))";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows deleted: "+no); log.info(" rows deleted: "+no);
trx.commit(true);
sql="DELETE AD_ELEMENT e" sql="DELETE AD_ELEMENT e"
+" WHERE AD_Element_ID >= 1000000 AND NOT EXISTS" +" WHERE AD_Element_ID >= 1000000 AND NOT EXISTS"
@ -137,7 +144,7 @@ public class SynchronizeTerminology extends SvrProcess
+" (SELECT 1 FROM AD_PROCESS_PARA p WHERE UPPER(e.ColumnName)=UPPER(p.ColumnName))"; +" (SELECT 1 FROM AD_PROCESS_PARA p WHERE UPPER(e.ColumnName)=UPPER(p.ColumnName))";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows deleted: "+no); log.info(" rows deleted: "+no);
trx.commit(true);
// Columns // Columns
log.info("Synchronize Column"); log.info("Synchronize Column");
@ -152,6 +159,7 @@ public class SynchronizeTerminology extends SvrProcess
+" OR NVL(c.Description,' ') <> NVL(e.Description,' ') OR NVL(c.Help,' ') <> NVL(e.Help,' ')))"; +" OR NVL(c.Description,' ') <> NVL(e.Description,' ') OR NVL(c.Help,' ') <> NVL(e.Help,' ')))";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Fields should now be synchronized // Fields should now be synchronized
log.info("Synchronize Field"); log.info("Synchronize Field");
@ -168,6 +176,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND (f.Name <> e.Name OR NVL(f.Description,' ') <> NVL(e.Description,' ') OR NVL(f.Help,' ') <> NVL(e.Help,' ')))"; +" AND (f.Name <> e.Name OR NVL(f.Description,' ') <> NVL(e.Description,' ') OR NVL(f.Help,' ') <> NVL(e.Help,' ')))";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Field Translations // Field Translations
log.info("Synchronize Field Translations"); log.info("Synchronize Field Translations");
@ -194,6 +203,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND (trl.Name <> e.Name OR NVL(trl.Description,' ') <> NVL(e.Description,' ') OR NVL(trl.Help,' ') <> NVL(e.Help,' ')))"; +" AND (trl.Name <> e.Name OR NVL(trl.Description,' ') <> NVL(e.Description,' ') OR NVL(trl.Help,' ') <> NVL(e.Help,' ')))";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Fields should now be synchronized // Fields should now be synchronized
log.info("Synchronize PO Field"); log.info("Synchronize PO Field");
@ -217,6 +227,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND w.IsSOTrx='N')"; +" AND w.IsSOTrx='N')";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Field Translations // Field Translations
log.info("Synchronize PO Field Translations"); log.info("Synchronize PO Field Translations");
@ -249,7 +260,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND w.IsSOTrx='N')"; +" AND w.IsSOTrx='N')";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Fields from Process // Fields from Process
log.info("Synchronize Field from Process"); log.info("Synchronize Field from Process");
@ -267,6 +278,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND (f.Name<>p.Name OR NVL(f.Description,' ')<>NVL(p.Description,' ') OR NVL(f.Help,' ')<>NVL(p.Help,' ')))"; +" AND (f.Name<>p.Name OR NVL(f.Description,' ')<>NVL(p.Description,' ') OR NVL(f.Help,' ')<>NVL(p.Help,' ')))";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Field Translations from Process // Field Translations from Process
log.info("Synchronize Field Trl from Process Trl"); log.info("Synchronize Field Trl from Process Trl");
@ -291,18 +303,20 @@ public class SynchronizeTerminology extends SvrProcess
+" AND (trl.Name<>p.Name OR NVL(trl.Description,' ')<>NVL(p.Description,' ') OR NVL(trl.Help,' ')<>NVL(p.Help,' ')))"; +" AND (trl.Name<>p.Name OR NVL(trl.Description,' ')<>NVL(p.Description,' ') OR NVL(trl.Help,' ')<>NVL(p.Help,' ')))";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Sync Parameter ColumnName // Sync Parameter ColumnName
sql="UPDATE AD_PROCESS_PARA f" sql="UPDATE AD_PROCESS_PARA f"
+" SET ColumnName = (SELECT e.ColumnName FROM AD_ELEMENT e" +" SET ColumnName = (SELECT e.ColumnName FROM AD_ELEMENT e"
// +" WHERE UPPER(e.ColumnName)=UPPER(f.ColumnName))" +" WHERE UPPER(e.ColumnName)=UPPER(f.ColumnName))"
+" WHERE e.ColumnName=f.ColumnName)" // +" WHERE e.ColumnName=f.ColumnName)"
+" WHERE f.IsCentrallyMaintained='Y' AND f.IsActive='Y'" +" WHERE f.IsCentrallyMaintained='Y' AND f.IsActive='Y'"
+" AND EXISTS (SELECT 1 FROM AD_ELEMENT e" +" AND EXISTS (SELECT 1 FROM AD_ELEMENT e"
+" WHERE UPPER(e.ColumnName)=UPPER(f.ColumnName)" +" WHERE UPPER(e.ColumnName)=UPPER(f.ColumnName)"
+" AND e.ColumnName<>f.ColumnName)"; +" AND e.ColumnName<>f.ColumnName)";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Parameter Fields // Parameter Fields
sql="UPDATE AD_PROCESS_PARA p" sql="UPDATE AD_PROCESS_PARA p"
@ -311,6 +325,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND NOT EXISTS (SELECT 1 FROM AD_ELEMENT e WHERE p.ColumnName=e.ColumnName)"; +" AND NOT EXISTS (SELECT 1 FROM AD_ELEMENT e WHERE p.ColumnName=e.ColumnName)";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Parameter Fields // Parameter Fields
log.info("Synchronize Process Parameter"); log.info("Synchronize Process Parameter");
@ -328,6 +343,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND (f.Name <> e.Name OR NVL(f.Description,' ') <> NVL(e.Description,' ') OR NVL(f.Help,' ') <> NVL(e.Help,' ')))"; +" AND (f.Name <> e.Name OR NVL(f.Description,' ') <> NVL(e.Description,' ') OR NVL(f.Help,' ') <> NVL(e.Help,' ')))";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Parameter Translations // Parameter Translations
log.info("Synchronize Process Parameter Trl"); log.info("Synchronize Process Parameter Trl");
@ -352,6 +368,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND (trl.Name <> et.Name OR NVL(trl.Description,' ') <> NVL(et.Description,' ') OR NVL(trl.Help,' ') <> NVL(et.Help,' ')))"; +" AND (trl.Name <> et.Name OR NVL(trl.Description,' ') <> NVL(et.Description,' ') OR NVL(trl.Help,' ') <> NVL(et.Help,' ')))";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Workflow Node - Window // Workflow Node - Window
log.info("Synchronize Workflow Node from Window"); log.info("Synchronize Workflow Node from Window");
@ -368,6 +385,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND (w.Name <> n.Name OR NVL(w.Description,' ') <> NVL(n.Description,' ') OR NVL(w.Help,' ') <> NVL(n.Help,' ')))"; +" AND (w.Name <> n.Name OR NVL(w.Description,' ') <> NVL(n.Description,' ') OR NVL(w.Help,' ') <> NVL(n.Help,' ')))";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Workflow Translations - Window // Workflow Translations - Window
log.info("Synchronize Workflow Node Trl from Window Trl"); log.info("Synchronize Workflow Node Trl from Window Trl");
@ -387,6 +405,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND (trl.Name <> t.Name OR NVL(trl.Description,' ') <> NVL(t.Description,' ') OR NVL(trl.Help,' ') <> NVL(t.Help,' ')))"; +" AND (trl.Name <> t.Name OR NVL(trl.Description,' ') <> NVL(t.Description,' ') OR NVL(trl.Help,' ') <> NVL(t.Help,' ')))";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Workflow Node - Form // Workflow Node - Form
log.info("Synchronize Workflow Node from Form"); log.info("Synchronize Workflow Node from Form");
@ -400,6 +419,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND (f.Name <> n.Name OR NVL(f.Description,' ') <> NVL(n.Description,' ') OR NVL(f.Help,' ') <> NVL(n.Help,' ')))"; +" AND (f.Name <> n.Name OR NVL(f.Description,' ') <> NVL(n.Description,' ') OR NVL(f.Help,' ') <> NVL(n.Help,' ')))";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Workflow Translations - Form // Workflow Translations - Form
log.info("Synchronize Workflow Node Trl from Form Trl"); log.info("Synchronize Workflow Node Trl from Form Trl");
@ -414,6 +434,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND (trl.Name <> t.Name OR NVL(trl.Description,' ') <> NVL(t.Description,' ') OR NVL(trl.Help,' ') <> NVL(t.Help,' ')))"; +" AND (trl.Name <> t.Name OR NVL(trl.Description,' ') <> NVL(t.Description,' ') OR NVL(trl.Help,' ') <> NVL(t.Help,' ')))";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Workflow Node - Report // Workflow Node - Report
log.info("Synchronize Workflow Node from Process"); log.info("Synchronize Workflow Node from Process");
@ -427,6 +448,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND (f.Name <> n.Name OR NVL(f.Description,' ') <> NVL(n.Description,' ') OR NVL(f.Help,' ') <> NVL(n.Help,' ')))"; +" AND (f.Name <> n.Name OR NVL(f.Description,' ') <> NVL(n.Description,' ') OR NVL(f.Help,' ') <> NVL(n.Help,' ')))";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Workflow Translations - Form // Workflow Translations - Form
log.info("Synchronize Workflow Node Trl from Process Trl"); log.info("Synchronize Workflow Node Trl from Process Trl");
@ -441,6 +463,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND (trl.Name <> t.Name OR NVL(trl.Description,' ') <> NVL(t.Description,' ') OR NVL(trl.Help,' ') <> NVL(t.Help,' ')))"; +" AND (trl.Name <> t.Name OR NVL(trl.Description,' ') <> NVL(t.Description,' ') OR NVL(trl.Help,' ') <> NVL(t.Help,' ')))";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Need centrally maintained flag here! // Need centrally maintained flag here!
log.info("Synchronize PrintFormatItem Name from Element"); log.info("Synchronize PrintFormatItem Name from Element");
@ -459,6 +482,7 @@ public class SynchronizeTerminology extends SvrProcess
+" WHERE AD_Client_ID=pfi.AD_Client_ID AND IsMultiLingualDocument='Y')"; +" WHERE AD_Client_ID=pfi.AD_Client_ID AND IsMultiLingualDocument='Y')";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
log.info("Synchronize PrintFormatItem PrintName from Element"); log.info("Synchronize PrintFormatItem PrintName from Element");
sql="UPDATE AD_PRINTFORMATITEM pfi" sql="UPDATE AD_PRINTFORMATITEM pfi"
@ -479,6 +503,7 @@ public class SynchronizeTerminology extends SvrProcess
+" WHERE AD_Client_ID=pfi.AD_Client_ID AND IsMultiLingualDocument='Y')"; +" WHERE AD_Client_ID=pfi.AD_Client_ID AND IsMultiLingualDocument='Y')";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
log.info("Synchronize PrintFormatItem Trl from Element Trl (Multi-Lingual)"); log.info("Synchronize PrintFormatItem Trl from Element Trl (Multi-Lingual)");
sql="UPDATE AD_PRINTFORMATITEM_TRL trl" sql="UPDATE AD_PRINTFORMATITEM_TRL trl"
@ -503,6 +528,7 @@ public class SynchronizeTerminology extends SvrProcess
+" WHERE AD_Client_ID=trl.AD_Client_ID AND IsMultiLingualDocument='Y')"; +" WHERE AD_Client_ID=trl.AD_Client_ID AND IsMultiLingualDocument='Y')";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
log.info("Synchronize PrintFormatItem Trl (Not Multi-Lingual)"); log.info("Synchronize PrintFormatItem Trl (Not Multi-Lingual)");
sql="UPDATE AD_PRINTFORMATITEM_TRL trl" sql="UPDATE AD_PRINTFORMATITEM_TRL trl"
@ -521,6 +547,7 @@ public class SynchronizeTerminology extends SvrProcess
+" WHERE AD_Client_ID=trl.AD_Client_ID AND IsMultiLingualDocument='N')"; +" WHERE AD_Client_ID=trl.AD_Client_ID AND IsMultiLingualDocument='N')";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
log.info("Reset PrintFormatItem Trl where not used in base table"); log.info("Reset PrintFormatItem Trl where not used in base table");
sql="UPDATE AD_PRINTFORMATITEM_TRL trl" sql="UPDATE AD_PRINTFORMATITEM_TRL trl"
@ -533,6 +560,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND (LENGTH (pfi.PrintName) = 0 OR pfi.PrintName IS NULL))"; +" AND (LENGTH (pfi.PrintName) = 0 OR pfi.PrintName IS NULL))";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
/** /**
SELECT e.PrintName "Element", pfi.PrintName "FormatItem", trl.AD_Language, trl.PrintName "Trl" SELECT e.PrintName "Element", pfi.PrintName "FormatItem", trl.AD_Language, trl.PrintName "Trl"
@ -552,6 +580,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND Action = 'W'"; +" AND Action = 'W'";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
sql="UPDATE AD_MENU_TRL mt" sql="UPDATE AD_MENU_TRL mt"
+" SET Name = (SELECT wt.Name FROM AD_WINDOW_TRL wt, AD_MENU m " +" SET Name = (SELECT wt.Name FROM AD_WINDOW_TRL wt, AD_MENU m "
@ -570,6 +599,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND m.Action = 'W')"; +" AND m.Action = 'W')";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Sync Names - Process // Sync Names - Process
log.info("Synchronizing Menu with Processes"); log.info("Synchronizing Menu with Processes");
@ -580,6 +610,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND m.Action IN ('R', 'P')"; +" AND m.Action IN ('R', 'P')";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
sql="UPDATE AD_MENU_TRL mt" sql="UPDATE AD_MENU_TRL mt"
+" SET Name = (SELECT pt.Name FROM AD_PROCESS_TRL pt, AD_MENU m" +" SET Name = (SELECT pt.Name FROM AD_PROCESS_TRL pt, AD_MENU m"
@ -598,6 +629,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND Action IN ('R', 'P'))"; +" AND Action IN ('R', 'P'))";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Sync Names = Form // Sync Names = Form
log.info("Synchronizing Menu with Forms"); log.info("Synchronizing Menu with Forms");
@ -608,6 +640,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND Action = 'X'"; +" AND Action = 'X'";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
sql="UPDATE AD_MENU_TRL mt" sql="UPDATE AD_MENU_TRL mt"
+" SET Name = (SELECT ft.Name FROM AD_FORM_TRL ft, AD_MENU m" +" SET Name = (SELECT ft.Name FROM AD_FORM_TRL ft, AD_MENU m"
@ -626,6 +659,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND Action = 'X')"; +" AND Action = 'X')";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Sync Names - Workflow // Sync Names - Workflow
log.info("Synchronizing Menu with Workflows"); log.info("Synchronizing Menu with Workflows");
@ -636,6 +670,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND m.Action = 'F'"; +" AND m.Action = 'F'";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
sql="UPDATE AD_MENU_TRL mt" sql="UPDATE AD_MENU_TRL mt"
+" SET Name = (SELECT pt.Name FROM AD_WORKFLOW_TRL pt, AD_MENU m" +" SET Name = (SELECT pt.Name FROM AD_WORKFLOW_TRL pt, AD_MENU m"
@ -654,6 +689,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND Action = 'F')"; +" AND Action = 'F')";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Sync Names = Task // Sync Names = Task
log.info("Synchronizing Menu with Tasks"); log.info("Synchronizing Menu with Tasks");
@ -664,6 +700,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND Action = 'T'"; +" AND Action = 'T'";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
sql="UPDATE AD_MENU_TRL mt" sql="UPDATE AD_MENU_TRL mt"
+" SET Name = (SELECT ft.Name FROM AD_TASK_TRL ft, AD_MENU m" +" SET Name = (SELECT ft.Name FROM AD_TASK_TRL ft, AD_MENU m"
@ -682,6 +719,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND Action = 'T')"; +" AND Action = 'T')";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Column Name + Element // Column Name + Element
log.info("Synchronizing Column with Element"); log.info("Synchronizing Column with Element");
@ -705,7 +743,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND ct.Name<>e.Name)"; +" AND ct.Name<>e.Name)";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no); log.info(" rows updated: "+no);
trx.commit(true);
// Table Name + Element // Table Name + Element
log.info("Synchronizing Table with Element"); log.info("Synchronizing Table with Element");
@ -716,6 +754,7 @@ public class SynchronizeTerminology extends SvrProcess
+"WHERE t.TableName||'_ID'=e.ColumnName " +"WHERE t.TableName||'_ID'=e.ColumnName "
+"AND t.Name<>e.Name)"; +"AND t.Name<>e.Name)";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
trx.commit(true);
log.info(" rows updated: " +no); log.info(" rows updated: " +no);
sql="UPDATE AD_TABLE_TRL tt" sql="UPDATE AD_TABLE_TRL tt"
@ -730,6 +769,7 @@ public class SynchronizeTerminology extends SvrProcess
+" AND tt.Name<>e.Name)"; +" AND tt.Name<>e.Name)";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" trl rows updated: "+no); log.info(" trl rows updated: "+no);
trx.commit(true);
// Trl Table Name + Element // Trl Table Name + Element
sql="UPDATE AD_TABLE t" sql="UPDATE AD_TABLE t"
@ -742,6 +782,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND t.Name<>e.Name)"; +" AND t.Name<>e.Name)";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" trl rows updated: "+no); log.info(" trl rows updated: "+no);
trx.commit(true);
sql=" UPDATE AD_TABLE_TRL tt" sql=" UPDATE AD_TABLE_TRL tt"
+" SET Name = (SELECT e.Name || ' **'" +" SET Name = (SELECT e.Name || ' **'"
+" FROM AD_TABLE t INNER JOIN AD_ELEMENT ex ON (SUBSTR(t.TableName,1,LENGTH(t.TableName)-4)||'_ID'=ex.ColumnName)" +" FROM AD_TABLE t INNER JOIN AD_ELEMENT ex ON (SUBSTR(t.TableName,1,LENGTH(t.TableName)-4)||'_ID'=ex.ColumnName)"
@ -755,6 +797,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND tt.Name<>e.Name)"; +" AND tt.Name<>e.Name)";
no = DB.executeUpdate(sql, false, get_TrxName()); no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" trl rows updated: "+no); log.info(" trl rows updated: "+no);
trx.commit(true);
} catch (Exception e) { } catch (Exception e) {
log.log (Level.SEVERE, "@Failed@: "+e.getLocalizedMessage(), e); log.log (Level.SEVERE, "@Failed@: "+e.getLocalizedMessage(), e);
throw e; throw e;

View File

@ -0,0 +1,4 @@
DROP INDEX ad_element_columnname;
CREATE UNIQUE INDEX ad_element_uppercolumnname
ON ad_element(UPPER(columnname));

View File

@ -0,0 +1,4 @@
DROP INDEX ad_element_columnname;
CREATE UNIQUE INDEX ad_element_uppercolumnname
ON ad_element(UPPER(columnname));