Skip to content

Commit

Permalink
Email recipients for attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
hexTileX committed Sep 3, 2017
1 parent c5718d0 commit e543c1e
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,22 @@ public void sendEmailNotification(Date creationDate, Activity.ActivityAction act
dalFacade = bazaarService.getDBConnection();

List<User> recipients = new ArrayList<>();
if (dataType.equals(Activity.DataType.REQUIREMENT)) {
if (dataType.equals(Activity.DataType.PROJECT)) {
recipients = dalFacade.getRecipientListForProject(dataId);
} else if (dataType.equals(Activity.DataType.CATEGORY)) {
recipients = dalFacade.getRecipientListForCategory(dataId);
} else if (dataType.equals(Activity.DataType.REQUIREMENT)) {
recipients = dalFacade.getRecipientListForRequirement(dataId);
} else if (dataType.equals(Activity.DataType.COMMENT)) {
int requirementId = dalFacade.getCommentById(dataId).getRequirementId();
recipients = dalFacade.getRecipientListForRequirement(requirementId);
} else if (dataType.equals(Activity.DataType.CATEGORY)) {
recipients = dalFacade.getRecipientListForCategory(dataId);
} else if (dataType.equals(Activity.DataType.PROJECT)) {
recipients = dalFacade.getRecipientListForProject(dataId);
} else if (dataType.equals(Activity.DataType.ATTACHMENT)) {
int requirementId = dalFacade.getAttachmentById(dataId).getRequirementId();
recipients = dalFacade.getRecipientListForRequirement(requirementId);
}
// delete the user who created the activity
Iterator<User> recipientsIterator = recipients.iterator();
while(recipientsIterator.hasNext()) {
while (recipientsIterator.hasNext()) {
User recipient = recipientsIterator.next();
if (recipient.getId() == userId) {
recipientsIterator.remove();
Expand Down

0 comments on commit e543c1e

Please sign in to comment.