aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/music/datastore/MusicDataStore.java
diff options
context:
space:
mode:
authorThomas Nelson Jr (arthurdent3) tn1381@att.com <tn1381@att.com>2018-07-16 16:41:20 -0400
committerThomas Nelson Jr (arthurdent3) tn1381@att.com <tn1381@att.com>2018-07-16 16:41:20 -0400
commit9b6efbd93a12c858a0d2643013217ec3d6c3a46d (patch)
treebaf6c8de19daba3f4dc2b7761bda4cb858ba90e4 /src/main/java/org/onap/music/datastore/MusicDataStore.java
parent5a28a331688c5578fef9c64d462d07cbae6797da (diff)
various Updates
Q-api, triggers, conductor conditional updates. Bug fixes Change-Id: Iec392309787cd90f0a2827a2955399723640e800 Issue-ID: MUSIC-93 Signed-off-by: Thomas Nelson Jr (arthurdent3) tn1381@att.com <tn1381@att.com>
Diffstat (limited to 'src/main/java/org/onap/music/datastore/MusicDataStore.java')
-rw-r--r--src/main/java/org/onap/music/datastore/MusicDataStore.java27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/main/java/org/onap/music/datastore/MusicDataStore.java b/src/main/java/org/onap/music/datastore/MusicDataStore.java
index e9356f9d..563e07f5 100644
--- a/src/main/java/org/onap/music/datastore/MusicDataStore.java
+++ b/src/main/java/org/onap/music/datastore/MusicDataStore.java
@@ -24,6 +24,7 @@ package org.onap.music.datastore;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
+import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
@@ -51,6 +52,7 @@ import com.datastax.driver.core.TableMetadata;
import com.datastax.driver.core.exceptions.AlreadyExistsException;
import com.datastax.driver.core.exceptions.InvalidQueryException;
import com.datastax.driver.core.exceptions.NoHostAvailableException;
+import com.sun.jersey.core.util.Base64;
/**
* @author nelson24
@@ -259,6 +261,12 @@ public class MusicDataStore {
return null;
}
}
+
+ public byte[] getBlobValue(Row row, String colName, DataType colType) {
+ ByteBuffer bb = row.getBytes(colName);
+ byte[] data = bb.array();
+ return data;
+ }
public boolean doesRowSatisfyCondition(Row row, Map<String, Object> condition) throws Exception {
ColumnDefinitions colInfo = row.getColumnDefinitions();
@@ -288,9 +296,15 @@ public class MusicDataStore {
ColumnDefinitions colInfo = row.getColumnDefinitions();
HashMap<String, Object> resultOutput = new HashMap<String, Object>();
for (Definition definition : colInfo) {
- if (!definition.getName().equals("vector_ts"))
- resultOutput.put(definition.getName(),
+ if (!definition.getName().equals("vector_ts")) {
+ if(definition.getType().toString().toLowerCase().contains("blob")) {
+ resultOutput.put(definition.getName(),
+ getBlobValue(row, definition.getName(), definition.getType()));
+ }
+ else
+ resultOutput.put(definition.getName(),
getColValue(row, definition.getName(), definition.getType()));
+ }
}
resultMap.put("row " + counter, resultOutput);
counter++;
@@ -326,10 +340,15 @@ public class MusicDataStore {
+ queryObject.getValues());
PreparedStatement preparedInsert = null;
try {
- preparedInsert = session.prepare(queryObject.getQuery());
+
+ preparedInsert = session.prepare(queryObject.getQuery());
+
} catch(InvalidQueryException iqe) {
- logger.error(EELFLoggerDelegate.errorLogger, iqe.getMessage());
+ logger.error(EELFLoggerDelegate.errorLogger, iqe.getMessage(),AppMessages.QUERYERROR, ErrorSeverity.CRITICAL, ErrorTypes.QUERYERROR);
throw new MusicQueryException(iqe.getMessage());
+ }catch(Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.QUERYERROR, ErrorSeverity.CRITICAL, ErrorTypes.QUERYERROR);
+ throw new MusicQueryException(e.getMessage());
}
try {