Skip to content

Commit

Permalink
SAK-42257 - Problems archiving message forums (sakaiproject#7232)
Browse files Browse the repository at this point in the history
* SAK-42257 - Problems archiving message forums

With this commit the export and import processes for forums are fixed. Now messages are exported and imported.

* SAK-42257: Problems archiving message forums

* SAK-42257 - Problems archiving message forums

Commit to fix issues reported by Codacy and some more.

* SAK-42257 - Problems archiving message forums

Commit to apply suggested changes in PR

* SAK-42257 - Problems archiving message forums

Commit to fix an issue importing forums with custom permission configuration at discussion topic level. Also Conflicts with master have been solved.
  • Loading branch information
adrianmticarum authored and ern committed Sep 16, 2019
1 parent 66cece7 commit 2ed0668
Show file tree
Hide file tree
Showing 13 changed files with 1,016 additions and 879 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ public interface MessageForumsForumManager {
/**
* Save a discussion forum topic
*/
public void saveDiscussionForumTopic(DiscussionTopic topic);
public void saveDiscussionForumTopic(DiscussionTopic topic, boolean parentForumDraftStatus);
public void saveDiscussionForumTopic(DiscussionTopic topic, boolean parentForumDraftStatus, String currentUser, boolean logEvent);
public DiscussionTopic saveDiscussionForumTopic(DiscussionTopic topic);
public DiscussionTopic saveDiscussionForumTopic(DiscussionTopic topic, boolean parentForumDraftStatus);
public DiscussionTopic saveDiscussionForumTopic(DiscussionTopic topic, boolean parentForumDraftStatus, String currentUser, boolean logEvent);
/**
* Create and save an empty private discussion forum topic
*/
Expand All @@ -130,8 +130,12 @@ public interface MessageForumsForumManager {
* Delete a private forum topic
*/
public void deletePrivateForumTopic(PrivateTopic topic);



/**
* Create an empty message
*/
Message createMessage(final DiscussionTopic topic);

/**
* Create and save an empty open discussion forum topic
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public interface MessageForumsMessageManager {

public Message createOpenMessage();

public Message saveMessage(Message message);
public Message saveOrUpdateMessage(Message message);

public Message saveMessage(Message message, boolean logEvent);
public Message saveOrUpdateMessage(Message message, boolean logEvent);
/**
*
* @param message message
Expand All @@ -50,7 +50,32 @@ public interface MessageForumsMessageManager {
* @return
*
*/
public Message saveMessage(Message message, boolean logEvent, String toolId, String userId, String contextId);
public Message saveOrUpdateMessage(Message message, boolean logEvent, String toolId, String userId, String contextId);
/**
*
* @param message
* @param logEvent
* @param ignoreLockedTopicForum set true if you want to allow the message
* to be updated even if the topic or forum is locked (ie marking as read or
* commenting on a moderated message)
* @return Message saved or updated, with the assigned id. Different object
* that the one passed as parameter.
*/
public Message saveOrUpdateMessage(Message message, boolean logEvent, boolean ignoreLockedTopicForum);

String saveMessage(Message message);

String saveMessage(Message message, boolean logEvent);
/**
*
* @param message message
* @param logEvent logEvent
* @param toolId id of the forums tool
* @param userId user id
* @param contextId context id
*
*/
String saveMessage(Message message, boolean logEvent, String toolId, String userId, String contextId);

/**
*
Expand All @@ -60,8 +85,10 @@ public interface MessageForumsMessageManager {
* to be updated even if the topic or forum is locked (ie marking as read or
* commenting on a moderated message)
*/
public Message saveMessage(Message message, boolean logEvent, boolean ignoreLockedTopicForum);
String saveMessage(Message message, boolean logEvent, boolean ignoreLockedTopicForum);

String saveMessage(Message message, boolean logEvent, String toolId, String userId, String contextId,
boolean ignoreLockedTopicForum);
public void deleteMessage(Message message);

public Message getMessageById(Long messageId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ public interface PermissionLevelManager {
public List<PermissionLevel> getDefaultPermissionLevels();

public DBMembershipItem createDBMembershipItem(String name, String permissionLevelName, Integer type);
public void saveDBMembershipItem(DBMembershipItem item);
public void savePermissionLevel(PermissionLevel level);
public DBMembershipItem saveDBMembershipItem(DBMembershipItem item);
public PermissionLevel savePermissionLevel(PermissionLevel level);

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4746,7 +4746,7 @@ public String processDfMsgRevisedPost()

LRS_Statement statement = forumManager.getStatementForUserPosted(dMsg.getTitle(), SAKAI_VERB.responded).orElse(null);
Message persistedMessage = forumManager.saveMessage(dMsg, new ForumsMessageEventParams(ForumsMessageEventParams.MessageEvent.REVISE, statement));

messageManager.markMessageReadForUser(dfTopic.getId(), persistedMessage.getId(), true);

List messageList = selectedTopic.getMessages();
Expand Down Expand Up @@ -5376,7 +5376,7 @@ public String processAddCommentToDeniedMsg()
.getTopicByIdWithMessages(selectedTopic.getTopic().getId()));
LRS_Statement statement = forumManager.getStatementForUserPosted(currMessage.getTitle(), SAKAI_VERB.responded).orElse(null);
Message persistedMessage = forumManager.saveMessage(currMessage, new ForumsMessageEventParams(ForumsMessageEventParams.MessageEvent.REVISE, statement), true);

if (displayDeniedMsg) // only displayed if from Deny & Comment path
{
setSuccessMessage(getResourceBundleString("cdfm_denied_alert"));
Expand Down Expand Up @@ -6987,7 +6987,7 @@ else if (target instanceof Topic){
setupMembershipItemPermission(membershipItem, permBean);

// save DBMembershiptItem here to get an id so we can add to the set
permissionLevelManager.saveDBMembershipItem(membershipItem);
membershipItem = permissionLevelManager.saveDBMembershipItem(membershipItem);

membershipItemSet.add(membershipItem);
}
Expand Down Expand Up @@ -8206,7 +8206,7 @@ private DiscussionTopicBean duplicateTopic(Long originalTopicId, DiscussionForum
log.debug("About to getMembershipItemCopy()");
DBMembershipItem newItem = getMembershipItemCopy(oldItem);
if (newItem != null) {
permissionLevelManager.saveDBMembershipItem(newItem);
newItem = permissionLevelManager.saveDBMembershipItem(newItem);
newTopic.addMembershipItem(newItem);
}
}
Expand Down Expand Up @@ -8859,7 +8859,7 @@ public String processMoveThread() {
if (log.isDebugEnabled()) log.debug("processMoveThread messageId = " + mes.getId());
if (log.isDebugEnabled()) log.debug("processMoveThread message title = " + mes.getTitle());
mes.setTopic(desttopic);
messageManager.saveMessage(mes);
mes = messageManager.saveOrUpdateMessage(mes);

// mfr_move_history_t stores only records that are used to display reminder links. Not all moves are recorded in this
// table.
Expand All @@ -8879,7 +8879,7 @@ public String processMoveThread() {
if (log.isDebugEnabled()) log.debug("processMoveThread messageId = " + childMsg.getId());
if (log.isDebugEnabled()) log.debug("processMoveThread message title = " + childMsg.getTitle());
childMsg.setTopic(desttopic);
messageManager.saveMessage(childMsg);
childMsg = messageManager.saveOrUpdateMessage(childMsg);
messageManager.saveMessageMoveHistory(childMsg.getId(), desttopicId, sourceTopicId, checkReminder);
eventmsg = "Moving message " + childMsg.getId() + " from topic " + sourceTopicId + " to topic " + desttopicId;
eventTrackingService.post(eventTrackingService.newEvent(DiscussionForumService.EVENT_FORUMS_MOVE_THREAD, eventmsg, true));
Expand Down
4 changes: 4 additions & 0 deletions msgcntr/messageforums-component-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@
<groupId>org.sakaiproject.rubrics</groupId>
<artifactId>rubrics-service-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
</dependencies>
<build>
<resources>
Expand Down
Loading

0 comments on commit 2ed0668

Please sign in to comment.