Initial commit for AAI-UI(sparky-backend)
[aai/sparky-be.git] / src / main / java / org / openecomp / 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
26 package org.openecomp.sparky.viewandinspect.entity;
27
28 import org.openecomp.sparky.dal.rest.OperationResult;
29
30 /**
31  * The Class NodeProcessingTransaction.
32  */
33 public class NodeProcessingTransaction {
34
35   private ActiveInventoryNode processingNode;
36   private OperationResult opResult;
37   private String selfLinkWithModifiers;
38   private String requestParameters;
39
40   /**
41    * Instantiates a new node processing transaction.
42    */
43   public NodeProcessingTransaction() {}
44
45   public String getRequestParameters() {
46     return requestParameters;
47   }
48
49   public void setRequestParameters(String requestParameters) {
50     this.requestParameters = requestParameters;
51   }
52
53   public String getSelfLinkWithModifiers() {
54
55     if (processingNode == null) {
56       return null;
57     }
58
59     return processingNode.getSelfLink() + requestParameters;
60   }
61
62   public ActiveInventoryNode getProcessingNode() {
63     return processingNode;
64   }
65
66   public void setProcessingNode(ActiveInventoryNode processingNode) {
67     this.processingNode = processingNode;
68   }
69
70   public OperationResult getOpResult() {
71     return opResult;
72   }
73
74   public void setOpResult(OperationResult opResult) {
75     this.opResult = opResult;
76   }
77
78   /**
79    * Processing error occurred.
80    *
81    * @return true, if successful
82    */
83   public boolean processingErrorOccurred() {
84     if (opResult == null) {
85       return true;
86     }
87
88     return !opResult.wasSuccessful();
89
90   }
91
92   /* (non-Javadoc)
93    * @see java.lang.Object#toString()
94    */
95   @Override
96   public String toString() {
97     return "NodeProcessingTransaction ["
98         + (processingNode != null ? "processingNode=" + processingNode + ", " : "")
99         + (opResult != null ? "opResult=" + opResult + ", " : "") + "processorErrorOccurred="
100         + processingErrorOccurred() + "]";
101   }
102
103 }