Package com.founder.fix.fixflow.core.impl.persistence.deployer

Examples of com.founder.fix.fixflow.core.impl.persistence.deployer.DeploymentCache


    ProcessDefinitionBehavior processDefinitionBehavior = getProcessDefinition(dataMap);
    return processDefinitionBehavior;
  }

  public ProcessDefinitionBehavior selectProcessDefinitionById(String processDefinitionId) {
    DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
    ProcessDefinitionBehavior processDefinition = deploymentCache.getProcessDefinitionCache().get(processDefinitionId);
    if (processDefinition == null) {
      String sqlText = "select * " + "from FIXFLOW_DEF_PROCESSDEFINITION " + "where PROCESS_ID = ?";
      // 构建查询参数
      List<Object> objectParamWhere = new ArrayList<Object>();
      objectParamWhere.add(processDefinitionId);
View Full Code Here


  private ProcessDefinitionBehavior getProcessDefinition(Map<String, Object> processDataMap) {
    String processId = StringUtil.getString(processDataMap.get("PROCESS_ID"));
    String deploymentId = StringUtil.getString(processDataMap.get("DEPLOYMENT_ID"));
    String resourceName = StringUtil.getString(processDataMap.get("RESOURCE_NAME"));
    String processKey = StringUtil.getString(processDataMap.get("PROCESS_KEY"));
    DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
    ProcessDefinitionBehavior processDefinition = deploymentCache.getProcessDefinitionCache().get(processId);
    if (processDefinition == null) {
      String sqlText = "SELECT BYTES FROM FIXFLOW_DEF_BYTEARRAY WHERE NAME=? and DEPLOYMENT_ID=?";
      // 构建查询参数
      List<Object> objectParamWhere = new ArrayList<Object>();
      objectParamWhere.add(resourceName);
      objectParamWhere.add(deploymentId);
      List<Map<String, Object>> dataObj = sqlCommand.queryForList(sqlText, objectParamWhere);
      Map<String, Object> dataMap = dataObj.get(0);
      Object bytesObject = dataMap.get("BYTES");
      if (bytesObject != null) {
        byte[] bytes = (byte[]) bytesObject;
        ResourceSet resourceSet = getResourceSet();
        String fixflowFilePath =  ProcessEngineManagement.getDefaultProcessEngine().getProcessEngineConfiguration().getNoneTemplateFilePath();
        URL url = ReflectUtil.getResource(fixflowFilePath);
        if(url == null){
          throw new FixFlowClassLoadingException(ExceptionCode.CLASSLOAD_EXCEPTION_FILENOTFOUND,fixflowFilePath);
        }
        String filePath = url.toString();
        Resource ddddResource = null;
        try {
          if (!filePath.startsWith("jar")) {
            filePath = java.net.URLDecoder.decode(url.getFile(),"utf-8");
            ddddResource = resourceSet.createResource(URI.createFileURI(filePath));
          } else {
            ddddResource = resourceSet.createResource(URI.createURI(filePath));
          }
          ddddResource.load(new ByteArrayInputStream(bytes), null);
        } catch (Exception e) {
          throw new FixFlowClassLoadingException(ExceptionCode.CLASSLOAD_EXCEPTION, e);
        }
        DefinitionsBehavior definitions = (DefinitionsBehavior) ddddResource.getContents().get(0).eContents().get(0);
        definitions.setProcessId(processId);

        for (RootElement rootElement : definitions.getRootElements()) {
          if (rootElement instanceof ProcessDefinitionBehavior) {
            ProcessDefinitionBehavior processObj = (ProcessDefinitionBehavior) rootElement;
            if (processObj.getProcessDefinitionKey().equals(processKey)) {
              processDefinition = (ProcessDefinitionBehavior) rootElement;
              break;
            }
          }
        }
        processDefinition.setDefinitions(definitions);
        // 加载事件定义.
        loadEvent(processDefinition);
        // 加载数据变量
        loadVariable(processDefinition);
        // 设置FlowNode元素的子流程
        loadSubProcess(processDefinition);
        processDefinition.persistentInit(processDataMap);
        deploymentCache.addProcessDefinition(processDefinition);
        return processDefinition;

      }
      return null;
    } else {
View Full Code Here

    if (deploymentCache == null) {
      List<Deployer> deployers = new ArrayList<Deployer>();

      deployers.add(new BpmnDeployer());
      deploymentCache = new DeploymentCache();
      deploymentCache.setDeployers(deployers);
    }
  }
View Full Code Here

TOP

Related Classes of com.founder.fix.fixflow.core.impl.persistence.deployer.DeploymentCache

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.