[jboss-user] [JBoss jBPM] - Getting first non exception transition

jorgemoralespou_2 do-not-reply at jboss.com
Wed Nov 28 07:38:11 EST 2007


Hi,
We have an ActionHandler where we want to Transition to take the first possible transition that is not an Exception Path, this is, is not one of the possible transitions taken by an ExceptionHandler`s actions.
We have this code now:


  | 	private String getOutputTransition(ExecutionContext context)
  | 			throws ActionHandlerConfigurationException {
  | 		List<ExceptionHandler> exceptionsH = context.getToken().getNode()
  | 				.getExceptionHandlers();
  | 		
  | 		Node node = context.getToken().getNode();
  | 		exceptionNodes = new ArrayList<String>();
  | 		outputTransitions = node.getLeavingTransitions();
  | 		if (exceptionsH != null) {
  | 			for (ExceptionHandler eh : exceptionsH) {
  | 				Action action = (Action) eh.getActions().iterator().next();
  | 				if (action != null) {
  | 					if (action.getActionDelegation().getClassName().equals("x.ba.MiExceptionHandler")) {
  | 						String tr = StringUtils.substringBetween(action
  | 								.getActionDelegation().getConfiguration(),
  | 								"<exceptionPathTransition>",
  | 								"</exceptionPathTransition>");
  | 						exceptionNodes.add(node.getLeavingTransition(tr)
  | 								.getTo().getName());
  | 					}
  | 				}
  | 			}
  | 		}
  | 		if (exceptionNodes.size() == 0) {
  | 			return null;
  | 		} else {
  | 			for (Transition t : outputTransitions) {
  | 				if (!exceptionNodes.contains(t.getTo().getName())) {
  | 					return t.getName();
  | 				}
  | 			}
  | 		}
  | 		throw new ActionHandlerConfigurationException(
  | 				"All next transitions exceptions. Set a normal path");
  | 	}
  | 

This code is working, but it takes long time to execute, compared with the rest of our ActionHandlers things.

Is there a way to achieve same result, and not having to use Configuration class?

Thanks.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108433#4108433

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108433



More information about the jboss-user mailing list