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

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

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

    在OSWorkflow中最讓人惱火的就是它的接口定義!我會就這些接口的混亂展開一系列的分析,今天先說說Configuration接口

    偶繼承了它的Configuration接口

    import com.company.engine.workflow.store.IWorkFlowStore;
    import com.opensymphony.workflow.StoreException;
    import com.opensymphony.workflow.config.Configuration;
    import com.opensymphony.workflow.spi.WorkflowStore;

    public interface IConfiguration extends Configuration
    {
     /**
      * @deprecated getIWorkflowStore()
      */
        WorkflowStore getWorkflowStore() throws StoreException;
       
        /**
         * return WorkFlowStore which implements the interface of IWorkFlowStore
         * @return
         * @throws StoreException
         */
        IWorkFlowStore getIWorkflowStore() throws StoreException;
       
    }

    你可能奇怪我為何要繼承它的接口(肯定是Bad smell),原因如下,

    IWorkFlowStore 接口定義

    import com.opensymphony.workflow.StoreException;
    import com.opensymphony.workflow.spi.Step;
    import com.opensymphony.workflow.spi.WorkflowEntry;
    import com.opensymphony.workflow.spi.WorkflowStore;

    public interface IWorkFlowStore extends WorkflowStore
    {
     
     public Step createCurrentStep(WorkflowEntry _entry , Step _step) throws StoreException;

    }

    WorkflowStore接口定義

        /**
         * Persists a step with the given parameters.
         *
         * @param entryId The workflow instance id.
         * @param stepId the ID of the workflow step associated with this new
         *               Step (not to be confused with the step primary key)
         * @param owner the owner of the step
         * @param startDate the start date of the step
         * @param status the status of the step
         * @param previousIds the previous step IDs
         * @return a representation of the workflow step persisted
         */
        public Step createCurrentStep(long entryId, int stepId, String owner, Date startDate, Date dueDate, String status, long[] previousIds) throws StoreException;

    看到了吧?

    其實我只是希望在createCurrentStep時按照OO的方法執行,而不是傳遞那些"Bad Smell"的參數,而OSWorkflow中的WorkflowStore是需要Configuration來獲取的,此時為了增加一個看似合理的方法,需要分別繼承Configuration與WorkflowStore;這還沒有完,你需要實現一個Configuration實現!!

    import com.company.engine.workflow.store.IWorkFlowStore;
    import com.opensymphony.workflow.StoreException;
    import com.opensymphony.workflow.config.DefaultConfiguration;
    import com.opensymphony.workflow.spi.WorkflowStore;

    public class DefaultIConfiguration extends DefaultConfiguration implements IConfiguration
    {
     
        public static DefaultIConfiguration INSTANCE = new DefaultIConfiguration();
        private transient IWorkFlowStore store = null;

     /**
      * @deprecated getIWorkflowStore()
      */
     public WorkflowStore getWorkflowStore() throws StoreException
     {
      return null;
     }

     public IWorkFlowStore getIWorkflowStore() throws StoreException
     {
      if (store == null)
      {
       String clazz = getPersistence();

       try
       {
        store = (IWorkFlowStore) Class.forName(clazz).newInstance();
       }
       catch (Exception ex)
       {
        throw new StoreException("Error creating store", ex);
       }

       store.init(getPersistenceArgs());
      }

      return store;
     }

    }

    總結

    1。OSWorkflow與WorkflowStore接口的關系比較的微妙,它需要借助于Configuration接口的實現來獲取到實際的WorkflowStore對象。

    2。由于這樣的一種微妙關系,對WorkflowStore接口的擴展必將連帶著需要擴展Configuration接口,而產生這樣的"果凍效應"的罪魁禍首就是由于WorkflowStore接口與Configuration接口耦合的太緊。

    3。OSWorkflow并沒有很好的遵守OO的設計規則,尤其在它的參數傳遞上,非常的差!

    主站蜘蛛池模板: 亚洲AV男人的天堂在线观看| 亚洲国产精品一区二区成人片国内 | 亚洲色图国产精品| 免费在线观影网站| 国产aⅴ无码专区亚洲av| 91在线免费视频| 亚洲AV无码乱码国产麻豆| 两个人看的www免费视频| 亚洲AV无码一区二区三区系列| 国产一级a毛一级a看免费人娇| 亚洲国产精品一区第二页 | 在线免费观看国产视频| 国产精品亚洲专区无码唯爱网| 日韩免费a级在线观看| 亚洲gay片在线gv网站| 国产免费观看视频| 亚洲精品视频免费观看| 亚洲电影国产一区| 美女裸身网站免费看免费网站| 亚洲精品精华液一区二区| 亚洲最大av无码网址| 中国一级毛片免费看视频| 亚洲AV美女一区二区三区| 成人在线免费看片| 亚洲av永久无码| 国产亚洲精品成人AA片新蒲金| 免费人成毛片动漫在线播放| 亚洲一区无码中文字幕乱码| 国产亚洲精品免费| 中文在线观看永久免费| 久久亚洲日韩看片无码| 日韩在线免费看网站| 亚洲国产免费综合| 亚洲毛片免费观看| 亚洲国产精品激情在线观看| 免费在线中文日本| 日韩成人精品日本亚洲| 五月天网站亚洲小说| 国产成人免费全部网站| 亚洲国产精品无码久久SM| 91麻豆最新在线人成免费观看 |