use of org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity in project carbon-business-process by wso2.
the class ProcessKPIParseHandler method executeParse.
@Override
protected void executeParse(BpmnParse bpmnParse, BaseElement baseElement) {
ProcessDefinitionEntity processDefinitionEntity = bpmnParse.getCurrentProcessDefinition();
// We have to check if the data publishing KPI listener has already been associated at server startup.
ExecutionListener processTerminationKPIListener = null;
List<ExecutionListener> endListeners = processDefinitionEntity.getExecutionListeners(PvmEvent.EVENTNAME_END);
if (endListeners != null) {
for (ExecutionListener listener : endListeners) {
if (listener instanceof ProcessTerminationKPIListener) {
processTerminationKPIListener = listener;
}
}
}
if (processTerminationKPIListener == null) {
if (log.isDebugEnabled()) {
log.debug("Enabling data publishing for process: " + processDefinitionEntity.getName());
}
processDefinitionEntity.addExecutionListener(PvmEvent.EVENTNAME_END, new ProcessTerminationKPIListener());
}
}
use of org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity in project carbon-business-process by wso2.
the class ProcessParseHandler method executeParse.
@Override
protected void executeParse(BpmnParse bpmnParse, BaseElement baseElement) {
ProcessDefinitionEntity processDefinitionEntity = bpmnParse.getCurrentProcessDefinition();
// We have to check if the data publishing listener has already been associated at server startup.
ExecutionListener processTerminationListener = null;
List<ExecutionListener> endListeners = processDefinitionEntity.getExecutionListeners(PvmEvent.EVENTNAME_END);
if (endListeners != null) {
for (ExecutionListener listener : endListeners) {
if (listener instanceof ProcessTerminationListener) {
processTerminationListener = listener;
break;
}
}
}
if (processTerminationListener == null) {
if (log.isDebugEnabled()) {
log.debug("Enabling data publishing for process: " + processDefinitionEntity.getName());
}
processDefinitionEntity.addExecutionListener(PvmEvent.EVENTNAME_END, new ProcessTerminationListener());
}
}
use of org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity in project CzechIdMng by bcvsolutions.
the class DefaultWorkflowHistoricProcessInstanceService method getDiagram.
/**
* Generate diagram for process instance. Highlight historic path (activity
* and flows)
*/
@Override
public InputStream getDiagram(String processInstanceId) {
if (processInstanceId == null) {
throw new ActivitiIllegalArgumentException("No process instance id provided");
}
HistoricProcessInstance pi = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
if (pi == null) {
throw new ActivitiObjectNotFoundException("Process instance with id " + processInstanceId + " could not be found", ProcessInstance.class);
}
ProcessDefinitionEntity pde = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(pi.getProcessDefinitionId());
if (pde != null && pde.isGraphicalNotationDefined()) {
BpmnModel bpmnModel = repositoryService.getBpmnModel(pde.getId());
List<String> historicActivityInstanceList = new ArrayList<String>();
List<String> highLightedFlows = new ArrayList<String>();
historicActivityInstanceList = getHighLightedFlows(bpmnModel, processInstanceId, historicActivityInstanceList, highLightedFlows);
ProcessDiagramGenerator diagramGenerator = new DefaultProcessDiagramGenerator();
return diagramGenerator.generateDiagram(bpmnModel, "png", historicActivityInstanceList, highLightedFlows);
} else {
throw new ActivitiException("Process instance with id " + processInstanceId + " has no graphic description");
}
}
use of org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity in project Activiti by Activiti.
the class AbstractSetProcessDefinitionStateCmd method changeProcessDefinitionState.
protected void changeProcessDefinitionState(CommandContext commandContext, List<ProcessDefinitionEntity> processDefinitions) {
for (ProcessDefinitionEntity processDefinition : processDefinitions) {
SuspensionStateUtil.setSuspensionState(processDefinition, getProcessDefinitionSuspensionState());
// Evict cache
commandContext.getProcessEngineConfiguration().getDeploymentManager().getProcessDefinitionCache().remove(processDefinition.getId());
// Suspend process instances (if needed)
if (includeProcessInstances) {
int currentStartIndex = 0;
List<ProcessInstance> processInstances = fetchProcessInstancesPage(commandContext, processDefinition, currentStartIndex);
while (!processInstances.isEmpty()) {
for (ProcessInstance processInstance : processInstances) {
AbstractSetProcessInstanceStateCmd processInstanceCmd = getProcessInstanceChangeStateCmd(processInstance);
processInstanceCmd.execute(commandContext);
}
// Fetch new batch of process instances
currentStartIndex += processInstances.size();
processInstances = fetchProcessInstancesPage(commandContext, processDefinition, currentStartIndex);
}
}
}
}
use of org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity in project Activiti by Activiti.
the class DeleteIdentityLinkForProcessDefinitionCmd method execute.
public Void execute(CommandContext commandContext) {
ProcessDefinitionEntity processDefinition = commandContext.getProcessDefinitionEntityManager().findById(processDefinitionId);
if (processDefinition == null) {
throw new ActivitiObjectNotFoundException("Cannot find process definition with id " + processDefinitionId, ProcessDefinition.class);
}
commandContext.getIdentityLinkEntityManager().deleteIdentityLink(processDefinition, userId, groupId);
return null;
}
Aggregations