Monday, December 30, 2013

#297 BAM and BPM Part 3

In this post, I add a rule to BAM to automatically re-order iPads, when the inventory is less than 10.

To begin with I create a web service to mimic the re-ordering.

I create the following class in JDeveloper and expose as a web service.














I deploy to my SOA AdminServer and test






















Note the wsdl -
http://localhost:7001/OrderProcessingService/OrderProcessingPort?WSDL

Now open BAM in Architect mode, add a new data objetc - LowInventory with one field - Product.

Now open BAM in Active Studio mode, open the report  -

Edit -







Double click on the Action List and click Change Report Properties










Add a new Action








































Edit the mapping - setting product in LowInventory to the value of Product from the ActionList.


























Save the report and run in Active Viewer










Check the lowInventory Data Object

It has one row -













Now we add a rule to call the web service when this happens.

































































Configure the Web Service
















re-test

I enter an order for 5 iPads.
I approve the order.

I select the order and click Re-order Product in the BAM report







I check the WLS console for the web service output.






#296 BAM and BPM Part 2

In this post I create some dashboards for the BPM process.

I begin by adding a new data object  - MyOrder - to BAM.
This will contain the following info -
Customer name, Product, Quantity and order value (unit price * quantity)

Open BAM and click on the Architect button
Create a new sub folder and then a new data object in there
































Create a new data object based on the Inventories DB table







































Now go to JDev and augment the project with a BAM adapter.



























































Add a Service Task (UpdateBAM) to the process to leverage the BAM adapter.
Data Associations as follows -























Deploy and Test















Approve the order for Hans and review the trail in EM












No back to BAM - Click the active studio link to create a new report based on our 2
data objects










Choose the 2nd template -2 tiles











Tile 1 - Action List - based on MyOrders Data object
Tile 2 - Bar Chart - based on MyInventory data object


Click on the Active Viewer button in BAM and select the report we just created




























execute the process again for a different customer




























In the next post, I will create a rule to auto-reorder iPads once there are less than 10 in stock

#295 BAM and BPM part 1

In this post I cover the use of BAM OOTB for BPM process analysis.

I have the following simple process that processes an Order -

















Here are the DB tables accessed in the process -













Here is the process -











Here is the composite -


















I deploy and test and verify that all is working.

Now I start the BAM server.
For this post, I will be leveraging the Sample Monitor Express components.
These need to be installed. Follow the README.txt at -










Now we need to do the BAM adapter setup in the WLS console -



Open the BPM project preferences -




















Change as follows -

















Login to BAM - http://localhost:9001/OracleBAM/














Start a couple of instances of the process via EM -












Click on the BAM - Active Viewer button

Click - Select Report















































Now let's add a counter to the process - to count the number of approval rejections.












































re-deploy and create some new instances.
Reject one of them








In BAM, click on Process View and select the process















We see the current value of our counter

Saturday, December 28, 2013

#294 Oracle SOA Governance 11g Implementation

The Book

At last over the holiday period I have gotten the opportunity to delve into this worthy tome. This book is excellent in it's coverage of design- and runtime governance. The example business case used for the book's case study is easy to follow. The authors begin by conducting a SOA Maturity Assessment for the fictional company and detail an appropriate reference architecture for them.

Chapter 3 covers Oracle Enterprise Repository - Oracle's flagship product for design time governance. This chapter gives an indepth account of OER architecture. This chapter also covers value-adds such as the solution packs available for OER.

Chapter 4 covers configuring OER for our case study - Service Discovery and Cataloging etc.

Chapter 5 discusses the harvester which allows one to bootstrap OER with existing assets, for example - there is a excellent section covering the OSB harvester. Once harvested - OER then allows us to visualize asset relationships - for me one of the most important features of the product.

Chapter 6 deals with Asset Lifecycle and Workflow - this part contains a valuable section on implementing architecture blueprints - thus defining expected deliverables and enforcing compliance.

Chapter 7 covers Oracle Service Registry (OSR) - Oracle's UDDI implementation. This section also covers the relationship between OSR and OER. OER - desgin time - OSR - runtime. It also covers the OER exchange utility which enables OER / OSR synchronisation. The chapter discusses the usual UDDI concepts in the context of OSR - UDDI Taxanomies, tModel etc. A good refresher!

