All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.uni.freiburg.iig.telematik.sewol.parser.AbstractLogParser Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 1.0.2
Show newest version
package de.uni.freiburg.iig.telematik.sewol.parser;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

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;

public abstract class AbstractLogParser implements LogParserInterface {

	protected List>> parsedLogFiles = null;
	protected Map> summaries = new HashMap>();

	protected boolean parsed() {
		return parsedLogFiles != null;
	}

	protected int parsedLogFiles() {
		if (!parsed())
			return 0;
		return parsedLogFiles.size();
	}
	
	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);
	}
	
	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 (!summaries.containsKey(index))
			summaries.put(index, new LogSummary(getParsedLog(index)));
		return summaries.get(index);
	}
	
	@Override
	public LogSummary getSummaryForFirstParsedLog() throws ParameterException {
		return getSummary(0);
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy