/** * Adds a condition on a transition * * @param expression * the condition. * @return the ProcessBuilder in order to add BPM elements */ public ProcessBuilder addCondition(final String expression) { Misc.checkArgsNotNull(expression); if ("".equals(expression.trim())) { problems.add(new Problem("Condition expression is an empty string.", Problem.SEVERITY_ERROR)); } final Object obj = peek(TransitionDefinitionImpl.class); if (isTransition(obj)) { final TransitionDefinitionImpl transition = (TransitionDefinitionImpl) obj; if (transition.getFromBoundaryEvent() != null) { problems.add(new Problem("Unable to set condition " + expression + " on the exception transition: " + transition.getName(), Problem.SEVERITY_ERROR)); } transition.setCondition(expression); } else { problems.add(new Problem("Unable to set condition " + expression + " on an object of type: " + getClass(obj), Problem.SEVERITY_ERROR)); } return this; }
/** * Adds a condition on a transition * * @param expression * the condition. * @return the ProcessBuilder in order to add BPM elements */ public ProcessBuilder addCondition(final String expression) { Misc.checkArgsNotNull(expression); if ("".equals(expression.trim())) { problems.add(new Problem("Condition expression is an empty string.", Problem.SEVERITY_ERROR)); } final Object obj = peek(TransitionDefinitionImpl.class); if (isTransition(obj)) { final TransitionDefinitionImpl transition = (TransitionDefinitionImpl) obj; if (transition.getFromBoundaryEvent() != null) { problems.add(new Problem("Unable to set condition " + expression + " on the exception transition: " + transition.getName(), Problem.SEVERITY_ERROR)); } transition.setCondition(expression); } else { problems.add(new Problem("Unable to set condition " + expression + " on an object of type: " + getClass(obj), Problem.SEVERITY_ERROR)); } return this; }