aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openecomp/restclient/client/OperationResult.java
diff options
context:
space:
mode:
authordave.adams (da490c) <dave.adams@amdocs.com>2017-05-24 17:08:10 -0400
committerdave.adams (da490c) <dave.adams@amdocs.com>2017-05-24 17:53:38 -0400
commitf709acf2e6fc372ed36e0d2612a0b25ff1d582de (patch)
tree7fe2d851dec0baf8b0018c6bc692bca99fbb22f4 /src/main/java/org/openecomp/restclient/client/OperationResult.java
parent80fa392258c5ea6f88e99441630b7c303237b1d1 (diff)
Update rest-client with additional operations
Change-Id: Ia19c5156d40c816dc1ee77cece92c43f40791c59 Signed-off-by: dave.adams (da490c) <dave.adams@amdocs.com>
Diffstat (limited to 'src/main/java/org/openecomp/restclient/client/OperationResult.java')
-rw-r--r--src/main/java/org/openecomp/restclient/client/OperationResult.java91
1 files changed, 83 insertions, 8 deletions
diff --git a/src/main/java/org/openecomp/restclient/client/OperationResult.java b/src/main/java/org/openecomp/restclient/client/OperationResult.java
index c9d0f9c..1a301b9 100644
--- a/src/main/java/org/openecomp/restclient/client/OperationResult.java
+++ b/src/main/java/org/openecomp/restclient/client/OperationResult.java
@@ -28,10 +28,32 @@ import javax.ws.rs.core.MultivaluedMap;
public class OperationResult {
+ private String requestedLink;
private String result;
private String failureCause;
+ private boolean fromCache;
private int resultCode;
- private MultivaluedMap<String, String> headers;
+ private int numRetries;
+ private MultivaluedMap<String, String> responseHeaders;
+
+
+ public OperationResult() {
+ super();
+ this.numRetries = 0;
+ this.fromCache = false;
+ }
+
+ /**
+ * Instantiates a new operation result.
+ *
+ * @param resultCode the result code
+ * @param result the result
+ */
+ public OperationResult(int resultCode, String result) {
+ this();
+ this.resultCode = resultCode;
+ this.result = result;
+ }
/**
* Get the HTTP headers of the response.
@@ -39,13 +61,21 @@ public class OperationResult {
* @return the HTTP headers of the response.
*/
public MultivaluedMap<String, String> getHeaders() {
- return headers;
+ return responseHeaders;
}
- public void setHeaders(MultivaluedMap<String, String> headers) {
- this.headers = headers;
+ /**
+ * Returns true if the HTTP Status Code 200 <= x <= 299
+ *
+ * @return true, if successful
+ */
+ public boolean wasSuccessful() {
+ return (resultCode > 199 && resultCode < 300);
}
+ public void setHeaders(MultivaluedMap<String, String> headers) {
+ this.responseHeaders = headers;
+ }
public String getResult() {
return result;
@@ -62,22 +92,67 @@ public class OperationResult {
public String getFailureCause() {
return failureCause;
}
-
+
+ /**
+ * Sets the result.
+ *
+ * @param resultCode the result code
+ * @param result the result
+ */
+ public void setResult(int resultCode, String result) {
+ this.resultCode = resultCode;
+ this.result = result;
+ }
+
public void setFailureCause(String failureCause) {
this.failureCause = failureCause;
}
+ /**
+ * Sets the failure cause.
+ *
+ * @param resultCode the result code
+ * @param failureCause the result error
+ */
+ public void setFailureCause(int resultCode, String failureCause) {
+ this.resultCode = resultCode;
+ this.failureCause = failureCause;
+ }
+
+
public void setResultCode(int resultCode) {
this.resultCode = resultCode;
}
- public OperationResult() {
- super();
+ public String getRequestedLink() {
+ return requestedLink;
+ }
+
+ public void setRequestedLink(String requestedLink) {
+ this.requestedLink = requestedLink;
+ }
+
+ public boolean isFromCache() {
+ return fromCache;
+ }
+
+ public void setFromCache(boolean fromCache) {
+ this.fromCache = fromCache;
+ }
+
+ public int getNumRetries() {
+ return numRetries;
+ }
+
+ public void setNumRetries(int numRetries) {
+ this.numRetries = numRetries;
}
@Override
public String toString() {
- return "OperationResult [result=" + result + ", resultCode=" + resultCode + "]";
+ return "OperationResult [result=" + result + ", requestedLink=" + requestedLink
+ + ", failureCause=" + failureCause + ", resultCode=" + resultCode + ", numRetries="
+ + numRetries + ", responseHeaders=" + responseHeaders + "]";
}
}