使用OSWorkflow提供的Query API[轉史蒂芬筆記]

來源:互聯網
上載者:User
要使用OSWorkflow提供的Query API,先繼承AbstractWorkflow,透過AbstractWorkflow裡的getPersistence method 可連接資料做查詢,其餘的語法參考程式即可知道,這裡針對幾點做說明:
  • WorkflowExpressionQuery參數
    這個類別建立時所需的四個參數,第二個對應到資料庫的Table如下所示,第一個則對應到Table中的欄位,欄位如何對應由名稱應可明瞭,不另作說明。
    常數 Table
    FieldExpression.ENTRY OS_WFENTRY
    FieldExpression.CURRENT_STEPS OS_CURRENTSTEP
    FieldExpression.HISTORY_STEPS OS_HISTORYSTEP

    第三個參數為運算元,只有四種如下:

    運算元 說明
    FieldExpression.EQUALS 等於
    FieldExpression.NOT_EQUALS 不等於
    FieldExpression.GT 大於
    FieldExpression.LT 小於

  • 巢狀運算
    如果要比較的不只一個欄位,就需要用到巢狀運算,使用class NestedExpression,底下是一個官方檔案的範例:
    // Get all finished workflow entries 
    //where the current owner is 'testuser'
    Expression queryLeft = new FieldExpression(
    FieldExpression.OWNER,
    FieldExpression.CURRENT_STEPS,
    FieldExpression.EQUALS, 'testuser');
    Expression queryRight = new FieldExpression(
    FieldExpression.STATUS,
    FieldExpression.CURRENT_STEPS,
    FieldExpression.EQUALS,
    "Finished",
    true);
    WorkflowExpressionQuery query =
    new WorkflowExpressionQuery(
    new NestedExpression(
    new Expression[] {queryLeft, queryRight},
    NestedExpression.AND));

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.