From 24d17a44d70ff67cf7e90ff966b709fc303649de Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 14 Jan 2015 10:08:01 -0500 Subject: [PATCH] Backed out changeset 3e83b907df0f --- .../oracle/201411091604_IDEMPIERE-2152.sql | 48 ------ .../201411091604_IDEMPIERE-2152.sql | 45 ------ .../src/org/adempiere/model/IInfoColumn.java | 38 ----- .../src/org/adempiere/model/MInfoProcess.java | 22 +-- .../src/org/adempiere/model/MInfoRelated.java | 22 +-- .../org/compiere/model/I_AD_InfoRelated.java | 15 -- .../org/compiere/model/X_AD_InfoRelated.java | 30 +--- .../src/org/compiere/util/DB.java | 12 +- .../src/test/functional/QueryTest.java | 18 +-- .../org/adempiere/webui/info/InfoWindow.java | 120 +++++--------- .../org/adempiere/webui/panel/InfoPanel.java | 146 ++++++------------ .../org/compiere/minigrid/EmbedWinInfo.java | 16 +- 12 files changed, 106 insertions(+), 426 deletions(-) delete mode 100644 migration/i2.1z/oracle/201411091604_IDEMPIERE-2152.sql delete mode 100644 migration/i2.1z/postgresql/201411091604_IDEMPIERE-2152.sql delete mode 100644 org.adempiere.base/src/org/adempiere/model/IInfoColumn.java diff --git a/migration/i2.1z/oracle/201411091604_IDEMPIERE-2152.sql b/migration/i2.1z/oracle/201411091604_IDEMPIERE-2152.sql deleted file mode 100644 index e6855ddfe6..0000000000 --- a/migration/i2.1z/oracle/201411091604_IDEMPIERE-2152.sql +++ /dev/null @@ -1,48 +0,0 @@ -SET SQLBLANKLINES ON -SET DEFINE OFF - --- Sep 11, 2014 9:56:05 AM ICT --- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator -INSERT INTO AD_Element (ColumnName,AD_Element_ID,Help,Name,Description,PrintName,AD_Element_UU,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,EntityType,Created,Updated) VALUES ('ParentRelatedColumn_ID',202792,'default column RelatedColumn in Relate Info window will link with key column of main info window -column define in ParentRelatedColumn will replace key column','Parent Related Column','column in parent info window, link with column in this relate info','Parent Related Column','d35a2b4b-6022-4b52-bace-93f05958a77a',0,100,100,'Y',0,'D',TO_DATE('2014-09-11 09:55:54','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2014-09-11 09:55:54','YYYY-MM-DD HH24:MI:SS')) -; - --- Sep 11, 2014 9:57:38 AM ICT -INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,AD_Element_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,AD_Val_Rule_ID) VALUES (0,'N',0,211765,'N','N','N',0,'N',10,'N','N','N','Y','e03bf0ab-df24-4a01-80b8-92e61d11188c','Y','ParentRelatedColumn_ID','column in parent info window, link with column in this relate info','default column RelatedColumn in Relate Info window will link with key column of main info window -column define in ParentRelatedColumn will replace key column','Parent Related Column','Y',TO_DATE('2014-09-11 09:57:33','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_DATE('2014-09-11 09:57:33','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N',202792,18,200072,200089,200065) -; - --- Sep 11, 2014 9:58:27 AM ICT -UPDATE AD_Column SET FKConstraintName='ParentRelatedColumn_ADInfoRela', FKConstraintType='N',Updated=TO_DATE('2014-09-11 09:58:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211765 -; - --- Sep 11, 2014 9:58:27 AM ICT -ALTER TABLE AD_InfoRelated ADD ParentRelatedColumn_ID NUMBER(10) DEFAULT NULL -; - --- Sep 11, 2014 9:58:28 AM ICT -ALTER TABLE AD_InfoRelated ADD CONSTRAINT ParentRelatedColumn_ADInfoRela FOREIGN KEY (ParentRelatedColumn_ID) REFERENCES ad_infocolumn(ad_infocolumn_id) DEFERRABLE INITIALLY DEFERRED -; - --- Sep 11, 2014 10:00:39 AM ICT -INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,AD_Column_ID,EntityType,Created) VALUES (0,'N',200100,0,'N','N',110,'Y',203446,'N','default column RelatedColumn in Relate Info window will link with key column of main info window -column define in ParentRelatedColumn will replace key column','column in parent info window, link with column in this relate info','Parent Related Column','59dd442c-8596-4be5-b689-cd437ac62edf','Y','N',100,0,100,TO_DATE('2014-09-11 10:00:30','YYYY-MM-DD HH24:MI:SS'),'Y','Y',80,1,'N',0,1,1,'N','N',211765,'D',TO_DATE('2014-09-11 10:00:30','YYYY-MM-DD HH24:MI:SS')) -; - --- Sep 11, 2014 10:00:59 AM ICT -UPDATE AD_Field SET Name='Parent Link Column',Updated=TO_DATE('2014-09-11 10:00:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203446 -; - --- Sep 11, 2014 10:01:23 AM ICT -UPDATE AD_Field SET SeqNo=100, IsDisplayed='Y', XPosition=1, ColumnSpan=2,Updated=TO_DATE('2014-09-11 10:01:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203446 -; - --- Sep 11, 2014 10:01:23 AM ICT -UPDATE AD_Field SET SeqNo=110, IsDisplayed='Y', XPosition=4,Updated=TO_DATE('2014-09-11 10:01:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202268 -; - --- Sep 11, 2014 10:01:23 AM ICT -UPDATE AD_Field SET SeqNo=0,Updated=TO_DATE('2014-09-11 10:01:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202269 -; -SELECT register_migration_script('201411091604_IDEMPIERE-2152.sql') FROM dual -; diff --git a/migration/i2.1z/postgresql/201411091604_IDEMPIERE-2152.sql b/migration/i2.1z/postgresql/201411091604_IDEMPIERE-2152.sql deleted file mode 100644 index 070bb20cbf..0000000000 --- a/migration/i2.1z/postgresql/201411091604_IDEMPIERE-2152.sql +++ /dev/null @@ -1,45 +0,0 @@ --- Sep 11, 2014 9:56:05 AM ICT --- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator -INSERT INTO AD_Element (ColumnName,AD_Element_ID,Help,Name,Description,PrintName,AD_Element_UU,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,EntityType,Created,Updated) VALUES ('ParentRelatedColumn_ID',202792,'default column RelatedColumn in Relate Info window will link with key column of main info window -column define in ParentRelatedColumn will replace key column','Parent Related Column','column in parent info window, link with column in this relate info','Parent Related Column','d35a2b4b-6022-4b52-bace-93f05958a77a',0,100,100,'Y',0,'D',TO_TIMESTAMP('2014-09-11 09:55:54','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2014-09-11 09:55:54','YYYY-MM-DD HH24:MI:SS')) -; - --- Sep 11, 2014 9:57:38 AM ICT -INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,AD_Element_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,AD_Val_Rule_ID) VALUES (0,'N',0,211765,'N','N','N',0,'N',10,'N','N','N','Y','e03bf0ab-df24-4a01-80b8-92e61d11188c','Y','ParentRelatedColumn_ID','column in parent info window, link with column in this relate info','default column RelatedColumn in Relate Info window will link with key column of main info window -column define in ParentRelatedColumn will replace key column','Parent Related Column','Y',TO_TIMESTAMP('2014-09-11 09:57:33','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_TIMESTAMP('2014-09-11 09:57:33','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N',202792,18,200072,200089,200065) -; - --- Sep 11, 2014 9:58:27 AM ICT -UPDATE AD_Column SET FKConstraintName='ParentRelatedColumn_ADInfoRela', FKConstraintType='N',Updated=TO_TIMESTAMP('2014-09-11 09:58:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211765 -; - --- Sep 11, 2014 9:58:27 AM ICT -ALTER TABLE AD_InfoRelated ADD COLUMN ParentRelatedColumn_ID NUMERIC(10) DEFAULT NULL -; - --- Sep 11, 2014 9:58:28 AM ICT -ALTER TABLE AD_InfoRelated ADD CONSTRAINT ParentRelatedColumn_ADInfoRela FOREIGN KEY (ParentRelatedColumn_ID) REFERENCES ad_infocolumn(ad_infocolumn_id) DEFERRABLE INITIALLY DEFERRED -; - --- Sep 11, 2014 10:00:39 AM ICT -INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,AD_Column_ID,EntityType,Created) VALUES (0,'N',200100,0,'N','N',110,'Y',203446,'N','default column RelatedColumn in Relate Info window will link with key column of main info window -column define in ParentRelatedColumn will replace key column','column in parent info window, link with column in this relate info','Parent Related Column','59dd442c-8596-4be5-b689-cd437ac62edf','Y','N',100,0,100,TO_TIMESTAMP('2014-09-11 10:00:30','YYYY-MM-DD HH24:MI:SS'),'Y','Y',80,1,'N',0,1,1,'N','N',211765,'D',TO_TIMESTAMP('2014-09-11 10:00:30','YYYY-MM-DD HH24:MI:SS')) -; - --- Sep 11, 2014 10:00:59 AM ICT -UPDATE AD_Field SET Name='Parent Link Column',Updated=TO_TIMESTAMP('2014-09-11 10:00:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203446 -; - --- Sep 11, 2014 10:01:23 AM ICT -UPDATE AD_Field SET SeqNo=100, IsDisplayed='Y', XPosition=1, ColumnSpan=2,Updated=TO_TIMESTAMP('2014-09-11 10:01:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203446 -; - --- Sep 11, 2014 10:01:23 AM ICT -UPDATE AD_Field SET SeqNo=110, IsDisplayed='Y', XPosition=4,Updated=TO_TIMESTAMP('2014-09-11 10:01:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202268 -; - --- Sep 11, 2014 10:01:23 AM ICT -UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2014-09-11 10:01:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202269 -; -SELECT register_migration_script('201411091604_IDEMPIERE-2152.sql') FROM dual -; diff --git a/org.adempiere.base/src/org/adempiere/model/IInfoColumn.java b/org.adempiere.base/src/org/adempiere/model/IInfoColumn.java deleted file mode 100644 index 0b7ec86298..0000000000 --- a/org.adempiere.base/src/org/adempiere/model/IInfoColumn.java +++ /dev/null @@ -1,38 +0,0 @@ -/****************************************************************************** - * Copyright (C) 2014 iDempiere * - * Product: iDempiere ERP & CRM Smart Business Solution * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - *****************************************************************************/ - -package org.adempiere.model; - -import org.compiere.model.MInfoColumn; - -/** - * - * @author hieplq - * implement to provide InfoColumn - * example MInfoProcess, MInfoRelate - * - */ -public interface IInfoColumn { - /** - * Id of MInfoColumn - * @return - */ - public int getInfoColumnID (); - - /** - * Object MInfoColumn - * @return - */ - public MInfoColumn getAD_InfoColumn (); -} diff --git a/org.adempiere.base/src/org/adempiere/model/MInfoProcess.java b/org.adempiere.base/src/org/adempiere/model/MInfoProcess.java index 5b15a5fc18..8e6de42a8b 100644 --- a/org.adempiere.base/src/org/adempiere/model/MInfoProcess.java +++ b/org.adempiere.base/src/org/adempiere/model/MInfoProcess.java @@ -17,7 +17,6 @@ import java.sql.ResultSet; import java.util.Properties; import java.util.logging.Level; -import org.compiere.model.MInfoColumn; import org.compiere.model.MProcess; import org.compiere.model.X_AD_InfoProcess; import org.compiere.util.Env; @@ -30,12 +29,11 @@ import org.compiere.util.Evaluator; * @author hieplq * */ -public class MInfoProcess extends X_AD_InfoProcess implements IInfoColumn { - +public class MInfoProcess extends X_AD_InfoProcess { /** * */ - private static final long serialVersionUID = 6603281032935632048L; + private static final long serialVersionUID = 2478699719088685214L; /** * {@inheritDoc} @@ -90,21 +88,5 @@ public class MInfoProcess extends X_AD_InfoProcess implements IInfoColumn { + " (" + getDisplayLogic() + ") => " + retValue); return retValue; } - - /** - * just forward call to {@link #getAD_InfoColumn_ID()} - */ - @Override - public int getInfoColumnID() { - return getAD_InfoColumn_ID(); - } - - /** - * Just forward call to {@link #getAD_InfoColumn ()} - */ - @Override - public MInfoColumn getAD_InfoColumn (){ - return (MInfoColumn)super.getAD_InfoColumn(); - } } diff --git a/org.adempiere.base/src/org/adempiere/model/MInfoRelated.java b/org.adempiere.base/src/org/adempiere/model/MInfoRelated.java index ec090d532b..0144038ada 100644 --- a/org.adempiere.base/src/org/adempiere/model/MInfoRelated.java +++ b/org.adempiere.base/src/org/adempiere/model/MInfoRelated.java @@ -17,16 +17,16 @@ import java.sql.ResultSet; import java.util.Properties; import java.util.logging.Level; +import org.compiere.model.I_AD_InfoRelated; import org.compiere.model.MInfoColumn; import org.compiere.model.Query; import org.compiere.model.X_AD_InfoRelated; -public class MInfoRelated extends X_AD_InfoRelated implements IInfoColumn { - +public class MInfoRelated extends X_AD_InfoRelated implements I_AD_InfoRelated { /** * */ - private static final long serialVersionUID = -4239930986439783006L; + private static final long serialVersionUID = 7899684001732574833L; public MInfoRelated(Properties ctx, int AD_InfoRelated_ID, String trxName) { super(ctx, AD_InfoRelated_ID, trxName); @@ -54,20 +54,4 @@ public class MInfoRelated extends X_AD_InfoRelated implements IInfoColumn { return ""; } - /** - * Just forward call to {@link #getParentRelatedColumn_ID()} - */ - @Override - public int getInfoColumnID() { - return getParentRelatedColumn_ID(); - } - - /** - * Just forward call to {@link #getParentRelatedColumn()} - */ - @Override - public MInfoColumn getAD_InfoColumn (){ - return (MInfoColumn) getParentRelatedColumn(); - } - } diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_InfoRelated.java b/org.adempiere.base/src/org/compiere/model/I_AD_InfoRelated.java index c9f6df20df..2490328ea4 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_InfoRelated.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_InfoRelated.java @@ -163,21 +163,6 @@ public interface I_AD_InfoRelated */ public String getName(); - /** Column name ParentRelatedColumn_ID */ - public static final String COLUMNNAME_ParentRelatedColumn_ID = "ParentRelatedColumn_ID"; - - /** Set Parent Related Column. - * column in parent info window, link with column in this relate info - */ - public void setParentRelatedColumn_ID (int ParentRelatedColumn_ID); - - /** Get Parent Related Column. - * column in parent info window, link with column in this relate info - */ - public int getParentRelatedColumn_ID(); - - public org.compiere.model.I_AD_InfoColumn getParentRelatedColumn() throws RuntimeException; - /** Column name RelatedColumn_ID */ public static final String COLUMNNAME_RelatedColumn_ID = "RelatedColumn_ID"; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_InfoRelated.java b/org.adempiere.base/src/org/compiere/model/X_AD_InfoRelated.java index a51ba6328a..62dd89c8a0 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_InfoRelated.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_InfoRelated.java @@ -30,7 +30,7 @@ public class X_AD_InfoRelated extends PO implements I_AD_InfoRelated, I_Persiste /** * */ - private static final long serialVersionUID = 20141112L; + private static final long serialVersionUID = 20141030L; /** Standard Constructor */ public X_AD_InfoRelated (Properties ctx, int AD_InfoRelated_ID, String trxName) @@ -198,34 +198,6 @@ public class X_AD_InfoRelated extends PO implements I_AD_InfoRelated, I_Persiste return new KeyNamePair(get_ID(), getName()); } - public org.compiere.model.I_AD_InfoColumn getParentRelatedColumn() throws RuntimeException - { - return (org.compiere.model.I_AD_InfoColumn)MTable.get(getCtx(), org.compiere.model.I_AD_InfoColumn.Table_Name) - .getPO(getParentRelatedColumn_ID(), get_TrxName()); } - - /** Set Parent Related Column. - @param ParentRelatedColumn_ID - column in parent info window, link with column in this relate info - */ - public void setParentRelatedColumn_ID (int ParentRelatedColumn_ID) - { - if (ParentRelatedColumn_ID < 1) - set_Value (COLUMNNAME_ParentRelatedColumn_ID, null); - else - set_Value (COLUMNNAME_ParentRelatedColumn_ID, Integer.valueOf(ParentRelatedColumn_ID)); - } - - /** Get Parent Related Column. - @return column in parent info window, link with column in this relate info - */ - public int getParentRelatedColumn_ID () - { - Integer ii = (Integer)get_Value(COLUMNNAME_ParentRelatedColumn_ID); - if (ii == null) - return 0; - return ii.intValue(); - } - public org.compiere.model.I_AD_InfoColumn getRelatedColumn() throws RuntimeException { return (org.compiere.model.I_AD_InfoColumn)MTable.get(getCtx(), org.compiere.model.I_AD_InfoColumn.Table_Name) diff --git a/org.adempiere.base/src/org/compiere/util/DB.java b/org.adempiere.base/src/org/compiere/util/DB.java index 10d3ead180..5ea1e72ae8 100644 --- a/org.adempiere.base/src/org/compiere/util/DB.java +++ b/org.adempiere.base/src/org/compiere/util/DB.java @@ -34,6 +34,7 @@ import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Map; import java.util.Properties; import java.util.logging.Level; @@ -2335,14 +2336,13 @@ public final class DB * @param selection * @param trxName */ - public static void createT_SelectionNew (int AD_PInstance_ID, Collection saveKeys, String trxName) + public static void createT_Selection(int AD_PInstance_ID, Map> saveKeys, int viewIDIndex, String trxName) { StringBuilder insert = new StringBuilder(); insert.append("INSERT INTO T_SELECTION(AD_PINSTANCE_ID, T_SELECTION_ID, ViewID) "); int counter = 0; - for(KeyNamePair saveKey : saveKeys) + for(Integer selectedId : saveKeys.keySet()) { - Integer selectedId = saveKey.getKey(); counter++; if (counter > 1) insert.append(" UNION "); @@ -2352,13 +2352,13 @@ public final class DB insert.append(selectedId); insert.append(", "); - String viewIDValue = saveKey.getName(); + List viewIDValues = saveKeys.get(selectedId); // when no process have viewID or this process have no viewID or value of viewID is null - if (viewIDValue == null){ + if (viewIDValues == null || viewIDIndex < 0 || viewIDValues.get(viewIDIndex) == null){ insert.append("NULL"); }else{ insert.append("'"); - insert.append(viewIDValue); + insert.append(viewIDValues.get(viewIDIndex)); insert.append("'"); } diff --git a/org.adempiere.extend/src/test/functional/QueryTest.java b/org.adempiere.extend/src/test/functional/QueryTest.java index ad8b161bc1..1be6f76fcf 100644 --- a/org.adempiere.extend/src/test/functional/QueryTest.java +++ b/org.adempiere.extend/src/test/functional/QueryTest.java @@ -14,8 +14,6 @@ package test.functional; import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -28,7 +26,6 @@ import org.compiere.model.Query; import org.compiere.model.X_AD_Element; import org.compiere.util.DB; import org.compiere.util.Env; -import org.compiere.util.KeyNamePair; import test.AdempiereTestCase; @@ -290,11 +287,11 @@ public class QueryTest extends AdempiereTestCase assertTrue(AD_PInstance_ID > 0); // Create selection list - List elements = new ArrayList (); - elements.add(new KeyNamePair(102, null)); // AD_Element_ID=102 => AD_Client_ID - elements.add(new KeyNamePair(104, null)); // AD_Element_ID=104 => AD_Column_ID + Map> elements = new HashMap> (); + elements.put(102, null); // AD_Element_ID=102 => AD_Client_ID + elements.put(104, null); // AD_Element_ID=104 => AD_Column_ID DB.executeUpdateEx("DELETE FROM T_Selection WHERE AD_PInstance_ID="+AD_PInstance_ID, getTrxName()); - DB.createT_SelectionNew (AD_PInstance_ID, elements, getTrxName()); + DB.createT_Selection(AD_PInstance_ID, elements, 0, getTrxName()); String whereClause = "1=1"; // some dummy where clause int[] ids = new Query(getCtx(), X_AD_Element.Table_Name, whereClause, getTrxName()) @@ -303,9 +300,12 @@ public class QueryTest extends AdempiereTestCase .getIDs(); assertEquals("Resulting number of elements differ", elements.size(), ids.length); - for (int i = 0; i < elements.size(); i++) + Integer[] keys = new Integer[elements.keySet().size()]; + keys = elements.keySet().toArray(keys); + + for (int i = 0; i < keys .length; i++) { - int expected = elements.get(i).getKey(); + int expected = keys[i]; assertEquals("Element "+i+" not equals", expected, ids[i]); } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java index ceb791e01b..4ae7e562d6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java @@ -14,7 +14,6 @@ import java.util.Properties; import java.util.TreeMap; import java.util.logging.Level; -import org.adempiere.model.IInfoColumn; import org.adempiere.model.MInfoProcess; import org.adempiere.model.MInfoRelated; import org.adempiere.webui.AdempiereWebUI; @@ -97,7 +96,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL /** * */ - private static final long serialVersionUID = 2751982942639167289L; + private static final long serialVersionUID = -2192106603768665006L; protected Grid parameterGrid; private Borderlayout layout; @@ -160,11 +159,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL int row = contentPanel.getSelectedRow(); if (row >= 0) { for (EmbedWinInfo embed : embeddedWinList) { - int indexData = 0; - if (columnDataIndex.containsKey(embed.getParentLinkColumnID())){ - indexData = p_layout.length + columnDataIndex.get(embed.getParentLinkColumnID()); - } - refresh(contentPanel.getValueAt(row,indexData),embed); + refresh(contentPanel.getValueAt(row,0),embed); }// refresh for all } } @@ -524,7 +519,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL return false; // topinfoColumns = infoWindow.getInfoColumns(); - relatedInfoList = infoWindow.getInfoRelated(true); + MInfoRelated[] relatedInfoList = infoWindow.getInfoRelated(true); Tabpanels tabPanels = new Tabpanels(); Tabs tabs = new Tabs(); @@ -578,9 +573,8 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL embeddedTbl.getModel().addTableModelListener(this); embeddedTbl.setVflex("1"); - //Xolali - add embeddedTbl to list, add m_sqlembedded to list - EmbedWinInfo ewinInfo = new EmbedWinInfo(embedInfo,embeddedTbl,m_sqlEmbedded,relatedInfo.getLinkColumnName(), relatedInfo.getLinkInfoColumn(), relatedInfo.getParentRelatedColumn_ID()); + EmbedWinInfo ewinInfo = new EmbedWinInfo(embedInfo,embeddedTbl,m_sqlEmbedded,relatedInfo.getLinkColumnName(), relatedInfo.getLinkInfoColumn()); embeddedWinList.add(ewinInfo); MInfoWindow riw = (MInfoWindow) relatedInfo.getRelatedInfo(); @@ -900,7 +894,6 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL addViewIDToQuery(); - if (m_sqlMain.length() > 0 && infoWindow.isDistinct()) { m_sqlMain = m_sqlMain.substring("SELECT ".length()); m_sqlMain = "SELECT DISTINCT " + m_sqlMain; @@ -921,58 +914,46 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL * if main query have subquery in SELECT, it will beak or incorrect */ protected void addViewIDToQuery () { - m_sqlMain = addMoreColumnToQuery (m_sqlMain, infoProcessList); - } - - - /** - * because data of infoColumn have isDisplay = false not load, - * just display column is load to show in List. - * Some function receive data from hidden column as viewID in infoProcess - * or parentLink of infoRelateWindow. - * - * this function just add column name of hidden infoWindow to end of query - * @param sqlMain main sql to append column - * @param listInfoColumn list of PO contain infoColumnID, this infoColumnID will add to query - * @return sql after append column - */ - protected String addMoreColumnToQuery (String sqlMain, IInfoColumn [] listInfoColumn) { - if (sqlMain == null || sqlMain.length() == 0 || listInfoColumn == null || listInfoColumn.length == 0){ - return sqlMain; - } - - int fromIndex = sqlMain.indexOf("FROM"); - // split Select and from clause - String selectClause = sqlMain.substring(0, fromIndex); - String fromClause = sqlMain.substring(fromIndex); - // get alias of main table - StringBuilder sqlBuilder = new StringBuilder(selectClause); - StringBuilder sqlColumn = new StringBuilder(); - - // add View_ID column to select clause - for (IInfoColumn infoProcess : listInfoColumn) { - // this process hasn't viewID column, next other infoProcess - if (infoProcess.getInfoColumnID() <= 0) - continue; - - MInfoColumn infocol = (MInfoColumn) infoProcess.getAD_InfoColumn(); + if (m_sqlMain.length() > 0 && infoProcessList != null && infoProcessList.length > 0){ + int fromIndex = m_sqlMain.indexOf("FROM"); + // split Select and from clause + String selectClause = m_sqlMain.substring(0, fromIndex); + String fromClause = m_sqlMain.substring(fromIndex); - if (! infocol.isDisplayed()) { - sqlColumn.append(", ").append(infocol.getSelectClause()).append(" AS ").append(infocol.getColumnName()).append(" "); - // add column to SELECT clause of main sql, if query is include this viewID column, not need add - if (!sqlBuilder.toString().contains(sqlColumn)){ - sqlBuilder.append(sqlColumn); + // get alias of main table + StringBuilder sqlBuilder = new StringBuilder(selectClause); + + // reset flag relate viewID to recount + numOfViewID = 0; + isHasViewID = false; + + // add View_ID column to select clause + for (MInfoProcess infoProcess : infoProcessList) { + // this process hasn't viewID column, next other infoProcess + if (infoProcess.getAD_InfoColumn_ID() <= 0) + continue; + + MInfoColumn infocol = (MInfoColumn) infoProcess.getAD_InfoColumn(); + // maintain varial relate to ViewID, it can init just one time when load infoWindow define + // but let it here for simple logic control + numOfViewID++; + isHasViewID = true; + + if (! infocol.isDisplayed()) { + // add column to SELECT clause of main sql + sqlBuilder.append(", "); + sqlBuilder.append (infocol.getSelectClause()); + sqlBuilder.append(" AS "); + sqlBuilder.append (infocol.getColumnName()); + sqlBuilder.append(" "); } - - sqlColumn.delete(0, sqlColumn.length()); } + + sqlBuilder.append(fromClause); + // update main sql + m_sqlMain = sqlBuilder.toString(); } - - sqlBuilder.append(fromClause); - // update main sql - return sqlBuilder.toString(); - } protected void renderWindow() @@ -1665,32 +1646,13 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL sql.append(relatedInfo.getInfoSql()); // delete get sql method from MInfoWindow if (log.isLoggable(Level.FINEST)) log.finest(sql.toString()); - - Object linkPara = null; - if (obj != null && obj instanceof IDColumn){ - IDColumn ID = (IDColumn) obj; - linkPara = ID.getRecord_ID(); - }else if (obj != null){ - linkPara = obj.toString(); - }else { - //TODO:hard case - } - + IDColumn ID = (IDColumn) obj; PreparedStatement pstmt = null; ResultSet rs = null; try { pstmt = DB.prepareStatement(relatedInfo.getInfoSql(), null); - //TODO: implicit type conversion. will exception in some case must recheck - if (relatedInfo.getTypeDataOfLink().equals(String.class)){ - pstmt.setString(1, (String)linkPara); - }else if (relatedInfo.getTypeDataOfLink().equals(int.class)){ - pstmt.setInt(1, Integer.parseInt(linkPara.toString())); - - }else{ - pstmt.setObject(1, linkPara); - } - + pstmt.setObject(1, ID.getRecord_ID()); rs = pstmt.executeQuery(); loadEmbedded(rs, relatedInfo); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java index 87e06f55a5..efb63230ab 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java @@ -33,9 +33,7 @@ import java.util.Map; import java.util.Vector; import java.util.logging.Level; -import org.adempiere.model.IInfoColumn; import org.adempiere.model.MInfoProcess; -import org.adempiere.model.MInfoRelated; import org.adempiere.webui.AdempiereWebUI; import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.apps.AEnv; @@ -113,12 +111,11 @@ import org.zkoss.zul.ext.Sortable; */ public abstract class InfoPanel extends Window implements EventListener, WTableModelListener, Sortable, IHelpContext { - /** * */ - private static final long serialVersionUID = 6617464791677971237L; - + private static final long serialVersionUID = 6027970576265023451L; + private final static int DEFAULT_PAGE_SIZE = 100; protected List