0fa07cfe0f3388d0df4c782efb8be9b474720b45
[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         CONFIGASSIGNED("ConfigAssigned", "config.?assigned"),
34         CONFIGURE("Configure" , "configure"),
35         CONFIGURED("Configured" , "configured");
36
37         private final String name;
38         private final String fuzzyMatcher;
39         private OrchestrationStatus(String name, String fuzzyMatcher) {
40                 this.name = name;
41                 this.fuzzyMatcher = fuzzyMatcher;
42         }
43
44         @Override
45         public String toString() {
46                 return name;
47         }
48         /**
49          * case insensitive regular expression match to enum value
50          * 
51          * @param status
52          * @return
53          */
54         public boolean fuzzyMap(String status) {
55                 if (status != null) {
56                         return status.matches("(?i)" + this.fuzzyMatcher);
57                 } else {
58                         return false;
59                 }
60         }
61 }