1.1 restoration
[mir.git] / source / mircoders / storage / DatabaseContentToTopics.java
index 2ad9fb2..2186c5e 100755 (executable)
@@ -76,8 +76,6 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
 
   /**
    * This class return an EntityList of Topics
-   * @param EntityContent content
-   * @returns EntityList
    */
   public EntityList getTopics(EntityContent content) {
     EntityList returnList=null;
@@ -99,8 +97,7 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
   }
 
   /**
-   * Returns a ArrayList of Integer-Objects from a content-id.
-   * @returns ArrayList
+   * Returns a List of String-Objects from a content-id.
    */
   public List getTopicsOfContent(String contentId)
     throws StorageObjectFailure {
@@ -110,13 +107,14 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
       String sql = "select topic_id from " + mainTable + " where content_id=" + contentId;
       Connection con=null;Statement stmt=null;
       try {
-        con = getPooledCon();
+        con = obtainConnection();
+
         // should be a preparedStatement because is faster
         stmt = con.createStatement();
         ResultSet rs = executeSql(stmt,sql);
         if(rs!=null){
           while(rs.next()){
-            returnList.add(new Integer(rs.getInt("topic_id")));
+            returnList.add(Integer.toString(rs.getInt("topic_id")));
           }
         }
       }
@@ -163,9 +161,9 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
     List currentTopics = getTopicsOfContent(anArticleId);
     logger.debug("New topics = " + newTopics.toString());
     logger.debug("Current topics = " + currentTopics.toString());
-    List topicsToDelete = new Vector(currentTopics);
+    List topicsToDelete = new ArrayList(currentTopics);
     topicsToDelete.removeAll(newTopics);
-    List topicsToAdd = new Vector(newTopics);
+    List topicsToAdd = new ArrayList(newTopics);
     topicsToAdd.removeAll(currentTopics);
     logger.debug("to delete = " + topicsToDelete.toString());
     logger.debug("to add = " + topicsToAdd.toString());
@@ -180,9 +178,9 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
       Connection connection=null;
       Statement statement=null;
       try {
-        connection = getPooledCon();
+        connection = obtainConnection();
         statement = connection.createStatement();
-        int rs = executeUpdate(statement, sql);
+        executeUpdate(statement, sql);
       }
       catch (Exception e) {
         logger.error("-- deleting topics failed");
@@ -205,10 +203,10 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
       Connection connection=null;
       Statement statement=null;
       try {
-        connection = getPooledCon();
+        connection = obtainConnection();
         // should be a preparedStatement because is faster
         statement = connection.createStatement();
-        int rs = executeUpdate(statement, sql);
+        executeUpdate(statement, sql);
       }
       catch (Exception e) {
         logger.error("-- adding topics failed");
@@ -234,10 +232,10 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
 
     Connection con=null;Statement stmt=null;
     try {
-      con = getPooledCon();
+      con = obtainConnection();
       // should be a preparedStatement because is faster
       stmt = con.createStatement();
-      ResultSet rs = executeSql(stmt,sql);
+      executeSql(stmt,sql);
     } catch (Exception e) {
       //theLog.printDebugInfo("-- delete topics failed  ");
     } finally {
@@ -256,10 +254,10 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
 
     Connection con=null;Statement stmt=null;
     try {
-      con = getPooledCon();
+      con = obtainConnection();
       // should be a preparedStatement because is faster
       stmt = con.createStatement();
-      ResultSet rs = executeSql(stmt,sql);
+      executeSql(stmt,sql);
     }
     catch (Exception e) {
       logger.error("-- delete topics failed ");