Task #2050
closedAdd full identity to LastContractEndNotificationTask
Added by Tomáš Doischer almost 5 years ago. Updated almost 5 years ago.
100%
Description
Right now, LastContractEndNotificationTask only sends first name, last name, and username. We need to change this to the full identity.
Related issues
Updated by Tomáš Doischer almost 5 years ago
- Status changed from In Progress to Needs feedback
- % Done changed from 0 to 80
Developed in branch
based on branch 1.6.0-RC.
I added the full identity to the notification but kept the full name with login as well for compatibility. I also noticed that there was a possible null pointer when no recipients were found, I fixed that and improved logging. Right now, in IdM, there are three possible scenarios in this task:
1) the notification was not sent and it shouldn't have been sent (i. e., the identity does not fit the criteria for sending the notification) - will be shown in yellow
2) the notification was not sent and it should have been sent but no recipients were found - will be shown in red with an explaining message
3) the notification was sent, shown in green
Updated by Tomáš Doischer almost 5 years ago
- Assignee changed from Tomáš Doischer to Peter Štrunc
@sourek Can you please perform code-review? Compare my branch to 1.6.0-RC? Thank you!
Updated by Peter Štrunc almost 5 years ago
- Status changed from Needs feedback to In Progress
- Assignee changed from Peter Štrunc to Tomáš Doischer
Thanks for the fix, i've found a few issues:
- Avoid using class fields to store state in classes, which are annotated as Service or Component. These are stateless by nature and are always singleton so it could have unpredictable consequences. If i am not mistaken, all of the class fields in LastContractEndNotificationTask, which are not autowired, can and should be refactored into local variables so that you prevent multithreading issues.
- You can use configurationService.getDateFormat() instead of hard-coded "dd. MM. YYYY" date format
Following code could be refactored into a separate method:
recipients = getRecipients(guarantee); if (recipients.isEmpty()) { return Optional.of(new OperationResult.Builder(OperationState.EXCEPTION). setModel(new DefaultResultModel(ExtrasResultCode.NO_RECIPIENTS_FOUND)). build()); } sendNotification(ExtrasModuleDescriptor.TOPIC_CONTRACT_END, new ArrayList<>(recipients), guarantee); return Optional.of(new OperationResult.Builder(OperationState.EXECUTED).build());
Otherwise the functionality looks great. Please update changelog and add this functionality also to current version compatible with 10.x.x.
I created MR here https://github.com/bcvsolutions/czechidm-extras/pull/16
Updated by Tomáš Doischer almost 5 years ago
- Assignee changed from Tomáš Doischer to Peter Štrunc
Thank you, I moved most of the class fields to local variables, some are still remaining (they have to be there). Other comments were implemented.
I updated documentation and will add the changes to current develop in its own branch.
Updated by Peter Štrunc almost 5 years ago
- Status changed from In Progress to Resolved
- % Done changed from 80 to 100
Merged. Thanks for this feature.
Updated by Peter Štrunc almost 5 years ago
- Copied to Task #2131: Add full identity to LastContractEndNotificationTask added
Updated by Peter Štrunc almost 5 years ago
- Status changed from Resolved to Closed