2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.controlloop.actorserviceprovider;
23 public enum OperationResult {
25 * Operation was successful.
33 * Operation failed due to maximum retries being met.
35 FAILURE_RETRIES("Failure_Retries"),
37 * Operation failed due to timeout occurring.
39 FAILURE_TIMEOUT("Failure_Timeout"),
41 * Operation failed due to an exception.
43 FAILURE_EXCEPTION("Failure_Exception"),
45 * Operation failed since Guard did not permit.
47 FAILURE_GUARD("Failure_Guard")
51 private String result;
52 private OperationResult(String result) {
57 public String toString() {
62 * Convert to a result.
64 * @param result result string
65 * @return Result object
67 public static OperationResult toResult(String result) {
68 if (result.equalsIgnoreCase(SUCCESS.toString())) {
71 if (result.equalsIgnoreCase(FAILURE.toString())) {
74 if (result.equalsIgnoreCase(FAILURE_RETRIES.toString())) {
75 return FAILURE_RETRIES;
77 if (result.equalsIgnoreCase(FAILURE_TIMEOUT.toString())) {
78 return FAILURE_TIMEOUT;
80 if (result.equalsIgnoreCase(FAILURE_EXCEPTION.toString())) {
81 return FAILURE_EXCEPTION;
83 if (result.equalsIgnoreCase(FAILURE_GUARD.toString())) {