// get process engine
ProcessEngine processEngine = processEngineInjector.getValue();
// get the process application component
ProcessApplicationInterface processApplication = null;
ComponentView componentView = paComponentViewInjector.getOptionalValue();
if(componentView != null) {
reference = componentView.createInstance();
processApplication = (ProcessApplicationInterface) reference.getInstance();
} else {
processApplication = noViewProcessApplication.getValue();
}
// get the application name
String processApplicationName = processApplication.getName();
// build the deployment
final RepositoryService repositoryService = processEngine.getRepositoryService();
final ProcessApplicationDeploymentBuilder deploymentBuilder = repositoryService.createDeployment(processApplication.getReference());
// enable duplicate filtering
deploymentBuilder.enableDuplicateFiltering(PropertyHelper.getBooleanProperty(processArchive.getProperties(), ProcessArchiveXml.PROP_IS_DEPLOY_CHANGED_ONLY, false));
// enable resuming of previous versions:
if(PropertyHelper.getBooleanProperty(processArchive.getProperties(), ProcessArchiveXml.PROP_IS_RESUME_PREVIOUS_VERSIONS, true)) {
deploymentBuilder.resumePreviousVersions();
}
// set the name for the deployment
String deploymentName = processArchive.getName();
if(deploymentName == null || deploymentName.isEmpty()) {
deploymentName = processApplicationName;
}
deploymentBuilder.name(deploymentName);
// add deployment resources
for (Entry<String, byte[]> resource : deploymentMap.entrySet()) {
deploymentBuilder.addInputStream(resource.getKey(), new ByteArrayInputStream(resource.getValue()));
}
// let the process application component add resources to the deployment.
processApplication.createDeployment(processArchive.getName(), deploymentBuilder);
Collection<String> resourceNames = deploymentBuilder.getResourceNames();
if(!resourceNames.isEmpty()) {
logDeploymentSummary(resourceNames, deploymentName, processApplicationName);
// perform the actual deployment