/**
* This class return an EntityList of Topics
- * @param EntityContent content
- * @returns EntityList
*/
public EntityList getTopics(EntityContent content) {
EntityList returnList=null;
}
/**
- * 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 {
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")));
}
}
}
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());
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");
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");
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 {
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 ");