d773e017127e640da9c54b79630375c0480a5ad8
[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.node.interfaces.NodeInterface;
15
16 public final class OtnDeviceRenderingResult extends OperationResult {
17     private final List<NodeInterface> renderedNodeInterfaces;
18
19     private OtnDeviceRenderingResult(boolean success, String message, List<NodeInterface> renderedNodeInterfaces) {
20         super(success, message);
21         if (renderedNodeInterfaces != null) {
22             this.renderedNodeInterfaces = Collections.unmodifiableList(renderedNodeInterfaces);
23         } else {
24             this.renderedNodeInterfaces = Collections.emptyList();
25         }
26     }
27
28     public List<NodeInterface> getRenderedNodeInterfaces() {
29         return this.renderedNodeInterfaces;
30     }
31
32     public static OtnDeviceRenderingResult failed(String message) {
33         return new OtnDeviceRenderingResult(false, message, null);
34     }
35
36     public static OtnDeviceRenderingResult ok(List<NodeInterface> renderedNodeInterfaces) {
37         return new OtnDeviceRenderingResult(true, "", renderedNodeInterfaces);
38     }
39
40 }