前言
學習使用12C
1.新建流程項目
1.0 打開JDV 12c IDE
1.1 點擊 New > Application…
1.2 選擇”BPM Application”
1.3 輸入應用名稱,以“App”爲後綴即可
1.4 next
自定義命名:ProcurementOrderProcess
1.5 Finish
1.6 Asynchronous Service
此時會出現新建流程彈出框,輸入流程名稱,類型選擇“Asynchronous Service”
1.7 點擊“Finish”,流程模型項目創建完成
2.定義流程BO對象
流程圖建好後,依次打開SOA->Schemas目錄,右鍵選擇“New”->”XML Schema”
注:第一次沒有XML Schema選項卡,兩種解決辦法
- 在Schemas目錄上Ctrl+N
- New的時候選擇From Gallery
2.1 選擇XML> XMLSchema>OK
2.3 新建 ProcessType.xsd
2.4 OK>打開 ProcessType.xsd
2.5 拷貝下列文件至processType.xsd
從已有的xsd文件中複製出schema結構到新建的processType.xsd文件中(也可以直接拷貝該xsd文件到Schemas目錄下)
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:fawjf="http://www.fawjf.com"
targetNamespace="http://www.fawjf.com" elementFormDefault="qualified">
<xsd:element name="inputParam" type="fawjf:InputType">
<xsd:annotation>
<xsd:documentation>A sample element</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="outputParam">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="instanceId" type="xsd:string" minOccurs="0"/>
<xsd:element name="resultFlag" type="xsd:string" minOccurs="0"/>
<xsd:element name="errorMsg" type="xsd:string" minOccurs="0"/>
<xsd:element name="outBusinessParam" type="fawjf:BusinessParamType" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="InputType">
<xsd:sequence>
<xsd:element name="processParam" type="fawjf:ProcessParamType" minOccurs="0"/>
<xsd:element name="businessParam" type="fawjf:BusinessParamType" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ProcessParamType">
<xsd:sequence>
<xsd:element name="processTitle" type="xsd:string" minOccurs="0"/>
<xsd:element name="processFormId" type="xsd:string" minOccurs="0"/>
<xsd:element name="processFormUrl" type="xsd:string" minOccurs="0"/>
<xsd:element name="processCreator" type="xsd:string" minOccurs="0"/>
<xsd:element name="processCreatorOrgCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="processParam" type="xsd:string" minOccurs="0"/>
<xsd:element name="processCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="processNextApprover" type="xsd:string" minOccurs="0"/>
<xsd:element name="processBusinessSysCode" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="humanTaskParam" type="fawjf:HumanTaskParamType"/>
<xsd:complexType name="HumanTaskParamType">
<xsd:sequence>
<xsd:element name="formTitle" type="xsd:string"/>
<xsd:element name="formId" type="xsd:string"/>
<xsd:element name="formUrl" type="xsd:string"/>
<xsd:element name="formParam" type="xsd:string"/>
<xsd:element name="formApprover" type="xsd:string"/>
<xsd:element name="formNextApprover" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="BusinessParamType">
<xsd:sequence>
<xsd:element name="customParams" maxOccurs="unbounded">
<xsd:complexType>
<xsd:attribute name="key" type="xsd:string"/>
<xsd:attribute name="value" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
2.6 粘貼完後 Ctrl+S
不保存後續代碼實現不了,建議之後把涉及修改的常按保存 😃
2.7 新建模塊 Data
因爲我新建了一個,所以重名
2.8 新建BO
在展開BPM->Business Componets目錄,選擇Data模塊右鍵新建Business Object
總共需要定義4個BO對象:
- ProcessParamBO:流程通用參數對象,包括流程申主題、請人、申請人部門代碼、表單ID等屬性,基於ProcessType Schema新建;
- InputBO:流程發起參數對象,包括流程通用參數、流程業務參數兩個子對象結構;
- ProcessBusinessParamBO:流程業務參數對象,定義流程特有的參數結構;
- OutputBO:流程返回參數對象,定義流程返回的參數結構;
2.8.1 ProcessParamBO
輸入名字後,點擊放大鏡,選擇模塊,第三列打勾,點擊放大鏡,選擇我們配置的對象
找不到對象就是因爲你沒按保存 😃
OK
新建一個的效果圖
2.8.2 InputBO
之後的照貓畫虎
效果圖
2.8.3 OutputBO
效果圖
2.8.4 ProcessBusinessParamBO 注意這個
2.8.4.1 創建只到第二步
2.8.4.2 OK>新建參數 departmentCode/projectCode
注:創建錯了選中當前行點X
2.9 設置流程發起參數
導航欄雙擊ProcurementOrderProcess
在Start按鈕這右鍵>Properties
點擊“新建“參數圖標,輸入參數名稱,類型選擇瀏覽,在瀏覽窗口選擇”InputBO”對象。
2.9.1 設置數據庫映射 點擊 Date Associations
2.9.2 在Date Object上右鍵 New 創建 proccessParamDO
2.9.3 同理 創建 ProcessBusinessParamDO
2.9.4 連線 processParam
設置輸入參數input下的processParam 對應到流程變量processParamDO上。
2.9.5 processBusinessDO 變量
選中processBusinessDO變量,右鍵選中“XSL Transformation”;
從“Sources”列表中將 Input參數移動到“Selected”中,然後輸入transformation名稱:
OK>效果圖
點OK關閉窗口
2.9.6 打開transformation文件,進行數據關係映射:連線
2.9.7 修改xpath表達式值,在@value前面加入
[@key='departmentCode']
2.10 更新流程實例和獲取審批人
分別拖入兩個DBAdapter服務到Composite中,用於更新流程實例和獲取審批人:
後期熟悉就行 知道個大概會用
祝你幸福
送你一首歌:《She》Elvis Costello 電影《諾丁山》插曲
附圖:《諾丁山》豆瓣7.9 1999