use of org.camunda.bpm.engine.impl.persistence.entity.DeploymentEntity in project camunda-bpm-platform by camunda.
the class DeployCmd method addResources.
protected void addResources(List<ResourceEntity> resources, DeploymentBuilderImpl deploymentBuilder) {
DeploymentEntity deployment = deploymentBuilder.getDeployment();
Map<String, ResourceEntity> existingResources = deployment.getResources();
for (ResourceEntity resource : resources) {
String resourceName = resource.getName();
if (existingResources != null && existingResources.containsKey(resourceName)) {
String message = String.format("Cannot add resource with id '%s' and name '%s' from " + "deployment with id '%s' to new deployment because the new deployment contains " + "already a resource with same name.", resource.getId(), resourceName, resource.getDeploymentId());
throw new NotValidException(message);
}
ByteArrayInputStream inputStream = new ByteArrayInputStream(resource.getBytes());
deploymentBuilder.addInputStream(resourceName, inputStream);
}
}
use of org.camunda.bpm.engine.impl.persistence.entity.DeploymentEntity in project camunda-bpm-platform by camunda.
the class DeployCmd method getResourcesByDeploymentId.
protected List<ResourceEntity> getResourcesByDeploymentId(Set<String> deploymentIds, CommandContext commandContext) {
List<ResourceEntity> result = new ArrayList<ResourceEntity>();
if (!deploymentIds.isEmpty()) {
DeploymentManager deploymentManager = commandContext.getDeploymentManager();
for (String deploymentId : deploymentIds) {
DeploymentEntity deployment = deploymentManager.findDeploymentById(deploymentId);
Map<String, ResourceEntity> resources = deployment.getResources();
Collection<ResourceEntity> values = resources.values();
result.addAll(values);
}
}
return result;
}
use of org.camunda.bpm.engine.impl.persistence.entity.DeploymentEntity in project camunda-bpm-platform by camunda.
the class DeployCmd method setDeploymentName.
protected void setDeploymentName(String deploymentId, DeploymentBuilderImpl deploymentBuilder, CommandContext commandContext) {
if (deploymentId != null && !deploymentId.isEmpty()) {
DeploymentManager deploymentManager = commandContext.getDeploymentManager();
DeploymentEntity deployment = deploymentManager.findDeploymentById(deploymentId);
deploymentBuilder.getDeployment().setName(deployment.getName());
}
}
use of org.camunda.bpm.engine.impl.persistence.entity.DeploymentEntity in project camunda-bpm-platform by camunda.
the class DeployCmd method initDeployment.
protected DeploymentEntity initDeployment() {
DeploymentEntity deployment = deploymentBuilder.getDeployment();
deployment.setDeploymentTime(ClockUtil.getCurrentTime());
return deployment;
}
use of org.camunda.bpm.engine.impl.persistence.entity.DeploymentEntity in project camunda-bpm-platform by camunda.
the class ProcessApplicationManager method logRegistration.
// logger ////////////////////////////////////////////////////////////////////////////
protected void logRegistration(Set<String> deploymentIds, ProcessApplicationReference reference) {
if (!LOG.isInfoEnabled()) {
// building the log message is expensive (db queries) so we avoid it if we can
return;
}
try {
StringBuilder builder = new StringBuilder();
builder.append("ProcessApplication '");
builder.append(reference.getName());
builder.append("' registered for DB deployments ");
builder.append(deploymentIds);
builder.append(". ");
List<ProcessDefinition> processDefinitions = new ArrayList<ProcessDefinition>();
List<CaseDefinition> caseDefinitions = new ArrayList<CaseDefinition>();
CommandContext commandContext = Context.getCommandContext();
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
boolean cmmnEnabled = processEngineConfiguration.isCmmnEnabled();
for (String deploymentId : deploymentIds) {
DeploymentEntity deployment = commandContext.getDbEntityManager().selectById(DeploymentEntity.class, deploymentId);
if (deployment != null) {
processDefinitions.addAll(getDeployedProcessDefinitionArtifacts(deployment));
if (cmmnEnabled) {
caseDefinitions.addAll(getDeployedCaseDefinitionArtifacts(deployment));
}
}
}
logProcessDefinitionRegistrations(builder, processDefinitions);
if (cmmnEnabled) {
logCaseDefinitionRegistrations(builder, caseDefinitions);
}
LOG.registrationSummary(builder.toString());
} catch (Throwable e) {
LOG.exceptionWhileLoggingRegistrationSummary(e);
}
}
Aggregations