2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017 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
12 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 package org.onap.aai.sparky.dal.rest;
26 * The Class OperationResult.
28 public class OperationResult {
30 private String result;
32 private String objectId;
33 private String requestLink;
34 private String requestPayload;
36 private int resultCode;
38 private boolean resolvedLinkFromCache;
40 private boolean resolvedLinkFromServer;
42 private boolean resolvedLinkFailure;
44 private int numRequestRetries;
46 private long responseTimeInMs;
54 this.requestLink = null;
55 this.requestPayload = null;
57 this.resolvedLinkFailure = false;
58 this.resolvedLinkFromServer = false;
59 this.resolvedLinkFromCache = false;
60 this.responseTimeInMs = 0;
61 this.numRequestRetries = 0;
64 public String getObjectId() {
68 public void setObjectId(String objectId) {
69 this.objectId = objectId;
72 public boolean isResolvedLinkFromCache() {
73 return resolvedLinkFromCache;
79 * @return true, if successful
81 public boolean wasSuccessful() {
82 return (resultCode > 199 && resultCode < 300);
85 public String getRequestLink() {
89 public void setRequestLink(String requestLink) {
90 this.requestLink = requestLink;
93 public String getRequestPayload() {
94 return requestPayload;
97 public void setRequestPayload(String requestPayload) {
98 this.requestPayload = requestPayload;
101 public void setResolvedLinkFromCache(boolean resolvedLinkFromCache) {
102 this.resolvedLinkFromCache = resolvedLinkFromCache;
105 public boolean isResolvedLinkFromServer() {
106 return resolvedLinkFromServer;
109 public void setResolvedLinkFromServer(boolean resolvedLinkFromServer) {
110 this.resolvedLinkFromServer = resolvedLinkFromServer;
113 public boolean isResolvedLinkFailure() {
114 return resolvedLinkFailure;
117 public void setResolvedLinkFailure(boolean resolvedLinkFailure) {
118 this.resolvedLinkFailure = resolvedLinkFailure;
121 public String getResult() {
125 public int getResultCode() {
129 public void setResultCode(int resultCode) {
130 this.resultCode = resultCode;
133 public void setResult(String result) {
134 this.result = result;
140 * @param resultCode the result code
141 * @param result the result
143 public void setResult(int resultCode, String result) {
144 this.resultCode = resultCode;
145 this.result = result;
149 * Instantiates a new operation result.
151 public OperationResult() {
156 * Instantiates a new operation result.
158 * @param resultCode the result code
159 * @param result the result
161 public OperationResult(int resultCode, String result) {
163 this.resultCode = resultCode;
164 this.result = result;
167 public long getResponseTimeInMs() {
168 return responseTimeInMs;
171 public void setResponseTimeInMs(long responseTimeInMs) {
172 this.responseTimeInMs = responseTimeInMs;
175 public int getNumRequestRetries() {
176 return numRequestRetries;
179 public void setNumRequestRetries(int numRequestRetries) {
180 this.numRequestRetries = numRequestRetries;
184 * @see java.lang.Object#toString()
187 public String toString() {
188 return "OperationResult [result=" + result + ", resultCode=" + resultCode
189 + ", resolvedLinkFromCache=" + resolvedLinkFromCache + ", resolvedLinkFromServer="
190 + resolvedLinkFromServer + ", resolvedLinkFailure=" + resolvedLinkFailure
191 + ", numRequestRetries=" + numRequestRetries + ", responseTimeInMs=" + responseTimeInMs