Ejemplo n.º 1
0
 /**
  * This is a hook/hack for assign reviewer/submit for review, which has potential of multiple
  * reviewers reviewers are supposed to be processed separately, but for 'prompt user', it merged
  * into one prompt. 'reviewer role' are the same, but the role qualifiers' are different which is
  * based on context. the role qualifier are populated when we merge all recipients in to one list.
  * So, when sendnotification, it is just using the last 'context', so at this point, we don't want
  * rolequalifiers being populated again. If it is populated again, all reviewer role will retrieve
  * same reviewer because the context are the same at the point of 'send'. Unless, there is better
  * approach, we'll stick with this hack for now. isPopulateRole is only 'true' for this case, so
  * the other cases will stay the same as before this change.
  *
  * @see
  *     org.kuali.coeus.common.notification.impl.NotificationContextBase#populateRoleQualifiers(org.kuali.coeus.common.notification.impl.bo.NotificationTypeRecipient)
  */
 @Override
 public void populateRoleQualifiers(NotificationTypeRecipient notificationRecipient)
     throws UnknownRoleException {
   if (CollectionUtils.isEmpty(notificationRecipient.getRoleQualifiers())) {
     super.populateRoleQualifiers(notificationRecipient);
   }
 }
  private List<NotificationTypeRecipient> getDefaultNotificationTypeRecipients(
      String roleName, String personId, String rolodexId) {
    List<NotificationTypeRecipient> notificationTypeRecipients =
        new ArrayList<NotificationTypeRecipient>();

    if (StringUtils.isNotBlank(roleName)) {
      NotificationTypeRecipient notificationTypeRecipientRoleName = new NotificationTypeRecipient();
      notificationTypeRecipientRoleName.setRoleName(roleName);
      notificationTypeRecipients.add(notificationTypeRecipientRoleName);
    }

    if (StringUtils.isNotBlank(personId)) {
      NotificationTypeRecipient notificationTypeRecipientPersonId = new NotificationTypeRecipient();
      notificationTypeRecipientPersonId.setPersonId(personId);
      notificationTypeRecipients.add(notificationTypeRecipientPersonId);
    }

    if (StringUtils.isNotBlank(rolodexId)) {
      NotificationTypeRecipient notificationTypeRecipientRolodexId =
          new NotificationTypeRecipient();
      notificationTypeRecipientRolodexId.setRolodexId(rolodexId);
      notificationTypeRecipients.add(notificationTypeRecipientRolodexId);
    }

    return notificationTypeRecipients;
  }
 public void checkForCertifiedByProxy(
     DevelopmentProposal developmentProposal, ProposalPerson person, boolean recentlyCompleted) {
   boolean selfCertifyOnly =
       getParameterService()
           .getParameterValueAsBoolean(
               Constants.MODULE_NAMESPACE_PROPOSAL_DEVELOPMENT,
               Constants.PARAMETER_COMPONENT_DOCUMENT,
               ProposalDevelopmentConstants.Parameters.KEY_PERSON_CERTIFICATION_SELF_CERTIFY_ONLY);
   if (selfCertifyOnly) {
     String proxyId = getGlobalVariableService().getUserSession().getPrincipalId();
     if (!StringUtils.equals(person.getPersonId(), proxyId) && recentlyCompleted) {
       ProposalDevelopmentNotificationContext context =
           new ProposalDevelopmentNotificationContext(
               developmentProposal, "106", "Proposal Person Certification Completed");
       ((ProposalDevelopmentNotificationRenderer) context.getRenderer())
           .setDevelopmentProposal(developmentProposal);
       KcNotification notification = getKcNotificationService().createNotificationObject(context);
       NotificationTypeRecipient recipient = new NotificationTypeRecipient();
       recipient.setPersonId(person.getPersonId());
       getKcNotificationService()
           .sendNotification(context, notification, Collections.singletonList(recipient));
     }
   }
 }