org.processmining.framework.log.rfb
Class LightweightLogSummary

java.lang.Object
  extended by org.processmining.framework.log.rfb.LightweightLogSummary
All Implemented Interfaces:
LogSummary

public class LightweightLogSummary
extends java.lang.Object
implements LogSummary

This class implements the log summary data structure in a lightweight manner. This means, best effort has been taken to ensure minimal memory footprint and runtime overhead. The implementation is fully compliant to the LogSummary interface, with significantly decreased runtime costs.

Author:
Christian W. Guenther (christian at deckfour dot org)

Nested Class Summary
protected  class LightweightLogSummary.ProcessBoundary
          A simple record for storing a process's start and end date.
 
Field Summary
protected  java.util.HashMap<LogEvent,java.lang.Integer> endingLogEvents
          Mapping from log events that end a process instance to the amount of times that these log events actually end a process instance
protected  java.util.TreeSet<java.lang.String> eventTypes
          Alphabetically ordered set containing as strings the log's event types.
protected static long future
          UNIX timestamp for a date, which is significantly far into the future.
protected  LogEvents logEvents
          Extended array list containing the log's events, i.e.
protected  java.util.HashMap<LogEvent,java.util.Set<ProcessInstance>> mapEventToProcessInstances
          Mapping from log events to process instances in which the respective event occurs.
protected  java.util.HashMap<java.lang.String,java.util.HashMap<LogEvent,java.lang.Integer>> mapOriginatorsToEvents
          Mapping from log events to the set of originator strings which have been found to execute this log event.
protected  java.util.TreeSet<java.lang.String> modelElements
          Alphabetically ordered set containing as strings the log's model elements.
protected  int numberOfAuditTrailEntries
          The total number of audit trail entries contained in a log.
protected  int numberOfProcessInstances
          The total number of process instances contained in a log.
protected  int numberOfUniqueProcessInstances
          The number of unique process instances contained in a log.
protected  java.util.TreeSet<java.lang.String> originators
          Alphabetically ordered set containing as strings the log's originators.
protected  java.util.HashMap<java.lang.String,LightweightLogSummary.ProcessBoundary> processBoundaries
          The boundaries, i.e.
protected  java.util.ArrayList<InfoItem> processInfoItems
          List of info items containing meta information about the set of processes.
protected  java.util.HashMap<java.lang.Integer,java.util.Set<java.lang.String>> processInstancesOccurrences
          Mapping from process instance occurrences to the actual process instance identifiers.
protected  InfoItem source
          Meta information about the source system.
protected  java.util.HashMap<LogEvent,java.lang.Integer> startingLogEvents
          Mapping from log events that start a process instance to the amount of times that these log events actually start a process instance
protected  InfoItem wfLog
          Meta information about the source log.
 
Constructor Summary
LightweightLogSummary()
          Creates a new, empty and initialized lightweight log summary instance.
LightweightLogSummary(java.lang.String logName, java.lang.String logDescription, java.util.Map<java.lang.String,java.lang.String> logData, java.lang.String sourceProgram, java.util.Map<java.lang.String,java.lang.String> sourceData)
          Creates a new lightweight log summary.
 
