Package org.uengine.processmanager

Examples of org.uengine.processmanager.ProcessManagerRemote


   
    return new String[]{definitionId, versionId};
  }

  public static String getDefinitionVersionId(ProcessInstance instance, String definitionId, int versionSelectionOption, ProcessDefinition definition) throws Exception{
    ProcessManagerRemote pm = null;

    if(instance!=null)
      pm = instance.getProcessTransactionContext().getProcessManager();
    else
      pm = (new ProcessManagerFactoryBean()).getProcessManagerForReadOnly();
View Full Code Here


        return null;
   

  public String getDefinitionVersionId(ProcessInstance instance)
      throws Exception {
    ProcessManagerRemote pm = new ProcessManagerBean();

    String versionId = null;
    String definitionId = null;

    String[] defIdAndVersionId = ProcessDefinition
        .splitDefinitionAndVersionId(getDefinitionId());
    definitionId = defIdAndVersionId[0];
    versionId = defIdAndVersionId[1];

    try {
      versionId = pm.getProcessDefinitionProductionVersion(definitionId);
    } catch (Exception e) {
      e.printStackTrace();

      try {
        versionId = pm.getFirstProductionVersionId(definitionId);
      } catch (Exception ex) {
        ex.printStackTrace();
        versionId = pm
            .getProcessDefinitionProductionVersion(definitionId);
      }
    }

    return versionId;
View Full Code Here

   
    String status = null;
    List<TaskInfo> taskInfoList = null;
   
    ProcessManagerFactoryBean pmfb = new ProcessManagerFactoryBean();
    ProcessManagerRemote pm = null;
    try {
      pm = pmfb.getProcessManager();
     
      ProcessManagerService pms = new ProcessManagerService(pm, null);
      pms.approvalDraftActivityComplete(adacMsg);
      pm.applyChanges();
     
      if (StringUtils.hasText(adacMsg.getInstanceId()) && StringUtils.hasText(adacMsg.getEndpoint())) {
        taskInfoList = pms.getTaskInfo(adacMsg.getInstanceId(), adacMsg.getEndpoint());
      }
     
      status = "S";
     
    } catch (Exception e) {
      e.printStackTrace();
     
      if (pm != null)
        try {
          pm.cancelChanges();
        } catch (Exception e1) {
        }
     
      status = "F";
     
    } finally {
      if (pm != null)
        try {
          pm.remove();
        } catch (RemoveException e) {
        }
    }

    return MakeReturnMsg.toElement(status, taskInfoList, APPROVAL_DRAFT_ACTIVITY_COMPLETE_RESPONSE, WORKFLOW_NAMESPACE);
View Full Code Here

   
    String status = null;
    List<TaskInfo> taskInfoList = null;
   
    ProcessManagerFactoryBean pmfb = new ProcessManagerFactoryBean();
    ProcessManagerRemote pm = null;
    try {
      pm = pmfb.getProcessManager();
     
      ProcessManagerService pms = new ProcessManagerService(pm, null);
      pms.processStop(psMsg);
      pm.applyChanges();
     
      status = "S";
     
    } catch (Exception e) {
      e.printStackTrace();
     
      if (pm != null)
        try {
          pm.cancelChanges();
        } catch (Exception e1) {
        }
     
      status = "F";
     
    } finally {
      if (pm != null)
        try {
          pm.remove();
        } catch (RemoveException e) {
        }
    }

    return MakeReturnMsg.toElement(status, taskInfoList, PROCESS_STOP_RESPONSE, WORKFLOW_NAMESPACE);
View Full Code Here

   
    String status = null;
    List<TaskInfo> taskInfoList = null;
   
    ProcessManagerFactoryBean pmfb = new ProcessManagerFactoryBean();
    ProcessManagerRemote pm = null;
    try {
      pm = pmfb.getProcessManager();
     
      ProcessManagerService pms = new ProcessManagerService(pm, null);
      pms.activityComplete(acMsg);
      pm.applyChanges();
     
      if (StringUtils.hasText(acMsg.getInstanceId()) && StringUtils.hasText(acMsg.getEndpoint())) {
        taskInfoList = pms.getTaskInfo(acMsg.getInstanceId(), acMsg.getEndpoint());
      }
     
      status = "S";
     
    } catch (Exception e) {
      e.printStackTrace();
     
      if (pm != null)
        try {
          pm.cancelChanges();
        } catch (Exception e1) {
        }
     
      status = "F";
     
    } finally {
      if (pm != null)
        try {
          pm.remove();
        } catch (RemoveException e) {
        }
    }

    return MakeReturnMsg.toElement(status, taskInfoList, ACTIVITY_COMPLETE_RESPONSE, WORKFLOW_NAMESPACE);
View Full Code Here

   
    String status = null;
    List<TaskInfo> taskInfoList = null;
   
    ProcessManagerFactoryBean pmfb = new ProcessManagerFactoryBean();
    ProcessManagerRemote pm = null;
    try {
      pm = pmfb.getProcessManager();
     
      ProcessManagerService pms = new ProcessManagerService(pm, null);
      pms.delegateWorkItem(dwMsg);
      pm.applyChanges();
     
      status = "S";
     
    } catch (Exception e) {
      e.printStackTrace();
     
      if (pm != null)
        try {
          pm.cancelChanges();
        } catch (Exception e1) {
        }
     
      status = "F";
     
    } finally {
      if (pm != null)
        try {
          pm.remove();
        } catch (RemoveException e) {
        }
    }

    return MakeReturnMsg.toElement(status, taskInfoList, DELEGATE_WORKITEM_RESPONSE, WORKFLOW_NAMESPACE);
View Full Code Here

   
    String status = null;
    List<TaskInfo> taskInfoList = null;
   
    ProcessManagerFactoryBean pmfb = new ProcessManagerFactoryBean();
    ProcessManagerRemote pm = null;
    try {
      pm = pmfb.getProcessManager();
     
      ProcessManagerService pms = new ProcessManagerService(pm, null);
      pms.approvalLineChange(alcMsg);
      pm.applyChanges();
     
      status = "S";
     
    } catch (Exception e) {
      e.printStackTrace();
     
      if (pm != null)
        try {
          pm.cancelChanges();
        } catch (Exception e1) {
        }
     
      status = "F";
     
    } finally {
      if (pm != null)
        try {
          pm.remove();
        } catch (RemoveException e) {
        }
    }

    return MakeReturnMsg.toElement(status, taskInfoList, APPROVAL_LINE_CHANGE_RESPONSE, WORKFLOW_NAMESPACE);
View Full Code Here

    out.close();
  }

  private boolean validateSingleData(String alias) {
    ProcessManagerFactoryBean processManagerFactory = new ProcessManagerFactoryBean();
    ProcessManagerRemote pm = null;
    ProcessDefinitionRemote[] pds = null;
    ProcessDefinitionRemote pdr = null;
    boolean val = true;
    try {
      pm = processManagerFactory.getProcessManagerForReadOnly();
      pds = pm.listProcessDefinitionRemotesLight();
      for (int i = 0; i < pds.length; i++) {
        pdr = pds[i];
        if (pdr.getAlias() != null && pdr.getAlias().equals(alias)) {
          val = false;
          break;
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      try {
        pm.remove();
      } catch (RemoteException e) {
        e.printStackTrace();
      } catch (RemoveException e) {
        e.printStackTrace();
      }
View Full Code Here

    return val;
  }

  private boolean[] validateMultiData(String paras) {
    ProcessManagerFactoryBean processManagerFactory = new ProcessManagerFactoryBean();
    ProcessManagerRemote pm = null;
    ProcessDefinitionRemote[] pds = null;
    ProcessDefinitionRemote pdr = null;

    String[] aliass = new String[paras.split("\\|").length];
    int count=0;
    StringTokenizer st = new StringTokenizer(paras, "|");
    while (st.hasMoreElements()) {
      aliass[count] = st.nextToken();
      count++;
    }

    boolean[] val = new boolean[aliass.length];

    try {
      pm = processManagerFactory.getProcessManagerForReadOnly();
      pds = pm.listProcessDefinitionRemotesLight();
      for (int j = 0; j < aliass.length; j++) {
        for (int i = 0; i < pds.length; i++) {
          pdr = pds[i];
          if (pdr.getAlias() != null && pdr.getAlias().equals(aliass[j])) {
            val[j] = true;
            break;
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      try {
        pm.remove();
      } catch (RemoteException e) {
        e.printStackTrace();
      } catch (RemoveException e) {
        e.printStackTrace();
      }
View Full Code Here

public class ExportServlet extends HttpServlet {

  public void service(HttpServletRequest request,  HttpServletResponse response)throws ServletException {
 
    String defId = request.getParameter("processDefinition");
    ProcessManagerRemote pm = null;
   
    try{
      ProcessManagerFactoryBean processManagerFactory = new ProcessManagerFactoryBean();
      pm = processManagerFactory.getProcessManagerForReadOnly();
      pm.exportProcessDefinitionbyDefinitionId(defId, false);
     
      String fileName = "";
      if(!defId.equals("-1")){
        fileName = pm.getProcessDefinitionRemoteByDefinitionId(defId).getName().getText();
      }else{
        fileName = "root";
      }

      String TEMP_DIRECTORY = GlobalContext.getPropertyString(
        "server.definition.path",
        "." + File.separatorChar + "uengine" + File.separatorChar + "definition" + File.separatorChar
      );
         
      if(!TEMP_DIRECTORY.endsWith("/") && !TEMP_DIRECTORY.endsWith("\\")){
        TEMP_DIRECTORY = TEMP_DIRECTORY + "/";
      }
      TEMP_DIRECTORY = TEMP_DIRECTORY + "temp" + File.separatorChar + "download" + File.separatorChar;
      String filePath = TEMP_DIRECTORY + fileName + ".zip";
     
      BufferedInputStream  fis  = new BufferedInputStream(new FileInputStream(filePath));
      int idx = filePath.lastIndexOf(File.separatorChar);
      filePath = filePath.substring(idx+1, filePath.length());

      response.setHeader("Cache-Control","private"); //HTTP 1.1
      response.setHeader("Pragma","no-cache"); //HTTP 1.0
      response.setHeader("Content-Disposition", "attachment;filename=\"" +  URLEncoder.encode(filePath, "UTF-8").replace('+',' ')+"\";");
      response.setDateHeader ("Expires", 0); //prevents caching at the proxy server

      UEngineUtil.copyStream(fis, response.getOutputStream());
      response.getOutputStream().flush();
      response.getOutputStream().close();

    }catch(Exception e){
      try {
        pm.cancelChanges();
      } catch (RemoteException e1) {}
      e.printStackTrace();
    }finally{
      try{
        pm.remove();
      }catch(Exception ex){}
    }
  }
View Full Code Here

TOP

Related Classes of org.uengine.processmanager.ProcessManagerRemote

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.