Chapter 8 covers Design Time Service Promotion and Discovery - essentially applying what we learned in the previous chapter to our use case. This chapter discusses such technical details as automatic workflows for publishing to OSR etc. Again a great feature of this book - the right mix of WHY and HOW.

Chapter 9 brings us to runtime governance - including how to use Oracle Web Services Manager (WSM) to implement security policies as well as monitoring via Enterprise Manager.

Chapter 10 discusses extending runtime governance via EM and BTM (Business Transaction Management)- for infrastructure monitoring. BTM is not a core part of SOA Suite, however it fits very nicely into the mix here as the authors mention.

Chapter 11 covers extending governance with AIA foundation pack - especially interesting in the realm of MDM.

All in all, the book itself is a great asset - with the right mix of answers to to the What, Why and How of SOA Governance. Chapeau Luis and Andrew!

Again the Book

Tuesday, December 17, 2013

Tuesday, December 10, 2013

#292 BPM 11g Human Task - Reassignment via API

Simple scenario:













Task is assigned to CSR role - jcooper is a member.

Create a test instance.
Validate in workspace.



Now I will reassign this task to wshake.















The actual Java API code is as follows -

    public String reassignTask(String taskName, String currentOwner,
                               String newOwner) {
        System.out.println("*** reassignTask() " + taskName + " from " +
                           currentOwner + " to " + newOwner);
        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(currentOwner, "welcome1".toCharArray(),
                                      null);
            //Set up list of columns to query
            List queryColumns = new ArrayList();
            queryColumns.add("TASKID");
            queryColumns.add("TASKNUMBER");
            queryColumns.add("TITLE");
            queryColumns.add("OUTCOME");

            Predicate pred =
                new Predicate(TableConstants.WFTASK_TITLE_COLUMN, Predicate.OP_EQ,
                              taskName);

            //Query a list of tasks assigned to jcooper
            List tasks =
                querySvc.queryTasks(ctx, queryColumns, null, //Do not query additional info
                    ITaskQueryService.AssignmentFilter.ALL, null, //No keywords
                    pred, //Custom predicate
                    null, //No special ordering
                    0, //Do not page the query result
                    0);
            //Get the task service
            ITaskService taskSvc = wfSvcClient.getTaskService();

            // create the newAssignee list - in our case only newOwner
            List assigneeList = new ArrayList();

            ITaskAssignee assignee = new TaskAssignee(newOwner, "user");
            assigneeList.add(assignee);
            //


            for (int i = 0; i < tasks.size(); i++) {
                Task task = (Task)tasks.get(i);
                int taskNumber = task.getSystemAttributes().getTaskNumber();
                String title = task.getTitle();
                String taskId = task.getSystemAttributes().getTaskId();
                String outcome = task.getSystemAttributes().getOutcome();
                List taskAssigneeList =
                    task.getSystemAttributes().getAssigneeUsers();
                System.out.println("Found task " + title + " taskId is " +
                                   taskId);

                // do the Reassignment
                for (int j = 0; j < taskAssigneeList.size(); j++) {
                    IdentityType type = (IdentityType)taskAssigneeList.get(j);
                    String name = type.getId();
                    System.out.println("Currently assigned to " + name);
                }
                int taskNr = task.getSystemAttributes().getTaskNumber();

                if (title != null && title.equalsIgnoreCase(taskName)) {
                    System.out.println("Starting reassignment...");
                    Task task4Reassign =
                        querySvc.getTaskDetailsById(ctx, taskId);
                    System.out.println("Task title " +
                                       task4Reassign.getTitle());
                    System.out.println("Reassigning task to " + newOwner +
                                       " for taskNr " + taskNr);
                    taskSvc.reassignTask(ctx, task4Reassign, assigneeList);
                }


            }
        } catch (Exception e) {
            //Handle any exceptions raised here...
            System.out.println("Caught workflow exception: " + e.getMessage());
        }

        return "done";
    }

Run -










login to workspace as wshake









Java project available here