1 package org.openecomp.sdc.be.dao.cassandra.schema.tables;
3 import java.util.ArrayList;
4 import java.util.Arrays;
5 import java.util.HashMap;
9 import org.apache.commons.lang3.tuple.ImmutablePair;
10 import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription;
11 import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
13 import com.datastax.driver.core.DataType;
15 public class EcompOperationalEnvironmentEventTableDesc implements ITableDescription {
17 private static final String OPERATIONAL_ENVIRONMENT_ID = "operational_environment_id";
20 public List<ImmutablePair<String, DataType>> primaryKeys() {
21 List<ImmutablePair<String, DataType>> keys = new ArrayList<>();
22 keys.add(new ImmutablePair<String, DataType>(OPERATIONAL_ENVIRONMENT_ID, DataType.varchar()));
27 public List<ImmutablePair<String, DataType>> clusteringKeys() {
28 List<ImmutablePair<String, DataType>> keys = new ArrayList<>();
29 keys.add(new ImmutablePair<String, DataType>(TIMESTAMP_FIELD, DataType.timestamp()));
34 public String getKeyspace() {
35 return AuditingTypesConstants.AUDIT_KEYSPACE;
39 public Map<String, ImmutablePair<DataType, Boolean>> getColumnDescription() {
40 Map<String, ImmutablePair<DataType, Boolean>> columns = new HashMap<>();
42 Arrays.stream(EcompOpEnvFieldsDescription.values())
43 .forEach(column -> columns.put(column.getName(), ImmutablePair.of(column.getType(), column.isIndexed())));
48 public String getTableName() {
49 return AuditingTypesConstants.ECOMP_OPERATIONAL_ENV_EVENT_TYPE;
52 enum EcompOpEnvFieldsDescription {
53 ACTION("action", DataType.varchar(), false),
54 OPERATIONAL_ENVIRONMENT_NAME("operational_environment_name", DataType.varchar(), false),
55 OPERATIONAL_ENVIRONMENT_TYPE("operational_environment_type", DataType.varchar(), false),
56 OPERATIONAL_ENVIRONMENT_ACTION("operational_environment_action", DataType.varchar(), false),
57 TENANT_CONTEXT("tenant_context", DataType.varchar(), false);
60 private DataType type;
61 private boolean indexed;
63 EcompOpEnvFieldsDescription(String name, DataType type, boolean indexed) {
66 this.indexed = indexed;
69 public String getName() {
73 public DataType getType() {
77 public boolean isIndexed() {