2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 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.dao.cassandra.schema.tables;
23 import com.datastax.driver.core.DataType;
24 import lombok.AllArgsConstructor;
26 import org.apache.commons.lang3.tuple.ImmutablePair;
27 import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription;
28 import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
33 public class OperationalEnvironmentsTableDescription implements ITableDescription {
35 private static final String OPERATIONAL_ENVIRONMENT_TABLE = "operationalEnvironment";
36 private static final String ENVIRONMENT_ID = "environment_id";
39 public List<ImmutablePair<String, DataType>> primaryKeys() {
40 List<ImmutablePair<String, DataType>> keys = new ArrayList<>();
41 keys.add(new ImmutablePair<>(ENVIRONMENT_ID, DataType.varchar()));
46 public List<ImmutablePair<String, DataType>> clusteringKeys() {
47 return new LinkedList<>();
51 public Map<String, ImmutablePair<DataType, Boolean>> getColumnDescription() {
52 Map<String, ImmutablePair<DataType, Boolean>> columns = new HashMap<>();
53 Arrays.stream(SdcOperationalEnvironmentFieldsDescription.values())
54 .forEach(column -> columns.put(column.getFieldName(), ImmutablePair.of(column.getFieldType(), column.isIndexed())));
59 public String getKeyspace() {
60 return AuditingTypesConstants.REPO_KEYSPACE;
64 public String getTableName() {
65 return OPERATIONAL_ENVIRONMENT_TABLE;
70 enum SdcOperationalEnvironmentFieldsDescription {
71 //there is also PK field "environmentID"
72 TENANT("tenant", DataType.varchar(), false),
73 IS_PRODUCTION("is_production", DataType.cboolean(), false),
74 ECOMP_WORKLOAD_CONTEXT("ecomp_workload_context", DataType.varchar(), false),
75 DMAAP_UEB_ADDRESS("dmaap_ueb_address", DataType.set(DataType.varchar()), false),
76 UEB_API_KEY("ueb_api_key",DataType.varchar(), false),
77 UEB_SECRET_KEY("ueb_secret_key",DataType.varchar(), false),
78 STATUS("status",DataType.varchar() ,true),
79 LAST_MODIFIED("last_modified",DataType.timestamp() ,false);
81 private final String fieldName;
82 private final DataType fieldType;
83 private final boolean isIndexed;