Index: lams_tool_scratchie/conf/xdoclet/struts-actions.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_scratchie/conf/xdoclet/struts-actions.xml,v
diff -u -r1.20.2.2 -r1.20.2.3
--- lams_tool_scratchie/conf/xdoclet/struts-actions.xml 3 Jul 2015 15:42:12 -0000 1.20.2.2
+++ lams_tool_scratchie/conf/xdoclet/struts-actions.xml 5 Apr 2016 17:24:33 -0000 1.20.2.3
@@ -212,6 +212,14 @@
+
+
+
+
+
+
+
+
+
@@ -75,6 +80,9 @@
+
+
+
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/BurningQuestionLikeDAO.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieBurningQuestionDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieBurningQuestionDAO.java,v
diff -u -r1.2.2.3 -r1.2.2.4
--- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieBurningQuestionDAO.java 3 Jul 2015 20:24:51 -0000 1.2.2.3
+++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieBurningQuestionDAO.java 5 Apr 2016 17:24:33 -0000 1.2.2.4
@@ -25,11 +25,12 @@
import java.util.List;
+import org.lamsfoundation.lams.tool.scratchie.dto.BurningQuestionDTO;
import org.lamsfoundation.lams.tool.scratchie.model.ScratchieBurningQuestion;
public interface ScratchieBurningQuestionDAO extends DAO {
- List getBurningQuestionsByItemUid(Long itemUid);
+ List getBurningQuestionsByContentId(Long scratchieUid, Long sessionId);
ScratchieBurningQuestion getBurningQuestionBySessionAndItem(Long sessionId, Long itemUid);
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/BurningQuestionLikeDAOHibernate.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieBurningQuestionDAOHibernate.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieBurningQuestionDAOHibernate.java,v
diff -u -r1.2.2.3 -r1.2.2.4
--- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieBurningQuestionDAOHibernate.java 3 Jul 2015 20:24:52 -0000 1.2.2.3
+++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieBurningQuestionDAOHibernate.java 5 Apr 2016 17:24:33 -0000 1.2.2.4
@@ -23,10 +23,17 @@
/* $Id$ */
package org.lamsfoundation.lams.tool.scratchie.dao.hibernate;
+import java.util.ArrayList;
import java.util.List;
+import org.hibernate.Hibernate;
+import org.hibernate.SQLQuery;
+import org.hibernate.type.IntegerType;
+import org.hibernate.type.LongType;
+import org.hibernate.type.StringType;
import org.lamsfoundation.lams.dao.hibernate.LAMSBaseDAO;
import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieBurningQuestionDAO;
+import org.lamsfoundation.lams.tool.scratchie.dto.BurningQuestionDTO;
import org.lamsfoundation.lams.tool.scratchie.model.ScratchieBurningQuestion;
public class ScratchieBurningQuestionDAOHibernate extends LAMSBaseDAO implements ScratchieBurningQuestionDAO {
@@ -49,8 +56,57 @@
// }
@Override
- public List getBurningQuestionsByItemUid(Long itemUid) {
- return (List) this.doFind(FIND_BY_ITEM_UID, new Object[] { itemUid});
+ @SuppressWarnings("unchecked")
+ public List getBurningQuestionsByContentId(Long scratchieUid, Long sessionId) {
+
+ /* Thread based lookups - Returns a complex structure so that the likes information can be passed
+ * back with it. */
+ String GET_BURNING_QUESTIONS_WITH_LIKES =
+ "SELECT bq.*, ANY_VALUE(session.session_name) sessionName, count(like1.uid) total_likes ";
+ //in case sessionId is provided - we need to also return which burning questions leader has liked
+ if (sessionId != null) {
+ GET_BURNING_QUESTIONS_WITH_LIKES +=
+ ", EXISTS(select * from tl_lascrt11_burning_que_like like2 where bq.uid = like2.burning_question_uid AND like2.session_id=:sessionId) user_liked";
+ }
+ GET_BURNING_QUESTIONS_WITH_LIKES +=
+ " FROM tl_lascrt11_burning_question bq "
+ + " JOIN tl_lascrt11_session session"
+ + " ON session.scratchie_uid = :scratchieUid AND bq.session_id = session.session_id "
+ + " LEFT JOIN tl_lascrt11_burning_que_like like1 ON bq.uid = like1.burning_question_uid "
+ + " WHERE bq.question IS NOT NULL AND bq.question != ''"
+ + " GROUP BY bq.uid";
+
+ SQLQuery query = getSession().createSQLQuery(GET_BURNING_QUESTIONS_WITH_LIKES);
+ query.addEntity("bq", ScratchieBurningQuestion.class)
+ .addScalar("sessionName", StringType.INSTANCE)
+ .addScalar("total_likes", IntegerType.INSTANCE)
+ .setLong("scratchieUid", scratchieUid);
+ if (sessionId != null) {
+ query.addScalar("user_liked", IntegerType.INSTANCE)
+ .setLong("sessionId", sessionId);
+ }
+ List