2 * ============LICENSE_START===================================================
3 * SPARKY (AAI UI service)
4 * ============================================================================
5 * Copyright © 2017 AT&T Intellectual Property.
6 * Copyright © 2017 Amdocs
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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=====================================================
22 * ECOMP and OpenECOMP are trademarks
23 * and service marks of AT&T Intellectual Property.
26 package org.openecomp.sparky.dal.rest;
29 * The Class OperationResult.
31 public class OperationResult {
33 private String result;
35 private String objectId;
36 private String requestLink;
37 private String requestPayload;
39 private int resultCode;
41 private boolean resolvedLinkFromCache;
43 private boolean resolvedLinkFromServer;
45 private boolean resolvedLinkFailure;
47 private int numRequestRetries;
49 private long responseTimeInMs;
57 this.requestLink = null;
58 this.requestPayload = null;
60 this.resolvedLinkFailure = false;
61 this.resolvedLinkFromServer = false;
62 this.resolvedLinkFromCache = false;
63 this.responseTimeInMs = 0;
64 this.numRequestRetries = 0;
67 public String getObjectId() {
71 public void setObjectId(String objectId) {
72 this.objectId = objectId;
75 public boolean isResolvedLinkFromCache() {
76 return resolvedLinkFromCache;
82 * @return true, if successful
84 public boolean wasSuccessful() {
85 return (resultCode > 199 && resultCode < 300);
88 public String getRequestLink() {
92 public void setRequestLink(String requestLink) {
93 this.requestLink = requestLink;
96 public String getRequestPayload() {
97 return requestPayload;
100 public void setRequestPayload(String requestPayload) {
101 this.requestPayload = requestPayload;
104 public void setResolvedLinkFromCache(boolean resolvedLinkFromCache) {
105 this.resolvedLinkFromCache = resolvedLinkFromCache;
108 public boolean isResolvedLinkFromServer() {
109 return resolvedLinkFromServer;
112 public void setResolvedLinkFromServer(boolean resolvedLinkFromServer) {
113 this.resolvedLinkFromServer = resolvedLinkFromServer;
116 public boolean isResolvedLinkFailure() {
117 return resolvedLinkFailure;
120 public void setResolvedLinkFailure(boolean resolvedLinkFailure) {
121 this.resolvedLinkFailure = resolvedLinkFailure;
124 public String getResult() {
128 public int getResultCode() {
132 public void setResultCode(int resultCode) {
133 this.resultCode = resultCode;
136 public void setResult(String result) {
137 this.result = result;
143 * @param resultCode the result code
144 * @param result the result
146 public void setResult(int resultCode, String result) {
147 this.resultCode = resultCode;
148 this.result = result;
152 * Instantiates a new operation result.
154 public OperationResult() {
159 * Instantiates a new operation result.
161 * @param resultCode the result code
162 * @param result the result
164 public OperationResult(int resultCode, String result) {
166 this.resultCode = resultCode;
167 this.result = result;
170 public long getResponseTimeInMs() {
171 return responseTimeInMs;
174 public void setResponseTimeInMs(long responseTimeInMs) {
175 this.responseTimeInMs = responseTimeInMs;
178 public int getNumRequestRetries() {
179 return numRequestRetries;
182 public void setNumRequestRetries(int numRequestRetries) {
183 this.numRequestRetries = numRequestRetries;
187 * @see java.lang.Object#toString()
190 public String toString() {
191 return "OperationResult [result=" + result + ", resultCode=" + resultCode
192 + ", resolvedLinkFromCache=" + resolvedLinkFromCache + ", resolvedLinkFromServer="
193 + resolvedLinkFromServer + ", resolvedLinkFailure=" + resolvedLinkFailure
194 + ", numRequestRetries=" + numRequestRetries + ", responseTimeInMs=" + responseTimeInMs