io.camunda.operate.webapp.elasticsearch.reader.IncidentReader Maven / Gradle / Ivy
/*
* 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.store.FlowNodeStore;
import io.camunda.operate.store.IncidentStore;
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 io.camunda.webapps.operate.TreePath;
import io.camunda.webapps.schema.entities.operate.ErrorType;
import io.camunda.webapps.schema.entities.operate.IncidentEntity;
import io.camunda.webapps.schema.entities.operation.OperationEntity;
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(final Long processInstanceKey) {
return incidentStore.getIncidentsByProcessInstanceKey(processInstanceKey);
}
/**
* Returns map of incident ids per process instance id.
*
* @param processInstanceKeys
* @return
*/
@Override
public Map> getIncidentKeysPerProcessInstance(
final List processInstanceKeys) {
return incidentStore.getIncidentKeysPerProcessInstance(processInstanceKeys);
}
@Override
public IncidentEntity getIncidentById(final Long incidentKey) {
return incidentStore.getIncidentById(incidentKey);
}
@Override
public IncidentResponseDto getIncidentsByProcessInstanceId(final String processInstanceId) {
// get treePath for process instance
final String treePath = processInstanceReader.getProcessInstanceTreePath(processInstanceId);
final List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy