Search in sources :

Example 1 with HistoricCaseInstanceEventEntity

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

the class CacheAwareCmmnHistoryEventProducer method loadCaseInstanceEventEntity.

@Override
protected HistoricCaseInstanceEventEntity loadCaseInstanceEventEntity(CaseExecutionEntity caseExecutionEntity) {
    final String caseInstanceId = caseExecutionEntity.getCaseInstanceId();
    HistoricCaseInstanceEventEntity cachedEntity = findInCache(HistoricCaseInstanceEventEntity.class, caseInstanceId);
    if (cachedEntity != null) {
        return cachedEntity;
    } else {
        return newCaseInstanceEventEntity(caseExecutionEntity);
    }
}
Also used : HistoricCaseInstanceEventEntity(org.camunda.bpm.engine.impl.history.event.HistoricCaseInstanceEventEntity)

Example 2 with HistoricCaseInstanceEventEntity

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

the class DefaultCmmnHistoryEventProducer method createCaseInstanceUpdateEvt.

public HistoryEvent createCaseInstanceUpdateEvt(DelegateCaseExecution caseExecution) {
    final CaseExecutionEntity caseExecutionEntity = (CaseExecutionEntity) caseExecution;
    // create event instance
    HistoricCaseInstanceEventEntity evt = loadCaseInstanceEventEntity(caseExecutionEntity);
    // initialize event
    initCaseInstanceEvent(evt, caseExecutionEntity, HistoryEventTypes.CASE_INSTANCE_UPDATE);
    return evt;
}
Also used : CaseExecutionEntity(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity) HistoricCaseInstanceEventEntity(org.camunda.bpm.engine.impl.history.event.HistoricCaseInstanceEventEntity)

Example 3 with HistoricCaseInstanceEventEntity

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

the class DefaultCmmnHistoryEventProducer method createCaseInstanceCreateEvt.

public HistoryEvent createCaseInstanceCreateEvt(DelegateCaseExecution caseExecution) {
    final CaseExecutionEntity caseExecutionEntity = (CaseExecutionEntity) caseExecution;
    // create event instance
    HistoricCaseInstanceEventEntity evt = newCaseInstanceEventEntity(caseExecutionEntity);
    // initialize event
    initCaseInstanceEvent(evt, caseExecutionEntity, HistoryEventTypes.CASE_INSTANCE_CREATE);
    // set create time
    evt.setCreateTime(ClockUtil.getCurrentTime());
    // set create user id
    evt.setCreateUserId(Context.getCommandContext().getAuthenticatedUserId());
    // set super case instance id
    CmmnExecution superCaseExecution = caseExecutionEntity.getSuperCaseExecution();
    if (superCaseExecution != null) {
        evt.setSuperCaseInstanceId(superCaseExecution.getCaseInstanceId());
    }
    // set super process instance id
    ExecutionEntity superExecution = caseExecutionEntity.getSuperExecution();
    if (superExecution != null) {
        evt.setSuperProcessInstanceId(superExecution.getProcessInstanceId());
    }
    return evt;
}
Also used : CaseExecutionEntity(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity) CaseExecutionEntity(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity) ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) CmmnExecution(org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution) HistoricCaseInstanceEventEntity(org.camunda.bpm.engine.impl.history.event.HistoricCaseInstanceEventEntity)

Example 4 with HistoricCaseInstanceEventEntity

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

the class DefaultCmmnHistoryEventProducer method createCaseInstanceCloseEvt.

public HistoryEvent createCaseInstanceCloseEvt(DelegateCaseExecution caseExecution) {
    final CaseExecutionEntity caseExecutionEntity = (CaseExecutionEntity) caseExecution;
    // create event instance
    HistoricCaseInstanceEventEntity evt = loadCaseInstanceEventEntity(caseExecutionEntity);
    // initialize event
    initCaseInstanceEvent(evt, caseExecutionEntity, HistoryEventTypes.CASE_INSTANCE_CLOSE);
    // set end time
    evt.setEndTime(ClockUtil.getCurrentTime());
    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) HistoricCaseInstanceEventEntity(org.camunda.bpm.engine.impl.history.event.HistoricCaseInstanceEventEntity)

Aggregations

HistoricCaseInstanceEventEntity (org.camunda.bpm.engine.impl.history.event.HistoricCaseInstanceEventEntity)4 CaseExecutionEntity (org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity)3 CmmnExecution (org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution)1 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)1