logger = new LoggerWrapper("Database.ContentToTopics");
hasTimestamp = false;
- theTable="content_x_topic";
+ mainTable="content_x_topic";
theEntityClass = mir.entity.GenericEntity.class;
}
String id = content.getId();
try {
Vector extraTables = new Vector();
- extraTables.add(theTable+" cxt");
+ extraTables.add(mainTable+" cxt");
returnList = DatabaseTopics.getInstance()
- .selectByWhereClauseWithExtraTables("t",extraTables,
- "t.id=cxt.topic_id and cxt.content_id="+id );
+ .selectByWhereClauseWithExtraTables("t",extraTables,
+ "t.id=cxt.topic_id and cxt.content_id="+id );
}
catch (Exception e) {
logger.error("-- get topics failed " + e.toString());
ArrayList returnList = new ArrayList();
if (contentId != null) {
- String sql = "select topic_id from " + theTable + " where content_id=" + contentId;
+ String sql = "select topic_id from " + mainTable + " where content_id=" + contentId;
Connection con=null;Statement stmt=null;
try {
con = getPooledCon();
logger.debug("to add = " + topicsToAdd.toString());
- if (!topicsToDelete.isEmpty()) {
+ if (!topicsToDelete.isEmpty()) {
String sql =
- "delete from " + theTable + " " +
+ "delete from " + mainTable + " " +
"where content_id=" + anArticleId +
" and topic_id in (" + getIdListExpression(topicsToDelete) + ")";
while (i.hasNext()) {
Integer topicId = (Integer) i.next();
String sql =
- "insert into " + theTable + " (content_id, topic_id) "+
+ "insert into " + mainTable + " (content_id, topic_id) "+
"values (" + anArticleId + "," + topicId + ")";
Connection connection=null;
Statement statement=null;
return;
}
//delete all row with content_id=contentId
- String sql = "delete from "+ theTable +" where content_id=" + contentId;
+ String sql = "delete from "+ mainTable +" where content_id=" + contentId;
Connection con=null;Statement stmt=null;
try {
return;
}
//delete all row with content_id=contentId
- String sql = "delete from "+ theTable +" where topic_id=" + topicId;
+ String sql = "delete from "+ mainTable +" where topic_id=" + topicId;
Connection con=null;Statement stmt=null;
try {
freeConnection(con,stmt);
}
}
-
+
/**
* Returns list of Content for a specific topic
* @param topic
String id = topic.getId();
try {
Vector extraTables = new Vector();
- extraTables.add(theTable+" cxt");
+ extraTables.add(mainTable+" cxt");
returnList = DatabaseContent.getInstance()
- .selectByWhereClauseWithExtraTables("c",extraTables,
- "c.id=cxt.content_id and cxt.topic_id="+id );
+ .selectByWhereClauseWithExtraTables("c",extraTables,
+ "c.id=cxt.content_id and cxt.topic_id="+id );
}
catch (Exception e) {
logger.error("-- get content failed");