2 * Copyright © 2017 AT&T 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.transportpce.renderer.provisiondevice;
10 import java.util.Collections;
11 import java.util.List;
12 import org.opendaylight.transportpce.common.OperationResult;
13 import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.link.tp.LinkTp;
14 import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.node.interfaces.NodeInterface;
15 import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.optical.renderer.nodes.Nodes;
17 public final class DeviceRenderingResult extends OperationResult {
19 private final List<Nodes> olmList;
20 private final List<NodeInterface> renderedNodeInterfaces;
21 private final List<LinkTp> otnLinkTps;
23 private DeviceRenderingResult(boolean success, String message, List<Nodes> olmList,
24 List<NodeInterface> renderedNodeInterfaces, List<LinkTp> otnLinkTps) {
25 super(success, message);
26 if (olmList != null) {
27 this.olmList = Collections.unmodifiableList(olmList);
29 this.olmList = Collections.emptyList();
31 if (renderedNodeInterfaces != null) {
32 this.renderedNodeInterfaces = Collections.unmodifiableList(renderedNodeInterfaces);
34 this.renderedNodeInterfaces = Collections.emptyList();
36 if (otnLinkTps != null) {
37 this.otnLinkTps = Collections.unmodifiableList(otnLinkTps);
39 this.otnLinkTps = Collections.emptyList();
43 public List<Nodes> getOlmList() {
47 public List<NodeInterface> getRenderedNodeInterfaces() {
48 return this.renderedNodeInterfaces;
51 public List<LinkTp> getOtnLinkTps() {
52 return this.otnLinkTps;
55 public static DeviceRenderingResult failed(String message) {
56 return new DeviceRenderingResult(false, message, null, null, null);
59 public static DeviceRenderingResult ok(List<Nodes> olmNodeList, List<NodeInterface> renderedNodeInterfaces,
60 List<LinkTp> otnLinkTps) {
61 return new DeviceRenderingResult(true, "", olmNodeList, renderedNodeInterfaces, otnLinkTps);