Index: lams_common/src/java/org/lamsfoundation/lams/qb/service/QbService.java =================================================================== diff -u -rc393d2b92ec8c8bdc5916ac5f53e0adcaeee0ce3 -r7faeaea7b800b429b1bce93191090f0851e8f9f5 --- lams_common/src/java/org/lamsfoundation/lams/qb/service/QbService.java (.../QbService.java) (revision c393d2b92ec8c8bdc5916ac5f53e0adcaeee0ce3) +++ lams_common/src/java/org/lamsfoundation/lams/qb/service/QbService.java (.../QbService.java) (revision 7faeaea7b800b429b1bce93191090f0851e8f9f5) @@ -20,6 +20,7 @@ import javax.servlet.http.HttpSession; +import org.apache.log4j.Logger; import org.lamsfoundation.lams.gradebook.GradebookUserLesson; import org.lamsfoundation.lams.gradebook.service.IGradebookService; import org.lamsfoundation.lams.learningdesign.Activity; @@ -54,6 +55,9 @@ import com.fasterxml.jackson.databind.node.ObjectNode; public class QbService implements IQbService { + + protected Logger log = Logger.getLogger(QbService.class); + private IQbDAO qbDAO; private IGradebookService gradebookService; @@ -375,6 +379,11 @@ collection.setName(name); collection.setUserId(userId); qbDAO.insert(collection); + + if (log.isDebugEnabled()) { + log.debug("User " + userId + " created a new QB collection: " + name); + } + return collection; } @@ -387,7 +396,13 @@ if (collection.getUserId() == null || collection.isPersonal()) { throw new InvalidParameterException("Attempt to remove a private or the public question bank collection"); } + + if (log.isDebugEnabled()) { + log.debug("Removed collection with UID: " + collectionUid + " and name: " + collection.getName()); + } + qbDAO.delete(collection); + } @Override @@ -397,6 +412,11 @@ // if the question is used in a Learning Design, do not allow to remove it return false; } + + if (log.isDebugEnabled()) { + log.debug("Removed QB question with UID: " + qbQuestionUid); + } + qbDAO.deleteById(QbQuestion.class, qbQuestionUid); return true; } @@ -411,6 +431,11 @@ Map properties = new HashMap<>(); properties.put("questionId", qbQuestionId); qbDAO.deleteByProperties(QbQuestion.class, properties); + + if (log.isDebugEnabled()) { + log.debug("Removed QB questions with question ID: " + qbQuestionId); + } + return true; } @@ -476,6 +501,11 @@ qbDAO.insert(newQuestion); } qbDAO.addCollectionQuestion(collectionUid, addQbQuestionId); + + if (log.isDebugEnabled()) { + log.debug("Added QB questions with question ID: " + qbQuestionId + " to collection with UID: " + + collectionUid); + } } @Override @@ -504,6 +534,12 @@ return removeQuestionByQuestionId(qbQuestionId); } qbDAO.removeCollectionQuestion(collectionUid, qbQuestionId); + + if (log.isDebugEnabled()) { + log.debug("Removed QB questions with question ID: " + qbQuestionId + " from collection with UID: " + + collectionUid); + } + return true; } @@ -643,6 +679,10 @@ qbDAO.insert(qbOption); } } + + if (log.isDebugEnabled()) { + log.debug("Created a new QB question with UID: " + qbQuestion.getUid()); + } } /**