Examples of ResourceEntity


Examples of com.founder.fix.fixflow.core.impl.persistence.definition.ResourceEntity

    ProcessDefinitionBehavior processDefinitionBehavior=processDefinitionQuery.singleResult();
    //验证是否得到流程定义
    assertNotNull(processDefinitionBehavior);
   
    //定义部署资源的字节流
    ResourceEntity resourceEntity = modelService.getResourceAsStream(processDefinitionBehavior.getResourceId());
    //验证是否得到定义部署资源的字节流
    assertNotNull(resourceEntity);
  }
View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.persistence.definition.ResourceEntity

    assertNotNull(map);
    //需要包含png文件和bpmn文件
    assertEquals(2, map.keySet().size());
    for(String key:map.keySet()){
      //获取资源文件
      ResourceEntity resourceEntity = map.get(key);
      //验证资源文件的大字段不为空
      assertNotNull(resourceEntity.getBytes());
    }
  }
View Full Code Here

Examples of org.activiti.engine.impl.persistence.entity.ResourceEntity

    }
    if(resourceName == null) {
      throw new ActivitiException("resourceName is null");
    }
   
    ResourceEntity resource = commandContext
      .getResourceManager()
      .findResourceByDeploymentIdAndResourceName(deploymentId, resourceName);
    if(resource == null) {
      throw new ActivitiException("no resource found with name '" + resourceName + "' in deployment '" + deploymentId + "'");
    }
    return new ByteArrayInputStream(resource.getBytes());
  }
View Full Code Here

Examples of org.activiti.engine.impl.persistence.entity.ResourceEntity

  protected boolean deploymentsDiffer(DeploymentEntity deployment, DeploymentEntity saved) {
    Map<String, ResourceEntity> resources = deployment.getResources();
    Map<String, ResourceEntity> savedResources = saved.getResources();
   
    for (String resourceName: resources.keySet()) {
      ResourceEntity savedResource = savedResources.get(resourceName);
     
      if(savedResource == null) return true;
     
      if(!savedResource.isGenerated()) {
        ResourceEntity resource = resources.get(resourceName);
       
        byte[] bytes = resource.getBytes();
        byte[] savedBytes = savedResource.getBytes();
        if (!Arrays.equals(bytes, savedBytes)) {
          return true;
        }
      }
View Full Code Here

Examples of org.activiti.engine.impl.persistence.entity.ResourceEntity

  }

  protected String getFormTemplateString(FormData formInstance, String formKey) {
    String deploymentId = formInstance.getDeploymentId();
   
    ResourceEntity resourceStream = Context
      .getCommandContext()
      .getResourceEntityManager()
      .findResourceByDeploymentIdAndResourceName(deploymentId, formKey);
   
    if (resourceStream == null) {
      throw new ActivitiObjectNotFoundException("Form with formKey '"+formKey+"' does not exist", String.class);
    }
   
    byte[] resourceBytes = resourceStream.getBytes();
    String encoding = "UTF-8";
    String formTemplateString = "";
    try {
      formTemplateString = new String(resourceBytes, encoding);
    } catch (UnsupportedEncodingException e) {
View Full Code Here

Examples of org.activiti.engine.impl.persistence.entity.ResourceEntity

    final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    for (String resourceName : resources.keySet()) {

      LOG.info("Processing resource {}", resourceName);
      if (isBpmnResource(resourceName)) {
        ResourceEntity resource = resources.get(resourceName);
        byte[] bytes = resource.getBytes();
        ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
       
        BpmnParse bpmnParse = bpmnParser
          .createParse()
          .sourceInputStream(inputStream)
View Full Code Here

Examples of org.activiti.engine.impl.persistence.entity.ResourceEntity

    }
    return bpmnFileResource;
  }

  protected void createResource(String name, byte[] bytes, DeploymentEntity deploymentEntity) {
    ResourceEntity resource = new ResourceEntity();
    resource.setName(name);
    resource.setBytes(bytes);
    resource.setDeploymentId(deploymentEntity.getId());
   
    // Mark the resource as 'generated'
    resource.setGenerated(true);
   
    Context
      .getCommandContext()
      .getDbSqlSession()
      .insert(resource);
View Full Code Here

Examples of org.activiti.engine.impl.persistence.entity.ResourceEntity

      throw new ActivitiObjectNotFoundException("Process definition does not exist: " + processDefinitionId, ProcessDefinitionEntity.class);
    }

    // Fetch the resource
    String resourceName = processDefinitionEntity.getResourceName();
    ResourceEntity resource = commandContext.getResourceEntityManager()
            .findResourceByDeploymentIdAndResourceName(processDefinitionEntity.getDeploymentId(), resourceName);
    if (resource == null) {
      if (commandContext.getDeploymentEntityManager().findDeploymentById(processDefinitionEntity.getDeploymentId()) == null) {
        throw new ActivitiObjectNotFoundException("deployment for process definition does not exist: "
      + processDefinitionEntity.getDeploymentId(), Deployment.class);
      } else {
        throw new ActivitiObjectNotFoundException("no resource found with name '" + resourceName
                + "' in deployment '" + processDefinitionEntity.getDeploymentId() + "'", InputStream.class);
      }
    }
   
    // Convert the bpmn 2.0 xml to a bpmn model
    BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();
    return bpmnXMLConverter.convertToBpmnModel(new BytesStreamSource(resource.getBytes()), false, false); // no need to validate schema, it was already validated on deploy
  }
View Full Code Here

Examples of org.activiti.engine.impl.persistence.entity.ResourceEntity

  public DeploymentBuilder addInputStream(String resourceName, InputStream inputStream) {
    if (inputStream==null) {
      throw new ActivitiIllegalArgumentException("inputStream for resource '"+resourceName+"' is null");
    }
    byte[] bytes = IoUtil.readInputStream(inputStream, resourceName);
    ResourceEntity resource = new ResourceEntity();
    resource.setName(resourceName);
    resource.setBytes(bytes);
    deployment.addResource(resource);
    return this;
  }
View Full Code Here

Examples of org.activiti.engine.impl.persistence.entity.ResourceEntity

  public DeploymentBuilder addString(String resourceName, String text) {
    if (text==null) {
      throw new ActivitiIllegalArgumentException("text is null");
    }
    ResourceEntity resource = new ResourceEntity();
    resource.setName(resourceName);
    try {
      resource.setBytes(text.getBytes(DEFAULT_ENCODING));
    } catch (UnsupportedEncodingException e) {
      throw new ActivitiException("Unable to get process bytes.", e);
    }
    deployment.addResource(resource);
    return this;
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.