fix bug [ 1707019 ] Fixed Assets package is broking synchronize translation

better indentation
dropped the AD_Synchronize specific for Oracle for easier maintenance.
This commit is contained in:
Carlos Ruiz 2007-05-08 03:42:54 +00:00
parent 3b9a37e64b
commit c12ec7d400
2 changed files with 677 additions and 663 deletions

View File

@ -54,9 +54,10 @@ public class SynchronizeTerminology extends SvrProcess
protected String doIt() throws Exception
{
//TODO Error handling
String sql = null;
try {
int rowNum;
String sql="SELECT DISTINCT ColumnName, Name,Description, Help, EntityType "
int no;
sql="SELECT DISTINCT ColumnName, Name,Description, Help, EntityType "
+"FROM AD_COLUMN c WHERE NOT EXISTS "
+"(SELECT 1 FROM AD_ELEMENT e "
+" WHERE UPPER(c.ColumnName)=UPPER(e.ColumnName))";
@ -109,8 +110,8 @@ public class SynchronizeTerminology extends SvrProcess
+" WHERE l.IsActive = 'Y' AND l.IsSystemLanguage = 'Y'"
+" AND AD_Element_ID || AD_LANGUAGE NOT IN "
+" (SELECT AD_Element_ID || AD_LANGUAGE FROM AD_ELEMENT_TRL)";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
log.info("Creating link from Element to Column");
@ -119,8 +120,8 @@ public class SynchronizeTerminology extends SvrProcess
+" (SELECT AD_Element_ID FROM AD_ELEMENT e"
+" WHERE UPPER(c.ColumnName)=UPPER(e.ColumnName))"
+" WHERE AD_Element_ID IS NULL";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
log.info("Deleting unused Elements");
@ -131,16 +132,16 @@ public class SynchronizeTerminology extends SvrProcess
+" (SELECT 1 FROM AD_COLUMN c WHERE UPPER(e.ColumnName)=UPPER(c.ColumnName))"
+" AND NOT EXISTS"
+" (SELECT 1 FROM AD_PROCESS_PARA p WHERE UPPER(e.ColumnName)=UPPER(p.ColumnName)))";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows deleted: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows deleted: "+no);
sql="DELETE AD_ELEMENT e"
+" WHERE NOT EXISTS"
+" (SELECT 1 FROM AD_COLUMN c WHERE UPPER(e.ColumnName)=UPPER(c.ColumnName))"
+" AND NOT EXISTS"
+" (SELECT 1 FROM AD_PROCESS_PARA p WHERE UPPER(e.ColumnName)=UPPER(p.ColumnName))";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows deleted: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows deleted: "+no);
// Columns
@ -154,8 +155,8 @@ public class SynchronizeTerminology extends SvrProcess
+" WHERE c.AD_Element_ID=e.AD_Element_ID"
+" AND (c.ColumnName <> e.ColumnName OR c.Name <> e.Name "
+" OR NVL(c.Description,' ') <> NVL(e.Description,' ') OR NVL(c.Help,' ') <> NVL(e.Help,' ')))";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Fields should now be syncronized
log.info("Synchronize Field");
@ -170,8 +171,8 @@ public class SynchronizeTerminology extends SvrProcess
+" WHERE f.AD_Column_ID=c.AD_Column_ID"
+" AND c.AD_Element_ID=e.AD_Element_ID AND c.AD_Process_ID IS NULL"
+" AND (f.Name <> e.Name OR NVL(f.Description,' ') <> NVL(e.Description,' ') OR NVL(f.Help,' ') <> NVL(e.Help,' ')))";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Field Translations
log.info("Synchronize Field Translations");
@ -196,8 +197,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND trl.AD_LANGUAGE=e.AD_LANGUAGE"
+" AND f.IsCentrallyMaintained='Y' AND f.IsActive='Y'"
+" AND (trl.Name <> e.Name OR NVL(trl.Description,' ') <> NVL(e.Description,' ') OR NVL(trl.Help,' ') <> NVL(e.Help,' ')))";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Fields should now be syncronized
log.info("Synchronize PO Field");
@ -219,8 +220,8 @@ public class SynchronizeTerminology extends SvrProcess
+" WHERE f.AD_Tab_ID=t.AD_Tab_ID"
+" AND t.AD_Window_ID=w.AD_Window_ID"
+" AND w.IsSOTrx='N')";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Field Translations
log.info("Synchronize PO Field Translations");
@ -251,8 +252,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND f.AD_Tab_ID=t.AD_Tab_ID"
+" AND t.AD_Window_ID=w.AD_Window_ID"
+" AND w.IsSOTrx='N')";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Fields from Process
@ -269,8 +270,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND EXISTS (SELECT 1 FROM AD_PROCESS p, AD_COLUMN c"
+" WHERE c.AD_Process_ID=p.AD_Process_ID AND f.AD_Column_ID=c.AD_Column_ID"
+" AND (f.Name<>p.Name OR NVL(f.Description,' ')<>NVL(p.Description,' ') OR NVL(f.Help,' ')<>NVL(p.Help,' ')))";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Field Translations from Process
log.info("Synchronize Field Trl from Process Trl");
@ -293,28 +294,28 @@ public class SynchronizeTerminology extends SvrProcess
+" AND f.AD_Field_ID=trl.AD_Field_ID AND p.AD_LANGUAGE=trl.AD_LANGUAGE"
+" AND f.IsCentrallyMaintained='Y' AND f.IsActive='Y'"
+" AND (trl.Name<>p.Name OR NVL(trl.Description,' ')<>NVL(p.Description,' ') OR NVL(trl.Help,' ')<>NVL(p.Help,' ')))";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Sync Parameter ColumnName
sql="UPDATE AD_PROCESS_PARA f"
+" 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 f.IsCentrallyMaintained='Y' AND f.IsActive='Y'"
+" AND EXISTS (SELECT 1 FROM AD_ELEMENT e"
+" WHERE UPPER(e.ColumnName)=UPPER(f.ColumnName)"
+" AND e.ColumnName<>f.ColumnName)";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Paramenter Fields
sql="UPDATE AD_PROCESS_PARA p"
+" SET IsCentrallyMaintained = 'N'"
+" WHERE IsCentrallyMaintained <> 'N'"
+" AND NOT EXISTS (SELECT 1 FROM AD_ELEMENT e WHERE p.ColumnName=e.ColumnName)";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Parameter Fields
log.info("Synchronize Process Parameter");
@ -330,8 +331,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND EXISTS (SELECT 1 FROM AD_ELEMENT e"
+" WHERE e.ColumnName=f.ColumnName"
+" AND (f.Name <> e.Name OR NVL(f.Description,' ') <> NVL(e.Description,' ') OR NVL(f.Help,' ') <> NVL(e.Help,' ')))";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Parameter Translations
log.info("Synchronize Process Parameter Trl");
@ -354,8 +355,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND e.ColumnName=f.ColumnName AND f.AD_Process_Para_ID=trl.AD_Process_Para_ID"
+" AND f.IsCentrallyMaintained='Y' AND f.IsActive='Y'"
+" AND (trl.Name <> et.Name OR NVL(trl.Description,' ') <> NVL(et.Description,' ') OR NVL(trl.Help,' ') <> NVL(et.Help,' ')))";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Workflow Node - Window
log.info("Synchronize Workflow Node from Window");
@ -370,8 +371,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND EXISTS (SELECT 1 FROM AD_WINDOW w"
+" WHERE w.AD_Window_ID=n.AD_Window_ID"
+" AND (w.Name <> n.Name OR NVL(w.Description,' ') <> NVL(n.Description,' ') OR NVL(w.Help,' ') <> NVL(n.Help,' ')))";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Workflow Translations - Window
log.info("Synchronize Workflow Node Trl from Window Trl");
@ -389,8 +390,8 @@ public class SynchronizeTerminology extends SvrProcess
+" WHERE trl.AD_WF_Node_ID=n.AD_WF_Node_ID AND n.AD_Window_ID=t.AD_Window_ID"
+" AND trl.AD_LANGUAGE=t.AD_LANGUAGE AND n.IsCentrallyMaintained='Y' AND n.IsActive='Y'"
+" AND (trl.Name <> t.Name OR NVL(trl.Description,' ') <> NVL(t.Description,' ') OR NVL(trl.Help,' ') <> NVL(t.Help,' ')))";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Workflow Node - Form
log.info("Synchronize Workflow Node from Form");
@ -402,8 +403,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND EXISTS (SELECT 1 FROM AD_FORM f"
+" WHERE f.AD_Form_ID=n.AD_Form_ID"
+" AND (f.Name <> n.Name OR NVL(f.Description,' ') <> NVL(n.Description,' ') OR NVL(f.Help,' ') <> NVL(n.Help,' ')))";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Workflow Translations - Form
log.info("Synchronize Workflow Node Trl from Form Trl");
@ -416,8 +417,8 @@ public class SynchronizeTerminology extends SvrProcess
+" WHERE trl.AD_WF_Node_ID=n.AD_WF_Node_ID AND n.AD_Form_ID=t.AD_Form_ID"
+" AND trl.AD_LANGUAGE=t.AD_LANGUAGE AND n.IsCentrallyMaintained='Y' AND n.IsActive='Y'"
+" AND (trl.Name <> t.Name OR NVL(trl.Description,' ') <> NVL(t.Description,' ') OR NVL(trl.Help,' ') <> NVL(t.Help,' ')))";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Workflow Node - Report
log.info("Synchronize Workflow Node from Process");
@ -429,8 +430,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND EXISTS (SELECT 1 FROM AD_PROCESS f"
+" WHERE f.AD_Process_ID=n.AD_Process_ID"
+" AND (f.Name <> n.Name OR NVL(f.Description,' ') <> NVL(n.Description,' ') OR NVL(f.Help,' ') <> NVL(n.Help,' ')))";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Workflow Translations - Form
log.info("Synchronize Workflow Node Trl from Process Trl");
@ -443,8 +444,8 @@ public class SynchronizeTerminology extends SvrProcess
+" WHERE trl.AD_WF_Node_ID=n.AD_WF_Node_ID AND n.AD_Process_ID=t.AD_Process_ID"
+" AND trl.AD_LANGUAGE=t.AD_LANGUAGE AND n.IsCentrallyMaintained='Y' AND n.IsActive='Y'"
+" AND (trl.Name <> t.Name OR NVL(trl.Description,' ') <> NVL(t.Description,' ') OR NVL(trl.Help,' ') <> NVL(t.Help,' ')))";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Need centrally maintained flag here!
log.info("Synchronize PrintFormatItem Name from Element");
@ -461,8 +462,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND e.Name<>pfi.Name)"
+" AND EXISTS (SELECT 1 FROM AD_CLIENT"
+" WHERE AD_Client_ID=pfi.AD_Client_ID AND IsMultiLingualDocument='Y')";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
log.info("Synchronize PrintFormatItem PrintName from Element");
sql="UPDATE AD_PRINTFORMATITEM pfi"
@ -481,8 +482,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND pf.IsForm='N' AND IsTableBased='Y')"
+" AND EXISTS (SELECT 1 FROM AD_CLIENT "
+" WHERE AD_Client_ID=pfi.AD_Client_ID AND IsMultiLingualDocument='Y')";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
log.info("Synchronize PrintFormatItem Trl from Element Trl (Multi-Lingual)");
sql="UPDATE AD_PRINTFORMATITEM_TRL trl"
@ -505,8 +506,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND pf.IsForm='N' AND IsTableBased='Y')"
+" AND EXISTS (SELECT 1 FROM AD_CLIENT "
+" WHERE AD_Client_ID=trl.AD_Client_ID AND IsMultiLingualDocument='Y')";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
log.info("Synchronize PrintFormatItem Trl (Not Multi-Lingual)");
sql="UPDATE AD_PRINTFORMATITEM_TRL trl"
@ -523,8 +524,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND pf.IsForm='N' AND pf.IsTableBased='Y')"
+" AND EXISTS (SELECT 1 FROM AD_CLIENT "
+" WHERE AD_Client_ID=trl.AD_Client_ID AND IsMultiLingualDocument='N')";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
log.info("Reset PrintFormatItem Trl where not used in base table");
sql="UPDATE AD_PRINTFORMATITEM_TRL trl"
@ -535,8 +536,8 @@ public class SynchronizeTerminology extends SvrProcess
+" WHERE pfi.AD_PrintFormatItem_ID=trl.AD_PrintFormatItem_ID"
+" AND pfi.IsCentrallyMaintained='Y'"
+" AND (LENGTH (pfi.PrintName) = 0 OR pfi.PrintName IS NULL))";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
/**
SELECT e.PrintName "Element", pfi.PrintName "FormatItem", trl.AD_Language, trl.PrintName "Trl"
@ -554,8 +555,8 @@ public class SynchronizeTerminology extends SvrProcess
+" Description = (SELECT Description FROM AD_WINDOW w WHERE m.AD_Window_ID=w.AD_Window_ID)"
+" WHERE AD_Window_ID IS NOT NULL"
+" AND Action = 'W'";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
sql="UPDATE AD_MENU_TRL mt"
+" SET Name = (SELECT wt.Name FROM AD_WINDOW_TRL wt, AD_MENU m "
@ -572,8 +573,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND mt.AD_LANGUAGE=wt.AD_LANGUAGE"
+" AND m.AD_Window_ID IS NOT NULL"
+" AND m.Action = 'W')";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Sync Names - Process
log.info("Synchronizing Menu with Processes");
@ -582,8 +583,8 @@ public class SynchronizeTerminology extends SvrProcess
+" Description = (SELECT p.Description FROM AD_PROCESS p WHERE m.AD_Process_ID=p.AD_Process_ID)"
+" WHERE m.AD_Process_ID IS NOT NULL"
+" AND m.Action IN ('R', 'P')";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
sql="UPDATE AD_MENU_TRL mt"
+" SET Name = (SELECT pt.Name FROM AD_PROCESS_TRL pt, AD_MENU m"
@ -600,8 +601,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND mt.AD_LANGUAGE=pt.AD_LANGUAGE"
+" AND m.AD_Process_ID IS NOT NULL"
+" AND Action IN ('R', 'P'))";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Sync Names = Form
log.info("Synchronizing Menu with Forms");
@ -610,8 +611,8 @@ public class SynchronizeTerminology extends SvrProcess
+" Description = (SELECT Description FROM AD_FORM f WHERE m.AD_Form_ID=f.AD_Form_ID)"
+" WHERE AD_Form_ID IS NOT NULL"
+" AND Action = 'X'";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
sql="UPDATE AD_MENU_TRL mt"
+" SET Name = (SELECT ft.Name FROM AD_FORM_TRL ft, AD_MENU m"
@ -628,8 +629,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND mt.AD_LANGUAGE=ft.AD_LANGUAGE"
+" AND m.AD_Form_ID IS NOT NULL"
+" AND Action = 'X')";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Sync Names - Workflow
log.info("Synchronizing Menu with Workflows");
@ -638,8 +639,8 @@ public class SynchronizeTerminology extends SvrProcess
+" Description = (SELECT p.Description FROM AD_WORKFLOW p WHERE m.AD_Workflow_ID=p.AD_Workflow_ID)"
+" WHERE m.AD_Workflow_ID IS NOT NULL"
+" AND m.Action = 'F'";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
sql="UPDATE AD_MENU_TRL mt"
+" SET Name = (SELECT pt.Name FROM AD_WORKFLOW_TRL pt, AD_MENU m"
@ -656,8 +657,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND mt.AD_LANGUAGE=pt.AD_LANGUAGE"
+" AND m.AD_Workflow_ID IS NOT NULL"
+" AND Action = 'F')";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Sync Names = Task
log.info("Synchronizing Menu with Tasks");
@ -666,8 +667,8 @@ public class SynchronizeTerminology extends SvrProcess
+" Description = (SELECT Description FROM AD_TASK f WHERE m.AD_Task_ID=f.AD_Task_ID)"
+" WHERE AD_Task_ID IS NOT NULL"
+" AND Action = 'T'";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
sql="UPDATE AD_MENU_TRL mt"
+" SET Name = (SELECT ft.Name FROM AD_TASK_TRL ft, AD_MENU m"
@ -684,8 +685,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND mt.AD_LANGUAGE=ft.AD_LANGUAGE"
+" AND m.AD_Task_ID IS NOT NULL"
+" AND Action = 'T')";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Column Name + Element
log.info("Synchronizing Column with Element");
@ -697,8 +698,8 @@ public class SynchronizeTerminology extends SvrProcess
+" (SELECT 1 FROM AD_ELEMENT e "
+" WHERE c.AD_Element_ID=e.AD_Element_ID"
+" AND c.Name<>e.Name)";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
sql="UPDATE AD_COLUMN_TRL ct"
+" SET Name = (SELECT e.Name"
+" FROM AD_COLUMN c INNER JOIN AD_ELEMENT_TRL e ON (c.AD_Element_ID=e.AD_Element_ID)"
@ -707,8 +708,8 @@ public class SynchronizeTerminology extends SvrProcess
+" (SELECT 1 FROM AD_COLUMN c INNER JOIN AD_ELEMENT_TRL e ON (c.AD_Element_ID=e.AD_Element_ID)"
+" WHERE ct.AD_Column_ID=c.AD_Column_ID AND ct.AD_LANGUAGE=e.AD_LANGUAGE"
+" AND ct.Name<>e.Name)";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: "+no);
// Table Name + Element
@ -719,9 +720,9 @@ public class SynchronizeTerminology extends SvrProcess
+"WHERE EXISTS (SELECT 1 FROM AD_ELEMENT e "
+"WHERE t.TableName||'_ID'=e.ColumnName "
+"AND t.Name<>e.Name)";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" rows updated: " +rowNum);
log.info(" rows updated: " +no);
sql="UPDATE AD_TABLE_TRL tt"
+" SET Name = (SELECT e.Name "
+" FROM AD_TABLE t INNER JOIN AD_ELEMENT ex ON (t.TableName||'_ID'=ex.ColumnName)"
@ -732,8 +733,8 @@ public class SynchronizeTerminology extends SvrProcess
+" INNER JOIN AD_ELEMENT_TRL e ON (ex.AD_Element_ID=e.AD_Element_ID)"
+" WHERE tt.AD_Table_ID=t.AD_Table_ID AND tt.AD_LANGUAGE=e.AD_LANGUAGE"
+" AND tt.Name<>e.Name)";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" trl rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" trl rows updated: "+no);
// Trl Table Name + Element
sql="UPDATE AD_TABLE t"
@ -744,8 +745,8 @@ public class SynchronizeTerminology extends SvrProcess
+" AND EXISTS (SELECT 1 FROM AD_ELEMENT e "
+" WHERE SUBSTR(t.TableName,1,LENGTH(t.TableName)-4)||'_ID'=e.ColumnName"
+" AND t.Name<>e.Name)";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" trl rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" trl rows updated: "+no);
sql=" UPDATE AD_TABLE_TRL tt"
+" 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)"
@ -757,10 +758,11 @@ public class SynchronizeTerminology extends SvrProcess
+" WHERE tt.AD_Table_ID=t.AD_Table_ID AND tt.AD_LANGUAGE=e.AD_LANGUAGE"
+" AND t.TableName LIKE '%_Trl'"
+" AND tt.Name<>e.Name)";
rowNum = DB.executeUpdate(sql, false, get_TrxName());
log.info(" trl rows updated: "+rowNum);
no = DB.executeUpdate(sql, false, get_TrxName());
log.info(" trl rows updated: "+no);
} catch (Exception e) {
log.log (Level.SEVERE, "@Failed@: "+e.getLocalizedMessage(), e);
throw e;
}
return "@OK@";

View File

@ -0,0 +1,12 @@
-- only needed for oracle
UPDATE AD_PROCESS
SET classname = 'org.compiere.process.SynchronizeTerminology',
procedurename = NULL,
updated = TO_DATE ('2007-05-07 21:20:30', 'YYYY-MM-DD HH24:MI:SS'),
updatedby = 100
WHERE ad_process_id = 172;
COMMIT ;
DROP PROCEDURE Ad_Synchronize;