From 466f5f6cae367bc73105b3e428a73e7fce6f25e3 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 28 Mar 2013 10:28:22 -0500 Subject: [PATCH 1/2] IDEMPIERE-136 Tenant base language improvement / make it thread safe (thanks to Heng Sin for raising the alert) and include other suggestions from findbugs --- .../src/org/compiere/model/MTable.java | 14 +++++++------- .../src/org/compiere/model/POInfo.java | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MTable.java b/org.adempiere.base/src/org/compiere/model/MTable.java index 526f290ec5..df61abd7d5 100644 --- a/org.adempiere.base/src/org/compiere/model/MTable.java +++ b/org.adempiere.base/src/org/compiere/model/MTable.java @@ -67,7 +67,7 @@ public class MTable extends X_AD_Table */ public static MTable get (Properties ctx, int AD_Table_ID) { - Integer key = new Integer (AD_Table_ID); + Integer key = Integer.valueOf(AD_Table_ID); MTable retValue = s_cache.get (key); if (retValue != null && retValue.getCtx() == ctx) { return retValue; @@ -125,7 +125,7 @@ public class MTable extends X_AD_Table if (retValue != null) { - Integer key = new Integer (retValue.getAD_Table_ID()); + Integer key = Integer.valueOf(retValue.getAD_Table_ID()); s_cache.put (key, retValue); } return retValue; @@ -216,7 +216,7 @@ public class MTable extends X_AD_Table * @param requery requery * @return array of columns */ - public MColumn[] getColumns (boolean requery) + public synchronized MColumn[] getColumns (boolean requery) { if (m_columns != null && !requery) return m_columns; @@ -277,7 +277,7 @@ public class MTable extends X_AD_Table * @param ColumnName column name * @return index of column with ColumnName or -1 if not found */ - public int getColumnIndex (String ColumnName) + public synchronized int getColumnIndex (String ColumnName) { if (m_columns == null) getColumns(false); @@ -293,7 +293,7 @@ public class MTable extends X_AD_Table * @param AD_Column_ID column * @return index of column with ColumnName or -1 if not found */ - public int getColumnIndex (int AD_Column_ID) + public synchronized int getColumnIndex (int AD_Column_ID) { if (m_columns == null) getColumns(false); @@ -370,7 +370,7 @@ public class MTable extends X_AD_Table if (po == null) { - po = new GenericPO(tableName, getCtx(), new Integer(Record_ID), trxName); + po = new GenericPO(tableName, getCtx(), Record_ID, trxName); if (po.get_ID() != Record_ID && Record_ID > 0) po = null; } @@ -493,7 +493,7 @@ public class MTable extends X_AD_Table MSequence seq = MSequence.get(getCtx(), getTableName(), get_TrxName()); if (seq == null || seq.get_ID() == 0) MSequence.createTableSequence(getCtx(), getTableName(), get_TrxName()); - else if (seq != null && !seq.getName().equals(getTableName())) + else if (!seq.getName().equals(getTableName())) { seq.setName(getTableName()); seq.saveEx(); diff --git a/org.adempiere.base/src/org/compiere/model/POInfo.java b/org.adempiere.base/src/org/compiere/model/POInfo.java index 6ba5b95d1f..7b852069f6 100644 --- a/org.adempiere.base/src/org/compiere/model/POInfo.java +++ b/org.adempiere.base/src/org/compiere/model/POInfo.java @@ -69,9 +69,9 @@ public class POInfo implements Serializable * @param trxName Transaction name * @return POInfo */ - public static POInfo getPOInfo (Properties ctx, int AD_Table_ID, String trxName) + public static synchronized POInfo getPOInfo (Properties ctx, int AD_Table_ID, String trxName) { - Integer key = new Integer(AD_Table_ID); + Integer key = Integer.valueOf(AD_Table_ID); POInfo retValue = (POInfo)s_cache.get(key); if (retValue == null) { @@ -577,7 +577,7 @@ public class POInfo implements Serializable * Is Table Translated * @return true if table is translated */ - public boolean isTranslated () + public synchronized boolean isTranslated () { if (m_IsTranslated == null) { m_IsTranslated = Boolean.FALSE; From 001a033914a9994e4b6bc19a2920d75b6e90920d Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 28 Mar 2013 11:06:00 -0500 Subject: [PATCH 2/2] IDEMPIERE-808 New record allows user to select System Client / some cleanup in tabs - make all client columns read-only --- .../oracle/201303281029_IDEMPIERE-808.sql | 116 ++++++++++++++++++ .../postgresql/201303281029_IDEMPIERE-808.sql | 116 ++++++++++++++++++ 2 files changed, 232 insertions(+) create mode 100644 migration/i1.0a-release/oracle/201303281029_IDEMPIERE-808.sql create mode 100644 migration/i1.0a-release/postgresql/201303281029_IDEMPIERE-808.sql diff --git a/migration/i1.0a-release/oracle/201303281029_IDEMPIERE-808.sql b/migration/i1.0a-release/oracle/201303281029_IDEMPIERE-808.sql new file mode 100644 index 0000000000..1f87f7adfb --- /dev/null +++ b/migration/i1.0a-release/oracle/201303281029_IDEMPIERE-808.sql @@ -0,0 +1,116 @@ +-- Mar 28, 2013 9:56:36 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10, IsInsertRecord='N',Updated=TO_DATE('2013-03-28 09:56:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53146 +; + +-- Mar 28, 2013 9:56:53 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=20,Updated=TO_DATE('2013-03-28 09:56:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53147 +; + +-- Mar 28, 2013 9:58:20 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_DATE('2013-03-28 09:58:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53139 +; + +-- Mar 28, 2013 9:58:53 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_DATE('2013-03-28 09:58:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53138 +; + +-- Mar 28, 2013 10:33:30 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10, IsInsertRecord='N',Updated=TO_DATE('2013-03-28 10:33:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53143 +; + +-- Mar 28, 2013 10:33:39 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=20, IsInsertRecord='N',Updated=TO_DATE('2013-03-28 10:33:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53144 +; + +-- Mar 28, 2013 10:33:44 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=30, IsInsertRecord='N',Updated=TO_DATE('2013-03-28 10:33:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53145 +; + +-- Mar 28, 2013 10:33:49 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=40,Updated=TO_DATE('2013-03-28 10:33:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53142 +; + +-- Mar 28, 2013 10:35:45 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10, IsInsertRecord='N',Updated=TO_DATE('2013-03-28 10:35:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53150 +; + +-- Mar 28, 2013 10:35:49 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=20, IsInsertRecord='N',Updated=TO_DATE('2013-03-28 10:35:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53148 +; + +-- Mar 28, 2013 10:35:54 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=30,Updated=TO_DATE('2013-03-28 10:35:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53149 +; + +-- Mar 28, 2013 10:36:59 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_DATE('2013-03-28 10:36:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53175 +; + +-- Mar 28, 2013 10:37:15 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_DATE('2013-03-28 10:37:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53174 +; + +-- Mar 28, 2013 10:37:27 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_DATE('2013-03-28 10:37:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53171 +; + +-- Mar 28, 2013 10:40:15 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_DATE('2013-03-28 10:40:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53152 +; + +-- Mar 28, 2013 10:40:24 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_DATE('2013-03-28 10:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53170 +; + +-- Mar 28, 2013 10:40:32 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_DATE('2013-03-28 10:40:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53141 +; + +-- Mar 28, 2013 10:40:43 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_DATE('2013-03-28 10:40:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=367 +; + +-- Mar 28, 2013 10:40:48 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=20,Updated=TO_DATE('2013-03-28 10:40:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=780 +; + +-- Mar 28, 2013 10:40:57 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_DATE('2013-03-28 10:40:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53140 +; + +update ad_column set ad_val_rule_id=129 where ad_element_id=102 and ad_val_rule_id is null and ad_reference_id=19 +; + +update ad_field set isreadonly='Y' where ad_column_id in (select ad_column_id from ad_column where ad_element_id=102) +; + +-- show again client on grid for system+client or all windows +update ad_field set isdisplayedgrid='Y' +where ad_column_id in (select ad_column_id from ad_column where ad_element_id=102) /* ad_client_id */ +and ad_field_id < 1000000 +and ad_column_id in (select c.ad_column_id from ad_column c join ad_table t on t.ad_table_id=c.ad_table_id where t.accesslevel in ('6','7')) +; + +SELECT register_migration_script('201303281029_IDEMPIERE-808.sql') FROM dual +; + diff --git a/migration/i1.0a-release/postgresql/201303281029_IDEMPIERE-808.sql b/migration/i1.0a-release/postgresql/201303281029_IDEMPIERE-808.sql new file mode 100644 index 0000000000..d7d3defb38 --- /dev/null +++ b/migration/i1.0a-release/postgresql/201303281029_IDEMPIERE-808.sql @@ -0,0 +1,116 @@ +-- Mar 28, 2013 9:56:36 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10, IsInsertRecord='N',Updated=TO_TIMESTAMP('2013-03-28 09:56:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53146 +; + +-- Mar 28, 2013 9:56:53 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=20,Updated=TO_TIMESTAMP('2013-03-28 09:56:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53147 +; + +-- Mar 28, 2013 9:58:20 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_TIMESTAMP('2013-03-28 09:58:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53139 +; + +-- Mar 28, 2013 9:58:53 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_TIMESTAMP('2013-03-28 09:58:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53138 +; + +-- Mar 28, 2013 10:33:30 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10, IsInsertRecord='N',Updated=TO_DATE('2013-03-28 10:33:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53143 +; + +-- Mar 28, 2013 10:33:39 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=20, IsInsertRecord='N',Updated=TO_DATE('2013-03-28 10:33:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53144 +; + +-- Mar 28, 2013 10:33:44 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=30, IsInsertRecord='N',Updated=TO_DATE('2013-03-28 10:33:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53145 +; + +-- Mar 28, 2013 10:33:49 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=40,Updated=TO_DATE('2013-03-28 10:33:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53142 +; + +-- Mar 28, 2013 10:35:45 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10, IsInsertRecord='N',Updated=TO_DATE('2013-03-28 10:35:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53150 +; + +-- Mar 28, 2013 10:35:49 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=20, IsInsertRecord='N',Updated=TO_DATE('2013-03-28 10:35:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53148 +; + +-- Mar 28, 2013 10:35:54 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=30,Updated=TO_DATE('2013-03-28 10:35:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53149 +; + +-- Mar 28, 2013 10:36:59 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_DATE('2013-03-28 10:36:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53175 +; + +-- Mar 28, 2013 10:37:15 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_DATE('2013-03-28 10:37:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53174 +; + +-- Mar 28, 2013 10:37:27 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_DATE('2013-03-28 10:37:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53171 +; + +-- Mar 28, 2013 10:40:15 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_DATE('2013-03-28 10:40:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53152 +; + +-- Mar 28, 2013 10:40:24 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_DATE('2013-03-28 10:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53170 +; + +-- Mar 28, 2013 10:40:32 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_DATE('2013-03-28 10:40:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53141 +; + +-- Mar 28, 2013 10:40:43 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_DATE('2013-03-28 10:40:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=367 +; + +-- Mar 28, 2013 10:40:48 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=20,Updated=TO_DATE('2013-03-28 10:40:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=780 +; + +-- Mar 28, 2013 10:40:57 AM COT +-- IDEMPIERE-808 new record allows user to select System Client +UPDATE AD_Tab SET SeqNo=10,Updated=TO_DATE('2013-03-28 10:40:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53140 +; + +update ad_column set ad_val_rule_id=129 where ad_element_id=102 and ad_val_rule_id is null and ad_reference_id=19 +; + +update ad_field set isreadonly='Y' where ad_column_id in (select ad_column_id from ad_column where ad_element_id=102) +; + +-- show again client on grid for system+client or all windows +update ad_field set isdisplayedgrid='Y' +where ad_column_id in (select ad_column_id from ad_column where ad_element_id=102) /* ad_client_id */ +and ad_field_id < 1000000 +and ad_column_id in (select c.ad_column_id from ad_column c join ad_table t on t.ad_table_id=c.ad_table_id where t.accesslevel in ('6','7')) +; + +SELECT register_migration_script('201303281029_IDEMPIERE-808.sql') FROM dual +; +