1 package org.openecomp.sdc.be.dao.cassandra.schema.tables;
3 import com.datastax.driver.core.DataType;
4 import org.apache.commons.lang3.tuple.ImmutablePair;
5 import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription;
6 import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
10 public class EcompOperationalEnvironmentEventTableDesc implements ITableDescription {
12 private static final String OPERATIONAL_ENVIRONMENT_ID = "operational_environment_id";
15 public List<ImmutablePair<String, DataType>> primaryKeys() {
16 List<ImmutablePair<String, DataType>> keys = new ArrayList<>();
17 keys.add(new ImmutablePair<>(OPERATIONAL_ENVIRONMENT_ID, DataType.varchar()));
22 public List<ImmutablePair<String, DataType>> clusteringKeys() {
23 List<ImmutablePair<String, DataType>> keys = new ArrayList<>();
24 keys.add(new ImmutablePair<>(TIMESTAMP_FIELD, DataType.timestamp()));
29 public String getKeyspace() {
30 return AuditingTypesConstants.AUDIT_KEYSPACE;
34 public Map<String, ImmutablePair<DataType, Boolean>> getColumnDescription() {
35 Map<String, ImmutablePair<DataType, Boolean>> columns = new HashMap<>();
37 Arrays.stream(EcompOpEnvFieldsDescription.values())
38 .forEach(column -> columns.put(column.getName(), ImmutablePair.of(column.getType(), column.isIndexed())));
43 public String getTableName() {
44 return AuditingTypesConstants.ECOMP_OPERATIONAL_ENV_EVENT_TYPE;
47 enum EcompOpEnvFieldsDescription {
48 ACTION("action", DataType.varchar(), false),
49 OPERATIONAL_ENVIRONMENT_NAME("operational_environment_name", DataType.varchar(), false),
50 OPERATIONAL_ENVIRONMENT_TYPE("operational_environment_type", DataType.varchar(), false),
51 OPERATIONAL_ENVIRONMENT_ACTION("operational_environment_action", DataType.varchar(), false),
52 TENANT_CONTEXT("tenant_context", DataType.varchar(), false);
55 private DataType type;
56 private boolean indexed;
58 EcompOpEnvFieldsDescription(String name, DataType type, boolean indexed) {
61 this.indexed = indexed;
64 public String getName() {
68 public DataType getType() {
72 public boolean isIndexed() {