03-Service Invocation Adapters

SCA – Service Component Architecture

to be written –

File Adapter

Lets extend the use case where the successfully approved candidates data will be written into DB , those whose applications are rejected would be written into file system . Some of the out of box adapters such as file and database adapter will be used for this purpose

Lets Open composite.xml drag n drop database adapter on the composite ,

Give the name as “Rejected Applications”

Select File Write Operation

/tmp is the output folder , %SEQ% is auto generated sequence id appended to file name

Select the XSD (Admission Process XSD )

Save the Composite . Open the BPM Process , drag n drop the Service component next Is Accepted as shown below, In the Implementation select the File Adapter that we just defined,

You would need to do Data Association to Student Application Data Object,

DataBase Adapter

Similarly to above steps open composite and drag n drop DB Adapter, Establish DB Connection if not already available

please use the below schema to create table after logging in as sys

---------------------------------------------------
login as sys
CREATE USER university IDENTIFIED BY welcome1;
GRANT resource,  connect   to university;
----
login as university
--Step 1-----------------------------
CREATE SEQUENCE "UNIVERSITY"."STUDENTSEQ" MINVALUE 1
MAXVALUE 100000 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE ;
--Step 2----------------------------
CREATE TABLE "UNIVERSITY"."APPLICATIONS"
  (
    "ID"              NUMBER NOT NULL ENABLE,
    "FISTNAME"        VARCHAR2(20 BYTE),
    "LASTNAME"        VARCHAR2(20 BYTE),
    "AGE"             NUMBER,
    "MARKSPERCENT"    NUMBER,
    "RESERVATION"     VARCHAR2(20 BYTE),
    "ANNUALINCOME"    VARCHAR2(20 BYTE),
    "ADMISSIONSTATUS" VARCHAR2(20 BYTE),
    CONSTRAINT "APPLICATIONS_PK" PRIMARY KEY ("ID") USING INDEX
    PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
   TABLESPACE "USERS" ENABLE
  )
--Step 3---------------------------------
CREATE OR REPLACE TRIGGER  "ASSIGN_APPL_ID" BEFORE INSERT ON applications
FOR EACH ROW
BEGIN
 IF :NEW.ID IS NULL OR :NEW.ID < 0 THEN
   SELECT STUDENTSEQ.NEXTVAL
     INTO :NEW.ID
     FROM DUAL;
   END IF;
END;

Note down JNDI name eis/DB/university

Perform Insert Operation

Import Applications table from University Schema

ID is Auto generated based on Schema , rest of the parameters are part of payload from BPM User Initiator Task

Ensure that STUDENTSEQ is selected

Customize Adapter Service by selecting Module name as Data and Name as Selected Applications

Save all,

Now open BPM Process, drag n drop service component after Admin Approval task, select service implementation as the DB Service that we just defined

we would need xml transformation to send input payload into database.

Save All, so thats it we are all set to deploy and run the process

Summary : Student jcooper enters his student application , based on business rules if his percentage is greater than 70% this application is accepted , needs to be approved by Admin officer jstein, after approval the data is written into Database

Alternative flow, if the percentage is less than 70, the student application is rejected by the business rule and his data is written into file system , and his data is stored at /tmp location

<< Prev

Next >>

3 thoughts on “03-Service Invocation Adapters

  1. Small Question I have , after creating DB Adapter how mapping happen between , BPM Object and Database field names . I am not able to see the xml mapping screen after ( Service Call ) DB service call

    • ” we would need xml transformation to send input payload into database “, New XML Transformation file needs to be manually created, you need to drag n drop lines from BPM Object to corresponding DB Fields of the Table.

  2. I have a scenario where I need to read data from database of xmltype (data type)

    Table Structure :

    Create table Ex_Tb (id number(30),emp_data XMLType );
    I can save xml content in database,

    Smaple

    insert into Ex_Tb values( 1, xmltype ( ‘ krishnaerodemale ‘));
    Data inserted .
    My Question :

    1. How to retrive xml attribute and how to map BO ?
    I like to select place and name from xml ,then I have to pass values to BO object .

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s