io.camunda.operate.webapp.elasticsearch.reader.IncidentReader Maven / Gradle / Ivy
The newest version!
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under
* one or more contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright ownership.
* Licensed under the Camunda License 1.0. You may not use this file
* except in compliance with the Camunda License 1.0.
*/
package io.camunda.operate.webapp.elasticsearch.reader;
import static io.camunda.operate.webapp.rest.dto.incidents.IncidentDto.FALLBACK_PROCESS_DEFINITION_NAME;
import io.camunda.operate.cache.ProcessCache;
import io.camunda.operate.conditions.ElasticsearchCondition;
import io.camunda.operate.entities.ErrorType;
import io.camunda.operate.entities.IncidentEntity;
import io.camunda.operate.entities.OperationEntity;
import io.camunda.operate.store.FlowNodeStore;
import io.camunda.operate.store.IncidentStore;
import io.camunda.operate.util.TreePath;
import io.camunda.operate.webapp.data.IncidentDataHolder;
import io.camunda.operate.webapp.reader.OperationReader;
import io.camunda.operate.webapp.rest.dto.incidents.IncidentDto;
import io.camunda.operate.webapp.rest.dto.incidents.IncidentErrorTypeDto;
import io.camunda.operate.webapp.rest.dto.incidents.IncidentFlowNodeDto;
import io.camunda.operate.webapp.rest.dto.incidents.IncidentResponseDto;
import java.util.*;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Conditional;
import org.springframework.stereotype.Component;
@Conditional(ElasticsearchCondition.class)
@Component
public class IncidentReader extends AbstractReader
implements io.camunda.operate.webapp.reader.IncidentReader {
private static final Logger LOGGER = LoggerFactory.getLogger(IncidentReader.class);
@Autowired private OperationReader operationReader;
@Autowired private ProcessInstanceReader processInstanceReader;
@Autowired private ProcessCache processCache;
@Autowired private IncidentStore incidentStore;
@Autowired private FlowNodeStore flowNodeStore;
@Override
public List getAllIncidentsByProcessInstanceKey(Long processInstanceKey) {
return incidentStore.getIncidentsByProcessInstanceKey(processInstanceKey);
}
/**
* Returns map of incident ids per process instance id.
*
* @param processInstanceKeys
* @return
*/
@Override
public Map> getIncidentKeysPerProcessInstance(List processInstanceKeys) {
return incidentStore.getIncidentKeysPerProcessInstance(processInstanceKeys);
}
@Override
public IncidentEntity getIncidentById(Long incidentKey) {
return incidentStore.getIncidentById(incidentKey);
}
@Override
public IncidentResponseDto getIncidentsByProcessInstanceId(String processInstanceId) {
// get treePath for process instance
final String treePath = processInstanceReader.getProcessInstanceTreePath(processInstanceId);
final List