Search in sources :

Example 16 with ResourceEntity

use of org.camunda.bpm.engine.impl.persistence.entity.ResourceEntity in project camunda-bpm-platform by camunda.

the class DeployCmd method ensureResourcesWithIdsExist.

protected void ensureResourcesWithIdsExist(String deploymentId, Set<String> expectedIds, List<ResourceEntity> actual) {
    Map<String, ResourceEntity> resources = new HashMap<String, ResourceEntity>();
    for (ResourceEntity resource : actual) {
        resources.put(resource.getId(), resource);
    }
    ensureResourcesWithKeysExist(deploymentId, expectedIds, resources, "id");
}
Also used : HashMap(java.util.HashMap) ResourceEntity(org.camunda.bpm.engine.impl.persistence.entity.ResourceEntity)

Example 17 with ResourceEntity

use of org.camunda.bpm.engine.impl.persistence.entity.ResourceEntity in project camunda-bpm-platform by camunda.

the class GetDeploymentResourceForIdCmd method execute.

public InputStream execute(CommandContext commandContext) {
    ensureNotNull("deploymentId", deploymentId);
    ensureNotNull("resourceId", resourceId);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkReadDeployment(deploymentId);
    }
    ResourceEntity resource = commandContext.getResourceManager().findResourceByDeploymentIdAndResourceId(deploymentId, resourceId);
    ensureNotNull("no resource found with id '" + resourceId + "' in deployment '" + deploymentId + "'", "resource", resource);
    return new ByteArrayInputStream(resource.getBytes());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ResourceEntity(org.camunda.bpm.engine.impl.persistence.entity.ResourceEntity) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker)

Example 18 with ResourceEntity

use of org.camunda.bpm.engine.impl.persistence.entity.ResourceEntity in project camunda-bpm-platform by camunda.

the class GetDeploymentResourceCmd method execute.

public InputStream execute(CommandContext commandContext) {
    ensureNotNull("deploymentId", deploymentId);
    ensureNotNull("resourceName", resourceName);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkReadDeployment(deploymentId);
    }
    ResourceEntity resource = commandContext.getResourceManager().findResourceByDeploymentIdAndResourceName(deploymentId, resourceName);
    ensureNotNull(DeploymentResourceNotFoundException.class, "no resource found with name '" + resourceName + "' in deployment '" + deploymentId + "'", "resource", resource);
    return new ByteArrayInputStream(resource.getBytes());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ResourceEntity(org.camunda.bpm.engine.impl.persistence.entity.ResourceEntity) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker)

Example 19 with ResourceEntity

use of org.camunda.bpm.engine.impl.persistence.entity.ResourceEntity in project camunda-bpm-platform by camunda.

the class CacheDeployer method initDeployment.

protected void initDeployment(final DeploymentEntity deployment, String... resourceNames) {
    deployment.clearResources();
    for (String resourceName : resourceNames) {
        if (resourceName != null) {
            // with the given resource we prevent the deployment of querying
            // the database which means using all resources that were utilized during the deployment
            ResourceEntity resource = Context.getCommandContext().getResourceManager().findResourceByDeploymentIdAndResourceName(deployment.getId(), resourceName);
            deployment.addResource(resource);
        }
    }
}
Also used : ResourceEntity(org.camunda.bpm.engine.impl.persistence.entity.ResourceEntity)

Aggregations

ResourceEntity (org.camunda.bpm.engine.impl.persistence.entity.ResourceEntity)19 HashMap (java.util.HashMap)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 ArrayList (java.util.ArrayList)3 NotValidException (org.camunda.bpm.engine.exception.NotValidException)3 DeploymentEntity (org.camunda.bpm.engine.impl.persistence.entity.DeploymentEntity)3 InputStream (java.io.InputStream)2 HashSet (java.util.HashSet)2 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)2 DeploymentManager (org.camunda.bpm.engine.impl.persistence.entity.DeploymentManager)2 ResourceManager (org.camunda.bpm.engine.impl.persistence.entity.ResourceManager)2 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 OutputStream (java.io.OutputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Map (java.util.Map)1 Set (java.util.Set)1 ProcessApplicationRegistration (org.camunda.bpm.application.ProcessApplicationRegistration)1 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)1