de.uni.freiburg.iig.telematik.sewol.parser.AbstractLogParser 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.
The newest version!
package de.uni.freiburg.iig.telematik.sewol.parser;
import de.invation.code.toval.parser.ParserException;
import java.util.List;
import de.invation.code.toval.validate.ParameterException;
import de.invation.code.toval.validate.ParameterException.ErrorCode;
import de.invation.code.toval.validate.Validate;
import de.uni.freiburg.iig.telematik.sewol.log.LogEntry;
import de.uni.freiburg.iig.telematik.sewol.log.LogSummary;
import de.uni.freiburg.iig.telematik.sewol.log.LogTrace;
import java.io.File;
import java.util.ArrayList;
public abstract class AbstractLogParser implements LogParserInterface {
protected List>> parsedLogFiles = null;
protected final List> summaries = new ArrayList<>();
protected boolean parsed() {
return parsedLogFiles != null;
}
protected int parsedLogFiles() {
if (!parsed()) {
return 0;
}
return parsedLogFiles.size();
}
@Override
public List> getParsedLog(int index) throws ParameterException {
if (!parsed()) {
throw new ParameterException("Log not parsed yet!");
}
Validate.notNegative(index);
if (index > parsedLogFiles() - 1) {
throw new ParameterException(ErrorCode.RANGEVIOLATION, "No log for index " + index);
}
return parsedLogFiles.get(index);
}
@Override
public List> getFirstParsedLog() throws ParameterException {
return getParsedLog(0);
}
@Override
public LogSummary getSummary(int index) throws ParameterException {
if (!parsed()) {
throw new ParameterException("Log not parsed yet!");
}
Validate.notNegative(index);
if (index > parsedLogFiles() - 1) {
throw new ParameterException(ErrorCode.RANGEVIOLATION, "No log for index " + index);
}
if (index >= summaries.size()) {
summaries.add(new LogSummary<>(getParsedLog(index)));
}
return summaries.get(index);
}
@Override
public LogSummary getSummaryForFirstParsedLog() throws ParameterException {
return getSummary(0);
}
}