de.uni.freiburg.iig.telematik.sewol.log.CommonLogEntries Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of SEWOL Show documentation
Show all versions of SEWOL Show documentation
SEWOL provides support for the handling of workflow traces. Specifically it allows to specify the shape and content of process traces in terms of entries representing the execution of a specific workflow activity. SEWOL also allows to write these traces on disk as a log file with the help of a special file writer for process logs. Currently it supports plain text, Petrify, MXML and XES log file types. In order to specify security-related context information, SEWOL provides access control models such as access control lists (ACL) and role-based access control models (RBAC). All types of models can be conveniently edited with the help of appropriate dialogs.
package de.uni.freiburg.iig.telematik.sewol.log;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import de.invation.code.toval.validate.ParameterException;
import de.invation.code.toval.validate.Validate;
public class CommonLogEntries {
Map, List>> commonEntries = new HashMap<>();;
public CommonLogEntries(LogTrace...traces) throws ParameterException{
Validate.noNullElements(traces);
for(LogTrace trace: traces){
Map> traceEntries = getEntryActivityMap(trace);
if(commonEntries.isEmpty()){
//First run
for(String activity: traceEntries.keySet()){
Map, List> newMap = new HashMap<>();
newMap.put(trace, traceEntries.get(activity));
commonEntries.put(activity, newMap);
}
} else {
Set keysToRemove = new HashSet<>();
for(String activity: commonEntries.keySet()){
if(traceEntries.keySet().contains(activity)){
commonEntries.get(activity).put(trace, trace.getEntriesForActivity(activity));
} else {
keysToRemove.add(activity);
}
}
for(String key: keysToRemove){
commonEntries.remove(key);
}
}
}
}
public Map> getEntryActivityMap(LogTrace trace) throws ParameterException{
Map> result = new HashMap<>();
for(String activity: trace.getDistinctActivities()){
result.put(activity, trace.getEntriesForActivity(activity));
}
return result;
}
public boolean isEmpty(){
return commonEntries.isEmpty();
}
public boolean isCommonEntry(String activity){
return commonEntries.containsKey(activity);
}
public Set getCommonEntries(){
return commonEntries.keySet();
}
public Map, List> getTraceMap(String activity){
if(activity == null)
throw new NullPointerException();
if(!commonEntries.containsKey(activity))
return null;
return commonEntries.get(activity);
}
public List getEntriesFor(String activity, LogTrace trace){
if(activity == null)
throw new NullPointerException();
if(!commonEntries.containsKey(activity))
return null;
if(!commonEntries.get(activity).containsKey(trace))
return null;
return commonEntries.get(activity).get(trace);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy