[SDC-29] rebase continue work to align source
[sdc.git] / test-apis-ci / src / main / java / org / openecomp / sdc / ci / tests / datatypes / enums / LifeCycleStatesEnum.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdc.ci.tests.datatypes.enums;
22
23 import java.util.List;
24
25 public enum LifeCycleStatesEnum {
26
27         CHECKOUT("checkout", "NOT_CERTIFIED_CHECKOUT"), 
28         CHECKIN("checkin", "NOT_CERTIFIED_CHECKIN"), 
29         CERTIFICATIONREQUEST("certificationRequest", "READY_FOR_CERTIFICATION"), 
30         UNDOCHECKOUT("undoCheckout", ""), 
31         CANCELCERTIFICATION("cancelCertification", ""), 
32         STARTCERTIFICATION("startCertification", "CERTIFICATION_IN_PROGRESS"), 
33         FAILCERTIFICATION("failCertification", ""), 
34         CERTIFY("certify", "CERTIFIED");
35
36         private String state;
37         private String componentState;
38
39         private LifeCycleStatesEnum(String state, String componentState) {
40                 this.state = state;
41                 this.componentState = componentState;
42
43         }
44
45         public String getState() {
46                 return state;
47         }
48
49         public String getComponentState() {
50                 return componentState;
51         }
52
53         public static LifeCycleStatesEnum findByCompState(String compState) {
54
55                 for (LifeCycleStatesEnum lifeCycleStatesEnum : LifeCycleStatesEnum.values()) {
56                         if (lifeCycleStatesEnum.getComponentState().equals(compState)) {
57                                 return lifeCycleStatesEnum;
58                         }
59                 }
60
61                 return null;
62
63         }
64
65         public static LifeCycleStatesEnum findByState(String state) {
66
67                 for (LifeCycleStatesEnum lifeCycleStatesEnum : LifeCycleStatesEnum.values()) {
68                         if (lifeCycleStatesEnum.name().equals(state)) {
69                                 return lifeCycleStatesEnum;
70                         }
71                 }
72
73                 return null;
74
75         }
76
77 }