IDEMPIERE-5697 - Improve Process Log for more advanced logging options for Processes (#1808)

* IDEMPIERE-5697 - Improve Process Log for more advanced logging options for Processes

* IDEMPIERE-5697 - fix javadoc

* IDEMPIERE-5697 - add PInstanceLogType to AD_PInstance_Log

* IDEMPIERE-5697 - implement Status Log Type

- implement Status Log Type
- fix javadoc

* IDEMPIERE-5697 - definition changes

- rename log type 'Tail' to 'Progress' as Chuck Boecking suggested
- make ad_pinstance_log_uu the primary key as Heng Sin suggested

* IDEMPIERE-5697 - updateLog method with UUID

* IDEMPIERE-5697 - requested changes

- split insert and update
- fix wrong javadoc
- small fixes

* IDEMPIERE-5697 - requested changes

- fix javadoc
- fix migration scripts

* IDEMPIERE-5697 - balance API

- rename methods in SvrProcess: saveLog -> saveProgress, saveStatus; updateLog -> updateStatus
- remove progress and status methods that take table and record id arguments, there is no need to save them in separate fields with there log types

* IDEMPIERE-5697 - balance API

- exchange logic between Progress and Status log types
- modify method names in ProcessInfo based on SvrProcess

* IDEMPIERE-5697 - pr 1808 patch by Heng Sin

- fix oracle migration script
This commit is contained in:
Peter Takács 2023-06-01 08:11:25 +02:00 committed by GitHub
parent dfe2fff6cd
commit 66e0d4200e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 650 additions and 36 deletions

View File

@ -0,0 +1,91 @@
-- IDEMPIERE-5697
-- add PInstanceLogType to AD_PInstance_Log
SELECT register_migration_script('202305020844_IDEMPIERE-5697.sql') FROM dual;
SET SQLBLANKLINES ON
SET DEFINE OFF
-- May 2, 2023, 8:44:21 AM CEST
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,PrintName,EntityType,AD_Element_UU) VALUES (203809,0,0,'Y',TO_TIMESTAMP('2023-05-02 08:44:21','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-02 08:44:21','YYYY-MM-DD HH24:MI:SS'),100,'PInstanceLogType','Log Type','Process Audit Log Type','Log Type','D','7925b5b3-a3ae-434c-9d72-f9f55f97c44e')
;
-- May 2, 2023, 8:45:02 AM CEST
INSERT INTO AD_Reference (AD_Reference_ID,Name,ValidationType,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,IsOrderByValue,AD_Reference_UU,ShowInactive) VALUES (200242,'AD_PInstance PInstanceLogType','L',0,0,'Y',TO_TIMESTAMP('2023-05-02 08:45:02','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-02 08:45:02','YYYY-MM-DD HH24:MI:SS'),100,'D','N','6a5f9e08-d4c5-4724-a9dc-8e981e734eaa','N')
;
-- May 2, 2023, 8:46:13 AM 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 (200637,'Status','Shows the current status of a process metric, e.g. progress in percents.',200242,'S',0,0,'Y',TO_TIMESTAMP('2023-05-02 08:46:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-02 08:46:13','YYYY-MM-DD HH24:MI:SS'),100,'D','c168a678-1b2b-4fe2-9270-8aeb29b635c3')
;
-- May 2, 2023, 8:47:11 AM 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 (200638,'Progress','Logs, that are created continuously during the execution of the process.',200242,'P',0,0,'Y',TO_TIMESTAMP('2023-05-02 08:47:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-02 08:47:11','YYYY-MM-DD HH24:MI:SS'),100,'D','2cc965b7-abf2-413a-930e-eff43afd5f81')
;
-- May 2, 2023, 8:47:50 AM 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 (200639,'Result','Logs created after the process is executed.',200242,'R',0,0,'Y',TO_TIMESTAMP('2023-05-02 08:47:49','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-02 08:47:49','YYYY-MM-DD HH24:MI:SS'),100,'D','aadce9f4-214c-4c52-b89d-d2696649172b')
;
-- May 2, 2023, 8:47:56 AM CEST
UPDATE AD_Ref_List SET Description='Logs created continuously during the execution of the process.',Updated=TO_TIMESTAMP('2023-05-02 08:47:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200638
;
-- May 2, 2023, 8:48:39 AM CEST
UPDATE AD_Reference SET Name='AD_PInstance_Log PInstanceLogType',Updated=TO_TIMESTAMP('2023-05-02 08:48:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=200242
;
-- May 2, 2023, 8:49:30 AM CEST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,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,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml) VALUES (215837,0,'Log Type','Process Audit Log Type',578,'PInstanceLogType',3,'N','N','N','N','N',0,'N',17,200242,0,0,'Y',TO_TIMESTAMP('2023-05-02 08:49:30','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-02 08:49:30','YYYY-MM-DD HH24:MI:SS'),100,203809,'Y','N','D','N','N','N','Y','066ccbf0-3e44-407a-bdc0-d8b0ae888998','Y',0,'N','N','N')
;
-- May 2, 2023, 8:49:50 AM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (207622,'Log Type','Process Audit Log Type',665,215837,'Y',3,90,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-05-02 08:49:50','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-02 08:49:50','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','ba79279a-3101-45e7-86f5-17b6ef3991d5','Y',90,2)
;
-- May 2, 2023, 9:10:25 AM CEST
ALTER TABLE AD_PInstance_Log ADD PInstanceLogType VARCHAR2(3 CHAR) DEFAULT 'R'
;
-- May 15, 2023, 10:36:39 AM CEST
UPDATE AD_Column SET IsKey='N',Updated=TO_TIMESTAMP('2023-05-15 10:36:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=8779
;
-- May 15, 2023, 10:42:19 AM CEST
UPDATE AD_Column SET AD_Reference_ID=11,Updated=TO_TIMESTAMP('2023-05-15 10:42:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=8779
;
-- May 15, 2023, 10:49:33 AM CEST
UPDATE AD_TableIndex SET Name='ad_pinstance_log_uu', IsKey='Y',Updated=TO_TIMESTAMP('2023-05-15 10:49:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_TableIndex_ID=200138
;
-- May 15, 2023, 10:49:54 AM CEST
ALTER TABLE AD_PInstance_Log DROP CONSTRAINT ad_pinstance_log_uu_idx CASCADE
;
-- May 15, 2023, 10:49:54 AM CEST
ALTER TABLE AD_PInstance_Log DROP PRIMARY KEY
;
-- May 15, 2023, 10:50:19 AM CEST
ALTER TABLE AD_PInstance_Log ADD CONSTRAINT ad_pinstance_log_uu PRIMARY KEY (AD_PInstance_Log_UU)
;
-- May 15, 2023, 3:03:52 PM CEST
INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing,IsKey) VALUES (0,0,201246,'f348e791-5d5e-40f2-89bd-7f8be0850217',TO_TIMESTAMP('2023-05-15 15:03:52','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ad_pinstance_id_log_id',TO_TIMESTAMP('2023-05-15 15:03:52','YYYY-MM-DD HH24:MI:SS'),100,578,'Y','Y','N','N')
;
-- May 15, 2023, 3:04:03 PM CEST
INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201684,'ecebad1f-2b24-4cae-afbf-dfed57ed4071',TO_TIMESTAMP('2023-05-15 15:04:03','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-05-15 15:04:03','YYYY-MM-DD HH24:MI:SS'),100,8780,201246,10)
;
-- May 15, 2023, 3:04:08 PM CEST
INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201685,'b83c67d5-260d-4b8a-9978-3bd823ecedb5',TO_TIMESTAMP('2023-05-15 15:04:07','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-05-15 15:04:07','YYYY-MM-DD HH24:MI:SS'),100,8779,201246,20)
;
-- May 15, 2023, 3:04:13 PM CEST
ALTER TABLE AD_PInstance_Log ADD CONSTRAINT ad_pinstance_id_log_id UNIQUE (AD_PInstance_ID,Log_ID)
;
-- May 29, 2023, 12:06:17 PM CEST
UPDATE AD_Column SET DefaultValue='R',Updated=TO_TIMESTAMP('2023-05-29 12:06:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=215837
;

View File

@ -0,0 +1,88 @@
-- IDEMPIERE-5697
-- add PInstanceLogType to AD_PInstance_Log
SELECT register_migration_script('202305020844_IDEMPIERE-5697.sql') FROM dual;
-- May 2, 2023, 8:44:21 AM CEST
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,PrintName,EntityType,AD_Element_UU) VALUES (203809,0,0,'Y',TO_TIMESTAMP('2023-05-02 08:44:21','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-02 08:44:21','YYYY-MM-DD HH24:MI:SS'),100,'PInstanceLogType','Log Type','Process Audit Log Type','Log Type','D','7925b5b3-a3ae-434c-9d72-f9f55f97c44e')
;
-- May 2, 2023, 8:45:02 AM CEST
INSERT INTO AD_Reference (AD_Reference_ID,Name,ValidationType,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,IsOrderByValue,AD_Reference_UU,ShowInactive) VALUES (200242,'AD_PInstance PInstanceLogType','L',0,0,'Y',TO_TIMESTAMP('2023-05-02 08:45:02','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-02 08:45:02','YYYY-MM-DD HH24:MI:SS'),100,'D','N','6a5f9e08-d4c5-4724-a9dc-8e981e734eaa','N')
;
-- May 2, 2023, 8:46:13 AM 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 (200637,'Status','Shows the current status of a process metric, e.g. progress in percents.',200242,'S',0,0,'Y',TO_TIMESTAMP('2023-05-02 08:46:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-02 08:46:13','YYYY-MM-DD HH24:MI:SS'),100,'D','c168a678-1b2b-4fe2-9270-8aeb29b635c3')
;
-- May 2, 2023, 8:47:11 AM 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 (200638,'Progress','Logs, that are created continuously during the execution of the process.',200242,'P',0,0,'Y',TO_TIMESTAMP('2023-05-02 08:47:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-02 08:47:11','YYYY-MM-DD HH24:MI:SS'),100,'D','2cc965b7-abf2-413a-930e-eff43afd5f81')
;
-- May 2, 2023, 8:47:50 AM 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 (200639,'Result','Logs created after the process is executed.',200242,'R',0,0,'Y',TO_TIMESTAMP('2023-05-02 08:47:49','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-02 08:47:49','YYYY-MM-DD HH24:MI:SS'),100,'D','aadce9f4-214c-4c52-b89d-d2696649172b')
;
-- May 2, 2023, 8:47:56 AM CEST
UPDATE AD_Ref_List SET Description='Logs created continuously during the execution of the process.',Updated=TO_TIMESTAMP('2023-05-02 08:47:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200638
;
-- May 2, 2023, 8:48:39 AM CEST
UPDATE AD_Reference SET Name='AD_PInstance_Log PInstanceLogType',Updated=TO_TIMESTAMP('2023-05-02 08:48:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=200242
;
-- May 2, 2023, 8:49:30 AM CEST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,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,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml) VALUES (215837,0,'Log Type','Process Audit Log Type',578,'PInstanceLogType',3,'N','N','N','N','N',0,'N',17,200242,0,0,'Y',TO_TIMESTAMP('2023-05-02 08:49:30','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-02 08:49:30','YYYY-MM-DD HH24:MI:SS'),100,203809,'Y','N','D','N','N','N','Y','066ccbf0-3e44-407a-bdc0-d8b0ae888998','Y',0,'N','N','N')
;
-- May 2, 2023, 8:49:50 AM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (207622,'Log Type','Process Audit Log Type',665,215837,'Y',3,90,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-05-02 08:49:50','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-02 08:49:50','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','ba79279a-3101-45e7-86f5-17b6ef3991d5','Y',90,2)
;
-- May 2, 2023, 9:10:25 AM CEST
ALTER TABLE AD_PInstance_Log ADD COLUMN PInstanceLogType VARCHAR(3) DEFAULT 'R'
;
-- May 15, 2023, 10:36:39 AM CEST
UPDATE AD_Column SET IsKey='N',Updated=TO_TIMESTAMP('2023-05-15 10:36:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=8779
;
-- May 15, 2023, 10:42:19 AM CEST
UPDATE AD_Column SET AD_Reference_ID=11,Updated=TO_TIMESTAMP('2023-05-15 10:42:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=8779
;
-- May 15, 2023, 10:49:33 AM CEST
UPDATE AD_TableIndex SET Name='ad_pinstance_log_uu', IsKey='Y',Updated=TO_TIMESTAMP('2023-05-15 10:49:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_TableIndex_ID=200138
;
-- May 15, 2023, 10:49:54 AM CEST
ALTER TABLE AD_PInstance_Log DROP CONSTRAINT ad_pinstance_log_uu_idx CASCADE
;
-- May 15, 2023, 10:49:54 AM CEST
ALTER TABLE AD_PInstance_Log DROP CONSTRAINT ad_pinstance_log_pkey CASCADE
;
-- May 15, 2023, 10:50:19 AM CEST
ALTER TABLE AD_PInstance_Log ADD CONSTRAINT ad_pinstance_log_uu PRIMARY KEY (AD_PInstance_Log_UU)
;
-- May 15, 2023, 3:03:52 PM CEST
INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing,IsKey) VALUES (0,0,201246,'f348e791-5d5e-40f2-89bd-7f8be0850217',TO_TIMESTAMP('2023-05-15 15:03:52','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ad_pinstance_id_log_id',TO_TIMESTAMP('2023-05-15 15:03:52','YYYY-MM-DD HH24:MI:SS'),100,578,'Y','Y','N','N')
;
-- May 15, 2023, 3:04:03 PM CEST
INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201684,'ecebad1f-2b24-4cae-afbf-dfed57ed4071',TO_TIMESTAMP('2023-05-15 15:04:03','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-05-15 15:04:03','YYYY-MM-DD HH24:MI:SS'),100,8780,201246,10)
;
-- May 15, 2023, 3:04:08 PM CEST
INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201685,'b83c67d5-260d-4b8a-9978-3bd823ecedb5',TO_TIMESTAMP('2023-05-15 15:04:07','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-05-15 15:04:07','YYYY-MM-DD HH24:MI:SS'),100,8779,201246,20)
;
-- May 15, 2023, 3:04:13 PM CEST
ALTER TABLE AD_PInstance_Log ADD CONSTRAINT ad_pinstance_id_log_id UNIQUE (AD_PInstance_ID,Log_ID)
;
-- May 29, 2023, 12:06:17 PM CEST
UPDATE AD_Column SET DefaultValue='R',Updated=TO_TIMESTAMP('2023-05-29 12:06:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=215837
;

View File

@ -89,6 +89,19 @@ public interface I_AD_PInstance_Log
/** Get Log */ /** Get Log */
public int getLog_ID(); public int getLog_ID();
/** Column name PInstanceLogType */
public static final String COLUMNNAME_PInstanceLogType = "PInstanceLogType";
/** Set Log Type.
* Process Audit Log Type
*/
public void setPInstanceLogType (String PInstanceLogType);
/** Get Log Type.
* Process Audit Log Type
*/
public String getPInstanceLogType();
/** Column name P_Date */ /** Column name P_Date */
public static final String COLUMNNAME_P_Date = "P_Date"; public static final String COLUMNNAME_P_Date = "P_Date";

View File

@ -20,10 +20,12 @@ import java.math.BigDecimal;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.UUID; import java.util.UUID;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Util;
/** /**
* Process Instance Log Model. * Process Instance Log Model.
@ -46,11 +48,11 @@ public class MPInstanceLog
public MPInstanceLog (int AD_PInstance_ID, int Log_ID, Timestamp P_Date, public MPInstanceLog (int AD_PInstance_ID, int Log_ID, Timestamp P_Date,
int P_ID, BigDecimal P_Number, String P_Msg) int P_ID, BigDecimal P_Number, String P_Msg)
{ {
this(AD_PInstance_ID, Log_ID, P_Date, P_ID, P_Number, P_Msg, 0, 0); this(AD_PInstance_ID, Log_ID, P_Date, P_ID, P_Number, P_Msg, 0, 0, X_AD_PInstance_Log.PINSTANCELOGTYPE_Result);
} // MPInstance_Log } // MPInstance_Log
/** /**
* Full Constructor * Constructor without PInstanceLogType
* @param AD_PInstance_ID * @param AD_PInstance_ID
* @param Log_ID * @param Log_ID
* @param P_Date * @param P_Date
@ -62,6 +64,43 @@ public class MPInstanceLog
*/ */
public MPInstanceLog (int AD_PInstance_ID, int Log_ID, Timestamp P_Date, public MPInstanceLog (int AD_PInstance_ID, int Log_ID, Timestamp P_Date,
int P_ID, BigDecimal P_Number, String P_Msg, int AD_Table_ID, int Record_ID) int P_ID, BigDecimal P_Number, String P_Msg, int AD_Table_ID, int Record_ID)
{
this(AD_PInstance_ID, Log_ID, P_Date, P_ID, P_Number, P_Msg, AD_Table_ID, Record_ID, X_AD_PInstance_Log.PINSTANCELOGTYPE_Result);
} // MPInstance_Log
/**
* Constructor without AD_PInstance_Log_UU
* @param AD_PInstance_ID
* @param Log_ID
* @param P_Date
* @param P_ID
* @param P_Number
* @param P_Msg
* @param AD_Table_ID
* @param Record_ID
* @param PInstanceLogType Log Type
*/
public MPInstanceLog (int AD_PInstance_ID, int Log_ID, Timestamp P_Date,
int P_ID, BigDecimal P_Number, String P_Msg, int AD_Table_ID, int Record_ID, String PInstanceLogType)
{
this("", AD_PInstance_ID, Log_ID, P_Date, P_ID, P_Number, P_Msg, AD_Table_ID, Record_ID, PInstanceLogType);
}
/**
* Full Constructor
* @param AD_PInstance_Log_UU
* @param AD_PInstance_ID
* @param Log_ID
* @param P_Date
* @param P_ID
* @param P_Number
* @param P_Msg
* @param AD_Table_ID
* @param Record_ID
* @param PInstanceLogType Log Type
*/
public MPInstanceLog (String AD_PInstance_Log_UU, int AD_PInstance_ID, int Log_ID, Timestamp P_Date,
int P_ID, BigDecimal P_Number, String P_Msg, int AD_Table_ID, int Record_ID, String PInstanceLogType)
{ {
setAD_PInstance_ID(AD_PInstance_ID); setAD_PInstance_ID(AD_PInstance_ID);
setLog_ID(Log_ID); setLog_ID(Log_ID);
@ -71,6 +110,9 @@ public class MPInstanceLog
setP_Msg(P_Msg); setP_Msg(P_Msg);
setAD_Table_ID(AD_Table_ID); setAD_Table_ID(AD_Table_ID);
setRecord_ID(Record_ID); setRecord_ID(Record_ID);
setPInstanceLogType(PInstanceLogType);
if(!Util.isEmpty(AD_PInstance_Log_UU))
setAD_PInstance_Log_UU(AD_PInstance_Log_UU);
} // MPInstance_Log } // MPInstance_Log
/** /**
@ -97,6 +139,8 @@ public class MPInstanceLog
private String m_P_Msg; private String m_P_Msg;
private int m_AD_Table_ID; private int m_AD_Table_ID;
private int m_Record_ID; private int m_Record_ID;
private String m_PInstanceLogType;
private String m_AD_PInstance_Log_UU;
/** /**
@ -121,8 +165,18 @@ public class MPInstanceLog
private final static String insertSql = "INSERT INTO AD_PInstance_Log " private final static String insertSql = "INSERT INTO AD_PInstance_Log "
+ "(AD_PInstance_ID, Log_ID, P_Date, P_ID, P_Number, P_Msg, AD_Table_ID, Record_ID, AD_PInstance_Log_UU)" + "(AD_PInstance_ID, Log_ID, P_Date, P_ID, P_Number, P_Msg, AD_Table_ID, Record_ID, AD_PInstance_Log_UU, PInstanceLogType)"
+ " VALUES (?,?,?,?,?,?,?,?,?)"; + " VALUES (?,?,?,?,?,?,?,?,?,?) ";
private final static String updateSql = "UPDATE AD_PInstance_Log "
+ " SET P_Date = ?, "
+ " P_ID = ?, "
+ " P_Number = ?, "
+ " P_Msg = ?, "
+ " AD_Table_ID = ?, "
+ " Record_ID = ?, "
+ " PInstanceLogType = ? "
+ " WHERE AD_PInstance_Log_UU = ? ";
/** /**
* Save to Database * Save to Database
@ -130,7 +184,7 @@ public class MPInstanceLog
*/ */
public boolean save () public boolean save ()
{ {
int no = DB.executeUpdate(insertSql, getInsertParams(), false, null); // outside of trx int no = DB.executeUpdate(insertSql, getParams(true), false, null); // outside of trx
return no == 1; return no == 1;
} // save } // save
@ -139,34 +193,69 @@ public class MPInstanceLog
*/ */
public void saveEx () public void saveEx ()
{ {
DB.executeUpdateEx(insertSql, getInsertParams(), null); // outside of trx DB.executeUpdateEx(insertSql, getParams(true), null); // outside of trx
} // saveEx } // saveEx
private Object[] getInsertParams() { /**
* Update record in Database
* @return true if saved
*/
public boolean update ()
{
int no = DB.executeUpdate(updateSql, getParams(false), false, null); // outside of trx
return no == 1;
} // update
/**
* Update record in Database, throwing Exception
*/
public void updateEx ()
{
DB.executeUpdateEx(updateSql, getParams(false), null); // outside of trx
} // updateEx
/**
* Get parameters for SQL INSERT or UPDATE
* @param isInsert - if true, get parameters for INSERT, else get parameters for UPDATE
* @return Object[] parameters
*/
private Object[] getParams(boolean isInsert) {
MColumn colMsg = MColumn.get(Env.getCtx(), I_AD_PInstance_Log.Table_Name, I_AD_PInstance_Log.COLUMNNAME_P_Msg); MColumn colMsg = MColumn.get(Env.getCtx(), I_AD_PInstance_Log.Table_Name, I_AD_PInstance_Log.COLUMNNAME_P_Msg);
int maxMsgLength = colMsg.getFieldLength(); int maxMsgLength = colMsg.getFieldLength();
Object[] params = new Object[9]; ArrayList<Object> params = new ArrayList <Object>();
params[0] = m_AD_PInstance_ID;
params[1] = m_Log_ID;
if (m_P_Date != null) if(isInsert) {
params[2] = m_P_Date; params.add(m_AD_PInstance_ID);
if (m_P_ID != 0) params.add(m_Log_ID);
params[3] = m_P_ID;
if (m_P_Number != null)
params[4] = m_P_Number;
if (m_P_Msg != null) {
if (m_P_Msg.length() > maxMsgLength)
params[5] = m_P_Msg.substring(0, maxMsgLength);
else
params[5] = m_P_Msg;
} }
if (m_AD_Table_ID != 0) params.add(m_P_Date != null ? m_P_Date : null);
params[6] = m_AD_Table_ID;
if (m_Record_ID != 0) params.add(m_P_ID != 0 ? m_P_ID : null);
params[7] = m_Record_ID;
params[8] = UUID.randomUUID().toString(); params.add(m_P_Number != null ? m_P_Number : null);
return params;
} if (m_P_Msg != null) {
params.add(m_P_Msg.length() > maxMsgLength ? m_P_Msg.substring(0, maxMsgLength) : m_P_Msg);
}
else {
params.add(null);
}
params.add(m_AD_Table_ID != 0 ? m_AD_Table_ID : null);
params.add(m_Record_ID != 0 ? m_Record_ID : null);
if(isInsert)
params.add(getAD_PInstance_Log_UU());
params.add(m_PInstanceLogType);
if(!isInsert)
params.add(getAD_PInstance_Log_UU());
return params.toArray();
} // getParams
/** /**
* Get AD_PInstance_ID * Get AD_PInstance_ID
@ -312,4 +401,38 @@ public class MPInstanceLog
m_Record_ID = recordId; m_Record_ID = recordId;
} }
/**
* Get Log Type
* @return Log Type
*/
public String getPInstanceLogType() {
return m_PInstanceLogType;
}
/**
* Set Log Type
* @param m_PInstanceLogType
*/
public void setPInstanceLogType(String m_PInstanceLogType) {
this.m_PInstanceLogType = m_PInstanceLogType;
}
/**
* Set AD_PInstance_Log_UU
* @return Sting AD_PInstance_Log_UU
*/
public String getAD_PInstance_Log_UU() {
if(Util.isEmpty(m_AD_PInstance_Log_UU))
m_AD_PInstance_Log_UU = UUID.randomUUID().toString();
return m_AD_PInstance_Log_UU;
}
/**
* Get AD_PInstance_Log_UU
* @param m_AD_PInstance_Log_UU
*/
public void setAD_PInstance_Log_UU(String m_AD_PInstance_Log_UU) {
this.m_AD_PInstance_Log_UU = m_AD_PInstance_Log_UU;
}
} // MPInstance_Log } // MPInstance_Log

View File

@ -33,7 +33,7 @@ public class X_AD_PInstance_Log extends PO implements I_AD_PInstance_Log, I_Pers
/** /**
* *
*/ */
private static final long serialVersionUID = 20230409L; private static final long serialVersionUID = 20230515L;
/** Standard Constructor */ /** Standard Constructor */
public X_AD_PInstance_Log (Properties ctx, int AD_PInstance_Log_ID, String trxName) public X_AD_PInstance_Log (Properties ctx, int AD_PInstance_Log_ID, String trxName)
@ -103,7 +103,8 @@ public class X_AD_PInstance_Log extends PO implements I_AD_PInstance_Log, I_Pers
public String toString() public String toString()
{ {
StringBuilder sb = new StringBuilder ("X_AD_PInstance_Log[") StringBuilder sb = new StringBuilder ("X_AD_PInstance_Log[")
.append(get_ID()).append("]"); .append(get_ID()).append(", ")
.append(get_UUID()).append("]");
return sb.toString(); return sb.toString();
} }
@ -199,6 +200,31 @@ public class X_AD_PInstance_Log extends PO implements I_AD_PInstance_Log, I_Pers
return ii.intValue(); return ii.intValue();
} }
/** PInstanceLogType AD_Reference_ID=200242 */
public static final int PINSTANCELOGTYPE_AD_Reference_ID=200242;
/** Progress = P */
public static final String PINSTANCELOGTYPE_Progress = "P";
/** Result = R */
public static final String PINSTANCELOGTYPE_Result = "R";
/** Status = S */
public static final String PINSTANCELOGTYPE_Status = "S";
/** Set Log Type.
@param PInstanceLogType Process Audit Log Type
*/
public void setPInstanceLogType (String PInstanceLogType)
{
set_Value (COLUMNNAME_PInstanceLogType, PInstanceLogType);
}
/** Get Log Type.
@return Process Audit Log Type
*/
public String getPInstanceLogType()
{
return (String)get_Value(COLUMNNAME_PInstanceLogType);
}
/** Set Process Date. /** Set Process Date.
@param P_Date Process Parameter @param P_Date Process Parameter
*/ */

View File

@ -26,12 +26,14 @@ import java.util.List;
import org.adempiere.util.IProcessUI; import org.adempiere.util.IProcessUI;
import org.compiere.model.MPInstance; import org.compiere.model.MPInstance;
import org.compiere.model.MPInstanceLog;
import org.compiere.model.MPInstancePara; import org.compiere.model.MPInstancePara;
import org.compiere.model.MProcess; import org.compiere.model.MProcess;
import org.compiere.model.MSession; import org.compiere.model.MSession;
import org.compiere.model.MSysConfig; import org.compiere.model.MSysConfig;
import org.compiere.model.PO; import org.compiere.model.PO;
import org.compiere.model.Query; import org.compiere.model.Query;
import org.compiere.model.X_AD_PInstance_Log;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -691,6 +693,90 @@ public class ProcessInfo implements Serializable
return logs; return logs;
} // getLogs } // getLogs
/**
* Save Status Log to DB immediately
* @param P_ID Process ID
* @param P_Date Process Date
* @param P_Number Process Number
* @param P_Msg Process Message
* @return String AD_PInstance_Log_UU
*/
public String saveStatus (int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg)
{
return saveLog (new ProcessInfoLog (P_ID, P_Date, P_Number, P_Msg, 0, 0, X_AD_PInstance_Log.PINSTANCELOGTYPE_Status));
} // saveLog
/**
* Save Progress Log to DB immediately
* @param P_ID Process ID
* @param P_Date Process Date
* @param P_Number Process Number
* @param P_Msg Process Message
* @return String AD_PInstance_Log_UU
*/
public String saveProgress (int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg)
{
return saveLog (new ProcessInfoLog (P_ID, P_Date, P_Number, P_Msg, 0, 0, X_AD_PInstance_Log.PINSTANCELOGTYPE_Progress));
} // saveLog
/**
* Save Log to DB immediately
* @param logEntry log entry
* @return String AD_PInstance_Log_UU
*/
public String saveLog (ProcessInfoLog logEntry)
{
if (logEntry == null)
return "";
MPInstanceLog il = new MPInstanceLog(getAD_PInstance_ID(),
logEntry.getLog_ID(),
logEntry.getP_Date(),
logEntry.getP_ID(),
logEntry.getP_Number(),
logEntry.getP_Msg(),
logEntry.getAD_Table_ID(),
logEntry.getRecord_ID(),
logEntry.getPInstanceLogType());
il.saveEx();
return il.getAD_PInstance_Log_UU();
} // saveLog
/**
* Update Progress Log to DB immediately
* @param pInstanceLogUU AD_PInstance_Log_UU
* @param P_ID Process ID
* @param P_Date Process Date
* @param P_Number Process Number
* @param P_Msg Process Message
* @return true if log is successfully updated
*/
public boolean updateProgress (String pInstanceLogUU, int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg)
{
return updateLog (new ProcessInfoLog (pInstanceLogUU, P_ID, P_Date, P_Number, P_Msg, X_AD_PInstance_Log.PINSTANCELOGTYPE_Progress));
} // updateLog
/**
* Update existing Log immediately
* @param logEntry log entry
* @return true if log is successfully updated
*/
public boolean updateLog (ProcessInfoLog logEntry)
{
if (logEntry == null)
return false;
MPInstanceLog il = new MPInstanceLog(logEntry.getAD_PInstance_Log_UU(),
getAD_PInstance_ID(),
logEntry.getLog_ID(),
logEntry.getP_Date(),
logEntry.getP_ID(),
logEntry.getP_Number(),
logEntry.getP_Msg(),
logEntry.getAD_Table_ID(),
logEntry.getRecord_ID(),
logEntry.getPInstanceLogType());
return il.update();
} // saveLog
/** /**
* Method getIDs * Method getIDs
* @return int[] * @return int[]

View File

@ -35,12 +35,17 @@ public class ProcessInfoLog implements Serializable
/** /**
* Create Process Info Log. * Create Process Info Log.
* @param AD_PInstance_Log_UU Log UU
* @param Log_ID Log ID
* @param P_ID Process ID * @param P_ID Process ID
* @param P_Date Process Date * @param P_Date Process Date
* @param P_Number Process Number * @param P_Number Process Number
* @param P_Msg Process Messagre * @param P_Msg Process Message
* @param AD_Table_ID Table ID
* @param Record_ID Record ID
* @param PInstanceLogType Log Type
*/ */
public ProcessInfoLog (int Log_ID,int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg, int AD_Table_ID ,int Record_ID) public ProcessInfoLog (String AD_PInstance_Log_UU, int Log_ID,int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg, int AD_Table_ID ,int Record_ID, String PInstanceLogType)
{ {
setLog_ID (Log_ID); setLog_ID (Log_ID);
setP_ID (P_ID); setP_ID (P_ID);
@ -49,9 +54,65 @@ public class ProcessInfoLog implements Serializable
setP_Msg (P_Msg); setP_Msg (P_Msg);
setAD_Table_ID(AD_Table_ID); setAD_Table_ID(AD_Table_ID);
setRecord_ID(Record_ID); setRecord_ID(Record_ID);
setPInstanceLogType(PInstanceLogType);
setAD_PInstance_Log_UU(AD_PInstance_Log_UU);
} // ProcessInfoLog } // ProcessInfoLog
/**
* Create Process Info Log.
* @param Log_ID Log ID
* @param P_ID Process ID
* @param P_Date Process Date
* @param P_Number Process Number
* @param P_Msg Process Message
* @param AD_Table_ID Table ID
* @param Record_ID Record ID
*/
public ProcessInfoLog (int Log_ID,int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg, int AD_Table_ID ,int Record_ID)
{
this("", Log_ID, P_ID, P_Date, P_Number, P_Msg, AD_Table_ID, Record_ID, null);
}
/**
* Create Process Info Log.
* @param P_ID Process ID
* @param P_Date Process Date
* @param P_Number Process Number
* @param P_Msg Process Message
* @param AD_Table_ID Table ID
* @param Record_ID Record ID
* @param PInstanceLogType Log Type
*/
public ProcessInfoLog (int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg, int AD_Table_ID ,int Record_ID, String PInstanceLogType)
{
this("", s_Log_ID++, P_ID, P_Date, P_Number, P_Msg, AD_Table_ID, Record_ID, PInstanceLogType);
}
/**
* Create Process Info Log.
* @param AD_PInstance_Log_UU Log UU
* @param P_ID Process ID
* @param P_Date Process Date
* @param P_Number Process Number
* @param P_Msg Process Message
* @param AD_Table_ID Table ID
* @param Record_ID Record ID
*/
public ProcessInfoLog (String AD_PInstance_Log_UU, int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg, int AD_Table_ID ,int Record_ID)
{
this(AD_PInstance_Log_UU, s_Log_ID++, P_ID, P_Date, P_Number, P_Msg, AD_Table_ID, Record_ID, null);
}
/**
* Create Process Info Log.
* @param P_ID Process ID
* @param P_Date Process Date
* @param P_Number Process Number
* @param P_Msg Process Message
* @param AD_Table_ID Table ID
* @param Record_ID Record ID
*/
public ProcessInfoLog (int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg , int AD_Table_ID ,int Record_ID) public ProcessInfoLog (int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg , int AD_Table_ID ,int Record_ID)
{ {
this (s_Log_ID++, P_ID, P_Date, P_Number, P_Msg, AD_Table_ID,Record_ID); this (s_Log_ID++, P_ID, P_Date, P_Number, P_Msg, AD_Table_ID,Record_ID);
@ -62,7 +123,7 @@ public class ProcessInfoLog implements Serializable
* @param P_ID Process ID * @param P_ID Process ID
* @param P_Date Process Date * @param P_Date Process Date
* @param P_Number Process Number * @param P_Number Process Number
* @param P_Msg Process Messagre * @param P_Msg Process Message
*/ */
public ProcessInfoLog (int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg) public ProcessInfoLog (int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg)
{ {
@ -75,13 +136,54 @@ public class ProcessInfoLog implements Serializable
* @param P_ID Process ID * @param P_ID Process ID
* @param P_Date Process Date * @param P_Date Process Date
* @param P_Number Process Number * @param P_Number Process Number
* @param P_Msg Process Messagre * @param P_Msg Process Message
*/ */
public ProcessInfoLog (int Log_ID, int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg) public ProcessInfoLog (int Log_ID, int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg)
{ {
this (Log_ID, P_ID, P_Date, P_Number, P_Msg, 0,0); this (Log_ID, P_ID, P_Date, P_Number, P_Msg, 0,0);
} // ProcessInfoLog } // ProcessInfoLog
/**
* Create Process Info Log.
* @param AD_PInstance_Log_UU Log UU
* @param P_ID Process ID
* @param P_Date Process Date
* @param P_Number Process Number
* @param P_Msg Process Message
* @param PInstanceLogType Log Type
*/
public ProcessInfoLog (String AD_PInstance_Log_UU, int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg, String PInstanceLogType)
{
this (AD_PInstance_Log_UU, s_Log_ID++, P_ID, P_Date, P_Number, P_Msg, 0, 0, PInstanceLogType);
} // ProcessInfoLog
/**
* Create Process Info Log.
* @param AD_PInstance_Log_UU Log UU
* @param P_ID Process ID
* @param P_Date Process Date
* @param P_Number Process Number
* @param P_Msg Process Message
*/
public ProcessInfoLog (String AD_PInstance_Log_UU, int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg)
{
this (AD_PInstance_Log_UU, s_Log_ID++, P_ID, P_Date, P_Number, P_Msg, 0,0,null);
} // ProcessInfoLog
/**
* Create Process Info Log.
* @param Log_ID Log ID
* @param P_ID Process ID
* @param P_Date Process Date
* @param P_Number Process Number
* @param P_Msg Process Message
* @param PInstanceLogType Log Type
*/
public ProcessInfoLog (int Log_ID, int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg, String PInstanceLogType)
{
this ("", Log_ID, P_ID, P_Date, P_Number, P_Msg, 0, 0, PInstanceLogType);
} // ProcessInfoLog
private static int s_Log_ID = 0; private static int s_Log_ID = 0;
private int m_Log_ID; private int m_Log_ID;
@ -91,6 +193,8 @@ public class ProcessInfoLog implements Serializable
private String m_P_Msg; private String m_P_Msg;
private int m_AD_Table_ID; private int m_AD_Table_ID;
private int m_Record_ID; private int m_Record_ID;
private String m_PInstanceLogType;
private String m_AD_PInstance_Log_UU;
public int getAD_Table_ID() { public int getAD_Table_ID() {
return m_AD_Table_ID; return m_AD_Table_ID;
@ -192,4 +296,36 @@ public class ProcessInfoLog implements Serializable
m_P_Msg = P_Msg; m_P_Msg = P_Msg;
} }
/**
* Get Log Type
* @return Log Type
*/
public String getPInstanceLogType() {
return m_PInstanceLogType;
}
/**
* Set Log Type
* @param m_PInstanceLogType
*/
public void setPInstanceLogType(String m_PInstanceLogType) {
this.m_PInstanceLogType = m_PInstanceLogType;
}
/**
* Set AD_PInstance_Log_UU
* @return Sting AD_PInstance_Log_UU
*/
public String getAD_PInstance_Log_UU() {
return m_AD_PInstance_Log_UU;
}
/**
* Get AD_PInstance_Log_UU
* @param m_AD_PInstance_Log_UU
*/
public void setAD_PInstance_Log_UU(String m_AD_PInstance_Log_UU) {
this.m_AD_PInstance_Log_UU = m_AD_PInstance_Log_UU;
}
} // ProcessInfoLog } // ProcessInfoLog

View File

@ -23,10 +23,12 @@ import java.util.ArrayList;
import java.util.logging.Level; import java.util.logging.Level;
import org.compiere.model.MPInstanceLog; import org.compiere.model.MPInstanceLog;
import org.compiere.model.X_AD_PInstance_Log;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.Util;
/** /**
* Process Info with Utilities * Process Info with Utilities
@ -172,7 +174,8 @@ public class ProcessInfoUtil
{ {
MPInstanceLog il = new MPInstanceLog(pi.getAD_PInstance_ID(), logs[i].getLog_ID(), logs[i].getP_Date(), MPInstanceLog il = new MPInstanceLog(pi.getAD_PInstance_ID(), logs[i].getLog_ID(), logs[i].getP_Date(),
logs[i].getP_ID(), logs[i].getP_Number(), logs[i].getP_Msg(), logs[i].getP_ID(), logs[i].getP_Number(), logs[i].getP_Msg(),
logs[i].getAD_Table_ID(), logs[i].getRecord_ID()); logs[i].getAD_Table_ID(), logs[i].getRecord_ID(),
!Util.isEmpty(logs[i].getPInstanceLogType()) ? logs[i].getPInstanceLogType() : X_AD_PInstance_Log.PINSTANCELOGTYPE_Result);
il.save(); il.save();
} }
} // saveLogToDB } // saveLogToDB

View File

@ -618,6 +618,54 @@ public abstract class SvrProcess implements ProcessCall
listEntryLog = null; // flushed - to avoid flushing it again in case is called listEntryLog = null; // flushed - to avoid flushing it again in case is called
} }
/**
* Save Progress Log Entry to DB immediately
* @param date date or null
* @param id record id or 0
* @param number number or null
* @param msg message or null
* @return String AD_PInstance_Log_UU
*/
public String saveProgress (int id, Timestamp date, BigDecimal number, String msg)
{
if (log.isLoggable(Level.INFO)) log.info(id + " - " + date + " - " + number + " - " + msg);
if (m_pi != null)
return m_pi.saveProgress(id, date, number, msg);
return "";
} // saveProgress
/**
* Save Status Log Entry to DB immediately
* @param date date or null
* @param id record id or 0
* @param number number or null
* @param msg message or null
* @return String AD_PInstance_Log_UU
*/
public String saveStatus (int id, Timestamp date, BigDecimal number, String msg)
{
if (log.isLoggable(Level.INFO)) log.info(id + " - " + date + " - " + number + " - " + msg);
if (m_pi != null)
return m_pi.saveStatus(id, date, number, msg);
return "";
} // saveStatus
/**
* Update Progress Log Entry with the specified AD_PInstance_Log_UU, update if exists
* @param pInstanceLogUU AD_PInstance_Log_UU
* @param id record id or 0
* @param date date or null
* @param number number or null
* @param msg message or null
*/
public void updateProgress (String pInstanceLogUU, int id, Timestamp date, BigDecimal number, String msg)
{
if (m_pi != null)
m_pi.updateProgress(pInstanceLogUU, id, date, number, msg);
if (log.isLoggable(Level.INFO)) log.info(pInstanceLogUU + " - " + id + " - " + date + " - " + number + " - " + msg);
} // saveLog
/************************************************************************** /**************************************************************************
* Execute function * Execute function
* @param className class * @param className class