IDEMPIERE-5060 iDempiere dictionary view doesn't support UNION ALL (#1009)

This commit is contained in:
Carlos Ruiz 2021-11-29 03:22:30 +01:00 committed by GitHub
parent 2b79a1a874
commit 143ef24a58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 175 additions and 1 deletions

View File

@ -0,0 +1,67 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-5060 iDempiere dictionary view doesn't support UNION ALL
-- Nov 28, 2021, 1:34:11 PM CET
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203549,0,0,'Y',TO_DATE('2021-11-28 13:33:31','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-11-28 13:33:31','YYYY-MM-DD HH24:MI:SS'),100,'IsUnionAll','Is UNION ALL','The component view is UNION ALL','When this is set the component view is joined to the others using UNION ALL, otherwise just UNION','Is UNION ALL','D','ab8f8c93-aa6e-4f1a-85e2-79a05d07a811')
;
-- Nov 28, 2021, 1:34:24 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,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,FKConstraintType,IsHtml) VALUES (214651,0,'Is UNION ALL','The component view is UNION ALL','When this is set the component view is joined to the others using UNION ALL, otherwise just UNION',200087,'IsUnionAll','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_DATE('2021-11-28 13:34:24','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-11-28 13:34:24','YYYY-MM-DD HH24:MI:SS'),100,203549,'Y','N','D','N','N','N','Y','f2332b5c-30ac-48c4-95df-6bc6e32743af','Y',0,'N','N','N','N')
;
-- Nov 28, 2021, 1:34:26 PM CET
ALTER TABLE AD_ViewComponent ADD IsUnionAll CHAR(1) DEFAULT 'N' CHECK (IsUnionAll IN ('Y','N')) NOT NULL
;
-- Nov 28, 2021, 1:34:47 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,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 (206814,'Is UNION ALL','The component view is UNION ALL','When this is set the component view is joined to the others using UNION ALL, otherwise just UNION',200098,214651,'Y',1,140,'N','N','N','N',0,0,'Y',TO_DATE('2021-11-28 13:34:47','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-11-28 13:34:47','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','abcfef41-97ad-45d4-911a-c05b893300d6','Y',120,2,2)
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=40, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_DATE('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202236
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET SeqNo=50, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202224
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET SeqNo=60, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202225
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET SeqNo=70, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202226
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=80, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202233
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_DATE('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206814
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202235
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202234
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202231
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202229
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202232
;
SELECT register_migration_script('202111281338_IDEMPIERE-5060.sql') FROM dual
;

View File

@ -0,0 +1,64 @@
-- IDEMPIERE-5060 iDempiere dictionary view doesn't support UNION ALL
-- Nov 28, 2021, 1:34:11 PM CET
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203549,0,0,'Y',TO_TIMESTAMP('2021-11-28 13:33:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-11-28 13:33:31','YYYY-MM-DD HH24:MI:SS'),100,'IsUnionAll','Is UNION ALL','The component view is UNION ALL','When this is set the component view is joined to the others using UNION ALL, otherwise just UNION','Is UNION ALL','D','ab8f8c93-aa6e-4f1a-85e2-79a05d07a811')
;
-- Nov 28, 2021, 1:34:24 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,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,FKConstraintType,IsHtml) VALUES (214651,0,'Is UNION ALL','The component view is UNION ALL','When this is set the component view is joined to the others using UNION ALL, otherwise just UNION',200087,'IsUnionAll','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2021-11-28 13:34:24','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-11-28 13:34:24','YYYY-MM-DD HH24:MI:SS'),100,203549,'Y','N','D','N','N','N','Y','f2332b5c-30ac-48c4-95df-6bc6e32743af','Y',0,'N','N','N','N')
;
-- Nov 28, 2021, 1:34:26 PM CET
ALTER TABLE AD_ViewComponent ADD COLUMN IsUnionAll CHAR(1) DEFAULT 'N' CHECK (IsUnionAll IN ('Y','N')) NOT NULL
;
-- Nov 28, 2021, 1:34:47 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,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 (206814,'Is UNION ALL','The component view is UNION ALL','When this is set the component view is joined to the others using UNION ALL, otherwise just UNION',200098,214651,'Y',1,140,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2021-11-28 13:34:47','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-11-28 13:34:47','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','abcfef41-97ad-45d4-911a-c05b893300d6','Y',120,2,2)
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=40, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202236
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET SeqNo=50, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202224
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET SeqNo=60, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202225
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET SeqNo=70, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202226
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=80, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202233
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206814
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202235
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202234
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202231
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202229
;
-- Nov 28, 2021, 1:36:14 PM CET
UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-11-28 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202232
;
SELECT register_migration_script('202111281338_IDEMPIERE-5060.sql') FROM dual
;

View File

@ -178,6 +178,19 @@ public interface I_AD_ViewComponent
*/ */
public boolean isActive(); public boolean isActive();
/** Column name IsUnionAll */
public static final String COLUMNNAME_IsUnionAll = "IsUnionAll";
/** Set Is UNION ALL.
* The component view is UNION ALL
*/
public void setIsUnionAll (boolean IsUnionAll);
/** Get Is UNION ALL.
* The component view is UNION ALL
*/
public boolean isUnionAll();
/** Column name Name */ /** Column name Name */
public static final String COLUMNNAME_Name = "Name"; public static final String COLUMNNAME_Name = "Name";

View File

@ -31,7 +31,7 @@ public class X_AD_ViewComponent extends PO implements I_AD_ViewComponent, I_Pers
/** /**
* *
*/ */
private static final long serialVersionUID = 20210917L; private static final long serialVersionUID = 20211128L;
/** Standard Constructor */ /** Standard Constructor */
public X_AD_ViewComponent (Properties ctx, int AD_ViewComponent_ID, String trxName) 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); setEntityType (null);
// @SQL=SELECT CASE WHEN '@P|AdempiereSys:N@'='Y' THEN 'D' ELSE get_sysconfig('DEFAULT_ENTITYTYPE','U',0,0) END FROM Dual // @SQL=SELECT CASE WHEN '@P|AdempiereSys:N@'='Y' THEN 'D' ELSE get_sysconfig('DEFAULT_ENTITYTYPE','U',0,0) END FROM Dual
setFromClause (null); setFromClause (null);
setIsUnionAll (false);
// N
setName (null); setName (null);
} */ } */
} }
@ -210,6 +212,30 @@ public class X_AD_ViewComponent extends PO implements I_AD_ViewComponent, I_Pers
return (String)get_Value(COLUMNNAME_Help); return (String)get_Value(COLUMNNAME_Help);
} }
/** Set Is UNION ALL.
@param IsUnionAll
The component view is UNION ALL
*/
public void setIsUnionAll (boolean IsUnionAll)
{
set_Value (COLUMNNAME_IsUnionAll, Boolean.valueOf(IsUnionAll));
}
/** Get Is UNION ALL.
@return The component view is UNION ALL
*/
public boolean isUnionAll ()
{
Object oo = get_Value(COLUMNNAME_IsUnionAll);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Name. /** Set Name.
@param Name @param Name
Alphanumeric identifier of the entity Alphanumeric identifier of the entity

View File

@ -99,7 +99,11 @@ public class DatabaseViewValidate extends SvrProcess {
{ {
MViewComponent vc = m_vcs[i]; MViewComponent vc = m_vcs[i];
if (i > 0) if (i > 0)
{
sb.append(" UNION "); sb.append(" UNION ");
if (vc.isUnionAll())
sb.append(" ALL ");
}
else else
{ {
vCols = vc.getColumns(true); vCols = vc.getColumns(true);