Move otn link update from renderer to SH
[transportpce.git] / renderer / src / main / java / org / opendaylight / transportpce / renderer / provisiondevice / DeviceRenderingResult.java
1 /*
2  * Copyright © 2017 AT&T 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.transportpce.renderer.provisiondevice;
9
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;
16
17 public final class DeviceRenderingResult extends OperationResult {
18
19     private final List<Nodes> olmList;
20     private final List<NodeInterface> renderedNodeInterfaces;
21     private final List<LinkTp> otnLinkTps;
22
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);
28         } else {
29             this.olmList = Collections.emptyList();
30         }
31         if (renderedNodeInterfaces != null) {
32             this.renderedNodeInterfaces = Collections.unmodifiableList(renderedNodeInterfaces);
33         } else {
34             this.renderedNodeInterfaces = Collections.emptyList();
35         }
36         if (otnLinkTps != null) {
37             this.otnLinkTps = Collections.unmodifiableList(otnLinkTps);
38         } else {
39             this.otnLinkTps = Collections.emptyList();
40         }
41     }
42
43     public List<Nodes> getOlmList() {
44         return this.olmList;
45     }
46
47     public List<NodeInterface> getRenderedNodeInterfaces() {
48         return this.renderedNodeInterfaces;
49     }
50
51     public List<LinkTp> getOtnLinkTps() {
52         return this.otnLinkTps;
53     }
54
55     public static DeviceRenderingResult failed(String message) {
56         return new DeviceRenderingResult(false, message, null, null, null);
57     }
58
59     public static DeviceRenderingResult ok(List<Nodes> olmNodeList, List<NodeInterface> renderedNodeInterfaces,
60         List<LinkTp> otnLinkTps) {
61         return new DeviceRenderingResult(true, "", olmNodeList, renderedNodeInterfaces, otnLinkTps);
62     }
63
64 }