import java.util.*;
import java.lang.*;
import com.javaexchange.dbConnectionBroker.*;
+import mir.storage.StorageObjectException;
/**
* Title: Mir
(String)configHash.get(propName);
}
- public static void addBroker(String driver, String URL) throws Exception {
+ public static void addBroker(String driver, String URL) throws StorageObjectException {
String username,passwd,min,max,log,reset;
if (br!=null){
instances++;
brokerHash.put("Pool.broker",br);
- } else {
- throw new Exception();
}
- } catch(Exception e){
+ } catch(IOException e){
System.err.println("Der ConnectionBroker konnte nicht initializiert werden"+ e.toString());e.printStackTrace();
- throw new Exception(e.toString());
- }
+ throw new StorageObjectException(e.toString());
+ }
} // end if
}
* @param EntityContent content
* @returns EntityList
*/
- public EntityList getTopics(EntityContent content)
- throws StorageObjectException {
+ public EntityList getTopics(EntityContent content) {
EntityList returnList=null;
if (content != null) {
// get all to_topic from content_x_topic
returnList = DatabaseTopics.getInstance().selectByWhereClause(subselect,-1);
} catch (Exception e) {
theLog.printDebugInfo("-- get topics failed " + e.toString());
- throw new StorageObjectException("-- get topics failed " + e.toString());
}
}
return returnList;
} catch (Exception e) {
theLog.printError(e.toString());
theLog.printError("-- get topicsofcontent failed");
- throw new StorageObjectException("-- get topicsofcontent failed" + e.toString());
} finally {
freeConnection(con,stmt);
}
return;
}
//first check which topics this article has
- ArrayList hasTopics = getTopicsOfContent(contentId);
- ArrayList toSet = new ArrayList();
- ArrayList toDelete = new ArrayList();
+ Collection hasTopics = getTopicsOfContent(contentId);
+ Collection toSet = new ArrayList();
+ Collection toDelete = new ArrayList();
if(hasTopics!=null && hasTopics.size()>0){
//now we check if there are new topics and copy them to an array.
}
} else {
//all the topics has to be set, so we copy all to the array
- toSet=(ArrayList)Arrays.asList(topicId);
+ for (int i = 0; i < topicId.length; i++){
+ toSet.add(topicId[i]);
+ }
}
//first delete all row with content_id=contentId
int rs = executeUpdate(stmt,sql);
} catch (Exception e) {
theLog.printDebugInfo("-- deleting topics failed");
- throw new StorageObjectException("-- deleting topics failed" + e.toString());
} finally {
freeConnection(con,stmt);
}
int rs = executeUpdate(stmt,sql);
} catch (Exception e) {
theLog.printDebugInfo("-- set topics failed -- insert laenge topicId" + topicId.length);
- throw new StorageObjectException("-- set topics failed" + e.toString());
} finally {
freeConnection(con,stmt);
}
stmt = con.createStatement();
ResultSet rs = executeSql(stmt,sql);
} catch (Exception e) {
- theLog.printDebugInfo("-- delete topics by contentId failed ");
- throw new StorageObjectException("-- delete topics by contentId failed" + e.toString());
+ //theLog.printDebugInfo("-- delete topics failed ");
} finally {
freeConnection(con,stmt);
}
ResultSet rs = executeSql(stmt,sql);
} catch (Exception e) {
theLog.printDebugInfo("-- delete topics failed ");
- throw new StorageObjectException("-- delete topics by topicId failed" + e.toString());
} finally {
freeConnection(con,stmt);
}
returnList = DatabaseContent.getInstance().selectByWhereClause(topicSelect,-1);
}
}
- catch (Exception e) {
- theLog.printDebugInfo("-- get content failed");
- throw new StorageObjectException("-- get content failed" + e.toString());
- } finally { freeConnection(con,stmt);}
+ catch (Exception e) {theLog.printDebugInfo("-- get contetn failed");}
+ finally { freeConnection(con,stmt);}
}
return returnList;
}