[ 1755177 ] ad_changelog should have an 'action' field
[ 1783027 ] Add descriptive info to AD_Session (like Role) [ 1755175 ] ad_changelog should capture insert too
This commit is contained in:
parent
97151d1485
commit
8e6133e094
|
@ -127,6 +127,19 @@ public interface I_AD_ChangeLog
|
||||||
*/
|
*/
|
||||||
public String getDescription();
|
public String getDescription();
|
||||||
|
|
||||||
|
/** Column name EventChangeLog */
|
||||||
|
public static final String COLUMNNAME_EventChangeLog = "EventChangeLog";
|
||||||
|
|
||||||
|
/** Set Event Change Log.
|
||||||
|
* Type of Event in Change Log
|
||||||
|
*/
|
||||||
|
public void setEventChangeLog (String EventChangeLog);
|
||||||
|
|
||||||
|
/** Get Event Change Log.
|
||||||
|
* Type of Event in Change Log
|
||||||
|
*/
|
||||||
|
public String getEventChangeLog();
|
||||||
|
|
||||||
/** Column name IsCustomization */
|
/** Column name IsCustomization */
|
||||||
public static final String COLUMNNAME_IsCustomization = "IsCustomization";
|
public static final String COLUMNNAME_IsCustomization = "IsCustomization";
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
package org.compiere.model;
|
package org.compiere.model;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.Timestamp;
|
||||||
import org.compiere.util.KeyNamePair;
|
import org.compiere.util.KeyNamePair;
|
||||||
|
|
||||||
/** Generated Interface for AD_Session
|
/** Generated Interface for AD_Session
|
||||||
|
@ -56,6 +57,21 @@ public interface I_AD_Session
|
||||||
|
|
||||||
/** Load Meta Data */
|
/** Load Meta Data */
|
||||||
|
|
||||||
|
/** Column name AD_Role_ID */
|
||||||
|
public static final String COLUMNNAME_AD_Role_ID = "AD_Role_ID";
|
||||||
|
|
||||||
|
/** Set Role.
|
||||||
|
* Responsibility Role
|
||||||
|
*/
|
||||||
|
public void setAD_Role_ID (int AD_Role_ID);
|
||||||
|
|
||||||
|
/** Get Role.
|
||||||
|
* Responsibility Role
|
||||||
|
*/
|
||||||
|
public int getAD_Role_ID();
|
||||||
|
|
||||||
|
public I_AD_Role getAD_Role() throws Exception;
|
||||||
|
|
||||||
/** Column name AD_Session_ID */
|
/** Column name AD_Session_ID */
|
||||||
public static final String COLUMNNAME_AD_Session_ID = "AD_Session_ID";
|
public static final String COLUMNNAME_AD_Session_ID = "AD_Session_ID";
|
||||||
|
|
||||||
|
@ -69,6 +85,28 @@ public interface I_AD_Session
|
||||||
*/
|
*/
|
||||||
public int getAD_Session_ID();
|
public int getAD_Session_ID();
|
||||||
|
|
||||||
|
/** 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 LoginDate */
|
||||||
|
public static final String COLUMNNAME_LoginDate = "LoginDate";
|
||||||
|
|
||||||
|
/** Set Login date */
|
||||||
|
public void setLoginDate (Timestamp LoginDate);
|
||||||
|
|
||||||
|
/** Get Login date */
|
||||||
|
public Timestamp getLoginDate();
|
||||||
|
|
||||||
/** Column name Processed */
|
/** Column name Processed */
|
||||||
public static final String COLUMNNAME_Processed = "Processed";
|
public static final String COLUMNNAME_Processed = "Processed";
|
||||||
|
|
||||||
|
|
|
@ -168,13 +168,10 @@ public class MChangeLog extends X_AD_ChangeLog
|
||||||
//
|
//
|
||||||
setOldValue (OldValue);
|
setOldValue (OldValue);
|
||||||
setNewValue (NewValue);
|
setNewValue (NewValue);
|
||||||
|
setEventChangeLog(event);
|
||||||
// EVENT / Release 3.3.1t_2007-12-05 ADempiere
|
// EVENT / Release 3.3.1t_2007-12-05 ADempiere
|
||||||
if (event != null)
|
// Drop description from AD_ChangeLog - pass it to AD_Session to save disk space
|
||||||
setDescription(event + " / " + Adempiere.MAIN_VERSION + "_"
|
// setDescription(Adempiere.MAIN_VERSION + "_" + Adempiere.DATE_VERSION + " " + Adempiere.getImplementationVersion());
|
||||||
+ Adempiere.DATE_VERSION + " " + Adempiere.getImplementationVersion());
|
|
||||||
else
|
|
||||||
setDescription(Adempiere.MAIN_VERSION + "_"
|
|
||||||
+ Adempiere.DATE_VERSION + " " + Adempiere.getImplementationVersion());
|
|
||||||
} // MChangeLog
|
} // MChangeLog
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@ import java.net.*;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.*;
|
import java.util.logging.*;
|
||||||
|
|
||||||
|
import org.compiere.Adempiere;
|
||||||
import org.compiere.util.*;
|
import org.compiere.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -142,6 +144,11 @@ public class MSession extends X_AD_Session
|
||||||
setRemote_Host(Remote_Host);
|
setRemote_Host(Remote_Host);
|
||||||
if (WebSession != null)
|
if (WebSession != null)
|
||||||
setWebSession(WebSession);
|
setWebSession(WebSession);
|
||||||
|
setDescription(Adempiere.MAIN_VERSION + "_"
|
||||||
|
+ Adempiere.DATE_VERSION + " "
|
||||||
|
+ Adempiere.getImplementationVersion());
|
||||||
|
setAD_Role_ID(Env.getContextAsInt(ctx, "#AD_Role_ID"));
|
||||||
|
setLoginDate(Env.getContextAsDate(ctx, "#Date"));
|
||||||
} // MSession
|
} // MSession
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -157,6 +164,11 @@ public class MSession extends X_AD_Session
|
||||||
InetAddress lh = InetAddress.getLocalHost();
|
InetAddress lh = InetAddress.getLocalHost();
|
||||||
setRemote_Addr(lh.getHostAddress());
|
setRemote_Addr(lh.getHostAddress());
|
||||||
setRemote_Host(lh.getHostName());
|
setRemote_Host(lh.getHostName());
|
||||||
|
setDescription(Adempiere.MAIN_VERSION + "_"
|
||||||
|
+ Adempiere.DATE_VERSION + " "
|
||||||
|
+ Adempiere.getImplementationVersion());
|
||||||
|
setAD_Role_ID(Env.getContextAsInt(ctx, "#AD_Role_ID"));
|
||||||
|
setLoginDate(Env.getContextAsDate(ctx, "#Date"));
|
||||||
}
|
}
|
||||||
catch (UnknownHostException e)
|
catch (UnknownHostException e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2195,7 +2195,7 @@ public abstract class PO
|
||||||
MChangeLog cLog = session.changeLog (
|
MChangeLog cLog = session.changeLog (
|
||||||
m_trxName, AD_ChangeLog_ID,
|
m_trxName, AD_ChangeLog_ID,
|
||||||
p_info.getAD_Table_ID(), p_info.getColumn(i).AD_Column_ID,
|
p_info.getAD_Table_ID(), p_info.getColumn(i).AD_Column_ID,
|
||||||
get_ID(), getAD_Client_ID(), getAD_Org_ID(), oldV, newV, "UPDATE");
|
get_ID(), getAD_Client_ID(), getAD_Org_ID(), oldV, newV, MChangeLog.EVENTCHANGELOG_Update);
|
||||||
if (cLog != null)
|
if (cLog != null)
|
||||||
AD_ChangeLog_ID = cLog.getAD_ChangeLog_ID();
|
AD_ChangeLog_ID = cLog.getAD_ChangeLog_ID();
|
||||||
}
|
}
|
||||||
|
@ -2407,14 +2407,14 @@ public abstract class PO
|
||||||
&& !p_info.isEncrypted(i) // not encrypted
|
&& !p_info.isEncrypted(i) // not encrypted
|
||||||
&& !p_info.isVirtualColumn(i) // no virtual column
|
&& !p_info.isVirtualColumn(i) // no virtual column
|
||||||
&& !"Password".equals(columnName)
|
&& !"Password".equals(columnName)
|
||||||
&& p_info.getColumn(i).IsKey // log just the key - to log all columns comment this line
|
// && p_info.getColumn(i).IsKey // log all record - to log just ID uncomment this line
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// change log on new
|
// change log on new
|
||||||
MChangeLog cLog = session.changeLog (
|
MChangeLog cLog = session.changeLog (
|
||||||
m_trxName, AD_ChangeLog_ID,
|
m_trxName, AD_ChangeLog_ID,
|
||||||
p_info.getAD_Table_ID(), p_info.getColumn(i).AD_Column_ID,
|
p_info.getAD_Table_ID(), p_info.getColumn(i).AD_Column_ID,
|
||||||
get_ID(), getAD_Client_ID(), getAD_Org_ID(), null, value, "INSERT");
|
get_ID(), getAD_Client_ID(), getAD_Org_ID(), null, value, MChangeLog.EVENTCHANGELOG_Insert);
|
||||||
if (cLog != null)
|
if (cLog != null)
|
||||||
AD_ChangeLog_ID = cLog.getAD_ChangeLog_ID();
|
AD_ChangeLog_ID = cLog.getAD_ChangeLog_ID();
|
||||||
}
|
}
|
||||||
|
@ -2680,7 +2680,7 @@ public abstract class PO
|
||||||
MChangeLog cLog = session.changeLog (
|
MChangeLog cLog = session.changeLog (
|
||||||
m_trxName != null ? m_trxName : localTrxName, AD_ChangeLog_ID,
|
m_trxName != null ? m_trxName : localTrxName, AD_ChangeLog_ID,
|
||||||
AD_Table_ID, p_info.getColumn(i).AD_Column_ID,
|
AD_Table_ID, p_info.getColumn(i).AD_Column_ID,
|
||||||
Record_ID, getAD_Client_ID(), getAD_Org_ID(), value, null, "DELETE");
|
Record_ID, getAD_Client_ID(), getAD_Org_ID(), value, null, MChangeLog.EVENTCHANGELOG_Delete);
|
||||||
if (cLog != null)
|
if (cLog != null)
|
||||||
AD_ChangeLog_ID = cLog.getAD_ChangeLog_ID();
|
AD_ChangeLog_ID = cLog.getAD_ChangeLog_ID();
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,6 +244,38 @@ public class X_AD_ChangeLog extends PO implements I_AD_ChangeLog, I_Persistent
|
||||||
return (String)get_Value(COLUMNNAME_Description);
|
return (String)get_Value(COLUMNNAME_Description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** EventChangeLog AD_Reference_ID=53238 */
|
||||||
|
public static final int EVENTCHANGELOG_AD_Reference_ID=53238;
|
||||||
|
/** Insert = I */
|
||||||
|
public static final String EVENTCHANGELOG_Insert = "I";
|
||||||
|
/** Delete = D */
|
||||||
|
public static final String EVENTCHANGELOG_Delete = "D";
|
||||||
|
/** Update = U */
|
||||||
|
public static final String EVENTCHANGELOG_Update = "U";
|
||||||
|
/** Set Event Change Log.
|
||||||
|
@param EventChangeLog
|
||||||
|
Type of Event in Change Log
|
||||||
|
*/
|
||||||
|
public void setEventChangeLog (String EventChangeLog)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (EventChangeLog == null || EventChangeLog.equals("I") || EventChangeLog.equals("D") || EventChangeLog.equals("U")); else throw new IllegalArgumentException ("EventChangeLog Invalid value - " + EventChangeLog + " - Reference_ID=53238 - I - D - U");
|
||||||
|
if (EventChangeLog != null && EventChangeLog.length() > 1)
|
||||||
|
{
|
||||||
|
log.warning("Length > 1 - truncated");
|
||||||
|
EventChangeLog = EventChangeLog.substring(0, 1);
|
||||||
|
}
|
||||||
|
set_Value (COLUMNNAME_EventChangeLog, EventChangeLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get Event Change Log.
|
||||||
|
@return Type of Event in Change Log
|
||||||
|
*/
|
||||||
|
public String getEventChangeLog ()
|
||||||
|
{
|
||||||
|
return (String)get_Value(COLUMNNAME_EventChangeLog);
|
||||||
|
}
|
||||||
|
|
||||||
/** Set Customization.
|
/** Set Customization.
|
||||||
@param IsCustomization
|
@param IsCustomization
|
||||||
The change is a customization of the data dictionary and can be applied after Migration
|
The change is a customization of the data dictionary and can be applied after Migration
|
||||||
|
|
|
@ -17,8 +17,11 @@
|
||||||
/** Generated Model - DO NOT CHANGE */
|
/** Generated Model - DO NOT CHANGE */
|
||||||
package org.compiere.model;
|
package org.compiere.model;
|
||||||
|
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.Timestamp;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.logging.Level;
|
||||||
import org.compiere.util.KeyNamePair;
|
import org.compiere.util.KeyNamePair;
|
||||||
|
|
||||||
/** Generated Model for AD_Session
|
/** Generated Model for AD_Session
|
||||||
|
@ -71,6 +74,45 @@ public class X_AD_Session extends PO implements I_AD_Session, I_Persistent
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public I_AD_Role getAD_Role() throws Exception
|
||||||
|
{
|
||||||
|
Class<?> clazz = MTable.getClass(I_AD_Role.Table_Name);
|
||||||
|
I_AD_Role result = null;
|
||||||
|
try {
|
||||||
|
Constructor<?> constructor = null;
|
||||||
|
constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class});
|
||||||
|
result = (I_AD_Role)constructor.newInstance(new Object[] {getCtx(), new Integer(getAD_Role_ID()), get_TrxName()});
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e);
|
||||||
|
log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Set Role.
|
||||||
|
@param AD_Role_ID
|
||||||
|
Responsibility Role
|
||||||
|
*/
|
||||||
|
public void setAD_Role_ID (int AD_Role_ID)
|
||||||
|
{
|
||||||
|
if (AD_Role_ID < 0)
|
||||||
|
set_Value (COLUMNNAME_AD_Role_ID, null);
|
||||||
|
else
|
||||||
|
set_Value (COLUMNNAME_AD_Role_ID, Integer.valueOf(AD_Role_ID));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get Role.
|
||||||
|
@return Responsibility Role
|
||||||
|
*/
|
||||||
|
public int getAD_Role_ID ()
|
||||||
|
{
|
||||||
|
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Role_ID);
|
||||||
|
if (ii == null)
|
||||||
|
return 0;
|
||||||
|
return ii.intValue();
|
||||||
|
}
|
||||||
|
|
||||||
/** Set Session.
|
/** Set Session.
|
||||||
@param AD_Session_ID
|
@param AD_Session_ID
|
||||||
User Session Online or Web
|
User Session Online or Web
|
||||||
|
@ -101,6 +143,43 @@ public class X_AD_Session extends PO implements I_AD_Session, I_Persistent
|
||||||
return new KeyNamePair(get_ID(), String.valueOf(getAD_Session_ID()));
|
return new KeyNamePair(get_ID(), String.valueOf(getAD_Session_ID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Set Description.
|
||||||
|
@param Description
|
||||||
|
Optional short description of the record
|
||||||
|
*/
|
||||||
|
public void setDescription (String Description)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (Description != null && Description.length() > 255)
|
||||||
|
{
|
||||||
|
log.warning("Length > 255 - truncated");
|
||||||
|
Description = Description.substring(0, 255);
|
||||||
|
}
|
||||||
|
set_Value (COLUMNNAME_Description, Description);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get Description.
|
||||||
|
@return Optional short description of the record
|
||||||
|
*/
|
||||||
|
public String getDescription ()
|
||||||
|
{
|
||||||
|
return (String)get_Value(COLUMNNAME_Description);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Set Login date.
|
||||||
|
@param LoginDate Login date */
|
||||||
|
public void setLoginDate (Timestamp LoginDate)
|
||||||
|
{
|
||||||
|
set_Value (COLUMNNAME_LoginDate, LoginDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get Login date.
|
||||||
|
@return Login date */
|
||||||
|
public Timestamp getLoginDate ()
|
||||||
|
{
|
||||||
|
return (Timestamp)get_Value(COLUMNNAME_LoginDate);
|
||||||
|
}
|
||||||
|
|
||||||
/** Set Processed.
|
/** Set Processed.
|
||||||
@param Processed
|
@param Processed
|
||||||
The document has been processed
|
The document has been processed
|
||||||
|
|
|
@ -200,7 +200,8 @@ public class ChangeLogProcess extends SvrProcess
|
||||||
m_oldRecord_ID = cLog.getRecord_ID();
|
m_oldRecord_ID = cLog.getRecord_ID();
|
||||||
|
|
||||||
// Insert - new value is null and UnDo only
|
// Insert - new value is null and UnDo only
|
||||||
m_isInsert = cLog.isNewNull() && p_CheckNewValue != null;
|
// m_isInsert = cLog.isNewNull() && p_CheckNewValue != null;
|
||||||
|
m_isInsert = MChangeLog.EVENTCHANGELOG_Insert.equals(cLog.getEventChangeLog());
|
||||||
if (m_isInsert)
|
if (m_isInsert)
|
||||||
{
|
{
|
||||||
m_sqlInsert = new StringBuffer ("INSERT INTO ")
|
m_sqlInsert = new StringBuffer ("INSERT INTO ")
|
||||||
|
|
Loading…
Reference in New Issue