Index: lams_build/lib/lams/lams.jar =================================================================== diff -u -rac01a5639fd922a47f5129471a695b0e5a7d0eb4 -r6507b9cc6e67eed53ac0061bd401514a3d70993f Binary files differ Index: lams_common/src/java/org/lamsfoundation/lams/events/EventNotificationService.java =================================================================== diff -u -r7e31f6d25dc9f5c22780eb6b3c25ec19fca00e1d -r6507b9cc6e67eed53ac0061bd401514a3d70993f --- lams_common/src/java/org/lamsfoundation/lams/events/EventNotificationService.java (.../EventNotificationService.java) (revision 7e31f6d25dc9f5c22780eb6b3c25ec19fca00e1d) +++ lams_common/src/java/org/lamsfoundation/lams/events/EventNotificationService.java (.../EventNotificationService.java) (revision 6507b9cc6e67eed53ac0061bd401514a3d70993f) @@ -135,7 +135,6 @@ * whether the message is of HTML content-type or plain text */ public void notifyUser(Subscription subscription, String subject, String message, boolean isHtmlFormat) { - subscription.setLastOperationTime(new Date()); subscription.setLastOperationMessage( subscription.getDeliveryMethod().send(null, subscription.getUserId(), subject, message, isHtmlFormat)); } @@ -147,23 +146,21 @@ List events = eventDAO.getEventsToResend(); for (Event event : events) { trigger(event, null, null); - if (event.getFailTime() != null) { - if (!event.getSubscriptions().isEmpty() && ((System.currentTimeMillis() - - event.getFailTime().getTime()) >= IEventNotificationService.RESEND_TIME_LIMIT)) { - StringBuilder body = new StringBuilder(messageService.getMessage("mail.resend.abandon.body1")) - .append(event.getMessage()) - .append(messageService.getMessage("mail.resend.abandon.body2")); - for (Subscription subscription : event.getSubscriptions()) { - User user = (User) userManagementService.findById(User.class, subscription.getUserId()); - body.append(user.getLogin()).append('\n'); - } - IEventNotificationService.DELIVERY_METHOD_MAIL.notifyAdmin( - messageService.getMessage("mail.resend.abandon.subject"), body.toString(), - event.isHtmlFormat()); - eventDAO.deleteEvent(event); + if ((event.getFailTime() != null) && !event.getSubscriptions().isEmpty() && ((System.currentTimeMillis() + - event.getFailTime().getTime()) >= IEventNotificationService.RESEND_TIME_LIMIT)) { + StringBuilder body = new StringBuilder(messageService.getMessage("mail.resend.abandon.body1")) + .append(event.getMessage()).append(messageService.getMessage("mail.resend.abandon.body2")); + for (Subscription subscription : event.getSubscriptions()) { + User user = (User) userManagementService.findById(User.class, subscription.getUserId()); + body.append(user.getLogin()).append('\n'); } + IEventNotificationService.DELIVERY_METHOD_MAIL.notifyAdmin( + messageService.getMessage("mail.resend.abandon.subject"), body.toString(), + event.isHtmlFormat()); + eventDAO.deleteEvent(event); } } + } catch (Exception e) { EventNotificationService.log.error("Error while resending messages", e); } @@ -180,7 +177,7 @@ EventNotificationService.log.error("Error occured while sending message: " + result); Event event = new Event(IEventNotificationService.SINGLE_MESSAGE_SCOPE, String.valueOf(System.currentTimeMillis()), null, subject, message, isHtmlFormat); - subscribe(event, toUserId, deliveryMethod, null); + subscribe(event, toUserId, deliveryMethod); event.setFailTime(new Date()); eventDAO.saveEvent(event); return false; @@ -204,7 +201,7 @@ if (result != null) { event = new Event(IEventNotificationService.SINGLE_MESSAGE_SCOPE, String.valueOf(System.currentTimeMillis()), null, subject, message, isHtmlFormat); - subscribe(event, id, deliveryMethod, null); + subscribe(event, id, deliveryMethod); } } if (event != null) { @@ -239,7 +236,7 @@ * See {@link IEventNotificationService#subscribe(String, String, Long, Long, AbstractDeliveryMethod, Long) * */ - protected void subscribe(Event event, Integer userId, AbstractDeliveryMethod deliveryMethod, Long periodicity) + private void subscribe(Event event, Integer userId, AbstractDeliveryMethod deliveryMethod) throws InvalidParameterException { if (userId == null) { throw new InvalidParameterException("User ID can not be null."); @@ -254,21 +251,18 @@ if (subscription.getUserId().equals(userId) && subscription.getDeliveryMethod().equals(deliveryMethod.getId())) { substriptionFound = true; - if (!subscription.getPeriodicity().equals(periodicity)) { - subscription.setPeriodicity(periodicity); - } break; } } if (!substriptionFound) { - event.getSubscriptions().add(new Subscription(userId, deliveryMethod, periodicity)); + event.getSubscriptions().add(new Subscription(userId, deliveryMethod)); } eventDAO.saveEvent(event); } @Override public void subscribe(String scope, String name, Long eventSessionId, Integer userId, - AbstractDeliveryMethod deliveryMethod, Long periodicity) throws InvalidParameterException { + AbstractDeliveryMethod deliveryMethod) throws InvalidParameterException { if (scope == null) { throw new InvalidParameterException("Scope should not be null."); } @@ -285,7 +279,7 @@ if (event == null) { throw new InvalidParameterException("An event with the given parameters does not exist."); } - subscribe(event, userId, deliveryMethod, periodicity); + subscribe(event, userId, deliveryMethod); } /** @@ -301,19 +295,16 @@ Iterator subscriptionIterator = event.getSubscriptions().iterator(); while (subscriptionIterator.hasNext()) { Subscription subscription = subscriptionIterator.next(); - if ((event.getFailTime() != null) || subscription.isEligibleForNotification()) { - notifyUser(subscription, subjectToSend, messageToSend, event.isHtmlFormat()); - if (subscription.getLastOperationSuccessful()) { - if (event.getFailTime() != null) { - subscriptionIterator.remove(); - } - } else if (event.getFailTime() == null) { - if (eventFailCopy == null) { - eventFailCopy = (Event) event.clone(); - } - subscribe(eventFailCopy, subscription.getUserId(), subscription.getDeliveryMethod(), - subscription.getPeriodicity()); + notifyUser(subscription, subjectToSend, messageToSend, event.isHtmlFormat()); + if (subscription.getLastOperationMessage() == null) { + if (event.getFailTime() != null) { + subscriptionIterator.remove(); } + } else if (event.getFailTime() == null) { + if (eventFailCopy == null) { + eventFailCopy = (Event) event.clone(); + } + subscribe(eventFailCopy, subscription.getUserId(), subscription.getDeliveryMethod()); } } if (event.getSubscriptions().isEmpty()) { @@ -393,19 +384,24 @@ /** * See {@link IEventNotificationService#triggerForSingleUser(String, String, Long, Long)} */ - protected boolean triggerForSingleUser(Event event, Integer userId, String subject, String message) + private void triggerForSingleUser(Event event, Integer userId, String subject, String message) throws InvalidParameterException { - if (userId == null) { - throw new InvalidParameterException("User ID can not be null."); - } + final String subjectToSend = subject == null ? event.getSubject() : subject; + final String messageToSend = message == null ? event.getMessage() : message; for (Subscription subscription : event.getSubscriptions()) { - if (subscription.getUserId().equals(userId) && subscription.isEligibleForNotification()) { + if (subscription.getUserId().equals(userId)) { notifyUser(subscription, subject, message, event.isHtmlFormat()); - return subscription.getLastOperationSuccessful(); + if (subscription.getLastOperationMessage() != null) { + Event eventFailCopy = (Event) event.clone(); + eventFailCopy.setFailTime(new Date()); + eventFailCopy.setSubject(subjectToSend); + eventFailCopy.setMessage(messageToSend); + subscribe(eventFailCopy, subscription.getUserId(), subscription.getDeliveryMethod()); + eventDAO.saveEvent(eventFailCopy); + } } } - return false; } @Override Index: lams_common/src/java/org/lamsfoundation/lams/events/IEventNotificationService.java =================================================================== diff -u -r0286278ded7ceca679228c62ca8d501bb57b515e -r6507b9cc6e67eed53ac0061bd401514a3d70993f --- lams_common/src/java/org/lamsfoundation/lams/events/IEventNotificationService.java (.../IEventNotificationService.java) (revision 0286278ded7ceca679228c62ca8d501bb57b515e) +++ lams_common/src/java/org/lamsfoundation/lams/events/IEventNotificationService.java (.../IEventNotificationService.java) (revision 6507b9cc6e67eed53ac0061bd401514a3d70993f) @@ -24,26 +24,6 @@ static final String SINGLE_MESSAGE_SCOPE = "SINGLE_MESSAGE"; /** - * User should be notified only once. Used when subscribing a user to an event. - */ - static final long PERIODICITY_SINGLE = 0; - - /** - * User should be notified daily. Used when subscribing a user to an event. - */ - static final long PERIODICITY_DAILY = 24 * 60 * 60; - - /** - * User should be notified weekly. Used when subscribing a user to an event. - */ - static final long PERIODICITY_WEEKLY = IEventNotificationService.PERIODICITY_DAILY * 7; - - /** - * User should be notified monthly. Used when subscribing a user to an event. - */ - static final long PERIODICITY_MONTHLY = IEventNotificationService.PERIODICITY_WEEKLY * 4; - - /** * Period after which the thread gives up on attempting to resend messages. Currently - 2 days. */ static final long RESEND_TIME_LIMIT = 2 * 24 * 60 * 60 * 1000; @@ -174,8 +154,7 @@ String message, boolean isHtmlFormat) throws InvalidParameterException; /** - * Registeres an user for notification of the event. If a subscription with given user ID and delivery method - * already exists, only periodicity is updated. + * Registeres an user for notification of the event. * * @param scope * scope of the event @@ -186,14 +165,12 @@ * @param userId * ID of the user * @param deliveryMethod - * method of messaged delivery to use - * @param periodicity - * how often the user should be notified (in seconds) + * method of messaged delivery to use how often the user should be notified (in seconds) * @throws InvalidParameterException * if scope, userId or delivery method are null, or name is blank */ void subscribe(String scope, String name, Long eventSessionId, Integer userId, - AbstractDeliveryMethod deliveryMethod, Long periodicity) throws InvalidParameterException; + AbstractDeliveryMethod deliveryMethod) throws InvalidParameterException; /** * Triggers the event with the default (or previously set) subject and message. Each subscribed user is notified. Index: lams_common/src/java/org/lamsfoundation/lams/events/Subscription.java =================================================================== diff -u -r15f56ca278fe37b325c0faf582c1245545a4100f -r6507b9cc6e67eed53ac0061bd401514a3d70993f --- lams_common/src/java/org/lamsfoundation/lams/events/Subscription.java (.../Subscription.java) (revision 15f56ca278fe37b325c0faf582c1245545a4100f) +++ lams_common/src/java/org/lamsfoundation/lams/events/Subscription.java (.../Subscription.java) (revision 6507b9cc6e67eed53ac0061bd401514a3d70993f) @@ -1,7 +1,6 @@ package org.lamsfoundation.lams.events; import java.security.InvalidParameterException; -import java.util.Date; /** * Subscription for an event notification. This class binds an user to an event and stores some information on the @@ -30,16 +29,6 @@ private Short deliveryMethodId; /** - * How often should the message be resend - */ - private Long periodicity; - - /** - * Time of the notification attempt - */ - private Date lastOperationTime; - - /** * Message returned by a delivery methond during the last notification attempt */ private String lastOperationMessage; @@ -63,19 +52,18 @@ * @param deliveryMethod * @param periodicity */ - public Subscription(Integer userId, AbstractDeliveryMethod deliveryMethod, Long periodicity) { + public Subscription(Integer userId, AbstractDeliveryMethod deliveryMethod) { if (deliveryMethod == null) { throw new InvalidParameterException("Delivery method can not be null."); } this.userId = userId; this.deliveryMethod = deliveryMethod; - setPeriodicity(periodicity); deliveryMethodId = deliveryMethod.getId(); } @Override public Object clone() { - return new Subscription(userId, deliveryMethod, periodicity); + return new Subscription(userId, deliveryMethod); } public AbstractDeliveryMethod getDeliveryMethod() { @@ -114,27 +102,7 @@ return lastOperationMessage; } - public boolean getLastOperationSuccessful() { - return lastOperationMessage == null; - } - /** - * @hibernate.property column="last_operation_time" - * @return - */ - public Date getLastOperationTime() { - return lastOperationTime; - } - - /** - * @hibernate.property column="periodicity" - * @return - */ - public Long getPeriodicity() { - return periodicity; - } - - /** * @hibernate.id column="uid" generator-class="native" */ public Long getUid() { @@ -149,16 +117,6 @@ return userId; } - /** - * States if a message should be send to the user or rather this subscription should be skipped. - * - * @return if the message should be send - */ - public boolean isEligibleForNotification() { - return !getLastOperationSuccessful() || (lastOperationTime == null) - || ((System.currentTimeMillis() - lastOperationTime.getTime()) > periodicity); - } - public void setDeliveryMethodId(Short deliveryMethodId) { this.deliveryMethodId = deliveryMethodId; } @@ -171,14 +129,6 @@ this.lastOperationMessage = lastOperationMessage; } - public void setLastOperationTime(Date lastOperationTime) { - this.lastOperationTime = lastOperationTime; - } - - public void setPeriodicity(Long periodicity) { - this.periodicity = periodicity == null ? IEventNotificationService.PERIODICITY_SINGLE : periodicity; - } - public void setUid(Long uid) { this.uid = uid; } Index: lams_common/src/java/org/lamsfoundation/lams/events/dao/hibernate/EventDAOHibernate.java =================================================================== diff -u -r15f56ca278fe37b325c0faf582c1245545a4100f -r6507b9cc6e67eed53ac0061bd401514a3d70993f --- lams_common/src/java/org/lamsfoundation/lams/events/dao/hibernate/EventDAOHibernate.java (.../EventDAOHibernate.java) (revision 15f56ca278fe37b325c0faf582c1245545a4100f) +++ lams_common/src/java/org/lamsfoundation/lams/events/dao/hibernate/EventDAOHibernate.java (.../EventDAOHibernate.java) (revision 6507b9cc6e67eed53ac0061bd401514a3d70993f) @@ -15,9 +15,7 @@ + " AS e WHERE e.scope=? AND e.name=? AND e.eventSessionId=? AND e.failTime IS NULL"; private static final String GET_EVENTS_TO_RESEND_QUERY = "SELECT DISTINCT e FROM " + Event.class.getName() - + " AS e INNER JOIN e.subscriptions AS subscription WHERE (e.failTime IS NOT NULL OR " - + "(subscription.periodicity > 0 AND subscription.lastOperationTime IS NOT NULL " - + "AND (NOW()- subscription.lastOperationTime >= subscription.periodicity)))"; + + " AS e WHERE e.failTime IS NOT NULL"; @SuppressWarnings("unchecked") public Event getEvent(String scope, String name, Long sessionId) throws InvalidParameterException { Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java =================================================================== diff -u -r2ff38cdf504d51a2590b113023d885069d32645e -r6507b9cc6e67eed53ac0061bd401514a3d70993f --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java (.../LearningAction.java) (revision 2ff38cdf504d51a2590b113023d885069d32645e) +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java (.../LearningAction.java) (revision 6507b9cc6e67eed53ac0061bd401514a3d70993f) @@ -260,8 +260,8 @@ int numOfRatings = forumService.getNumOfRatingsByUserAndForum(forumUser.getUid(), forum.getUid()); boolean noMoreRatings = (forum.getMaximumRate() != 0) && (numOfRatings >= forum.getMaximumRate()) && forum.isAllowRateMessages(); - boolean isMinRatingsCompleted = (forum.getMinimumRate() == 0) || (numOfRatings >= forum.getMinimumRate()) - && forum.isAllowRateMessages(); + boolean isMinRatingsCompleted = (forum.getMinimumRate() == 0) + || (numOfRatings >= forum.getMinimumRate()) && forum.isAllowRateMessages(); sessionMap.put(ForumConstants.ATTR_NO_MORE_RATINGSS, noMoreRatings); sessionMap.put(ForumConstants.ATTR_IS_MIN_RATINGS_COMPLETED, isMinRatingsCompleted); sessionMap.put(ForumConstants.ATTR_NUM_OF_RATINGS, numOfRatings); @@ -301,8 +301,8 @@ if (!forum.isAllowNewTopic()) { // add the number post the learner has made for each topic. for (MessageDTO messageDTO : rootTopics) { - int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), messageDTO.getMessage() - .getUid()); + int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), + messageDTO.getMessage().getUid()); messageDTO.setNumOfPosts(numOfPosts); } } @@ -325,7 +325,7 @@ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); forumService.getEventNotificationService().subscribe(ForumConstants.TOOL_SIGNATURE, ForumConstants.EVENT_NAME_NOTIFY_LEARNERS_ON_MARK_RELEASE, forum.getContentId(), user.getUserID(), - IEventNotificationService.DELIVERY_METHOD_MAIL, IEventNotificationService.PERIODICITY_SINGLE); + IEventNotificationService.DELIVERY_METHOD_MAIL); } // check if there is submission deadline @@ -379,8 +379,8 @@ // finish current session for user forumService.finishUserSession(getCurrentUser(request, sessionId)); - ToolSessionManager sessionMgrService = ForumServiceProxy.getToolSessionManager(getServlet() - .getServletContext()); + ToolSessionManager sessionMgrService = ForumServiceProxy + .getToolSessionManager(getServlet().getServletContext()); nextActivityUrl = sessionMgrService.leaveToolSession(sessionId, userID); response.sendRedirect(nextActivityUrl); } catch (DataMissingException e) { @@ -481,8 +481,8 @@ // ========================================================================================== /** - * Display the messages for a particular topic. The Topic will arranged by Tree structure and loaded - * thread by thread (with paging). + * Display the messages for a particular topic. The Topic will arranged by Tree structure and loaded thread by + * thread (with paging). * * @param mapping * @param form @@ -507,7 +507,7 @@ Long lastMsgSeqId = WebUtil.readLongParam(request, ForumConstants.PAGE_LAST_ID, true); Long pageSize = WebUtil.readLongParam(request, ForumConstants.PAGE_SIZE, true); - + setupViewTopicPagedDTOList(request, rootTopicId, sessionMapID, forumUser, forum, lastMsgSeqId, pageSize); // Should we show the reflection or not? We shouldn't show it when the View Forum screen is accessed @@ -543,7 +543,8 @@ } /** - * Display the messages for a particular thread in a particular topic. Returns all messages for this thread - does not need paging. + * Display the messages for a particular thread in a particular topic. Returns all messages for this thread - does + * not need paging. * * @param mapping * @param form @@ -579,8 +580,8 @@ request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts); request.setAttribute(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts); request.setAttribute(ForumConstants.ATTR_NO_MORE_PAGES, true); - - if ( highlightMessageUid != null ) { + + if (highlightMessageUid != null) { request.setAttribute(ForumConstants.ATTR_MESS_ID, highlightMessageUid); } // transfer SessionMapID as well @@ -625,8 +626,8 @@ request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts); request.setAttribute(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts); request.setAttribute(ForumConstants.ATTR_NO_MORE_PAGES, true); - - if ( messageUid != null ) { + + if (messageUid != null) { request.setAttribute(ForumConstants.ATTR_MESS_ID, messageUid); } // transfer SessionMapID as well @@ -809,8 +810,8 @@ ForumToolSession session = forumService.getSessionBySessionId(sessionId); Forum forum = session.getForum(); - setupViewTopicPagedDTOList(request, rootTopicId, messageForm.getSessionMapID(), forumUser, forum, null, null); - + setupViewTopicPagedDTOList(request, rootTopicId, messageForm.getSessionMapID(), forumUser, forum, null, null); + // notify learners and teachers Long forumId = (Long) sessionMap.get(ForumConstants.ATTR_FORUM_ID); forumService.sendNotificationsOnNewPosting(forumId, sessionId, message); @@ -827,11 +828,12 @@ * @param response * @return * @throws InterruptedException - * @throws JSONException - * @throws IOException + * @throws JSONException + * @throws IOException */ - private synchronized ActionForward replyTopicInline(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws InterruptedException, JSONException, IOException { + private synchronized ActionForward replyTopicInline(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) + throws InterruptedException, JSONException, IOException { MessageForm messageForm = (MessageForm) form; SessionMap sessionMap = getSessionMap(request, messageForm); @@ -933,8 +935,8 @@ MessageDTO dto = new MessageDTO(); dto.setHasAttachment(false); request.setAttribute(ForumConstants.AUTHORING_TOPIC, dto); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute( - WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID)); + SessionMap sessionMap = (SessionMap) request.getSession() + .getAttribute(WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID)); request.setAttribute(ForumConstants.ATTR_ALLOW_UPLOAD, sessionMap.get(ForumConstants.ATTR_ALLOW_UPLOAD)); return mapping.findForward("success"); @@ -967,12 +969,12 @@ ForumUser forumUser = getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID)); Forum forum = forumUser.getSession().getForum(); setupViewTopicPagedDTOList(request, rootTopicId, messageForm.getSessionMapID(), forumUser, forum, null, null); - + return mapping.findForward("success"); } - private void doUpdateTopic(HttpServletRequest request, MessageForm messageForm, SessionMap sessionMap, - Long topicId, Message message) { + private void doUpdateTopic(HttpServletRequest request, MessageForm messageForm, SessionMap sessionMap, Long topicId, + Message message) { boolean makeAuditEntry = ToolAccessMode.TEACHER.equals(sessionMap.get(AttributeNames.ATTR_MODE)); String oldMessageString = null; @@ -994,8 +996,8 @@ userId = message.getCreatedBy().getUserId(); loginName = message.getCreatedBy().getLoginName(); } - forumService.getAuditService().logChange(ForumConstants.TOOL_SIGNATURE, userId, loginName, - oldMessageString, messagePO.toString()); + forumService.getAuditService().logChange(ForumConstants.TOOL_SIGNATURE, userId, loginName, oldMessageString, + messagePO.toString()); } // save message into database @@ -1012,8 +1014,8 @@ * @param response * @return * @throws PersistenceException - * @throws JSONException - * @throws IOException + * @throws JSONException + * @throws IOException */ public ActionForward updateTopicInline(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws PersistenceException, JSONException, IOException { @@ -1097,26 +1099,25 @@ forumService = getForumManager(); String sessionMapId = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute( - sessionMapId); + SessionMap sessionMap = (SessionMap) request.getSession() + .getAttribute(sessionMapId); Long forumUid = (Long) sessionMap.get(ForumConstants.ATTR_FORUM_UID); Long userUid = (Long) sessionMap.get(ForumConstants.ATTR_USER_UID); boolean isAllowRateMessages = (Boolean) sessionMap.get(ForumConstants.ATTR_ALLOW_RATE_MESSAGES); int forumMaximumRate = (Integer) sessionMap.get(ForumConstants.ATTR_MAXIMUM_RATE); int forumMinimumRate = (Integer) sessionMap.get(ForumConstants.ATTR_MINIMUM_RATE); - + float rating = Float.parseFloat((String) request.getParameter("rate")); Long responseId = WebUtil.readLongParam(request, "idBox"); Long toolSessionID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); UserDTO user = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER); Long userId = new Long(user.getUserID().intValue()); AverageRatingDTO averageRatingDTO = forumService.rateMessage(responseId, userId, toolSessionID, rating); - + //refresh numOfRatings and noMoreRatings int numOfRatings = forumService.getNumOfRatingsByUserAndForum(userUid, forumUid); - boolean noMoreRatings = (forumMaximumRate != 0) && (numOfRatings >= forumMaximumRate) - && isAllowRateMessages; + boolean noMoreRatings = (forumMaximumRate != 0) && (numOfRatings >= forumMaximumRate) && isAllowRateMessages; boolean isMinRatingsCompleted = (forumMinimumRate != 0) && (numOfRatings >= forumMinimumRate) && isAllowRateMessages; sessionMap.put(ForumConstants.ATTR_NO_MORE_RATINGSS, noMoreRatings); @@ -1175,8 +1176,8 @@ } /** - * This method will set flag in message DTO:
  • If this topic is created by current login user, then set Author - * mark true.
  • + * This method will set flag in message DTO: + *
  • If this topic is created by current login user, then set Author mark true.
  • * * @param msgDtoList */ @@ -1241,8 +1242,8 @@ */ private IForumService getForumManager() { if (forumService == null) { - WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet() - .getServletContext()); + WebApplicationContext wac = WebApplicationContextUtils + .getRequiredWebApplicationContext(getServlet().getServletContext()); forumService = (IForumService) wac.getBean(ForumConstants.FORUM_SERVICE); } return forumService; Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/LearnerAction.java =================================================================== diff -u -r1fdab2d1df4835bf09b88e2bb34e4016c43af73a -r6507b9cc6e67eed53ac0061bd401514a3d70993f --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/LearnerAction.java (.../LearnerAction.java) (revision 1fdab2d1df4835bf09b88e2bb34e4016c43af73a) +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/LearnerAction.java (.../LearnerAction.java) (revision 6507b9cc6e67eed53ac0061bd401514a3d70993f) @@ -171,8 +171,8 @@ content.setDefineLater(false); submitFilesService.saveOrUpdateContent(content); - LearningWebUtil.putActivityPositionInRequestByToolSessionId(sessionID, request, getServlet() - .getServletContext()); + LearningWebUtil.putActivityPositionInRequestByToolSessionId(sessionID, request, + getServlet().getServletContext()); // check if there is submission deadline Date submissionDeadline = content.getSubmissionDeadline(); @@ -200,7 +200,7 @@ submitFilesService.getEventNotificationService().subscribe(SbmtConstants.TOOL_SIGNATURE, SbmtConstants.EVENT_NAME_NOTIFY_LEARNERS_ON_MARK_RELEASE, content.getContentID(), userID, - IEventNotificationService.DELIVERY_METHOD_MAIL, IEventNotificationService.PERIODICITY_SINGLE); + IEventNotificationService.DELIVERY_METHOD_MAIL); } return mapping.findForward(SbmtConstants.SUCCESS); @@ -227,8 +227,8 @@ // set the mode into http session Long sessionID = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); - LearningWebUtil.putActivityPositionInRequestByToolSessionId(sessionID, request, getServlet() - .getServletContext()); + LearningWebUtil.putActivityPositionInRequestByToolSessionId(sessionID, request, + getServlet().getServletContext()); if (validateUploadForm(learnerForm, request)) { // get session from shared session. @@ -269,11 +269,11 @@ SubmitFilesContent content = submitFilesService.getSessionById(sessionID).getContent(); if (content.isNotifyTeachersOnFileSubmit()) { - String message = submitFilesService - .getLocalisedMessage("event.file.submit.body", new Object[] { learner.getFullName() }); + String message = submitFilesService.getLocalisedMessage("event.file.submit.body", + new Object[] { learner.getFullName() }); submitFilesService.getEventNotificationService().notifyLessonMonitors(sessionID, message, false); } - + return mapping.getInputForward(); } @@ -298,8 +298,8 @@ Long sessionID = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); if (mode == ToolAccessMode.LEARNER || mode.equals(ToolAccessMode.AUTHOR)) { - ToolSessionManager sessionMgrService = SubmitFilesServiceProxy.getToolSessionManager(getServlet() - .getServletContext()); + ToolSessionManager sessionMgrService = SubmitFilesServiceProxy + .getToolSessionManager(getServlet().getServletContext()); ISubmitFilesService submitFilesService = getService(); // get back login user DTO @@ -329,8 +329,8 @@ // Private mehtods // ********************************************************************************************** private ISubmitFilesService getService() { - ISubmitFilesService submitFilesService = SubmitFilesServiceProxy.getSubmitFilesService(this.getServlet() - .getServletContext()); + ISubmitFilesService submitFilesService = SubmitFilesServiceProxy + .getSubmitFilesService(this.getServlet().getServletContext()); return submitFilesService; } @@ -339,15 +339,15 @@ ActionMessages errors = new ActionMessages(); Locale preferredLocale = (Locale) request.getSession().getAttribute(LocaleFilter.PREFERRED_LOCALE_KEY); if (learnerForm.getFile() == null || StringUtils.isBlank(learnerForm.getFile().getFileName())) { - errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.required", this.getResources(request) - .getMessage(preferredLocale, "learner.form.filepath.displayname"))); + errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.required", + this.getResources(request).getMessage(preferredLocale, "learner.form.filepath.displayname"))); } if (StringUtils.isBlank(learnerForm.getDescription())) { - errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.required", this.getResources(request) - .getMessage(preferredLocale, "label.learner.fileDescription"))); + errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.required", + this.getResources(request).getMessage(preferredLocale, "label.learner.fileDescription"))); } else if (learnerForm.getDescription().length() > LearnerForm.DESCRIPTION_LENGTH) { - errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.maxdescsize", - LearnerForm.DESCRIPTION_LENGTH)); + errors.add(ActionMessages.GLOBAL_MESSAGE, + new ActionMessage("errors.maxdescsize", LearnerForm.DESCRIPTION_LENGTH)); } FileValidatorUtil.validateFileSize(learnerForm.getFile(), false, errors); Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/WikiPageAction.java =================================================================== diff -u -r15f56ca278fe37b325c0faf582c1245545a4100f -r6507b9cc6e67eed53ac0061bd401514a3d70993f --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/WikiPageAction.java (.../WikiPageAction.java) (revision 15f56ca278fe37b325c0faf582c1245545a4100f) +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/WikiPageAction.java (.../WikiPageAction.java) (revision 6507b9cc6e67eed53ac0061bd401514a3d70993f) @@ -512,8 +512,7 @@ } else { // subscribe the learner to the event notificationService.subscribe(WikiConstants.TOOL_SIGNATURE, WikiConstants.EVENT_NOTIFY_LEARNERS, - toolSessionID, user.getUserID(), IEventNotificationService.DELIVERY_METHOD_MAIL, - IEventNotificationService.PERIODICITY_SINGLE); + toolSessionID, user.getUserID(), IEventNotificationService.DELIVERY_METHOD_MAIL); } // return to the wiki page