use of org.camunda.bpm.engine.ProcessEngine in project camunda-bpm-platform by camunda.
the class UndeployProcessArchiveStep method performOperationStep.
public void performOperationStep(DeploymentOperation operationContext) {
final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
final Map<String, DeployedProcessArchive> processArchiveDeploymentMap = deployedProcessApplication.getProcessArchiveDeploymentMap();
final DeployedProcessArchive deployedProcessArchive = processArchiveDeploymentMap.get(processArchive.getName());
final ProcessEngine processEngine = serviceContainer.getServiceValue(ServiceTypes.PROCESS_ENGINE, processEngineName);
// unregrister with the process engine.
processEngine.getManagementService().unregisterProcessApplication(deployedProcessArchive.getAllDeploymentIds(), true);
// delete the deployment if not disabled
if (PropertyHelper.getBooleanProperty(processArchive.getProperties(), ProcessArchiveXml.PROP_IS_DELETE_UPON_UNDEPLOY, false)) {
if (processEngine != null) {
// always cascade & skip custom listeners
deleteDeployment(deployedProcessArchive.getPrimaryDeploymentId(), processEngine.getRepositoryService());
}
}
}
use of org.camunda.bpm.engine.ProcessEngine in project camunda-bpm-platform by camunda.
the class DeployProcessArchiveStep method getProcessEngine.
protected ProcessEngine getProcessEngine(final PlatformServiceContainer serviceContainer) {
String processEngineName = processArchive.getProcessEngineName();
if (processEngineName != null) {
ProcessEngine processEngine = serviceContainer.getServiceValue(ServiceTypes.PROCESS_ENGINE, processEngineName);
ensureNotNull("Cannot deploy process archive '" + processArchive.getName() + "' to process engine '" + processEngineName + "' no such process engine exists", "processEngine", processEngine);
return processEngine;
} else {
ProcessEngine processEngine = serviceContainer.getServiceValue(ServiceTypes.PROCESS_ENGINE, "default");
ensureNotNull("Cannot deploy process archive '" + processArchive.getName() + "' to default process: no such process engine exists", "processEngine", processEngine);
return processEngine;
}
}
use of org.camunda.bpm.engine.ProcessEngine in project camunda-bpm-platform by camunda.
the class ProcessDefinitionRestServiceImpl method getProcessDefinitionsCount.
@Override
public CountResultDto getProcessDefinitionsCount(UriInfo uriInfo) {
ProcessDefinitionQueryDto queryDto = new ProcessDefinitionQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
ProcessEngine engine = getProcessEngine();
ProcessDefinitionQuery query = queryDto.toQuery(engine);
long count = query.count();
CountResultDto result = new CountResultDto();
result.setCount(count);
return result;
}
use of org.camunda.bpm.engine.ProcessEngine in project camunda-bpm-platform by camunda.
the class ProcessDefinitionRestServiceImpl method getProcessDefinitions.
@Override
public List<ProcessDefinitionDto> getProcessDefinitions(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
ProcessDefinitionQueryDto queryDto = new ProcessDefinitionQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
List<ProcessDefinitionDto> definitions = new ArrayList<ProcessDefinitionDto>();
ProcessEngine engine = getProcessEngine();
ProcessDefinitionQuery query = queryDto.toQuery(engine);
List<ProcessDefinition> matchingDefinitions = null;
if (firstResult != null || maxResults != null) {
matchingDefinitions = executePaginatedQuery(query, firstResult, maxResults);
} else {
matchingDefinitions = query.list();
}
for (ProcessDefinition definition : matchingDefinitions) {
ProcessDefinitionDto def = ProcessDefinitionDto.fromProcessDefinition(definition);
definitions.add(def);
}
return definitions;
}
use of org.camunda.bpm.engine.ProcessEngine in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceImpl method queryProcessInstances.
@Override
public List<ProcessInstanceDto> queryProcessInstances(ProcessInstanceQueryDto queryDto, Integer firstResult, Integer maxResults) {
ProcessEngine engine = getProcessEngine();
queryDto.setObjectMapper(getObjectMapper());
ProcessInstanceQuery query = queryDto.toQuery(engine);
List<ProcessInstance> matchingInstances;
if (firstResult != null || maxResults != null) {
matchingInstances = executePaginatedQuery(query, firstResult, maxResults);
} else {
matchingInstances = query.list();
}
List<ProcessInstanceDto> instanceResults = new ArrayList<ProcessInstanceDto>();
for (ProcessInstance instance : matchingInstances) {
ProcessInstanceDto resultInstance = ProcessInstanceDto.fromProcessInstance(instance);
instanceResults.add(resultInstance);
}
return instanceResults;
}
Aggregations