2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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=========================================================
20 package org.openecomp.policy.controlloop.policy;
22 public enum PolicyResult {
24 * Operation was successful.
32 * Operation failed due to maximum retries being met.
34 FAILURE_RETRIES("Failure_Retries"),
36 * Operation failed due to timeout occurring.
38 FAILURE_TIMEOUT("Failure_Timeout"),
40 * Operation failed due to an exception.
42 FAILURE_EXCEPTION("Failure_Exception"),
44 * Operation failed since Guard did not permit.
46 FAILURE_GUARD("Failure_Guard")
49 private String result;
51 private PolicyResult(String result) {
55 public String toString() {
59 public static PolicyResult toResult(String result) {
60 if (result.equalsIgnoreCase(SUCCESS.toString())) {
63 if (result.equalsIgnoreCase(FAILURE.toString())) {
66 if (result.equalsIgnoreCase(FAILURE_RETRIES.toString())) {
67 return FAILURE_RETRIES;
69 if (result.equalsIgnoreCase(FAILURE_TIMEOUT.toString())) {
70 return FAILURE_TIMEOUT;
72 if (result.equalsIgnoreCase(FAILURE_EXCEPTION.toString())) {
73 return FAILURE_EXCEPTION;
75 if (result.equalsIgnoreCase(FAILURE_GUARD.toString())) {