diff options
author | Thomas <thomas.lenz@egiz.gv.at> | 2019-12-05 09:52:48 +0100 |
---|---|---|
committer | Thomas <thomas.lenz@egiz.gv.at> | 2019-12-05 09:52:48 +0100 |
commit | 3fada6cef21c9b16467177d866df778203b51b4d (patch) | |
tree | 8fe8ed37b6ee9fe35a1e035ceba6c68808328415 /eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process | |
parent | 95b21a826e5d81fdeabcf4673a9e87047edaec9d (diff) | |
download | EAAF-Components-3fada6cef21c9b16467177d866df778203b51b4d.tar.gz EAAF-Components-3fada6cef21c9b16467177d866df778203b51b4d.tar.bz2 EAAF-Components-3fada6cef21c9b16467177d866df778203b51b4d.zip |
some code code-style modifications
active code-quality checks!
Diffstat (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process')
19 files changed, 252 insertions, 177 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ExecutionContextImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ExecutionContextImpl.java index 619911c1..27bc829d 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ExecutionContextImpl.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ExecutionContextImpl.java @@ -24,6 +24,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Set; + import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; /** diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ExpressionEvaluationContextImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ExpressionEvaluationContextImpl.java index 72ad456f..67604a03 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ExpressionEvaluationContextImpl.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ExpressionEvaluationContextImpl.java @@ -24,6 +24,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Set; + import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluationContext; @@ -40,7 +41,8 @@ public class ExpressionEvaluationContextImpl implements ExpressionEvaluationCont private final Map<String, Serializable> ctxData; /** - * Creates a new instance and initializes it with data from a given process instance. + * Creates a new instance and initializes it with data from a given process + * instance. * * @param processInstance The process instance. */ diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessDefinitionParser.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessDefinitionParser.java index 63ae66d5..c693b87e 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessDefinitionParser.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessDefinitionParser.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Objects; + import javax.xml.XMLConstants; import javax.xml.namespace.QName; import javax.xml.stream.XMLEventReader; @@ -40,19 +41,21 @@ import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.xml.sax.SAXException; + import at.gv.egiz.eaaf.core.impl.idp.process.model.EndEvent; import at.gv.egiz.eaaf.core.impl.idp.process.model.ProcessDefinition; import at.gv.egiz.eaaf.core.impl.idp.process.model.ProcessNode; import at.gv.egiz.eaaf.core.impl.idp.process.model.StartEvent; import at.gv.egiz.eaaf.core.impl.idp.process.model.TaskInfo; import at.gv.egiz.eaaf.core.impl.idp.process.model.Transition; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.xml.sax.SAXException; /** - * Parses an XML representation of a process definition as defined by the respective XML schema. - * The parser is thread-safe. + * Parses an XML representation of a process definition as defined by the + * respective XML schema. The parser is thread-safe. * * @author tknall * @@ -81,13 +84,13 @@ public class ProcessDefinitionParser { } /** - * Parses an XML representation of a process definition. The representation is being validated in - * order to suffice the related XML schema. + * Parses an XML representation of a process definition. The representation is + * being validated in order to suffice the related XML schema. * * @param processDefinitionInputStream The process definition. * @return A new process definition. - * @throws ProcessDefinitionParserException Thrown in case of error parsing the process - * definition. + * @throws ProcessDefinitionParserException Thrown in case of error parsing the + * process definition. */ public ProcessDefinition parse(final InputStream processDefinitionInputStream) throws ProcessDefinitionParserException { @@ -232,7 +235,7 @@ public class ProcessDefinitionParser { && Objects.equals(transition.getFrom(), transition.getTo())) { throw new ProcessDefinitionParserException( "Transition's 'from' equals its 'to'. Since no 'conditionExpression' " - + "has been set this will cause a loop."); + + "has been set this will cause a loop."); } } log.debug("Process definition '{}' successfully parsed.", pd.getId()); diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessDefinitionParserException.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessDefinitionParserException.java index 472d6469..d7d4928c 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessDefinitionParserException.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessDefinitionParserException.java @@ -30,18 +30,19 @@ public class ProcessDefinitionParserException extends Exception { private static final long serialVersionUID = 1L; /** - * Creates a new parser exception providing a {@code message} describing the reason and the - * {@code cause}. + * Creates a new parser exception providing a {@code message} describing the + * reason and the {@code cause}. * * @param message The message. - * @param cause The cause. + * @param cause The cause. */ public ProcessDefinitionParserException(final String message, final Throwable cause) { super(message, cause); } /** - * Creates a new parser exception providing a {@code message} describing the reason. + * Creates a new parser exception providing a {@code message} describing the + * reason. * * @param message The message. */ diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessEngineImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessEngineImpl.java index fefcf331..9274ea81 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessEngineImpl.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessEngineImpl.java @@ -25,8 +25,17 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; + +import org.apache.commons.collections4.IterableUtils; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; + import at.gv.egiz.eaaf.core.api.IRequest; -import at.gv.egiz.eaaf.core.api.data.EAAFConstants; +import at.gv.egiz.eaaf.core.api.data.EaafConstants; import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluationContext; import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluator; @@ -42,17 +51,10 @@ import at.gv.egiz.eaaf.core.impl.idp.process.model.ProcessNode; import at.gv.egiz.eaaf.core.impl.idp.process.model.StartEvent; import at.gv.egiz.eaaf.core.impl.idp.process.model.TaskInfo; import at.gv.egiz.eaaf.core.impl.idp.process.model.Transition; -import org.apache.commons.collections4.IterableUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.MDC; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; /** - * Process engine implementation allowing starting and continuing processes as well as providing - * means for cleanup actions. + * Process engine implementation allowing starting and continuing processes as + * well as providing means for cleanup actions. */ public class ProcessEngineImpl implements ProcessEngine { @@ -93,8 +95,8 @@ public class ProcessEngineImpl implements ProcessEngine { * Sets the process definitions. * * @param processDefinitions The process definitions. - * @throws IllegalArgumentException In case the process definitions contain definitions with the - * same identifier. + * @throws IllegalArgumentException In case the process definitions contain + * definitions with the same identifier. */ public void setProcessDefinitions(final Iterable<ProcessDefinition> processDefinitions) { this.processDefinitions.clear(); @@ -108,7 +110,8 @@ public class ProcessEngineImpl implements ProcessEngine { } /** - * Sets an expression evaluator that should be used to process transition condition expressions. + * Sets an expression evaluator that should be used to process transition + * condition expressions. * * @param transitionConditionExpressionEvaluator The expression evaluator. */ @@ -117,7 +120,6 @@ public class ProcessEngineImpl implements ProcessEngine { this.transitionConditionExpressionEvaluator = transitionConditionExpressionEvaluator; } - @Override public String createProcessInstance(final String processDefinitionId, final ExecutionContext executionContext) throws ProcessExecutionException { @@ -220,7 +222,7 @@ public class ProcessEngineImpl implements ProcessEngine { pi.setState(ProcessInstanceState.STARTED); // put pending-request ID on execution-context because it could be changed - pi.getExecutionContext().put(EAAFConstants.PARAM_HTTP_TARGET_PENDINGREQUESTID, + pi.getExecutionContext().put(EaafConstants.PARAM_HTTP_TARGET_PENDINGREQUESTID, pendingReq.getPendingRequestId()); execute(pi, pendingReq); @@ -238,15 +240,15 @@ public class ProcessEngineImpl implements ProcessEngine { } } - /** * Instantiates a task implementation given by a {@link TaskInfo}. * * @param ti The task info. - * @return A Task implementation or {@code null} if the task info does not reference any task - * implementing classes. - * @throws ProcessExecutionException Thrown in case of error (when the referenced class does not - * implement {@link Task} for instance). + * @return A Task implementation or {@code null} if the task info does not + * reference any task implementing classes. + * @throws ProcessExecutionException Thrown in case of error (when the + * referenced class does not implement + * {@link Task} for instance). */ private Task createTaskInstance(final TaskInfo ti) throws ProcessExecutionException { final String clazz = StringUtils.trimToNull(ti.getTaskImplementingClass()); @@ -283,7 +285,7 @@ public class ProcessEngineImpl implements ProcessEngine { /** * Starts/executes a given process instance. * - * @param pi The process instance. + * @param pi The process instance. * @param pendingReq current pending request * @throws ProcessExecutionException Thrown in case of error. */ @@ -404,7 +406,8 @@ public class ProcessEngineImpl implements ProcessEngine { * Persists a {@link ProcessInstance} to the database. * * @param processInstance The object to persist. - * @throws MOADatabaseException Thrown if an error occurs while accessing the database. + * @throws MOADatabaseException Thrown if an error occurs while accessing the + * database. */ private void saveOrUpdateProcessInstance(final ProcessInstance processInstance) throws EaafException { @@ -431,9 +434,10 @@ public class ProcessEngineImpl implements ProcessEngine { * Load a {@link ProcessInstance} with a certain id from the database. * * @param processInstanceId The process instance id - * @return The process instance corresponding to the id or {@code null} if no such object is - * found. - * @throws MOADatabaseException Thrown if an error occurs while accessing the database. + * @return The process instance corresponding to the id or {@code null} if no + * such object is found. + * @throws MOADatabaseException Thrown if an error occurs while accessing the + * database. */ private ProcessInstance loadProcessInstance(final String processInstanceId) throws EaafException { @@ -462,7 +466,9 @@ public class ProcessEngineImpl implements ProcessEngine { /* * (non-Javadoc) * - * @see at.gv.egovernment.moa.id.process.ProcessEngine#deleteProcessInstance(java.lang.String) + * @see + * at.gv.egovernment.moa.id.process.ProcessEngine#deleteProcessInstance(java. + * lang.String) */ @Override public void deleteProcessInstance(final String processInstanceId) diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessInstance.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessInstance.java index 69683529..f3ec6b2d 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessInstance.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessInstance.java @@ -21,17 +21,19 @@ package at.gv.egiz.eaaf.core.impl.idp.process; import java.io.Serializable; import java.util.Date; -import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; -import at.gv.egiz.eaaf.core.impl.idp.process.model.ProcessDefinition; -import at.gv.egiz.eaaf.core.impl.idp.process.support.SecureRandomHolder; + import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.time.DurationFormatUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; +import at.gv.egiz.eaaf.core.impl.idp.process.model.ProcessDefinition; +import at.gv.egiz.eaaf.core.impl.idp.process.support.SecureRandomHolder; + /** - * Represents a process being executed. The process instance provides information about the process - * and its state. + * Represents a process being executed. The process instance provides + * information about the process and its state. * * @author tknall * @@ -47,19 +49,18 @@ public class ProcessInstance implements Serializable { private final ExecutionContext executionContext; private ProcessInstanceState state = ProcessInstanceState.NOT_STARTED; - - /** - * Creates a new process instance, based on a given process definition and a given execution - * context. If the given execution context is {@code null} a new execution context will be - * created. + * Creates a new process instance, based on a given process definition and a + * given execution context. If the given execution context is {@code null} a new + * execution context will be created. * <p/> - * The process instance id of the execution context will be newly generated if it is {@code null} - * in the execution context. + * The process instance id of the execution context will be newly generated if + * it is {@code null} in the execution context. * * @param processDefinition The process definition. - * @param executionContext The execution context (may be {@code null}). If {@code null} a new - * execution context will be created internally. + * @param executionContext The execution context (may be {@code null}). If + * {@code null} a new execution context will be created + * internally. */ ProcessInstance(final ProcessDefinition processDefinition, ExecutionContext executionContext) { final Logger log = LoggerFactory.getLogger(getClass()); @@ -94,7 +95,8 @@ public class ProcessInstance implements Serializable { /** * Returns the id of the process node to be executed next. * - * @return The process node pointer indicating the process node to be executed next. + * @return The process node pointer indicating the process node to be executed + * next. */ public String getNextId() { touch(); diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessInstanceState.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessInstanceState.java index e6bfa480..f2353869 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessInstanceState.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessInstanceState.java @@ -28,7 +28,8 @@ package at.gv.egiz.eaaf.core.impl.idp.process; public enum ProcessInstanceState { /** - * Indicates that the process with this process instance has not yet been started. + * Indicates that the process with this process instance has not yet been + * started. */ NOT_STARTED, @@ -38,8 +39,8 @@ public enum ProcessInstanceState { STARTED, /** - * Indicates that the process has been suspended until being waken up by someonce calling - * {@code signal}. + * Indicates that the process has been suspended until being waken up by + * someonce calling {@code signal}. */ SUSPENDED, diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStore.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStore.java index f1abaef3..07d44f36 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStore.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStore.java @@ -21,6 +21,7 @@ package at.gv.egiz.eaaf.core.impl.idp.process.dao; import java.io.Serializable; import java.util.Map; + import at.gv.egiz.eaaf.core.impl.idp.process.ProcessInstanceState; public class ProcessInstanceStore implements Serializable { @@ -28,8 +29,8 @@ public class ProcessInstanceStore implements Serializable { private static final long serialVersionUID = -6147519767313903808L; /** - * A process instance identifier qualifies as natural primary key by satisfying these requirements. - * ("unique, constant, required"): + * A process instance identifier qualifies as natural primary key by satisfying + * these requirements. ("unique, constant, required"): * <ul> * <li>unique value</li> * <li>never changes (immutable)</li> diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStoreDaoImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStoreDaoImpl.java index 06c8cc1a..cca8872f 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStoreDaoImpl.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStoreDaoImpl.java @@ -19,16 +19,18 @@ package at.gv.egiz.eaaf.core.impl.idp.process.dao; -import at.gv.egiz.eaaf.core.api.idp.process.ProcessInstanceStoreDao; -import at.gv.egiz.eaaf.core.api.storage.ITransactionStorage; -import at.gv.egiz.eaaf.core.exceptions.EaafException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import at.gv.egiz.eaaf.core.api.idp.process.ProcessInstanceStoreDao; +import at.gv.egiz.eaaf.core.api.storage.ITransactionStorage; +import at.gv.egiz.eaaf.core.exceptions.EaafException; + /** - * Database backed implementation of the {@link ProcessInstanceStoreDao} interface. + * Database backed implementation of the {@link ProcessInstanceStoreDao} + * interface. */ @Service("ProcessInstanceStoreage") public class ProcessInstanceStoreDaoImpl implements ProcessInstanceStoreDao { diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/EndEvent.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/EndEvent.java index 48919ded..ac7406ae 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/EndEvent.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/EndEvent.java @@ -20,10 +20,12 @@ package at.gv.egiz.eaaf.core.impl.idp.process.model; import java.io.Serializable; + import org.apache.commons.collections4.CollectionUtils; /** - * Represents an end event. Process execution terminates when an end event is reached. + * Represents an end event. Process execution terminates when an end event is + * reached. * * @author tknall */ diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/ProcessDefinition.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/ProcessDefinition.java index 3ab68266..39adda69 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/ProcessDefinition.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/ProcessDefinition.java @@ -23,6 +23,7 @@ import java.io.Serializable; import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; + import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParser; /** @@ -31,7 +32,8 @@ import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParser; * <li>a {@link StartEvent},</li> * <li>one or more {@linkplain TaskInfo Tasks},</li> * <li>one or more {@linkplain EndEvent EndEvents} and</li> - * <li>some {@linkplain Transition Transitions} linking StartEvents, Tasks and EndEvents. + * <li>some {@linkplain Transition Transitions} linking StartEvents, Tasks and + * EndEvents. * </ul> * * @author tknall @@ -49,8 +51,8 @@ public class ProcessDefinition implements Serializable { /** * Returns the unique identifier of the process definition. * - * @return The unique identifier (never {@code null} if process definition comes from - * {@link ProcessDefinitionParser}). + * @return The unique identifier (never {@code null} if process definition comes + * from {@link ProcessDefinitionParser}). */ public String getId() { return id; @@ -106,8 +108,8 @@ public class ProcessDefinition implements Serializable { /** * Returns a map containing the end events of the process description. * - * @return The map containing the end events (map is never {@code null} if process definition - * comes from {@link ProcessDefinitionParser}). + * @return The map containing the end events (map is never {@code null} if + * process definition comes from {@link ProcessDefinitionParser}). */ public Map<String, EndEvent> getEndEvents() { return endEvents; @@ -126,8 +128,8 @@ public class ProcessDefinition implements Serializable { * Returns the process node associated with the given {@code id}. * * @param id The identifier of the process node. - * @return The process node (may be {code null} when no process node with the given {@code id} - * exists). + * @return The process node (may be {code null} when no process node with the + * given {@code id} exists). */ public ProcessNode getProcessNode(final String id) { Objects.requireNonNull(id, "Identifier must not be null."); diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/ProcessNode.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/ProcessNode.java index 92858edf..46f086f9 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/ProcessNode.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/ProcessNode.java @@ -21,10 +21,12 @@ package at.gv.egiz.eaaf.core.impl.idp.process.model; import java.util.ArrayList; import java.util.List; + import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParser; /** - * Represents a {@link StartEvent}, an {@link EndEvent} or a {@linkplain TaskInfo Task}. + * Represents a {@link StartEvent}, an {@link EndEvent} or a + * {@linkplain TaskInfo Task}. * * @author tknall * @@ -38,8 +40,8 @@ public abstract class ProcessNode { /** * Returns the unique identifier of the process node. * - * @return The unique identifier (never {@code null} if process node comes from a process - * definition from {@link ProcessDefinitionParser}). + * @return The unique identifier (never {@code null} if process node comes from + * a process definition from {@link ProcessDefinitionParser}). */ public String getId() { return id; @@ -57,8 +59,8 @@ public abstract class ProcessNode { /** * Returns a list of transitions pointing from this process node to another one. * - * @return A list of transitions (never {@code null} if process node comes from a process - * definition from {@link ProcessDefinitionParser}). + * @return A list of transitions (never {@code null} if process node comes from + * a process definition from {@link ProcessDefinitionParser}). */ public List<Transition> getOutgoingTransitions() { return outgoingTransitions; @@ -67,7 +69,8 @@ public abstract class ProcessNode { /** * Sets the list of transitions pointing from this process node to another one. * - * @param outgoingTransitions The list of transitions originating from this process node. + * @param outgoingTransitions The list of transitions originating from this + * process node. */ public void setOutgoingTransitions(final List<Transition> outgoingTransitions) { this.outgoingTransitions = outgoingTransitions; @@ -76,8 +79,8 @@ public abstract class ProcessNode { /** * Returns a list of transitions pointing from another process node to this one. * - * @return A list of transitions (never {@code null} if process node comes from a process - * definition from {@link ProcessDefinitionParser}). + * @return A list of transitions (never {@code null} if process node comes from + * a process definition from {@link ProcessDefinitionParser}). */ public List<Transition> getIncomingTransitions() { return incomingTransitions; @@ -86,7 +89,8 @@ public abstract class ProcessNode { /** * Sets the list of transitions pointing from another process node to this one. * - * @param incomingTransitions A list of transitions pointing to this process node. + * @param incomingTransitions A list of transitions pointing to this process + * node. */ public void setIncomingTransitions(final List<Transition> incomingTransitions) { this.incomingTransitions = incomingTransitions; diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/StartEvent.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/StartEvent.java index 698312c7..ef6bc7ef 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/StartEvent.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/StartEvent.java @@ -20,11 +20,12 @@ package at.gv.egiz.eaaf.core.impl.idp.process.model; import java.io.Serializable; + import org.apache.commons.collections4.CollectionUtils; /** - * Represents a start event. Each process description contains a single start event. Process - * execution starts with a start event. + * Represents a start event. Each process description contains a single start + * event. Process execution starts with a start event. * * @author tknall * diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/TaskInfo.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/TaskInfo.java index 9e384b4c..c8eea1bb 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/TaskInfo.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/TaskInfo.java @@ -20,11 +20,14 @@ package at.gv.egiz.eaaf.core.impl.idp.process.model; import java.io.Serializable; -import at.gv.egiz.eaaf.core.api.idp.process.Task; + import org.apache.commons.collections4.CollectionUtils; +import at.gv.egiz.eaaf.core.api.idp.process.Task; + /** - * Represents information about a single task to be performed upon process execution. + * Represents information about a single task to be performed upon process + * execution. * * @author tknall * @@ -38,17 +41,19 @@ public class TaskInfo extends ProcessNode implements Serializable { private boolean async = DEFAULT_ASYNC; /** - * Determines if the task is marked asynchronous ({@code true}) or synchronous ({@code false}). + * Determines if the task is marked asynchronous ({@code true}) or synchronous + * ({@code false}). * - * @return A flag indicating if the task should be executed asynchronously or synchronously. - * (Default: {@code false}) + * @return A flag indicating if the task should be executed asynchronously or + * synchronously. (Default: {@code false}) */ public boolean isAsync() { return async; } /** - * Marks a task to executed asynchronously ({@code true}) or synchronously ({@code false}). + * Marks a task to executed asynchronously ({@code true}) or synchronously + * ({@code false}). * * @param async The flag. */ @@ -57,7 +62,8 @@ public class TaskInfo extends ProcessNode implements Serializable { } /** - * Returns the class that implements the actual task (must implement {@link Task}). + * Returns the class that implements the actual task (must implement + * {@link Task}). * * @return The task implementing class. */ diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/Transition.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/Transition.java index 4c7b70f0..39c5f437 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/Transition.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/Transition.java @@ -20,11 +20,13 @@ package at.gv.egiz.eaaf.core.impl.idp.process.model; import java.io.Serializable; + import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParser; /** - * Represents a single transition from a {@link StartEvent} or {@linkplain TaskInfo Task} to another - * {@linkplain TaskInfo Task} or {@link EndEvent}. + * Represents a single transition from a {@link StartEvent} or + * {@linkplain TaskInfo Task} to another {@linkplain TaskInfo Task} or + * {@link EndEvent}. * * @author tknall * @@ -39,11 +41,12 @@ public class Transition implements Serializable { private ProcessNode to; /** - * Returns the process node (effectively a {@link StartEvent} or {@linkplain TaskInfo Task}) the - * transition is pointing from. + * Returns the process node (effectively a {@link StartEvent} or + * {@linkplain TaskInfo Task}) the transition is pointing from. * - * @return The transition's source process node (never {@code null} if transition comes from a - * process definition from {@link ProcessDefinitionParser}). + * @return The transition's source process node (never {@code null} if + * transition comes from a process definition from + * {@link ProcessDefinitionParser}). */ public ProcessNode getFrom() { return from; @@ -59,11 +62,12 @@ public class Transition implements Serializable { } /** - * Returns the process node (effectively a {@linkplain TaskInfo Task} or {@link EndEvent}) the - * transition is pointing to. + * Returns the process node (effectively a {@linkplain TaskInfo Task} or + * {@link EndEvent}) the transition is pointing to. * - * @return The transition's destination process node (never {@code null} if transition comes from - * a process definition from {@link ProcessDefinitionParser}). + * @return The transition's destination process node (never {@code null} if + * transition comes from a process definition from + * {@link ProcessDefinitionParser}). */ public ProcessNode getTo() { return to; diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/SpringExpressionEvaluator.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/SpringExpressionEvaluator.java index fc01463e..588a3bde 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/SpringExpressionEvaluator.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/SpringExpressionEvaluator.java @@ -20,10 +20,9 @@ package at.gv.egiz.eaaf.core.impl.idp.process.spring; import java.util.Objects; + import javax.annotation.PostConstruct; -import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluationContext; -import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluator; -import at.gv.egiz.eaaf.core.impl.idp.process.model.Transition; + import org.apache.commons.lang3.BooleanUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,9 +34,13 @@ import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.expression.spel.support.StandardEvaluationContext; +import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluationContext; +import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluator; +import at.gv.egiz.eaaf.core.impl.idp.process.model.Transition; + /** - * Expression evaluator for processing {@link Transition} conditions allowing to reference Spring - * beans from the application context. + * Expression evaluator for processing {@link Transition} conditions allowing to + * reference Spring beans from the application context. * * @author tknall * diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/AbstractAuthSourceServlet.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/AbstractAuthSourceServlet.java index cc899641..bd352bef 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/AbstractAuthSourceServlet.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/AbstractAuthSourceServlet.java @@ -21,9 +21,7 @@ package at.gv.egiz.eaaf.core.impl.idp.process.springweb; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; -import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; -import at.gv.egiz.eaaf.core.api.idp.process.ProcessEngine; -import at.gv.egiz.eaaf.core.impl.idp.process.ProcessInstance; + import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeansException; import org.springframework.beans.factory.NoSuchBeanDefinitionException; @@ -31,10 +29,14 @@ import org.springframework.beans.factory.NoUniqueBeanDefinitionException; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; +import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; +import at.gv.egiz.eaaf.core.api.idp.process.ProcessEngine; +import at.gv.egiz.eaaf.core.impl.idp.process.ProcessInstance; + /** - * Abstract HttpServlet that provides means for retrieving the process engine (Spring Web required) - * as well as retrieving the underlying process instance and execution context evaluating a certain - * request parameter. + * Abstract HttpServlet that provides means for retrieving the process engine + * (Spring Web required) as well as retrieving the underlying process instance + * and execution context evaluating a certain request parameter. * * @author tknall * @@ -46,7 +48,8 @@ public abstract class AbstractAuthSourceServlet extends HttpServlet { private ProcessEngine processEngine; /** - * Returns the name of the request parameter representing the respective instance id. + * Returns the name of the request parameter representing the respective + * instance id. * <p/> * Default is {@code processInstanceId}. * @@ -60,11 +63,16 @@ public abstract class AbstractAuthSourceServlet extends HttpServlet { * Returns the underlying process engine instance. * * @return The process engine (never {@code null}). - * @throws NoSuchBeanDefinitionException if no {@link ProcessEngine} bean was found. - * @throws NoUniqueBeanDefinitionException if more than one {@link ProcessEngine} bean was found. - * @throws BeansException if a problem getting the {@link ProcessEngine} bean occurred. - * @throws IllegalStateException if the Spring WebApplicationContext was not found, which means - * that the servlet is used outside a Spring web environment. + * @throws NoSuchBeanDefinitionException if no {@link ProcessEngine} bean was + * found. + * @throws NoUniqueBeanDefinitionException if more than one + * {@link ProcessEngine} bean was found. + * @throws BeansException if a problem getting the + * {@link ProcessEngine} bean occurred. + * @throws IllegalStateException if the Spring WebApplicationContext + * was not found, which means that the + * servlet is used outside a Spring web + * environment. */ public synchronized ProcessEngine getProcessEngine() { if (processEngine == null) { @@ -73,7 +81,7 @@ public abstract class AbstractAuthSourceServlet extends HttpServlet { if (ctx == null) { throw new IllegalStateException( "Unable to find Spring WebApplicationContext. " - + "Servlet needs to be executed within a Spring web environment."); + + "Servlet needs to be executed within a Spring web environment."); } processEngine = ctx.getBean(ProcessEngine.class); } @@ -86,13 +94,20 @@ public abstract class AbstractAuthSourceServlet extends HttpServlet { * * @param request The HttpServletRequest. * @return The process instance (never {@code null}). - * @throws NoSuchBeanDefinitionException if no {@link ProcessEngine} bean was found. - * @throws NoUniqueBeanDefinitionException if more than one {@link ProcessEngine} bean was found. - * @throws BeansException if a problem getting the {@link ProcessEngine} bean occurred. - * @throws IllegalStateException if the Spring WebApplicationContext was not found, which means - * that the servlet is used outside a Spring web environment. - * @throws IllegalArgumentException in case the process instance id referenced by the request - * parameter {@link #getProcessInstanceIdParameterName()} does not exist. + * @throws NoSuchBeanDefinitionException if no {@link ProcessEngine} bean was + * found. + * @throws NoUniqueBeanDefinitionException if more than one + * {@link ProcessEngine} bean was found. + * @throws BeansException if a problem getting the + * {@link ProcessEngine} bean occurred. + * @throws IllegalStateException if the Spring WebApplicationContext + * was not found, which means that the + * servlet is used outside a Spring web + * environment. + * @throws IllegalArgumentException in case the process instance id + * referenced by the request parameter + * {@link #getProcessInstanceIdParameterName()} + * does not exist. */ public ProcessInstance getProcessInstance(final HttpServletRequest request) { final String processInstanceId = @@ -105,18 +120,26 @@ public abstract class AbstractAuthSourceServlet extends HttpServlet { } /** - * Retrieves the execution context for the respective process instance referenced by the request - * parameter {@link #getProcessInstanceIdParameterName()}. + * Retrieves the execution context for the respective process instance + * referenced by the request parameter + * {@link #getProcessInstanceIdParameterName()}. * * @param request The HttpServletRequest. * @return The execution context (never {@code null}). - * @throws NoSuchBeanDefinitionException if no {@link ProcessEngine} bean was found. - * @throws NoUniqueBeanDefinitionException if more than one {@link ProcessEngine} bean was found. - * @throws BeansException if a problem getting the {@link ProcessEngine} bean occurred. - * @throws IllegalStateException if the Spring WebApplicationContext was not found, which means - * that the servlet is used outside a Spring web environment. - * @throws IllegalArgumentException in case the process instance id referenced by the request - * parameter {@link #getProcessInstanceIdParameterName()} does not exist. + * @throws NoSuchBeanDefinitionException if no {@link ProcessEngine} bean was + * found. + * @throws NoUniqueBeanDefinitionException if more than one + * {@link ProcessEngine} bean was found. + * @throws BeansException if a problem getting the + * {@link ProcessEngine} bean occurred. + * @throws IllegalStateException if the Spring WebApplicationContext + * was not found, which means that the + * servlet is used outside a Spring web + * environment. + * @throws IllegalArgumentException in case the process instance id + * referenced by the request parameter + * {@link #getProcessInstanceIdParameterName()} + * does not exist. */ public ExecutionContext getExecutionContext(final HttpServletRequest request) { return getProcessInstance(request).getExecutionContext(); diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/AbstractTask.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/AbstractTask.java index 02db6686..2cdb84c5 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/AbstractTask.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/AbstractTask.java @@ -21,15 +21,17 @@ package at.gv.egiz.eaaf.core.impl.idp.process.springweb; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import at.gv.egiz.eaaf.core.api.IRequest; -import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; -import at.gv.egiz.eaaf.core.api.idp.process.Task; -import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException; + import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.filter.RequestContextFilter; +import at.gv.egiz.eaaf.core.api.IRequest; +import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; +import at.gv.egiz.eaaf.core.api.idp.process.Task; +import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException; + /** * Abstract task implementation providing {@link HttpServletRequest} and * {@link HttpServletResponse}. @@ -68,8 +70,8 @@ public abstract class AbstractTask implements Task { if (request == null || response == null) { throw new IllegalStateException( "Spring's RequestContextHolder did not provide HttpServletResponse. " - + "Did you forget to set the required " - + "org.springframework.web.filter.RequestContextFilter in your web.xml."); + + "Did you forget to set the required " + + "org.springframework.web.filter.RequestContextFilter in your web.xml."); } return internalExecute(pendingReq, executionContext, request, response); } else { @@ -78,43 +80,45 @@ public abstract class AbstractTask implements Task { } /** - * Executes the task providing the underlying {@link ExecutionContext} {@code executionContext} as - * well as the respective {@link HttpServletRequest} and {@link HttpServletResponse}. + * Executes the task providing the underlying {@link ExecutionContext} + * {@code executionContext} as well as the respective {@link HttpServletRequest} + * and {@link HttpServletResponse}. * * @param executionContext The execution context (never {@code null}). - * @param request The HttpServletRequest (never {@code null}). - * @param response The HttpServletResponse (never {@code null}). - * @throws IllegalStateException Thrown in case the task is nur being run within the required - * environment. Refer to javadoc for further information. - * @throws Exception Thrown in case of error executing the task. + * @param request The HttpServletRequest (never {@code null}). + * @param response The HttpServletResponse (never {@code null}). + * @throws IllegalStateException Thrown in case the task is nur being run within + * the required environment. Refer to javadoc for + * further information. + * @throws Exception Thrown in case of error executing the task. */ public abstract void execute(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) throws TaskExecutionException; /** - * Executes the task providing the underlying {@link ExecutionContext} {@code executionContext} - * and the {@link IRequest} {@code pendingReq }as well as the respective - * {@link HttpServletRequest} and {@link HttpServletResponse}. + * Executes the task providing the underlying {@link ExecutionContext} + * {@code executionContext} and the {@link IRequest} {@code pendingReq }as well + * as the respective {@link HttpServletRequest} and {@link HttpServletResponse}. * * <p> - * This method sets the pending-request object of the task implementation and starts the - * {@code execute} method of the task + * This method sets the pending-request object of the task implementation and + * starts the {@code execute} method of the task * </p> * - * @param pendingReq The pending-request object (never {@code null}). + * @param pendingReq The pending-request object (never {@code null}). * @param executionContext The execution context (never {@code null}). - * @param request The HttpServletRequest (never {@code null}). - * @param response The HttpServletResponse (never {@code null}). - * @return The pending-request object, because Process-management works recursive + * @param request The HttpServletRequest (never {@code null}). + * @param response The HttpServletResponse (never {@code null}). + * @return The pending-request object, because Process-management works + * recursive * - * @throws IllegalStateException Thrown in case the task is being run within the required - * environment. Refer to javadoc for further information. - * @throws Exception Thrown in case of error executing the task. + * @throws IllegalStateException Thrown in case the task is being run within the + * required environment. Refer to javadoc for + * further information. + * @throws Exception Thrown in case of error executing the task. */ protected abstract IRequest internalExecute(IRequest pendingReq, ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) throws TaskExecutionException; - - } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/SpringWebExpressionEvaluator.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/SpringWebExpressionEvaluator.java index c723a728..afcc0a58 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/SpringWebExpressionEvaluator.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/SpringWebExpressionEvaluator.java @@ -22,12 +22,10 @@ package at.gv.egiz.eaaf.core.impl.idp.process.springweb; import java.io.Serializable; import java.util.Map; import java.util.Objects; + import javax.annotation.PostConstruct; import javax.servlet.http.HttpServletRequest; -import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; -import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluationContext; -import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluator; -import at.gv.egiz.eaaf.core.impl.idp.process.model.Transition; + import org.apache.commons.lang3.BooleanUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,13 +37,21 @@ import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.expression.spel.support.StandardEvaluationContext; +import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; +import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluationContext; +import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluator; +import at.gv.egiz.eaaf.core.impl.idp.process.model.Transition; + /** - * Expression evaluator for processing {@link Transition} conditions allowing to. + * Expression evaluator for processing {@link Transition} conditions allowing + * to. * <ul> - * <li>reference Spring beans from the application context using {@code @myBeanName...},</li> + * <li>reference Spring beans from the application context using + * {@code @myBeanName...},</li> * <li>{@link ExecutionContext} properties using {@code ctx['property']},</li> - * <li>Multi valued {@link HttpServletRequest} parameters using {@code requestParameters['foo']} - * (keep in mind that this expression returns an array of String values) and</li> + * <li>Multi valued {@link HttpServletRequest} parameters using + * {@code requestParameters['foo']} (keep in mind that this expression returns + * an array of String values) and</li> * <li>Single valued {@link HttpServletRequest} parameters using * {@code requestParameter['foo']}</li> * </ul> @@ -70,9 +76,10 @@ public class SpringWebExpressionEvaluator implements ExpressionEvaluator { } /** - * Evaluation context that provides access to {@link HttpServletRequest} parameters using - * {@code requestParameter['foo']} for single value parameters or {@code requestParameters['foo']} - * for multi value parameters. Basic calls to {@code ctx} will be delegated. + * Evaluation context that provides access to {@link HttpServletRequest} + * parameters using {@code requestParameter['foo']} for single value parameters + * or {@code requestParameters['foo']} for multi value parameters. Basic calls + * to {@code ctx} will be delegated. * * @author tknall * @@ -82,11 +89,11 @@ public class SpringWebExpressionEvaluator implements ExpressionEvaluator { private static final long serialVersionUID = 1L; /** - * Creates a new expression evaluation context, providing access to HttpServletRequest - * parameter(s). + * Creates a new expression evaluation context, providing access to + * HttpServletRequest parameter(s). * - * @param delegate The original {@link ExpressionEvaluationContext} to be delegated to for - * {@code ctx['foo']} expressions. + * @param delegate The original {@link ExpressionEvaluationContext} to be + * delegated to for {@code ctx['foo']} expressions. */ public SpringWebExpressionEvaluationContext(final ExpressionEvaluationContext delegate) { this.delegate = delegate; |