Lab material for jBPM
Your airline company, RedEye, is trying to stay relevant in order to complete with some of the bigger organizations. One of the biggest issue you are currently facing is the slow time to market for changes to your first class upgrade process. Several C-level executives have decided that you will need to offer a mechanism for passengers to initiate an attempt at a first class upgrade. However they are still deciding the criteria and steps that will be used to either approve or deny their request. Your mission, if you choose to keep your job, is to implement a webservice that is backed by jBPM for these attempts at first class upgrades. The boss wants to see a simlpe functional example during Phase 1, and then an actual decision taking place in Phase 2. Lastly, during Phase 3 we should allow human intervention (from one of our customer service representatives) that will take a declined request and approve it. Furthermore, after creating the application that will recieve the requests for upgrade you must not undeploy it. This means the changes from Phase 1 to Phase 2 to Phase 3 will need to be done without a redeploy!
- first-class-upgrade : Parent project for dependency management
- first-class-uprgade-app : The WAR that will expose your REST service
- first-class-upgrade-model : This artifact will hold the common classes used by the client and the process diagram
- Get JDK 1.7
- Install Maven
- Install Git
- Install JBoss EAP 6.4
- User: admin
- Pass: abcd1234!
- Install BPMS 6.1.0 into EAP 6.4
- User: bpmsAdmin
- Pass: abcd1234!
- Ensure you can start up, and log into, BPMS 6.1.0
- Download the BPMS 6.1.0 maven repository and unzip it into your local maven cache (default ~/.m2/repository)
- Download the EAP 6.4.0 maven repository and unzip it into your local maven cache (default ~/.m2/repository)
- Clone this project
- Navigate to parent redeye project
- Execute 'mvn clean install' in the first-class-upgrade project
- Update the RestRuntimeEngineProvider class if you did not use admin:abcd1234! for authentication
- Upload first-class-upgrade-model jar to BPMS
- Create OU in BPMS (For the 'RedEye' organization) with default group com.rhc.jbpm.redeye
- Create repo in BPMS (For the 'FirstClass' team)
- Create new project ('First Class Upgrade') with GAV com.rhc.jbpm.redeye:first-class-upgrade-kjar:1.0.0
- Add dependency in first-class-upgrade-kjar on first-class-upgrade-model, save the project
- Set the deployment type to 'PER_REQUEST' in the deployment descriptor, save the project
- Make sure to add the remote class 'com.rhc.jbpm.redeye.model.Person' to the deployment descriptor, save the project
- Create 'FirstClassUpgrade' business process with Start->Script(Log)->End
- Should have a process variable named 'requestor' with type 'com.rhc.jbpm.redeye.model.Person'
- Log task should print out the value of this process variable
- Build and Deploy the first-class-upgrade-kjar.
- Deploy first-class-upgrade-app to EAP and test a request by visiting the context root and inspecting the logs
- Alter your diagram to include an exclusive gateway that will be used to decide whether or not the upgrade request is approved
- Use the expression 'return requestor.getAge() > 30;' for the accept path and the opposite for the deny path
- For the approve case and the deny case include a node that will log the appropriate message
- Upgrade the version of first-class-upgrade-kjar to 1.0.1
- Without undeploying the first-class-upgrade-app, build and deploy the first-class-upgrade-kjar
- Confirm that you can start a new process, and check the logs for the message that was sent to the customer!
- Now you can even remove the 1.0.1 deployment and see how the behavior reverts!
- Add a process variable for 'override', should be Boolean
- Add a human task after the declined logging message
- Set the 'actor' property of the human task equal to 'bpmsAdmin'
- Add 'person' to data inputs with type 'com.rhc.jbpm.redeye.model.Person'
- Add 'override' to data outputs with Boolean type
- Create assignments for person input and override output
- Set the 'Task Name' attribute to 'Manual Override'
- Create task form using graphical modeler
- Add data holder for person to task form
- id: person
- input id: person
- type: com.rhc.jbpm.redeye.model.Person
- Add data holder for override to task form
- id: override
- output id: override
- type: Boolean
- Add fields by origin
- Add the person field (and all properties) to the form
- Add the override field to the form
- Save the task form
- Add a gateway after human task that uses the process variable 'override' to either log a hard decline or go to the approval step
- Save the business process
- Upgrade the project version to 1.0.2 , save, and build & deploy
- Practice manually overriding the request, either by approving or denying
-
Rest interface has been deprecated! Change to embedded jbpm now!
-
Add element under active profile
<repository> <id>guvnor-m2-repo</id> <name>BRMS Repository</name> <url>http://localhost:8080/business-central/maven2/</url> <layout>default</layout> <releases> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </releases> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </repository>
-
Add element to specify authentication information
<server> <id>guvnor-m2-repo</id> <username>admin</username> <password>admin</password> <configuration> <wagonProvider>httpclient</wagonProvider> <httpConfiguration> <all> <usePreemptive>true</usePreemptive> </all> </httpConfiguration> </configuration> </server>
-
Inspect Embedded jBPM code and switch to use it (hint: CDI)
-
Run the app and confirm functionality
-
Does the human task interaction still work? Why (not)?