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
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org.openecomp.sdc.be.datatypes.enums;
18 import java.util.ArrayList;
19 import java.util.List;
22 public enum GraphPropertyEnum {
24 // field name ,class type ,unique ,indexed
25 UNIQUE_ID("uid", String.class, true, true),
26 LABEL("nodeLabel", String.class, false, true),
27 JSON("json", String.class, false, false),
28 METADATA("metadata", String.class, false, false),
29 VERSION("version", String.class, false, true),
30 STATE("state", String.class, false, true),
31 IS_HIGHEST_VERSION("highestVersion", Boolean.class, false, true),
32 IS_DELETED("deleted", Boolean.class, false, true),
33 NORMALIZED_NAME("normalizedName", String.class, false, true),
34 NAME("name", String.class, false, true),
35 TOSCA_RESOURCE_NAME("toscaResourceName", String.class, false, true),
36 DISTRIBUTION_STATUS("distributionStatus", String.class, false, false),
37 RESOURCE_TYPE("resourceType", String.class, false, true),
38 COMPONENT_TYPE("componentType", String.class, false, true),
39 UUID("uuid", String.class, false, true),
40 SYSTEM_NAME("systemName", String.class, false, true),
41 IS_ABSTRACT("abstract", Boolean.class, false, true),
42 INVARIANT_UUID("invariantUuid", String.class, false, true),
43 CSAR_UUID("csarUuid", String.class, false, true),
44 //used for user (old format, no json for users)
45 USERID("userId", String.class, true, true),
46 ROLE("role", String.class, false, false),
47 FIRST_NAME("firstName", String.class, false, false),
48 LAST_NAME("lastName", String.class, false, false),
49 EMAIL("email", String.class, false, false),
50 LAST_LOGIN_TIME("lastLoginTime", Long.class, false, false),
51 //used for category (old format, no json for categories)
52 ICONS("icons", String.class, false, false),
55 IS_ARCHIVED("isArchived", Boolean.class, false, true),
56 IS_VSP_ARCHIVED("isVspArchived", Boolean.class, false, true),
57 ARCHIVE_TIME("archiveTime", Long.class, false, true),
58 PREV_CATALOG_UPDATE_TIME ("previousUpdateTime", Long.class, false, true),
59 CURRENT_CATALOG_UPDATE_TIME ("currentUpdateTime", Long.class, false, true),
62 HEALING_VERSION("healVersion", Integer.class, false, true);
66 private String property;
68 private boolean unique;
69 private boolean indexed;
71 GraphPropertyEnum(String property, Class clazz, boolean unique, boolean indexed) {
72 this.property = property;
75 this.indexed = indexed;
78 public static GraphPropertyEnum getByProperty(String property) {
79 for (GraphPropertyEnum currProperty : GraphPropertyEnum.values()) {
80 if (currProperty.getProperty().equals(property)) {
87 public String getProperty() {
91 public void setProperty(String property) {
92 this.property = property;
95 public Class getClazz() {
99 public void setClazz(Class clazz) {
103 public boolean isUnique() {
107 public void setUnique(boolean unique) {
108 this.unique = unique;
111 public boolean isIndexed() {
115 public void setIndexed(boolean indexed) {
116 this.indexed = indexed;
119 public static List<String> getAllProperties() {
121 List<String> arrayList = new ArrayList<>();
123 for (GraphPropertyEnum graphProperty : GraphPropertyEnum.values()) {
124 arrayList.add(graphProperty.getProperty());