2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2021 Nordix Foundation
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 * SPDX-License-Identifier: Apache-2.0
17 * ============LICENSE_END=========================================================
20 package org.openecomp.sdc.be.dao.cassandra.schema.tables;
22 import com.datastax.driver.core.DataType;
23 import java.util.Collections;
24 import java.util.List;
26 import java.util.stream.Collectors;
27 import java.util.stream.Stream;
28 import lombok.AllArgsConstructor;
30 import org.apache.commons.lang3.tuple.ImmutablePair;
31 import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription;
32 import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
34 public class ToscaImportByModelTableDescription implements ITableDescription {
36 private static final String MODEL_ID = "model_id";
37 private static final String FULL_PATH = "full_path";
40 public List<ImmutablePair<String, DataType>> primaryKeys() {
42 new ImmutablePair<>(MODEL_ID, DataType.varchar()),
43 new ImmutablePair<>(FULL_PATH, DataType.varchar())
48 public List<ImmutablePair<String, DataType>> clusteringKeys() {
49 return Collections.emptyList();
53 public Map<String, ImmutablePair<DataType, Boolean>> getColumnDescription() {
54 return Stream.of(SdcSchemaFilesFieldsDescription.values())
55 .collect(Collectors.toMap(SdcSchemaFilesFieldsDescription::getName, field -> new ImmutablePair<>(field.type, field.indexed)));
59 public String getKeyspace() {
60 return AuditingTypesConstants.ARTIFACT_KEYSPACE;
64 public String getTableName() {
65 return "tosca_import_by_model";
70 enum SdcSchemaFilesFieldsDescription {
71 MODEL_ID("model_id", DataType.varchar(), true),
72 CONTENT("content", DataType.varchar(), false);
74 private final String name;
75 private final DataType type;
76 private final boolean indexed;