Implement hiding mechanism
[sdc.git] / common-be / src / main / java / org / openecomp / sdc / be / datatypes / enums / GraphPropertyEnum.java
1 /*-
2  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *      http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 package org.openecomp.sdc.be.datatypes.enums;
16
17 import java.util.ArrayList;
18 import java.util.List;
19 import java.util.Map;
20 import lombok.AllArgsConstructor;
21 import lombok.Getter;
22
23 @AllArgsConstructor
24 @Getter
25 public enum GraphPropertyEnum {
26     // @formatter:off
27     //                              field name,             class type,            unique,        indexed
28     UNIQUE_ID(              "uid",                  String.class,   true,   true),
29     LABEL(                  "nodeLabel",            String.class,   false,  true),
30     JSON(                   "json",                 String.class,   false,  false),
31     METADATA(               "metadata",             String.class,   false,  false),
32     VERSION(                "version",              String.class,   false,  true),
33     STATE(                  "state",                String.class,   false,  true),
34     IS_HIGHEST_VERSION(     "highestVersion",       Boolean.class,  false,  true),
35     IS_DELETED(             "deleted",              Boolean.class,  false,  true),
36     NORMALIZED_NAME(        "normalizedName",       String.class,   false,  true),
37     NAME(                   "name",                 String.class,   false,  true),
38     TOSCA_RESOURCE_NAME(    "toscaResourceName",    String.class,   false,  true),
39     DISTRIBUTION_STATUS(    "distributionStatus",   String.class,   false,  false),
40     RESOURCE_TYPE(          "resourceType",         String.class,   false,  true),
41     COMPONENT_TYPE(         "componentType",        String.class,   false,  true),
42     UUID(                   "uuid",                 String.class,   false,  true),
43     SYSTEM_NAME(            "systemName",           String.class,   false,  true),
44     IS_ABSTRACT(            "abstract",             Boolean.class,  false,  true),
45     INVARIANT_UUID(         "invariantUuid",        String.class,   false,  true),
46     CSAR_UUID(              "csarUuid",             String.class,   false,  true),
47     CSAR_VERSION_UUID(      "csarVersionUuid",      String.class,   false,  true),
48     //used for user (old format, no json for users)
49     USERID(                 "userId",               String.class,   true,   true),
50     ROLE(                   "role",                 String.class,   false,  false),
51     FIRST_NAME(             "firstName",            String.class,   false,  false),
52     LAST_NAME(              "lastName",             String.class,   false,  false),
53     EMAIL(                  "email",                String.class,   false,  false),
54     LAST_LOGIN_TIME(        "lastLoginTime",        Long.class,     false,  false),
55     //used for category (old format, no json for categories)
56     ICONS(                  "icons",                String.class,   false,  false),
57     METADATA_KEYS(          "metadataKeys",         String.class,   false,  false),
58     USE_SUBSTITUTION_FOR_NESTED_SERVICES("useServiceSubstitutionForNestedServices",Boolean.class,false,false),
59     NOT_APPLICABLE_METADATA_KEYS("notApplicableMetadataKeys",String.class,false,false),
60     DATA_TYPES(             "data_types",           Map.class,      false,  false),
61     //Archive/Restore
62     IS_ARCHIVED(            "isArchived",           Boolean.class,  false,  true),
63     IS_VSP_ARCHIVED(        "isVspArchived",        Boolean.class,  false,  true),
64     ARCHIVE_TIME(           "archiveTime",          Long.class,     false,  true),
65     PREV_CATALOG_UPDATE_TIME("previousUpdateTime",  Long.class,     false,  true),
66     CURRENT_CATALOG_UPDATE_TIME("currentUpdateTime",Long.class,     false,  true),
67     //Healing
68     HEALING_VERSION(        "healVersion",          Integer.class,  false,  true),
69     MODEL(                  "model",                String.class,   false,  false),
70     MODEL_TYPE(             "modelType",            String.class,   false,  false);
71     // @formatter:on
72
73     private final String property;
74     private final Class<?> clazz;
75     private final boolean unique;
76     private final boolean indexed;
77
78     public static GraphPropertyEnum getByProperty(String property) {
79         for (GraphPropertyEnum currProperty : GraphPropertyEnum.values()) {
80             if (currProperty.getProperty().equals(property)) {
81                 return currProperty;
82             }
83         }
84         return null;
85     }
86
87     public static List<String> getAllProperties() {
88         List<String> arrayList = new ArrayList<>();
89         for (GraphPropertyEnum graphProperty : GraphPropertyEnum.values()) {
90             arrayList.add(graphProperty.getProperty());
91         }
92         return arrayList;
93     }
94 }