Thanks to my colleague Cosmin for the pointer.
New features HERE
Wednesday, July 31, 2013
Tuesday, July 30, 2013
#266 BPM Parallel Multi Instance sub processes
Very simple scenario here -
An order with lines is processed. The OrderProcess accepts in an order with its attendant lines. The Fulfillment process is called for each order line. We do not have many order lines, and the processing is simple, so we run this in parallel.
Let's look at the definition of the Multi Instance sub-process -
The Send and Receive Activities will require a Conversation to do the correlation between the 2 processes. This needs to be defined at Sub-process level and NOT AT PROCESS LEVEL. I made this mistake once too often!
Send Activity Definition -
Receive Activity Definition -
Full lab doc HERE
An order with lines is processed. The OrderProcess accepts in an order with its attendant lines. The Fulfillment process is called for each order line. We do not have many order lines, and the processing is simple, so we run this in parallel.
Let's look at the definition of the Multi Instance sub-process -
The Send and Receive Activities will require a Conversation to do the correlation between the 2 processes. This needs to be defined at Sub-process level and NOT AT PROCESS LEVEL. I made this mistake once too often!
Send Activity Definition -
Receive Activity Definition -
Full lab doc HERE
Thursday, July 25, 2013
Friday, July 19, 2013
#264 - BPM 11g PS6 Web Forms not displaying in Process Composer
Web Forms is a great addition to Oracle BPM, however one may hit an issue when testing these in process composer.
Here is a simple example of such a form -
One can then click on the "running man" icon to test the form.
Looks good - if yours doesn't render then check/set the following -
Make sure you set the above to your fully qualified machine name.
make sure this is in your etc/hosts.
Also check the listen address / front end host setting for your WLS server via the WLS console.
This should also be set to your fully qualified machine name
Use your fully qualified machine name when starting process composer in your browser.
e.g. http://mymachine.niall.com:7001/bpm/composer
Here is a simple example of such a form -
One can then click on the "running man" icon to test the form.
Looks good - if yours doesn't render then check/set the following -
Make sure you set the above to your fully qualified machine name.
make sure this is in your etc/hosts.
Also check the listen address / front end host setting for your WLS server via the WLS console.
This should also be set to your fully qualified machine name
Use your fully qualified machine name when starting process composer in your browser.
e.g. http://mymachine.niall.com:7001/bpm/composer
Tuesday, July 16, 2013
Wednesday, July 10, 2013
#262 BPM PS6 partner workshops...
*** For EMEA Oracle BPM Partners ***
please see the post from Juergen Kress here
please see the post from Juergen Kress here
Thursday, July 4, 2013
#261 Short Digression on the Human Task API
Scenario:
I need to update the payload of an order via the API.
My order is very simple -
The User task is called Approve.
All I want to do is add my margin to the price ( * 1.5).
I also append " on special offer " to the product name
Here is the payload before -
after -
Here is the code -
package hwjavaclient;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import oracle.bpel.services.workflow.client.IWorkflowServiceClient;
import oracle.bpel.services.workflow.client.IWorkflowServiceClientConstants;
import oracle.bpel.services.workflow.client.WorkflowServiceClientFactory;
import oracle.bpel.services.workflow.query.ITaskQueryService;
import oracle.bpel.services.workflow.task.ITaskService;
import oracle.bpel.services.workflow.task.model.Task;
import oracle.bpel.services.workflow.verification.IWorkflowContext;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class HwTask {
public HwTask() {
super();
}
public String getTaskdetails(String user) {
Map properties = new HashMap();
properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_PROVIDER_URL,
"t3://localhost:7001");
properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_CREDENTIALS,
"welcome1");
properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_PRINCIPAL,
"weblogic");
try {
//Create JAVA WorflowServiceClient
IWorkflowServiceClient wfSvcClient =
WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.REMOTE_CLIENT,
properties,
null);
//Get the task query service
ITaskQueryService querySvc = wfSvcClient.getTaskQueryService();
//Login as jcooper
IWorkflowContext ctx =
querySvc.authenticate("weblogic", "welcome1".toCharArray(),
null);
System.out.println("CTX " + ctx.getIdentityContext());
//Set up list of columns to query
List queryColumns = new ArrayList();
queryColumns.add("TASKID");
queryColumns.add("TASKNUMBER");
queryColumns.add("TITLE");
queryColumns.add("OUTCOME");
// also get the payload
List optionalInfo = new ArrayList();
optionalInfo.add(ITaskQueryService.OptionalInfo.PAYLOAD);
//
//Query a list of all tasks
List tasks =
querySvc.queryTasks(ctx, queryColumns, optionalInfo, // Payload
ITaskQueryService.AssignmentFilter.ALL, null, //No keywords
null, //No custom predicate
null, //No special ordering
0, //Do not page the query result
0);
//Get the task service
ITaskService taskSvc = wfSvcClient.getTaskService();
//Loop over the tasks, outputting task information, and approving any
//tasks whose outcome has not been set...
System.out.println("*** Nr of tasks " + tasks.size());
for (int i = 0; i < tasks.size(); i++) {
Task task = (Task)tasks.get(i);
int taskNumber = task.getSystemAttributes().getTaskNumber();
String title = task.getTitle();
String outcome = task.getSystemAttributes().getOutcome();
System.out.println("Task #" + taskNumber + " (" + title +
") has the outcome set to " + outcome);
// Extract and update the payload for the approve order task
if (title.equalsIgnoreCase("Approve")) {
// Get TaskDetailsByNumber so as to be able to update the payload
Task task2Update =
querySvc.getTaskDetailsByNumber(ctx, taskNumber);
System.out.println("Getting the Payload...");
Element el = task2Update.getPayloadAsElement();
Element newEl = getPayloadValues(el);
task2Update.setPayloadAsElement(newEl);
taskSvc.updateTask(ctx, task2Update);
}
}
} catch (Exception e) {
//Handle any exceptions raised here...
System.out.println("Caught workflow exception: " + e.getMessage());
}
return "done";
}
public static Element getPayloadValues(Element pElement) {
System.out.println("getPayloadValues() for Payload of type " +
pElement.getFirstChild().getNodeName());
NodeList nl = pElement.getChildNodes();
Node parentNode = nl.item(0);
NodeList nlChildren = parentNode.getChildNodes();
for (int i = 0; i < nlChildren.getLength(); i++) {
Node n = nlChildren.item(i);
String NodeName = n.getNodeName();
if (!NodeName.equalsIgnoreCase("#text")) {
Element myElement = (Element)nlChildren.item(i);
NodeList nlElement = myElement.getChildNodes();
String elName = n.getNodeName();
String elValue = nlElement.item(0).getNodeValue();
System.out.println("Element is " + elName +
" with a value of " + elValue);
if (elName.equalsIgnoreCase("ns2:product")) {
System.out.println("Updating product name to add special offer tag...");
nlElement.item(0).setNodeValue(elValue +
" on special offer");
}
if (elName.equalsIgnoreCase("ns2:price")) {
System.out.println("Updating price to add a decent margin...");
Double price = new Double(elValue);
price = price * 1.5;
String newPrice = price.toString();
nlElement.item(0).setNodeValue(newPrice);
}
}
}
return pElement;
}
}
I need to update the payload of an order via the API.
My order is very simple -
The User task is called Approve.
All I want to do is add my margin to the price ( * 1.5).
I also append " on special offer " to the product name
Here is the payload before -
after -
Here is the code -
package hwjavaclient;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import oracle.bpel.services.workflow.client.IWorkflowServiceClient;
import oracle.bpel.services.workflow.client.IWorkflowServiceClientConstants;
import oracle.bpel.services.workflow.client.WorkflowServiceClientFactory;
import oracle.bpel.services.workflow.query.ITaskQueryService;
import oracle.bpel.services.workflow.task.ITaskService;
import oracle.bpel.services.workflow.task.model.Task;
import oracle.bpel.services.workflow.verification.IWorkflowContext;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class HwTask {
public HwTask() {
super();
}
public String getTaskdetails(String user) {
Map properties = new HashMap();
properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_PROVIDER_URL,
"t3://localhost:7001");
properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_CREDENTIALS,
"welcome1");
properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_PRINCIPAL,
"weblogic");
try {
//Create JAVA WorflowServiceClient
IWorkflowServiceClient wfSvcClient =
WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.REMOTE_CLIENT,
properties,
null);
//Get the task query service
ITaskQueryService querySvc = wfSvcClient.getTaskQueryService();
//Login as jcooper
IWorkflowContext ctx =
querySvc.authenticate("weblogic", "welcome1".toCharArray(),
null);
System.out.println("CTX " + ctx.getIdentityContext());
//Set up list of columns to query
List queryColumns = new ArrayList();
queryColumns.add("TASKID");
queryColumns.add("TASKNUMBER");
queryColumns.add("TITLE");
queryColumns.add("OUTCOME");
// also get the payload
List optionalInfo = new ArrayList();
optionalInfo.add(ITaskQueryService.OptionalInfo.PAYLOAD);
//
//Query a list of all tasks
List tasks =
querySvc.queryTasks(ctx, queryColumns, optionalInfo, // Payload
ITaskQueryService.AssignmentFilter.ALL, null, //No keywords
null, //No custom predicate
null, //No special ordering
0, //Do not page the query result
0);
//Get the task service
ITaskService taskSvc = wfSvcClient.getTaskService();
//Loop over the tasks, outputting task information, and approving any
//tasks whose outcome has not been set...
System.out.println("*** Nr of tasks " + tasks.size());
for (int i = 0; i < tasks.size(); i++) {
Task task = (Task)tasks.get(i);
int taskNumber = task.getSystemAttributes().getTaskNumber();
String title = task.getTitle();
String outcome = task.getSystemAttributes().getOutcome();
System.out.println("Task #" + taskNumber + " (" + title +
") has the outcome set to " + outcome);
// Extract and update the payload for the approve order task
if (title.equalsIgnoreCase("Approve")) {
// Get TaskDetailsByNumber so as to be able to update the payload
Task task2Update =
querySvc.getTaskDetailsByNumber(ctx, taskNumber);
System.out.println("Getting the Payload...");
Element el = task2Update.getPayloadAsElement();
Element newEl = getPayloadValues(el);
task2Update.setPayloadAsElement(newEl);
taskSvc.updateTask(ctx, task2Update);
}
}
} catch (Exception e) {
//Handle any exceptions raised here...
System.out.println("Caught workflow exception: " + e.getMessage());
}
return "done";
}
public static Element getPayloadValues(Element pElement) {
System.out.println("getPayloadValues() for Payload of type " +
pElement.getFirstChild().getNodeName());
NodeList nl = pElement.getChildNodes();
Node parentNode = nl.item(0);
NodeList nlChildren = parentNode.getChildNodes();
for (int i = 0; i < nlChildren.getLength(); i++) {
Node n = nlChildren.item(i);
String NodeName = n.getNodeName();
if (!NodeName.equalsIgnoreCase("#text")) {
Element myElement = (Element)nlChildren.item(i);
NodeList nlElement = myElement.getChildNodes();
String elName = n.getNodeName();
String elValue = nlElement.item(0).getNodeValue();
System.out.println("Element is " + elName +
" with a value of " + elValue);
if (elName.equalsIgnoreCase("ns2:product")) {
System.out.println("Updating product name to add special offer tag...");
nlElement.item(0).setNodeValue(elValue +
" on special offer");
}
if (elName.equalsIgnoreCase("ns2:price")) {
System.out.println("Updating price to add a decent margin...");
Double price = new Double(elValue);
price = price * 1.5;
String newPrice = price.toString();
nlElement.item(0).setNodeValue(newPrice);
}
}
}
return pElement;
}
}
Subscribe to:
Posts (Atom)
