Task #456

Merge mail box table

Added by Tan Lee Yong about 14 years ago. Updated almost 14 years ago.

Status:Work Completed-End life cycleStart date:September 08, 2010
Priority:NormalDue date:September 17, 2010
Assignee:Ngoh Chee Ping% Done:

100%

Category:-Spent time:43.00 hours
Target version:-

Description

To merge the inbox, sentbox and trashcan to one single table

History

#1 Updated by Ngoh Chee Ping about 14 years ago

  • Status changed from New - Begin Life Cycle to Development / Work In Progress
  • % Done changed from 0 to 40

Table MAIL_BOX and MAIL_BOX_RECIPIENT have been created. This table is to combine the inbox, sentbox, and trashcan table. Now finish edited the query in BaseHibernateDaoImpl. But havent edit the methods in SecuredMailBox.

#2 Updated by Ngoh Chee Ping about 14 years ago

  • % Done changed from 40 to 70

Edited the BaseHibernateDaoImpl and finish modify the SecuredMailBox methods.

Problem:
For example: When the user delete a mail in sentbox, it will change the messageType to trash can. But for this mail got many recipients, when the messageType changed to trash can. For all this recipient cannot get this mail in inbox, because of the messageType. They will only get the mail from trash can although they did not delete the mail.

Suggestion:
Actually in MAIL_BOX can ignore the messageType, mean no need to use messageType in MAIL_BOX. The reason is the inbox mail can be get by follow the recipentId, sentbox can get by follow the senderId, and trash can can get by follow the last action user id and status(DELETED).

#3 Updated by Tan Lee Yong about 14 years ago

Create suggestion. It is more direct without type checking. Good job!

#4 Updated by Ngoh Chee Ping about 14 years ago

  • % Done changed from 70 to 80

Finish edited the codes that no messageType. Now doing the testing on all the methods to make sure it work.

#5 Updated by Ngoh Chee Ping about 14 years ago

Testing until archiveMessage got some problem. The problem occur when i want to send a mail form sentbox to archive, we need to store all the data from MAIL_BOX to MAIL_ARCHIVE, because this message have multiple recipients, recipients and sender are using this message, then we cannot delete the message in MAIL_BOX. What i did is i just add the message in MAIL_ARCHIVE, then change the messageStatus in MAIL_BOX. But for the recipients i also send to MAIL_RECIPIENT_ARCHIVE, because when the message in MAIL_ARCHIVE want to get the recipient, it also can get it from MAIL_RECIPIENT_ARCHIVE, only the status is not archive for those recipients.

This problem solved when i add in a method to check the recipient inside MAIL_RECIPIENT_ARCHIVE, when the recipient is inside MAIL_RECIPIENT_ARCHIVE it will not save inside the table. But for the recipient from inbox and trash can will update the status and last action inside MAIL_RECIPIENT_ARCHIVE.

#6 Updated by Tan Lee Yong about 14 years ago

Do think if we also merge the archive table to this mailbox table will make thing easier?

#7 Updated by Ngoh Chee Ping about 14 years ago

Actually the archive and trashcan is the same. If we want to merge the trashcan, archive also merge together will be more easy.If do not want to merge the archive, we can separate the trashcan out. The recipient table can only use that MAIL_BOX_RECIPIENT, all the mailbox can get the recipient from this table, we no need to add or delete the recipient when archive and delete message. But in the MAIL_BOX_RECIPIENT we need to set the messageType.

#8 Updated by Tan Lee Yong about 14 years ago

Please go ahead to merge all tables to one due to coding, logic and maintenance complication.

#9 Updated by Ngoh Chee Ping about 14 years ago

Finally decide to merge all table together, because separate the table will make the coding more confusing and hard to maintain. Now i need to add 2 column in the recipients table, that is messageType, and originating, because we can not just use the status to get the message when all table combine, the status will be replace when archive and delete.

#10 Updated by Ngoh Chee Ping about 14 years ago

Now change the database design to the newest design. Editing the SecuredMailBox all method. Now finish until the restore delete message. No problem come out from now.

#11 Updated by Ngoh Chee Ping almost 14 years ago

  • % Done changed from 80 to 90

Finish edited all the methods and tested it. Just got one problem. That is when archive one mail, the mail will change the message type and set the originating. Then if i delete this mail, it will change the message type and the originating. If i want to restore it, i will restore from trash can, after restore it will set the originating to MailTrashCan. Therefore when i restore it from MailArchive, it will go back to MailTrashCan. It cannot go back to inbox or sentbox.

#12 Updated by Tan Lee Yong almost 14 years ago

Scenario:
1) Archive a message from Inbox
- Change the Originating to Inbox
2) Delete the message from Archive
- Mark the message as deleted
- Done. The message still in Archive
- If the message is deleted from Archive, it is consider gone, can't restore

Scenario:
1) Archive a message from Inbox
- Change the Originating to Inbox
2) Restore the message in Archive
- Change the Originating to Archive
- Move the message to Inbox
3) Delete the message from Inbox
- Change the Originating to Inbox
- Move the message to Trash Can
4) Archive the message from Trash Can
- Change the Originating to TrashCan
- Move the message to Archive
5) Restore the message
- Change the Originating to TrashCan
- Move the message to TrashCan
6) Delete the message from TrashCan
- Mark the message as Deleted
- Done. User can't see this message anymore.

#13 Updated by Ngoh Chee Ping almost 14 years ago

  • % Done changed from 90 to 100

Finish edited the method that match all the scenario.

#14 Updated by Ngoh Chee Ping almost 14 years ago

  • Status changed from Development / Work In Progress to Work Completed-End life cycle

Also available in: Atom PDF