Merge "Release 3.2.38"
[music.git] / music-core / src / main / java / org / onap / music / datastore / jsonobjects / JsonTable.java
index ef56014..0ba1a7e 100644 (file)
@@ -144,11 +144,6 @@ public class JsonTable {
     }
     
     public PreparedQueryObject genCreateTableQuery()  throws MusicQueryException {
-        if (logger.isDebugEnabled()) {
-            logger.debug("Coming inside genCreateTableQuery method " + this.getKeyspaceName());
-            logger.debug("Coming inside genCreateTableQuery method " + this.getTableName());
-        }
-
         String primaryKey = null;
         String partitionKey = this.getPartitionKey();
         String clusterKey = this.getClusteringKey();
@@ -171,8 +166,10 @@ public class JsonTable {
             if (entry.getKey().equals("PRIMARY KEY")) {
                 primaryKey = entry.getValue(); // replaces primaryKey
                 primaryKey = primaryKey.trim();
-            } else {
-                if (counter == 0 )  fieldsString.append("" + entry.getKey() + " " + entry.getValue() + "");
+            } 
+                       else {
+                if (counter == 0 ) 
+                                       fieldsString.append("" + entry.getKey() + " " + entry.getValue() + "");
                 else fieldsString.append("," + entry.getKey() + " " + entry.getValue() + "");
             }
 
@@ -214,7 +211,8 @@ public class JsonTable {
                             clusterKey=clusterKey.substring(1);
                         }
                         clusterKey = clusterKey.trim();
-                        if (clusterKey.equals(",") ) clusterKey=""; // print error if needed    ( ... ),)
+                        if (clusterKey.equals(",") )
+                                                       clusterKey=""; // print error if needed    ( ... ),)
                     }
 
                     if (!(partitionKey.isEmpty() || clusterKey.isEmpty())
@@ -231,12 +229,16 @@ public class JsonTable {
 
                     }
 
-                    if (partitionKey.isEmpty() )  primaryKey="";
-                    else  if (clusterKey.isEmpty() ) primaryKey=" (" + partitionKey  + ")";
-                    else  primaryKey=" (" + partitionKey + ")," + clusterKey;
+                    if (partitionKey.isEmpty() ) 
+                                               primaryKey="";
+                    else  if (clusterKey.isEmpty() ) 
+                                               primaryKey=" (" + partitionKey  + ")";
+                    else 
+                                               primaryKey=" (" + partitionKey + ")," + clusterKey;
 
             
-                    if (primaryKey != null) fieldsString.append(", PRIMARY KEY (" + primaryKey + " )");
+                    if (primaryKey != null) 
+                                               fieldsString.append(", PRIMARY KEY (" + primaryKey + " )");
 
                 } else { // end of length > 0
                 
@@ -253,11 +255,15 @@ public class JsonTable {
                                 Status.BAD_REQUEST.getStatusCode());
                     }
 
-                    if (partitionKey.isEmpty() )  primaryKey="";
-                    else  if (clusterKey.isEmpty() ) primaryKey=" (" + partitionKey  + ")";
-                    else  primaryKey=" (" + partitionKey + ")," + clusterKey;
+                    if (partitionKey.isEmpty() ) 
+                                               primaryKey="";
+                    else  if (clusterKey.isEmpty() )
+                                               primaryKey=" (" + partitionKey  + ")";
+                    else 
+                                               primaryKey=" (" + partitionKey + ")," + clusterKey;
 
-                    if (primaryKey != null) fieldsString.append(", PRIMARY KEY (" + primaryKey + " )");
+                    if (primaryKey != null) 
+                                               fieldsString.append(", PRIMARY KEY (" + primaryKey + " )");
                 }
                 fieldsString.append(")");
 
@@ -340,36 +346,12 @@ public class JsonTable {
         return queryObject;
     }
 
-    /**
-     * 
-     * @return
-     */
-    public PreparedQueryObject genCreateShadowLockingTableQuery() {
-        if (logger.isDebugEnabled()) {
-            logger.debug("Coming inside genCreateShadowLockingTableQuery method " + this.getKeyspaceName());
-            logger.debug("Coming inside genCreateShadowLockingTableQuery method " + this.getTableName());
-        }
-
-        String tableName = "unsyncedKeys_" + this.getTableName();
-        String tabQuery = "CREATE TABLE IF NOT EXISTS " + this.getKeyspaceName() + "." + tableName
-                + " ( key text,PRIMARY KEY (key) );";
-        PreparedQueryObject queryObject = new PreparedQueryObject();
-        queryObject.appendQueryString(tabQuery);
-
-        return queryObject;
-    }
-
     /**
      * genDropTableQuery
      * 
      * @return PreparedQueryObject
      */
     public PreparedQueryObject genDropTableQuery() {
-        if (logger.isDebugEnabled()) {
-            logger.debug("Coming inside genDropTableQuery method " + this.getKeyspaceName());
-            logger.debug("Coming inside genDropTableQuery method " + this.getTableName());
-        }
-
         PreparedQueryObject query = new PreparedQueryObject();
         query.appendQueryString("DROP TABLE  " + this.getKeyspaceName() + "." + this.getTableName() + ";");
         logger.info("Delete Query ::::: " + query.getQuery());