/** * Persist notifications * * @param pl Susbcriptors for each event * @param audits The events */ private void createNotifications( List<Profile> pl, List<UGCAudit> audits, Map<String, Profile> actionOwnersCache) { if (pl == null || pl.size() == 0) { return; } for (UGCAudit currentAudit : audits) { UGC ugc = ugcRepository.findOne(currentAudit.getUgcId()); if (ugc != null) { UGC.ModerationStatus modStatus = ugc.getModerationStatus(); if (modStatus != UGC.ModerationStatus.SPAM && modStatus != UGC.ModerationStatus.TRASH) { for (Profile profile : pl) { if (log.isDebugEnabled()) { log.debug( "Audit harvester creating notification event ROW " + currentAudit.getRow() + " for the subscriber: " + profile.getUserName()); } createNotification(profile, currentAudit, actionOwnersCache); } } } } }
private Event createEvent(UGCAudit currentAudit, Profile actionOwner) { Event event = new Event(); event.setAction(currentAudit.getAction()); event.setProfile(actionOwner); event.setTarget(currentAudit.getTarget()); event.setUgcId(currentAudit.getUgcId()); event.setTenantName(currentAudit.getTenant()); event.setAuditDate(currentAudit.getCreatedDate()); return event; }