use of org.activiti.engine.ProcessEngineConfiguration in project Activiti by Activiti.
the class SimpleTableEditor method showDiagram.
protected void showDiagram() {
StreamResource.StreamSource streamSource = new StreamSource() {
private static final long serialVersionUID = 6993112534181068935L;
public InputStream getStream() {
WorkflowDefinitionConversion workflowDefinitionConversion = ExplorerApp.get().getWorkflowDefinitionConversionFactory().createWorkflowDefinitionConversion(createWorkflow());
final ProcessEngineImpl defaultProcessEngine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine();
final ProcessEngineConfiguration processEngineConfiguration = defaultProcessEngine.getProcessEngineConfiguration();
final ProcessDiagramGenerator diagramGenerator = processEngineConfiguration.getProcessDiagramGenerator();
return diagramGenerator.generateDiagram(workflowDefinitionConversion.getBpmnModel(), "png", processEngineConfiguration.getActivityFontName(), processEngineConfiguration.getLabelFontName(), processEngineConfiguration.getAnnotationFontName(), processEngineConfiguration.getClassLoader());
}
};
// resource must have unique id (or cache-crap can happen)!
StreamResource imageresource = new StreamResource(streamSource, UUID.randomUUID() + ".png", ExplorerApp.get());
Embedded diagram = new Embedded("", imageresource);
diagram.setType(Embedded.TYPE_IMAGE);
diagram.setSizeUndefined();
// using panel for scrollbars
imagePanel = new Panel();
imagePanel.setScrollable(true);
imagePanel.addStyleName(Reindeer.PANEL_LIGHT);
imagePanel.setWidth(100, UNITS_PERCENTAGE);
imagePanel.setHeight("100%");
mainLayout.addComponent(imagePanel);
HorizontalLayout panelLayout = new HorizontalLayout();
panelLayout.setSizeUndefined();
imagePanel.setContent(panelLayout);
imagePanel.addComponent(diagram);
}
use of org.activiti.engine.ProcessEngineConfiguration in project Activiti by Activiti.
the class EventSubscriptionEntity method scheduleEventAsync.
protected void scheduleEventAsync(Serializable payload) {
final CommandContext commandContext = Context.getCommandContext();
MessageEntity message = new MessageEntity();
message.setJobHandlerType(ProcessEventJobHandler.TYPE);
message.setJobHandlerConfiguration(id);
message.setTenantId(getTenantId());
GregorianCalendar expireCal = new GregorianCalendar();
ProcessEngineConfiguration processEngineConfig = Context.getCommandContext().getProcessEngineConfiguration();
expireCal.setTime(processEngineConfig.getClock().getCurrentTime());
expireCal.add(Calendar.SECOND, processEngineConfig.getLockTimeAsyncJobWaitTime());
message.setLockExpirationTime(expireCal.getTime());
// TODO: support payload
// if(payload != null) {
// message.setEventPayload(payload);
// }
commandContext.getJobEntityManager().send(message);
}
use of org.activiti.engine.ProcessEngineConfiguration in project Activiti by Activiti.
the class ExecutionEntity method scheduleAtomicOperationAsync.
protected void scheduleAtomicOperationAsync(AtomicOperation executionOperation) {
MessageEntity message = new MessageEntity();
message.setExecution(this);
message.setExclusive(getActivity().isExclusive());
message.setJobHandlerType(AsyncContinuationJobHandler.TYPE);
// At the moment, only AtomicOperationTransitionCreateScope can be performed asynchronously,
// so there is no need to pass it to the handler
GregorianCalendar expireCal = new GregorianCalendar();
ProcessEngineConfiguration processEngineConfig = Context.getCommandContext().getProcessEngineConfiguration();
expireCal.setTime(processEngineConfig.getClock().getCurrentTime());
expireCal.add(Calendar.SECOND, processEngineConfig.getLockTimeAsyncJobWaitTime());
message.setLockExpirationTime(expireCal.getTime());
// Inherit tenant id (if applicable)
if (getTenantId() != null) {
message.setTenantId(getTenantId());
}
Context.getCommandContext().getJobEntityManager().send(message);
}
use of org.activiti.engine.ProcessEngineConfiguration in project Activiti by Activiti.
the class AdminRunningInstancesPanel method addProcessImage.
protected void addProcessImage(ProcessDefinition processDefinition, HistoricProcessInstance processInstance) {
if (currentEmbedded != null) {
mainPanel.removeComponent(currentEmbedded);
}
ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processDefinition.getId());
// Only show when graphical notation is defined
if (processDefinitionEntity != null && processDefinitionEntity.isGraphicalNotationDefined()) {
if (imageHeader == null) {
imageHeader = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM));
imageHeader.addStyleName(ExplorerLayout.STYLE_H3);
imageHeader.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
imageHeader.addStyleName(ExplorerLayout.STYLE_NO_LINE);
addDetailComponent(imageHeader);
}
ProcessEngineConfiguration processEngineConfig = ((ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine()).getProcessEngineConfiguration();
ProcessDiagramGenerator diagramGenerator = processEngineConfig.getProcessDiagramGenerator();
StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder().buildStreamResource(processInstance.getId(), processInstance.getProcessDefinitionId(), repositoryService, runtimeService, diagramGenerator, processEngineConfig);
currentEmbedded = new Embedded(null, diagram);
currentEmbedded.setType(Embedded.TYPE_IMAGE);
addDetailComponent(currentEmbedded);
}
}
use of org.activiti.engine.ProcessEngineConfiguration in project tutorials by eugenp.
the class ProcessEngineCreationIntegrationTest method givenDifferentBeanNameInXMLConfig_whenGetProcessEngineConfig_thenGotResult.
@Test
public void givenDifferentBeanNameInXMLConfig_whenGetProcessEngineConfig_thenGotResult() {
ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("my.activiti.cfg.xml", "myProcessEngineConfiguration");
ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
assertNotNull(processEngine);
assertEquals("baeldung", processEngine.getProcessEngineConfiguration().getJdbcUsername());
}
Aggregations