Examples of ResourceEntity


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

      ZipEntry entry = zipInputStream.getNextEntry();
      while (entry != null) {
        if (!entry.isDirectory()) {
          String entryName = entry.getName();
          byte[] bytes = IoUtil.readInputStream(zipInputStream, entryName);
          ResourceEntity resource = new ResourceEntity();
          resource.setName(entryName);
          resource.setBytes(bytes);
          deployment.addResource(resource);
        }
        entry = zipInputStream.getNextEntry();
      }
    } catch (Exception e) {
View Full Code Here

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

   
    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

    }
    if(resourceName == null) {
      throw new ActivitiIllegalArgumentException("resourceName is null");
    }
   
    ResourceEntity resource = commandContext
      .getResourceEntityManager()
      .findResourceByDeploymentIdAndResourceName(deploymentId, resourceName);
    if(resource == null) {
      if(commandContext.getDeploymentEntityManager().findDeploymentById(deploymentId) == null) {
        throw new ActivitiObjectNotFoundException("deployment does not exist: " + deploymentId, Deployment.class);
      }
      else
      {
        throw new ActivitiObjectNotFoundException("no resource found with name '" + resourceName + "' in deployment '" + deploymentId + "'", InputStream.class);
      }
    }
    return new ByteArrayInputStream(resource.getBytes());
  }
View Full Code Here

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

      log.info("Processing resource {}", resourceName);
      if (resourceName.endsWith(".drl")) { // is only parsing .drls sufficient? what about other rule dsl's? (@see ResourceType)
        if (knowledgeBuilder==null) {
          knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        }
        ResourceEntity resourceEntity = resources.get(resourceName);
        byte[] resourceBytes = resourceEntity.getBytes();
        Resource droolsResource = ResourceFactory.newByteArrayResource(resourceBytes);
        knowledgeBuilder.add(droolsResource, ResourceType.DRL);
      }
    }
   
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 ActivitiException("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 ActivitiException("text is null");
    }
    ResourceEntity resource = new ResourceEntity();
    resource.setName(resourceName);
    resource.setBytes(text.getBytes());
    deployment.addResource(resource);
    return this;
  }
View Full Code Here

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

      ZipEntry entry = zipInputStream.getNextEntry();
      while (entry != null) {
        if (!entry.isDirectory()) {
          String entryName = entry.getName();
          byte[] bytes = IoUtil.readInputStream(zipInputStream, entryName);
          ResourceEntity resource = new ResourceEntity();
          resource.setName(entryName);
          resource.setBytes(bytes);
          deployment.addResource(resource);
        }
        entry = zipInputStream.getNextEntry();
      }
    } catch (Exception e) {
View Full Code Here

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

      log.info("Processing resource " + resourceName);
      if (resourceName.endsWith(".drl")) { // is only parsing .drls sufficient? what about other rule dsl's? (@see ResourceType)
        if (knowledgeBuilder==null) {
          knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        }
        ResourceEntity resourceEntity = resources.get(resourceName);
        byte[] resourceBytes = resourceEntity.getBytes();
        Resource droolsResource = ResourceFactory.newByteArrayResource(resourceBytes);
        knowledgeBuilder.add(droolsResource, ResourceType.DRL);
      }
    }
   
View Full Code Here

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

    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
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.