diff --git a/migration/iD11/oracle/202302170238_IDEMPIERE-5567.sql b/migration/iD11/oracle/202302170238_IDEMPIERE-5567.sql new file mode 100644 index 0000000000..66e10d968b --- /dev/null +++ b/migration/iD11/oracle/202302170238_IDEMPIERE-5567.sql @@ -0,0 +1,18 @@ +-- IDEMPIERE-5567 Evaluate support of Long ID (FHCA-4195) +SELECT register_migration_script('202302170238_IDEMPIERE-5567.sql') FROM dual; + +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Feb 17, 2023, 2:38:33 AM CET +INSERT INTO AD_Reference (AD_Reference_ID,Name,Description,ValidationType,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,IsOrderByValue,AD_Reference_UU) VALUES (200231,'UUID','Universally unique identifier','D',0,0,'Y',TO_TIMESTAMP('2023-02-17 02:38:33','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-17 02:38:33','YYYY-MM-DD HH24:MI:SS'),100,'D','N','2dbf9d9e-3e83-4927-b737-c1124918402c') +; + +-- Mar 13, 2023, 8:42:24 PM CET +UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=13 | @IsKey@=Y',Updated=TO_TIMESTAMP('2023-03-13 20:42:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=161 +; + +-- Mar 17, 2023, 1:18:24 PM CET +UPDATE AD_Process_Para SET ReadOnlyLogic=NULL,Updated=TO_TIMESTAMP('2023-03-17 13:18:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200361 +; + diff --git a/migration/iD11/oracle/202303171334_IDEMPIERE-5567.sql b/migration/iD11/oracle/202303171334_IDEMPIERE-5567.sql new file mode 100644 index 0000000000..466c9c636d --- /dev/null +++ b/migration/iD11/oracle/202303171334_IDEMPIERE-5567.sql @@ -0,0 +1,250 @@ +-- IDEMPIERE-5567 Support of UUID as Key (FHCA-4195) +SELECT register_migration_script('202303171334_IDEMPIERE-5567.sql') FROM dual; + +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Mar 17, 2023, 1:34:39 PM CET +INSERT INTO AD_Table (AD_Table_ID,Name,TableName,AccessLevel,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSecurityEnabled,IsDeleteable,IsHighVolume,IsView,EntityType,IsChangeLog,ReplicationType,AD_Table_UU,Processing) VALUES (200383,'Test UU Based Table','TestUU','7',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:39','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:39','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','N','N','D','Y','L','9827c04e-633e-44c2-a17f-d9bd56874b75','N') +; + +-- Mar 17, 2023, 1:34:40 PM CET +INSERT INTO AD_Sequence (Name,CurrentNext,IsAudited,StartNewYear,Description,IsActive,IsTableID,AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,AD_Sequence_ID,IsAutoSequence,StartNo,IncrementNo,CurrentNextSys,AD_Sequence_UU) VALUES ('TestUU',1000000,'N','N','Table TestUU','Y','Y',0,0,TO_TIMESTAMP('2023-03-17 13:34:39','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:39','YYYY-MM-DD HH24:MI:SS'),100,200453,'Y',1000000,1,200000,'d9a6863f-41e8-4dcc-9af2-d37a98dd467f') +; + +-- Mar 17, 2023, 1:34:40 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,ReadOnlyLogic,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215778,0.0,'Tenant','Tenant for this installation.','A Tenant is a company or a legal entity. You cannot share data between Tenants.',200383,'AD_Client_ID','@#AD_Client_ID@',10,'N','N','Y','N','N','N',30,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:40','YYYY-MM-DD HH24:MI:SS'),100,102,'N','N','1=1','D','N','48c9c712-f123-4531-957d-ed983667e86a','N') +; + +-- Mar 17, 2023, 1:34:41 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215779,0.0,'Organization','Organizational entity within tenant','An organization is a unit of your tenant or legal entity - examples are store, department. You can share data between organizations.',200383,'AD_Org_ID','@AD_Org_ID@',10,'N','N','Y','N','N','N',19,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:40','YYYY-MM-DD HH24:MI:SS'),100,113,'N','N','D','N','0cc337db-20e1-4e7a-bb51-4bc50cf4c6d2','N') +; + +-- Mar 17, 2023, 1:34:41 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215780,0.0,'Created','Date this record was created','The Created field indicates the date that this record was created.',200383,'Created',7,'N','N','Y','N','N','N',16,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:41','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:41','YYYY-MM-DD HH24:MI:SS'),100,245,'N','N','D','N','7fd767de-9383-4733-b007-171c6011521e','N') +; + +-- Mar 17, 2023, 1:34:42 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215781,0.0,'Created By','User who created this records','The Created By field indicates the user who created this record.',200383,'CreatedBy',10,'N','N','Y','N','N','N',30,110,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:41','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:41','YYYY-MM-DD HH24:MI:SS'),100,246,'N','N','D','N','b26ee963-280a-438f-9bf2-8ad6e9333d1d','N') +; + +-- Mar 17, 2023, 1:34:42 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215782,0.0,'Updated','Date this record was updated','The Updated field indicates the date that this record was updated.',200383,'Updated',7,'N','N','Y','N','N','N',16,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:42','YYYY-MM-DD HH24:MI:SS'),100,607,'N','N','D','N','c94550c9-6d87-46f3-b32b-1be64d9434e7','N') +; + +-- Mar 17, 2023, 1:34:42 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215783,0.0,'Updated By','User who updated this records','The Updated By field indicates the user who updated this record.',200383,'UpdatedBy',10,'N','N','Y','N','N','N',30,110,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:42','YYYY-MM-DD HH24:MI:SS'),100,608,'N','N','D','N','7ad894c2-b246-47bf-8060-f7257e8c5ede','N') +; + +-- Mar 17, 2023, 1:34:43 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215784,0.0,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200383,'IsActive','Y',1,'N','N','Y','N','N','N',20,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:42','YYYY-MM-DD HH24:MI:SS'),100,348,'Y','N','D','N','56fdfbae-62af-4618-8442-81bf9c058081','N') +; + +-- Mar 17, 2023, 1:34:43 PM CET +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203793,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:43','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:43','YYYY-MM-DD HH24:MI:SS'),100,'TestUU_UU','TestUU_UU','TestUU_UU','D','b1f089f6-466f-4a40-89bf-0fbfa475301c') +; + +-- Mar 17, 2023, 1:34:44 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215785,0.0,'TestUU_UU',200383,'TestUU_UU',36,'N','N','N','N','N','N',200231,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:43','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:43','YYYY-MM-DD HH24:MI:SS'),100,203793,'Y','N','D','N','dc7709ed-c524-4610-aada-b67edf4ddf6a','N') +; + +-- Mar 17, 2023, 1:34:44 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,SeqNoSelection,IsToolbarButton) VALUES (215786,0.0,'Search Key','Search key for the record in the format required - must be unique','A search key allows you a fast method of finding a particular record. +If you leave the search key empty, the system automatically creates a numeric number. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_", where TableName is the actual name of the table (e.g. C_Order).',200383,'Value',40,'N','N','N','N','N','N',10,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:44','YYYY-MM-DD HH24:MI:SS'),100,620,'Y','Y','D','N','b92de84e-ccbf-4a10-aa52-e91650636d4e',10,'N') +; + +-- Mar 17, 2023, 1:34:44 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,SeqNoSelection,IsToolbarButton) VALUES (215787,0.0,'Name','Alphanumeric identifier of the entity','The name of an entity (record) is used as an default search option in addition to the search key. The name is up to 60 characters in length.',200383,'Name',60,'N','N','Y','N','Y','N',10,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:44','YYYY-MM-DD HH24:MI:SS'),100,469,'Y','Y','D','N','674c6f2b-91b6-4d04-816e-40c772853c7d',20,'N') +; + +-- Mar 17, 2023, 1:34:45 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215788,0.0,'Description','Optional short description of the record','A description is limited to 255 characters.',200383,'Description',255,'N','N','N','N','N','N',10,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:44','YYYY-MM-DD HH24:MI:SS'),100,275,'Y','N','D','N','4f383051-d64b-4457-ba7b-6386699fcda6','N') +; + +-- Mar 17, 2023, 1:34:45 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215789,0.0,'Comment/Help','Comment or Hint','The Help field contains a hint, comment or help about the use of this item.',200383,'Help',2000,'N','N','N','N','N','N',10,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:45','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:45','YYYY-MM-DD HH24:MI:SS'),100,326,'Y','N','D','N','d9291e97-85da-4817-816c-7efc9971dcce','N') +; + +-- Mar 17, 2023, 1:35:40 PM CET +UPDATE AD_Column SET IsAllowCopy='N', FKConstraintName='ADClient_TestUU', FKConstraintType='N',Updated=TO_TIMESTAMP('2023-03-17 13:35:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=215778 +; + +-- Mar 17, 2023, 1:35:40 PM CET +UPDATE AD_Column SET IsAllowCopy='N', FKConstraintName='ADOrg_TestUU', FKConstraintType='N',Updated=TO_TIMESTAMP('2023-03-17 13:35:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=215779 +; + +-- Mar 17, 2023, 1:35:40 PM CET +UPDATE AD_Column SET IsAllowCopy='N', FKConstraintName='CreatedBy_TestUU', FKConstraintType='N',Updated=TO_TIMESTAMP('2023-03-17 13:35:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=215781 +; + +-- Mar 17, 2023, 1:35:40 PM CET +UPDATE AD_Column SET IsAllowCopy='N', FKConstraintName='UpdatedBy_TestUU', FKConstraintType='N',Updated=TO_TIMESTAMP('2023-03-17 13:35:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=215783 +; + +-- Mar 21, 2023, 12:00:02 PM CET +CREATE TABLE TestUU (AD_Client_ID NUMBER(10) NOT NULL, AD_Org_ID NUMBER(10) NOT NULL, Created DATE NOT NULL, CreatedBy NUMBER(10) NOT NULL, Description VARCHAR2(255 CHAR) DEFAULT NULL , Help VARCHAR2(2000 CHAR) DEFAULT NULL , IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL, Name VARCHAR2(60 CHAR) NOT NULL, TestUU_UU VARCHAR2(36 CHAR) DEFAULT NULL , Updated DATE NOT NULL, UpdatedBy NUMBER(10) NOT NULL, Value VARCHAR2(40 CHAR) DEFAULT NULL , CONSTRAINT TestUU_UU_idx PRIMARY KEY (TestUU_UU)) +; + +-- Mar 17, 2023, 1:35:40 PM CET +ALTER TABLE TestUU ADD CONSTRAINT ADClient_TestUU FOREIGN KEY (AD_Client_ID) REFERENCES ad_client(ad_client_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Mar 17, 2023, 1:35:40 PM CET +ALTER TABLE TestUU ADD CONSTRAINT ADOrg_TestUU FOREIGN KEY (AD_Org_ID) REFERENCES ad_org(ad_org_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Mar 17, 2023, 1:35:40 PM CET +ALTER TABLE TestUU ADD CONSTRAINT CreatedBy_TestUU FOREIGN KEY (CreatedBy) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Mar 17, 2023, 1:35:40 PM CET +ALTER TABLE TestUU ADD CONSTRAINT UpdatedBy_TestUU FOREIGN KEY (UpdatedBy) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Mar 17, 2023, 1:36:10 PM CET +INSERT INTO AD_Window (AD_Window_ID,Name,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,WindowType,Processing,EntityType,IsSOTrx,IsDefault,IsBetaFunctionality,AD_Window_UU) VALUES (200138,'Test UU Based Table',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:10','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:10','YYYY-MM-DD HH24:MI:SS'),100,'M','N','D','Y','N','N','2921802a-9dc1-4f96-82c2-49c5a3e0cba7') +; + +-- Mar 17, 2023, 1:36:11 PM CET +INSERT INTO AD_Tab (AD_Tab_ID,Name,AD_Window_ID,SeqNo,IsSingleRow,AD_Table_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,HasTree,IsTranslationTab,IsReadOnly,OrderByClause,Processing,TabLevel,IsSortTab,EntityType,IsInsertRecord,IsAdvancedTab,AD_Tab_UU) VALUES (200348,'Test UU Based Table',200138,10,'Y',200383,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:10','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:10','YYYY-MM-DD HH24:MI:SS'),100,'N','N','N','TestUU.Value','N',0,'N','D','Y','N','c3f2631d-4c03-479a-b117-c3b63ce7d88a') +; + +-- Mar 17, 2023, 1:36:11 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,ColumnSpan) VALUES (207573,'Tenant','Tenant for this installation.','A Tenant is a company or a legal entity. You cannot share data between Tenants.',200348,215778,'Y',10,10,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:11','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','6d183212-b625-4279-a774-75879a79357e','Y',10,2) +; + +-- Mar 17, 2023, 1:36:12 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,IsAllowCopy,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (207574,'Organization','Organizational entity within tenant','An organization is a unit of your tenant or legal entity - examples are store, department. You can share data between organizations.',200348,215779,'Y',10,20,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:11','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','4d4b86aa-db82-4c2f-86fa-c95272048099','Y','Y',20,4,2) +; + +-- Mar 17, 2023, 1:36:12 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,ColumnSpan) VALUES (207575,'Search Key','Search key for the record in the format required - must be unique','A search key allows you a fast method of finding a particular record. +If you leave the search key empty, the system automatically creates a numeric number. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_", where TableName is the actual name of the table (e.g. C_Order).',200348,215786,'Y',40,30,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:12','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:12','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','3785369b-0696-41fd-a3dd-33badee4e29c','Y',30,2) +; + +-- Mar 17, 2023, 1:36:12 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,ColumnSpan) VALUES (207576,'Name','Alphanumeric identifier of the entity','The name of an entity (record) is used as an default search option in addition to the search key. The name is up to 60 characters in length.',200348,215787,'Y',60,40,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:12','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:12','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','55284ece-1182-4892-8bc0-5cb3ff8eb8a4','Y',40,5) +; + +-- Mar 17, 2023, 1:36:13 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,ColumnSpan) VALUES (207577,'Description','Optional short description of the record','A description is limited to 255 characters.',200348,215788,'Y',255,50,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:12','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:12','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','6e93839b-99b9-4d99-b573-3ad4d7111254','Y',50,5) +; + +-- Mar 17, 2023, 1:36:13 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,ColumnSpan) VALUES (207578,'Comment/Help','Comment or Hint','The Help field contains a hint, comment or help about the use of this item.',200348,215789,'Y',2000,60,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:13','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','546d1673-1e8b-44c9-bba1-d1d99069029c','Y',60,5) +; + +-- Mar 17, 2023, 1:36:14 PM CET +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,ColumnSpan) VALUES (207579,'TestUU_UU',200348,215785,'N',36,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:13','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','c1031159-ed74-4653-b230-73646a37f206','N',2) +; + +-- Mar 17, 2023, 1:36:14 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 (207580,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200348,215784,'Y',1,70,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:14','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:14','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','b1bd71c5-8051-4dd0-9fb9-f76cecf30279','Y',70,2,2) +; + +-- Mar 17, 2023, 1:36:14 PM CET +INSERT INTO AD_Menu (AD_Menu_ID,Name,Action,AD_Window_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSummary,IsSOTrx,IsReadOnly,EntityType,AD_Menu_UU) VALUES (200224,'Test UU Based Table','W',200138,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:14','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:14','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','N','D','290332f2-20a2-455f-8b07-28758c4d8f47') +; + +-- Mar 17, 2023, 1:36:14 PM CET +INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNodeMM_UU) SELECT t.AD_Client_ID, 0, 'Y', getDate(), 100, getDate(), 100,t.AD_Tree_ID, 200224, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='MM' AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200224) +; + +-- Mar 17, 2023, 1:36:14 PM CET +UPDATE AD_Table SET AD_Window_ID=200138,Updated=TO_TIMESTAMP('2023-03-17 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=200383 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=10,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200224 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=11,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=220 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=12,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=351 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=13,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200218 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=14,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=289 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=15,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=302 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=16,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200168 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=17,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200169 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=18,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200221 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=19,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200222 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=20,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=303 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=21,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200047 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=22,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200048 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=23,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=321 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=24,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=461 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=25,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=53193 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=26,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200161 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=27,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=53322 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=28,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=383 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=29,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200177 +; + +-- Mar 17, 2023, 7:37:47 PM CET +INSERT INTO TestUU (AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,IsActive,TestUU_UU,Value,Name) VALUES (0,0,TO_TIMESTAMP('2023-03-17 19:37:47','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 19:37:47','YYYY-MM-DD HH24:MI:SS'),100,'Y','4e148b89-bdd9-48a6-8a8a-7609092f965c','TRS','Test Record in System') +; + +-- Mar 17, 2023, 7:38:31 PM CET +INSERT INTO TestUU (AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,IsActive,TestUU_UU,Value,Name) VALUES (11,0,TO_TIMESTAMP('2023-03-17 19:38:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 19:38:31','YYYY-MM-DD HH24:MI:SS'),100,'Y','8858ecc2-cf1d-405f-987f-793536037e76','TRGW','Test Record in GardenWorld') +; + diff --git a/migration/iD11/oracle/202303181647_IDEMPIERE-5567.sql b/migration/iD11/oracle/202303181647_IDEMPIERE-5567.sql new file mode 100644 index 0000000000..f1569822fc --- /dev/null +++ b/migration/iD11/oracle/202303181647_IDEMPIERE-5567.sql @@ -0,0 +1,14 @@ +-- IDEMPIERE-5567 Support of UUID as Key (FHCA-4195) +SELECT register_migration_script('202303181647_IDEMPIERE-5567.sql') FROM dual; + +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Mar 18, 2023, 4:47:30 PM CET +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,AD_Reference_Value_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted,IsAutocomplete,DateRangeOption,IsShowNegateButton) VALUES (200433,0,0,'Y',TO_TIMESTAMP('2023-03-18 16:47:29','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-18 16:47:29','YYYY-MM-DD HH24:MI:SS'),100,'Link Column','Link Column for Multi-Parent tables','The Link Column indicates which column is the primary key for those situations where there is more than one parent. Only define it, if the table has more than one parent column (e.g. AD_User_Roles).',200118,70,19,3,'N',100,10,'N','AD_Column_ID','N','D',104,'5fce2b79-b32a-4b42-868b-c6d1dbee5cc9','N','N','D','N') +; + +-- Mar 18, 2023, 4:48:24 PM CET +UPDATE AD_Process_Para SET DisplayLogic='@TabLevel@>0 & @IsNewWindow@=''N''', MandatoryLogic='@TabLevel@>0 & @IsNewWindow@=''N''',Updated=TO_TIMESTAMP('2023-03-18 16:48:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200433 +; + diff --git a/migration/iD11/postgresql/202302170238_IDEMPIERE-5567.sql b/migration/iD11/postgresql/202302170238_IDEMPIERE-5567.sql new file mode 100644 index 0000000000..971e6dd618 --- /dev/null +++ b/migration/iD11/postgresql/202302170238_IDEMPIERE-5567.sql @@ -0,0 +1,15 @@ +-- IDEMPIERE-5567 Evaluate support of Long ID (FHCA-4195) +SELECT register_migration_script('202302170238_IDEMPIERE-5567.sql') FROM dual; + +-- Feb 17, 2023, 2:38:33 AM CET +INSERT INTO AD_Reference (AD_Reference_ID,Name,Description,ValidationType,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,IsOrderByValue,AD_Reference_UU) VALUES (200231,'UUID','Universally unique identifier','D',0,0,'Y',TO_TIMESTAMP('2023-02-17 02:38:33','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-17 02:38:33','YYYY-MM-DD HH24:MI:SS'),100,'D','N','2dbf9d9e-3e83-4927-b737-c1124918402c') +; + +-- Mar 13, 2023, 8:42:24 PM CET +UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=13 | @IsKey@=Y',Updated=TO_TIMESTAMP('2023-03-13 20:42:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=161 +; + +-- Mar 17, 2023, 1:18:24 PM CET +UPDATE AD_Process_Para SET ReadOnlyLogic=NULL,Updated=TO_TIMESTAMP('2023-03-17 13:18:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200361 +; + diff --git a/migration/iD11/postgresql/202303171334_IDEMPIERE-5567.sql b/migration/iD11/postgresql/202303171334_IDEMPIERE-5567.sql new file mode 100644 index 0000000000..8df539d23b --- /dev/null +++ b/migration/iD11/postgresql/202303171334_IDEMPIERE-5567.sql @@ -0,0 +1,247 @@ +-- IDEMPIERE-5567 Support of UUID as Key (FHCA-4195) +SELECT register_migration_script('202303171334_IDEMPIERE-5567.sql') FROM dual; + +-- Mar 17, 2023, 1:34:39 PM CET +INSERT INTO AD_Table (AD_Table_ID,Name,TableName,AccessLevel,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSecurityEnabled,IsDeleteable,IsHighVolume,IsView,EntityType,IsChangeLog,ReplicationType,AD_Table_UU,Processing) VALUES (200383,'Test UU Based Table','TestUU','7',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:39','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:39','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','N','N','D','Y','L','9827c04e-633e-44c2-a17f-d9bd56874b75','N') +; + +-- Mar 17, 2023, 1:34:40 PM CET +INSERT INTO AD_Sequence (Name,CurrentNext,IsAudited,StartNewYear,Description,IsActive,IsTableID,AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,AD_Sequence_ID,IsAutoSequence,StartNo,IncrementNo,CurrentNextSys,AD_Sequence_UU) VALUES ('TestUU',1000000,'N','N','Table TestUU','Y','Y',0,0,TO_TIMESTAMP('2023-03-17 13:34:39','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:39','YYYY-MM-DD HH24:MI:SS'),100,200453,'Y',1000000,1,200000,'d9a6863f-41e8-4dcc-9af2-d37a98dd467f') +; + +-- Mar 17, 2023, 1:34:40 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,ReadOnlyLogic,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215778,0.0,'Tenant','Tenant for this installation.','A Tenant is a company or a legal entity. You cannot share data between Tenants.',200383,'AD_Client_ID','@#AD_Client_ID@',10,'N','N','Y','N','N','N',30,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:40','YYYY-MM-DD HH24:MI:SS'),100,102,'N','N','1=1','D','N','48c9c712-f123-4531-957d-ed983667e86a','N') +; + +-- Mar 17, 2023, 1:34:41 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215779,0.0,'Organization','Organizational entity within tenant','An organization is a unit of your tenant or legal entity - examples are store, department. You can share data between organizations.',200383,'AD_Org_ID','@AD_Org_ID@',10,'N','N','Y','N','N','N',19,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:40','YYYY-MM-DD HH24:MI:SS'),100,113,'N','N','D','N','0cc337db-20e1-4e7a-bb51-4bc50cf4c6d2','N') +; + +-- Mar 17, 2023, 1:34:41 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215780,0.0,'Created','Date this record was created','The Created field indicates the date that this record was created.',200383,'Created',7,'N','N','Y','N','N','N',16,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:41','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:41','YYYY-MM-DD HH24:MI:SS'),100,245,'N','N','D','N','7fd767de-9383-4733-b007-171c6011521e','N') +; + +-- Mar 17, 2023, 1:34:42 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215781,0.0,'Created By','User who created this records','The Created By field indicates the user who created this record.',200383,'CreatedBy',10,'N','N','Y','N','N','N',30,110,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:41','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:41','YYYY-MM-DD HH24:MI:SS'),100,246,'N','N','D','N','b26ee963-280a-438f-9bf2-8ad6e9333d1d','N') +; + +-- Mar 17, 2023, 1:34:42 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215782,0.0,'Updated','Date this record was updated','The Updated field indicates the date that this record was updated.',200383,'Updated',7,'N','N','Y','N','N','N',16,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:42','YYYY-MM-DD HH24:MI:SS'),100,607,'N','N','D','N','c94550c9-6d87-46f3-b32b-1be64d9434e7','N') +; + +-- Mar 17, 2023, 1:34:42 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215783,0.0,'Updated By','User who updated this records','The Updated By field indicates the user who updated this record.',200383,'UpdatedBy',10,'N','N','Y','N','N','N',30,110,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:42','YYYY-MM-DD HH24:MI:SS'),100,608,'N','N','D','N','7ad894c2-b246-47bf-8060-f7257e8c5ede','N') +; + +-- Mar 17, 2023, 1:34:43 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215784,0.0,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200383,'IsActive','Y',1,'N','N','Y','N','N','N',20,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:42','YYYY-MM-DD HH24:MI:SS'),100,348,'Y','N','D','N','56fdfbae-62af-4618-8442-81bf9c058081','N') +; + +-- Mar 17, 2023, 1:34:43 PM CET +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203793,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:43','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:43','YYYY-MM-DD HH24:MI:SS'),100,'TestUU_UU','TestUU_UU','TestUU_UU','D','b1f089f6-466f-4a40-89bf-0fbfa475301c') +; + +-- Mar 17, 2023, 1:34:44 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215785,0.0,'TestUU_UU',200383,'TestUU_UU',36,'N','N','N','N','N','N',200231,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:43','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:43','YYYY-MM-DD HH24:MI:SS'),100,203793,'Y','N','D','N','dc7709ed-c524-4610-aada-b67edf4ddf6a','N') +; + +-- Mar 17, 2023, 1:34:44 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,SeqNoSelection,IsToolbarButton) VALUES (215786,0.0,'Search Key','Search key for the record in the format required - must be unique','A search key allows you a fast method of finding a particular record. +If you leave the search key empty, the system automatically creates a numeric number. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_", where TableName is the actual name of the table (e.g. C_Order).',200383,'Value',40,'N','N','N','N','N','N',10,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:44','YYYY-MM-DD HH24:MI:SS'),100,620,'Y','Y','D','N','b92de84e-ccbf-4a10-aa52-e91650636d4e',10,'N') +; + +-- Mar 17, 2023, 1:34:44 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,SeqNoSelection,IsToolbarButton) VALUES (215787,0.0,'Name','Alphanumeric identifier of the entity','The name of an entity (record) is used as an default search option in addition to the search key. The name is up to 60 characters in length.',200383,'Name',60,'N','N','Y','N','Y','N',10,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:44','YYYY-MM-DD HH24:MI:SS'),100,469,'Y','Y','D','N','674c6f2b-91b6-4d04-816e-40c772853c7d',20,'N') +; + +-- Mar 17, 2023, 1:34:45 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215788,0.0,'Description','Optional short description of the record','A description is limited to 255 characters.',200383,'Description',255,'N','N','N','N','N','N',10,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:44','YYYY-MM-DD HH24:MI:SS'),100,275,'Y','N','D','N','4f383051-d64b-4457-ba7b-6386699fcda6','N') +; + +-- Mar 17, 2023, 1:34:45 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (215789,0.0,'Comment/Help','Comment or Hint','The Help field contains a hint, comment or help about the use of this item.',200383,'Help',2000,'N','N','N','N','N','N',10,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:34:45','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:34:45','YYYY-MM-DD HH24:MI:SS'),100,326,'Y','N','D','N','d9291e97-85da-4817-816c-7efc9971dcce','N') +; + +-- Mar 17, 2023, 1:35:40 PM CET +UPDATE AD_Column SET IsAllowCopy='N', FKConstraintName='ADClient_TestUU', FKConstraintType='N',Updated=TO_TIMESTAMP('2023-03-17 13:35:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=215778 +; + +-- Mar 17, 2023, 1:35:40 PM CET +UPDATE AD_Column SET IsAllowCopy='N', FKConstraintName='ADOrg_TestUU', FKConstraintType='N',Updated=TO_TIMESTAMP('2023-03-17 13:35:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=215779 +; + +-- Mar 17, 2023, 1:35:40 PM CET +UPDATE AD_Column SET IsAllowCopy='N', FKConstraintName='CreatedBy_TestUU', FKConstraintType='N',Updated=TO_TIMESTAMP('2023-03-17 13:35:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=215781 +; + +-- Mar 17, 2023, 1:35:40 PM CET +UPDATE AD_Column SET IsAllowCopy='N', FKConstraintName='UpdatedBy_TestUU', FKConstraintType='N',Updated=TO_TIMESTAMP('2023-03-17 13:35:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=215783 +; + +-- Mar 21, 2023, 12:00:02 PM CET +CREATE TABLE TestUU (AD_Client_ID NUMERIC(10) NOT NULL, AD_Org_ID NUMERIC(10) NOT NULL, Created TIMESTAMP NOT NULL, CreatedBy NUMERIC(10) NOT NULL, Description VARCHAR(255) DEFAULT NULL , Help VARCHAR(2000) DEFAULT NULL , IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL, Name VARCHAR(60) NOT NULL, TestUU_UU VARCHAR(36) DEFAULT NULL , Updated TIMESTAMP NOT NULL, UpdatedBy NUMERIC(10) NOT NULL, Value VARCHAR(40) DEFAULT NULL , CONSTRAINT TestUU_UU_idx PRIMARY KEY (TestUU_UU)) +; + +-- Mar 17, 2023, 1:35:40 PM CET +ALTER TABLE TestUU ADD CONSTRAINT ADClient_TestUU FOREIGN KEY (AD_Client_ID) REFERENCES ad_client(ad_client_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Mar 17, 2023, 1:35:40 PM CET +ALTER TABLE TestUU ADD CONSTRAINT ADOrg_TestUU FOREIGN KEY (AD_Org_ID) REFERENCES ad_org(ad_org_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Mar 17, 2023, 1:35:40 PM CET +ALTER TABLE TestUU ADD CONSTRAINT CreatedBy_TestUU FOREIGN KEY (CreatedBy) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Mar 17, 2023, 1:35:40 PM CET +ALTER TABLE TestUU ADD CONSTRAINT UpdatedBy_TestUU FOREIGN KEY (UpdatedBy) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Mar 17, 2023, 1:36:10 PM CET +INSERT INTO AD_Window (AD_Window_ID,Name,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,WindowType,Processing,EntityType,IsSOTrx,IsDefault,IsBetaFunctionality,AD_Window_UU) VALUES (200138,'Test UU Based Table',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:10','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:10','YYYY-MM-DD HH24:MI:SS'),100,'M','N','D','Y','N','N','2921802a-9dc1-4f96-82c2-49c5a3e0cba7') +; + +-- Mar 17, 2023, 1:36:11 PM CET +INSERT INTO AD_Tab (AD_Tab_ID,Name,AD_Window_ID,SeqNo,IsSingleRow,AD_Table_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,HasTree,IsTranslationTab,IsReadOnly,OrderByClause,Processing,TabLevel,IsSortTab,EntityType,IsInsertRecord,IsAdvancedTab,AD_Tab_UU) VALUES (200348,'Test UU Based Table',200138,10,'Y',200383,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:10','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:10','YYYY-MM-DD HH24:MI:SS'),100,'N','N','N','TestUU.Value','N',0,'N','D','Y','N','c3f2631d-4c03-479a-b117-c3b63ce7d88a') +; + +-- Mar 17, 2023, 1:36:11 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,ColumnSpan) VALUES (207573,'Tenant','Tenant for this installation.','A Tenant is a company or a legal entity. You cannot share data between Tenants.',200348,215778,'Y',10,10,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:11','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','6d183212-b625-4279-a774-75879a79357e','Y',10,2) +; + +-- Mar 17, 2023, 1:36:12 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,IsAllowCopy,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (207574,'Organization','Organizational entity within tenant','An organization is a unit of your tenant or legal entity - examples are store, department. You can share data between organizations.',200348,215779,'Y',10,20,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:11','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','4d4b86aa-db82-4c2f-86fa-c95272048099','Y','Y',20,4,2) +; + +-- Mar 17, 2023, 1:36:12 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,ColumnSpan) VALUES (207575,'Search Key','Search key for the record in the format required - must be unique','A search key allows you a fast method of finding a particular record. +If you leave the search key empty, the system automatically creates a numeric number. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_", where TableName is the actual name of the table (e.g. C_Order).',200348,215786,'Y',40,30,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:12','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:12','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','3785369b-0696-41fd-a3dd-33badee4e29c','Y',30,2) +; + +-- Mar 17, 2023, 1:36:12 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,ColumnSpan) VALUES (207576,'Name','Alphanumeric identifier of the entity','The name of an entity (record) is used as an default search option in addition to the search key. The name is up to 60 characters in length.',200348,215787,'Y',60,40,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:12','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:12','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','55284ece-1182-4892-8bc0-5cb3ff8eb8a4','Y',40,5) +; + +-- Mar 17, 2023, 1:36:13 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,ColumnSpan) VALUES (207577,'Description','Optional short description of the record','A description is limited to 255 characters.',200348,215788,'Y',255,50,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:12','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:12','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','6e93839b-99b9-4d99-b573-3ad4d7111254','Y',50,5) +; + +-- Mar 17, 2023, 1:36:13 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,ColumnSpan) VALUES (207578,'Comment/Help','Comment or Hint','The Help field contains a hint, comment or help about the use of this item.',200348,215789,'Y',2000,60,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:13','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','546d1673-1e8b-44c9-bba1-d1d99069029c','Y',60,5) +; + +-- Mar 17, 2023, 1:36:14 PM CET +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,ColumnSpan) VALUES (207579,'TestUU_UU',200348,215785,'N',36,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:13','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','c1031159-ed74-4653-b230-73646a37f206','N',2) +; + +-- Mar 17, 2023, 1:36:14 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 (207580,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200348,215784,'Y',1,70,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:14','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:14','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','b1bd71c5-8051-4dd0-9fb9-f76cecf30279','Y',70,2,2) +; + +-- Mar 17, 2023, 1:36:14 PM CET +INSERT INTO AD_Menu (AD_Menu_ID,Name,"action",AD_Window_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSummary,IsSOTrx,IsReadOnly,EntityType,AD_Menu_UU) VALUES (200224,'Test UU Based Table','W',200138,0,0,'Y',TO_TIMESTAMP('2023-03-17 13:36:14','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 13:36:14','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','N','D','290332f2-20a2-455f-8b07-28758c4d8f47') +; + +-- Mar 17, 2023, 1:36:14 PM CET +INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNodeMM_UU) SELECT t.AD_Client_ID, 0, 'Y', statement_timestamp(), 100, statement_timestamp(), 100,t.AD_Tree_ID, 200224, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='MM' AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200224) +; + +-- Mar 17, 2023, 1:36:14 PM CET +UPDATE AD_Table SET AD_Window_ID=200138,Updated=TO_TIMESTAMP('2023-03-17 13:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=200383 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=10,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200224 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=11,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=220 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=12,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=351 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=13,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200218 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=14,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=289 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=15,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=302 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=16,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200168 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=17,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200169 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=18,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200221 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=19,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200222 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=20,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=303 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=21,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200047 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=22,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200048 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=23,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=321 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=24,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=461 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=25,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=53193 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=26,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200161 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=27,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=53322 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=28,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=383 +; + +-- Mar 17, 2023, 1:36:54 PM CET +UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=29,Updated=TO_TIMESTAMP('2023-03-17 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tree_ID=10 AND Node_ID=200177 +; + +-- Mar 17, 2023, 7:37:47 PM CET +INSERT INTO TestUU (AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,IsActive,TestUU_UU,Value,Name) VALUES (0,0,TO_TIMESTAMP('2023-03-17 19:37:47','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 19:37:47','YYYY-MM-DD HH24:MI:SS'),100,'Y','4e148b89-bdd9-48a6-8a8a-7609092f965c','TRS','Test Record in System') +; + +-- Mar 17, 2023, 7:38:31 PM CET +INSERT INTO TestUU (AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,IsActive,TestUU_UU,Value,Name) VALUES (11,0,TO_TIMESTAMP('2023-03-17 19:38:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-17 19:38:31','YYYY-MM-DD HH24:MI:SS'),100,'Y','8858ecc2-cf1d-405f-987f-793536037e76','TRGW','Test Record in GardenWorld') +; + diff --git a/migration/iD11/postgresql/202303181647_IDEMPIERE-5567.sql b/migration/iD11/postgresql/202303181647_IDEMPIERE-5567.sql new file mode 100644 index 0000000000..6b1dc7719f --- /dev/null +++ b/migration/iD11/postgresql/202303181647_IDEMPIERE-5567.sql @@ -0,0 +1,11 @@ +-- IDEMPIERE-5567 Support of UUID as Key (FHCA-4195) +SELECT register_migration_script('202303181647_IDEMPIERE-5567.sql') FROM dual; + +-- Mar 18, 2023, 4:47:30 PM CET +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,AD_Reference_Value_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted,IsAutocomplete,DateRangeOption,IsShowNegateButton) VALUES (200433,0,0,'Y',TO_TIMESTAMP('2023-03-18 16:47:29','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-03-18 16:47:29','YYYY-MM-DD HH24:MI:SS'),100,'Link Column','Link Column for Multi-Parent tables','The Link Column indicates which column is the primary key for those situations where there is more than one parent. Only define it, if the table has more than one parent column (e.g. AD_User_Roles).',200118,70,19,3,'N',100,10,'N','AD_Column_ID','N','D',104,'5fce2b79-b32a-4b42-868b-c6d1dbee5cc9','N','N','D','N') +; + +-- Mar 18, 2023, 4:48:24 PM CET +UPDATE AD_Process_Para SET DisplayLogic='@TabLevel@>0 & @IsNewWindow@=''N''', MandatoryLogic='@TabLevel@>0 & @IsNewWindow@=''N''',Updated=TO_TIMESTAMP('2023-03-18 16:48:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200433 +; + diff --git a/org.adempiere.base.process/src/org/compiere/process/CreateWindowFromTable.java b/org.adempiere.base.process/src/org/compiere/process/CreateWindowFromTable.java index 306ef6ddbe..864ee72c27 100644 --- a/org.adempiere.base.process/src/org/compiere/process/CreateWindowFromTable.java +++ b/org.adempiere.base.process/src/org/compiere/process/CreateWindowFromTable.java @@ -70,6 +70,9 @@ public class CreateWindowFromTable extends SvrProcess /** Create Menu Record */ private boolean p_isCreateMenu = false; + /** Link Column */ + private int p_LinkColumn_ID = 0; + /** * Prepare - e.g., get Parameters. */ @@ -93,6 +96,8 @@ public class CreateWindowFromTable extends SvrProcess p_TabLevel = para[i].getParameterAsInt(); else if (name.equals("IsCreateMenu")) p_isCreateMenu = para[i].getParameterAsBoolean(); + else if (name.equals("AD_Column_ID")) + p_LinkColumn_ID = para[i].getParameterAsInt(); else MProcessPara.validateUnknownParameter(getProcessInfo().getAD_Process_ID(), para[i]); } @@ -144,18 +149,9 @@ public class CreateWindowFromTable extends SvrProcess tabSeqNo = 10; } else { //If no new window but a detail tab - if (p_TabLevel > 0) { - boolean hasParentLinkColumn = false; - for (MColumn column : table.getColumns(false)) { - if (column.isParent()) { - hasParentLinkColumn = true; - break; - } - } - - if (!hasParentLinkColumn) - throw new AdempiereException(Msg.getMsg(getCtx(), "NoParentLink")); - } + if (p_TabLevel > 0 && p_LinkColumn_ID <= 0) + throw new AdempiereException(Msg.getMsg(getCtx(), "NoParentLink")); + window = new MWindow(getCtx(), p_AD_Window_ID, get_TrxName()); int maxTabLevel = -1; @@ -181,6 +177,8 @@ public class CreateWindowFromTable extends SvrProcess tab.setName(table.getName()); tab.setAD_Table_ID(p_AD_Table_ID); tab.setTabLevel(p_TabLevel); + if (p_TabLevel > 0 && p_LinkColumn_ID > 0) + tab.setAD_Column_ID(p_LinkColumn_ID); tab.setIsSingleRow(true); //Default //Set order by diff --git a/org.adempiere.base.process/src/org/idempiere/process/CreateTable.java b/org.adempiere.base.process/src/org/idempiere/process/CreateTable.java index e3b4db2c57..227a9a4dc3 100644 --- a/org.adempiere.base.process/src/org/idempiere/process/CreateTable.java +++ b/org.adempiere.base.process/src/org/idempiere/process/CreateTable.java @@ -36,6 +36,7 @@ import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_NUMBER; import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_STRING; import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_TABLE; import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_TABLEDIR; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_UUID; import static org.compiere.model.SystemIDs.REFERENCE_DOCUMENTACTION; import static org.compiere.model.SystemIDs.REFERENCE_DOCUMENTSTATUS; import static org.compiere.model.SystemIDs.REFERENCE_POSTED; @@ -596,7 +597,7 @@ public class CreateTable extends SvrProcess { column.setFieldLength(LENGTH_22); } else if (element.getColumnName().equalsIgnoreCase(table.getTableName() + "_UU")) { // UUID column - column.setAD_Reference_ID(REFERENCE_DATATYPE_STRING); + column.setAD_Reference_ID(REFERENCE_DATATYPE_UUID); column.setFieldLength(LENGTH_36); } else if (element.getColumnName().equalsIgnoreCase((table.getTableName().substring(0, table.getTableName().length()-4)) + "_ID")) { // ID of parent table (for translation tables) diff --git a/org.adempiere.base/src/org/adempiere/util/ModelClassGenerator.java b/org.adempiere.base/src/org/adempiere/util/ModelClassGenerator.java index ef83d1b908..61d9e64c4c 100644 --- a/org.adempiere.base/src/org/adempiere/util/ModelClassGenerator.java +++ b/org.adempiere.base/src/org/adempiere/util/ModelClassGenerator.java @@ -38,6 +38,7 @@ import java.util.logging.Level; import org.adempiere.exceptions.DBException; import org.compiere.Adempiere; import org.compiere.model.MTable; +import org.compiere.model.PO; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.DisplayType; @@ -79,12 +80,16 @@ public class ModelClassGenerator { this.packageName = packageName; + MTable table = MTable.get(AD_Table_ID); + boolean uuidKeyTable = table.isUUIDKeyTable() || table.getKeyColumns().length > 1 || (table.getKeyColumns().length == 1 && (!table.getColumn(table.getKeyColumns()[0]).isKey())); + boolean tableHasIds = table.getKeyColumns().length > 0 && !table.isUUIDKeyTable(); + // create column access methods StringBuilder mandatory = new StringBuilder(); - StringBuilder sb = createColumns(AD_Table_ID, mandatory, entityTypeFilter); + StringBuilder sb = createColumns(AD_Table_ID, mandatory, entityTypeFilter, uuidKeyTable); // Header - String className = createHeader(AD_Table_ID, sb, mandatory, packageName); + String className = createHeader(AD_Table_ID, sb, mandatory, packageName, uuidKeyTable, tableHasIds); // Save if ( ! directory.endsWith(File.separator) ) @@ -108,9 +113,11 @@ public class ModelClassGenerator * @param sb buffer * @param mandatory init call for mandatory columns * @param packageName package name + * @param uuidKeyTable + * @param tableHasIds * @return class name */ - private String createHeader (int AD_Table_ID, StringBuilder sb, StringBuilder mandatory, String packageName) + private String createHeader (int AD_Table_ID, StringBuilder sb, StringBuilder mandatory, String packageName, boolean uuidKeyTable, boolean tableHasIds) { String tableName = ""; int accessLevel = 0; @@ -151,6 +158,8 @@ public class ModelClassGenerator // StringBuilder keyColumn = new StringBuilder().append(tableName).append("_ID"); StringBuilder className = new StringBuilder("X_").append(tableName); + String uuidColumn = PO.getUUIDColumnName(tableName); + // StringBuilder start = new StringBuilder() .append (ModelInterfaceGenerator.COPY) @@ -166,13 +175,13 @@ public class ModelClassGenerator createImports(start); // Class start.append("/** Generated Model for ").append(tableName).append(NL) - .append(" * @author iDempiere (generated) ").append(NL) + .append(" * @author iDempiere (generated)").append(NL) .append(" * @version ").append(Adempiere.MAIN_VERSION).append(" - $Id$ */").append(NL) .append("@org.adempiere.base.Model(table=\"").append(tableName).append("\")").append(NL) .append("public class ").append(className) .append(" extends PO") .append(" implements I_").append(tableName) - .append(", I_Persistent ") + .append(", I_Persistent") .append(NL) .append("{").append(NL) @@ -183,10 +192,11 @@ public class ModelClassGenerator .append("\t */").append(NL) .append("\tprivate static final long serialVersionUID = ") .append(String.format("%1$tY%1$tm%1$td", new Timestamp(System.currentTimeMillis()))) - .append("L;").append(NL) + .append("L;").append(NL); - // Standard Constructor - .append(NL) + if (tableHasIds) { + // Standard ID Constructor + start.append(NL) .append(" /** Standard Constructor */").append(NL) .append(" public ").append(className).append(" (Properties ctx, int ").append(keyColumn).append(", String trxName)").append(NL) .append(" {").append(NL) @@ -198,7 +208,7 @@ public class ModelClassGenerator .append(" }").append(NL) // Constructor End - // Standard Constructor + Virtual Columns + // Standard ID Constructor + Virtual Columns .append(NL) .append(" /** Standard Constructor */").append(NL) .append(" public ").append(className).append(" (Properties ctx, int ").append(keyColumn).append(", String trxName, String ... virtualColumns)").append(NL) @@ -208,6 +218,33 @@ public class ModelClassGenerator .append(" {").append(NL) .append(mandatory) .append(" } */").append(NL) + .append(" }").append(NL); + // Constructor End + } + + // Standard UUID Constructor + start.append(NL) + .append(" /** Standard Constructor */").append(NL) + .append(" public ").append(className).append(" (Properties ctx, String ").append(uuidColumn).append(", String trxName)").append(NL) + .append(" {").append(NL) + .append(" super (ctx, ").append(uuidColumn).append(", trxName);").append(NL) + .append(" /** if (").append(uuidColumn).append(" == null)").append(NL) + .append(" {").append(NL) + .append(mandatory) + .append(" } */").append(NL) + .append(" }").append(NL) + // Constructor End + + // Standard UUID Constructor + Virtual Columns + .append(NL) + .append(" /** Standard Constructor */").append(NL) + .append(" public ").append(className).append(" (Properties ctx, String ").append(uuidColumn).append(", String trxName, String ... virtualColumns)").append(NL) + .append(" {").append(NL) + .append(" super (ctx, ").append(uuidColumn).append(", trxName, virtualColumns);").append(NL) + .append(" /** if (").append(uuidColumn).append(" == null)").append(NL) + .append(" {").append(NL) + .append(mandatory) + .append(" } */").append(NL) .append(" }").append(NL) // Constructor End @@ -223,7 +260,7 @@ public class ModelClassGenerator // accessLevel .append(NL) .append(" /** AccessLevel").append(NL) - .append(" * @return ").append(accessLevelInfo).append(NL) + .append(" * @return ").append(accessLevelInfo.toString().trim()).append(NL) .append(" */").append(NL) .append(" protected int get_AccessLevel()").append(NL) .append(" {").append(NL) @@ -247,7 +284,7 @@ public class ModelClassGenerator .append(" public String toString()").append(NL) .append(" {").append(NL) .append(" StringBuilder sb = new StringBuilder (\"").append(className).append("[\")").append(NL) - .append(" .append(get_ID())"); + .append(" .append(").append(uuidKeyTable ? "get_UUID" : "get_ID").append("())"); if (hasName) start.append(".append(\",Name=\").append(getName())"); start.append(".append(\"]\");").append(NL) @@ -268,9 +305,10 @@ public class ModelClassGenerator * @param AD_Table_ID table * @param mandatory init call for mandatory columns * @param entityTypeFilter + * @param uuidKeyTable * @return set/get method */ - private StringBuilder createColumns (int AD_Table_ID, StringBuilder mandatory, String entityTypeFilter) + private StringBuilder createColumns (int AD_Table_ID, StringBuilder mandatory, String entityTypeFilter, boolean uuidKeyTable) { StringBuilder sb = new StringBuilder(); String sql = "SELECT c.ColumnName, c.IsUpdateable, c.IsMandatory," // 1..3 @@ -324,7 +362,10 @@ public class ModelClassGenerator // if (seqNo == 1 && IsIdentifier) { if (!isKeyNamePairCreated) { - sb.append(createKeyNamePair(columnName, displayType)); + if (uuidKeyTable) + sb.append(createValueNamePair(columnName, displayType)); + else + sb.append(createKeyNamePair(columnName, displayType)); isKeyNamePairCreated = true; } else { @@ -538,10 +579,10 @@ public class ModelClassGenerator } else if (clazz.equals(Boolean.class)) { sb.append("Object oo = ").append(getValue).append("(").append ("COLUMNNAME_").append(columnName).append(");").append(NL) - .append("\t\tif (oo != null) ").append(NL) + .append("\t\tif (oo != null)").append(NL) .append("\t\t{").append(NL) - .append("\t\t\t if (oo instanceof Boolean) ").append(NL) - .append("\t\t\t\t return ((Boolean)oo).booleanValue(); ").append(NL) + .append("\t\t\t if (oo instanceof Boolean)").append(NL) + .append("\t\t\t\t return ((Boolean)oo).booleanValue();").append(NL) .append("\t\t\treturn \"Y\".equals(oo);").append(NL) .append("\t\t}").append(NL) .append("\t\treturn false;").append(NL); @@ -713,8 +754,8 @@ public class ModelClassGenerator /** * Create getKeyNamePair() method with first identifier * @param columnName name - * * @param displayType int - @return method code + * @param displayType int + * @return method code */ private StringBuilder createKeyNamePair (String columnName, int displayType) { @@ -726,7 +767,7 @@ public class ModelClassGenerator .append(" /** Get Record ID/ColumnName").append(NL) .append(" @return ID/ColumnName pair").append(NL) .append(" */").append(NL) - .append(" public KeyNamePair getKeyNamePair() ").append(NL) + .append(" public KeyNamePair getKeyNamePair()").append(NL) .append(" {").append(NL) .append(" return new KeyNamePair(get_ID(), ").append(method).append(");").append(NL) .append(" }").append(NL) @@ -735,6 +776,31 @@ public class ModelClassGenerator return sb; } // createKeyNamePair + /** + * Create getValueNamePair() method with first identifier + * @param columnName name + * @param displayType String + * @return method code + */ + private StringBuilder createValueNamePair (String columnName, int displayType) + { + StringBuilder method = new StringBuilder("get").append(columnName).append("()"); + if (displayType != DisplayType.String) + method = new StringBuilder("String.valueOf(").append(method).append(")"); + + StringBuilder sb = new StringBuilder(NL) + .append(" /** Get Record UU/ColumnName").append(NL) + .append(" @return UU/ColumnName pair").append(NL) + .append(" */").append(NL) + .append(" public ValueNamePair getValueNamePair()").append(NL) + .append(" {").append(NL) + .append(" return new ValueNamePair(get_UUID(), ").append(method).append(");").append(NL) + .append(" }").append(NL) + ; + addImportClass(org.compiere.util.ValueNamePair.class); + return sb; + } // createValueNamePair + /************************************************************************** * Write to file diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index 28274c39e4..38a730502f 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -2381,14 +2381,16 @@ public class GridTable extends AbstractTableModel { int size = m_fields.size(); StringBuilder singleRowWHERE = null; + StringBuilder singleRowUUWHERE = null; StringBuilder multiRowWHERE = null; String tableName = getTableName(); + int uidColumn = -1; for (int col = 0; col < size; col++) { GridField field = (GridField)m_fields.get (col); + String columnName = field.getColumnName(); if (field.isKey()) { - String columnName = field.getColumnName(); Object value = rowData[col]; if (value == null) { @@ -2401,10 +2403,10 @@ public class GridTable extends AbstractTableModel else singleRowWHERE = new StringBuilder(tableName).append(".").append(columnName) .append ("=").append (DB.TO_STRING(value.toString())); + break; } else if (field.isParentColumn()) { - String columnName = field.getColumnName(); Object value = rowData[col]; if (value == null) { @@ -2425,11 +2427,35 @@ public class GridTable extends AbstractTableModel multiRowWHERE.append (tableName).append(".").append(columnName) .append ("=").append (DB.TO_STRING(value.toString())); } + else if (columnName.equals(PO.getUUIDColumnName(tableName))) + { + uidColumn = col; + } } // for all columns + if (singleRowWHERE != null) return singleRowWHERE.toString(); + if (multiRowWHERE != null) return multiRowWHERE.toString(); + + if (uidColumn >= 0) + { + Object value = rowData[uidColumn]; + if (value == null && multiRowWHERE == null) + { + log.log(Level.WARNING, "UUID data is null - " + uidColumn); + return null; + } + else + { + singleRowUUWHERE = new StringBuilder(tableName).append(".").append(PO.getUUIDColumnName(tableName)) + .append ("=").append (DB.TO_STRING(value.toString())); + } + } + if (singleRowUUWHERE != null) + return singleRowUUWHERE.toString(); + log.log(Level.WARNING, "No key Found"); return null; } // getWhereClause diff --git a/org.adempiere.base/src/org/compiere/model/I_Test.java b/org.adempiere.base/src/org/compiere/model/I_Test.java index d204092c6f..b352076832 100644 --- a/org.adempiere.base/src/org/compiere/model/I_Test.java +++ b/org.adempiere.base/src/org/compiere/model/I_Test.java @@ -35,7 +35,7 @@ public interface I_Test KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); - /** AccessLevel = 7 - System - Client - Org + /** AccessLevel = 7 - System - Client - Org */ BigDecimal accessLevel = BigDecimal.valueOf(7); diff --git a/org.adempiere.base/src/org/compiere/model/I_TestUU.java b/org.adempiere.base/src/org/compiere/model/I_TestUU.java new file mode 100644 index 0000000000..3070314aba --- /dev/null +++ b/org.adempiere.base/src/org/compiere/model/I_TestUU.java @@ -0,0 +1,170 @@ +/****************************************************************************** + * Product: iDempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. * + * 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. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.model; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import org.compiere.util.KeyNamePair; + +/** Generated Interface for TestUU + * @author iDempiere (generated) + * @version Release 11 + */ +public interface I_TestUU +{ + + /** TableName=TestUU */ + public static final String Table_Name = "TestUU"; + + /** AD_Table_ID=200383 */ + public static final int Table_ID = 200383; + + KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); + + /** AccessLevel = 7 - System - Client - Org + */ + BigDecimal accessLevel = BigDecimal.valueOf(7); + + /** Load Meta Data */ + + /** Column name AD_Client_ID */ + public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID"; + + /** Get Tenant. + * Tenant for this installation. + */ + public int getAD_Client_ID(); + + /** Column name AD_Org_ID */ + public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID"; + + /** Set Organization. + * Organizational entity within tenant + */ + public void setAD_Org_ID (int AD_Org_ID); + + /** Get Organization. + * Organizational entity within tenant + */ + public int getAD_Org_ID(); + + /** Column name Created */ + public static final String COLUMNNAME_Created = "Created"; + + /** Get Created. + * Date this record was created + */ + public Timestamp getCreated(); + + /** Column name CreatedBy */ + public static final String COLUMNNAME_CreatedBy = "CreatedBy"; + + /** Get Created By. + * User who created this records + */ + public int getCreatedBy(); + + /** Column name Description */ + public static final String COLUMNNAME_Description = "Description"; + + /** Set Description. + * Optional short description of the record + */ + public void setDescription (String Description); + + /** Get Description. + * Optional short description of the record + */ + public String getDescription(); + + /** Column name Help */ + public static final String COLUMNNAME_Help = "Help"; + + /** Set Comment/Help. + * Comment or Hint + */ + public void setHelp (String Help); + + /** Get Comment/Help. + * Comment or Hint + */ + public String getHelp(); + + /** Column name IsActive */ + public static final String COLUMNNAME_IsActive = "IsActive"; + + /** Set Active. + * The record is active in the system + */ + public void setIsActive (boolean IsActive); + + /** Get Active. + * The record is active in the system + */ + public boolean isActive(); + + /** Column name Name */ + public static final String COLUMNNAME_Name = "Name"; + + /** Set Name. + * Alphanumeric identifier of the entity + */ + public void setName (String Name); + + /** Get Name. + * Alphanumeric identifier of the entity + */ + public String getName(); + + /** Column name TestUU_UU */ + public static final String COLUMNNAME_TestUU_UU = "TestUU_UU"; + + /** Set TestUU_UU */ + public void setTestUU_UU (String TestUU_UU); + + /** Get TestUU_UU */ + public String getTestUU_UU(); + + /** Column name Updated */ + public static final String COLUMNNAME_Updated = "Updated"; + + /** Get Updated. + * Date this record was updated + */ + public Timestamp getUpdated(); + + /** Column name UpdatedBy */ + public static final String COLUMNNAME_UpdatedBy = "UpdatedBy"; + + /** Get Updated By. + * User who updated this records + */ + public int getUpdatedBy(); + + /** Column name Value */ + public static final String COLUMNNAME_Value = "Value"; + + /** Set Search Key. + * Search key for the record in the format required - must be unique + */ + public void setValue (String Value); + + /** Get Search Key. + * Search key for the record in the format required - must be unique + */ + public String getValue(); +} diff --git a/org.adempiere.base/src/org/compiere/model/MColumn.java b/org.adempiere.base/src/org/compiere/model/MColumn.java index 842cb0f1e3..649e0caeb3 100644 --- a/org.adempiere.base/src/org/compiere/model/MColumn.java +++ b/org.adempiere.base/src/org/compiere/model/MColumn.java @@ -660,6 +660,7 @@ public class MColumn extends X_AD_Column implements ImmutablePOSupport + " FOREIGN KEY (" + getColumnName() + ") REFERENCES " + AD_Table(AD_Table_ID) ON DELETE CASCADE **/ + MTable table = MTable.get(getAD_Table_ID()); // IDEMPIERE-965 if (getColumnName().equals(PO.getUUIDColumnName(tableName))) { StringBuilder indexName = new StringBuilder().append(getColumnName()).append("_idx"); @@ -667,7 +668,12 @@ public class MColumn extends X_AD_Column implements ImmutablePOSupport indexName = new StringBuilder().append(getColumnName().substring(0, 25)); indexName.append("uuidx"); } - StringBuilder msgreturn = new StringBuilder("CONSTRAINT ").append(indexName).append(" UNIQUE (").append(getColumnName()).append(")"); + String constraintType; + if (table.isUUIDKeyTable()) + constraintType = "PRIMARY KEY"; + else + constraintType = "UNIQUE"; + StringBuilder msgreturn = new StringBuilder("CONSTRAINT ").append(indexName).append(" ").append(constraintType).append(" (").append(getColumnName()).append(")"); return msgreturn.toString(); } return ""; diff --git a/org.adempiere.base/src/org/compiere/model/MTable.java b/org.adempiere.base/src/org/compiere/model/MTable.java index c6745ce9e6..1afabb7433 100644 --- a/org.adempiere.base/src/org/compiere/model/MTable.java +++ b/org.adempiere.base/src/org/compiere/model/MTable.java @@ -66,7 +66,7 @@ public class MTable extends X_AD_Table implements ImmutablePOSupport /** * */ - private static final long serialVersionUID = 2509844209115894798L; + private static final long serialVersionUID = -8036408095622443747L; public final static int MAX_OFFICIAL_ID = 999999; @@ -318,6 +318,8 @@ public class MTable extends X_AD_Table implements ImmutablePOSupport /** Columns */ private MColumn[] m_columns = null; + /** Key Columns */ + private String[] m_KeyColumns = null; /** column name to index map **/ private Map m_columnNameMap; /** ad_column_id to index map **/ @@ -455,22 +457,44 @@ public class MTable extends X_AD_Table implements ImmutablePOSupport */ public String[] getKeyColumns() { + if (m_KeyColumns != null) + return m_KeyColumns; getColumns(false); ArrayList list = new ArrayList(); // for (int i = 0; i < m_columns.length; i++) { MColumn column = m_columns[i]; - if (column.isKey()) - return new String[]{column.getColumnName()}; + if (column.isKey()) { + m_KeyColumns = new String[]{column.getColumnName()}; + return m_KeyColumns; + } if (column.isParent()) list.add(column.getColumnName()); } + //check uuid key + if (list.isEmpty()) { + MColumn uuColumn = getColumn(PO.getUUIDColumnName(getTableName())); + if (uuColumn != null) { + m_KeyColumns = new String[]{uuColumn.getColumnName()}; + return m_KeyColumns; + } + } String[] retValue = new String[list.size()]; retValue = list.toArray(retValue); - return retValue; + m_KeyColumns = retValue; + return m_KeyColumns; } // getKeyColumns + /** + * @return true if table key is _UU instead of _ID or composite parent key. + */ + public boolean isUUIDKeyTable() + { + String uuColName = PO.getUUIDColumnName(getTableName()); + return (getKeyColumns() != null && getKeyColumns()[0].equals(uuColName)); + } + /** * Get Identifier Columns of Table * @return Identifier columns diff --git a/org.adempiere.base/src/org/compiere/model/MTestUU.java b/org.adempiere.base/src/org/compiere/model/MTestUU.java new file mode 100644 index 0000000000..9256ffb46e --- /dev/null +++ b/org.adempiere.base/src/org/compiere/model/MTestUU.java @@ -0,0 +1,76 @@ +/*********************************************************************** + * This file is part of iDempiere ERP Open Source * + * http://www.idempiere.org * + * * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * 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., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Carlos Ruiz - globalqss - bxservice * + **********************************************************************/ + +package org.compiere.model; + +import java.sql.ResultSet; +import java.util.Properties; + +/** + * Test UUID Based Table Model + * @author Carlos Ruiz - globalqss - bxservice + */ +public class MTestUU extends X_TestUU { + /** + * + */ + private static final long serialVersionUID = 5182486896440407051L; + + /** + * Constructor + * + * @param ctx context + * @param Test_UU + * @param trxName transaction + */ + public MTestUU(Properties ctx, String Test_UU, String trxName) { + this(ctx, Test_UU, trxName, (String[]) null); + } // MTestUU + + public MTestUU(Properties ctx, String Test_UU, String trxName, String... virtualColumns) { + super(ctx, Test_UU, trxName, virtualColumns); + if ("".equals(Test_UU)) { + setName(null); + } + } // MTestUU + + /** + * Load Constructor + * + * @param ctx context + * @param rs result set + * @param trxName transaction + */ + public MTestUU(Properties ctx, ResultSet rs, String trxName) { + super(ctx, rs, trxName); + } // MTestUU + + @Override + protected boolean beforeSave(boolean newRecord) { + log.warning("Capturing beforeSave event on TestUU table"); + return true; + } + +} // MTestUU diff --git a/org.adempiere.base/src/org/compiere/model/MZoomCondition.java b/org.adempiere.base/src/org/compiere/model/MZoomCondition.java index d448b8f863..915c5ce7c2 100644 --- a/org.adempiere.base/src/org/compiere/model/MZoomCondition.java +++ b/org.adempiere.base/src/org/compiere/model/MZoomCondition.java @@ -277,6 +277,29 @@ public class MZoomCondition extends X_AD_ZoomCondition implements ImmutablePOSup * @return AD_Window_ID */ public static int findZoomWindowByTableId(int AD_Table_ID, int recordID, int windowNo) + { + return findZoomWindowByTableIdOrUU(AD_Table_ID, recordID, null, windowNo); + } + + /** + * find AD_Window_ID from matching zoom condition record + * @param AD_Table_ID + * @param recordUU + * @return AD_Window_ID + */ + public static int findZoomWindowByTableUU(int AD_Table_ID, String recordUU, int windowNo) + { + return findZoomWindowByTableIdOrUU(AD_Table_ID, -1, recordUU, windowNo); + } + + /** + * find AD_Window_ID from matching zoom condition record + * @param AD_Table_ID + * @param recordID + * @param recordUU + * @return AD_Window_ID + */ + public static int findZoomWindowByTableIdOrUU(int AD_Table_ID, int recordID, String recordUU, int windowNo) { final int winNo = windowNo; MTable table = MTable.get(Env.getCtx(), AD_Table_ID); @@ -289,7 +312,11 @@ public class MZoomCondition extends X_AD_ZoomCondition implements ImmutablePOSup } }; - String whereClause = table.getTableName() + "_ID="+recordID; + String whereClause; + if (recordUU != null) + whereClause = PO.getUUIDColumnName(table.getTableName())+"="+DB.TO_STRING(recordUU); + else + whereClause = table.getTableName() + "_ID="+recordID; for (MZoomCondition condition : conditions) { if (! Util.isEmpty(condition.getZoomLogic())) { diff --git a/org.adempiere.base/src/org/compiere/model/PO.java b/org.adempiere.base/src/org/compiere/model/PO.java index 8dc80f54db..7a80604fc6 100644 --- a/org.adempiere.base/src/org/compiere/model/PO.java +++ b/org.adempiere.base/src/org/compiere/model/PO.java @@ -113,7 +113,10 @@ public abstract class PO /** * */ - private static final long serialVersionUID = 3153695115162945843L; + private static final long serialVersionUID = 1569541357840608310L; + + /* String key to create a new record based in UUID constructor */ + public static final String UUID_NEW_RECORD = ""; public static final String LOCAL_TRX_PREFIX = "POSave"; @@ -153,8 +156,8 @@ public abstract class PO /** * Create and Load existing Persistent Object - * @param ID The unique ID of the object * @param ctx context + * @param ID The unique ID of the object * @param trxName transaction name */ public PO (Properties ctx, int ID, String trxName) @@ -162,6 +165,17 @@ public abstract class PO this (ctx, ID, trxName, null, (String[]) null); } // PO + /** + * Create and Load existing Persistent Object + * @param ctx context + * @param UUID The unique UUID of the object + * @param trxName transaction name + */ + public PO (Properties ctx, String UUID, String trxName) + { + this (ctx, UUID, trxName, null, (String[]) null); + } // PO + /** * Create and load existing Persistent Object * @param ctx Context @@ -174,6 +188,18 @@ public abstract class PO this (ctx, ID, trxName, null, virtualColumns); } + /** + * Create and load existing Persistent Object + * @param ctx Context + * @param UUID Unique UUID of the object + * @param trxName Transaction name + * @param virtualColumns names of virtual columns to load along with the regular table columns + */ + public PO (Properties ctx, String UUID, String trxName, String ... virtualColumns) + { + this (ctx, UUID, trxName, null, virtualColumns); + } + /** * Create and Load existing Persistent Object. * @param ctx context @@ -228,6 +254,59 @@ public abstract class PO checkCrossTenant(false); } // PO + /** + * Create and Load existing Persistent Object. + *
+	 *  You load
+	 * 		- an existing single key record with 	new PO (ctx, Record_ID)
+	 * 			or									new PO (ctx, Record_ID, trxName)
+	 * 			or									new PO (ctx, rs, get_TrxName())
+	 * 		- a new single key record with			new PO (ctx, 0)
+	 * 		- an existing multi key record with		new PO (ctx, rs, get_TrxName())
+	 * 		- a new multi key record with			new PO (ctx, null)
+	 *  The ID for new single key records is created automatically,
+	 *  you need to set the IDs for multi-key records explicitly.
+	 *	
+ * @param ctx context + * @param UUID the UUID if "", the record defaults are applied - ignored if re exists + * @param trxName transaction name + * @param rs optional - load from current result set position (no navigation, not closed) + * @param virtualColumns optional - names of virtual columns to load along with the regular table columns + */ + public PO (Properties ctx, String UUID, String trxName, ResultSet rs, String ... virtualColumns) + { + p_ctx = ctx != null ? ctx : Env.getCtx(); + m_trxName = trxName; + + p_info = initPO(ctx); + if (p_info == null || p_info.getTableName() == null) + throw new IllegalArgumentException ("Invalid PO Info - " + p_info); + // + int size = p_info.getColumnCount(); + m_oldValues = new Object[size]; + m_newValues = new Object[size]; + m_setErrors = new ValueNamePair[size]; + m_setErrorsFilled = false; + + if (rs != null) + { + load(rs); + } + else + { + if (UUID != null && UUID.length() == 0) // new + { + initNewRecord(); + } + else + { + loadPO(UUID, trxName, virtualColumns); + } + } + + checkCrossTenant(false); + } // PO + /** * Create New PO by Copying existing (key not copied). * @param ctx context @@ -1369,13 +1448,20 @@ public abstract class PO } else // new { - loadDefaults(); - m_createNew = true; - setKeyInfo(); // sets m_IDs - loadComplete(true); + initNewRecord(); } } // load + /** + * Prepare PO for capturing of new record + */ + private void initNewRecord() { + loadDefaults(); + m_createNew = true; + setKeyInfo(); // sets m_IDs + loadComplete(true); + } + /** * Load record with UUID * @@ -1397,7 +1483,7 @@ public abstract class PO if (log.isLoggable(Level.FINEST)) log.finest("uuID=" + uuID); - load(uuID,trxName, virtualColumns); + loadPO(uuID,trxName, virtualColumns); } // loadByUU /** @@ -1407,18 +1493,20 @@ public abstract class PO * @return true if loaded */ public boolean load (String trxName, String ... virtualColumns) { - return load(null, trxName, virtualColumns); + return loadPO(null, trxName, virtualColumns); } /** - * (re)Load record with uuID - * @param uuID RecrodUU + * (re)Load record with uuID or {@link #m_IDs} + * @param uuID RecrodUU if not null, load by uuID, otherwise by m_IDs * @param trxName transaction * @param virtualColumns names of virtual columns to load along with the regular table columns * @return true if loaded */ - protected boolean load (String uuID, String trxName, String ... virtualColumns) + protected boolean loadPO (String uuID, String trxName, String ... virtualColumns) { + if (log.isLoggable(Level.FINEST)) log.finest("UU=" + uuID); + m_trxName = trxName; boolean success = true; StringBuilder sql = new StringBuilder("SELECT "); @@ -1855,12 +1943,12 @@ public abstract class PO m_KeyColumns = new String[] {ColumnName}; if (p_info.getColumnName(i).endsWith("_ID")) { - Integer ii = (Integer)get_Value(i); - if (ii == null) - m_IDs = new Object[] {I_ZERO}; - else - m_IDs = new Object[] {ii}; - if (log.isLoggable(Level.FINEST)) log.finest("(PK) " + ColumnName + "=" + ii); + Integer ii = (Integer)get_Value(i); + if (ii == null) + m_IDs = new Object[] {I_ZERO}; + else + m_IDs = new Object[] {ii}; + if (log.isLoggable(Level.FINEST)) log.finest("(PK) " + ColumnName + "=" + ii); } else { @@ -1884,31 +1972,55 @@ public abstract class PO } // Set FKs int size = columnNames.size(); - if (size == 0) - throw new IllegalStateException("No PK nor FK - " + p_info.getTableName()); - m_IDs = new Object[size]; - m_KeyColumns = new String[size]; - for (int i = 0; i < size; i++) + if (size > 0) { - m_KeyColumns[i] = (String)columnNames.get(i); - if (m_KeyColumns[i].endsWith("_ID")) + m_IDs = new Object[size]; + m_KeyColumns = new String[size]; + for (int i = 0; i < size; i++) { - Integer ii = null; - try + m_KeyColumns[i] = (String)columnNames.get(i); + if (m_KeyColumns[i].endsWith("_ID")) { - ii = (Integer)get_Value(m_KeyColumns[i]); + Integer ii = null; + try + { + ii = (Integer)get_Value(m_KeyColumns[i]); + } + catch (Exception e) + { + log.log(Level.SEVERE, "", e); + } + if (ii != null) + m_IDs[i] = ii; } - catch (Exception e) - { - log.log(Level.SEVERE, "", e); - } - if (ii != null) - m_IDs[i] = ii; + else + m_IDs[i] = get_Value(m_KeyColumns[i]); + if (log.isLoggable(Level.FINEST)) log.finest("(FK) " + m_KeyColumns[i] + "=" + m_IDs[i]); } - else - m_IDs[i] = get_Value(m_KeyColumns[i]); - if (log.isLoggable(Level.FINEST)) log.finest("(FK) " + m_KeyColumns[i] + "=" + m_IDs[i]); } + + if (m_KeyColumns == null || m_KeyColumns.length == 0) + { + // Search for UUID Key + for (int i = 0; i < p_info.getColumnCount(); i++) + { + String ColumnName = p_info.getColumnName(i); + if (ColumnName.equals(PO.getUUIDColumnName(get_TableName()))) + { + m_KeyColumns = new String[] {ColumnName}; + Object oo = get_Value(i); + if (oo == null) + m_IDs = new Object[] {null}; + else + m_IDs = new Object[] {oo}; + if (log.isLoggable(Level.FINEST)) log.finest("(UU) " + ColumnName + "=" + oo); + return; + } + } // UUID key search + } + + if (m_KeyColumns.length == 0) + throw new IllegalStateException("No PK, UU nor FK - " + p_info.getTableName()); } // setKeyInfo diff --git a/org.adempiere.base/src/org/compiere/model/SystemIDs.java b/org.adempiere.base/src/org/compiere/model/SystemIDs.java index d6155f491d..c150bc0636 100644 --- a/org.adempiere.base/src/org/compiere/model/SystemIDs.java +++ b/org.adempiere.base/src/org/compiere/model/SystemIDs.java @@ -161,6 +161,7 @@ public class SystemIDs public final static int REFERENCE_DATATYPE_TIMESTAMP_WITH_TIMEZONE = 200133; public final static int REFERENCE_DATATYPE_TIMEZONE = 200135; public final static int REFERENCE_DATATYPE_URL = 40; + public final static int REFERENCE_DATATYPE_UUID = 200231; public final static int REFERENCE_DATATYPE_YES_NO = 20; public final static int REFERENCE_ACCOUNT = 175; diff --git a/org.adempiere.base/src/org/compiere/model/X_Test.java b/org.adempiere.base/src/org/compiere/model/X_Test.java index d662f16042..56984ad82b 100644 --- a/org.adempiere.base/src/org/compiere/model/X_Test.java +++ b/org.adempiere.base/src/org/compiere/model/X_Test.java @@ -25,16 +25,16 @@ import org.compiere.util.Env; import org.compiere.util.KeyNamePair; /** Generated Model for Test - * @author iDempiere (generated) + * @author iDempiere (generated) * @version Release 11 - $Id$ */ @org.adempiere.base.Model(table="Test") -public class X_Test extends PO implements I_Test, I_Persistent +public class X_Test extends PO implements I_Test, I_Persistent { /** * */ - private static final long serialVersionUID = 20230216L; + private static final long serialVersionUID = 20230318L; /** Standard Constructor */ public X_Test (Properties ctx, int Test_ID, String trxName) @@ -58,6 +58,28 @@ public class X_Test extends PO implements I_Test, I_Persistent } */ } + /** Standard Constructor */ + public X_Test (Properties ctx, String Test_UU, String trxName) + { + super (ctx, Test_UU, trxName); + /** if (Test_UU == null) + { + setName (null); + setTest_ID (0); + } */ + } + + /** Standard Constructor */ + public X_Test (Properties ctx, String Test_UU, String trxName, String ... virtualColumns) + { + super (ctx, Test_UU, trxName, virtualColumns); + /** if (Test_UU == null) + { + setName (null); + setTest_ID (0); + } */ + } + /** Load Constructor */ public X_Test (Properties ctx, ResultSet rs, String trxName) { @@ -435,7 +457,7 @@ public class X_Test extends PO implements I_Test, I_Persistent /** Get Record ID/ColumnName @return ID/ColumnName pair */ - public KeyNamePair getKeyNamePair() + public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), getName()); } @@ -454,10 +476,10 @@ public class X_Test extends PO implements I_Test, I_Persistent public boolean isProcessed() { Object oo = get_Value(COLUMNNAME_Processed); - if (oo != null) + if (oo != null) { - if (oo instanceof Boolean) - return ((Boolean)oo).booleanValue(); + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; @@ -476,10 +498,10 @@ public class X_Test extends PO implements I_Test, I_Persistent public boolean isProcessing() { Object oo = get_Value(COLUMNNAME_Processing); - if (oo != null) + if (oo != null) { - if (oo instanceof Boolean) - return ((Boolean)oo).booleanValue(); + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; diff --git a/org.adempiere.base/src/org/compiere/model/X_TestUU.java b/org.adempiere.base/src/org/compiere/model/X_TestUU.java new file mode 100644 index 0000000000..8cf33fe5e5 --- /dev/null +++ b/org.adempiere.base/src/org/compiere/model/X_TestUU.java @@ -0,0 +1,161 @@ +/****************************************************************************** + * Product: iDempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. * + * 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. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +/** Generated Model - DO NOT CHANGE */ +package org.compiere.model; + +import java.sql.ResultSet; +import java.util.Properties; + +/** Generated Model for TestUU + * @author iDempiere (generated) + * @version Release 11 - $Id$ */ +@org.adempiere.base.Model(table="TestUU") +public class X_TestUU extends PO implements I_TestUU, I_Persistent +{ + + /** + * + */ + private static final long serialVersionUID = 20230318L; + + /** Standard Constructor */ + public X_TestUU (Properties ctx, String TestUU_UU, String trxName) + { + super (ctx, TestUU_UU, trxName); + /** if (TestUU_UU == null) + { + setName (null); + } */ + } + + /** Standard Constructor */ + public X_TestUU (Properties ctx, String TestUU_UU, String trxName, String ... virtualColumns) + { + super (ctx, TestUU_UU, trxName, virtualColumns); + /** if (TestUU_UU == null) + { + setName (null); + } */ + } + + /** Load Constructor */ + public X_TestUU (Properties ctx, ResultSet rs, String trxName) + { + super (ctx, rs, trxName); + } + + /** AccessLevel + * @return 7 - System - Client - Org + */ + protected int get_AccessLevel() + { + return accessLevel.intValue(); + } + + /** Load Meta Data */ + protected POInfo initPO (Properties ctx) + { + POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); + return poi; + } + + public String toString() + { + StringBuilder sb = new StringBuilder ("X_TestUU[") + .append(get_UUID()).append(",Name=").append(getName()).append("]"); + return sb.toString(); + } + + /** Set Description. + @param Description Optional short description of the record + */ + public void setDescription (String Description) + { + set_Value (COLUMNNAME_Description, Description); + } + + /** Get Description. + @return Optional short description of the record + */ + public String getDescription() + { + return (String)get_Value(COLUMNNAME_Description); + } + + /** Set Comment/Help. + @param Help Comment or Hint + */ + public void setHelp (String Help) + { + set_Value (COLUMNNAME_Help, Help); + } + + /** Get Comment/Help. + @return Comment or Hint + */ + public String getHelp() + { + return (String)get_Value(COLUMNNAME_Help); + } + + /** Set Name. + @param Name Alphanumeric identifier of the entity + */ + public void setName (String Name) + { + set_Value (COLUMNNAME_Name, Name); + } + + /** Get Name. + @return Alphanumeric identifier of the entity + */ + public String getName() + { + return (String)get_Value(COLUMNNAME_Name); + } + + /** Set TestUU_UU. + @param TestUU_UU TestUU_UU + */ + public void setTestUU_UU (String TestUU_UU) + { + set_Value (COLUMNNAME_TestUU_UU, TestUU_UU); + } + + /** Get TestUU_UU. + @return TestUU_UU */ + public String getTestUU_UU() + { + return (String)get_Value(COLUMNNAME_TestUU_UU); + } + + /** Set Search Key. + @param Value Search key for the record in the format required - must be unique + */ + public void setValue (String Value) + { + set_Value (COLUMNNAME_Value, Value); + } + + /** Get Search Key. + @return Search key for the record in the format required - must be unique + */ + public String getValue() + { + return (String)get_Value(COLUMNNAME_Value); + } +} \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/util/DisplayType.java b/org.adempiere.base/src/org/compiere/util/DisplayType.java index 13a7766842..5a82e15a0f 100644 --- a/org.adempiere.base/src/org/compiere/util/DisplayType.java +++ b/org.adempiere.base/src/org/compiere/util/DisplayType.java @@ -59,6 +59,7 @@ import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_TIME; import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_TIMESTAMP_WITH_TIMEZONE; import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_TIMEZONE; import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_URL; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_UUID; import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_YES_NO; import java.text.DateFormat; @@ -155,6 +156,8 @@ public final class DisplayType public static final int FileName = REFERENCE_DATATYPE_FILENAME; /** Display Type 40 URL */ public static final int URL = REFERENCE_DATATYPE_URL; + /** Display Type 200231 UUID */ + public static final int UUID = REFERENCE_DATATYPE_UUID; /** Display Type 42 PrinterName */ public static final int PrinterName = REFERENCE_DATATYPE_PRINTNAME; // Candidates: @@ -362,7 +365,8 @@ public final class DisplayType || displayType == ChosenMultipleSelectionList || displayType == ChosenMultipleSelectionTable || displayType == ChosenMultipleSelectionSearch - || displayType == TimeZoneId) + || displayType == TimeZoneId + || displayType == UUID) return true; //not custom type, don't have to check factory @@ -1084,6 +1088,8 @@ public final class DisplayType return "Payment"; if (displayType == Chart) return "Chart"; + if (displayType == UUID) + return "UUID"; IServiceReferenceHolder cache = s_displayTypeFactoryCache.get(displayType); if (cache != null) { diff --git a/org.adempiere.base/src/org/compiere/util/Env.java b/org.adempiere.base/src/org/compiere/util/Env.java index 0339535174..fa053a5d23 100644 --- a/org.adempiere.base/src/org/compiere/util/Env.java +++ b/org.adempiere.base/src/org/compiere/util/Env.java @@ -2110,6 +2110,15 @@ public final class Env return AD_Window_ID; } + public static int getZoomWindowUU(int AD_Table_ID, String Record_UU) { + return getZoomWindowUU(AD_Table_ID, Record_UU, 0); + } + + public static int getZoomWindowUU(int AD_Table_ID, String Record_UU, int windowNo) + { + return getZoomWindowIDOrUU(AD_Table_ID, -1, Record_UU, windowNo); + } + public static int getZoomWindowID(int AD_Table_ID, int Record_ID) { return getZoomWindowID(AD_Table_ID, Record_ID, 0); @@ -2117,7 +2126,12 @@ public final class Env public static int getZoomWindowID(int AD_Table_ID, int Record_ID, int windowNo) { - int AD_Window_ID = MZoomCondition.findZoomWindowByTableId(AD_Table_ID, Record_ID, windowNo); + return getZoomWindowIDOrUU(AD_Table_ID, Record_ID, null, windowNo); + } + + private static int getZoomWindowIDOrUU(int AD_Table_ID, int Record_ID, String Record_UU, int windowNo) + { + int AD_Window_ID = MZoomCondition.findZoomWindowByTableIdOrUU(AD_Table_ID, Record_ID, Record_UU, windowNo); if (AD_Window_ID <= 0) { MTable table = MTable.get(Env.getCtx(), AD_Table_ID); @@ -2133,13 +2147,17 @@ public final class Env boolean isSOTrx = true; if (table.getPO_Window_ID() != 0) { - String whereClause = table.getTableName() + "_ID=" + Record_ID; + String whereClause; + if (Record_UU != null) + whereClause = PO.getUUIDColumnName(table.getTableName()) + "=" + DB.TO_STRING(Record_UU); + else + whereClause = table.getTableName() + "_ID=" + Record_ID; isSOTrx = DB.isSOTrx(table.getTableName(), whereClause, windowNo); if (!isSOTrx) AD_Window_ID = table.getPO_Window_ID(); } - if (log.isLoggable(Level.CONFIG)) log.config(table.getTableName() + " - Record_ID=" + Record_ID + " (IsSOTrx=" + isSOTrx + ")"); + if (log.isLoggable(Level.CONFIG)) log.config(table.getTableName() + " - Record_ID=" + Record_ID + " - Record_UU=" + Record_UU + " (IsSOTrx=" + isSOTrx + ")"); } return AD_Window_ID; } @@ -2252,4 +2270,5 @@ public final class Env } return false; } + } // Env \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/util/Util.java b/org.adempiere.base/src/org/compiere/util/Util.java index 06e31addfe..9bcace9f17 100644 --- a/org.adempiere.base/src/org/compiere/util/Util.java +++ b/org.adempiere.base/src/org/compiere/util/Util.java @@ -766,4 +766,15 @@ public class Util return output.trim(); } + private final static String UUID_REGEX="[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"; + + /** + * @param value + * @return true if value is a uuid identifier + */ + public static boolean isUUID(String value) + { + return value == null ? false : value.matches(UUID_REGEX); + } + } // Util diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java index c0dad29883..87fd3229db 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java @@ -382,19 +382,29 @@ public class AdempiereWebUI extends Window implements EventListener, IWeb private void processParameters() { String action = getPrmString("Action"); if ("Zoom".equalsIgnoreCase(action)) { + MTable table = null; int tableID = getPrmInt("AD_Table_ID"); if (tableID == 0) { String tableName = getPrmString("TableName"); if (!Util.isEmpty(tableName)) { - MTable table = MTable.get(Env.getCtx(), tableName); + table = MTable.get(Env.getCtx(), tableName); if (table != null) { tableID = table.getAD_Table_ID(); } } + } else { + table = MTable.get(Env.getCtx(), tableID); } - int recordID = getPrmInt("Record_ID"); - if (tableID > 0) { - AEnv.zoom(tableID, recordID); + if (table != null) { + String recordUU = getPrmString("Record_UU"); + if (!Util.isEmpty(recordUU)) { + AEnv.zoomUU(tableID, recordUU); + } else { + int recordID = getPrmInt("Record_ID"); + if (tableID > 0) { + AEnv.zoom(tableID, recordID); + } + } } } m_URLParameters = null; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java index b9c4a6799e..f05ec0026a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java @@ -176,6 +176,25 @@ public final class AEnv zoom(AD_Window_ID, query); } // zoom + /************************************************************************* + * Zoom to AD Window by AD_Table_ID and Record_UU. + * @param AD_Table_ID + * @param Record_UU + */ + public static void zoomUU(int AD_Table_ID, String Record_UU) + { + int AD_Window_ID = Env.getZoomWindowUU(AD_Table_ID, Record_UU); + // Nothing to Zoom to + if (AD_Window_ID == 0) + return; + MTable table = MTable.get(Env.getCtx(), AD_Table_ID); + MQuery query = MQuery.getEqualQuery(PO.getUUIDColumnName(table.getTableName()), Record_UU); + query.setZoomTableName(table.getTableName()); + query.setZoomColumnName(table.getUUIDColumnName()); + query.setZoomValue(Record_UU); + zoom(AD_Window_ID, query); + } // zoom + /************************************************************************* * Zoom to AD Window by AD_Table_ID and Record_ID. * @param AD_Table_ID @@ -892,6 +911,15 @@ public final class AEnv return m_ApplicationUrl; } + /** + * @param po + * @return URL link for direct access to the record using AD_Table_ID+Record_UUID + */ + public static String getZoomUrlTableUU(PO po) + { + return getApplicationUrl() + "?Action=Zoom&AD_Table_ID=" + po.get_Table_ID() + "&Record_UU=" + po.get_UUID(); + } + /** * @param po * @return URL link for direct access to the record using AD_Table_ID+Record_ID diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WRecordInfo.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WRecordInfo.java index 42ed2272ce..ce9af85c58 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WRecordInfo.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WRecordInfo.java @@ -317,8 +317,6 @@ public class WRecordInfo extends Window implements EventListener int Record_ID = -1; if (dse.Record_ID instanceof Integer) Record_ID = ((Integer)dse.Record_ID).intValue(); - else - log.info("dynInit - Invalid Record_ID=" + dse.Record_ID); MTable dbtable = null; if (dse.AD_Table_ID != 0) @@ -332,6 +330,7 @@ public class WRecordInfo extends Window implements EventListener String uuid = null; if (po.is_new()) { if (Record_ID == 0 && MTable.isZeroIDTable(dbtable.getTableName())) { + // Need to read the UUID directly from database because the PO cannot be used with zero ID records StringBuilder sql = new StringBuilder("SELECT ") .append(uuidcol) .append(" FROM ") @@ -342,14 +341,18 @@ public class WRecordInfo extends Window implements EventListener uuid = DB.getSQLValueString(null, sql.toString()); } } else { - uuid = po.get_ValueAsString(uuidcol); + uuid = po.get_UUID(); } if (!Util.isEmpty(uuid)) m_info.append("\n ").append(uuidcol).append("=").append(uuid); if (po.get_KeyColumns().length == 1) { + String ticketURL; + if (Record_ID <= 0) + ticketURL = AEnv.getZoomUrlTableUU(po); + else + ticketURL = AEnv.getZoomUrlTableID(po); m_permalink.addEventListener(Events.ON_CLICK, new EventListener() { public void onEvent(Event event) throws Exception { - String ticketURL = AEnv.getZoomUrlTableID(po); StringBuffer sb = new StringBuffer("navigator.clipboard.writeText(\"") .append(ticketURL) .append("\");"); @@ -359,12 +362,13 @@ public class WRecordInfo extends Window implements EventListener }); } m_permalink.setVisible(po.get_KeyColumns().length == 1); + final String whereClause = po.get_WhereClause(true, uuid); m_copySelect.addEventListener(Events.ON_CLICK, new EventListener() { public void onEvent(Event event) throws Exception { StringBuffer query = new StringBuffer("navigator.clipboard.writeText(\"SELECT * FROM ") .append(po.get_TableName()) .append(" WHERE ") - .append(po.get_WhereClause(true)); + .append(whereClause); query.append("\");"); Clients.evalJavaScript(query.toString()); Notification.show(Msg.getMsg(Env.getCtx(), "Copied"), Notification.TYPE_INFO, m_copySelect, "end_before", 1000); diff --git a/org.idempiere.test/src/org/idempiere/test/model/MTestUUTest.java b/org.idempiere.test/src/org/idempiere/test/model/MTestUUTest.java new file mode 100644 index 0000000000..f275e26c2f --- /dev/null +++ b/org.idempiere.test/src/org/idempiere/test/model/MTestUUTest.java @@ -0,0 +1,89 @@ +/*********************************************************************** + * This file is part of iDempiere ERP Open Source * + * http://www.idempiere.org * + * * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * 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., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Carlos Ruiz - globalqss - bxservice * + **********************************************************************/ + +package org.idempiere.test.model; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.Properties; + +import org.compiere.model.MTestUU; +import org.compiere.model.PO; +import org.compiere.util.Env; +import org.compiere.util.Util; +import org.idempiere.test.AbstractTestCase; +import org.junit.jupiter.api.Test; + +/** + * + * @author Carlos Ruiz - globalqss - bxservice + * + */ +public class MTestUUTest extends AbstractTestCase { + + private static final String TestRecordInGardenWorld = "8858ecc2-cf1d-405f-987f-793536037e76"; + + public MTestUUTest() { + } + + @Test + public void testReadingUpdatingTestUU() { + Properties ctx = Env.getCtx(); + String trxName = getTrxName(); + MTestUU testuu = new MTestUU(ctx, TestRecordInGardenWorld, trxName); + testuu.setDescription("Test setting description"); + testuu.saveEx(); + testuu.load(trxName); + assertEquals("Test setting description", testuu.getDescription()); + } + + @Test + public void testInsertingTestUU() { + Properties ctx = Env.getCtx(); + String trxName = getTrxName(); + MTestUU testuu = new MTestUU(ctx, PO.UUID_NEW_RECORD, trxName); + testuu.setName("Test UU record created on JUnit test"); + testuu.saveEx(); + testuu.load(trxName); + assertEquals("Test UU record created on JUnit test", testuu.getName()); + String uukey = testuu.getTestUU_UU(); + String uuid = testuu.get_UUID(); + assertTrue(Util.isUUID(uukey)); + assertEquals(uukey, uuid); + } + + @Test + public void testDeletingTestUU() { + Properties ctx = Env.getCtx(); + String trxName = getTrxName(); + MTestUU testuu = new MTestUU(ctx, TestRecordInGardenWorld, trxName); + testuu.deleteEx(true); + MTestUU testuu2 = new MTestUU(ctx, TestRecordInGardenWorld, trxName); + assertFalse(testuu2.get_UUID().equals(TestRecordInGardenWorld)); + } + +} diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ADLookup.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ADLookup.java index a7dd96e098..8ad9f86c4d 100644 --- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ADLookup.java +++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ADLookup.java @@ -23,6 +23,7 @@ import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.KeyNamePair; +import org.compiere.util.Util; import org.compiere.util.ValueNamePair; import org.idempiere.adInterface.x10.LookupValue; import org.idempiere.adInterface.x10.LookupValues; @@ -97,7 +98,7 @@ public class ADLookup { m_keyColumnName = m_columnName; } - if (isUUID(text)) + if (Util.isUUID(text)) { sql.append("SELECT ").append(m_keyColumnName).append(" FROM ").append(m_tableName) .append(" WHERE ").append(m_tableName).append("_UU=").append(DB.TO_STRING(text.toLowerCase())); @@ -346,14 +347,4 @@ public class ADLookup { return whereClause; } // getWhereClause - private final static String UUID_REGEX="[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"; - - /** - * @param value - * @return true if value is a uuid identifier - */ - public static boolean isUUID(String value) - { - return value == null ? false : value.matches(UUID_REGEX); - } } diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java index 044d2505e0..ebbc844c44 100644 --- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java +++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java @@ -355,7 +355,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic return -1; if (string.equals(io.toString())) return i; - if (parameterName.endsWith("_ID") && ADLookup.isUUID(string)) { + if (parameterName.endsWith("_ID") && Util.isUUID(string)) { String tableName = parameterName.substring(0, parameterName.length()-3); StringBuilder sql = new StringBuilder("SELECT "); sql.append(parameterName).append(" FROM ").append(tableName) @@ -454,7 +454,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic if (xmlInt != null) { // String xml <...> blocks String content = xmlInt.toString().replaceAll("<[^>]*>", ""); - if (! Util.isEmpty(content, true) && ADLookup.isUUID(content)) + if (! Util.isEmpty(content, true) && Util.isUUID(content)) return content; }