IDEMPIERE-5371 : Adding user session reference on Process Instance (#1603)
* IDEMPIERE-5371 : Adding user session reference on Process Instance * - Peer review Co-authored-by: dpansheriya <deepakpansheriya@gmail.com>
This commit is contained in:
parent
d28ee2e008
commit
816e57ec5a
|
@ -0,0 +1,43 @@
|
||||||
|
SET SQLBLANKLINES ON
|
||||||
|
SET DEFINE OFF
|
||||||
|
|
||||||
|
-- Add Session Audit(AD_Session_ID) reference in Process Audit (AD_PInstance).
|
||||||
|
|
||||||
|
-- Nov 11, 2022, 10:52:49 AM IST
|
||||||
|
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (215639,0,'Session','User Session Online or Web','Online or Web Session Information',282,'AD_Session_ID',22,'N','N','N','N','N',0,'N',30,0,0,'Y',TO_DATE('2022-11-11 10:52:48','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2022-11-11 10:52:48','YYYY-MM-DD HH24:MI:SS'),100,2029,'N','N','D','N','N','N','Y','b45ac525-c04b-489b-aa7b-bd895e8a44f1','Y',0,'N','N','N','N')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 11, 2022, 10:52:55 AM IST
|
||||||
|
UPDATE AD_Column SET FKConstraintName='ADSession_ADPInstance', FKConstraintType='N',Updated=TO_DATE('2022-11-11 10:52:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=215639
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 11, 2022, 10:52:56 AM IST
|
||||||
|
ALTER TABLE AD_PInstance ADD AD_Session_ID NUMBER(10) DEFAULT NULL
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 11, 2022, 10:52:56 AM IST
|
||||||
|
ALTER TABLE AD_PInstance ADD CONSTRAINT ADSession_ADPInstance FOREIGN KEY (AD_Session_ID) REFERENCES ad_session(ad_session_id) DEFERRABLE INITIALLY DEFERRED
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 11, 2022, 10:55:56 AM IST
|
||||||
|
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 (207416,'Session','User Session Online or Web','Online or Web Session Information',663,215639,'Y',22,140,'N','N','N','N',0,0,'Y',TO_DATE('2022-11-11 10:55:54','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2022-11-11 10:55:54','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','13a67a4d-d7b3-4a89-adfb-780d2e2d61f7','Y',130,2)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 11, 2022, 10:56:38 AM IST
|
||||||
|
UPDATE AD_Field SET SeqNo=95, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_DATE('2022-11-11 10:56:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207416
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 21, 2022, 5:17:01 PM IST
|
||||||
|
UPDATE AD_Column SET IsIdentifier='N', SeqNo=0,Updated=TO_DATE('2022-11-21 17:17:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=8579
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 21, 2022, 5:17:46 PM IST
|
||||||
|
UPDATE AD_Column SET IsIdentifier='Y',Updated=TO_DATE('2022-11-21 17:17:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=8577
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 21, 2022, 5:18:04 PM IST
|
||||||
|
UPDATE AD_Column SET IsIdentifier='Y', SeqNo=2,Updated=TO_DATE('2022-11-21 17:18:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=8584
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('202211111143_IDEMPIERE-5371.sql') FROM dual;
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
-- Add Session Audit(AD_Session_ID) reference in Process Audit (AD_PInstance).
|
||||||
|
|
||||||
|
-- Nov 11, 2022, 10:52:49 AM IST
|
||||||
|
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (215639,0,'Session','User Session Online or Web','Online or Web Session Information',282,'AD_Session_ID',22,'N','N','N','N','N',0,'N',30,0,0,'Y',TO_TIMESTAMP('2022-11-11 10:52:48','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-11-11 10:52:48','YYYY-MM-DD HH24:MI:SS'),100,2029,'N','N','D','N','N','N','Y','b45ac525-c04b-489b-aa7b-bd895e8a44f1','Y',0,'N','N','N','N')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 11, 2022, 10:52:55 AM IST
|
||||||
|
UPDATE AD_Column SET FKConstraintName='ADSession_ADPInstance', FKConstraintType='N',Updated=TO_TIMESTAMP('2022-11-11 10:52:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=215639
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 11, 2022, 10:52:56 AM IST
|
||||||
|
ALTER TABLE AD_PInstance ADD COLUMN AD_Session_ID NUMERIC(10) DEFAULT NULL
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 11, 2022, 10:52:56 AM IST
|
||||||
|
ALTER TABLE AD_PInstance ADD CONSTRAINT ADSession_ADPInstance FOREIGN KEY (AD_Session_ID) REFERENCES ad_session(ad_session_id) DEFERRABLE INITIALLY DEFERRED
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 11, 2022, 10:55:56 AM IST
|
||||||
|
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 (207416,'Session','User Session Online or Web','Online or Web Session Information',663,215639,'Y',22,140,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-11-11 10:55:54','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-11-11 10:55:54','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','13a67a4d-d7b3-4a89-adfb-780d2e2d61f7','Y',130,2)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 11, 2022, 10:56:38 AM IST
|
||||||
|
UPDATE AD_Field SET SeqNo=95, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-11-11 10:56:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207416
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 21, 2022, 5:17:01 PM IST
|
||||||
|
UPDATE AD_Column SET IsIdentifier='N', SeqNo=0,Updated=TO_TIMESTAMP('2022-11-21 17:17:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=8579
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 21, 2022, 5:17:46 PM IST
|
||||||
|
UPDATE AD_Column SET IsIdentifier='Y',Updated=TO_TIMESTAMP('2022-11-21 17:17:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=8577
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 21, 2022, 5:18:04 PM IST
|
||||||
|
UPDATE AD_Column SET IsIdentifier='Y', SeqNo=2,Updated=TO_TIMESTAMP('2022-11-21 17:18:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=8584
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('202211111143_IDEMPIERE-5371.sql') FROM dual;
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.compiere.util.KeyNamePair;
|
||||||
|
|
||||||
/** Generated Interface for AD_PInstance
|
/** Generated Interface for AD_PInstance
|
||||||
* @author iDempiere (generated)
|
* @author iDempiere (generated)
|
||||||
* @version Release 9
|
* @version Release 10
|
||||||
*/
|
*/
|
||||||
public interface I_AD_PInstance
|
public interface I_AD_PInstance
|
||||||
{
|
{
|
||||||
|
@ -125,6 +125,21 @@ public interface I_AD_PInstance
|
||||||
|
|
||||||
public org.compiere.model.I_AD_Process getAD_Process() throws RuntimeException;
|
public org.compiere.model.I_AD_Process getAD_Process() throws RuntimeException;
|
||||||
|
|
||||||
|
/** Column name AD_Session_ID */
|
||||||
|
public static final String COLUMNNAME_AD_Session_ID = "AD_Session_ID";
|
||||||
|
|
||||||
|
/** Set Session.
|
||||||
|
* User Session Online or Web
|
||||||
|
*/
|
||||||
|
public void setAD_Session_ID (int AD_Session_ID);
|
||||||
|
|
||||||
|
/** Get Session.
|
||||||
|
* User Session Online or Web
|
||||||
|
*/
|
||||||
|
public int getAD_Session_ID();
|
||||||
|
|
||||||
|
public org.compiere.model.I_AD_Session getAD_Session() throws RuntimeException;
|
||||||
|
|
||||||
/** Column name AD_User_ID */
|
/** Column name AD_User_ID */
|
||||||
public static final String COLUMNNAME_AD_User_ID = "AD_User_ID";
|
public static final String COLUMNNAME_AD_User_ID = "AD_User_ID";
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class MPInstance extends X_AD_PInstance
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 3756494717528301224L;
|
private static final long serialVersionUID = -6414730734415159480L;
|
||||||
|
|
||||||
public static final String ON_RUNNING_JOB_CHANGED_TOPIC = "onRunningJobChanged";
|
public static final String ON_RUNNING_JOB_CHANGED_TOPIC = "onRunningJobChanged";
|
||||||
|
|
||||||
|
@ -630,4 +630,20 @@ public class MPInstance extends X_AD_PInstance
|
||||||
public boolean isDirectPrint = false;
|
public boolean isDirectPrint = false;
|
||||||
public int estimate;
|
public int estimate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Before Save
|
||||||
|
* @param newRecord new
|
||||||
|
* @return true
|
||||||
|
*/
|
||||||
|
protected boolean beforeSave (boolean newRecord)
|
||||||
|
{
|
||||||
|
if (newRecord) {
|
||||||
|
int sessionId = Env.getContextAsInt(Env.getCtx(), Env.AD_SESSION_ID);
|
||||||
|
if (sessionId > 0)
|
||||||
|
setAD_Session_ID(sessionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} // beforeSave
|
||||||
} // MPInstance
|
} // MPInstance
|
|
@ -23,7 +23,7 @@ import org.compiere.util.KeyNamePair;
|
||||||
|
|
||||||
/** Generated Model for AD_PInstance
|
/** Generated Model for AD_PInstance
|
||||||
* @author iDempiere (generated)
|
* @author iDempiere (generated)
|
||||||
* @version Release 9 - $Id$ */
|
* @version Release 10 - $Id$ */
|
||||||
@org.adempiere.base.Model(table="AD_PInstance")
|
@org.adempiere.base.Model(table="AD_PInstance")
|
||||||
public class X_AD_PInstance extends PO implements I_AD_PInstance, I_Persistent
|
public class X_AD_PInstance extends PO implements I_AD_PInstance, I_Persistent
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ public class X_AD_PInstance extends PO implements I_AD_PInstance, I_Persistent
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 20220116L;
|
private static final long serialVersionUID = 20221115L;
|
||||||
|
|
||||||
/** Standard Constructor */
|
/** Standard Constructor */
|
||||||
public X_AD_PInstance (Properties ctx, int AD_PInstance_ID, String trxName)
|
public X_AD_PInstance (Properties ctx, int AD_PInstance_ID, String trxName)
|
||||||
|
@ -219,6 +219,34 @@ public class X_AD_PInstance extends PO implements I_AD_PInstance, I_Persistent
|
||||||
return ii.intValue();
|
return ii.intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public org.compiere.model.I_AD_Session getAD_Session() throws RuntimeException
|
||||||
|
{
|
||||||
|
return (org.compiere.model.I_AD_Session)MTable.get(getCtx(), org.compiere.model.I_AD_Session.Table_ID)
|
||||||
|
.getPO(getAD_Session_ID(), get_TrxName());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Set Session.
|
||||||
|
@param AD_Session_ID User Session Online or Web
|
||||||
|
*/
|
||||||
|
public void setAD_Session_ID (int AD_Session_ID)
|
||||||
|
{
|
||||||
|
if (AD_Session_ID < 1)
|
||||||
|
set_ValueNoCheck (COLUMNNAME_AD_Session_ID, null);
|
||||||
|
else
|
||||||
|
set_ValueNoCheck (COLUMNNAME_AD_Session_ID, Integer.valueOf(AD_Session_ID));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get Session.
|
||||||
|
@return User Session Online or Web
|
||||||
|
*/
|
||||||
|
public int getAD_Session_ID()
|
||||||
|
{
|
||||||
|
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Session_ID);
|
||||||
|
if (ii == null)
|
||||||
|
return 0;
|
||||||
|
return ii.intValue();
|
||||||
|
}
|
||||||
|
|
||||||
public org.compiere.model.I_AD_User getAD_User() throws RuntimeException
|
public org.compiere.model.I_AD_User getAD_User() throws RuntimeException
|
||||||
{
|
{
|
||||||
return (org.compiere.model.I_AD_User)MTable.get(getCtx(), org.compiere.model.I_AD_User.Table_ID)
|
return (org.compiere.model.I_AD_User)MTable.get(getCtx(), org.compiere.model.I_AD_User.Table_ID)
|
||||||
|
|
Loading…
Reference in New Issue