Examples of WFException


Examples of com.exedosoft.wf.WFException

      pi.setPtUid(pt.getObjUid());
      String ptName = pt.getPtName();
      BOInstance bi = pt.getDoBO().getCorrInstance();
      if (bi == null) {
        t.rollback();
        throw new WFException("启动工作流失败:没有与业务表关联!");
      }
      pi.setInstanceUid(bi.getUid());
      if (bi.getName() != null && !bi.getName().equals("N/A")) {
        ptName = bi.getName();
      }

      if (pt.getDoBO2() != null) {
        BOInstance bi2 = DOGlobals.getInstance().getSessoinContext()
            .get(pt.getDoBO2());
        if (bi2 != null) {
          pi.setInstanceUid2(bi2.getUid());
        }
      }
      if (pt.getDoBO3() != null) {

        BOInstance bi3 = DOGlobals.getInstance().getSessoinContext()
            .get(pt.getDoBO3());
        if (bi3 != null) {
          pi.setInstanceUid3(bi3.getUid());
        }
      }

      pi.setWfiName(ptName);
      pi.setStartTime(new java.sql.Timestamp(System.currentTimeMillis()));

      SessionContext us = DOGlobals.getInstance().getSessoinContext();

      if(us.getUser()!=null){
        pi.setStartUser(us.getUser().getUid());
      }

      if (isRun) {
        pi.setExeStatus(Integer.valueOf(ProcessInstance.STATUS_RUN));
      }

      DAOUtil.BUSI().store(pi); // /////保存工作流实例

      PTNode startNode = pt.getStartNode();
      niStart = NodeInstance.initNodeInstance(pi, startNode,
          NodeInstance.STATUS_FREE);
      DAOUtil.BUSI().store(niStart);

      // // /////////如果模板存在节点
      // if (pt.getNodes() != null && pt.getNodes().size() > 0) {
      //
      // // ///存储Node 和 NodeInstance 的对应关系
      // // /////原因是要找到开始Node才能建立关联,要两次遍历
      // // //否则没必要用Map 保持他们的联系
      // PTNode start = null; // ////定义开始节点
      // HashMap mapNode = new HashMap();
      // // ///////////// 保存节点实例及下面的Actions,并返回开始节点
      // start = copyToNodeInstances(dao, pi, mapNode);
      // // ////////////建立该模板下的节点实例之间的关系。
      // buildInstanceRelation(pt, mapNode, dao);
      //             
      // niStart = (NodeInstance) mapNode.get(start);
      // } else {
      // throw new WFException("启动工作流失败:没有为工作流模板定义节点");
      // }
      // /////end copy nodes

      // /////////copy vars
      if (pt.retrievePtVars() != null && pt.retrievePtVars().size() > 0) {
        copyToVarInstances(pi);
      }
      // ///////////end copy vars

      // ////////////把控制权交给 Start NodeInstance.
      niStart.setExeStatus(Integer.valueOf(NodeInstance.STATUS_INIT));

      // niStart.perform();
    } catch (Exception ex) {
      t.rollback();
      throw new WFException("启动工作流失败", ex);
    } finally {
      t.end();
    }

    System.out.println("Start::" + niStart);
View Full Code Here

Examples of org.ofbiz.workflow.WfException

     * @see org.ofbiz.workflow.impl.WfExecutionObjectImpl#WfExecutionObjectImpl(org.ofbiz.entity.Delegator, java.lang.String)
     */
    public WfProcessImpl(Delegator delegator, String workEffortId) throws WfException {
        super(delegator, workEffortId);
        if (UtilValidate.isNotEmpty(activityId))
            throw new WfException("Execution object is not of type WfProcess.");
        this.manager = WfFactory.getWfProcessMgr(delegator, packageId, packageVersion, processId, processVersion);
        this.requester = null;
    }
View Full Code Here

Examples of org.ofbiz.workflow.WfException

                // this is either the first activity defined or specified as an ExtendedAttribute
                // since this is defined in XPDL, we don't care if canStart is set.
                start = getDefinitionObject().getRelatedOne("DefaultStartWorkflowActivity");
            }
        } catch (GenericEntityException e) {
            throw new WfException(e.getMessage(), e.getNested());
        }
        if (start == null)
            throw new CannotStart("No initial activity available");

        if (Debug.verboseOn())
View Full Code Here

Examples of org.ofbiz.workflow.WfException

    /**
     * @see org.ofbiz.workflow.WfProcess#activityComplete(org.ofbiz.workflow.WfActivity)
     */
    public synchronized void activityComplete(WfActivity activity) throws WfException {
        if (!activity.state().equals("closed.completed"))
            throw new WfException("Activity state is not completed");
        if (Debug.verboseOn()) Debug.logVerbose("[WfProcess.activityComplete] : Activity (" + activity.name() + ") is complete", module);
        queueNext(activity);
    }
