IDEMPIERE-5835 - disallow multiple executions by any user (#1977)

* IDEMPIERE-5835 - disallow multiple executions by any user

* IDEMPIERE-5835 - renaming flags

* IDEMPIERE-5835 - applying terminology patch
This commit is contained in:
matheus-marcelinux 2023-11-03 18:53:05 -03:00 committed by GitHub
parent f0f5823691
commit 23b738df5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 299 additions and 24 deletions

View File

@ -0,0 +1,126 @@
-- IDEMPIERE-5835
SELECT register_migration_script('202308241336_IDEMPIERE-5835.sql') FROM dual;
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Aug 24, 2023, 1:36:54 PM BRT
UPDATE AD_Ref_List SET Name='Disallow multiple executions with the same parameters & user', Description='Allow to execute a process multiple times with different parameters and same user',Updated=TO_TIMESTAMP('2023-08-24 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200441
;
-- Aug 24, 2023, 1:37:12 PM BRT
UPDATE AD_Ref_List SET Name='Disallow multiple executions by same user',Updated=TO_TIMESTAMP('2023-08-24 13:37:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200440
;
-- Aug 24, 2023, 1:37:20 PM BRT
UPDATE AD_Ref_List SET Description='Never allow to execute a process that is already running by the same user',Updated=TO_TIMESTAMP('2023-08-24 13:37:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200440
;
-- Aug 24, 2023, 1:38:20 PM BRT
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,Description,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200646,'Disallow multiple executions any user','Never allow to execute a process that is already running by any user',200158,'NA',0,0,'Y',TO_TIMESTAMP('2023-08-24 13:38:19','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-08-24 13:38:19','YYYY-MM-DD HH24:MI:SS'),100,'D','8911db76-92ef-4c9b-9482-442cf31a2fc4')
;
-- Aug 24, 2023, 1:39:40 PM BRT
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,Description,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200647,'Disallow multiple execution with the same parameter any user','Allow to execute a process multiple times with different parameters by any user',200158,'PA',0,0,'Y',TO_TIMESTAMP('2023-08-24 13:39:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-08-24 13:39:40','YYYY-MM-DD HH24:MI:SS'),100,'D','d13ecbd0-370f-4935-826b-2ae7313add8a')
;
-- Aug 24, 2023, 2:13:12 PM BRT
UPDATE AD_Column SET FieldLength=2,Updated=TO_TIMESTAMP('2023-08-24 14:13:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213699
;
-- Aug 24, 2023, 2:13:16 PM BRT
ALTER TABLE AD_Process MODIFY AllowMultipleExecution VARCHAR2(2 CHAR) DEFAULT 'P'
;
-- Sep 11, 2023, 12:26:16 PM CEST
UPDATE AD_Element SET Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help='When blank: Allows to execute a process concurrently.', PrintName='Allow Concurrent Execution',Updated=TO_TIMESTAMP('2023-09-11 12:26:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=203269
;
-- Sep 11, 2023, 12:26:16 PM CEST
UPDATE AD_Column SET ColumnName='AllowMultipleExecution', Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help='When blank: Allows to execute a process concurrently.', Placeholder=NULL WHERE AD_Element_ID=203269
;
-- Sep 11, 2023, 12:26:16 PM CEST
UPDATE AD_Process_Para SET ColumnName='AllowMultipleExecution', Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help='When blank: Allows to execute a process concurrently.', AD_Element_ID=203269 WHERE UPPER(ColumnName)='ALLOWMULTIPLEEXECUTION' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 11, 2023, 12:26:16 PM CEST
UPDATE AD_Process_Para SET ColumnName='AllowMultipleExecution', Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help='When blank: Allows to execute a process concurrently.', Placeholder=NULL WHERE AD_Element_ID=203269 AND IsCentrallyMaintained='Y'
;
-- Sep 11, 2023, 12:26:16 PM CEST
UPDATE AD_InfoColumn SET ColumnName='AllowMultipleExecution', Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help='When blank: Allows to execute a process concurrently.', Placeholder=NULL WHERE AD_Element_ID=203269 AND IsCentrallyMaintained='Y'
;
-- Sep 11, 2023, 12:26:16 PM CEST
UPDATE AD_Field SET Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help='When blank: Allows to execute a process concurrently.', Placeholder=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=203269) AND IsCentrallyMaintained='Y'
;
-- Sep 11, 2023, 12:26:16 PM CEST
UPDATE AD_PrintFormatItem SET PrintName='Allow Concurrent Execution', Name='Allow Concurrent Execution' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=203269)
;
-- Sep 11, 2023, 12:27:29 PM CEST
UPDATE AD_Ref_List SET Name='Not from same user', Description='Do not allow to execute a process that is already running by the same user',Updated=TO_TIMESTAMP('2023-09-11 12:27:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200440
;
-- Sep 11, 2023, 12:27:48 PM CEST
UPDATE AD_Ref_List SET Name='Not from any user', Description='Do not allow to execute a process that is already running by any user',Updated=TO_TIMESTAMP('2023-09-11 12:27:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200646
;
-- Sep 11, 2023, 12:28:44 PM CEST
UPDATE AD_Ref_List SET Name='Not same user and parameters', Description='Do not allow to execute a process concurrently with same parameters and same user',Updated=TO_TIMESTAMP('2023-09-11 12:28:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200441
;
-- Sep 11, 2023, 12:28:48 PM CEST
UPDATE AD_Ref_List SET Name='Not from same user and parameters',Updated=TO_TIMESTAMP('2023-09-11 12:28:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200441
;
-- Sep 11, 2023, 12:29:17 PM CEST
UPDATE AD_Ref_List SET Name='Not from any user and same parameters', Description='Do not allow to execute a process concurrently with same parameters from any user',Updated=TO_TIMESTAMP('2023-09-11 12:29:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200647
;
-- Sep 11, 2023, 12:31:35 PM CEST
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,Description,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200648,'Yes','Allow concurrent execution',200158,'Y',0,0,'Y',TO_TIMESTAMP('2023-09-11 12:31:35','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-09-11 12:31:35','YYYY-MM-DD HH24:MI:SS'),100,'D','832cb3cb-d520-4c5d-98e5-a302f0fa0f39')
;
-- Sep 11, 2023, 12:32:49 PM CEST
UPDATE AD_Element SET Help=NULL,Updated=TO_TIMESTAMP('2023-09-11 12:32:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=203269
;
-- Sep 11, 2023, 12:32:49 PM CEST
UPDATE AD_Column SET ColumnName='AllowMultipleExecution', Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help=NULL, Placeholder=NULL WHERE AD_Element_ID=203269
;
-- Sep 11, 2023, 12:32:49 PM CEST
UPDATE AD_Process_Para SET ColumnName='AllowMultipleExecution', Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help=NULL, AD_Element_ID=203269 WHERE UPPER(ColumnName)='ALLOWMULTIPLEEXECUTION' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 11, 2023, 12:32:49 PM CEST
UPDATE AD_Process_Para SET ColumnName='AllowMultipleExecution', Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help=NULL, Placeholder=NULL WHERE AD_Element_ID=203269 AND IsCentrallyMaintained='Y'
;
-- Sep 11, 2023, 12:32:49 PM CEST
UPDATE AD_InfoColumn SET ColumnName='AllowMultipleExecution', Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help=NULL, Placeholder=NULL WHERE AD_Element_ID=203269 AND IsCentrallyMaintained='Y'
;
-- Sep 11, 2023, 12:32:49 PM CEST
UPDATE AD_Field SET Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help=NULL, Placeholder=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=203269) AND IsCentrallyMaintained='Y'
;
-- Sep 11, 2023, 12:33:33 PM CEST
UPDATE AD_Column SET IsMandatory='Y',Updated=TO_TIMESTAMP('2023-09-11 12:33:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213699
;
-- Sep 11, 2023, 12:33:37 PM CEST
ALTER TABLE AD_Process MODIFY AllowMultipleExecution VARCHAR2(2 CHAR) DEFAULT 'P'
;
-- Sep 11, 2023, 12:33:37 PM CEST
UPDATE AD_Process SET AllowMultipleExecution='Y' WHERE AllowMultipleExecution IS NULL
;
-- Sep 11, 2023, 12:33:37 PM CEST
ALTER TABLE AD_Process MODIFY AllowMultipleExecution NOT NULL
;

View File

@ -0,0 +1,123 @@
-- IDEMPIERE-5835
SELECT register_migration_script('202308241336_IDEMPIERE-5835.sql') FROM dual;
-- Aug 24, 2023, 1:36:54 PM BRT
UPDATE AD_Ref_List SET Name='Disallow multiple executions with the same parameters & user', Description='Allow to execute a process multiple times with different parameters and same user',Updated=TO_TIMESTAMP('2023-08-24 13:36:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200441
;
-- Aug 24, 2023, 1:37:12 PM BRT
UPDATE AD_Ref_List SET Name='Disallow multiple executions by same user',Updated=TO_TIMESTAMP('2023-08-24 13:37:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200440
;
-- Aug 24, 2023, 1:37:20 PM BRT
UPDATE AD_Ref_List SET Description='Never allow to execute a process that is already running by the same user',Updated=TO_TIMESTAMP('2023-08-24 13:37:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200440
;
-- Aug 24, 2023, 1:38:20 PM BRT
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,Description,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200646,'Disallow multiple executions any user','Never allow to execute a process that is already running by any user',200158,'NA',0,0,'Y',TO_TIMESTAMP('2023-08-24 13:38:19','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-08-24 13:38:19','YYYY-MM-DD HH24:MI:SS'),100,'D','8911db76-92ef-4c9b-9482-442cf31a2fc4')
;
-- Aug 24, 2023, 1:39:40 PM BRT
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,Description,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200647,'Disallow multiple execution with the same parameter any user','Allow to execute a process multiple times with different parameters by any user',200158,'PA',0,0,'Y',TO_TIMESTAMP('2023-08-24 13:39:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-08-24 13:39:40','YYYY-MM-DD HH24:MI:SS'),100,'D','d13ecbd0-370f-4935-826b-2ae7313add8a')
;
-- Aug 24, 2023, 2:13:12 PM BRT
UPDATE AD_Column SET FieldLength=2,Updated=TO_TIMESTAMP('2023-08-24 14:13:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213699
;
-- Aug 24, 2023, 2:13:16 PM BRT
INSERT INTO t_alter_column values('ad_process','AllowMultipleExecution','VARCHAR(2)',null,'P')
;
-- Sep 11, 2023, 12:26:16 PM CEST
UPDATE AD_Element SET Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help='When blank: Allows to execute a process concurrently.', PrintName='Allow Concurrent Execution',Updated=TO_TIMESTAMP('2023-09-11 12:26:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=203269
;
-- Sep 11, 2023, 12:26:16 PM CEST
UPDATE AD_Column SET ColumnName='AllowMultipleExecution', Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help='When blank: Allows to execute a process concurrently.', Placeholder=NULL WHERE AD_Element_ID=203269
;
-- Sep 11, 2023, 12:26:16 PM CEST
UPDATE AD_Process_Para SET ColumnName='AllowMultipleExecution', Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help='When blank: Allows to execute a process concurrently.', AD_Element_ID=203269 WHERE UPPER(ColumnName)='ALLOWMULTIPLEEXECUTION' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 11, 2023, 12:26:16 PM CEST
UPDATE AD_Process_Para SET ColumnName='AllowMultipleExecution', Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help='When blank: Allows to execute a process concurrently.', Placeholder=NULL WHERE AD_Element_ID=203269 AND IsCentrallyMaintained='Y'
;
-- Sep 11, 2023, 12:26:16 PM CEST
UPDATE AD_InfoColumn SET ColumnName='AllowMultipleExecution', Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help='When blank: Allows to execute a process concurrently.', Placeholder=NULL WHERE AD_Element_ID=203269 AND IsCentrallyMaintained='Y'
;
-- Sep 11, 2023, 12:26:16 PM CEST
UPDATE AD_Field SET Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help='When blank: Allows to execute a process concurrently.', Placeholder=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=203269) AND IsCentrallyMaintained='Y'
;
-- Sep 11, 2023, 12:26:16 PM CEST
UPDATE AD_PrintFormatItem SET PrintName='Allow Concurrent Execution', Name='Allow Concurrent Execution' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=203269)
;
-- Sep 11, 2023, 12:27:29 PM CEST
UPDATE AD_Ref_List SET Name='Not from same user', Description='Do not allow to execute a process that is already running by the same user',Updated=TO_TIMESTAMP('2023-09-11 12:27:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200440
;
-- Sep 11, 2023, 12:27:48 PM CEST
UPDATE AD_Ref_List SET Name='Not from any user', Description='Do not allow to execute a process that is already running by any user',Updated=TO_TIMESTAMP('2023-09-11 12:27:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200646
;
-- Sep 11, 2023, 12:28:44 PM CEST
UPDATE AD_Ref_List SET Name='Not same user and parameters', Description='Do not allow to execute a process concurrently with same parameters and same user',Updated=TO_TIMESTAMP('2023-09-11 12:28:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200441
;
-- Sep 11, 2023, 12:28:48 PM CEST
UPDATE AD_Ref_List SET Name='Not from same user and parameters',Updated=TO_TIMESTAMP('2023-09-11 12:28:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200441
;
-- Sep 11, 2023, 12:29:17 PM CEST
UPDATE AD_Ref_List SET Name='Not from any user and same parameters', Description='Do not allow to execute a process concurrently with same parameters from any user',Updated=TO_TIMESTAMP('2023-09-11 12:29:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200647
;
-- Sep 11, 2023, 12:31:35 PM CEST
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,Description,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200648,'Yes','Allow concurrent execution',200158,'Y',0,0,'Y',TO_TIMESTAMP('2023-09-11 12:31:35','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-09-11 12:31:35','YYYY-MM-DD HH24:MI:SS'),100,'D','832cb3cb-d520-4c5d-98e5-a302f0fa0f39')
;
-- Sep 11, 2023, 12:32:49 PM CEST
UPDATE AD_Element SET Help=NULL,Updated=TO_TIMESTAMP('2023-09-11 12:32:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=203269
;
-- Sep 11, 2023, 12:32:49 PM CEST
UPDATE AD_Column SET ColumnName='AllowMultipleExecution', Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help=NULL, Placeholder=NULL WHERE AD_Element_ID=203269
;
-- Sep 11, 2023, 12:32:49 PM CEST
UPDATE AD_Process_Para SET ColumnName='AllowMultipleExecution', Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help=NULL, AD_Element_ID=203269 WHERE UPPER(ColumnName)='ALLOWMULTIPLEEXECUTION' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 11, 2023, 12:32:49 PM CEST
UPDATE AD_Process_Para SET ColumnName='AllowMultipleExecution', Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help=NULL, Placeholder=NULL WHERE AD_Element_ID=203269 AND IsCentrallyMaintained='Y'
;
-- Sep 11, 2023, 12:32:49 PM CEST
UPDATE AD_InfoColumn SET ColumnName='AllowMultipleExecution', Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help=NULL, Placeholder=NULL WHERE AD_Element_ID=203269 AND IsCentrallyMaintained='Y'
;
-- Sep 11, 2023, 12:32:49 PM CEST
UPDATE AD_Field SET Name='Allow Concurrent Execution', Description='Allow or disallow executing a process/report multiple times concurrently', Help=NULL, Placeholder=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=203269) AND IsCentrallyMaintained='Y'
;
-- Sep 11, 2023, 12:33:33 PM CEST
UPDATE AD_Column SET IsMandatory='Y',Updated=TO_TIMESTAMP('2023-09-11 12:33:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213699
;
-- Sep 11, 2023, 12:33:37 PM CEST
INSERT INTO t_alter_column values('ad_process','AllowMultipleExecution','VARCHAR(2)',null,'P')
;
-- Sep 11, 2023, 12:33:37 PM CEST
UPDATE AD_Process SET AllowMultipleExecution='Y' WHERE AllowMultipleExecution IS NULL
;
-- Sep 11, 2023, 12:33:37 PM CEST
INSERT INTO t_alter_column values('ad_process','AllowMultipleExecution',null,'NOT NULL',null)
;

View File

@ -171,13 +171,13 @@ public interface I_AD_Process
/** Column name AllowMultipleExecution */
public static final String COLUMNNAME_AllowMultipleExecution = "AllowMultipleExecution";
/** Set Multiple Execution.
* Allow or disallow executing a process/report multiple times.
/** Set Allow Concurrent Execution.
* Allow or disallow executing a process/report multiple times concurrently
*/
public void setAllowMultipleExecution (String AllowMultipleExecution);
/** Get Multiple Execution.
* Allow or disallow executing a process/report multiple times.
/** Get Allow Concurrent Execution.
* Allow or disallow executing a process/report multiple times concurrently
*/
public String getAllowMultipleExecution();

View File

@ -31,7 +31,7 @@ public class X_AD_Process extends PO implements I_AD_Process, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20230409L;
private static final long serialVersionUID = 20230911L;
/** Standard Constructor */
public X_AD_Process (Properties ctx, int AD_Process_ID, String trxName)
@ -41,6 +41,8 @@ public class X_AD_Process extends PO implements I_AD_Process, I_Persistent
{
setAccessLevel (null);
setAD_Process_ID (0);
setAllowMultipleExecution (null);
// P
setEntityType (null);
// @SQL=SELECT CASE WHEN '@P|AdempiereSys:N@'='Y' THEN 'D' ELSE get_sysconfig('DEFAULT_ENTITYTYPE','U',0,0) END FROM Dual
setIsBetaFunctionality (false);
@ -58,6 +60,8 @@ public class X_AD_Process extends PO implements I_AD_Process, I_Persistent
{
setAccessLevel (null);
setAD_Process_ID (0);
setAllowMultipleExecution (null);
// P
setEntityType (null);
// @SQL=SELECT CASE WHEN '@P|AdempiereSys:N@'='Y' THEN 'D' ELSE get_sysconfig('DEFAULT_ENTITYTYPE','U',0,0) END FROM Dual
setIsBetaFunctionality (false);
@ -75,6 +79,8 @@ public class X_AD_Process extends PO implements I_AD_Process, I_Persistent
{
setAccessLevel (null);
setAD_Process_ID (0);
setAllowMultipleExecution (null);
// P
setEntityType (null);
// @SQL=SELECT CASE WHEN '@P|AdempiereSys:N@'='Y' THEN 'D' ELSE get_sysconfig('DEFAULT_ENTITYTYPE','U',0,0) END FROM Dual
setIsBetaFunctionality (false);
@ -92,6 +98,8 @@ public class X_AD_Process extends PO implements I_AD_Process, I_Persistent
{
setAccessLevel (null);
setAD_Process_ID (0);
setAllowMultipleExecution (null);
// P
setEntityType (null);
// @SQL=SELECT CASE WHEN '@P|AdempiereSys:N@'='Y' THEN 'D' ELSE get_sysconfig('DEFAULT_ENTITYTYPE','U',0,0) END FROM Dual
setIsBetaFunctionality (false);
@ -338,12 +346,18 @@ public class X_AD_Process extends PO implements I_AD_Process, I_Persistent
/** AllowMultipleExecution AD_Reference_ID=200158 */
public static final int ALLOWMULTIPLEEXECUTION_AD_Reference_ID=200158;
/** Disallow multiple executions = N */
public static final String ALLOWMULTIPLEEXECUTION_DisallowMultipleExecutions = "N";
/** Disallow multiple executions with the same parameters = P */
public static final String ALLOWMULTIPLEEXECUTION_DisallowMultipleExecutionsWithTheSameParameters = "P";
/** Set Multiple Execution.
@param AllowMultipleExecution Allow or disallow executing a process/report multiple times.
/** Not from same user = N */
public static final String ALLOWMULTIPLEEXECUTION_NotFromSameUser = "N";
/** Not from any user = NA */
public static final String ALLOWMULTIPLEEXECUTION_NotFromAnyUser = "NA";
/** Not from same user and parameters = P */
public static final String ALLOWMULTIPLEEXECUTION_NotFromSameUserAndParameters = "P";
/** Not from any user and same parameters = PA */
public static final String ALLOWMULTIPLEEXECUTION_NotFromAnyUserAndSameParameters = "PA";
/** Yes = Y */
public static final String ALLOWMULTIPLEEXECUTION_Yes = "Y";
/** Set Allow Concurrent Execution.
@param AllowMultipleExecution Allow or disallow executing a process/report multiple times concurrently
*/
public void setAllowMultipleExecution (String AllowMultipleExecution)
{
@ -351,8 +365,8 @@ public class X_AD_Process extends PO implements I_AD_Process, I_Persistent
set_Value (COLUMNNAME_AllowMultipleExecution, AllowMultipleExecution);
}
/** Get Multiple Execution.
@return Allow or disallow executing a process/report multiple times.
/** Get Allow Concurrent Execution.
@return Allow or disallow executing a process/report multiple times concurrently
*/
public String getAllowMultipleExecution()
{

View File

@ -22,6 +22,7 @@ import java.math.BigDecimal;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.adempiere.util.IProcessUI;
@ -1048,21 +1049,32 @@ public class ProcessInfo implements Serializable
if (lastRebootDate == null)
return false;
List<MPInstance> processInstanceList = new Query(Env.getCtx(), MPInstance.Table_Name, " AD_Process_ID=? AND AD_User_ID=? AND IsProcessing='Y' AND record_ID = ? AND Created > ? ", null)
.setParameters(getAD_Process_ID(), getAD_User_ID(), getRecord_ID(), lastRebootDate)
StringBuilder whereClause = new StringBuilder(
"AD_Process_ID=? AND IsProcessing='Y' AND Record_ID = ? AND Created > ?");
List<Object> queryParams = new ArrayList<>(Arrays.asList(getAD_Process_ID(), getRecord_ID(), lastRebootDate));
if ( MProcess.ALLOWMULTIPLEEXECUTION_NotFromSameUser.equals(multipleExecutions)
|| MProcess.ALLOWMULTIPLEEXECUTION_NotFromSameUserAndParameters.equals(multipleExecutions)) {
whereClause.append(" AND AD_User_ID = ? ");
queryParams.add(getAD_User_ID());
}
List<MPInstance> processInstanceList = new Query(Env.getCtx(), MPInstance.Table_Name, whereClause.toString(), null)
.setParameters(queryParams)
.setClient_ID()
.setOnlyActiveRecords(true)
.list();
.setOnlyActiveRecords(true).list();
if (processInstanceList == null || processInstanceList.isEmpty())
return false;
//Never allow multiple executions
if (multipleExecutions.equals(MProcess.ALLOWMULTIPLEEXECUTION_DisallowMultipleExecutions))
// Do not allow concurrent executions
if ( MProcess.ALLOWMULTIPLEEXECUTION_NotFromSameUser.equals(multipleExecutions)
|| MProcess.ALLOWMULTIPLEEXECUTION_NotFromAnyUser.equals(multipleExecutions))
return true;
//Disallow multiple executions with the same params
if (multipleExecutions.equals(MProcess.ALLOWMULTIPLEEXECUTION_DisallowMultipleExecutionsWithTheSameParameters)) {
// Do not allow concurrent executions with the same params
if ( MProcess.ALLOWMULTIPLEEXECUTION_NotFromAnyUserAndSameParameters.equals(multipleExecutions)
|| MProcess.ALLOWMULTIPLEEXECUTION_NotFromSameUserAndParameters.equals(multipleExecutions)) {
for (MPInstance instance : processInstanceList) {
if (instance.equalParameters(params))
return true;