Method Summary
 void addAuditTrailEntry(AuditTrailEntry ate, ProcessInstance instance)
          Adds, or registers, a new audit trail entry contained in the summarized log.
 void addLogAttribute(java.lang.String key, java.lang.String value)
          Adds an attribute to the summarized log.
 void addProcess(java.lang.String name, java.lang.String description, java.util.Map<java.lang.String,java.lang.String> data)
          Adds, or registers, a new process contained in the summarized log.
 void addProcessInstance(ProcessInstance instance)
          Adds, or registers, a new process instance contained in the summarized log.
 void addSourceAttribute(java.lang.String key, java.lang.String value)
          Adds an attribute to the log's source program.
 java.util.HashMap<LogEvent,java.lang.Integer> getEndingLogEvents()
          Returns the mapping between the ending log events and the number of times they end a process instance.
 java.util.Date getEndTime(java.lang.String process)
          Returns the latest timestamp in all audittrailentries of the given process
 java.util.Set<LogEvent> getEventsForInstance(ProcessInstance instance)
          Returns the set of log events occurring in the specified process instance.
 java.util.HashMap<LogEvent,java.lang.Integer> getEventsForOriginator(java.lang.String originator)
          Returns a Map, whose keys are the events which have been executed by the specified originator.
 java.lang.String[] getEventTypes()
          Returns an alphabetically sorted list of all event types in the log.
 java.util.Set<ProcessInstance> getInstancesForEvent(LogEvent event)
          Returns a set of (references to) process instances, in which the provided log event occurs.
 LogEvents getLogEvents()
          Returns a list of all log events (unique model element name and event type combinations) in the log.
 java.lang.String[] getModelElements()
          Returns an alphabetically sorted list of all model element names in the log.
 int getNumberOfAuditTrailEntries()
          Returns the total number of audit trail entries in the log.
 int getNumberOfProcessInstances()
          Returns the total number of process instances in the log.
 int getNumberOfUniqueProcessInstances()
          Returns the number of different process instances in the log.
 java.lang.String[] getOriginators()
          Returns an alphabetically sorted list of all originators in the log.
 InfoItem[] getProcesses()
          Returns information about all the processes in the log.
 java.util.HashMap<java.lang.Integer,java.util.Set<java.lang.String>> getProcessInstancesOccurrences()
          Returns the mapping between process instances occurrences and the names of the process instances that occurred a certain amount of times.
 InfoItem getSource()
          Returns information about the source.
 java.util.HashMap<LogEvent,java.lang.Integer> getStartingLogEvents()
          Returns the mapping between the starting log events and the number of times they start a process instance.
 java.util.Date getStartTime(java.lang.String process)
          Returns the earliest timestamp in all audittrailentries of the given process
 InfoItem getWorkflowLog()
          Returns information about the workflow log itself.
 int hashCode()
           
 void removeProcess(java.lang.String name)
          Removes information about the given process from the summary.
 void setLogDescription(java.lang.String logDescription)
          Sets the description of the summarized log.
 void setLogName(java.lang.String logName)
          Sets the name of the summarized log.
 void setSourceProgram(java.lang.String sourceProgram)
          Sets the name of the log's source program.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

future

protected static long future
UNIX timestamp for a date, which is significantly far into the future.


numberOfAuditTrailEntries

protected int numberOfAuditTrailEntries
The total number of audit trail entries contained in a log.


numberOfProcessInstances

protected int numberOfProcessInstances
The total number of process instances contained in a log.


numberOfUniqueProcessInstances

protected int numberOfUniqueProcessInstances
The number of unique process instances contained in a log.


eventTypes

protected java.util.TreeSet<java.lang.String> eventTypes
Alphabetically ordered set containing as strings the log's event types.


processInstancesOccurrences

protected java.util.HashMap<java.lang.Integer,java.util.Set<java.lang.String>> processInstancesOccurrences
Mapping from process instance occurrences to the actual process instance identifiers.


startingLogEvents

protected java.util.HashMap<LogEvent,java.lang.Integer> startingLogEvents
Mapping from log events that start a process instance to the amount of times that these log events actually start a process instance


endingLogEvents

protected java.util.HashMap<LogEvent,java.lang.Integer> endingLogEvents
Mapping from log events that end a process instance to the amount of times that these log events actually end a process instance


originators

protected java.util.TreeSet<java.lang.String> originators
Alphabetically ordered set containing as strings the log's originators.


modelElements

protected java.util.TreeSet<java.lang.String> modelElements
Alphabetically ordered set containing as strings the log's model elements.


logEvents

protected LogEvents logEvents
Extended array list containing the log's events, i.e. unique element/type combinations.


mapOriginatorsToEvents

protected java.util.HashMap<java.lang.String,java.util.HashMap<LogEvent,java.lang.Integer>> mapOriginatorsToEvents
Mapping from log events to the set of originator strings which have been found to execute this log event.


mapEventToProcessInstances

protected java.util.HashMap<LogEvent,java.util.Set<ProcessInstance>> mapEventToProcessInstances
Mapping from log events to process instances in which the respective event occurs.


processBoundaries

protected java.util.HashMap<java.lang.String,LightweightLogSummary.ProcessBoundary> processBoundaries
The boundaries, i.e. dates of first and last event, of each process, referenced by the process's name.


processInfoItems

protected java.util.ArrayList<InfoItem> processInfoItems
List of info items containing meta information about the set of processes.


wfLog

