Author: alex.guizar(a)jboss.com
Date: 2009-07-30 20:32:32 -0400 (Thu, 30 Jul 2009)
New Revision: 5402
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/JbpmContext.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/GraphElement.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/instantiation/UserCodeInterceptorConfig.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/el/impl/JbpmExpressionEvaluator.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/mail/Mail.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/TaskController.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/exe/TaskMgmtInstance.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/default.jbpm.cfg.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/instantiation/UserCodeInterceptorTest.java
jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/main/java/org/jbpm/sim/def/JbpmSimulationModel.java
jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/main/java/org/jbpm/sim/report/jasper/AbstractBaseJasperReport.java
Log:
[JBPM-2194] Allow clients to set the UserCodeInterceptor in the configuration file
introduce configuration elements jbpm.expression.evaluator and jbpm.user.code.interceptor
deprecate setExpressionEvaluator, setVariableResolver, setFunctionMapper and
setUserCodeInterceptor
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/JbpmContext.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/JbpmContext.java 2009-07-30
20:33:16 UTC (rev 5401)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/JbpmContext.java 2009-07-31
00:32:32 UTC (rev 5402)
@@ -103,10 +103,10 @@
public static final String DEFAULT_JBPM_CONTEXT_NAME =
"default.jbpm.context";
- ObjectFactory objectFactory = null;
- Services services = null;
- List autoSaveProcessInstances = null;
- JbpmConfiguration jbpmConfiguration = null;
+ ObjectFactory objectFactory;
+ Services services;
+ List autoSaveProcessInstances;
+ JbpmConfiguration jbpmConfiguration;
/**
* normally, JbpmContext object are created via a {@link JbpmConfiguration}.
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/GraphElement.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/GraphElement.java 2009-07-30
20:33:16 UTC (rev 5401)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/GraphElement.java 2009-07-31
00:32:32 UTC (rev 5402)
@@ -23,6 +23,7 @@
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
@@ -38,6 +39,7 @@
import org.jbpm.graph.exe.RuntimeAction;
import org.jbpm.graph.exe.Token;
import org.jbpm.graph.log.ActionLog;
+import org.jbpm.instantiation.UserCodeInterceptor;
import org.jbpm.instantiation.UserCodeInterceptorConfig;
import org.jbpm.job.ExecuteActionJob;
import org.jbpm.msg.MessageService;
@@ -52,12 +54,12 @@
private static final long serialVersionUID = 1L;
- long id = 0;
- protected String name = null;
- protected String description = null;
- protected ProcessDefinition processDefinition = null;
- protected Map events = null;
- protected List exceptionHandlers = null;
+ long id;
+ protected String name;
+ protected String description;
+ protected ProcessDefinition processDefinition;
+ protected Map events;
+ protected List exceptionHandlers;
public GraphElement() {
}
@@ -83,23 +85,15 @@
}
public boolean hasEvents() {
- return ((events != null) && (events.size() > 0));
+ return events != null && !events.isEmpty();
}
public Event getEvent(String eventType) {
- Event event = null;
- if (events != null) {
- event = (Event) events.get(eventType);
- }
- return event;
+ return events != null ? (Event) events.get(eventType) : null;
}
public boolean hasEvent(String eventType) {
- boolean hasEvent = false;
- if (events != null) {
- hasEvent = events.containsKey(eventType);
- }
- return hasEvent;
+ return events != null ? events.containsKey(eventType) : false;
}
public Event addEvent(Event event) {
@@ -165,9 +159,9 @@
}
public void reorderExceptionHandler(int oldIndex, int newIndex) {
- if ((exceptionHandlers != null)
- && (Math.min(oldIndex, newIndex) >= 0)
- && (Math.max(oldIndex, newIndex) < exceptionHandlers.size())) {
+ if (exceptionHandlers != null
+ && Math.min(oldIndex, newIndex) >= 0
+ && Math.max(oldIndex, newIndex) < exceptionHandlers.size()) {
Object o = exceptionHandlers.remove(oldIndex);
exceptionHandlers.add(newIndex, o);
}
@@ -188,15 +182,12 @@
try {
executionContext.setEventSource(this);
- // TODO: Is it a valid condition that the jbpmContext is not there?
JbpmContext jbpmContext = executionContext.getJbpmContext();
if (jbpmContext != null) {
- Services services = jbpmContext.getServices();
- if (services != null) {
- EventService evService = (EventService)
services.getService(EventService.SERVICE_NAME);
- if (evService != null) {
- evService.fireEvent(eventType, this, executionContext);
- }
+ EventService eventService = (EventService) jbpmContext.getServices()
+ .getService(EventService.SERVICE_NAME);
+ if (eventService != null) {
+ eventService.fireEvent(eventType, this, executionContext);
}
}
@@ -208,9 +199,8 @@
}
public void fireAndPropagateEvent(String eventType, ExecutionContext executionContext)
{
- // calculate if the event was fired on this element or if it was a
- // propagated event
- boolean isPropagated = !(this.equals(executionContext.getEventSource()));
+ // calculate if the event was fired on this element or if it was a propagated event
+ boolean isPropagated = !equals(executionContext.getEventSource());
// execute static actions
Event event = getEvent(eventType);
@@ -236,22 +226,20 @@
}
void executeActions(List actions, ExecutionContext executionContext, boolean
isPropagated) {
- if (actions != null) {
- Iterator iter = actions.iterator();
- while (iter.hasNext()) {
- Action action = (Action) iter.next();
- if (action.acceptsPropagatedEvents() || (!isPropagated)) {
- if (action.isAsync()) {
- ExecuteActionJob job =
createAsyncActionExecutionJob(executionContext.getToken(),
- action);
- MessageService messageService = (MessageService)
Services.getCurrentService(Services.SERVICENAME_MESSAGE);
- messageService.send(job);
- }
- else {
- executeAction(action, executionContext);
- }
- }
+ if (actions == null) return;
+
+ for (Iterator iter = actions.iterator(); iter.hasNext();) {
+ Action action = (Action) iter.next();
+ if (!action.acceptsPropagatedEvents() && isPropagated) continue;
+
+ if (action.isAsync()) {
+ ExecuteActionJob job = createAsyncActionExecutionJob(executionContext.getToken(),
action);
+ MessageService messageService = (MessageService)
Services.getCurrentService(Services.SERVICENAME_MESSAGE);
+ messageService.send(job);
}
+ else {
+ executeAction(action, executionContext);
+ }
}
}
@@ -274,7 +262,7 @@
// the token needs to be locked. if this is an action
// being executed as the node behaviour or if the token
// is already locked, the token doesn't need to be locked.
- boolean actionMustBeLocked = (executionContext.getEvent() != null) &&
(!token.isLocked());
+ boolean actionMustBeLocked = executionContext.getEvent() != null &&
!token.isLocked();
try {
// update the execution context
@@ -288,20 +276,17 @@
token.lock(lockOwnerId);
}
- if (UserCodeInterceptorConfig.userCodeInterceptor != null) {
- UserCodeInterceptorConfig.userCodeInterceptor.executeAction(action,
executionContext);
+ UserCodeInterceptor userCodeInterceptor =
UserCodeInterceptorConfig.getUserCodeInterceptor();
+ if (userCodeInterceptor != null) {
+ userCodeInterceptor.executeAction(action, executionContext);
}
else {
action.execute(executionContext);
}
-
}
finally {
- if (actionMustBeLocked) {
- token.unlock(lockOwnerId);
- }
+ if (actionMustBeLocked) token.unlock(lockOwnerId);
}
-
}
catch (Exception exception) {
// NOTE that Errors are not caught because that might halt the JVM and mask the
original Error
@@ -323,12 +308,11 @@
List runtimeActionsForEvent = null;
List runtimeActions = executionContext.getProcessInstance().getRuntimeActions();
if (runtimeActions != null) {
- Iterator iter = runtimeActions.iterator();
- while (iter.hasNext()) {
+ for (Iterator iter = runtimeActions.iterator(); iter.hasNext();) {
RuntimeAction runtimeAction = (RuntimeAction) iter.next();
// if the runtime-action action is registered on this element and this eventType
- if ((this.equals(runtimeAction.getGraphElement()))
- && (eventType.equals(runtimeAction.getEventType()))) {
+ if (equals(runtimeAction.getGraphElement())
+ && eventType.equals(runtimeAction.getEventType())) {
// ... add its action to the list of runtime actions
if (runtimeActionsForEvent == null) runtimeActionsForEvent = new ArrayList();
runtimeActionsForEvent.add(runtimeAction.getAction());
@@ -338,30 +322,6 @@
return runtimeActionsForEvent;
}
- /*
- * // the next instruction merges the actions specified in the process definition with
the runtime
- * actions List actions = event.collectActions(executionContext);
- *
- * // loop over all actions of this event Iterator iter = actions.iterator(); while
- * (iter.hasNext()) { Action action = (Action) iter.next();
executionContext.setAction(action);
- *
- * if ( (!isPropagated) || (action.acceptsPropagatedEvents() ) ) {
- *
- * // create action log ActionLog actionLog = new ActionLog(action);
- * executionContext.getToken().startCompositeLog(actionLog);
- *
- * try { // execute the action action.execute(executionContext);
- *
- * } catch (Exception exception) { // NOTE that Error's are not caught because that
might halt the
- * JVM and mask the original Error.
- * Event.log.error("action threw exception: "+exception.getMessage(),
exception);
- *
- * // log the action exception actionLog.setException(exception);
- *
- * // if an exception handler is available
event.graphElement.raiseException(exception,
- * executionContext); } finally { executionContext.getToken().endCompositeLog(); } } }
}
- */
-
/**
* throws an ActionException if no applicable exception handler is found. An
ExceptionHandler is
* searched for in this graph element and then recursively up the parent hierarchy. If
an
@@ -372,25 +332,23 @@
public void raiseException(Throwable exception, ExecutionContext executionContext)
throws DelegationException {
if (isAbleToHandleExceptions(executionContext)) {
- if (exceptionHandlers != null) {
- try {
- ExceptionHandler exceptionHandler = findExceptionHandler(exception);
- if (exceptionHandler != null) {
- executionContext.setException(exception);
- exceptionHandler.handleException(this, executionContext);
- return;
- }
+ try {
+ ExceptionHandler exceptionHandler = findExceptionHandler(exception);
+ if (exceptionHandler != null) {
+ executionContext.setException(exception);
+ exceptionHandler.handleException(this, executionContext);
+ return;
}
- catch (Exception e) {
- // NOTE that Error's are not caught because that might halt the JVM
- // and mask the original Error.
- exception = e;
- }
}
+ catch (Exception e) {
+ // NOTE that Error's are not caught because that might halt the JVM
+ // and mask the original Error.
+ exception = e;
+ }
GraphElement parent = getParent();
// if this graph element has a parent
- if ((parent != null) && (!equals(parent))) {
+ if (parent != null && !equals(parent)) {
// raise to the parent
parent.raiseException(exception, executionContext);
return;
@@ -401,8 +359,8 @@
// rollbackActions(executionContext);
// if there is no parent we need to throw a delegation exception to the client
- throw exception instanceof JbpmException ? (JbpmException) exception : new
DelegationException(
- exception, executionContext);
+ throw exception instanceof JbpmException ? (JbpmException) exception
+ : new DelegationException(exception, executionContext);
}
/**
@@ -414,27 +372,24 @@
*/
private static boolean isAbleToHandleExceptions(ExecutionContext executionContext) {
/*
- * if an exception is already set, we are already handling an exception; in this case
don't give
- * the exception to the handlers but throw it to the client see
- *
https://jira.jboss.org/jira/browse/JBPM-1887
+ * if an exception is already set, we are already handling an exception;
+ * in this case don't give the exception to the handlers but throw it to the
client
+ * see
https://jira.jboss.org/jira/browse/JBPM-1887
*/
if (executionContext.getException() != null) return false;
/*
- * check whether the transaction is still active before scanning the exception
handlers. that
- * way we can load the exception handlers lazily see
- *
https://jira.jboss.org/jira/browse/JBPM-1775
+ * check whether the transaction is still active before scanning the exception
handlers.
+ * that way we can load the exception handlers lazily
+ * see
https://jira.jboss.org/jira/browse/JBPM-1775
*/
JbpmContext jbpmContext = executionContext.getJbpmContext();
if (jbpmContext != null) {
- Services services = jbpmContext.getServices();
- if (services != null) {
- Service service = services.getPersistenceService();
- if (service instanceof DbPersistenceService) {
- DbPersistenceService persistenceService = (DbPersistenceService) service;
- return persistenceService.isTransactionActive()
- || persistenceService.getTransaction() == null;
- }
+ Service service = jbpmContext.getServices().getPersistenceService();
+ if (service instanceof DbPersistenceService) {
+ DbPersistenceService persistenceService = (DbPersistenceService) service;
+ return persistenceService.isTransactionActive()
+ || persistenceService.getTransaction() == null;
}
}
@@ -443,19 +398,13 @@
}
protected ExceptionHandler findExceptionHandler(Throwable exception) {
- ExceptionHandler exceptionHandler = null;
-
if (exceptionHandlers != null) {
- Iterator iter = exceptionHandlers.iterator();
- while (iter.hasNext() && (exceptionHandler == null)) {
+ for (Iterator iter = exceptionHandlers.iterator(); iter.hasNext();) {
ExceptionHandler candidate = (ExceptionHandler) iter.next();
- if (candidate.matches(exception)) {
- exceptionHandler = candidate;
- }
+ if (candidate.matches(exception)) return candidate;
}
}
-
- return exceptionHandler;
+ return null;
}
public GraphElement getParent() {
@@ -463,19 +412,23 @@
}
/**
- * @return all the parents of this graph element ordered by age.
+ * @return the ancestors of this graph element ordered by depth.
*/
public List getParents() {
- List parents = new ArrayList();
+ List parents;
GraphElement parent = getParent();
if (parent != null) {
+ parents = new ArrayList();
parent.addParentChain(parents);
}
+ else {
+ parents = Collections.EMPTY_LIST;
+ }
return parents;
}
/**
- * @return this graph element plus all the parents ordered by age.
+ * @return this graph element plus the ancestors ordered by depth.
*/
public List getParentChain() {
List parents = new ArrayList();
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/instantiation/UserCodeInterceptorConfig.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/instantiation/UserCodeInterceptorConfig.java 2009-07-30
20:33:16 UTC (rev 5401)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/instantiation/UserCodeInterceptorConfig.java 2009-07-31
00:32:32 UTC (rev 5402)
@@ -1,9 +1,23 @@
package org.jbpm.instantiation;
-public abstract class UserCodeInterceptorConfig {
+import org.jbpm.JbpmConfiguration;
- public static UserCodeInterceptor userCodeInterceptor = null;
+public class UserCodeInterceptorConfig {
+ private static UserCodeInterceptor userCodeInterceptor;
+
+ private UserCodeInterceptorConfig() {
+ // prevent instantiation
+ }
+
+ public static UserCodeInterceptor getUserCodeInterceptor() {
+ return userCodeInterceptor != null ? userCodeInterceptor
+ : JbpmConfiguration.Configs.hasObject("jbpm.user.code.interceptor") ?
+ (UserCodeInterceptor)
JbpmConfiguration.Configs.getObject("jbpm.user.code.interceptor")
+ : null;
+ }
+
+ /** @deprecated Use the configuration entry
<code>jbpm.user.code.interceptor</code> instead */
public static void setUserCodeInterceptor(UserCodeInterceptor interceptor) {
userCodeInterceptor = interceptor;
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/el/impl/JbpmExpressionEvaluator.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/el/impl/JbpmExpressionEvaluator.java 2009-07-30
20:33:16 UTC (rev 5401)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/el/impl/JbpmExpressionEvaluator.java 2009-07-31
00:32:32 UTC (rev 5402)
@@ -1,6 +1,5 @@
package org.jbpm.jpdl.el.impl;
-
import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmException;
import org.jbpm.graph.exe.ExecutionContext;
@@ -11,41 +10,51 @@
public class JbpmExpressionEvaluator {
- static ExpressionEvaluator evaluator = new ExpressionEvaluatorImpl();
+ private static ExpressionEvaluator expressionEvaluator;
+
+ static ExpressionEvaluator getExpressionEvaluator() {
+ return expressionEvaluator != null ? expressionEvaluator
+ : (ExpressionEvaluator)
JbpmConfiguration.Configs.getObject("jbpm.expression.evaluator");
+ }
+
+ /** @deprecated Use the configuration entry
<code>jbpm.expression.evaluator</code> instead */
public static void setExpressionEvaluator(ExpressionEvaluator expressionEvaluator) {
- JbpmExpressionEvaluator.evaluator = expressionEvaluator;
+ JbpmExpressionEvaluator.expressionEvaluator = expressionEvaluator;
}
-
- static VariableResolver variableResolver = null;
+
+ static VariableResolver variableResolver;
+
+ /** @deprecated Use the configuration entry
<code>jbpm.variable.resolver</code> instead */
public static void setVariableResolver(VariableResolver variableResolver) {
JbpmExpressionEvaluator.variableResolver = variableResolver;
}
-
- static FunctionMapper functionMapper = null;
+
+ static FunctionMapper functionMapper;
+
+ /** @deprecated Use the configuration entry
<code>jbpm.function.mapper</code> instead */
public static void setFunctionMapper(FunctionMapper functionMapper) {
JbpmExpressionEvaluator.functionMapper = functionMapper;
}
-
+
public static Object evaluate(String expression, ExecutionContext executionContext) {
- return evaluate(expression, executionContext, getUsedVariableResolver(),
getUsedFunctionMapper());
+ return evaluate(expression, executionContext, getVariableResolver(),
getFunctionMapper());
}
- public static Object evaluate(String expression, ExecutionContext executionContext,
VariableResolver usedVariableResolver, FunctionMapper functionMapper) {
- Object result = null;
-
+ public static Object evaluate(String expression, ExecutionContext executionContext,
+ VariableResolver variableResolver, FunctionMapper functionMapper) {
ExecutionContext.pushCurrentContext(executionContext);
try {
String dollarExpression = translateExpressionToDollars(expression);
- result = evaluator.evaluate(dollarExpression, Object.class, usedVariableResolver,
functionMapper);
-
- } catch (ELException e) {
-
- throw new JbpmException("couldn't evaluate expression
'"+expression+"'", (e.getRootCause()!=null ? e.getRootCause() :
e));
- } finally {
+ return getExpressionEvaluator().evaluate(dollarExpression, Object.class,
+ variableResolver, functionMapper);
+ }
+ catch (ELException e) {
+ throw new JbpmException("couldn't evaluate expression '" +
expression + "'",
+ e.getRootCause() != null ? e.getRootCause() : e);
+ }
+ finally {
ExecutionContext.popCurrentContext(executionContext);
}
-
- return result;
}
static String translateExpressionToDollars(String expression) {
@@ -60,20 +69,25 @@
return new String(expressionChars);
}
+ /** @deprecated Use {@link #getVariableResolver()} instead */
public static VariableResolver getUsedVariableResolver() {
- if (variableResolver!=null) {
- return variableResolver;
- }
- return (VariableResolver)
JbpmConfiguration.Configs.getObject("jbpm.variable.resolver");
+ return getVariableResolver();
}
+ public static VariableResolver getVariableResolver() {
+ return variableResolver != null ? variableResolver
+ : (VariableResolver)
JbpmConfiguration.Configs.getObject("jbpm.variable.resolver");
+ }
+
+ /** @deprecated Use {@link #getFunctionMapper()} instead */
public static FunctionMapper getUsedFunctionMapper() {
- if (functionMapper!=null) {
- return functionMapper;
- }
- if (JbpmConfiguration.Configs.hasObject("jbpm.function.mapper")) {
- return (FunctionMapper)
JbpmConfiguration.Configs.getObject("jbpm.function.mapper");
- }
- return null;
+ return getFunctionMapper();
}
+
+ public static FunctionMapper getFunctionMapper() {
+ return functionMapper != null ? functionMapper
+ : JbpmConfiguration.Configs.hasObject("jbpm.function.mapper") ?
+ (FunctionMapper)
JbpmConfiguration.Configs.getObject("jbpm.function.mapper")
+ : null;
+ }
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/mail/Mail.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/mail/Mail.java 2009-07-30
20:33:16 UTC (rev 5401)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/mail/Mail.java 2009-07-31
00:32:32 UTC (rev 5402)
@@ -338,11 +338,11 @@
if (expression == null) {
return null;
}
- VariableResolver variableResolver =
JbpmExpressionEvaluator.getUsedVariableResolver();
+ VariableResolver variableResolver = JbpmExpressionEvaluator.getVariableResolver();
if (variableResolver != null) {
variableResolver = new MailVariableResolver(templateVariables, variableResolver);
}
- return (String) JbpmExpressionEvaluator.evaluate(expression, executionContext,
variableResolver, JbpmExpressionEvaluator.getUsedFunctionMapper());
+ return (String) JbpmExpressionEvaluator.evaluate(expression, executionContext,
variableResolver, JbpmExpressionEvaluator.getFunctionMapper());
}
class MailVariableResolver implements VariableResolver, Serializable {
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/TaskController.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/TaskController.java 2009-07-30
20:33:16 UTC (rev 5401)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/TaskController.java 2009-07-31
00:32:32 UTC (rev 5402)
@@ -33,10 +33,9 @@
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.exe.Token;
import org.jbpm.instantiation.Delegation;
-import org.jbpm.instantiation.ProcessClassLoaderFactory;
+import org.jbpm.instantiation.UserCodeInterceptor;
import org.jbpm.instantiation.UserCodeInterceptorConfig;
import org.jbpm.taskmgmt.exe.TaskInstance;
-import org.jbpm.util.ClassLoaderUtil;
import org.jbpm.util.EqualsUtil;
/**
@@ -84,8 +83,9 @@
ContextInstance contextInstance = (processInstance != null ?
processInstance.getContextInstance() : null);
Token token = taskInstance.getToken();
- if (UserCodeInterceptorConfig.userCodeInterceptor != null) {
-
UserCodeInterceptorConfig.userCodeInterceptor.executeTaskControllerInitialization(taskControllerHandler,
taskInstance, contextInstance, token);
+ UserCodeInterceptor userCodeInterceptor =
UserCodeInterceptorConfig.getUserCodeInterceptor();
+ if (userCodeInterceptor != null) {
+ userCodeInterceptor.executeTaskControllerInitialization(taskControllerHandler,
taskInstance, contextInstance, token);
} else {
taskControllerHandler.initializeTaskVariables(taskInstance, contextInstance,
token);
}
@@ -132,8 +132,9 @@
ContextInstance contextInstance = (processInstance != null ?
processInstance.getContextInstance() : null);
Token token = taskInstance.getToken();
- if (UserCodeInterceptorConfig.userCodeInterceptor != null) {
-
UserCodeInterceptorConfig.userCodeInterceptor.executeTaskControllerSubmission(taskControllerHandler,
taskInstance, contextInstance, token);
+ UserCodeInterceptor userCodeInterceptor =
UserCodeInterceptorConfig.getUserCodeInterceptor();
+ if (userCodeInterceptor != null) {
+ userCodeInterceptor.executeTaskControllerSubmission(taskControllerHandler,
taskInstance, contextInstance, token);
} else {
taskControllerHandler.submitTaskVariables(taskInstance, contextInstance,
token);
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/exe/TaskMgmtInstance.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/exe/TaskMgmtInstance.java 2009-07-30
20:33:16 UTC (rev 5401)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/exe/TaskMgmtInstance.java 2009-07-31
00:32:32 UTC (rev 5402)
@@ -42,6 +42,7 @@
import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.graph.exe.Token;
import org.jbpm.instantiation.Delegation;
+import org.jbpm.instantiation.UserCodeInterceptor;
import org.jbpm.instantiation.UserCodeInterceptorConfig;
import org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator;
import org.jbpm.module.exe.ModuleInstance;
@@ -266,9 +267,9 @@
// instantiate the assignment handler
AssignmentHandler assignmentHandler = (AssignmentHandler)
assignmentDelegation.instantiate();
// invoke the assignment handler
- if (UserCodeInterceptorConfig.userCodeInterceptor != null) {
-
UserCodeInterceptorConfig.userCodeInterceptor.executeAssignment(assignmentHandler,
- assignable, executionContext);
+ UserCodeInterceptor userCodeInterceptor =
UserCodeInterceptorConfig.getUserCodeInterceptor();
+ if (userCodeInterceptor != null) {
+ userCodeInterceptor.executeAssignment(assignmentHandler, assignable,
executionContext);
}
else {
assignmentHandler.assign(assignable, executionContext);
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/default.jbpm.cfg.xml
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/default.jbpm.cfg.xml 2009-07-30
20:33:16 UTC (rev 5401)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/default.jbpm.cfg.xml 2009-07-31
00:32:32 UTC (rev 5402)
@@ -19,10 +19,13 @@
<service name="tx" factory="org.jbpm.tx.TxServiceFactory"
/>
</jbpm-context>
- <!-- configuration property used by persistence service impl
org.jbpm.persistence.db.DbPersistenceServiceFactory -->
+ <!-- database persistence configuration -->
<string name="resource.hibernate.cfg.xml"
value="hibernate.cfg.xml" />
+ <!-- additional database persistence properties
+ <string name="resource.hibernate.properties"
value="hibernate.properties" />
+ -->
- <!-- configuration resource files pointing to default configuration files in
jbpm-{version}.jar -->
+ <!-- entries pointing to default configuration resources in jbpm-jpdl.jar -->
<string name="resource.business.calendar"
value="org/jbpm/calendar/jbpm.business.calendar.properties" />
<string name="resource.default.modules"
value="org/jbpm/graph/def/jbpm.default.modules.properties" />
<string name="resource.converter"
value="org/jbpm/db/hibernate/jbpm.converter.properties" />
@@ -32,18 +35,27 @@
<string name="resource.varmapping"
value="org/jbpm/context/exe/jbpm.varmapping.xml" />
<string name="resource.mail.templates"
value="jbpm.mail.templates.xml" />
- <!-- class loading
+ <!-- alternate delegation class loader
<string name="jbpm.class.loader" value="context" />
-->
<bean name="process.class.loader.factory"
class="org.jbpm.instantiation.SharedProcessClassLoaderFactory"
singleton="true" />
+ <bean name="jbpm.task.instance.factory"
class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl"
singleton="true" />
<!-- make sure the block size matches the length in ByteArray.hbm.xml -->
- <int name="jbpm.byte.block.size" value="1024"
singleton="true" />
- <bean name="jbpm.task.instance.factory"
class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl"
singleton="true" />
- <bean name="jbpm.variable.resolver"
class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true"
/>
+ <int name="jbpm.byte.block.size" value="1024"
singleton="true" />
+
+ <bean name="jbpm.expression.evaluator"
class="org.jbpm.jpdl.el.impl.ExpressionEvaluatorImpl" singleton="true"
/>
+ <bean name="jbpm.variable.resolver"
class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true"
/>
+ <!-- custom function mapper
+ <bean name="jbpm.function.mapper"
class="org.example.FunctionMapperImpl" />
+ -->
+ <!-- user code interceptor
+ <bean name="jbpm.user.code.interceptor"
class="org.example.UserCodeInterceptorImpl" />
+ -->
+
<string name="jbpm.mail.smtp.host" value="localhost" />
- <bean name="jbpm.mail.address.resolver"
class="org.jbpm.identity.mail.IdentityAddressResolver"
singleton="true" />
<string name="jbpm.mail.from.address" value="jbpm@noreply"
/>
+ <bean name="jbpm.mail.address.resolver"
class="org.jbpm.identity.mail.IdentityAddressResolver"
singleton="true" />
<bean name="jbpm.job.executor"
class="org.jbpm.job.executor.JobExecutor">
<field name="jbpmConfiguration"><ref
bean="jbpmConfiguration" /></field>
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/instantiation/UserCodeInterceptorTest.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/instantiation/UserCodeInterceptorTest.java 2009-07-30
20:33:16 UTC (rev 5401)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/instantiation/UserCodeInterceptorTest.java 2009-07-31
00:32:32 UTC (rev 5402)
@@ -4,6 +4,8 @@
import java.util.List;
import org.jbpm.AbstractJbpmTestCase;
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
import org.jbpm.context.exe.ContextInstance;
import org.jbpm.graph.def.Action;
import org.jbpm.graph.def.ActionHandler;
@@ -17,100 +19,103 @@
import org.jbpm.taskmgmt.exe.TaskInstance;
public class UserCodeInterceptorTest extends AbstractJbpmTestCase {
-
- static List logs = null;
- TestInterceptor testInterceptor = null;
+ private static List logs = new ArrayList();
- protected void setUp() throws Exception
- {
+ private JbpmContext jbpmContext;
+
+ protected void setUp() throws Exception {
super.setUp();
- logs = new ArrayList();
- testInterceptor = new TestInterceptor();
- UserCodeInterceptorConfig.setUserCodeInterceptor(testInterceptor);
+ JbpmConfiguration jbpmConfiguration =
JbpmConfiguration.parseXmlString("<jbpm-configuration>"
+ + " <jbpm-context />"
+ + " <bean name='jbpm.user.code.interceptor' class='"
+ + TestInterceptor.class.getName()
+ + "' singleton='true'/>"
+ + "</jbpm-configuration>");
+ jbpmContext = jbpmConfiguration.createJbpmContext();
}
- protected void tearDown() throws Exception
- {
- UserCodeInterceptorConfig.setUserCodeInterceptor(null);
- testInterceptor = null;
- logs = null;
+ protected void tearDown() throws Exception {
+ jbpmContext.close();
+ jbpmContext.getJbpmConfiguration().close();
+ logs.clear();
super.tearDown();
}
-
- public void testAction()
- {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
- "<process-definition>" +
- " <start-state name='start'>" +
- " <event type='node-leave'>" +
- " <action name='takingthetransition'
class='"+TestAction.class.getName()+"' />" +
- " </event>" +
- " <transition to='end'/>" +
- " </start-state>" +
- " <state name='end'/>" +
- "</process-definition>"
- );
+
+ public void testAction() {
+ ProcessDefinition processDefinition =
ProcessDefinition.parseXmlString("<process-definition>"
+ + " <start-state name='start'>"
+ + " <event type='node-leave'>"
+ + " <action name='takingthetransition' class='"
+ + TestAction.class.getName()
+ + "' />"
+ + " </event>"
+ + " <transition to='end'/>"
+ + " </start-state>"
+ + " <state name='end'/>"
+ + "</process-definition>");
// create the process instance
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
-
+
List expectedLogs = new ArrayList();
expectedLogs.add("before action takingthetransition in node start");
expectedLogs.add("action executed");
expectedLogs.add("after action takingthetransition in node start");
-
+
assertEquals(expectedLogs, logs);
}
-
- public void testInterceptControllerInitialization()
- {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
- "<process-definition>" +
- " <start-state name='start'>" +
- " <transition to='t'/>" +
- " </start-state>" +
- " <task-node name='t'>" +
- " <task>" +
- " <controller
class='"+TestController.class.getName()+"'/>" +
- " </task>" +
- " <transition to='end'/>" +
- " </task-node>" +
- " <state name='end' />" +
- "</process-definition>"
- );
+
+ public void testInterceptControllerInitialization() {
+ ProcessDefinition processDefinition =
ProcessDefinition.parseXmlString("<process-definition>"
+ + " <start-state name='start'>"
+ + " <transition to='t'/>"
+ + " </start-state>"
+ + " <task-node name='t'>"
+ + " <task>"
+ + " <controller class='"
+ + TestController.class.getName()
+ + "'/>"
+ + " </task>"
+ + " <transition to='end'/>"
+ + " </task-node>"
+ + " <state name='end' />"
+ + "</process-definition>");
// create the process instance
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
-
+
List expectedLogs = new ArrayList();
expectedLogs.add("before task controller initialization");
expectedLogs.add("initializing task variables for TaskInstance(t)");
expectedLogs.add("after task controller initialization");
-
- assertEquals(expectedLogs,logs);
+
+ assertEquals(expectedLogs, logs);
}
public void testInterceptControllerSubmission() {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
- "<process-definition>" +
- " <start-state name='start'>" +
- " <transition to='t'/>" +
- " </start-state>" +
- " <task-node name='t'>" +
- " <task>" +
- " <controller
class='"+TestController.class.getName()+"'/>" +
- " </task>" +
- " <transition to='end'/>" +
- " </task-node>" +
- " <state name='end' />" +
- "</process-definition>"
- );
+ ProcessDefinition processDefinition =
ProcessDefinition.parseXmlString("<process-definition>"
+ + " <start-state name='start'>"
+ + " <transition to='t'/>"
+ + " </start-state>"
+ + " <task-node name='t'>"
+ + " <task>"
+ + " <controller class='"
+ + TestController.class.getName()
+ + "'/>"
+ + " </task>"
+ + " <transition to='end'/>"
+ + " </task-node>"
+ + " <state name='end' />"
+ + "</process-definition>");
// create the process instance
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
- TaskInstance ti = (TaskInstance)
processInstance.getTaskMgmtInstance().getTaskInstances().iterator().next();
+ TaskInstance ti = (TaskInstance) processInstance.getTaskMgmtInstance()
+ .getTaskInstances()
+ .iterator()
+ .next();
ti.end();
List expectedLogs = new ArrayList();
@@ -120,113 +125,109 @@
expectedLogs.add("before task controller submission");
expectedLogs.add("submitting task variables for TaskInstance(t)");
expectedLogs.add("after task controller submission");
-
- assertEquals(expectedLogs.get(0),logs.get(0));
- assertEquals(expectedLogs.get(1),logs.get(1));
- assertEquals(expectedLogs.get(2),logs.get(2));
- assertEquals(expectedLogs.get(3),logs.get(3));
- assertEquals(expectedLogs.get(4),logs.get(4));
- assertEquals(expectedLogs.get(5),logs.get(5));
+
+ assertEquals(expectedLogs.get(0), logs.get(0));
+ assertEquals(expectedLogs.get(1), logs.get(1));
+ assertEquals(expectedLogs.get(2), logs.get(2));
+ assertEquals(expectedLogs.get(3), logs.get(3));
+ assertEquals(expectedLogs.get(4), logs.get(4));
+ assertEquals(expectedLogs.get(5), logs.get(5));
}
-
- public void testNodeBehaviour()
- {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
- "<process-definition>" +
- " <start-state name='start'>" +
- " <transition to='auto'/>" +
- " </start-state>" +
- " <node name='auto'>" +
- " <action name='theautonode'
class='"+TestAutoAction.class.getName()+"' />" +
- " <transition to='end'/>" +
- " </node>" +
- " <state name='end' />" +
- "</process-definition>"
- );
+
+ public void testNodeBehaviour() {
+ ProcessDefinition processDefinition =
ProcessDefinition.parseXmlString("<process-definition>"
+ + " <start-state name='start'>"
+ + " <transition to='auto'/>"
+ + " </start-state>"
+ + " <node name='auto'>"
+ + " <action name='theautonode' class='"
+ + TestAutoAction.class.getName()
+ + "' />"
+ + " <transition to='end'/>"
+ + " </node>"
+ + " <state name='end' />"
+ + "</process-definition>");
// create the process instance
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
-
+
List expectedLogs = new ArrayList();
expectedLogs.add("before action theautonode in node auto");
expectedLogs.add("auto action executed");
expectedLogs.add("after action theautonode in node end");
-
+
assertEquals(expectedLogs, logs);
}
- public void testReferencedNodeBehaviour()
- {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
- "<process-definition>" +
- " <start-state name='start'>" +
- " <transition to='auto'/>" +
- " </start-state>" +
- " <node name='auto'>" +
- " <action name='reference' ref-name='referenced'
/>" +
- " <transition to='end'/>" +
- " </node>" +
- " <state name='end' />" +
- " <action name='referenced'
class='"+TestAutoAction.class.getName()+"' />" +
- "</process-definition>"
- );
+ public void testReferencedNodeBehaviour() {
+ ProcessDefinition processDefinition =
ProcessDefinition.parseXmlString("<process-definition>"
+ + " <start-state name='start'>"
+ + " <transition to='auto'/>"
+ + " </start-state>"
+ + " <node name='auto'>"
+ + " <action name='reference' ref-name='referenced'
/>"
+ + " <transition to='end'/>"
+ + " </node>"
+ + " <state name='end' />"
+ + " <action name='referenced' class='"
+ + TestAutoAction.class.getName()
+ + "' />"
+ + "</process-definition>");
// create the process instance
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
-
+
List expectedLogs = new ArrayList();
expectedLogs.add("before action reference in node auto");
expectedLogs.add("auto action executed");
expectedLogs.add("after action reference in node end");
-
+
assertEquals(expectedLogs, logs);
}
- public void testReferencedAction()
- {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
- "<process-definition>" +
- " <start-state name='start'>" +
- " <transition to='auto'/>" +
- " </start-state>" +
- " <node name='auto'>" +
- " <event type='node-enter'>" +
- " <action name='reference' ref-name='referenced'
/>" +
- " </event>" +
- " <transition to='end'/>" +
- " </node>" +
- " <state name='end' />" +
- " <action name='referenced'
class='"+TestAction.class.getName()+"' />" +
- "</process-definition>"
- );
+ public void testReferencedAction() {
+ ProcessDefinition processDefinition =
ProcessDefinition.parseXmlString("<process-definition>"
+ + " <start-state name='start'>"
+ + " <transition to='auto'/>"
+ + " </start-state>"
+ + " <node name='auto'>"
+ + " <event type='node-enter'>"
+ + " <action name='reference' ref-name='referenced'
/>"
+ + " </event>"
+ + " <transition to='end'/>"
+ + " </node>"
+ + " <state name='end' />"
+ + " <action name='referenced' class='"
+ + TestAction.class.getName()
+ + "' />"
+ + "</process-definition>");
// create the process instance
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
-
+
List expectedLogs = new ArrayList();
expectedLogs.add("before action reference in node auto");
expectedLogs.add("action executed");
expectedLogs.add("after action reference in node auto");
-
+
assertEquals(expectedLogs, logs);
}
-
- public void testInterceptAssignment()
- {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
- "<process-definition>" +
- " <start-state name='start'>" +
- " <transition to='t'/>" +
- " </start-state>" +
- " <task-node name='t'>" +
- " <task>" +
- " <assignment
class='"+TestAssignment.class.getName()+"' />" +
- " </task>" +
- " <transition to='end'/>" +
- " </task-node>" +
- " <state name='end' />" +
- "</process-definition>"
- );
+
+ public void testInterceptAssignment() {
+ ProcessDefinition processDefinition =
ProcessDefinition.parseXmlString("<process-definition>"
+ + " <start-state name='start'>"
+ + " <transition to='t'/>"
+ + " </start-state>"
+ + " <task-node name='t'>"
+ + " <task>"
+ + " <assignment class='"
+ + TestAssignment.class.getName()
+ + "' />"
+ + " </task>"
+ + " <transition to='end'/>"
+ + " </task-node>"
+ + " <state name='end' />"
+ + "</process-definition>");
// create the process instance
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
@@ -235,85 +236,82 @@
expectedLogs.add("before assignment");
expectedLogs.add("assigning TaskInstance(t)");
expectedLogs.add("after assignment");
-
+
assertEquals(expectedLogs, logs);
}
- public static class TestInterceptor implements UserCodeInterceptor
- {
+ public static class TestInterceptor implements UserCodeInterceptor {
- public void executeAction(Action action, ExecutionContext executionContext) throws
Exception
- {
- logs.add("before action " + action.getName() + " in node " +
executionContext.getNode().getName());
+ public void executeAction(Action action, ExecutionContext executionContext) throws
Exception {
+ logs.add("before action "
+ + action.getName()
+ + " in node "
+ + executionContext.getNode().getName());
action.execute(executionContext);
- logs.add("after action " + action.getName() + " in node " +
executionContext.getNode().getName());
+ logs.add("after action "
+ + action.getName()
+ + " in node "
+ + executionContext.getNode().getName());
}
- public void executeAssignment(AssignmentHandler assignmentHandler, Assignable
assignable, ExecutionContext executionContext) throws Exception
- {
+ public void executeAssignment(AssignmentHandler assignmentHandler, Assignable
assignable,
+ ExecutionContext executionContext) throws Exception {
logs.add("before assignment");
assignmentHandler.assign(assignable, executionContext);
logs.add("after assignment");
}
- public void executeTaskControllerInitialization(TaskControllerHandler
taskControllerHandler, TaskInstance taskInstance, ContextInstance contextInstance, Token
token)
- {
+ public void executeTaskControllerInitialization(TaskControllerHandler
taskControllerHandler,
+ TaskInstance taskInstance, ContextInstance contextInstance, Token token) {
logs.add("before task controller initialization");
taskControllerHandler.initializeTaskVariables(taskInstance, contextInstance,
token);
logs.add("after task controller initialization");
}
- public void executeTaskControllerSubmission(TaskControllerHandler
taskControllerHandler, TaskInstance taskInstance, ContextInstance contextInstance, Token
token)
- {
+ public void executeTaskControllerSubmission(TaskControllerHandler
taskControllerHandler,
+ TaskInstance taskInstance, ContextInstance contextInstance, Token token) {
logs.add("before task controller submission");
taskControllerHandler.submitTaskVariables(taskInstance, contextInstance, token);
logs.add("after task controller submission");
}
}
- public static class TestAction implements ActionHandler
- {
+ public static class TestAction implements ActionHandler {
private static final long serialVersionUID = 1L;
- public void execute(ExecutionContext executionContext) throws Exception
- {
+ public void execute(ExecutionContext executionContext) throws Exception {
logs.add("action executed");
}
}
- public static class TestAutoAction implements ActionHandler
- {
+ public static class TestAutoAction implements ActionHandler {
private static final long serialVersionUID = 1L;
- public void execute(ExecutionContext executionContext) throws Exception
- {
+ public void execute(ExecutionContext executionContext) throws Exception {
logs.add("auto action executed");
executionContext.leaveNode();
}
}
- public static class TestAssignment implements AssignmentHandler
- {
+ public static class TestAssignment implements AssignmentHandler {
private static final long serialVersionUID = 1L;
- public void assign(Assignable assignable, ExecutionContext executionContext) throws
Exception
- {
+ public void assign(Assignable assignable, ExecutionContext executionContext) throws
Exception {
logs.add("assigning " + assignable);
assignable.setActorId("shipper");
}
}
- public static class TestController implements TaskControllerHandler
- {
+ public static class TestController implements TaskControllerHandler {
private static final long serialVersionUID = 1L;
- public void initializeTaskVariables(TaskInstance taskInstance, ContextInstance
contextInstance, Token token)
- {
+ public void initializeTaskVariables(TaskInstance taskInstance, ContextInstance
contextInstance,
+ Token token) {
logs.add("initializing task variables for " + taskInstance);
}
- public void submitTaskVariables(TaskInstance taskInstance, ContextInstance
contextInstance, Token token)
- {
+ public void submitTaskVariables(TaskInstance taskInstance, ContextInstance
contextInstance,
+ Token token) {
logs.add("submitting task variables for " + taskInstance);
}
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/main/java/org/jbpm/sim/def/JbpmSimulationModel.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/main/java/org/jbpm/sim/def/JbpmSimulationModel.java 2009-07-30
20:33:16 UTC (rev 5401)
+++
jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/main/java/org/jbpm/sim/def/JbpmSimulationModel.java 2009-07-31
00:32:32 UTC (rev 5402)
@@ -15,14 +15,11 @@
import org.jbpm.graph.def.Transition;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.node.EndState;
-import org.jbpm.instantiation.UserCodeInterceptorConfig;
import org.jbpm.sim.SimulationConstants;
import org.jbpm.sim.entity.ResourceUsingEntity;
import org.jbpm.sim.event.ProcessStartEventGenerator;
import org.jbpm.sim.exception.ExperimentConfigurationException;
import org.jbpm.sim.jpdl.SimulationDefinition;
-import org.jbpm.sim.jpdl.SimulationUserCodeInterceptor;
-import org.jbpm.sim.kpi.BusinessFigureCalculator;
import org.jbpm.sim.kpi.BusinessFigure;
import org.jbpm.taskmgmt.def.Task;
import org.jbpm.taskmgmt.exe.TaskInstance;
@@ -56,7 +53,7 @@
* <li> ending TaskInstances
* </ul>
* every distribution is identified by a name. If you add more than one
- * distribution with the same name ot the expermient, a
+ * distribution with the same name of the experiment, a
* <code>org.jbpm.sim.exception.ExperimentConfigurationException</code> is
thrown.
*/
private Map distributions = new HashMap();
@@ -82,7 +79,7 @@
*
* It's a Map<String, String>
*/
-// private Map processStartDistributions = new HashMap();
+ // private Map processStartDistributions = new HashMap();
/**
* maps for process elements which distribution to use
@@ -91,7 +88,7 @@
private Map distributionMap = new HashMap();
/**
- * conbfigurations for choosing the leaving transition
+ * configurations for choosing the leaving transition
*
* It is a Map<Node, LeavingTransitionProbabilityConfiguration>
*/
@@ -148,10 +145,10 @@
super(owner, name, true, true);
// "install" the UserCode Intercepter (TODO: may not needed, delete then)
- UserCodeInterceptorConfig.userCodeInterceptor = new SimulationUserCodeInterceptor();
+ // UserCodeInterceptorConfig.setUserCodeInterceptor(new
SimulationUserCodeInterceptor());
// load special configuration for simulation run
-// JbpmConfiguration.getInstance("org/jbpm/sim/simulation.cfg.xml");
+ // JbpmConfiguration.getInstance("org/jbpm/sim/simulation.cfg.xml");
}
public JbpmSimulationModel() {
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/main/java/org/jbpm/sim/report/jasper/AbstractBaseJasperReport.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/main/java/org/jbpm/sim/report/jasper/AbstractBaseJasperReport.java 2009-07-30
20:33:16 UTC (rev 5401)
+++
jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/main/java/org/jbpm/sim/report/jasper/AbstractBaseJasperReport.java 2009-07-31
00:32:32 UTC (rev 5402)
@@ -3,8 +3,6 @@
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -24,7 +22,6 @@
import net.sf.jasperreports.engine.JasperPrintManager;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.data.JRBeanArrayDataSource;
-import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.engine.export.JRPrintServiceExporter;
import net.sf.jasperreports.engine.export.JRPrintServiceExporterParameter;
import net.sf.jasperreports.engine.util.JRLoader;