Search in sources :

Example 1 with HistoricCaseActivityInstanceEventEntity

use of org.camunda.bpm.engine.impl.history.event.HistoricCaseActivityInstanceEventEntity in project camunda-bpm-platform by camunda.

the class CacheAwareCmmnHistoryEventProducer method loadCaseActivityInstanceEventEntity.

@Override
protected HistoricCaseActivityInstanceEventEntity loadCaseActivityInstanceEventEntity(CaseExecutionEntity caseExecutionEntity) {
    final String caseActivityInstanceId = caseExecutionEntity.getId();
    HistoricCaseActivityInstanceEventEntity cachedEntity = findInCache(HistoricCaseActivityInstanceEventEntity.class, caseActivityInstanceId);
    if (cachedEntity != null) {
        return cachedEntity;
    } else {
        return newCaseActivityInstanceEventEntity(caseExecutionEntity);
    }
}
Also used : HistoricCaseActivityInstanceEventEntity(org.camunda.bpm.engine.impl.history.event.HistoricCaseActivityInstanceEventEntity)

Example 2 with HistoricCaseActivityInstanceEventEntity

use of org.camunda.bpm.engine.impl.history.event.HistoricCaseActivityInstanceEventEntity in project camunda-bpm-platform by camunda.

the class DefaultCmmnHistoryEventProducer method createCaseActivityInstanceCreateEvt.

public HistoryEvent createCaseActivityInstanceCreateEvt(DelegateCaseExecution caseExecution) {
    final CaseExecutionEntity caseExecutionEntity = (CaseExecutionEntity) caseExecution;
    // create event instance
    HistoricCaseActivityInstanceEventEntity evt = newCaseActivityInstanceEventEntity(caseExecutionEntity);
    // initialize event
    initCaseActivityInstanceEvent(evt, caseExecutionEntity, HistoryEventTypes.CASE_ACTIVITY_INSTANCE_CREATE);
    // set start time
    evt.setCreateTime(ClockUtil.getCurrentTime());
    return evt;
}
Also used : CaseExecutionEntity(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity) HistoricCaseActivityInstanceEventEntity(org.camunda.bpm.engine.impl.history.event.HistoricCaseActivityInstanceEventEntity)

Example 3 with HistoricCaseActivityInstanceEventEntity

use of org.camunda.bpm.engine.impl.history.event.HistoricCaseActivityInstanceEventEntity in project camunda-bpm-platform by camunda.

the class DefaultCmmnHistoryEventProducer method createCaseActivityInstanceEndEvt.

public HistoryEvent createCaseActivityInstanceEndEvt(DelegateCaseExecution caseExecution) {
    final CaseExecutionEntity caseExecutionEntity = (CaseExecutionEntity) caseExecution;
    // create event instance
    HistoricCaseActivityInstanceEventEntity evt = loadCaseActivityInstanceEventEntity(caseExecutionEntity);
    // initialize event
    initCaseActivityInstanceEvent(evt, caseExecutionEntity, HistoryEventTypes.CASE_ACTIVITY_INSTANCE_END);
    // set end time
    evt.setEndTime(ClockUtil.getCurrentTime());
    // calculate duration
    if (evt.getStartTime() != null) {
        evt.setDurationInMillis(evt.getEndTime().getTime() - evt.getStartTime().getTime());
    }
    return evt;
}
Also used : CaseExecutionEntity(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity) HistoricCaseActivityInstanceEventEntity(org.camunda.bpm.engine.impl.history.event.HistoricCaseActivityInstanceEventEntity)

Example 4 with HistoricCaseActivityInstanceEventEntity

use of org.camunda.bpm.engine.impl.history.event.HistoricCaseActivityInstanceEventEntity in project camunda-bpm-platform by camunda.

the class HistoricCaseActivityInstanceTest method assertHistoricState.

protected void assertHistoricState(String activityId, CaseExecutionState expectedState) {
    HistoricCaseActivityInstanceEventEntity historicActivityInstance = (HistoricCaseActivityInstanceEventEntity) queryHistoricActivityCaseInstance(activityId);
    int actualStateCode = historicActivityInstance.getCaseActivityInstanceState();
    CaseExecutionState actualState = CaseExecutionState.CaseExecutionStateImpl.getStateForCode(actualStateCode);
    assertEquals("The state of historic case activity '" + activityId + "' wasn't as expected", expectedState, actualState);
}
Also used : CaseExecutionState(org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState) HistoricCaseActivityInstanceEventEntity(org.camunda.bpm.engine.impl.history.event.HistoricCaseActivityInstanceEventEntity)

Example 5 with HistoricCaseActivityInstanceEventEntity

use of org.camunda.bpm.engine.impl.history.event.HistoricCaseActivityInstanceEventEntity in project camunda-bpm-platform by camunda.

the class DefaultCmmnHistoryEventProducer method createCaseActivityInstanceUpdateEvt.

public HistoryEvent createCaseActivityInstanceUpdateEvt(DelegateCaseExecution caseExecution) {
    final CaseExecutionEntity caseExecutionEntity = (CaseExecutionEntity) caseExecution;
    // create event instance
    HistoricCaseActivityInstanceEventEntity evt = loadCaseActivityInstanceEventEntity(caseExecutionEntity);
    // initialize event
    initCaseActivityInstanceEvent(evt, caseExecutionEntity, HistoryEventTypes.CASE_ACTIVITY_INSTANCE_UPDATE);
    if (caseExecutionEntity.getTask() != null) {
        evt.setTaskId(caseExecutionEntity.getTask().getId());
    }
    if (caseExecutionEntity.getSubProcessInstance() != null) {
        evt.setCalledProcessInstanceId(caseExecutionEntity.getSubProcessInstance().getId());
    }
    if (caseExecutionEntity.getSubCaseInstance() != null) {
        evt.setCalledCaseInstanceId(caseExecutionEntity.getSubCaseInstance().getId());
    }
    return evt;
}
Also used : CaseExecutionEntity(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity) HistoricCaseActivityInstanceEventEntity(org.camunda.bpm.engine.impl.history.event.HistoricCaseActivityInstanceEventEntity)

Aggregations

HistoricCaseActivityInstanceEventEntity (org.camunda.bpm.engine.impl.history.event.HistoricCaseActivityInstanceEventEntity)5 CaseExecutionEntity (org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity)3 CaseExecutionState (org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState)1