aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportDataCommand.java1
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportSerializer.java29
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java5
3 files changed, 20 insertions, 15 deletions
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportDataCommand.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportDataCommand.java
index aac1202506..decd0cee9a 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportDataCommand.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportDataCommand.java
@@ -46,6 +46,7 @@ public final class ExportDataCommand {
public static final String MAP_DELIMITER = "!@";
public static final String MAP_DELIMITER_SPLITTER = "\\!\\@";
public static final int THREAD_POOL_SIZE = 6;
+ public static final String NULL_REPRESENTATION = "nnuullll";
private ExportDataCommand() {
}
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 92dfeca3c1..e4b0610019 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
@@ -3,21 +3,15 @@
*/
package org.openecomp.core.tools.exportinfo;
+import static org.openecomp.core.tools.exportinfo.ExportDataCommand.NULL_REPRESENTATION;
+import static org.openecomp.core.tools.importinfo.ImportSingleTable.dataTypesMap;
+
import com.datastax.driver.core.DataType.Name;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.google.gson.JsonSyntaxException;
-import org.apache.commons.lang3.StringUtils;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.openecomp.core.tools.importinfo.ImportProperties;
-import org.openecomp.core.tools.model.ColumnDefinition;
-import org.openecomp.core.tools.model.TableData;
-import org.openecomp.core.tools.util.Utils;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
@@ -30,8 +24,14 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
-
-import static org.openecomp.core.tools.importinfo.ImportSingleTable.dataTypesMap;
+import org.apache.commons.lang3.StringUtils;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.openecomp.core.tools.importinfo.ImportProperties;
+import org.openecomp.core.tools.model.ColumnDefinition;
+import org.openecomp.core.tools.model.TableData;
+import org.openecomp.core.tools.util.Utils;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
public class ExportSerializer {
@@ -39,6 +39,7 @@ public class ExportSerializer {
private static final String ELEMENT_TABLE_NAME = "element";
private static final String ELEMENT_INFO_COLUMN_NAME = "info";
+
public void serializeResult(final ResultSet resultSet, final Set<String> filteredItems, final String filteredColumn, Set<String> vlms) {
try {
TableData tableData = new TableData();
@@ -79,7 +80,7 @@ public class ExportSerializer {
case ASCII:
String string = row.getString(i);
if (string == null) {
- string = "";
+ string = NULL_REPRESENTATION;
}
if (checkForVLM && vlms != null) {
String vlm = extractVlm(string);
@@ -117,12 +118,12 @@ public class ExportSerializer {
data = row.getFloat(i);
break;
case SET:
- Set<Object> set = row.getSet(i, Object.class);
+ Set<Object> set = (Set<Object>) row.getObject(i);
Object joined = set.stream().map(Object::toString).collect(Collectors.joining(ExportDataCommand.JOIN_DELIMITER));
data = Base64.getEncoder().encodeToString(joined.toString().getBytes());
break;
case MAP:
- Map<Object, Object> map = row.getMap(i, Object.class, Object.class);
+ Map<Object, Object> map = (Map<Object, Object>) row.getObject(i);
Set<Map.Entry<Object, Object>> entrySet = map.entrySet();
Object mapAsString = entrySet.parallelStream().map(entry -> entry.getKey().toString() + ExportDataCommand.MAP_DELIMITER + entry.getValue().toString())
.collect(Collectors.joining(ExportDataCommand.JOIN_DELIMITER));
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 ed016aa997..3cac0e7892 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
@@ -1,5 +1,7 @@
package org.openecomp.core.tools.importinfo;
+import static org.openecomp.core.tools.exportinfo.ExportDataCommand.NULL_REPRESENTATION;
+
import com.datastax.driver.core.BoundStatement;
import com.datastax.driver.core.DataType.Name;
import com.datastax.driver.core.PreparedStatement;
@@ -74,7 +76,8 @@ public class ImportSingleTable {
case VARCHAR:
case TEXT:
case ASCII:
- bind.setString(i, new String(Base64.getDecoder().decode(rowData)));
+ String string = new String(Base64.getDecoder().decode(rowData));
+ bind.setString(i, NULL_REPRESENTATION.equals(string) ? null : string);
break;
case BLOB:
bind.setBytes(i, ByteBuffer.wrap(Base64.getDecoder().decode(rowData.getBytes())));