Containerization feature of SO
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / OrchestrationStatus.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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.onap.so.db.catalog.beans;
22
23 public enum OrchestrationStatus {
24         ACTIVE("Active", "active"),
25         ASSIGNED("Assigned", "assigned"),
26         CREATED("Created", "created"),
27         INVENTORIED("Inventoried", "inventoried"),
28         PENDING("Pending", "pending"),
29         PENDING_ACTIVATION("PendingActivation", "pending.?activation"),
30         PENDING_CREATE("PendingCreate", "pending.?create"),
31         PENDING_DELETE("PendingDelete", "pending.?delete"),
32         PRECREATED("PreCreated", "pre.?created");
33
34         private final String name;
35         private final String fuzzyMatcher;
36         private OrchestrationStatus(String name, String fuzzyMatcher) {
37                 this.name = name;
38                 this.fuzzyMatcher = fuzzyMatcher;
39         }
40
41         @Override
42         public String toString() {
43                 return name;
44         }
45         /**
46          * case insensitive regular expression match to enum value
47          * 
48          * @param status
49          * @return
50          */
51         public boolean fuzzyMap(String status) {
52                 if (status != null) {
53                         return status.matches("(?i)" + this.fuzzyMatcher);
54                 } else {
55                         return false;
56                 }
57         }
58 }