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