[JBoss jBPM] - Fork Node Issues
by kannanekanath
Hi,
I have a workflow where I need a fork and one of the paths is readonly. For example, when a student submits a request to a teacher for a leave, he needs to get the task in "Leaves awaiting approval" list, (He cant change anything though). For this we wrote a custom join node, which does the joining, and also terminates all readonly tasks in the parent token (Apologies, for posting a slightly big xml file, but I couldnt make it any simpler to demonstrate my point)
| <task-node name="Student Submits Leave">
| <task name="Create Leave Request" swimlane="student"/>
| <transition name="fork1" to="Fork Leave Request"/>
| </task-node>
|
| <fork name="Fork Leave Request">
| <transition name="Read Only" to="Leaves sent to teacher"/>
| <transition name="Read Write" to="Pending Approval"/>
| </fork>
|
| <task-node name="Leaves sent to teacher">
| <task name="Leave requests sent to teacher" swimlane="student"/>
| <!-- The UI will just show a readonly jsp page-->
| <transition name="" to="JoinStudent"/>
| </task-node>
|
| <task-node name="Pending Approval">
| <task name="Pending Approval" swimlane="teacher"/>
| <!-- Teacher can approve/send to principal-->
| <transition name="" to="JoinStudent"/>
| </task-node>
|
| <custom-join name="JoinStudent"> <!-- This will terminate the read only token -->
| <transition name="" to="Principals Review"/>
| </custom-join>
|
| <task-node name="Principals Review">
| <task name="Principals Review" swimlane="principal"/>
| <!-- Teacher can approve/send to principal-->
| <transition name="" to="Pending Approval"/>
| </task-node>
|
So a principal reviews the request from the teacher, and if he finds it ok, sends again to the principal, so that he can do a final approval (those parts are not shown here)
a) The node ("Pending Approval") has to be exactly the same, whether the request is coming from student for first time, or if it is coming from the principal
b) Now when the first time join is invoked, i am setting token.setAbleToReactivateParent as false meaning the token cannot do a join anymore :), so when the same token is coming back from principal, the workflow stops there.
To avoid this, we added an else clause
| public void execute(ExecutionContext executionContext) {
| Token token = executionContext.getToken();
| if (token.isAbleToReactivateParent()) {
| Token parentToken = token.getParent();
| if (parentToken != null) {
| //go ahead and terminate all sibling tasks
| } else {
| logger.debug("Token[" + token + "] is itself a parent");
| //This is the case of the token coming from principal
| leave(executionContext);
| }
| }
| }
|
I would like to know, if there is someone who has encountered a similar issue, If yes, is there a recommendation for this. I went through the code, in Join class of JBPM and there is no else part there. The essence is that you dont expect a Join call when there is no fork, for me there is a node, which could have come as a result of a fork and in some cases it might not be from a fork (in this case from principals review node)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034872#4034872
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034872
19 years
[JBoss Seam] - JSF rendering of invalid values
by christian.bauer@jboss.com
To debug another problem I need to know how JSF gets component values during RENDER RESPONSE after validation fails. I basically need someone who knows JSF internals :)
Form:
| <h:form id="commentForm">
|
| <s:validateAll>
|
| <s:decorate id="foobarDecorate">
| <div class="entry">
| <div class="label">Entity test string:</div>
| <div class="input">
| <h:inputText tabindex="1" size="40" maxlength="100" required="true"
| id="foobar" value="#{testBean.testEntity.testString}">
| </h:inputText>
| </div>
| </div>
| </s:decorate>
|
| <s:decorate id="bazDecorate">
| <div class="entry">
| <div class="label">Test string:</div>
| <div class="input">
| <h:inputText tabindex="1" size="40" maxlength="100" required="true"
| id="baz" value="#{testBean.testString}">
| </h:inputText>
| </div>
| </div>
| </s:decorate>
|
| </s:validateAll>
|
| <div class="entry">
| <div class="label"> </div>
| <div class="input">
|
| <h:commandLink action="#{testBean.doSomething}"
| styleClass="button"><span class="buttonLabel">Do Something</span></h:commandLink>
|
| </div>
| </div>
|
| </h:form>
|
The backing bean:
| @Name("testBean")
| @Scope(ScopeType.PAGE)
| public class TestBean implements Serializable {
|
| @In(required = false)
| private FacesMessages facesMessages;
|
| private String testString;
|
| public String getTestString() {
| System.out.println("#### GETTING: " + testString);
| return testString;
| }
|
| public void setTestString(String testString) {
| System.out.println("#### SETTING: " + testString);
| this.testString = testString;
| }
|
| private TestEntity testEntity;
|
| public TestEntity getTestEntity() {
| System.out.println("######## GETTING ENTITY INSTANCE");
| return testEntity;
| }
|
| @Create
| public void create() {
| System.out.println("###################### NEW TEST ENTITY");
| testEntity = new TestEntity();
| }
|
| public void doSomething() {
| System.out.println("################ DO SOMETHING ############################");
|
| facesMessages.addFromResourceBundleOrDefault(
| FacesMessage.SEVERITY_ERROR,
| "didSomething", "Hello! This is a message! Current test string is: " + testString + " and in entity it's: " + testEntity.testString );
|
| facesMessages.addToControl(
| "foobar",
| FacesMessage.SEVERITY_ERROR,
| "Message for component!");
|
| }
|
| public static class TestEntity implements Serializable {
|
| @Length(min = 3, max = 255)
| private String testString;
|
| public String getTestString() {
| System.out.println("#### GETTING INSIDE ENTITY: " + testString);
| return testString;
| }
|
| public void setTestString(String testString) {
| System.out.println("#### SETTING INSIDE ENTITY: " + testString);
| this.testString = testString;
| }
| }
|
| }
|
When I enter "a" and "b" into the two form fields, validation for the first field should fail (@Length on the entity class). It does so, and it shows me the form again with "a" and "b" in the fields and the decorated validation error message.
How do the values "a" and "b" get into the form components during RENDER RESPONSE? This is what I see in the logs:
| 07:47:49,321 DEBUG [SeamPhaseListener] before phase: APPLY_REQUEST_VALUES(2)
| ... Nothing interesting ...
| 07:47:49,325 DEBUG [SeamPhaseListener] after phase: APPLY_REQUEST_VALUES(2)
| 07:47:49,325 DEBUG [SeamPhaseListener] before phase: PROCESS_VALIDATIONS(3)
| ... Nothing interesting ...
| 07:47:49,327 DEBUG [RootInterceptor] intercepted: testBean.getTestEntity
| 07:47:49,328 INFO [STDOUT] ######## GETTING ENTITY INSTANCE
| 07:47:49,328 DEBUG [RootInterceptor] intercepted: testBean.getTestEntity
| 07:47:49,329 INFO [STDOUT] ######## GETTING ENTITY INSTANCE
| 07:47:49,333 DEBUG [RootInterceptor] intercepted: testBean.getTestString
| 07:47:49,333 INFO [STDOUT] #### GETTING: null
| 07:47:49,333 DEBUG [SeamPhaseListener] after phase: PROCESS_VALIDATIONS(3)
| 07:47:49,334 DEBUG [AbstractSeamPhaseListener] committing transaction after phase: PROCESS_VALIDATIONS(3)
| 07:47:49,334 DEBUG [SeamPhaseListener] before phase: RENDER_RESPONSE(6)
| ... Nothing interesting ...
| 07:47:49,664 DEBUG [RootInterceptor] intercepted: testBean.getTestEntity
| 07:47:49,665 INFO [STDOUT] ######## GETTING ENTITY INSTANCE
| 07:47:49,665 INFO [STDOUT] #### GETTING INSIDE ENTITY: null
| 07:47:49,690 DEBUG [SeamPhaseListener] after phase: RENDER_RESPONSE(6)
|
So during PROCESS VALIDATIONS, my backing bean getters are being called. Why that is the case I don't know, maybe this is triggered by <s:validateAll> (haven't been able to figure out how this is implemented) or simply the JSF implementation randomly calling my model.
Then validation obviously fails. During RENDER RESPONSE, the two input components are rendered again. They magically get the values "a" and "b" that I entered into the form. From where and how? Obviously not from my model or backing bean, because only one of them calls it's bound getter, and even that returns null.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034864#4034864
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034864
19 years