OK Here it goes
The system I am prototyping is as follows.
Within an insurance company, a client(member) has asked for an increase of
cover. In this case, the request has come through in the format of an
application form.
This application form is scanned and starts a process definition.
@CreateProcess(definition="DocumentLoader")
| @IfInvalid(outcome=REDISPLAY)
| public String scannedLoaderIn() {
| try{
| log.info("Document loaded");
| documentLocation="sample.pdf"; //The document
| return "complete";
| }catch(Exception e){
| log.info(e.getMessage());
| }
| return null;
| }
A decision node is then executed to determine if the image should be attached
to an existing case or if a new case needs to be established.
<decision name="CoverExists" expression="#{Exists.checkCoverExists}">
| <transition name="NoCoverExists" to="CheckOut">
| <action expression="#{coverTasks.createCover}"/>
| </transition>
| <transition name="AtleastOneCoverExists"
to="SelectCover"></transition>
| </decision>
|
if no cover exists then the method createCover is executed. This in essence
creates a default cover and transition is sent to the next Task Node.
If a cover exists, then the user is expected to select from a list of existing
covers.
<task-node name="SelectCover">
| <task name="choose" description="Multiple Open Covers">
| <assignment pooled-actors="user"/>
| </task>
| <transition name="cancel" to="SelectCover"/>
| <transition name="CoverSelected" to="CheckOut"></transition>
| <transition name="NewCover" to="CheckOut">
| <action expression="#{fileTasks.createFile}"/>
| </transition>
| </task-node>
In this instance however, instead of the user needing to select the work item
from the pooled Instance list, the user should be able to continue with the
same work item. ie: transition to this task automatically instead of having to
select it again.
The code for this transition looks like this
| @EndTask(transition="FileSelected")
| @IfInvalid(outcome="multipleFiles")
| public String select(){
| if(fileId==null || fileId==0)
| return null;
|
| try{
| log.info("FileId: "+ fileId);
| //This is where we can attach the Document to the Cover
| Document document = new
Document(em.find(Cover.class,fileId),user,(DocumentType)em.find(DocumentType.class,documentTypeId));
| document.setComment("Added to Cover");
| document.setFileObject(documentLocation);
| em.persist(document);
| em.flush();
| log.info("Document Saved and Flushed");
| }catch(Exception ex){
| log.info("Failed to save Document: "+ ex.getMessage());
| }
| return "cover";
| }
Once the selection is done, the transition moves to the next task called
CheckOut. Note this is the same task as that called when there is no cover.
This then appears in the specified work lists as determined by the
pooledTaskInstanceList.
as you can see above, the document(image) is simply added to the selected
cover. The EndTask is to mark the transition to the next task.
The return "cover" displays the cover item page. I would like the user to
manipulate this cover within a task, especially since they may exit there
session before processing and starting a new task.
What I thought I could use is the annotation @Begintask at the top of the
method but this obviously fails.
One way I thought this could be achieved is by using BeginTask with a parameter
to signify starting the task after a succesful EndTask transition
hope this makes sense
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3924128#3924128
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3924128
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user