Skip to main content

JBoss BPM Suite - 拖拉一個人工任務,(偽)長假申請流程 BPM Suite版

BPM Suite 是Red Hat 最新推出的流程產品,應該在2月底會正式推出,為了要去上Workshop 所以就拿現在Beta版上面測試了之前的(偽)請假流程。
基本上jBPM 流程的部分,與前一版大同小異。
(是說,如果我找一天在咖啡店開一堂這個課,有人會想來聽嗎?)

在開始之前,請先確定BPM Suite 是安裝OK的。然後使用者資訊也在Server 上都設定成功登入正常。 在Task Server 上也把你的使用者資訊都放置上去了。
(我已經寫好了,等版本GA了我就可以放上來了,現在還是Beta, 覺得搞不好畫面還會改... )

登入 http://IP:PORT/business-central之下,如果先前還沒有建立群組以及儲存庫,請到
Authoring -> Administration ,之下的 Organizational Units -> Manage Organizational Units, 按下之後左方會出現組織與相關儲存庫的關係圖。 按下 Add.

新增組織名稱,以及owner 名稱.


新增儲存庫 Repositories -> New repository,

輸入儲存庫名稱,



這樣組織與儲存庫就建立好了,現在開始建立專案。
請到Authoring -> Project Authoring


 建立新專案,到New Item 下點選 Project


 輸入專案名稱

 輸入專案相關的細節

以下就是你會看到的結果拉~


 可以開始建立第一個流程拉,到New Item下 ,選擇Business Process



給他一個流程的名字~



稍微等一下,因為瀏覽器要畫出editor,點選綠色的小圓點(Start Event),



你就會看到下圖的圓圓開始,選擇它,這時右邊應該會出現一堆可以按的快速建立鈕,請直接按選方形的那個。
 以此類推,在新建的Task 上點選,出現快速建立鈕時再選一次方形的那個。

我們的流程要有一個條件判斷,所以選取菱形的XOR
判斷的地方,請用滑鼠點選在菱形上,點選正方形的Task,請做兩次,因為有兩個分流



接下來我們的流程就要結束了,所以請在兩個分流出來的Task 後選擇實心的圓形。


建立好之後,請按選第一個正方形的Task, 然後把右邊的Proprties 設定頁拉大一點。
在TaskType 選擇 Script,給他一個Name : Logging




既然是個Logging 的 Script Task, 那就來寫個log 吧,點選下方Extra 的 Script,之後會跳出一個畫面,請在裡面寫上,
System.out.println("Starting Apply PTO Process");

好,上一個Logging 的Task 已經完成了,請把滑鼠游標點在空白畫上,這時右手邊Properties 會變得比較不一樣,因為已經變成Process Level 的屬性了,請點選Variable Definitions, 我們要來設定這個流程收什麼資料。

因為本小姐很想放個長假,所以,我就定義這個流程叫做長假申請好了,使用者輸入名字想請的假期長度,跟是否申請成功



以上流程的屬性也設定好了,接下來,就是設定人工流程,請選擇第二的Task, 然後選擇User。


每個人工流程都要定義自己的Data Input, 有點像是method 的parameter,請選擇DataInput。
對了,快速起見,我先定一這個Task 會丟給自己 (Actors 設定為christina)


設定如下。

除了Data Input 也要設定Data Output,也就是輸出的變數.


然後,要把流程的變數,聯結到剛剛我們做的data input裡,所以請按Assignement. 


設定如下。

最後,也是最重要的一步,給個名字吧。總共有兩個地方,如下圖。


流程的部分到這裡就完成了。接下來因為我想用BRMS 內建的jbpm console 秀畫面,所以,我就點選右上方小圖,它會自動幫我產生畫面。(快爆肝了)

                         

會在左手邊產生兩個FORM,一個是流程一開始的時候,輸入的畫面,與人工任務的畫面。


 按下DayOffView-taskform, 這邊就是直接編輯左邊畫面,很直覺的修改.. 我就不多說了..




別忘了 PTOApplication.ptoflow-taskform 也要改喔~



