IDEMPIERE-5434 : Allow to define db view component with DISTINCT (#1505)
https://idempiere.atlassian.net/browse/IDEMPIERE-5434
This commit is contained in:
parent
011ac10a4f
commit
98c9dfc844
|
@ -0,0 +1,46 @@
|
|||
-- IDEMPIERE-5434
|
||||
SELECT register_migration_script('202209290713_IDEMPIERE-5434.sql') FROM dual;
|
||||
|
||||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Sep 29, 2022, 7:13:48 AM CEST
|
||||
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml,AD_InfoWindow_ID) VALUES (215407,0,'Distinct','Select Distinct',200087,'IsDistinct','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2022-09-29 07:13:47','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-09-29 07:13:47','YYYY-MM-DD HH24:MI:SS'),100,202186,'Y','N','D','N','N','N','Y','14b4fad8-0f5d-415e-8c55-e8d2490952ea','Y',0,'N','N','N',200000)
|
||||
;
|
||||
|
||||
-- Sep 29, 2022, 7:13:52 AM CEST
|
||||
ALTER TABLE AD_ViewComponent ADD IsDistinct CHAR(1) DEFAULT 'N' CHECK (IsDistinct IN ('Y','N')) NOT NULL
|
||||
;
|
||||
|
||||
-- Sep 29, 2022, 7:14:09 AM CEST
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (207286,'Distinct','Select Distinct',200098,215407,'Y',1,150,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-09-29 07:14:08','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-09-29 07:14:08','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','ba2ad5f7-84c3-4e71-b78b-186094505a91','Y',130,2,2)
|
||||
;
|
||||
|
||||
-- Sep 29, 2022, 7:14:26 AM CEST
|
||||
UPDATE AD_Field SET SeqNo=90, ColumnSpan=1,Updated=TO_TIMESTAMP('2022-09-29 07:14:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206814
|
||||
;
|
||||
|
||||
-- Sep 29, 2022, 7:14:26 AM CEST
|
||||
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, XPosition=6, ColumnSpan=1,Updated=TO_TIMESTAMP('2022-09-29 07:14:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207286
|
||||
;
|
||||
|
||||
-- Sep 29, 2022, 7:14:26 AM CEST
|
||||
UPDATE AD_Field SET SeqNo=110,Updated=TO_TIMESTAMP('2022-09-29 07:14:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202235
|
||||
;
|
||||
|
||||
-- Sep 29, 2022, 7:14:26 AM CEST
|
||||
UPDATE AD_Field SET SeqNo=120,Updated=TO_TIMESTAMP('2022-09-29 07:14:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202234
|
||||
;
|
||||
|
||||
-- Sep 29, 2022, 7:14:26 AM CEST
|
||||
UPDATE AD_Field SET SeqNo=130,Updated=TO_TIMESTAMP('2022-09-29 07:14:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202231
|
||||
;
|
||||
|
||||
-- Sep 29, 2022, 7:14:26 AM CEST
|
||||
UPDATE AD_Field SET SeqNo=140,Updated=TO_TIMESTAMP('2022-09-29 07:14:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202229
|
||||
;
|
||||
|
||||
-- Sep 29, 2022, 7:14:26 AM CEST
|
||||
UPDATE AD_Field SET SeqNo=150,Updated=TO_TIMESTAMP('2022-09-29 07:14:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202232
|
||||
;
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
-- IDEMPIERE-5434
|
||||
SELECT register_migration_script('202209290713_IDEMPIERE-5434.sql') FROM dual;
|
||||
|
||||
-- Sep 29, 2022, 7:13:48 AM CEST
|
||||
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml,AD_InfoWindow_ID) VALUES (215407,0,'Distinct','Select Distinct',200087,'IsDistinct','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2022-09-29 07:13:47','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-09-29 07:13:47','YYYY-MM-DD HH24:MI:SS'),100,202186,'Y','N','D','N','N','N','Y','14b4fad8-0f5d-415e-8c55-e8d2490952ea','Y',0,'N','N','N',200000)
|
||||
;
|
||||
|
||||
-- Sep 29, 2022, 7:13:52 AM CEST
|
||||
ALTER TABLE AD_ViewComponent ADD COLUMN IsDistinct CHAR(1) DEFAULT 'N' CHECK (IsDistinct IN ('Y','N')) NOT NULL
|
||||
;
|
||||
|
||||
-- Sep 29, 2022, 7:14:09 AM CEST
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (207286,'Distinct','Select Distinct',200098,215407,'Y',1,150,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-09-29 07:14:08','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-09-29 07:14:08','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','ba2ad5f7-84c3-4e71-b78b-186094505a91','Y',130,2,2)
|
||||
;
|
||||
|
||||
-- Sep 29, 2022, 7:14:26 AM CEST
|
||||
UPDATE AD_Field SET SeqNo=90, ColumnSpan=1,Updated=TO_TIMESTAMP('2022-09-29 07:14:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206814
|
||||
;
|
||||
|
||||
-- Sep 29, 2022, 7:14:26 AM CEST
|
||||
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, XPosition=6, ColumnSpan=1,Updated=TO_TIMESTAMP('2022-09-29 07:14:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207286
|
||||
;
|
||||
|
||||
-- Sep 29, 2022, 7:14:26 AM CEST
|
||||
UPDATE AD_Field SET SeqNo=110,Updated=TO_TIMESTAMP('2022-09-29 07:14:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202235
|
||||
;
|
||||
|
||||
-- Sep 29, 2022, 7:14:26 AM CEST
|
||||
UPDATE AD_Field SET SeqNo=120,Updated=TO_TIMESTAMP('2022-09-29 07:14:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202234
|
||||
;
|
||||
|
||||
-- Sep 29, 2022, 7:14:26 AM CEST
|
||||
UPDATE AD_Field SET SeqNo=130,Updated=TO_TIMESTAMP('2022-09-29 07:14:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202231
|
||||
;
|
||||
|
||||
-- Sep 29, 2022, 7:14:26 AM CEST
|
||||
UPDATE AD_Field SET SeqNo=140,Updated=TO_TIMESTAMP('2022-09-29 07:14:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202229
|
||||
;
|
||||
|
||||
-- Sep 29, 2022, 7:14:26 AM CEST
|
||||
UPDATE AD_Field SET SeqNo=150,Updated=TO_TIMESTAMP('2022-09-29 07:14:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202232
|
||||
;
|
||||
|
|
@ -22,7 +22,7 @@ import org.compiere.util.KeyNamePair;
|
|||
|
||||
/** Generated Interface for AD_ViewComponent
|
||||
* @author iDempiere (generated)
|
||||
* @version Release 9
|
||||
* @version Release 10
|
||||
*/
|
||||
public interface I_AD_ViewComponent
|
||||
{
|
||||
|
@ -178,6 +178,19 @@ public interface I_AD_ViewComponent
|
|||
*/
|
||||
public boolean isActive();
|
||||
|
||||
/** Column name IsDistinct */
|
||||
public static final String COLUMNNAME_IsDistinct = "IsDistinct";
|
||||
|
||||
/** Set Distinct.
|
||||
* Select Distinct
|
||||
*/
|
||||
public void setIsDistinct (boolean IsDistinct);
|
||||
|
||||
/** Get Distinct.
|
||||
* Select Distinct
|
||||
*/
|
||||
public boolean isDistinct();
|
||||
|
||||
/** Column name IsUnionAll */
|
||||
public static final String COLUMNNAME_IsUnionAll = "IsUnionAll";
|
||||
|
||||
|
|
|
@ -142,6 +142,9 @@ public class MViewComponent extends X_AD_ViewComponent implements ImmutablePOSup
|
|||
StringBuilder sb = new StringBuilder("SELECT ");
|
||||
//
|
||||
|
||||
if (isDistinct())
|
||||
sb.append("DISTINCT ");
|
||||
|
||||
for (int i = 0; i < vCols.length; i++)
|
||||
{
|
||||
String colName = vCols[i].getColumnName();
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.compiere.util.KeyNamePair;
|
|||
|
||||
/** Generated Model for AD_ViewComponent
|
||||
* @author iDempiere (generated)
|
||||
* @version Release 9 - $Id$ */
|
||||
* @version Release 10 - $Id$ */
|
||||
@org.adempiere.base.Model(table="AD_ViewComponent")
|
||||
public class X_AD_ViewComponent extends PO implements I_AD_ViewComponent, I_Persistent
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ public class X_AD_ViewComponent extends PO implements I_AD_ViewComponent, I_Pers
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20220116L;
|
||||
private static final long serialVersionUID = 20220929L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_AD_ViewComponent (Properties ctx, int AD_ViewComponent_ID, String trxName)
|
||||
|
@ -44,6 +44,8 @@ public class X_AD_ViewComponent extends PO implements I_AD_ViewComponent, I_Pers
|
|||
setEntityType (null);
|
||||
// @SQL=SELECT CASE WHEN '@P|AdempiereSys:N@'='Y' THEN 'D' ELSE get_sysconfig('DEFAULT_ENTITYTYPE','U',0,0) END FROM Dual
|
||||
setFromClause (null);
|
||||
setIsDistinct (false);
|
||||
// N
|
||||
setIsUnionAll (false);
|
||||
// N
|
||||
setName (null);
|
||||
|
@ -61,6 +63,8 @@ public class X_AD_ViewComponent extends PO implements I_AD_ViewComponent, I_Pers
|
|||
setEntityType (null);
|
||||
// @SQL=SELECT CASE WHEN '@P|AdempiereSys:N@'='Y' THEN 'D' ELSE get_sysconfig('DEFAULT_ENTITYTYPE','U',0,0) END FROM Dual
|
||||
setFromClause (null);
|
||||
setIsDistinct (false);
|
||||
// N
|
||||
setIsUnionAll (false);
|
||||
// N
|
||||
setName (null);
|
||||
|
@ -226,6 +230,29 @@ public class X_AD_ViewComponent extends PO implements I_AD_ViewComponent, I_Pers
|
|||
return (String)get_Value(COLUMNNAME_Help);
|
||||
}
|
||||
|
||||
/** Set Distinct.
|
||||
@param IsDistinct Select Distinct
|
||||
*/
|
||||
public void setIsDistinct (boolean IsDistinct)
|
||||
{
|
||||
set_Value (COLUMNNAME_IsDistinct, Boolean.valueOf(IsDistinct));
|
||||
}
|
||||
|
||||
/** Get Distinct.
|
||||
@return Select Distinct
|
||||
*/
|
||||
public boolean isDistinct()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_IsDistinct);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set Is UNION ALL.
|
||||
@param IsUnionAll The component view is UNION ALL
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue