beb858c8df3d7b7f1f5b590c33c6069aec7b152e
[controller.git] / opendaylight / md-sal / eos-dom-akka / src / main / java / org / opendaylight / controller / eos / akka / owner / supervisor / command / GetEntitiesBackendReply.java
1 /*
2  * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.eos.akka.owner.supervisor.command;
9
10 import com.google.common.collect.ImmutableMap;
11 import com.google.common.collect.ImmutableSetMultimap;
12 import java.io.Serializable;
13 import java.util.Map;
14 import java.util.Set;
15 import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
16
17 public final class GetEntitiesBackendReply extends OwnerSupervisorReply implements Serializable {
18     private static final long serialVersionUID = 1L;
19
20     private final ImmutableSetMultimap<DOMEntity, String> candidates;
21     private final ImmutableMap<DOMEntity, String> owners;
22
23     public GetEntitiesBackendReply(final Map<DOMEntity, String> owners, final Map<DOMEntity, Set<String>> candidates) {
24         final ImmutableSetMultimap.Builder<DOMEntity, String> builder = ImmutableSetMultimap.builder();
25         for (Map.Entry<DOMEntity, Set<String>> entry : candidates.entrySet()) {
26             builder.putAll(entry.getKey(), entry.getValue());
27         }
28         this.candidates = builder.build();
29         this.owners = ImmutableMap.copyOf(owners);
30     }
31
32     public ImmutableSetMultimap<DOMEntity, String>  getCandidates() {
33         return candidates;
34     }
35
36     public ImmutableMap<DOMEntity, String> getOwners() {
37         return owners;
38     }
39 }