Adding interfaces in documentation
[aai/sparky-be.git] / sparkybe-onap-service / src / main / java / org / onap / aai / sparky / viewandinspect / entity / NodeProcessingTransaction.java
1 /**
2  * ============LICENSE_START===================================================
3  * SPARKY (AAI UI service)
4  * ============================================================================
5  * Copyright © 2017 AT&T Intellectual Property.
6  * Copyright © 2017 Amdocs
7  * All rights reserved.
8  * ============================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=====================================================
21  *
22  * ECOMP and OpenECOMP are trademarks
23  * and service marks of AT&T Intellectual Property.
24  */
25 package org.onap.aai.sparky.viewandinspect.entity;
26
27 import org.onap.aai.restclient.client.OperationResult;
28
29 /**
30  * The Class NodeProcessingTransaction.
31  */
32 public class NodeProcessingTransaction {
33
34   private ActiveInventoryNode processingNode;
35   private OperationResult opResult;
36   private String selfLinkWithModifiers;
37   private String requestParameters;
38
39   /**
40    * Instantiates a new node processing transaction.
41    */
42   public NodeProcessingTransaction() {}
43
44   public String getRequestParameters() {
45     return requestParameters;
46   }
47
48   public void setRequestParameters(String requestParameters) {
49     this.requestParameters = requestParameters;
50   }
51
52   public String getSelfLink() {
53     if (processingNode == null) {
54       return null;
55     }
56
57     return processingNode.getSelfLink(); 
58   }
59
60   public String getSelfLinkWithModifiers() {
61     if (processingNode == null) {
62       return null;
63     }
64
65     return processingNode.getSelfLink() + requestParameters;
66   }
67
68   public ActiveInventoryNode getProcessingNode() {
69     return processingNode;
70   }
71
72   public void setProcessingNode(ActiveInventoryNode processingNode) {
73     this.processingNode = processingNode;
74   }
75
76   public OperationResult getOpResult() {
77     return opResult;
78   }
79
80   public void setOpResult(OperationResult opResult) {
81     this.opResult = opResult;
82   }
83
84   /**
85    * Processing error occurred.
86    *
87    * @return true, if successful
88    */
89   public boolean processingErrorOccurred() {
90     if (opResult == null) {
91       return true;
92     }
93
94     return !opResult.wasSuccessful();
95
96   }
97
98   /* (non-Javadoc)
99    * @see java.lang.Object#toString()
100    */
101   @Override
102   public String toString() {
103     return "NodeProcessingTransaction ["
104         + (processingNode != null ? "processingNode=" + processingNode + ", " : "")
105         + (opResult != null ? "opResult=" + opResult + ", " : "") + "processorErrorOccurred="
106         + processingErrorOccurred() + "]";
107   }
108
109 }