Looking into similar existing solutions - I am thinking about the Publication Workflow Review This seems to create an "automagical" entry in the notifications section to listen to theses events and get mails, etc. The code to fetch the pending workflow documents looks like it might be reused for to the review pages: https://github.com/xwiki-contrib/application-publication-workflow-review/blob/2fafaddaf093eaa1abf27925bacc62ffd8ee8faf/xwiki-workflow-publication-review-api/src/main/java/org/xwiki/contrib/publicationworkflowreview/internal/DefaultPublicationWorkflowReviewManager.java#L90 (The query could be simplified, as HQL in the mean time knows about the < operator for dates.) The Scheduler calling this is at : https://github.com/xwiki-contrib/application-publication-workflow-review/blob/main/xwiki-workflow-publication-review-ui/src/main/resources/PublicationWorkflowReviewCode/ReviewPublishedDocumentsNotifierSchedulerJob.xml but this might be a separate java level code instead as well. (However this might make it more tricky to configure than just editing the scheduler job.) The events generated by this scheduler are here: https://github.com/xwiki-contrib/application-publication-workflow-review/blob/main/xwiki-workflow-publication-review-api/src/main/java/org/xwiki/contrib/publicationworkflowreview/notifications/events/DocumentReviewDateReachedTargetableEvent.java but I cannot find where the mail template to send the event is - there seem to be some fallback provided by the platform. All in all implementing this should need the introduction of a java-level "API" module, which is likely to be a good idea anyway. |