2 * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.controller.eos.akka.owner.supervisor.command;
10 import com.google.common.collect.ImmutableSet;
11 import java.io.Serializable;
13 import java.util.stream.Collectors;
14 import org.eclipse.jdt.annotation.NonNull;
15 import org.eclipse.jdt.annotation.Nullable;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.entity.owners.norev.GetEntityOutput;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.entity.owners.norev.GetEntityOutputBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.entity.owners.norev.NodeName;
20 public final class GetEntityReply extends OwnerSupervisorReply implements Serializable {
21 private static final long serialVersionUID = 1L;
23 private final ImmutableSet<String> candidates;
24 private final String owner;
26 public GetEntityReply(final @Nullable String owner, final @Nullable Set<String> candidates) {
28 this.candidates = candidates == null ? ImmutableSet.of() : ImmutableSet.copyOf(candidates);
31 public @NonNull GetEntityOutput toOutput() {
32 final GetEntityOutputBuilder builder = new GetEntityOutputBuilder();
34 builder.setOwnerNode(new NodeName(owner));
37 .setCandidateNodes(candidates.stream().map(NodeName::new).collect(Collectors.toUnmodifiableList()))