Yesterday I had posted a question regarding optimizing editMethod here on code-review here on code-review. Thanks to an awesome answer by Pimgd Pimgd, I was able to merge conditional checks, checking conditions and few other things.
Yesterday I had posted a question regarding optimizing editMethod here on code-review. Thanks to an awesome answer by Pimgd, I was able to merge conditional checks, checking conditions and few other things.
Yesterday I had posted a question regarding optimizing editMethod here on code-review. Thanks to an awesome answer by Pimgd, I was able to merge conditional checks, checking conditions and few other things.
sendOutNotifications method :
private void sendOutNotifications(Long groupAccountId, GroupCanvas groupCanvas, GroupSection groupSection,
GroupNotes mnotes, GroupNoteHistory groupNoteHistory, int personid, String email,
String firstName, String subject, String text, boolean gantt, String oldName) {
List<GroupMembers> groupMembersList = this.groupMembersService.returnGroupMembers(groupAccountId);
GroupAccount groupAccount = this.groupAccountService.getGroupById(groupAccountId);
Person editingUser = this.personService.getPersonById(personid);
String type = "note";
if (gantt)
type = "gantt";
for (GroupMembers groupMembers : groupMembersList) {
Notification notification = this.notificationService.createNotification(personid, true, "/section/listing/" + groupCanvas.getMcanvasid() + "?note=" + mnotes.getMnoticesid(), subject, text,
type, groupSection.getMsectionid(), groupCanvas.getMcanvasid(), mnotes.getMnoticesid(), mnotes.getMnotecolor());
if (!(groupNoteHistory.getWhatHasChanged() == null)) {
if (groupNoteHistory.getWhatHasChanged().equals("generalchange")) {
notification.setSubject(groupAccount.getGroupName() + ", " + groupCanvas.getMcanvasname());
notification.setText("Note editiert: <span class='bold'>" + mnotes.getMnotetag() + "</span> ");
} else {
if (groupNoteHistory.getWhatHasChanged().equals("colorchange")) {
notification.setSubject(groupAccount.getGroupName() + ", " + groupCanvas.getMcanvasname());
notification.setText("Note Farbe geändert: <span class='bold'>" + mnotes.getMnotetag() + "</span> ");
}
if (groupNoteHistory.getWhatHasChanged().equals("tagchange")) {
notification.setSubject(groupAccount.getGroupName() + ", " + groupCanvas.getMcanvasname());
notification.setText("Note Überschrift geändert: <span class='bold'>" + oldName + "</span> " + " in <span class='bold'> " + mnotes.getMnotetag() + "</span>");
}
if (groupNoteHistory.getWhatHasChanged().equals("textchange")) {
notification.setSubject(groupAccount.getGroupName() + ", " + groupCanvas.getMcanvasname());
notification.setText("Note Text geändert: <span class='bold'>" + mnotes.getMnotetag() + "</span> ");
}
if (groupNoteHistory.getWhatHasChanged().equals("zugweised")) {
notification.setSubject(groupAccount.getGroupName() + ", " + groupCanvas.getMcanvasname());
notification.setText("Note <span class='bold'>" + mnotes.getMnotetag() + "</span> " + editingUser.getFirstName() + " zugewiesen");
}
}
}
this.chatService.sendNotification(notification, groupMembers.getMemberid());
if (!(groupMembers.getMemberUsername().equals(email)) && (!gantt)) {
this.notificationService.addNotification(notification, groupMembers.getMemberid());
UnreadNotes unreadNotes = this.unreadNotesService.createUnreadNoteEntry(groupAccountId, groupMembers.getMemberUsername(), groupCanvas.getMcanvasid());
this.unreadNotesService.saveUnreadNoteEntry(unreadNotes, mnotes.getMnoticesid());
}
}
this.noteLockService.deleteNoteLockForUser(mnotes.getMnoticesid());
}
sendOutNotifications method :
private void sendOutNotifications(Long groupAccountId, GroupCanvas groupCanvas, GroupSection groupSection,
GroupNotes mnotes, GroupNoteHistory groupNoteHistory, int personid, String email,
String firstName, String subject, String text, boolean gantt, String oldName) {
List<GroupMembers> groupMembersList = this.groupMembersService.returnGroupMembers(groupAccountId);
GroupAccount groupAccount = this.groupAccountService.getGroupById(groupAccountId);
Person editingUser = this.personService.getPersonById(personid);
String type = "note";
if (gantt)
type = "gantt";
for (GroupMembers groupMembers : groupMembersList) {
Notification notification = this.notificationService.createNotification(personid, true, "/section/listing/" + groupCanvas.getMcanvasid() + "?note=" + mnotes.getMnoticesid(), subject, text,
type, groupSection.getMsectionid(), groupCanvas.getMcanvasid(), mnotes.getMnoticesid(), mnotes.getMnotecolor());
if (!(groupNoteHistory.getWhatHasChanged() == null)) {
if (groupNoteHistory.getWhatHasChanged().equals("generalchange")) {
notification.setSubject(groupAccount.getGroupName() + ", " + groupCanvas.getMcanvasname());
notification.setText("Note editiert: <span class='bold'>" + mnotes.getMnotetag() + "</span> ");
} else {
if (groupNoteHistory.getWhatHasChanged().equals("colorchange")) {
notification.setSubject(groupAccount.getGroupName() + ", " + groupCanvas.getMcanvasname());
notification.setText("Note Farbe geändert: <span class='bold'>" + mnotes.getMnotetag() + "</span> ");
}
if (groupNoteHistory.getWhatHasChanged().equals("tagchange")) {
notification.setSubject(groupAccount.getGroupName() + ", " + groupCanvas.getMcanvasname());
notification.setText("Note Überschrift geändert: <span class='bold'>" + oldName + "</span> " + " in <span class='bold'> " + mnotes.getMnotetag() + "</span>");
}
if (groupNoteHistory.getWhatHasChanged().equals("textchange")) {
notification.setSubject(groupAccount.getGroupName() + ", " + groupCanvas.getMcanvasname());
notification.setText("Note Text geändert: <span class='bold'>" + mnotes.getMnotetag() + "</span> ");
}
if (groupNoteHistory.getWhatHasChanged().equals("zugweised")) {
notification.setSubject(groupAccount.getGroupName() + ", " + groupCanvas.getMcanvasname());
notification.setText("Note <span class='bold'>" + mnotes.getMnotetag() + "</span> " + editingUser.getFirstName() + " zugewiesen");
}
}
}
this.chatService.sendNotification(notification, groupMembers.getMemberid());
if (!(groupMembers.getMemberUsername().equals(email)) && (!gantt)) {
this.notificationService.addNotification(notification, groupMembers.getMemberid());
UnreadNotes unreadNotes = this.unreadNotesService.createUnreadNoteEntry(groupAccountId, groupMembers.getMemberUsername(), groupCanvas.getMcanvasid());
this.unreadNotesService.saveUnreadNoteEntry(unreadNotes, mnotes.getMnoticesid());
}
}
this.noteLockService.deleteNoteLockForUser(mnotes.getMnoticesid());
}
Java : Edit method, optimizing and minimizing method to reduce complexity
Yesterday I had posted a question regarding optimizing editMethod here on code-review. Thanks to an awesome answer by Pimgd, I was able to merge conditional checks, checking conditions and few other things.
I am posting this as a follow-up question for the other question for further optimization of the method. All suggestions are welcome!. Thank you very much.
Thank you. :-)
Java : Edit method, optimizing and minimizing method to reduce complexity
Yesterday I had posted a question regarding optimizing editMethod here on code-review. Thanks to an awesome answer by Pimgd, I was able to merge conditional checks, checking conditions and few other things. I am posting this as a follow-up question for the other question for further optimization of the method. All suggestions are welcome!. Thank you very much.
Thank you. :-)
Edit method, optimizing and minimizing method to reduce complexity
Yesterday I had posted a question regarding optimizing editMethod here on code-review. Thanks to an awesome answer by Pimgd, I was able to merge conditional checks, checking conditions and few other things.
I am posting this as a follow-up question for the other question for further optimization of the method. All suggestions are welcome!.