package com.linkedin.thirdeye.anomaly.detection;

import com.google.common.collect.ListMultimap;
import com.linkedin.thirdeye.api.DimensionMap;
import com.linkedin.thirdeye.api.MetricTimeSeries;
import com.linkedin.thirdeye.datalayer.dto.MergedAnomalyResultDTO;
import com.linkedin.thirdeye.datalayer.dto.RawAnomalyResultDTO;
import com.linkedin.thirdeye.detector.metric.transfer.ScalingFactor;
import java.util.List;
import java.util.Map;

public class AnomalyDetectionInputContext {
  Map<DimensionMap, MetricTimeSeries> dimensionKeyMetricTimeSeriesMap;
  ListMultimap<DimensionMap, RawAnomalyResultDTO> existingRawAnomalies;
  ListMultimap<DimensionMap, MergedAnomalyResultDTO> knownMergedAnomalies;
  List<ScalingFactor> scalingFactors;

  public Map<DimensionMap, MetricTimeSeries> getDimensionKeyMetricTimeSeriesMap() {
    return dimensionKeyMetricTimeSeriesMap;
  }

  public void setDimensionKeyMetricTimeSeriesMap(
      Map<DimensionMap, MetricTimeSeries> dimensionKeyMetricTimeSeriesMap) {
    this.dimensionKeyMetricTimeSeriesMap = dimensionKeyMetricTimeSeriesMap;
  }

  public ListMultimap<DimensionMap, RawAnomalyResultDTO> getExistingRawAnomalies() {
    return existingRawAnomalies;
  }

  public void setExistingRawAnomalies(ListMultimap<DimensionMap, RawAnomalyResultDTO> existingRawAnomalies) {
    this.existingRawAnomalies = existingRawAnomalies;
  }

  public ListMultimap<DimensionMap, MergedAnomalyResultDTO> getKnownMergedAnomalies() {
    return knownMergedAnomalies;
  }

  public void setKnownMergedAnomalies(ListMultimap<DimensionMap, MergedAnomalyResultDTO> knownMergedAnomalies) {
    this.knownMergedAnomalies = knownMergedAnomalies;
  }

  public List<ScalingFactor> getScalingFactors() {
    return scalingFactors;
  }

  public void setScalingFactors(List<ScalingFactor> scalingFactors) {
    this.scalingFactors = scalingFactors;
  }
}

@@ -43,16 +43,68 @@
 ction;%0A%0A
+import com.google.common.collect.ArrayListMultimap;%0A
 import c
@@ -134,32 +134,32 @@
 t.ListMultimap;%0A
-
 import com.linke
@@ -440,16 +440,46 @@
 Factor;%0A
+import java.util.Collections;%0A
 import j
@@ -625,24 +625,49 @@
 imeSeriesMap
+ = Collections.emptyMap()
 ;%0A  ListMult
@@ -718,32 +718,62 @@
 tingRawAnomalies
+ = ArrayListMultimap.create();
 ;%0A  ListMultimap
@@ -827,24 +827,54 @@
 gedAnomalies
+ = ArrayListMultimap.create();
 ;%0A  List%3CSca
@@ -899,16 +899,42 @@
 gFactors
+ = Collections.emptyList()
 ;%0A%0A  pub

Fix null exceptin issue when updating merged anomalies (#1168)