記得儲存。按下右上方的X 離開畫面,回到流程的畫面,在菱形的XOR的兩條連接出去的線上,分別輸入左邊的內容。



最後,分別做兩個Script Task 印成功失敗的log出來。



記得按下左上方的Save 按鍵Save。回到Project Exploer,到Tools 下面的 Project Editor,

看到PTOApplication,也就是我們這次建立的Project, 請按下左上方的 Save 後,按下Deploy and build.


到Deploy之下,你就會看到Build之後的Project



以上,建置的部分就完成了。

接下來,就是去真使用我們剛剛建立的請假流程了。。
到最上方選擇 Task -> Task Lists, 這時,就會看到剛剛建立的proflow ,請按下最右邊的Action 下的箭頭開始流程。



第一個FORM就出現請你輸入名字跟要請假的天數 (我們剛剛建立的那個),填入資料後按下箭頭,往下一步走。


執行之後,就可以到右手邊的Action 跟View 看目前這個流程的內容拉!



可以看到現在流程跑到哪裡囉~


也可以看到目前流程的變數,也可以修改。


去Task->Task List裡面,請按左邊的箭頭就可以把這個任務分配過來了。


執行任務,決定要不要勾選核准,按下Complete,



就是這樣拉,流程就走完了,也可以看到log



以上。我要睡覺去。

Comments

廖健智 said…
很詳盡的解說~
新手消化中XD

是說妳如果開課都是在台北嗎?

Popular posts from this blog

Red Hat JBoss Fuse/A-MQ - Fuse and A-MQ Version 6.3 GA is released!

Fuse and A-MQ 6.3 GA has just went out. Maybe, you would think this is just only a minor version release why should I care? Hold your thoughts on that! Because they have done a lot of improvements and also added many new features into this release.

Besides various bug fixes and making sure Fuse Fabric is much more stable. There are two major change in this version update:

New Tooling in JBoss Developer Studio (JBDS) 9.1 GA. Newer Apache Camel version – Camel v2.17. I was really impressed by the work put in to make developing Camel application much simpler. First is the installation of tooling itself. Now it has a all-in-one installer so you don't need to worry about which plugins you need to check. See the videos below to see the new "Getting Started" of Fuse 6.3.



And If you notice from the above video, the presentation of camel route in JBDS has also updated. It fixed some of the miss representation of logic and making it easier to read.

Old Camel Route
New Camel Route
On …

Fuse Integration Service - Setup JBDS and create first quickstart application

Before we go and start creating our first application, I want to show you how to setup your JBoss Developer Studio, create a small application from the quickstart example and then running it on Fuse Integration Service.

I am using JBoss Developer Studio version 9, you can find it here.
After download the

jboss-devstudio-9.0.0.GA-installer-eap.jar
double-click it, and start installing with default values.

After successful installation, we will need install the plugins for Fuse, on JBoss Central view, select software update, select enable early access.


And select JBoss Fuse Development for the plugin,


Click on install, and we are all set to go!

First thing first, we want to create a Fuse project to deploy on the base of Fuse Integration Service, which is OpenShift. If you have not installed it, please go back to my previous post for instructions. So on your JBDS, right click and start creating the project. Select new, maven project, if you have installed the plugin correctly, you should …

Red Hat JBoss Fuse - Getting Started with Fuse Integration Service 2.0 Tech preview

I just realized that I did not do a getting started for Fuse Integration Service 2.0 Tech preview before I did the pipeline demo, thanks for those of you who reminded me! :)

To get started with FIS 2.0, for people who has just getting to know the technology, here is how I interpret it. Basically, it's divide into two aspect,

1. Integration development, FIS uses Apache Camel as the core technology that creates, orchestrate, compose microservices into a super lightweight thin integration layer, and become the API provider and service orchestrator through exposing RESTful or messaging service endpoints. And you can choose to either package and run it with Spring-Boot or Karaf.


2. Application Deployment and Management, FIS takes advantages of OpenShift platform, and allows you to separately deploy the micro-integration service among distributed environment, at the same time takes care of the failover, high availability, load balancing and service lookup problem for you.


So, now we know …