Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Helper for audit logs
  */
 package pt.webdetails.cpf.audit;
 
 import  org.pentaho.platform.api.engine.IParameterProvider;
 
 
import  org.pentaho.platform.api.engine.ILogger;
import  org.pentaho.platform.api.engine.IPentahoSession;
import  org.pentaho.platform.engine.core.audit.AuditHelper;
import  org.pentaho.platform.engine.core.audit.MessageTypes;
public class CpfAuditHelper {

Start Audit Event

Parameters:
processId Id for the audit process (usually the plugin name)
actionName Name of the action
objectName Object of the action
userSession Pentaho User Session
logger Logger object
requestParams parameters associated to the request
Returns:
UUID of start event
	static public UUID startAudit(String processIdString actionNameString objectName, IPentahoSession userSession,ILogger logger, IParameterProvider requestParams) {
		UUID uuid=UUID.randomUUID();
    StringBuilder sb = new StringBuilder();
    if (requestParams != null) {
      Iterator iter = requestParams.getParameterNames();
      while (iter.hasNext()) {
        String paramName = iter.next().toString();
        sb.append(paramName).append("=").append(requestParams.getStringParameter(paramName"novalue")).append(";");
      }
    }
      
    
    
		AuditHelper.audit(userSession.getId(), userSession.getName(), actionNameobjectNameprocessId,
				MessageTypes.INSTANCE_START, uuid.toString(), sb.toString(), 0, logger);
		return uuid;
	}

End Audit Event

Parameters:
processId Id for the audit process (usually the plugin name)
actionName Name of the action
objectName Object of the action
userSession Pentaho User Session
logger Logger object
start Start time in Millis Seconds
uuid UUID of start event
end End time in Millis Seconds
	static public void endAudit(String processIdString actionNameString objectName, IPentahoSession userSession,ILogger loggerlong start,UUID uuidlong end) {
    AuditHelper.audit(userSession.getId(), userSession.getName(), actionNameobjectNameprocessId,
				MessageTypes.INSTANCE_END, uuid.toString(),"", ((float) (end - start) / 1000), logger);
	}
New to GrepCode? Check out our FAQ X