View Full Code Here

Examples of org.ofbiz.workflow.WfException

                GenericValue toActivity = null;

                try {
                    toActivity = trans.getRelatedOne("ToWorkflowActivity");
                } catch (GenericEntityException e) {
                    throw new WfException(e.getMessage(), e);
                }

                // check for a join
                String join = "WJT_AND"; // default join is AND
View Full Code Here

Examples of org.ofbiz.workflow.WfException

       
        List<GenericValue> toTrans = null;
        try {
            toTrans = toActivity.getRelated("ToWorkflowTransition");
        } catch (GenericEntityException e) {
            throw new WfException(e.getMessage(), e);
        }

        // get a list of followed transition to this activity
        List<GenericValue> followed = null;
        try {
            Map<String, Object> fields = new HashMap<String, Object>();
            fields.put("processWorkEffortId", dataObject.getString("workEffortId"));
            fields.put("toActivityId", toActivity.getString("activityId"));
            followed = getDelegator().findByAnd("WorkEffortTransBox", fields);
        } catch (GenericEntityException e) {
            throw new WfException(e.getMessage(), e);
        }

        if (Debug.verboseOn()) Debug.logVerbose("[WfProcess.joinTransition] : toTrans (" + toTrans.size() + ") followed (" +
                (followed.size() + 1) + ")", module);

        // check to see if all transition requirements are met
        if (toTrans.size() == (followed.size() + 1)) {
            Debug.logVerbose("[WfProcess.joinTransition] : All transitions have followed.", module);
            startActivity(toActivity);
            try {
                Map<String, Object> fields = new HashMap<String, Object>();
                fields.put("processWorkEffortId", dataObject.getString("workEffortId"));
                fields.put("toActivityId", toActivity.getString("activityId"));
                getDelegator().removeByAnd("WorkEffortTransBox", fields);
            } catch (GenericEntityException e) {
                throw new WfException(e.getMessage(), e);
            }
        } else {
            Debug.logVerbose("[WfProcess.joinTransition] : Waiting for transitions to finish.", module);
            try {
                Map<String, Object> fields = new HashMap<String, Object>();
                fields.put("processWorkEffortId", dataObject.getString("workEffortId"));
                fields.put("toActivityId", toActivity.getString("activityId"));
                fields.put("transitionId", transition.getString("transitionId"));
                GenericValue obj = getDelegator().makeValue("WorkEffortTransBox", fields);

                getDelegator().create(obj);
            } catch (GenericEntityException e) {
                throw new WfException(e.getMessage(), e);
            }
        }
    }
View Full Code Here

Examples of org.ofbiz.workflow.WfException

        LocalDispatcher dispatcher = this.getDispatcher();

        // get the job manager
        JobManager jm = dispatcher.getJobManager();
        if (jm == null) {
            throw new WfException("No job manager found on the service dispatcher; cannot start activity");
        }

        // using the StartActivityJob class to run the activity within its own thread
        try {
            Job activityJob = new StartActivityJob(activity, req);
            jm.runJob(activityJob);
        } catch (JobManagerException e) {
            throw new WfException("JobManager error", e);
        }

        // the GenericRequester object will hold any exceptions; and report the job as failed
        if (req.status() == GenericResultWaiter.SERVICE_FAILED) {
            Throwable reqt = req.getThrowable();
            if (reqt instanceof CannotStart)
                Debug.logVerbose("[WfProcess.startActivity] : Cannot start activity. Waiting for manual start.", module);
            else if (reqt instanceof AlreadyRunning)
                throw new WfException("Activity already running", reqt);
            else
                throw new WfException("Activity error", reqt);
        }
    }
View Full Code Here

Examples of org.ofbiz.workflow.WfException

        // get the from transitions
        List<GenericValue> fromTransitions = null;
        try {
            fromTransitions = fromActivity.getDefinitionObject().getRelated("FromWorkflowTransition");
        } catch (GenericEntityException e) {
            throw new WfException(e.getMessage(), e);
        }

        // check for a split
        String split = "WST_AND"; // default split is AND
View Full Code Here

Examples of org.ofbiz.workflow.WfException

            WfEventAudit audit = WfFactory.getWfEventAudit(this, null); // this will need to be updated

            try {
                requester.receiveEvent(audit);
            } catch (InvalidPerformer e) {
                throw new WfException(e.getMessage(), e);
            }
        }
    }
View Full Code Here

Examples of org.ofbiz.workflow.WfException

        List<GenericValue> workEffortList = null;
        try {
            workEffortList = getDelegator().findByAnd("WorkEffort", UtilMisc.toMap("workEffortParentId", runtimeKey()));
        } catch (GenericEntityException e) {
            throw new WfException(e.getMessage(), e);
        }
        if (workEffortList == null) {
            return steps;
        }
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.