org.camunda.bpm.engine.impl.history.event.HistoricProcessInstanceEventEntity Java Examples
The following examples show how to use
org.camunda.bpm.engine.impl.history.event.HistoricProcessInstanceEventEntity.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DbDeadlockTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override protected void tearDown() throws Exception { // end interaction with Thread 2 thread2.waitUntilDone(); // end interaction with Thread 1 thread1.waitUntilDone(); processEngineConfiguration.getCommandExecutorTxRequired() .execute(new Command<Void>() { public Void execute(CommandContext commandContext) { List<HistoricProcessInstance> list = commandContext.getDbEntityManager().createHistoricProcessInstanceQuery().list(); for (HistoricProcessInstance historicProcessInstance : list) { commandContext.getDbEntityManager().delete(HistoricProcessInstanceEventEntity.class, "deleteHistoricProcessInstance", historicProcessInstance.getId()); } return null; } }); }
Example #2
Source File: DbDeadlockTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public Void execute(CommandContext commandContext) { DbEntityManagerFactory dbEntityManagerFactory = new DbEntityManagerFactory(Context.getProcessEngineConfiguration().getIdGenerator()); DbEntityManager newEntityManager = dbEntityManagerFactory.openSession(); HistoricProcessInstanceEventEntity hpi = new HistoricProcessInstanceEventEntity(); hpi.setId(id); hpi.setProcessInstanceId(id); hpi.setProcessDefinitionId("someProcDefId"); hpi.setStartTime(new Date()); hpi.setState(HistoricProcessInstance.STATE_ACTIVE); newEntityManager.insert(hpi); newEntityManager.flush(); monitor.sync(); DbEntityManager cmdEntityManager = commandContext.getDbEntityManager(); cmdEntityManager.createHistoricProcessInstanceQuery().list(); monitor.sync(); return null; }
Example #3
Source File: DefaultHistoryRemovalTimeProvider.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public Date calculateRemovalTime(HistoricProcessInstanceEventEntity historicRootProcessInstance, ProcessDefinition processDefinition) { Integer historyTimeToLive = processDefinition.getHistoryTimeToLive(); if (historyTimeToLive != null) { if (isProcessInstanceRunning(historicRootProcessInstance)) { Date startTime = historicRootProcessInstance.getStartTime(); return determineRemovalTime(startTime, historyTimeToLive); } else if (isProcessInstanceEnded(historicRootProcessInstance)) { Date endTime = historicRootProcessInstance.getEndTime(); return determineRemovalTime(endTime, historyTimeToLive); } } return null; }
Example #4
Source File: DefaultHistoryEventProducer.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override public HistoryEvent createProcessInstanceMigrateEvt(DelegateExecution execution) { final ExecutionEntity executionEntity = (ExecutionEntity) execution; // create event instance HistoricProcessInstanceEventEntity evt = newProcessInstanceEventEntity(executionEntity); // initialize event initProcessInstanceEvent(evt, executionEntity, HistoryEventTypes.PROCESS_INSTANCE_MIGRATE); if (executionEntity.isSuspended()) { evt.setState(HistoricProcessInstance.STATE_SUSPENDED); } else { evt.setState(HistoricProcessInstance.STATE_ACTIVE); } return evt; }
Example #5
Source File: AbstractSetProcessInstanceStateCmd.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override protected void triggerHistoryEvent(CommandContext commandContext){ HistoryLevel historyLevel = commandContext.getProcessEngineConfiguration().getHistoryLevel(); List<ProcessInstance> updatedProcessInstances = obtainProcessInstances(commandContext); //suspension state is not updated synchronously if (getNewSuspensionState() != null && updatedProcessInstances != null) { for (final ProcessInstance processInstance: updatedProcessInstances) { if (historyLevel.isHistoryEventProduced(HistoryEventTypes.PROCESS_INSTANCE_UPDATE, processInstance)) { HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() { @Override public HistoryEvent createHistoryEvent(HistoryEventProducer producer) { HistoricProcessInstanceEventEntity processInstanceUpdateEvt = (HistoricProcessInstanceEventEntity) producer.createProcessInstanceUpdateEvt((DelegateExecution) processInstance); if (SuspensionState.SUSPENDED.getStateCode() == getNewSuspensionState().getStateCode()) { processInstanceUpdateEvt.setState(HistoricProcessInstance.STATE_SUSPENDED); } else { processInstanceUpdateEvt.setState(HistoricProcessInstance.STATE_ACTIVE); } return processInstanceUpdateEvt; } }); } } } }
Example #6
Source File: DefaultHistoryEventProducer.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public HistoryEvent createProcessInstanceUpdateEvt(DelegateExecution execution) { final ExecutionEntity executionEntity = (ExecutionEntity) execution; // create event instance HistoricProcessInstanceEventEntity evt = loadProcessInstanceEventEntity(executionEntity); // initialize event initProcessInstanceEvent(evt, executionEntity, HistoryEventTypes.PROCESS_INSTANCE_UPDATE); if (executionEntity.isSuspended()) { evt.setState(HistoricProcessInstance.STATE_SUSPENDED); } else { evt.setState(HistoricProcessInstance.STATE_ACTIVE); } return evt; }
Example #7
Source File: ElasticSearchDefaultIndexStrategy.java From camunda-bpm-elasticsearch with Apache License 2.0 | 5 votes |
protected boolean filterEvents(HistoryEvent historyEvent) { if (historyEvent instanceof HistoricProcessInstanceEventEntity || historyEvent instanceof HistoricActivityInstanceEventEntity || historyEvent instanceof HistoricTaskInstanceEventEntity || historyEvent instanceof HistoricVariableUpdateEventEntity) { return false; } return true; }
Example #8
Source File: DefaultHistoryEventProducer.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void provideRemovalTime(HistoryEvent historyEvent) { String rootProcessInstanceId = historyEvent.getRootProcessInstanceId(); if (rootProcessInstanceId != null) { HistoricProcessInstanceEventEntity historicRootProcessInstance = getHistoricRootProcessInstance(rootProcessInstanceId); if (historicRootProcessInstance != null) { Date removalTime = historicRootProcessInstance.getRemovalTime(); historyEvent.setRemovalTime(removalTime); } } }
Example #9
Source File: DefaultHistoryEventProducer.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected Date calculateRemovalTime(HistoryEvent historyEvent) { String processDefinitionId = historyEvent.getProcessDefinitionId(); ProcessDefinition processDefinition = findProcessDefinitionById(processDefinitionId); return Context.getProcessEngineConfiguration() .getHistoryRemovalTimeProvider() .calculateRemovalTime((HistoricProcessInstanceEventEntity) historyEvent, processDefinition); }
Example #10
Source File: DefaultHistoryEventProducer.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void determineEndState(ExecutionEntity executionEntity, HistoricProcessInstanceEventEntity evt) { //determine state if (executionEntity.getActivity() != null) { evt.setState(HistoricProcessInstance.STATE_COMPLETED); } else { if (executionEntity.isExternallyTerminated()) { evt.setState(HistoricProcessInstance.STATE_EXTERNALLY_TERMINATED); } else if (!executionEntity.isExternallyTerminated()) { evt.setState(HistoricProcessInstance.STATE_INTERNALLY_TERMINATED); } } }
Example #11
Source File: DefaultHistoryEventProducer.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public HistoryEvent createProcessInstanceEndEvt(DelegateExecution execution) { final ExecutionEntity executionEntity = (ExecutionEntity) execution; // create event instance HistoricProcessInstanceEventEntity evt = loadProcessInstanceEventEntity(executionEntity); // initialize event initProcessInstanceEvent(evt, executionEntity, HistoryEventTypes.PROCESS_INSTANCE_END); determineEndState(executionEntity, evt); // set end activity id evt.setEndActivityId(executionEntity.getActivityId()); evt.setEndTime(ClockUtil.getCurrentTime()); if(evt.getStartTime() != null) { evt.setDurationInMillis(evt.getEndTime().getTime()-evt.getStartTime().getTime()); } if (isRootProcessInstance(evt) && isHistoryRemovalTimeStrategyEnd()) { Date removalTime = calculateRemovalTime(evt); if (removalTime != null) { addRemovalTimeToHistoricProcessInstances(evt.getRootProcessInstanceId(), removalTime); if (isDmnEnabled()) { addRemovalTimeToHistoricDecisions(evt.getRootProcessInstanceId(), removalTime); } } } // set delete reason (if applicable). if (executionEntity.getDeleteReason() != null) { evt.setDeleteReason(executionEntity.getDeleteReason()); } return evt; }
Example #12
Source File: DefaultHistoryEventProducer.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public HistoryEvent createProcessInstanceStartEvt(DelegateExecution execution) { final ExecutionEntity executionEntity = (ExecutionEntity) execution; // create event instance HistoricProcessInstanceEventEntity evt = newProcessInstanceEventEntity(executionEntity); // initialize event initProcessInstanceEvent(evt, executionEntity, HistoryEventTypes.PROCESS_INSTANCE_START); evt.setStartActivityId(executionEntity.getActivityId()); evt.setStartTime(ClockUtil.getCurrentTime()); // set super process instance id ExecutionEntity superExecution = executionEntity.getSuperExecution(); if (superExecution != null) { evt.setSuperProcessInstanceId(superExecution.getProcessInstanceId()); } //state evt.setState(HistoricProcessInstance.STATE_ACTIVE); // set start user Id evt.setStartUserId(Context.getCommandContext().getAuthenticatedUserId()); if (isHistoryRemovalTimeStrategyStart()) { if (isRootProcessInstance(evt)) { Date removalTime = calculateRemovalTime(evt); evt.setRemovalTime(removalTime); } else { provideRemovalTime(evt); } } return evt; }
Example #13
Source File: DefaultHistoryEventProducer.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void initProcessInstanceEvent(HistoricProcessInstanceEventEntity evt, ExecutionEntity execution, HistoryEventType eventType) { String processDefinitionId = execution.getProcessDefinitionId(); String processInstanceId = execution.getProcessInstanceId(); String executionId = execution.getId(); // the given execution is the process instance! String caseInstanceId = execution.getCaseInstanceId(); String tenantId = execution.getTenantId(); ProcessDefinitionEntity definition = execution.getProcessDefinition(); String processDefinitionKey = null; if (definition != null) { processDefinitionKey = definition.getKey(); } evt.setId(processInstanceId); evt.setEventType(eventType.getEventName()); evt.setProcessDefinitionKey(processDefinitionKey); evt.setProcessDefinitionId(processDefinitionId); evt.setProcessInstanceId(processInstanceId); evt.setExecutionId(executionId); evt.setBusinessKey(execution.getProcessBusinessKey()); evt.setCaseInstanceId(caseInstanceId); evt.setTenantId(tenantId); evt.setRootProcessInstanceId(execution.getRootProcessInstanceId()); if (execution.getSuperCaseExecution() != null) { evt.setSuperCaseInstanceId(execution.getSuperCaseExecution().getCaseInstanceId()); } if (execution.getSuperExecution() != null) { evt.setSuperProcessInstanceId(execution.getSuperExecution().getProcessInstanceId()); } }
Example #14
Source File: DefaultDmnHistoryEventProducer.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void provideRemovalTime(HistoryEvent historyEvent) { String rootProcessInstanceId = historyEvent.getRootProcessInstanceId(); if (rootProcessInstanceId != null) { HistoricProcessInstanceEventEntity historicRootProcessInstance = getHistoricRootProcessInstance(rootProcessInstanceId); if (historicRootProcessInstance != null) { Date removalTime = historicRootProcessInstance.getRemovalTime(); historyEvent.setRemovalTime(removalTime); } } }
Example #15
Source File: CreateAttachmentCmd.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void provideRemovalTime(AttachmentEntity attachment) { String rootProcessInstanceId = attachment.getRootProcessInstanceId(); if (rootProcessInstanceId != null) { HistoricProcessInstanceEventEntity historicRootProcessInstance = getHistoricRootProcessInstance(rootProcessInstanceId); if (historicRootProcessInstance != null) { Date removalTime = historicRootProcessInstance.getRemovalTime(); attachment.setRemovalTime(removalTime); } } }
Example #16
Source File: AddCommentCmd.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void provideRemovalTime(CommentEntity comment) { String rootProcessInstanceId = comment.getRootProcessInstanceId(); if (rootProcessInstanceId != null) { HistoricProcessInstanceEventEntity historicRootProcessInstance = getHistoricRootProcessInstance(rootProcessInstanceId); if (historicRootProcessInstance != null) { Date removalTime = historicRootProcessInstance.getRemovalTime(); comment.setRemovalTime(removalTime); } } }
Example #17
Source File: ElasticSearchDefaultIndexStrategy.java From camunda-bpm-elasticsearch with Apache License 2.0 | 5 votes |
protected UpdateRequestBuilder prepareUpdateRequest(HistoryEvent historyEvent) throws IOException { UpdateRequestBuilder updateRequestBuilder = esClient.prepareUpdate() .setIndex(dispatcher.getDispatchTargetIndex(historyEvent)) .setId(historyEvent.getProcessInstanceId()); String dispatchTargetType = dispatcher.getDispatchTargetType(historyEvent); if (dispatchTargetType != null && !dispatchTargetType.isEmpty()) { updateRequestBuilder.setType(dispatchTargetType); } if (historyEvent instanceof HistoricProcessInstanceEventEntity) { prepareHistoricProcessInstanceEventUpdate(historyEvent, updateRequestBuilder); } else if (historyEvent instanceof HistoricActivityInstanceEventEntity || historyEvent instanceof HistoricTaskInstanceEventEntity || historyEvent instanceof HistoricVariableUpdateEventEntity) { updateRequestBuilder = prepareOtherHistoricEventsUpdateRequest(historyEvent, updateRequestBuilder); } else { // unknown event - insert... throw new IllegalArgumentException("Unknown event detected: '" + historyEvent + "'"); // LOGGER.warning("Unknown event detected: '" + historyEvent + "'"); } if (LOGGER.isLoggable(Level.FINE)) { updateRequestBuilder.setFields("_source"); } return updateRequestBuilder; }
Example #18
Source File: HistoricProcessInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test @Deployment(resources = {"org/camunda/bpm/engine/test/history/oneTaskProcess.bpmn20.xml"}) public void testLongRunningHistoricDataCreatedForProcessExecution() { final long ONE_YEAR = 1000 * 60 * 60 * 24 * 365; Calendar cal = Calendar.getInstance(); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); Date now = cal.getTime(); ClockUtil.setCurrentTime(now); final ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", "myBusinessKey"); assertEquals(1, historyService.createHistoricProcessInstanceQuery().unfinished().count()); assertEquals(0, historyService.createHistoricProcessInstanceQuery().finished().count()); HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstance.getId()).singleResult(); assertEquals(now, historicProcessInstance.getStartTime()); List<Task> tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list(); assertEquals(1, tasks.size()); // in this test scenario we assume that one year after the process start, the // user completes the task (incredible speedy!) cal.add(Calendar.YEAR, 1); Date oneYearLater = cal.getTime(); ClockUtil.setCurrentTime(oneYearLater); taskService.complete(tasks.get(0).getId()); historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstance.getId()).singleResult(); assertEquals(now, historicProcessInstance.getStartTime()); assertEquals(oneYearLater, historicProcessInstance.getEndTime()); assertTrue(historicProcessInstance.getDurationInMillis() >= ONE_YEAR); assertTrue(((HistoricProcessInstanceEventEntity)historicProcessInstance).getDurationRaw() >= ONE_YEAR); assertEquals(0, historyService.createHistoricProcessInstanceQuery().unfinished().count()); assertEquals(1, historyService.createHistoricProcessInstanceQuery().finished().count()); }
Example #19
Source File: DefaultDmnHistoryEventProducer.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected HistoricProcessInstanceEventEntity getHistoricRootProcessInstance(String rootProcessInstanceId) { return Context.getCommandContext().getDbEntityManager() .selectById(HistoricProcessInstanceEventEntity.class, rootProcessInstanceId); }
Example #20
Source File: HistoricProcessInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test @Deployment(resources = {"org/camunda/bpm/engine/test/history/oneTaskProcess.bpmn20.xml"}) public void testHistoricDataCreatedForProcessExecution() { Calendar calendar = new GregorianCalendar(); calendar.set(Calendar.YEAR, 2010); calendar.set(Calendar.MONTH, 8); calendar.set(Calendar.DAY_OF_MONTH, 30); calendar.set(Calendar.HOUR_OF_DAY, 12); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); Date noon = calendar.getTime(); ClockUtil.setCurrentTime(noon); final ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", "myBusinessKey"); assertEquals(1, historyService.createHistoricProcessInstanceQuery().unfinished().count()); assertEquals(0, historyService.createHistoricProcessInstanceQuery().finished().count()); HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstance.getId()).singleResult(); assertNotNull(historicProcessInstance); assertEquals(processInstance.getId(), historicProcessInstance.getId()); assertEquals(processInstance.getBusinessKey(), historicProcessInstance.getBusinessKey()); assertEquals(processInstance.getProcessDefinitionId(), historicProcessInstance.getProcessDefinitionId()); assertEquals(noon, historicProcessInstance.getStartTime()); assertNull(historicProcessInstance.getEndTime()); assertNull(historicProcessInstance.getDurationInMillis()); assertNull(historicProcessInstance.getCaseInstanceId()); List<Task> tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list(); assertEquals(1, tasks.size()); // in this test scenario we assume that 25 seconds after the process start, the // user completes the task (yes! he must be almost as fast as me) Date twentyFiveSecsAfterNoon = new Date(noon.getTime() + 25*1000); ClockUtil.setCurrentTime(twentyFiveSecsAfterNoon); taskService.complete(tasks.get(0).getId()); historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstance.getId()).singleResult(); assertNotNull(historicProcessInstance); assertEquals(processInstance.getId(), historicProcessInstance.getId()); assertEquals(processInstance.getProcessDefinitionId(), historicProcessInstance.getProcessDefinitionId()); assertEquals(noon, historicProcessInstance.getStartTime()); assertEquals(twentyFiveSecsAfterNoon, historicProcessInstance.getEndTime()); assertEquals(new Long(25 * 1000), historicProcessInstance.getDurationInMillis()); assertTrue(((HistoricProcessInstanceEventEntity) historicProcessInstance).getDurationRaw() >= 25000); assertNull(historicProcessInstance.getCaseInstanceId()); assertEquals(0, historyService.createHistoricProcessInstanceQuery().unfinished().count()); assertEquals(1, historyService.createHistoricProcessInstanceQuery().finished().count()); runtimeService.startProcessInstanceByKey("oneTaskProcess", "myBusinessKey"); assertEquals(1, historyService.createHistoricProcessInstanceQuery().finished().count()); assertEquals(1, historyService.createHistoricProcessInstanceQuery().unfinished().count()); assertEquals(0, historyService.createHistoricProcessInstanceQuery().finished().unfinished().count()); }
Example #21
Source File: ElasticSearchProcessInstanceHistoryEntity.java From camunda-bpm-elasticsearch with Apache License 2.0 | 4 votes |
public static ElasticSearchProcessInstanceHistoryEntity createFromHistoryEvent(HistoryEvent historyEvent) { ElasticSearchProcessInstanceHistoryEntity esHistoryEntity = new ElasticSearchProcessInstanceHistoryEntity(); esHistoryEntity.setId(historyEvent.getId()); // maybe use process instance id here? esHistoryEntity.setProcessInstanceId(historyEvent.getProcessInstanceId()); if (historyEvent instanceof HistoricProcessInstanceEventEntity) { HistoricProcessInstanceEventEntity pie = (HistoricProcessInstanceEventEntity) historyEvent; esHistoryEntity.setExecutionId(pie.getExecutionId()); esHistoryEntity.setProcessDefinitionId(pie.getProcessDefinitionId()); esHistoryEntity.setStartActivityId(pie.getStartActivityId()); esHistoryEntity.setEndActivityId(pie.getEndActivityId()); esHistoryEntity.setStartTime(pie.getStartTime()); esHistoryEntity.setEndTime(pie.getEndTime()); esHistoryEntity.setDurationInMillis(pie.getDurationInMillis()); esHistoryEntity.setBusinessKey(pie.getBusinessKey()); esHistoryEntity.setStartUserId(pie.getStartUserId()); esHistoryEntity.setDeleteReason(pie.getDeleteReason()); esHistoryEntity.setSuperProcessInstanceId(pie.getSuperProcessInstanceId()); } else if (historyEvent instanceof HistoricActivityInstanceEventEntity) { HistoricActivityInstanceEventEntity aie = (HistoricActivityInstanceEventEntity) historyEvent; esHistoryEntity.addHistoricActivityInstanceEvent(aie); } else if (historyEvent instanceof HistoricTaskInstanceEventEntity) { HistoricTaskInstanceEventEntity tie = (HistoricTaskInstanceEventEntity) historyEvent; esHistoryEntity.addHistoricTaskInstanceEvent(tie); } else if (historyEvent instanceof HistoricVariableUpdateEventEntity) { HistoricVariableUpdateEventEntity vue = (HistoricVariableUpdateEventEntity) historyEvent; esHistoryEntity.addHistoricVariableUpdateEvent(vue); } else { // unknown event - throw exception or return null? } return esHistoryEntity; }
Example #22
Source File: DefaultHistoryRemovalTimeProvider.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected boolean isProcessInstanceEnded(HistoricProcessInstanceEventEntity historicProcessInstance) { return historicProcessInstance.getEndTime() != null; }
Example #23
Source File: DefaultHistoryRemovalTimeProvider.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected boolean isProcessInstanceRunning(HistoricProcessInstanceEventEntity historicProcessInstance) { return historicProcessInstance.getEndTime() == null; }
Example #24
Source File: DefaultAuthorizationProvider.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected HistoryEvent findHistoricProcessInstance(String rootProcessInstanceId) { return Context.getCommandContext() .getDbEntityManager() .selectById(HistoricProcessInstanceEventEntity.class, rootProcessInstanceId); }
Example #25
Source File: DefaultHistoryEventProducer.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected HistoricProcessInstanceEventEntity getHistoricRootProcessInstance(String rootProcessInstanceId) { return Context.getCommandContext() .getDbEntityManager() .selectById(HistoricProcessInstanceEventEntity.class, rootProcessInstanceId); }
Example #26
Source File: HistoricProcessInstanceManager.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public HistoricProcessInstanceEventEntity findHistoricProcessInstanceEvent(String eventId) { if (isHistoryEnabled()) { return getDbEntityManager().selectById(HistoricProcessInstanceEventEntity.class, eventId); } return null; }
Example #27
Source File: HistoricProcessInstanceManager.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public void addRemovalTimeToProcessInstancesByRootProcessInstanceId(String rootProcessInstanceId, Date removalTime) { CommandContext commandContext = Context.getCommandContext(); commandContext.getHistoricActivityInstanceManager() .addRemovalTimeToActivityInstancesByRootProcessInstanceId(rootProcessInstanceId, removalTime); commandContext.getHistoricTaskInstanceManager() .addRemovalTimeToTaskInstancesByRootProcessInstanceId(rootProcessInstanceId, removalTime); commandContext.getHistoricVariableInstanceManager() .addRemovalTimeToVariableInstancesByRootProcessInstanceId(rootProcessInstanceId, removalTime); commandContext.getHistoricDetailManager() .addRemovalTimeToDetailsByRootProcessInstanceId(rootProcessInstanceId, removalTime); commandContext.getHistoricIncidentManager() .addRemovalTimeToIncidentsByRootProcessInstanceId(rootProcessInstanceId, removalTime); commandContext.getHistoricExternalTaskLogManager() .addRemovalTimeToExternalTaskLogByRootProcessInstanceId(rootProcessInstanceId, removalTime); commandContext.getHistoricJobLogManager() .addRemovalTimeToJobLogByRootProcessInstanceId(rootProcessInstanceId, removalTime); commandContext.getOperationLogManager() .addRemovalTimeToUserOperationLogByRootProcessInstanceId(rootProcessInstanceId, removalTime); commandContext.getHistoricIdentityLinkManager() .addRemovalTimeToIdentityLinkLogByRootProcessInstanceId(rootProcessInstanceId, removalTime); commandContext.getCommentManager() .addRemovalTimeToCommentsByRootProcessInstanceId(rootProcessInstanceId, removalTime); commandContext.getAttachmentManager() .addRemovalTimeToAttachmentsByRootProcessInstanceId(rootProcessInstanceId, removalTime); commandContext.getByteArrayManager() .addRemovalTimeToByteArraysByRootProcessInstanceId(rootProcessInstanceId, removalTime); if (isEnableHistoricInstancePermissions()) { commandContext.getAuthorizationManager() .addRemovalTimeToAuthorizationsByRootProcessInstanceId(rootProcessInstanceId, removalTime); } Map<String, Object> parameters = new HashMap<>(); parameters.put("rootProcessInstanceId", rootProcessInstanceId); parameters.put("removalTime", removalTime); getDbEntityManager() .updatePreserveOrder(HistoricProcessInstanceEventEntity.class, "updateHistoricProcessInstanceEventsByRootProcessInstanceId", parameters); }
Example #28
Source File: DefaultHistoryEventProducer.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected boolean isRootProcessInstance(HistoricProcessInstanceEventEntity evt) { return evt.getProcessInstanceId().equals(evt.getRootProcessInstanceId()); }
Example #29
Source File: HistoricProcessInstanceManager.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public void addRemovalTimeById(String processInstanceId, Date removalTime) { CommandContext commandContext = Context.getCommandContext(); commandContext.getHistoricActivityInstanceManager() .addRemovalTimeToActivityInstancesByProcessInstanceId(processInstanceId, removalTime); commandContext.getHistoricTaskInstanceManager() .addRemovalTimeToTaskInstancesByProcessInstanceId(processInstanceId, removalTime); commandContext.getHistoricVariableInstanceManager() .addRemovalTimeToVariableInstancesByProcessInstanceId(processInstanceId, removalTime); commandContext.getHistoricDetailManager() .addRemovalTimeToDetailsByProcessInstanceId(processInstanceId, removalTime); commandContext.getHistoricIncidentManager() .addRemovalTimeToIncidentsByProcessInstanceId(processInstanceId, removalTime); commandContext.getHistoricExternalTaskLogManager() .addRemovalTimeToExternalTaskLogByProcessInstanceId(processInstanceId, removalTime); commandContext.getHistoricJobLogManager() .addRemovalTimeToJobLogByProcessInstanceId(processInstanceId, removalTime); commandContext.getOperationLogManager() .addRemovalTimeToUserOperationLogByProcessInstanceId(processInstanceId, removalTime); commandContext.getHistoricIdentityLinkManager() .addRemovalTimeToIdentityLinkLogByProcessInstanceId(processInstanceId, removalTime); commandContext.getCommentManager() .addRemovalTimeToCommentsByProcessInstanceId(processInstanceId, removalTime); commandContext.getAttachmentManager() .addRemovalTimeToAttachmentsByProcessInstanceId(processInstanceId, removalTime); commandContext.getByteArrayManager() .addRemovalTimeToByteArraysByProcessInstanceId(processInstanceId, removalTime); if (isEnableHistoricInstancePermissions()) { commandContext.getAuthorizationManager() .addRemovalTimeToAuthorizationsByProcessInstanceId(processInstanceId, removalTime); } Map<String, Object> parameters = new HashMap<>(); parameters.put("processInstanceId", processInstanceId); parameters.put("removalTime", removalTime); getDbEntityManager() .updatePreserveOrder(HistoricProcessInstanceEventEntity.class, "updateHistoricProcessInstanceByProcessInstanceId", parameters); }
Example #30
Source File: AddCommentCmd.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected HistoricProcessInstanceEventEntity getHistoricRootProcessInstance(String rootProcessInstanceId) { return Context.getCommandContext() .getDbEntityManager() .selectById(HistoricProcessInstanceEventEntity.class, rootProcessInstanceId); }