protected InfoItem wfLog
Meta information about the source log.


source

protected InfoItem source
Meta information about the source system.

Constructor Detail

LightweightLogSummary

public LightweightLogSummary(java.lang.String logName,
                             java.lang.String logDescription,
                             java.util.Map<java.lang.String,java.lang.String> logData,
                             java.lang.String sourceProgram,
                             java.util.Map<java.lang.String,java.lang.String> sourceData)
Creates a new lightweight log summary.

Parameters:
logName - Name (e.g. file name) of the summarized log.
logDescription - Description of the summarized log.
logData - Set of attributes, as key-value pairs, associated with the summarized log.
sourceProgram - Name of the program from which the summarized log has been acquired.
sourceData - Set of attributes, as key-value pairs, associated with the program from which the summarized log has been acquired.

LightweightLogSummary

public LightweightLogSummary()
Creates a new, empty and initialized lightweight log summary instance.

Method Detail

addProcess

public void addProcess(java.lang.String name,
                       java.lang.String description,
                       java.util.Map<java.lang.String,java.lang.String> data)
Adds, or registers, a new process contained in the summarized log.

Parameters:
name - Name, or ID, of the process.
description - Description of the process.
data - Set of attributes, as key-value pairs, associated with the process.

getProcessInstancesOccurrences

public java.util.HashMap<java.lang.Integer,java.util.Set<java.lang.String>> getProcessInstancesOccurrences()
Description copied from interface: LogSummary
Returns the mapping between process instances occurrences and the names of the process instances that occurred a certain amount of times.

Specified by:
getProcessInstancesOccurrences in interface LogSummary
Returns:
A mapping between process intance occurrences.

getStartingLogEvents

public java.util.HashMap<LogEvent,java.lang.Integer> getStartingLogEvents()
Description copied from interface: LogSummary
Returns the mapping between the starting log events and the number of times they start a process instance.

Specified by:
getStartingLogEvents in interface LogSummary
Returns:
A mapping between starting log events occurrence.

getEndingLogEvents

public java.util.HashMap<LogEvent,java.lang.Integer> getEndingLogEvents()
Description copied from interface: LogSummary
Returns the mapping between the ending log events and the number of times they end a process instance.

Specified by:
getEndingLogEvents in interface LogSummary
Returns:
A mapping between starting log events occurrence.

removeProcess

public void removeProcess(java.lang.String name)
Removes information about the given process from the summary.

Parameters:
name - Name of the process to remove.

addProcessInstance

public void addProcessInstance(ProcessInstance instance)
                        throws java.lang.IndexOutOfBoundsException,
                               java.io.IOException
Adds, or registers, a new process instance contained in the summarized log. This method will also add all audit trail entries contained in the provided process instance (by calling addAuditTrailEntry()).

Parameters:
instance - The process instance to be added.
Throws:
java.lang.IndexOutOfBoundsException
java.io.IOException

addAuditTrailEntry

public void addAuditTrailEntry(AuditTrailEntry ate,
                               ProcessInstance instance)
Adds, or registers, a new audit trail entry contained in the summarized log.

Parameters:
ate - The audit trail entry to be registered.
instance - The process instance in which the audit trail entry occurs.

getStartTime

public java.util.Date getStartTime(java.lang.String process)
Description copied from interface: LogSummary
Returns the earliest timestamp in all audittrailentries of the given process

Specified by:
getStartTime in interface LogSummary
Parameters:
process - Name of the process
Returns:
Date null in case the log does not contain any timestamp for this process

getEndTime

public java.util.Date getEndTime(java.lang.String process)
Description copied from interface: LogSummary
Returns the latest timestamp in all audittrailentries of the given process

Specified by:
getEndTime in interface LogSummary
Parameters:
process - Name of the process
Returns:
Date null in case the log does not contain any timestamp for this process

getEventTypes

public java.lang.String[] getEventTypes()
Description copied from interface: LogSummary
Returns an alphabetically sorted list of all event types in the log.

Specified by:
getEventTypes in interface LogSummary
Returns:
an alphabetically sorted list of all event types in the log

getLogEvents

public LogEvents getLogEvents()
Description copied from interface: LogSummary
Returns a list of all log events (unique model element name and event type combinations) in the log.

Specified by:
getLogEvents in interface LogSummary
Returns:
a list of all log events in the log

