<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    少年阿賓

    那些青春的歲月

      BlogJava :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
      500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks
    osworkflow.xml
    <osworkflow>
     <persistence class="com.opensymphony.workflow.spi.memory.MemoryWorkflowStore" />
     <factory class="com.opensymphony.workflow.loader.XMLWorkflowFactory">
      <property key="resource" value="workflows.xml" />
     </factory>
    </osworkflow>


    workflows.xml
    <workflows>
      <workflow name="docworkflow" type="resource" location="myworkflow.xml"/>
    </workflows>


    myworkflow.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE workflow PUBLIC "-//OpenSymphony Group//DTD OSWorkflow 2.6//EN" "<workflow>
     <registers>
      <register type="class" variable-name="log">
       <arg name="class.name">com.opensymphony.workflow.util.LogRegister</arg>
       <arg name="addInstanceId">true</arg>
      </register>
     </registers>

     <initial-actions>
      <action id="100" name="Start Ordinary Workflow">
       <results>
        <unconditional-result old-status="Finished"
         status="Queued" step="1" />
       </results>
      </action>
      <action id="200" name="Start Emergent Workflow">
       <results>
        <unconditional-result old-status="Finished"
         status="Queued" step="5" />
       </results>
      </action>
     </initial-actions>

     <steps>

      <step id="1" name="Initiate Doc">
       <actions>
        <action id="1" name="Initial Work">
         <restrict-to>
          <conditions>
           <condition type="class">
            <arg name="class.name">
             com.opensymphony.workflow.util.StatusCondition
            </arg>
            <arg name="status">Queued</arg>
           </condition>
          </conditions>
         </restrict-to>
         <validators>
          <validator type="class">
           <arg name="class.name">
            org.abin.lee.validator.TitleValidator
           </arg>
          </validator>
         </validators>
         <pre-functions>
          <function type="class">
           <arg name="class.name">
            com.opensymphony.workflow.util.Caller
           </arg>
           <arg name="stepId">1</arg>
          </function>
          <function type="beanshell">
           <arg name="script">
            transientVars.get("log").info("Initiate Work");
           </arg>
          </function>
         </pre-functions>
         <results>
          <unconditional-result old-status="Finished"
           status="Prepared" step="1" owner="${caller}" />
         </results>
         <post-functions>
          <function type="beanshell">
           <arg name="script">
            propertySet.setString("title",
            (String)transientVars.get("title"));
           </arg>
          </function>
         </post-functions>
        </action>
        <action id="2" name="Deliver Work">
         <restrict-to>
          <conditions type="AND">
           <condition type="class">
            <arg name="class.name">
             com.opensymphony.workflow.util.StatusCondition
            </arg>
            <arg name="status">Prepared</arg>
            <arg name="stepId">1</arg>
           </condition>
           <condition type="class">
            <arg name="class.name">
             com.opensymphony.workflow.util.AllowOwnerOnlyCondition
            </arg>
           </condition>
          </conditions>
         </restrict-to>
         <pre-functions>
          <function type="beanshell">
           <arg name="script">
            transientVars.get("log").info("Deliver Doc to Boss A and B");
           </arg>
          </function>
         </pre-functions>
         <results>
          <unconditional-result old-status="Finished"
           status="Prepared" split="1" />
         </results>
        </action>
       </actions>
      </step>

      <step id="2" name="Review Doc In Boss A">
       <external-permissions>
        <permission name="permA">
         <restrict-to>
          <conditions type="AND">
           <condition name="check.status" type="class">
            <arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
            <arg name="status">Prepared</arg>
           </condition>
           <condition name="allow.owner.only" type="class">
            <arg name="class.name">com.opensymphony.workflow.util.AllowOwnerOnlyCondition</arg>
           </condition>
          </conditions>
         </restrict-to>
        </permission>
       </external-permissions>
       <actions>
        <action id="3" name="Review Work By A">
         <pre-functions>
          <function type="beanshell">
           <arg name="script">
            transientVars.get("log").info("Doc Reviewed By Boss A")
           </arg>
          </function>
         </pre-functions>
         <results>
          <unconditional-result old-status="Finished"
           status="Underway" join="1" />
         </results>
        </action>
       </actions>
      </step>

      <step id="3" name="Review Doc In Boss B">
       <external-permissions>
        <permission name="permA">
         <restrict-to>
          <conditions type="AND">
           <condition name="check.status" type="class">
            <arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
            <arg name="status">Prepared</arg>
           </condition>
           <condition name="allow.owner.only" type="class">
            <arg name="class.name">com.opensymphony.workflow.util.AllowOwnerOnlyCondition</arg>
           </condition>
          </conditions>
         </restrict-to>
        </permission>
       </external-permissions>
       <actions>
        <action id="4" name="Review Work By B">
         <pre-functions>
          <function type="beanshell">
           <arg name="script">
            transientVars.get("log").info("Doc Reviewed By Boss B")
           </arg>
          </function>
         </pre-functions>
         <results>
          <unconditional-result old-status="Finished"
           status="Underway" join="1" />
         </results>
        </action>
       </actions>
      </step>

      <step id="4" name="Finish Ordinary Work">
       <pre-functions>
        <function type="beanshell">
         <arg name="script">
          System.out.println("Finish Doc Review. \nTitle:"+propertySet.getString("title")+".");
         </arg>
        </function>
       </pre-functions>
      </step>

      <step id="5" name="Finish Emergent Work">
       <pre-functions>
        <function type="beanshell">
         <arg name="script">
          System.out.println("Emergency Handler");
         </arg>
        </function>
       </pre-functions>
      </step>

     </steps>

     <splits>
      <split id="1">
       <unconditional-result old-status="Finished"
        status="Prepared" step="2" />
       <unconditional-result old-status="Finished"
        status="Prepared" step="3" />
      </split>
     </splits>

     <joins>
      <join id="1">
       <conditions type="AND">
        <condition type="beanshell">
         <arg name="script"><![CDATA[ "Finished".equals(jn.getStep(2).getStatus()) && "Finished".equals(jn.getStep(3).getStatus()) ]]></arg>
        </condition>
       </conditions>
       <unconditional-result old-status="Finished"
        status="Reviewed" step="4" />
      </join>
     </joins>

    </workflow>




    TitleValidator.java

    package org.abin.lee.validator;

    import java.util.Map;
    import com.opensymphony.module.propertyset.PropertySet;
    import com.opensymphony.workflow.InvalidInputException;
    import com.opensymphony.workflow.Validator;
    import com.opensymphony.workflow.WorkflowException;

    public class TitleValidator implements Validator {
     public void validate(Map transientVars, Map args, PropertySet ps)
       throws InvalidInputException, WorkflowException {
      System.out.println("TitleValidator is running");
      String title = (String) transientVars.get("title");
      if (title == null)
       throw new InvalidInputException("Missing title");
      if (title.length() > 30)
       throw new InvalidInputException("Title too long");
     }
    }



    SimpleSample.java

    package org.abin.lee.workflow;

    import java.util.HashMap;

    import com.opensymphony.workflow.InvalidActionException;
    import com.opensymphony.workflow.InvalidEntryStateException;
    import com.opensymphony.workflow.InvalidInputException;
    import com.opensymphony.workflow.InvalidRoleException;
    import com.opensymphony.workflow.Workflow;
    import com.opensymphony.workflow.WorkflowException;
    import com.opensymphony.workflow.basic.BasicWorkflow;
    import com.opensymphony.workflow.config.DefaultConfiguration;

    public class SimpleSample {
     public static void main(String[] args) {
      try {
       Workflow workflow = new BasicWorkflow("abin");

       DefaultConfiguration config = new DefaultConfiguration();
       workflow.setConfiguration(config);

       long workflowId = workflow.initialize("docworkflow", 100, null);
       HashMap inputs = new HashMap();
       inputs.put("title", "openopen");

       workflow.doAction(workflowId, 1, inputs);

       workflow.doAction(workflowId, 2, null);

       workflow.doAction(workflowId, 3, null);

       workflow.doAction(workflowId, 4, null);
       
      } catch (InvalidActionException e) {
       System.out.println(e.getMessage());
      } catch (InvalidRoleException e) {
       System.out.println(e.getMessage());
      } catch (InvalidInputException e) {
       System.out.println(e.getMessage());
      } catch (InvalidEntryStateException e) {
       System.out.println(e.getMessage());
      } catch (WorkflowException e) {
       System.out.println(e.getMessage());
      }
     }
    }




    log4j.properties

    log4j.rootCategory=info,log,console

    log4j.logger.org.apache.axis2.enterprise=FATAL
    log4j.logger.de.hunsicker.jalopy.io=FATAL
    log4j.logger.httpclient.wire.header=FATAL
    log4j.logger.org.apache.commons.httpclient=FATAL

    log4j.appender.console=org.apache.log4j.ConsoleAppender
    log4j.appender.console.layout=org.apache.log4j.PatternLayout
    log4j.appender.console.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
     
    log4j.appender.log=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.log.File=logs/osworkflow.log
    log4j.appender.log.layout=org.apache.log4j.PatternLayout
    log4j.appender.log.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n




    http://blog.sina.com.cn/s/blog_544a96ce0100nvjy.html

    http://blog.csdn.net/tanruitian/article/details/498167

    http://www.cnblogs.com/jacky73/archive/2008/12/17/1357134.html

    posted on 2012-06-03 22:39 abin 閱讀(1546) 評(píng)論(2)  編輯  收藏 所屬分類(lèi): workflow

    Feedback

    # re: Osworkflow2.8 入門(mén)級(jí)例子 2012-11-05 17:42 Taiwaner
    Osworkflow 已經(jīng)不再開(kāi)發(fā)了,不是嗎?

      回復(fù)  更多評(píng)論
      

    # re: Osworkflow2.8 入門(mén)級(jí)例子 2013-01-16 23:47 abin
    @Taiwaner
    是滴,osworkflow貌似不提供更新了,都是使用以前的老東西,現(xiàn)在好多人都在用Jbpm。  回復(fù)  更多評(píng)論
      


    只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 日本妇人成熟免费中文字幕| 免费福利在线视频| 九九九精品视频免费| 国产激情久久久久影院老熟女免费| 亚洲免费在线观看| 久久99热精品免费观看牛牛| 国产在线jyzzjyzz免费麻豆| 欧洲美熟女乱又伦免费视频| 亚洲国产精品一区二区第四页| 国产亚洲精品精华液| 亚洲成av人片不卡无码| 亚洲AV成人无码网站| aa级毛片毛片免费观看久| 麻豆高清免费国产一区| 免费看美女让人桶尿口| 亚洲一区精品无码| 亚洲一卡2卡4卡5卡6卡在线99| 国产精品无码亚洲精品2021| 中出五十路免费视频| 青青在线久青草免费观看| 四虎永久成人免费| 亚洲AV第一页国产精品| 亚洲国产精品99久久久久久| 中文字幕免费视频精品一| 99re热免费精品视频观看 | 毛片免费vip会员在线看| 免费在线观看a级毛片| 亚洲国产成人久久精品影视| 亚洲色偷偷偷综合网| 中文字幕看片在线a免费| 国产精品69白浆在线观看免费| 亚洲美女高清一区二区三区 | 亚洲精品无码久久不卡| 亚洲精品熟女国产| 手机永久免费的AV在线电影网| 99re热精品视频国产免费| 国产一区视频在线免费观看| 亚洲男人天堂av| 美女视频黄频a免费大全视频| 亚洲啪啪免费视频| 夜夜春亚洲嫩草影院|