Package org.fireflow.engine.persistence

Examples of org.fireflow.engine.persistence.IPersistenceService


    try {
      return (IWorkItem) this.execute(new IWorkflowSessionCallback() {

        public Object doInWorkflowSession(RuntimeContext ctx)
            throws EngineException, KernelException {
          IPersistenceService persistenceService = ctx
              .getPersistenceService();

          return persistenceService.findWorkItemById(workItemId);
        }
      });
    } catch (EngineException ex) {
      ex.printStackTrace();
      return null;
View Full Code Here


    try {
      return (ITaskInstance) this.execute(new IWorkflowSessionCallback() {

        public Object doInWorkflowSession(RuntimeContext ctx)
            throws EngineException, KernelException {
          IPersistenceService persistenceService = ctx
              .getPersistenceService();

          return persistenceService
              .findTaskInstanceById(taskInstanceId);
        }
      });
    } catch (EngineException ex) {
      ex.printStackTrace();
View Full Code Here

      return (IProcessInstance) this
          .execute(new IWorkflowSessionCallback() {

            public Object doInWorkflowSession(RuntimeContext ctx)
                throws EngineException, KernelException {
              IPersistenceService persistenceService = ctx
                  .getPersistenceService();

              return persistenceService
                  .findProcessInstanceById(id);
            }
          });
    } catch (EngineException ex) {
      ex.printStackTrace();
View Full Code Here

      return (List<IProcessInstance>) this
          .execute(new IWorkflowSessionCallback() {

            public Object doInWorkflowSession(RuntimeContext ctx)
                throws EngineException, KernelException {
              IPersistenceService persistenceService = ctx
                  .getPersistenceService();

              return persistenceService
                  .findProcessInstancesByProcessId(processId);
            }
          });
    } catch (EngineException ex) {
      ex.printStackTrace();
View Full Code Here

      return (List<IProcessInstance>) this
          .execute(new IWorkflowSessionCallback() {

            public Object doInWorkflowSession(RuntimeContext ctx)
                throws EngineException, KernelException {
              IPersistenceService persistenceService = ctx
                  .getPersistenceService();

              return persistenceService
                  .findProcessInstancesByProcessIdAndVersion(
                      processId, version);
            }
          });
    } catch (EngineException ex) {
View Full Code Here

      return (List<ITaskInstance>) this
          .execute(new IWorkflowSessionCallback() {

            public Object doInWorkflowSession(RuntimeContext ctx)
                throws EngineException, KernelException {
              IPersistenceService persistenceService = ctx
                  .getPersistenceService();

              return persistenceService
                  .findTaskInstancesForProcessInstance(
                      processInstanceId, activityId);
            }
          });
    } catch (EngineException ex) {
View Full Code Here

        if (enterTransInstanceCount == 0) {//检查流程定义是否合法,同步器节点必须有输入边

            throw new EngineException(this.getId(), this.getWorkflowProcess(),
                    synchInst.getSynchronizer().getId(), "The process definition [" + this.getName() + "] is invalid,the synchronizer[" + synchInst.getSynchronizer() + "] has no entering transition");
        }
        IPersistenceService persistenceService = rtCtx.getPersistenceService();
        //保存到数据库
        persistenceService.saveOrUpdateToken(token);

        IJoinPoint resultJoinPoint = null;
        resultJoinPoint = new JoinPoint();
        resultJoinPoint.setProcessInstance(this);
        resultJoinPoint.setSynchronizerId(synchInst.getSynchronizer().getId());
        if (enterTransInstanceCount == 1) {
            // 生成一个不存储到数据库中的JoinPoint
            resultJoinPoint.addValue(token.getValue());

            if (token.isAlive()) {
                resultJoinPoint.setAlive(true);
                resultJoinPoint.setFromActivityId(token.getFromActivityId());
            }
            resultJoinPoint.setStepNumber(token.getStepNumber() + 1);

            return resultJoinPoint;
        } else {

            int stepNumber = 0;

            List<IToken> tokensList_0 = persistenceService.findTokensForProcessInstance(this.getId(), synchInst.getSynchronizer().getId());
            Map<String,IToken> tokensMap = new HashMap<String,IToken>();
            for (int i = 0; i < tokensList_0.size(); i++) {
                IToken tmpToken =   tokensList_0.get(i);
                String tmpFromActivityId = tmpToken.getFromActivityId();
                if (!tokensMap.containsKey(tmpFromActivityId)) {
View Full Code Here

    /* (non-Javadoc)
     * @see org.fireflow.engine.IProcessInstance#getProcessInstanceVariables()
     */
    public Map<String ,Object> getProcessInstanceVariables() {
    IPersistenceService persistenceService = this.rtCtx.getPersistenceService();
      if (processInstanceVariables==null){
        //通过数据库查询进行初始化
        List<ProcessInstanceVar> allVars = persistenceService.findProcessInstanceVariable(this.getId());
        processInstanceVariables = new HashMap<String ,Object>();
        if (allVars!=null && allVars.size()!=0){
          for (ProcessInstanceVar theVar :allVars){
            processInstanceVariables.put(theVar.getVarPrimaryKey().getName(), theVar.getValue());
          }
View Full Code Here

    /* (non-Javadoc)
     * @see org.fireflow.engine.IProcessInstance#getProcessInstanceVariable(java.lang.String)
     */
    public Object getProcessInstanceVariable(String name) {
    IPersistenceService persistenceService = this.rtCtx.getPersistenceService();
      if (processInstanceVariables==null){
        //通过数据库查询进行初始化
        List<ProcessInstanceVar> allVars = persistenceService.findProcessInstanceVariable(this.getId());
        processInstanceVariables = new HashMap<String ,Object>();
        if (allVars!=null && allVars.size()!=0){
          for (ProcessInstanceVar theVar :allVars){
            processInstanceVariables.put(theVar.getVarPrimaryKey().getName(), theVar.getValue());
          }
View Full Code Here

    /* (non-Javadoc)
     * @see org.fireflow.engine.IProcessInstance#setProcessInstanceVariable(java.lang.String, java.lang.Object)
     */
    public void setProcessInstanceVariable(String name, Object value) {
    IPersistenceService persistenceService = this.rtCtx.getPersistenceService();
      if (processInstanceVariables==null){
        //通过数据库查询进行初始化
        List<ProcessInstanceVar> allVars = persistenceService.findProcessInstanceVariable(this.getId());
        processInstanceVariables = new HashMap<String ,Object>();
        if (allVars!=null && allVars.size()!=0){
          for (ProcessInstanceVar theVar :allVars){
            processInstanceVariables.put(theVar.getVarPrimaryKey().getName(), theVar.getValue());
          }
        }
      }
      ProcessInstanceVar procInstVar = new ProcessInstanceVar();
      ProcessInstanceVarPk pk = new ProcessInstanceVarPk();
      pk.setProcessInstanceId(this.getId());
      pk.setName(name);
      procInstVar.setVarPrimaryKey(pk);
      procInstVar.setValue(value);
      procInstVar.setValueType(value.getClass().getName());
     
      if (processInstanceVariables.containsKey(name)){
        persistenceService.updateProcessInstanceVariable(procInstVar);
      }else{
        persistenceService.saveProcessInstanceVariable(procInstVar);
      }
        processInstanceVariables.put(name, value);
    }
View Full Code Here

TOP

Related Classes of org.fireflow.engine.persistence.IPersistenceService

Copyright © 2018 www.massapicom. 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.