getModelElements

public java.lang.String[] getModelElements()
Description copied from interface: LogSummary
Returns an alphabetically sorted list of all model element names in the log.

Specified by:
getModelElements in interface LogSummary
Returns:
an alphabetically sorted list of all model element names in the log

getNumberOfAuditTrailEntries

public int getNumberOfAuditTrailEntries()
Description copied from interface: LogSummary
Returns the total number of audit trail entries in the log.

Specified by:
getNumberOfAuditTrailEntries in interface LogSummary
Returns:
the total number of audit trail entries in the log

getNumberOfProcessInstances

public int getNumberOfProcessInstances()
Description copied from interface: LogSummary
Returns the total number of process instances in the log.

Specified by:
getNumberOfProcessInstances in interface LogSummary
Returns:
the total number of process instances in the log

getNumberOfUniqueProcessInstances

public int getNumberOfUniqueProcessInstances()
Description copied from interface: LogSummary
Returns the number of different process instances in the log.

Specified by:
getNumberOfUniqueProcessInstances in interface LogSummary
Returns:
the number different of process instances in the log

getOriginators

public java.lang.String[] getOriginators()
Description copied from interface: LogSummary
Returns an alphabetically sorted list of all originators in the log.

Specified by:
getOriginators in interface LogSummary
Returns:
an alphabetically sorted list of all originators in the log

getProcesses

public InfoItem[] getProcesses()
Description copied from interface: LogSummary
Returns information about all the processes in the log. Provides an array with one entry per process. Each entry contains the 'id' and 'description' attributes of the 'process' tag and the contents of the 'data' section.

Specified by:
getProcesses in interface LogSummary
Returns:
information about the processes

getSource

public InfoItem getSource()
Description copied from interface: LogSummary
Returns information about the source. Provides 'program' attribute of the 'source' tag and the contents of the 'data' section.

Specified by:
getSource in interface LogSummary
Returns:
information about the source

getWorkflowLog

public InfoItem getWorkflowLog()
Description copied from interface: LogSummary
Returns information about the workflow log itself. Provides the 'description' attribute of the 'workflow' tag and the contents of the 'data' section.

Specified by:
getWorkflowLog in interface LogSummary
Returns:
information about the workflow log itself

setLogName

public void setLogName(java.lang.String logName)
Sets the name of the summarized log.

Parameters:
logName - The name of the summarized log.

setLogDescription

public void setLogDescription(java.lang.String logDescription)
Sets the description of the summarized log.

Parameters:
logDescription - The description of the summarized log.

addLogAttribute

public void addLogAttribute(java.lang.String key,
                            java.lang.String value)
Adds an attribute to the summarized log.

Parameters:
key - Key of the attribute to add.
value - Value of the attribute to add.

setSourceProgram

public void setSourceProgram(java.lang.String sourceProgram)
Sets the name of the log's source program.

Parameters:
sourceProgram - The name of the log's source program.

addSourceAttribute

public void addSourceAttribute(java.lang.String key,
                               java.lang.String value)
Adds an attribute to the log's source program.

Parameters:
key - Key of the attribute to add.
value - Value of the attribute to add.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getEventsForInstance

public java.util.Set<LogEvent> getEventsForInstance(ProcessInstance instance)
Description copied from interface: LogSummary
Returns the set of log events occurring in the specified process instance.

Specified by:
getEventsForInstance in interface LogSummary
Parameters:
instance - Process instance to find log events for.
Returns:
A set of log events.

getEventsForOriginator

public java.util.HashMap<LogEvent,java.lang.Integer> getEventsForOriginator(java.lang.String originator)
Description copied from interface: LogSummary
Returns a Map, whose keys are the events which have been executed by the specified originator. The values for each key indicate how often the originator has performed the task.

Specified by:
getEventsForOriginator in interface LogSummary
Parameters:
originator - Originator as string.
Returns:
A hashmap with log events executed by the specified originator, and the number of times that the originator performed each event.

getInstancesForEvent

public java.util.Set<ProcessInstance> getInstancesForEvent(LogEvent event)
Description copied from interface: LogSummary
Returns a set of (references to) process instances, in which the provided log event occurs.

Specified by:
getInstancesForEvent in interface LogSummary
Parameters:
event - Log event to find instances for.
Returns:
A set of process instances.