9da2e9d1b4e388fc507cd9717ecb9aff611448bf
[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.rev210930.link.tp.LinkTp;
15 import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.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         this.renderedNodeInterfaces =
26             renderedNodeInterfaces == null
27                 ? Collections.emptyList()
28                 : Collections.unmodifiableList(renderedNodeInterfaces);
29         this.otnLinkTps =
30             otnLinkTps == null
31                 ? Collections.emptyList()
32                 : Collections.unmodifiableList(otnLinkTps);
33     }
34
35     public List<NodeInterface> getRenderedNodeInterfaces() {
36         return this.renderedNodeInterfaces;
37     }
38
39     public List<LinkTp> getOtnLinkTps() {
40         return this.otnLinkTps;
41     }
42
43     public static OtnDeviceRenderingResult failed(String message) {
44         return new OtnDeviceRenderingResult(false, message, null, null);
45     }
46
47     public static OtnDeviceRenderingResult ok(List<NodeInterface> renderedNodeInterfaces,
48             List<LinkTp> otnLinkTps) {
49         return new OtnDeviceRenderingResult(true, "", renderedNodeInterfaces, otnLinkTps);
50     }
51
52 }