Move otn link update from renderer to SH
[transportpce.git] / renderer / src / main / java / org / opendaylight / transportpce / renderer / provisiondevice / OtnDeviceRenderingResult.java
1 /*
2  * Copyright © 2020 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
9 package org.opendaylight.transportpce.renderer.provisiondevice;
10
11 import java.util.Collections;
12 import java.util.List;
13 import org.opendaylight.transportpce.common.OperationResult;
14 import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.link.tp.LinkTp;
15 import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.node.interfaces.NodeInterface;
16
17 public final class OtnDeviceRenderingResult extends OperationResult {
18     private final List<NodeInterface> renderedNodeInterfaces;
19     private final List<LinkTp> otnLinkTps;
20
21
22     private OtnDeviceRenderingResult(boolean success, String message, List<NodeInterface> renderedNodeInterfaces,
23         List<LinkTp> otnLinkTps) {
24         super(success, message);
25         if (renderedNodeInterfaces != null) {
26             this.renderedNodeInterfaces = Collections.unmodifiableList(renderedNodeInterfaces);
27         } else {
28             this.renderedNodeInterfaces = Collections.emptyList();
29         }
30         if (otnLinkTps != null) {
31             this.otnLinkTps = Collections.unmodifiableList(otnLinkTps);
32         } else {
33             this.otnLinkTps = Collections.emptyList();
34         }
35     }
36
37     public List<NodeInterface> getRenderedNodeInterfaces() {
38         return this.renderedNodeInterfaces;
39     }
40
41     public List<LinkTp> getOtnLinkTps() {
42         return this.otnLinkTps;
43     }
44
45     public static OtnDeviceRenderingResult failed(String message) {
46         return new OtnDeviceRenderingResult(false, message, null, null);
47     }
48
49     public static OtnDeviceRenderingResult ok(List<NodeInterface> renderedNodeInterfaces,
50             List<LinkTp> otnLinkTps) {
51         return new OtnDeviceRenderingResult(true, "", renderedNodeInterfaces, otnLinkTps);
52     }
53
54 }