JBoss JBPM SVN: r5404 - jbpm3/branches/jbpm-3.2-soa/modules/core.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-07-31 02:42:58 -0400 (Fri, 31 Jul 2009)
New Revision: 5404
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml
Log:
exclude schema test from db2 suite
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml 2009-07-31 06:26:42 UTC (rev 5403)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml 2009-07-31 06:42:58 UTC (rev 5404)
@@ -384,6 +384,11 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>org/jbpm/db/JbpmSchemaDbTest.java</exclude>
+ </excludes>
+ </configuration>
</plugin>
</plugins>
</build>
14 years, 9 months
JBoss JBPM SVN: r5403 - jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2375.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-07-31 02:26:42 -0400 (Fri, 31 Jul 2009)
New Revision: 5403
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2375/JBPM2375Test.java
Log:
increase test timeout
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2375/JBPM2375Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2375/JBPM2375Test.java 2009-07-31 00:32:32 UTC (rev 5402)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2375/JBPM2375Test.java 2009-07-31 06:26:42 UTC (rev 5403)
@@ -15,7 +15,7 @@
*/
public class JBPM2375Test extends AbstractDbTestCase {
- private static final int TEST_TIMEOUT = 10 * 1000;
+ private static final int TEST_TIMEOUT = 60 * 1000;
private static boolean throwError;
private ProcessDefinition processDefinition;
14 years, 9 months
JBoss JBPM SVN: r5402 - in jbpm3/branches/jbpm-3.2-soa/modules: core/src/main/java/org/jbpm/graph/def and 9 other directories.
by do-not-reply@jboss.org
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;
14 years, 9 months
JBoss JBPM SVN: r5401 - in jbpm4/trunk/modules/bpmn/src: main/java/org/jbpm/bpmn/parser and 2 other directories.
by do-not-reply@jboss.org
Author: kukeltje
Date: 2009-07-30 16:33:16 -0400 (Thu, 30 Jul 2009)
New Revision: 5401
Modified:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java
jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayTest.java
jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/UserTaskTest.java
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGateway.bpmn.xml
Log:
Made default sequenceflow working on exclusiveGateway
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java 2009-07-30 20:26:44 UTC (rev 5400)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java 2009-07-30 20:33:16 UTC (rev 5401)
@@ -43,7 +43,7 @@
public abstract class BpmnActivity implements ActivityBehaviour {
private static final Log log = Log.getLog(BindingsParser.class.getName());
-
+
private static final long serialVersionUID = 1L;
private static final boolean FORK_ALLOWED = true;
@@ -53,19 +53,19 @@
protected void leaveBpmnActivity(ExecutionImpl execution) {
- proceedForkedIfAllowed(execution, FORK_ALLOWED, CONDITIONS_CHECKED);
+ proceedForkedIfAllowed(execution, FORK_ALLOWED, CONDITIONS_CHECKED, null);
}
- protected void leaveBpmnActivitySingle(ExecutionImpl execution) {
+ protected void leaveBpmnActivitySingle(ExecutionImpl execution, String default_) {
- proceedForkedIfAllowed(execution, FORK_DISALLOWED, CONDITIONS_CHECKED);
+ proceedForkedIfAllowed(execution, FORK_DISALLOWED, CONDITIONS_CHECKED, default_);
}
-
+
protected void leaveBpmnActivityAll(ExecutionImpl execution) {
- proceedForkedIfAllowed(execution, FORK_ALLOWED, CONDITIONS_IGNORED);
+ proceedForkedIfAllowed(execution, FORK_ALLOWED, CONDITIONS_IGNORED, null);
}
@@ -74,28 +74,40 @@
*
* Code copied basically from jPDL fork.
*/
- private void proceedForkedIfAllowed(ExecutionImpl execution, boolean forkAllowed, boolean checkConditions) {
+ private void proceedForkedIfAllowed(ExecutionImpl execution, boolean forkAllowed, boolean checkConditions, String default_) {
Activity activity = execution.getActivity();
-
+
// evaluate the conditions and find the transitions that should be forked
List<Transition> forkingTransitions = new ArrayList<Transition>();
List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
for (Transition transition : outgoingTransitions) {
Condition condition = transition.getCondition();
- if ((condition == null) || (!checkConditions) || (condition.evaluate(execution)) ) {
+ // also ignore the default transition of the exclusive gateway
+ if (((condition == null) || (!checkConditions) || (condition.evaluate(execution))) && (!transition.getName().equals(default_))) {
forkingTransitions.add(transition);
}
}
- log.debug(forkingTransitions.size() + " out of "+ outgoingTransitions.size() + " selected for " + activity.getName());
-
+ log.debug(forkingTransitions.size() + " out of " + outgoingTransitions.size() + " selected for " + activity.getName());
+
// if no outgoing transitions should be forked,
if (forkingTransitions.size() == 0) {
- // end this execution
- execution.end();
- // if there is exactly 1 transition to be taken, just use the incoming
- // execution
- } else if (forkingTransitions.size() == 1) {
+ if (default_ != null) { // take the default if it is there
+ for (Transition transition : outgoingTransitions) {
+ if (default_.equals(transition.getName())) {
+ // take it
+ execution.take(transition);
+ }
+ }
+ } else {
+ // end this execution
+ execution.end();
+ }
+ }
+
+ // if there is exactly 1 transition to be taken, just use the incoming
+ // execution
+ else if (forkingTransitions.size() == 1) {
execution.take(forkingTransitions.get(0));
// if there are more transitions
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java 2009-07-30 20:26:44 UTC (rev 5400)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java 2009-07-30 20:33:16 UTC (rev 5401)
@@ -37,7 +37,7 @@
public class ExclusiveGatewayActivity extends BpmnActivity {
String gatewayDirection = "unspecified"; // is the default behaviour
- String default_ = null;
+ String default_;
private static final long serialVersionUID = 1L;
@@ -46,7 +46,7 @@
}
public void execute(ExecutionImpl execution) {
- leaveBpmnActivitySingle(execution);
+ leaveBpmnActivitySingle(execution, default_);
}
public String getGatewayDirection() {
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java 2009-07-30 20:26:44 UTC (rev 5400)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java 2009-07-30 20:33:16 UTC (rev 5401)
@@ -43,12 +43,12 @@
public Object parse(Element element, Parse parse, Parser parser) {
super.parse(element);
-
+
String default_ = null;
- if (element.hasAttribute("default")) {
+ if (element.hasAttribute("default")) {
default_ = element.getAttribute("default");
}
-
+
boolean defaultExists = false;
List<Element> transitionElements = XmlUtil.elements((Element) element.getParentNode(), "sequenceFlow");
@@ -63,15 +63,16 @@
if (elementId.equals(sourceRef)) {
outgoing++;
ce = XmlUtil.element(transitionElement, "conditionExpression");
-
- //TODO: Warn or error if CE is not of type tFormalExpression?
-
+
+ // TODO: Warn or error if CE is not of type tFormalExpression?
+
if (transitionElement.getAttribute("id").equals(default_)) {
defaultExists = true;
if (ce != null) {
// conditionExpression on the default sequenceflow SHALL be ignored
// according to the spec
- log.debug("Default sequenceFlow for " + elementName + " has conditionExpressio(s). Ignoring them by removing them from the Document model");
+ log.debug("Default sequenceFlow (" + default_ + ") for '" + elementName
+ + "' has conditionExpressio(s). Ignoring them by removing them from the Document model");
transitionElement.removeChild(ce);
}
} else if (default_ != null && ce == null) {
@@ -88,8 +89,7 @@
valid = valid == false ? false : validGatewayDirection;
if (default_ != null && !defaultExists) {
- parse.addProblem("exclusiveGateway '" + elementName + "' default sequenceFlow '" + default_
- + "' does not exist or is not related to this node", element);
+ parse.addProblem("exclusiveGateway '" + elementName + "' default sequenceFlow '" + default_ + "' does not exist or is not related to this node", element);
valid = false;
}
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java 2009-07-30 20:26:44 UTC (rev 5400)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java 2009-07-30 20:33:16 UTC (rev 5401)
@@ -39,30 +39,30 @@
public class BindingsParser extends Parser {
private static final Log log = Log.getLog(BindingsParser.class.getName());
-
+
public Object parseDocumentElement(Element documentElement, Parse parse) {
List<Binding> bindings = new ArrayList<Binding>();
parse.setDocumentObject(bindings);
-
+
for (Element bindingElement : XmlUtil.elements(documentElement)) {
Binding binding = instantiateBinding(bindingElement, parse);
bindings.add(binding);
}
-
+
return bindings;
}
protected Binding instantiateBinding(Element bindingElement, Parse parse) {
String bindingClassName = XmlUtil.attribute(bindingElement, "binding", true, parse);
-
- log.trace("adding bpmn binding "+bindingClassName);
-
- if (bindingClassName!=null) {
+
+ log.trace("adding bpmn binding " + bindingClassName);
+
+ if (bindingClassName != null) {
try {
- Class<?> bindingClass = ReflectUtil.loadClass(classLoader, bindingClassName);
+ Class< ? > bindingClass = ReflectUtil.loadClass(classLoader, bindingClassName);
return (Binding) bindingClass.newInstance();
} catch (Exception e) {
- parse.addProblem("couldn't instantiate activity binding "+bindingClassName, e);
+ parse.addProblem("couldn't instantiate activity binding " + bindingClassName, e);
}
}
return null;
Modified: jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayTest.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayTest.java 2009-07-30 20:26:44 UTC (rev 5400)
+++ jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayTest.java 2009-07-30 20:33:16 UTC (rev 5401)
@@ -56,7 +56,7 @@
}
}
- public void testNormalExecute() {
+ public void testNormalExecuteDecisionCondition() {
String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/flownodes/exclusiveGateway.bpmn.xml").deploy();
@@ -66,26 +66,48 @@
variables.put("test", "value");
ProcessInstance pi = executionService.startProcessInstanceByKey("ExclusiveGateway", variables );
-
String pid = pi.getId();
-
TaskQuery taskQuery = taskService.createTaskQuery();
List<Task> allTasks = taskQuery.list();
- // since the uncontrolled sequence flow OUT of the activity behaves as a fork
- // we now have two tasks
assertEquals(1, allTasks.size());
assertEquals("doSomething", allTasks.get(0).getActivityName());
- //assertEquals("doSomethingElse", allTasks.get(1).getActivityName());
- // specifying a transition is unnecessary, BPMN has outgoing AND semantic!
- // TODO: fix
- // Currently not passing any 'outcome'
taskService.completeTask( allTasks.get(0).getId());
+
+ // process instance should be ended
+ pi = executionService.findProcessInstanceById(pid);
+ assertNull(pi);
+ }
+ finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
+ }
+
+ public void testNormalExecuteDefault() {
+
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/flownodes/exclusiveGateway.bpmn.xml").deploy();
+
+ try {
+ Map variables = new HashMap();
+
+ variables.put("test", "other value");
+
+ ProcessInstance pi = executionService.startProcessInstanceByKey("ExclusiveGateway", variables );
+ String pid = pi.getId();
+
+ TaskQuery taskQuery = taskService.createTaskQuery();
+ List<Task> allTasks = taskQuery.list();
+
+ assertEquals(1, allTasks.size());
+ assertEquals("doSomethingElse", allTasks.get(0).getActivityName());
+
+ taskService.completeTask( allTasks.get(0).getId());
+
+ // process instance should be ended
pi = executionService.findProcessInstanceById(pid);
- // process instance should be ended
assertNull(pi);
}
@@ -94,6 +116,7 @@
}
}
+
public void testNonBoundDefault() {
List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayNonBoundDefault.bpmn.xml");
Modified: jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/UserTaskTest.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/UserTaskTest.java 2009-07-30 20:26:44 UTC (rev 5400)
+++ jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/UserTaskTest.java 2009-07-30 20:33:16 UTC (rev 5401)
@@ -82,7 +82,9 @@
// process instance is ended
pi = executionService.findProcessInstanceById(pi.getId());
- assertEquals(true, pi.isEnded());
+ // One way or another I would also expect this to work... pi is gone from database immediately when ended. Only in History DB
+ //assertEquals(true, pi.isEnded());
+ assertNull(pi);
}
finally {
repositoryService.deleteDeploymentCascade(deploymentId);
Modified: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGateway.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGateway.bpmn.xml 2009-07-30 20:26:44 UTC (rev 5400)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGateway.bpmn.xml 2009-07-30 20:33:16 UTC (rev 5401)
@@ -13,7 +13,7 @@
targetRef="exclusiveGatewayDecision" name="Start->exclusiveGateway" />
<bpmn:exclusiveGateway id="exclusiveGatewayDecision"
- name="Just a gateway" />
+ name="Just a gateway" default="flow3"/>
<!-- Sequence Flow -->
@@ -23,7 +23,6 @@
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGatewayDecision"
targetRef="doSomethingElse">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${test == 'other'}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:userTask id="doSomething" name="Anything at all"
14 years, 9 months
JBoss JBPM SVN: r5400 - jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-07-30 16:26:44 -0400 (Thu, 30 Jul 2009)
New Revision: 5400
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/hibernate.cache.xml
Log:
[JBPM-2092] Byte Array Should Be In Default Cache Configuration
class ByteArray and collection ByteArray.byteBlocks added to cache configuration
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/hibernate.cache.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/hibernate.cache.xml 2009-07-30 20:02:32 UTC (rev 5399)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/hibernate.cache.xml 2009-07-30 20:26:44 UTC (rev 5400)
@@ -5,6 +5,9 @@
<!-- strategy="nonstrict-read-write" can be used with HashtableCacheProvider -->
+ <class-cache class="org.jbpm.bytes.ByteArray" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.bytes.ByteArray.byteBlocks" usage="nonstrict-read-write" />
+
<class-cache class="org.jbpm.context.def.VariableAccess" usage="nonstrict-read-write" />
<collection-cache collection="org.jbpm.file.def.FileDefinition.processFiles" usage="nonstrict-read-write" />
14 years, 9 months
JBoss JBPM SVN: r5399 - jbpm3/branches/jbpm-3.2-soa/modules/identity/src/main/java/org/jbpm/identity/hibernate.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-07-30 16:02:32 -0400 (Thu, 30 Jul 2009)
New Revision: 5399
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/identity/src/main/java/org/jbpm/identity/hibernate/IdentitySession.java
Log:
minor fix to issue introduced in r5397
Modified: jbpm3/branches/jbpm-3.2-soa/modules/identity/src/main/java/org/jbpm/identity/hibernate/IdentitySession.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/identity/src/main/java/org/jbpm/identity/hibernate/IdentitySession.java 2009-07-30 19:27:41 UTC (rev 5398)
+++ jbpm3/branches/jbpm-3.2-soa/modules/identity/src/main/java/org/jbpm/identity/hibernate/IdentitySession.java 2009-07-30 20:02:32 UTC (rev 5399)
@@ -44,7 +44,7 @@
private static final Log log = LogFactory.getLog(IdentitySession.class);
- Session session;
+ final Session session;
private Transaction transaction;
public IdentitySession(Session session) {
@@ -207,6 +207,7 @@
.createAlias("group", "g")
.add(Restrictions.eq("role", role))
.add(Restrictions.eq("g.name", groupName))
+ .setProjection(Projections.property("user"))
.uniqueResult();
}
}
14 years, 9 months
JBoss JBPM SVN: r5397 - in jbpm3/branches/jbpm-3.2-soa/modules: core/src/main/java/org/jbpm/db and 4 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-07-30 15:25:26 -0400 (Thu, 30 Jul 2009)
New Revision: 5397
Removed:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/Execution.java
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/db/ContextSession.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/LoggingSession.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/TaskMgmtSession.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Identifiable.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/el/parser/ELParser.java
jbpm3/branches/jbpm-3.2-soa/modules/identity/src/main/java/org/jbpm/identity/hibernate/IdentitySession.java
Log:
fix some eclipse warnings
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 18:57:16 UTC (rev 5396)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/JbpmContext.java 2009-07-30 19:25:26 UTC (rev 5397)
@@ -140,10 +140,11 @@
}
/**
- * obtains the current JbpmContext from a thread local. The current JbpmContexts are maintained in
+ * obtains the current JbpmContext from a thread local. The current contexts are maintained in
* a stack so that you can do nested context operations for different jbpm configurations.
*
- * @deprecated method moved to {@link JbpmConfiguration}.
+ * <p>it is <strong>strongly recommended</strong> that client code invokes
+ * {@link JbpmConfiguration#getCurrentJbpmContext()} in preference to this method.</p>
*/
public static JbpmContext getCurrentJbpmContext() {
JbpmContext currentJbpmContext = null;
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/ContextSession.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/ContextSession.java 2009-07-30 18:57:16 UTC (rev 5396)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/ContextSession.java 2009-07-30 19:25:26 UTC (rev 5397)
@@ -30,8 +30,9 @@
*/
public class ContextSession {
+ final Session session;
+ /** @deprecated */
final JbpmSession jbpmSession;
- final Session session;
/**
* @deprecated use {@link #ContextSession(Session)} instead
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java 2009-07-30 18:57:16 UTC (rev 5396)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java 2009-07-30 19:25:26 UTC (rev 5397)
@@ -47,6 +47,7 @@
public class GraphSession {
final Session session;
+ /** @deprecated */
final JbpmSession jbpmSession;
/** @deprecated use {@link #GraphSession(Session)} instead */
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/LoggingSession.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/LoggingSession.java 2009-07-30 18:57:16 UTC (rev 5396)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/LoggingSession.java 2009-07-30 19:25:26 UTC (rev 5397)
@@ -37,8 +37,9 @@
public class LoggingSession {
+ final Session session;
+ /** @deprecated */
final JbpmSession jbpmSession;
- final Session session;
/** @deprecated use {@link #LoggingSession(Session)} instead */
public LoggingSession(JbpmSession jbpmSession) {
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/TaskMgmtSession.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/TaskMgmtSession.java 2009-07-30 18:57:16 UTC (rev 5396)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/TaskMgmtSession.java 2009-07-30 19:25:26 UTC (rev 5397)
@@ -36,6 +36,7 @@
public class TaskMgmtSession {
final Session session;
+ /** @deprecated */
final JbpmSession jbpmSession;
/** @deprecated use {@link #TaskMgmtSession(Session)} instead */
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Identifiable.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Identifiable.java 2009-07-30 18:57:16 UTC (rev 5396)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Identifiable.java 2009-07-30 19:25:26 UTC (rev 5397)
@@ -22,12 +22,11 @@
package org.jbpm.graph.def;
/**
- * Implemteded by elemtes that support an id
+ * Implemented by elements that support an id
*
* @author Thomas.Diesler(a)jboss.com
* @since 04-Dec-2008
*/
-public interface Identifiable
-{
+public interface Identifiable {
long getId();
}
Deleted: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/Execution.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/Execution.java 2009-07-30 18:57:16 UTC (rev 5396)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/Execution.java 2009-07-30 19:25:26 UTC (rev 5397)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.graph.exe;
-
-import org.jbpm.graph.def.ProcessDefinition;
-
-/**
- * Introduce the concept of Execution.
- *
- * This implementation is equivalent to the jBPM3
- *
- * @link{ProcessInstance}
- */
-public class Execution extends ProcessInstance {
-
- public Execution(ProcessDefinition pd) {
- super(pd);
- }
-
-}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/el/parser/ELParser.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/el/parser/ELParser.java 2009-07-30 18:57:16 UTC (rev 5396)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/el/parser/ELParser.java 2009-07-30 19:25:26 UTC (rev 5397)
@@ -80,15 +80,13 @@
if (elems != null) {
ret = new ExpressionString (elems.toArray ());
}
- {if (true) return ret;}
- throw new Error("Missing return statement in function");
+ return ret;
}
final public String AttrValueString() throws ParseException {
ELToken t;
t = jj_consume_token(NON_EXPRESSION_TEXT);
- {if (true) return t.image;}
- throw new Error("Missing return statement in function");
+ return t.image;
}
final public Expression AttrValueExpression() throws ParseException {
@@ -96,8 +94,7 @@
jj_consume_token(START_EXPRESSION);
exp = Expression();
jj_consume_token(END_EXPRESSION);
- {if (true) return exp;}
- throw new Error("Missing return statement in function");
+ return exp;
}
final public Expression Expression() throws ParseException {
@@ -126,8 +123,7 @@
throw new ParseException();
}
}
- {if (true) return ret;}
- throw new Error("Missing return statement in function");
+ return ret;
}
final public Expression OrExpression() throws ParseException {
@@ -170,14 +166,13 @@
expressions.add (expression);
}
if (operators != null) {
- {if (true) return new BinaryOperatorExpression (startExpression,
+ return new BinaryOperatorExpression (startExpression,
operators,
- expressions);}
+ expressions);
}
else {
- {if (true) return startExpression;}
+ return startExpression;
}
- throw new Error("Missing return statement in function");
}
final public Expression AndExpression() throws ParseException {
@@ -220,14 +215,13 @@
expressions.add (expression);
}
if (operators != null) {
- {if (true) return new BinaryOperatorExpression (startExpression,
+ return new BinaryOperatorExpression (startExpression,
operators,
- expressions);}
+ expressions);
}
else {
- {if (true) return startExpression;}
+ return startExpression;
}
- throw new Error("Missing return statement in function");
}
final public Expression EqualityExpression() throws ParseException {
@@ -297,14 +291,13 @@
expressions.add (expression);
}
if (operators != null) {
- {if (true) return new BinaryOperatorExpression (startExpression,
+ return new BinaryOperatorExpression (startExpression,
operators,
- expressions);}
+ expressions);
}
else {
- {if (true) return startExpression;}
+ return startExpression;
}
- throw new Error("Missing return statement in function");
}
final public Expression RelationalExpression() throws ParseException {
@@ -410,14 +403,13 @@
expressions.add (expression);
}
if (operators != null) {
- {if (true) return new BinaryOperatorExpression (startExpression,
+ return new BinaryOperatorExpression (startExpression,
operators,
- expressions);}
+ expressions);
}
else {
- {if (true) return startExpression;}
+ return startExpression;
}
- throw new Error("Missing return statement in function");
}
final public Expression AddExpression() throws ParseException {
@@ -461,14 +453,13 @@
expressions.add (expression);
}
if (operators != null) {
- {if (true) return new BinaryOperatorExpression (startExpression,
+ return new BinaryOperatorExpression (startExpression,
operators,
- expressions);}
+ expressions);
}
else {
- {if (true) return startExpression;}
+ return startExpression;
}
- throw new Error("Missing return statement in function");
}
final public Expression MultiplyExpression() throws ParseException {
@@ -543,14 +534,13 @@
expressions.add (expression);
}
if (operators != null) {
- {if (true) return new BinaryOperatorExpression (startExpression,
+ return new BinaryOperatorExpression (startExpression,
operators,
- expressions);}
+ expressions);
}
else {
- {if (true) return startExpression;}
+ return startExpression;
}
- throw new Error("Missing return statement in function");
}
final public Expression ConditionalExpression() throws ParseException {
@@ -560,8 +550,7 @@
trueBranch = Expression();
jj_consume_token(COLON);
falseBranch = Expression();
- {if (true) return new ConditionalExpression(condition, trueBranch, falseBranch);}
- throw new Error("Missing return statement in function");
+ return new ConditionalExpression(condition, trueBranch, falseBranch);
}
final public Expression UnaryExpression() throws ParseException {
@@ -626,15 +615,14 @@
}
expression = Value();
if (operators != null) {
- {if (true) return new UnaryOperatorExpression (null, operators, expression);}
+ return new UnaryOperatorExpression (null, operators, expression);
}
else if (singleOperator != null) {
- {if (true) return new UnaryOperatorExpression (singleOperator, null, expression);}
+ return new UnaryOperatorExpression (singleOperator, null, expression);
}
else {
- {if (true) return expression;}
+ return expression;
}
- throw new Error("Missing return statement in function");
}
final public Expression Value() throws ParseException {
@@ -660,12 +648,11 @@
suffixes.add (suffix);
}
if (suffixes == null) {
- {if (true) return prefix;}
+ return prefix;
}
else {
- {if (true) return new ComplexValue (prefix, suffixes);}
+ return new ComplexValue (prefix, suffixes);
}
- throw new Error("Missing return statement in function");
}
/**
@@ -703,15 +690,13 @@
}
}
}
- {if (true) return ret;}
- throw new Error("Missing return statement in function");
+ return ret;
}
final public NamedValue NamedValue() throws ParseException {
ELToken t;
t = jj_consume_token(IDENTIFIER);
- {if (true) return new NamedValue (t.image);}
- throw new Error("Missing return statement in function");
+ return new NamedValue (t.image);
}
final public FunctionInvocation FunctionInvocation() throws ParseException {
@@ -755,8 +740,7 @@
;
}
jj_consume_token(RPAREN);
- {if (true) return new FunctionInvocation(qualifiedName, argumentList);}
- throw new Error("Missing return statement in function");
+ return new FunctionInvocation(qualifiedName, argumentList);
}
final public ValueSuffix ValueSuffix() throws ParseException {
@@ -773,8 +757,7 @@
jj_consume_token(-1);
throw new ParseException();
}
- {if (true) return suffix;}
- throw new Error("Missing return statement in function");
+ return suffix;
}
final public PropertySuffix PropertySuffix() throws ParseException {
@@ -782,8 +765,7 @@
String property;
jj_consume_token(DOT);
property = Identifier();
- {if (true) return new PropertySuffix (property);}
- throw new Error("Missing return statement in function");
+ return new PropertySuffix (property);
}
final public ArraySuffix ArraySuffix() throws ParseException {
@@ -791,8 +773,7 @@
jj_consume_token(LBRACKET);
index = Expression();
jj_consume_token(RBRACKET);
- {if (true) return new ArraySuffix (index);}
- throw new Error("Missing return statement in function");
+ return new ArraySuffix (index);
}
final public Literal Literal() throws ParseException {
@@ -819,60 +800,51 @@
jj_consume_token(-1);
throw new ParseException();
}
- {if (true) return ret;}
- throw new Error("Missing return statement in function");
+ return ret;
}
final public BooleanLiteral BooleanLiteral() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case TRUE:
jj_consume_token(TRUE);
- {if (true) return BooleanLiteral.TRUE;}
- break;
+ return BooleanLiteral.TRUE;
case FALSE:
jj_consume_token(FALSE);
- {if (true) return BooleanLiteral.FALSE;}
- break;
+ return BooleanLiteral.FALSE;
default:
jj_la1[34] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
- throw new Error("Missing return statement in function");
}
final public StringLiteral StringLiteral() throws ParseException {
ELToken t;
t = jj_consume_token(STRING_LITERAL);
- {if (true) return StringLiteral.fromToken (t.image);}
- throw new Error("Missing return statement in function");
+ return StringLiteral.fromToken (t.image);
}
final public IntegerLiteral IntegerLiteral() throws ParseException {
ELToken t;
t = jj_consume_token(INTEGER_LITERAL);
- {if (true) return new IntegerLiteral (t.image);}
- throw new Error("Missing return statement in function");
+ return new IntegerLiteral (t.image);
}
final public FloatingPointLiteral FloatingPointLiteral() throws ParseException {
ELToken t;
t = jj_consume_token(FLOATING_POINT_LITERAL);
- {if (true) return new FloatingPointLiteral (t.image);}
- throw new Error("Missing return statement in function");
+ return new FloatingPointLiteral (t.image);
}
final public NullLiteral NullLiteral() throws ParseException {
jj_consume_token(NULL);
- {if (true) return NullLiteral.SINGLETON;}
- throw new Error("Missing return statement in function");
+ return NullLiteral.SINGLETON;
}
final public String Identifier() throws ParseException {
ELToken t;
t = jj_consume_token(IDENTIFIER);
- {if (true) return t.image;}
- throw new Error("Missing return statement in function");
+ return t.image;
}
final public String QualifiedName() throws ParseException {
@@ -885,10 +857,9 @@
}
localPart = Identifier();
if (prefix == null)
- {if (true) return localPart;}
+ return localPart;
else
- {if (true) return prefix + ":" + localPart;}
- throw new Error("Missing return statement in function");
+ return prefix + ":" + localPart;
}
final private boolean jj_2_1(int xla) {
Modified: jbpm3/branches/jbpm-3.2-soa/modules/identity/src/main/java/org/jbpm/identity/hibernate/IdentitySession.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/identity/src/main/java/org/jbpm/identity/hibernate/IdentitySession.java 2009-07-30 18:57:16 UTC (rev 5396)
+++ jbpm3/branches/jbpm-3.2-soa/modules/identity/src/main/java/org/jbpm/identity/hibernate/IdentitySession.java 2009-07-30 19:25:26 UTC (rev 5397)
@@ -26,10 +26,13 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.HibernateException;
-import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
-import org.jbpm.db.JbpmSession;
+import org.hibernate.criterion.Projections;
+import org.hibernate.criterion.Restrictions;
+
+import org.jbpm.JbpmContext;
+import org.jbpm.JbpmException;
import org.jbpm.identity.Entity;
import org.jbpm.identity.Group;
import org.jbpm.identity.Membership;
@@ -37,127 +40,103 @@
import org.jbpm.identity.assignment.ExpressionSession;
import org.jbpm.identity.security.IdentityService;
-public class IdentitySession implements IdentityService, ExpressionSession
-{
+public class IdentitySession implements IdentityService, ExpressionSession {
+
private static final Log log = LogFactory.getLog(IdentitySession.class);
Session session;
private Transaction transaction;
- public IdentitySession(Session session)
- {
+ public IdentitySession(Session session) {
this.session = session;
}
- public IdentitySession()
- {
- JbpmSession currentJbpmSession = JbpmSession.getCurrentJbpmSession();
- if ((currentJbpmSession == null) || (currentJbpmSession.getSession() == null) || (!currentJbpmSession.getSession().isOpen()))
- {
- throw new RuntimeException("no active JbpmSession to create an identity session");
- }
- session = currentJbpmSession.getSession();
+ public IdentitySession() {
+ JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
+ if (jbpmContext == null) throw new RuntimeException("no active jbpm context");
+
+ session = jbpmContext.getSession();
+ if (session == null) throw new JbpmException("no active hibernate session");
}
// IdentityService methods //////////////////////////////////////////////////
- public Object verify(String userName, String pwd)
- {
- Object userId = null;
- Query query = session.createQuery("select user.id " + "from org.jbpm.identity.User as user where user.name = :userName and user.password = :password");
- query.setString("userName", userName);
- query.setString("password", pwd);
- userId = (Long)query.uniqueResult();
- return userId;
+ public Object verify(String userName, String pwd) {
+ return session.createCriteria(User.class)
+ .setProjection(Projections.property("id"))
+ .add(Restrictions.eq("name", userName))
+ .add(Restrictions.eq("password", pwd))
+ .uniqueResult();
}
- public User getUserById(Object userId)
- {
- return (User)session.load(User.class, (Long)userId);
+ public User getUserById(Object userId) {
+ return (User) session.load(User.class, (Long) userId);
}
// transaction convenience methods //////////////////////////////////////////
- public Session getSession()
- {
+ public Session getSession() {
return session;
}
- public Transaction getTransaction()
- {
+ public Transaction getTransaction() {
return transaction;
}
- public void beginTransaction()
- {
- try
- {
+ public void beginTransaction() {
+ try {
transaction = session.beginTransaction();
}
- catch (HibernateException e)
- {
+ catch (HibernateException e) {
log.error(e);
throw new RuntimeException("couldn't begin a transaction", e);
}
}
- public void commitTransaction()
- {
- if (transaction == null)
- {
+ public void commitTransaction() {
+ if (transaction == null) {
throw new RuntimeException("can't commit : no transaction started");
}
- try
- {
+ try {
session.flush();
transaction.commit();
}
- catch (HibernateException e)
- {
+ catch (HibernateException e) {
log.error(e);
throw new RuntimeException("couldn't commit transaction", e);
}
transaction = null;
}
- public void rollbackTransaction()
- {
- if (transaction == null)
- {
+ public void rollbackTransaction() {
+ if (transaction == null) {
throw new RuntimeException("can't rollback : no transaction started");
}
- try
- {
+ try {
transaction.rollback();
}
- catch (HibernateException e)
- {
+ catch (HibernateException e) {
log.error(e);
throw new RuntimeException("couldn't rollback transaction", e);
}
transaction = null;
}
- public void commitTransactionAndClose()
- {
+ public void commitTransactionAndClose() {
commitTransaction();
close();
}
- public void rollbackTransactionAndClose()
- {
+ public void rollbackTransactionAndClose() {
rollbackTransaction();
close();
}
- public void close()
- {
- try
- {
+ public void close() {
+ try {
session.close();
}
- catch (HibernateException e)
- {
+ catch (HibernateException e) {
log.error(e);
throw new RuntimeException("couldn't close the hibernate connection", e);
}
@@ -165,94 +144,69 @@
// identity methods /////////////////////////////////////////////////////////
- public void saveUser(User user)
- {
+ public void saveUser(User user) {
session.save(user);
}
- public void saveGroup(Group group)
- {
+ public void saveGroup(Group group) {
session.save(group);
}
- public void saveEntity(Entity entity)
- {
+ public void saveEntity(Entity entity) {
session.save(entity);
}
- public void saveMembership(Membership membership)
- {
+ public void saveMembership(Membership membership) {
session.save(membership);
}
- public User loadUser(long userId)
- {
- return (User)session.load(User.class, new Long(userId));
+ public User loadUser(long userId) {
+ return (User) session.load(User.class, new Long(userId));
}
- public Group loadGroup(long groupId)
- {
- return (Group)session.load(Group.class, new Long(groupId));
+ public Group loadGroup(long groupId) {
+ return (Group) session.load(Group.class, new Long(groupId));
}
- public void deleteGroup(Group group)
- {
+ public void deleteGroup(Group group) {
session.delete(group);
}
-
- public void deleteUser(User user)
- {
+
+ public void deleteUser(User user) {
session.delete(user);
}
-
- public User getUserByName(String userName)
- {
- User user = null;
- Query query = session.createQuery("select u " + "from org.jbpm.identity.User as u " + "where u.name = :userName");
- query.setString("userName", userName);
- List users = query.list();
- if ((users != null) && (users.size() > 0))
- {
- user = (User)users.get(0);
- }
- return user;
+
+ public User getUserByName(String userName) {
+ List users = session.createCriteria(User.class).add(Restrictions.eq("name", userName)).list();
+ return users.isEmpty() ? null : (User) users.get(0);
}
- public Group getGroupByName(String groupName)
- {
- Group group = null;
- Query query = session.createQuery("select g " + "from org.jbpm.identity.Group as g " + "where g.name = :groupName");
- query.setString("groupName", groupName);
- List groups = query.list();
- if ((groups != null) && (groups.size() > 0))
- {
- group = (Group)groups.get(0);
- }
- return group;
+ public Group getGroupByName(String groupName) {
+ List groups = session.createCriteria(Group.class)
+ .add(Restrictions.eq("name", groupName))
+ .list();
+ return groups.isEmpty() ? null : (Group) groups.get(0);
}
- public List getUsers()
- {
- Query query = session.createQuery("select u " + "from org.jbpm.identity.User as u");
- return query.list();
+ public List getUsers() {
+ return session.createCriteria(User.class).list();
}
- public List getGroupNamesByUserAndGroupType(String userName, String groupType)
- {
- Query query = session.createQuery("select membership.group.name from org.jbpm.identity.Membership as membership where membership.user.name = :userName "
- + " and membership.group.type = :groupType");
- query.setString("userName", userName);
- query.setString("groupType", groupType);
- return query.list();
+ public List getGroupNamesByUserAndGroupType(String userName, String groupType) {
+ return session.createCriteria(Membership.class)
+ .createAlias("group", "g")
+ .createAlias("user", "u")
+ .add(Restrictions.eq("u.name", userName))
+ .add(Restrictions.eq("g.type", groupType))
+ .setProjection(Projections.property("g.name"))
+ .list();
}
- public User getUserByGroupAndRole(String groupName, String role)
- {
- User user = null;
- Query query = session.createQuery("select m.user " + "from org.jbpm.identity.Membership as m where m.group.name = :groupName and m.role = :role");
- query.setString("groupName", groupName);
- query.setString("role", role);
- user = (User)query.uniqueResult();
- return user;
+ public User getUserByGroupAndRole(String groupName, String role) {
+ return (User) session.createCriteria(Membership.class)
+ .createAlias("group", "g")
+ .add(Restrictions.eq("role", role))
+ .add(Restrictions.eq("g.name", groupName))
+ .uniqueResult();
}
}
14 years, 9 months
JBoss JBPM SVN: r5396 - jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-07-30 14:57:16 -0400 (Thu, 30 Jul 2009)
New Revision: 5396
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/hibernate.common.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-db2-ds.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-hsqldb-ds.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-mysql-ds.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-oracle-ds.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-postgresql-ds.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-sybase-ds.xml
Log:
[JBPM-2115] remove unnecessary elements from data sources
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/hibernate.common.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/hibernate.common.xml 2009-07-30 18:42:33 UTC (rev 5395)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/hibernate.common.xml 2009-07-30 18:57:16 UTC (rev 5396)
@@ -1,4 +1,3 @@
-
<!-- DataSource properties (begin) ===
<property name="hibernate.connection.datasource">java:comp/env/jdbc/JbpmDataSource</property>
==== DataSource properties (end) -->
@@ -35,4 +34,4 @@
<!-- Additional mappings defined per module go here -->
<mapping resource="hibernate.extra.hbm.xml" />
<mapping resource="hibernate.identity.hbm.xml" />
-
+
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-db2-ds.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-db2-ds.xml 2009-07-30 18:42:33 UTC (rev 5395)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-db2-ds.xml 2009-07-30 18:57:16 UTC (rev 5396)
@@ -21,8 +21,6 @@
<isSameRM-override-value>false</isSameRM-override-value>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->
- <metadata>
- <type-mapping>DB2</type-mapping>
- </metadata>
+ <type-mapping>DB2</type-mapping>
</xa-datasource>
</datasources>
\ No newline at end of file
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-hsqldb-ds.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-hsqldb-ds.xml 2009-07-30 18:42:33 UTC (rev 5395)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-hsqldb-ds.xml 2009-07-30 18:57:16 UTC (rev 5396)
@@ -9,24 +9,21 @@
<user-name>sa</user-name>
<password></password>
- <!-- connection pool parameters -->
- <min-pool-size>1</min-pool-size>
- <max-pool-size>5</max-pool-size>
-
<!-- disable idle connection removal, hsqldb does not reap threads on closed connections -->
<idle-timeout-minutes>0</idle-timeout-minutes>
+ <!-- check all statements are closed when the connection is returned to the pool -->
+ <track-statements />
<!-- hsqldb benefits from prepared statement caching -->
<prepared-statement-cache-size>32</prepared-statement-cache-size>
<!-- corresponding type-mapping in conf/standardjbosscmp-jdbc.xml -->
- <metadata>
- <type-mapping>Hypersonic SQL</type-mapping>
- </metadata>
+ <type-mapping>Hypersonic SQL</type-mapping>
<!-- ensure the datasource is not initialized before the database itself -->
<depends>jboss:service=Hypersonic,database=jbpmDB</depends>
</local-tx-datasource>
+ <!-- for hsqldb accessed from jboss only, in-process (standalone) mode -->
<mbean code="org.jboss.jdbc.HypersonicDatabase" name="jboss:service=Hypersonic,database=jbpmDB">
<attribute name="Database">jbpmDB</attribute>
<attribute name="InProcessMode">true</attribute>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-mysql-ds.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-mysql-ds.xml 2009-07-30 18:42:33 UTC (rev 5395)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-mysql-ds.xml 2009-07-30 18:57:16 UTC (rev 5396)
@@ -25,8 +25,6 @@
</valid-connection-checker-class-name>
<!-- corresponding type-mapping in conf/standardjbosscmp-jdbc.xml -->
- <metadata>
- <type-mapping>mySQL</type-mapping>
- </metadata>
+ <type-mapping>mySQL</type-mapping>
</xa-datasource>
</datasources>
\ No newline at end of file
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-oracle-ds.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-oracle-ds.xml 2009-07-30 18:42:33 UTC (rev 5395)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-oracle-ds.xml 2009-07-30 18:57:16 UTC (rev 5396)
@@ -26,9 +26,7 @@
</valid-connection-checker-class-name>
<!-- corresponding type-mapping in standardjbosscmp-jdbc.xml -->
- <metadata>
- <type-mapping>Oracle9i</type-mapping>
- </metadata>
+ <type-mapping>Oracle9i</type-mapping>
</xa-datasource>
<mbean code="org.jboss.resource.adapter.jdbc.vendor.OracleXAExceptionFormatter"
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-postgresql-ds.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-postgresql-ds.xml 2009-07-30 18:42:33 UTC (rev 5395)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-postgresql-ds.xml 2009-07-30 18:57:16 UTC (rev 5396)
@@ -15,8 +15,6 @@
<track-connection-by-tx />
<!-- corresponding type-mapping in conf/standardjbosscmp-jdbc.xml -->
- <metadata>
- <type-mapping>PostgreSQL 8.0</type-mapping>
- </metadata>
+ <type-mapping>PostgreSQL 8.0</type-mapping>
</xa-datasource>
</datasources>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-sybase-ds.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-sybase-ds.xml 2009-07-30 18:42:33 UTC (rev 5395)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-sybase-ds.xml 2009-07-30 18:57:16 UTC (rev 5396)
@@ -22,8 +22,6 @@
</exception-sorter-class-name>
<!-- corresponding type-mapping in conf/standardjbosscmp-jdbc.xml -->
- <metadata>
- <type-mapping>Sybase</type-mapping>
- </metadata>
+ <type-mapping>Sybase</type-mapping>
</xa-datasource>
</datasources>
14 years, 9 months
JBoss JBPM SVN: r5395 - in jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm: perf and 1 other directory.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-07-30 14:42:33 -0400 (Thu, 30 Jul 2009)
New Revision: 5395
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm983/JBPM983Test.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java
Log:
[JBPM-2115] increase test timeouts
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm983/JBPM983Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm983/JBPM983Test.java 2009-07-30 17:33:24 UTC (rev 5394)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm983/JBPM983Test.java 2009-07-30 18:42:33 UTC (rev 5395)
@@ -147,7 +147,7 @@
}
protected void waitFor(long piId) throws Exception {
- final int endTimeout = 30;
+ final int endTimeout = 60;
long startTime = System.currentTimeMillis();
while (!jbpmContext.loadProcessInstance(piId).hasEnded()) {
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java 2009-07-30 17:33:24 UTC (rev 5394)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java 2009-07-30 18:42:33 UTC (rev 5395)
@@ -40,7 +40,7 @@
private static final int WARMUP_INSTANCES = 100;
private static final int MEASURED_INSTANCES = 1000;
- private static final long TIMEOUT = 5 * 60 * 1000;
+ private static final long TIMEOUT = 2 * 60 * 1000;
private ProcessDefinition processDefinition;
@@ -68,13 +68,13 @@
long secondTime = System.currentTimeMillis();
launchProcessInstances(MEASURED_INSTANCES);
- processJobs((secondTime - firstTime) * MEASURED_INSTANCES / WARMUP_INSTANCES);
+ processJobs((secondTime - firstTime) * (MEASURED_INSTANCES / WARMUP_INSTANCES) + 1);
long duration = System.currentTimeMillis() - secondTime;
NumberFormat format = NumberFormat.getNumberInstance();
format.setMaximumFractionDigits(1);
System.out.println("==> Processed " +
- format.format(1000.0 * MEASURED_INSTANCES / duration) +
+ format.format(1000D * MEASURED_INSTANCES / duration) +
" instances per second <==");
}
14 years, 9 months