aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/lib/openecomp-common-lib/pom.xml1
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatPseudoParameters.java16
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportSerializer.java10
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java8
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/model/TableData.java6
5 files changed, 19 insertions, 22 deletions
diff --git a/openecomp-be/lib/openecomp-common-lib/pom.xml b/openecomp-be/lib/openecomp-common-lib/pom.xml
index a2a36c3cab..9ffb3c5284 100644
--- a/openecomp-be/lib/openecomp-common-lib/pom.xml
+++ b/openecomp-be/lib/openecomp-common-lib/pom.xml
@@ -46,6 +46,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
+ <version>${apache-commons-text.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatPseudoParameters.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatPseudoParameters.java
index 7ed8203bfe..73020bcbcf 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatPseudoParameters.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatPseudoParameters.java
@@ -23,33 +23,27 @@ package org.openecomp.sdc.heat.datatypes.model;
import java.util.ArrayList;
import java.util.List;
+import lombok.AllArgsConstructor;
import lombok.Getter;
+@AllArgsConstructor
@Getter
public enum HeatPseudoParameters {
OS_STACK_NAME("OS::stack_name"),
OS_STACK_ID("OS::stack_id"),
OS_PROJECT_ID("OS::project_id");
- private static List<String> pseudoParameterNames;
- private String pseudoParameter;
+ private static final List<String> pseudoParameterNames = new ArrayList<>();
+ private final String pseudoParameter;
static {
- pseudoParameterNames = new ArrayList<>();
- for (HeatPseudoParameters parameter : HeatPseudoParameters.values()) {
+ for (HeatPseudoParameters parameter : values()) {
pseudoParameterNames.add(parameter.getPseudoParameter());
}
}
- HeatPseudoParameters(String pseudoParameter) {
- this.pseudoParameter = pseudoParameter;
- }
-
public static List<String> getPseudoParameterNames() {
return pseudoParameterNames;
}
- public static void setPseudoParameterNames(List<String> pseudoParameterNames) {
- HeatPseudoParameters.pseudoParameterNames = pseudoParameterNames;
- }
}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportSerializer.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportSerializer.java
index b41f74fc69..3454b99dc2 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportSerializer.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportSerializer.java
@@ -53,8 +53,8 @@ public class ExportSerializer {
public void serializeResult(final ResultSet resultSet, final Set<String> filteredItems, final String filteredColumn, Set<String> vlms) {
try {
TableData tableData = new TableData();
- tableData.definitions = resultSet.getColumnDefinitions().asList().stream().map(ColumnDefinition::new).collect(Collectors.toList());
- String table = tableData.definitions.iterator().next().getTable();
+ tableData.getDefinitions().addAll(resultSet.getColumnDefinitions().asList().stream().map(ColumnDefinition::new).collect(Collectors.toList()));
+ String table = tableData.getDefinitions().iterator().next().getTable();
boolean isElementTable = table.equals(ELEMENT_TABLE_NAME);
Iterator<Row> iterator = resultSet.iterator();
iterator.forEachRemaining(row -> {
@@ -62,14 +62,14 @@ public class ExportSerializer {
return;
}
List<String> rowData = new ArrayList<>();
- for (int i = 0; i < tableData.definitions.size(); i++) {
- ColumnDefinition columnDefinition = tableData.definitions.get(i);
+ for (int i = 0; i < tableData.getDefinitions().size(); i++) {
+ ColumnDefinition columnDefinition = tableData.getDefinitions().get(i);
Name name = dataTypesMap.get(columnDefinition.getType());
boolean checkForVLM = isElementTable && columnDefinition.getName().equals(ELEMENT_INFO_COLUMN_NAME);
Object data = convertByType(vlms, row, i, name, checkForVLM);
rowData.add(data.toString());
}
- tableData.rows.add(rowData);
+ tableData.getRows().add(rowData);
});
ObjectMapper objectMapper = new ObjectMapper();
String fileName = ImportProperties.ROOT_DIRECTORY + File.separator + table + "_" + System.currentTimeMillis() + ".json";
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java
index 40486c8269..64c595caa5 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java
@@ -61,7 +61,7 @@ public class ImportSingleTable {
TableData tableData = objectMapper.readValue(file.toFile(), TableData.class);
Session session = CassandraSessionFactory.getSession();
PreparedStatement ps = getPrepareStatement(tableData, session);
- tableData.rows.forEach(row -> executeQuery(session, ps, tableData.definitions, row));
+ tableData.getRows().forEach(row -> executeQuery(session, ps, tableData.getDefinitions(), row));
} catch (IOException e) {
Utils.logError(logger, e);
}
@@ -153,12 +153,12 @@ public class ImportSingleTable {
}
private String createQuery(TableData tableData) {
- ColumnDefinition def = tableData.definitions.iterator().next();
+ ColumnDefinition def = tableData.getDefinitions().iterator().next();
StringBuilder sb = new StringBuilder(1024);
sb.append(INSERT_INTO).append(def.getKeyspace()).append(".").append(def.getTable());
- sb.append(tableData.definitions.stream().map(ColumnDefinition::getName)
+ sb.append(tableData.getDefinitions().stream().map(ColumnDefinition::getName)
.collect(Collectors.joining(" , ", " ( ", " ) ")));
- sb.append(VALUES).append(tableData.definitions.stream().map(definition -> "?")
+ sb.append(VALUES).append(tableData.getDefinitions().stream().map(definition -> "?")
.collect(Collectors.joining(" , ", " ( ", " ) "))).append(";");
return sb.toString();
}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/model/TableData.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/model/TableData.java
index a6fdbd801e..77b6ca1b76 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/model/TableData.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/model/TableData.java
@@ -21,8 +21,10 @@ package org.openecomp.core.tools.model;
import java.util.ArrayList;
import java.util.List;
+import lombok.Getter;
+@Getter
public class TableData {
- public List<ColumnDefinition> definitions = new ArrayList<>();
- public List<List<String>> rows = new ArrayList<>();
+ private final List<ColumnDefinition> definitions = new ArrayList<>();
+ private final List<List<String>> rows = new ArrayList<>();
}