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=========================================================
21 package org.openecomp.sdc.be.datatypes.enums;
23 import java.util.ArrayList;
24 import java.util.List;
28 public enum GraphPropertyEnum {
29 // field name class type unique indexed
30 // stored in graph index
31 UNIQUE_ID ("uid", String.class, true, true),
32 LABEL ("nodeLabel", String.class, false, true),
33 JSON ("json", String.class, false, false),
34 METADATA ("metadata", String.class, false, false),
35 VERSION ("version", String.class, false, true),
36 STATE ("state", String.class, false, true),
37 IS_HIGHEST_VERSION ("highestVersion", Boolean.class, false, true),
38 IS_DELETED ("deleted", Boolean.class, false, true),
39 NORMALIZED_NAME ("normalizedName", String.class, false, true),
40 NAME ("name", String.class, false, true),
41 TOSCA_RESOURCE_NAME ("toscaResourceName", String.class, false, true),
42 DISTRIBUTION_STATUS ("distributionStatus", String.class, false, false),
43 RESOURCE_TYPE ("resourceType", String.class, false, true),
44 COMPONENT_TYPE ("componentType", String.class, false, true),
45 UUID ("uuid", String.class, false, true),
46 SYSTEM_NAME ("systemName", String.class, false, true),
47 IS_ABSTRACT ("abstract", Boolean.class, false, true),
48 INVARIANT_UUID ("invariantUuid", String.class, false, true),
49 CSAR_UUID ("csarUuid", String.class, false, true),
50 //used for user (old format, no json for users)
51 USERID ("userId", String.class, true, true),
52 ROLE ("role", String.class, false, false),
53 FIRST_NAME ("firstName", String.class, false, false),
54 LAST_NAME ("lastName", String.class, false, false),
55 EMAIL ("email", String.class, false, false),
56 LAST_LOGIN_TIME ("lastLoginTime", Long.class, false, false),
57 //used for category (old format, no json for categories)
58 ICONS ("icons", String.class, false, false),
61 IS_ARCHIVED ("isArchived", Boolean.class, false, true),
62 IS_VSP_ARCHIVED ("isVspArchived", Boolean.class, false, true),
63 ARCHIVE_TIME ("archiveTime", Long.class, false, true);
65 private String property;
67 private boolean unique;
68 private boolean indexed;
70 GraphPropertyEnum(String property, Class clazz, boolean unique, boolean indexed) {
71 this.property = property;
74 this.indexed = indexed;
77 public static GraphPropertyEnum getByProperty(String property){
78 for(GraphPropertyEnum currProperty :GraphPropertyEnum.values()){
79 if(currProperty.getProperty().equals(property)){
86 public String getProperty() {
90 public void setProperty(String property) {
91 this.property = property;
94 public Class getClazz() {
98 public void setClazz(Class clazz) {
102 public boolean isUnique() {
106 public void setUnique(boolean unique) {
107 this.unique = unique;
110 public boolean isIndexed() {
114 public void setIndexed(boolean indexed) {
115 this.indexed = indexed;
118 public static List<String> getAllProperties() {
120 List<String> arrayList = new ArrayList<>();
122 for (GraphPropertyEnum graphProperty : GraphPropertyEnum.values()) {
123 arrayList.add(graphProperty.getProperty());