/** {@inheritDoc} */ public void validate(final ActivityDTO inActivity) { ValidationException ve = new ValidationException(); // Actor is not validated because it is supplied by the action. if (inActivity.getOriginalActor() != null && inActivity.getOriginalActor().getUniqueIdentifier() != null && inActivity.getOriginalActor().getUniqueIdentifier().length() > 0) { ve.addError("OriginalActor", "Must not be included for Post verbs."); } if (!ve.getErrors().isEmpty()) { throw ve; } }
/** * This method takes the activity and gets a list of all the org coordinators who are responsible * for the person or group to whose stream the activity was posted. Those will be the recipients. * * <p>{@inheritDoc} */ @Override public Collection<NotificationDTO> translate( final long inActorId, final long inDestinationId, final long inActivityId) { // Get the activity ActivityDTO activity = activitiesMapper.execute(inActivityId, null); StreamEntityDTO stream = activity.getDestinationStream(); NotificationType type = EntityType.PERSON == stream.getType() ? NotificationType.FLAG_PERSONAL_ACTIVITY : NotificationType.FLAG_GROUP_ACTIVITY; // Get the list of coordinators for the org which owns the entity (person/group) in whose stream // the activity // was posted List<Long> coordinatorIds = new ArrayList<Long>(coordinatorMapper.execute(activity.getRecipientParentOrgId())); NotificationDTO notif = new NotificationDTO(coordinatorIds, type, inActorId); notif.setDestination(activity.getRecipientParentOrgId(), EntityType.ORGANIZATION); notif.setActivity(inActivityId, activity.getBaseObjectType()); return Collections.singletonList(notif); }