コード例 #1
0
 /**
  * This method is to delete alert
  *
  * @param formBase
  * @param result
  * @param request
  * @param response
  * @return ModelAndView
  */
 @RequestMapping(params = "methodToCall=approveAlert")
 public ModelAndView approveAlert(
     @ModelAttribute("KualiForm") DocumentFormBase formBase,
     BindingResult result,
     HttpServletRequest request,
     HttpServletResponse response) {
   AlertBo alertBo = null;
   MaintenanceDocumentForm maintenanceDocumentForm = (MaintenanceDocumentForm) formBase;
   OlePersistableBusinessObjectBase olePersistableBusinessObjectBase =
       (OlePersistableBusinessObjectBase)
           maintenanceDocumentForm.getDocument().getNewMaintainableObject().getDataObject();
   int index =
       Integer.parseInt(
           maintenanceDocumentForm.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
   olePersistableBusinessObjectBase.getAlertBoList().get(index).setAlertStatus(false);
   olePersistableBusinessObjectBase
       .getAlertBoList()
       .get(index)
       .setAlertModifierId(GlobalVariables.getUserSession().getPrincipalId());
   if (olePersistableBusinessObjectBase.getAlertBoList().get(index).isRepeatable()) {
     alertBo =
         alertHelperService.createNewAlertBo(
             olePersistableBusinessObjectBase.getAlertBoList().get(index));
     olePersistableBusinessObjectBase.getAlertBoList().add(alertBo);
   }
   return super.navigate(formBase, result, request, response);
 }
コード例 #2
0
 /**
  * This method is to save alert
  *
  * @param formBase
  * @param result
  * @param request
  * @param response
  * @return ModelAndView
  */
 @RequestMapping(params = "methodToCall=saveAlert")
 public ModelAndView saveAlert(
     @ModelAttribute("KualiForm") DocumentFormBase formBase,
     BindingResult result,
     HttpServletRequest request,
     HttpServletResponse response) {
   MaintenanceDocumentForm maintenanceDocumentForm = (MaintenanceDocumentForm) formBase;
   OlePersistableBusinessObjectBase olePersistableBusinessObjectBase =
       (OlePersistableBusinessObjectBase)
           maintenanceDocumentForm.getDocument().getNewMaintainableObject().getDataObject();
   int index =
       Integer.parseInt(
           maintenanceDocumentForm.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
   olePersistableBusinessObjectBase.getAlertBoList().get(index).setEditFlag(false);
   AlertBo alertBo = olePersistableBusinessObjectBase.getAlertBoList().get(index);
   String status = null;
   if (alertBo.getAlertDate() != null) {
     Date alertDate = alertBo.getAlertDate();
     if (alertDate.toString().equals(new Date(System.currentTimeMillis()).toString())) {
       status = "Active";
     } else {
       int dateCompare = alertBo.getAlertDate().compareTo(new Date(System.currentTimeMillis()));
       if (dateCompare > 0) {
         status = "Future";
       } else if (dateCompare < 0) {
         status = "Complete";
       }
     }
   }
   alertBo.setStatus(status);
   return super.navigate(maintenanceDocumentForm, result, request, response);
 }
コード例 #3
0
  @RequestMapping(params = "methodToCall=" + KRADConstants.Maintenance.METHOD_TO_CALL_EDIT)
  public ModelAndView maintenanceEdit(
      @ModelAttribute("KualiForm") MaintenanceDocumentForm form,
      BindingResult result,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    setupMaintenance(form, request, KRADConstants.MAINTENANCE_EDIT_ACTION);
    OlePersistableBusinessObjectBase olePersistableBusinessObjectBase =
        (OlePersistableBusinessObjectBase)
            form.getDocument().getNewMaintainableObject().getDataObject();
    olePersistableBusinessObjectBase.setAlertBoList(
        alertService.retrieveAlertList(form.getDocument().getDocumentNumber()));
    return getUIFModelAndView(form);
  }
コード例 #4
0
 /**
  * This method is to delete alert
  *
  * @param formBase
  * @param result
  * @param request
  * @param response
  * @return ModelAndView
  */
 @RequestMapping(params = "methodToCall=deleteAlert")
 public ModelAndView deleteAlert(
     @ModelAttribute("KualiForm") DocumentFormBase formBase,
     BindingResult result,
     HttpServletRequest request,
     HttpServletResponse response) {
   MaintenanceDocumentForm maintenanceDocumentForm = (MaintenanceDocumentForm) formBase;
   OlePersistableBusinessObjectBase olePersistableBusinessObjectBase =
       (OlePersistableBusinessObjectBase)
           maintenanceDocumentForm.getDocument().getNewMaintainableObject().getDataObject();
   int index =
       Integer.parseInt(
           maintenanceDocumentForm.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
   if (olePersistableBusinessObjectBase.getAlertBoList().size() > index) {
     olePersistableBusinessObjectBase.getAlertBoList().remove(index);
   }
   return super.navigate(formBase, result, request, response);
 }
コード例 #5
0
 /**
  * This method is to edit alert
  *
  * @param formBase
  * @param result
  * @param request
  * @param response
  * @return ModelAndView
  */
 @RequestMapping(params = "methodToCall=editAlert")
 public ModelAndView editAlert(
     @ModelAttribute("KualiForm") DocumentFormBase formBase,
     BindingResult result,
     HttpServletRequest request,
     HttpServletResponse response) {
   MaintenanceDocumentForm maintenanceDocumentForm = (MaintenanceDocumentForm) formBase;
   OlePersistableBusinessObjectBase olePersistableBusinessObjectBase =
       (OlePersistableBusinessObjectBase)
           maintenanceDocumentForm.getDocument().getNewMaintainableObject().getDataObject();
   int index =
       Integer.parseInt(
           maintenanceDocumentForm.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
   AlertBo alertBo = olePersistableBusinessObjectBase.getAlertBoList().get(index);
   alertBo.setEditFlag(true);
   alertBo.setAlertModifierId(GlobalVariables.getUserSession().getPrincipalId());
   alertBo.setAlertModifiedDate(new Date(System.currentTimeMillis()));
   alertBo.setAlertModifierName(
       alertService.getName(GlobalVariables.getUserSession().getPrincipalId()));
   return super.navigate(maintenanceDocumentForm, result, request, response);
 }
コード例 #6
0
  @Override
  public List<KeyValue> getKeyValues(ViewModel model) {

    List<KeyValue> keyValues = new ArrayList<KeyValue>();
    MaintenanceDocumentForm docForm = (MaintenanceDocumentForm) model;
    HrBusinessObject anHrKeyObject =
        (HrBusinessObject) docForm.getDocument().getNewMaintainableObject().getDataObject();
    LocalDate aDate = LocalDate.fromDateFields(anHrKeyObject.getRelativeEffectiveDate());

    if (aDate != null) {
      List<? extends HrGroupKey> groupKeyList =
          HrServiceLocator.getHrGroupKeyService().getAllActiveHrGroupKeys(aDate);
      if (CollectionUtils.isNotEmpty(groupKeyList)) {
        for (HrGroupKey groupKey : groupKeyList) {
          keyValues.add(
              new ConcreteKeyValue(
                  (String) groupKey.getGroupKeyCode(), (String) groupKey.getGroupKeyCode()));
        }
      }
    }

    return keyValues;
  }
  protected static void populateCreateCourseOfferingForm(
      MaintenanceDocumentForm form, HttpServletRequest request) {
    int firstValue = 0;

    try {
      ContextInfo contextInfo = ContextUtils.createDefaultContextInfo();
      MaintenanceDocument document = form.getDocument();
      String termId = request.getParameter(CourseOfferingConstants.TARGET_TERM_ID);
      CourseInfo courseInfo =
          CourseOfferingManagementUtil.getCourseService()
              .getCourse(request.getParameter(CourseOfferingConstants.COURSE_ID), contextInfo);

      // 1. set CourseOfferingInfo - no saved Course Offering as of yet (see logic in
      // CourseOfferingEditMaintainableImpl.retrieveObjectForEditOrCopy
      CourseOfferingInfo coInfo =
          CourseOfferingManagementUtil.createCourseOfferingInfo(termId, courseInfo);
      // set the default value for hasWaitlist based on info defined in ks-enroll-config.xml through
      // CourseWaitListServiceFacade
      coInfo.setHasWaitlist(getCourseWaitListServiceFacade().getHasWaitlist());

      CourseOfferingEditWrapper formObject = new CourseOfferingEditWrapper(coInfo);
      formObject.setCreateCO(true);

      // 2. set CourseInfo
      formObject.setCourse(courseInfo);

      // 3. set formatOfferingList
      formObject.setFormatOfferingList(new ArrayList<FormatOfferingWrapper>());
      FormatOfferingWrapper defaultFO = new FormatOfferingWrapper();
      defaultFO.setFormatId(courseInfo.getFormats().get(firstValue).getId());
      defaultFO.getRenderHelper().setNewRow(true);
      defaultFO.setCourseOfferingWrapper(formObject);
      formObject.getFormatOfferingList().add(defaultFO);
      formObject.setFinalExamDriver(LuServiceConstants.LU_EXAM_DRIVER_AO_KEY);

      // 4. Checking if Grading Options should be disabled or not and assign default (if no value)
      // 5. Checking if there are any student registration options from CLU for screen display
      List<String> studentRegOptions = new ArrayList<String>();
      List<String> crsGradingOptions = new ArrayList<String>();
      if (courseInfo != null) {
        List<String> gradingOptions = courseInfo.getGradingOptions();
        Set<String> regOpts =
            new HashSet<String>(
                Arrays.asList(
                    CourseOfferingServiceConstants.ALL_STUDENT_REGISTRATION_OPTION_TYPE_KEYS));
        for (String gradingOption : gradingOptions) {
          if (regOpts.contains(gradingOption)) {
            studentRegOptions.add(gradingOption);
          } else {
            crsGradingOptions.add(gradingOption);
          }
        }
        // Audit is pulled out into a dynamic attribute on course so map it back
        if ("true"
            .equals(
                courseInfo.getAttributeValue(
                    CourseAssemblerConstants.COURSE_RESULT_COMP_ATTR_AUDIT))) {
          studentRegOptions.add(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_AUDIT);
        }
      }

      formObject.setStudentRegOptions(studentRegOptions);
      formObject.setCrsGradingOptions(crsGradingOptions);

      // 6. Defining Credit Option and if CLU is fixed (then it's disabled)
      boolean creditOptionFixed = false;
      CreditOptionInfo creditOption = new CreditOptionInfo();

      // Grab the Course's credit constraints
      // FindBugs: getCreditOptions() null check is in CourseInfo
      List<ResultValuesGroupInfo> courseCreditOptions = courseInfo.getCreditOptions();

      // Lookup the related course's credit constraints and set them on the creditOption
      if (!courseCreditOptions.isEmpty()) {
        ResultValuesGroupInfo resultValuesGroupInfo = courseCreditOptions.get(firstValue);
        // Check for fixed
        if (resultValuesGroupInfo
            .getTypeKey()
            .equalsIgnoreCase(LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_FIXED)) {
          if (!resultValuesGroupInfo.getResultValueKeys().isEmpty()) {
            creditOption.setCourseFixedCredits(
                CourseOfferingManagementUtil.getLrcService()
                    .getResultValue(
                        resultValuesGroupInfo.getResultValueKeys().get(firstValue), contextInfo)
                    .getValue());
          }
          // Set the flag
          creditOptionFixed = true;

          // Default the value
          creditOption.setTypeKey(LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_FIXED);
          creditOption.setFixedCredit(creditOption.getCourseFixedCredits());
          creditOption.getAllowedCredits().add(creditOption.getCourseFixedCredits());
        } else {
          // This is either range or multiple

          // Copy all the allowed credits and sort so that the multiple checkboxes can be properly
          // displayed
          List<ResultValueInfo> resultValueInfos =
              CourseOfferingManagementUtil.getLrcService()
                  .getResultValuesForResultValuesGroup(resultValuesGroupInfo.getKey(), contextInfo);
          for (ResultValueInfo rVI : resultValueInfos) {
            creditOption.getAllowedCredits().add(rVI.getValue());
          }
          Collections.sort(creditOption.getAllowedCredits());

          if (resultValuesGroupInfo
              .getTypeKey()
              .equalsIgnoreCase(LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_RANGE)) {
            creditOption.setCourseMinCredits(
                resultValuesGroupInfo.getResultValueRange().getMinValue());
            creditOption.setCourseMaxCredits(
                resultValuesGroupInfo.getResultValueRange().getMaxValue());

            // Default the value
            creditOption.setTypeKey(LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_RANGE);
            creditOption.setMinCredits(creditOption.getCourseMinCredits());
            creditOption.setMaxCredits(creditOption.getCourseMaxCredits());
          } else if (resultValuesGroupInfo
              .getTypeKey()
              .equalsIgnoreCase(LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_MULTIPLE)) {
            // Default the value
            creditOption.setTypeKey(LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_MULTIPLE);
            creditOption.getCredits().addAll(creditOption.getAllowedCredits());
          }
        }
      }

      formObject.setCreditOption(creditOption);
      formObject.setCreditOptionFixed(creditOptionFixed);

      formObject.setOrganizationNames(new ArrayList<OrganizationInfoWrapper>());

      ArrayList<OrganizationInfoWrapper> orgList = new ArrayList<OrganizationInfoWrapper>();

      if (courseInfo.getUnitsContentOwner() != null
          && !courseInfo.getUnitsContentOwner().isEmpty()) {
        for (String orgId : courseInfo.getUnitsContentOwner()) {
          OrgInfo orgInfo =
              CourseOfferingManagementUtil.getOrganizationService().getOrg(orgId, contextInfo);
          orgList.add(new OrganizationInfoWrapper(orgInfo));
        }
      }
      formObject.setOrganizationNames(orgList);

      // retrieve exam period id for the term that the CO is attached to
      try {
        String examPeriodId =
            CourseOfferingManagementUtil.getExamOfferingServiceFacade()
                .getExamPeriodId(
                    formObject.getCourseOfferingInfo().getTermId(),
                    ContextUtils.createDefaultContextInfo());
        if (!StringUtils.isEmpty(examPeriodId)) {
          formObject.setExamPeriodId(examPeriodId);
        }
      } catch (DoesNotExistException e) {
        LOG.warn(
            "The Term {} that the course offering {} is attached to doesn't have an exam period to create exam offerings.",
            formObject.getCourseOfferingInfo().getTermId(),
            formObject.getCourseOfferingCode());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }

      formObject.setUseFinalExamMatrixSystemDefault(
          CourseOfferingManagementUtil.getExamOfferingServiceFacade().isUseFinalExamMatrix());
      formObject.setUseFinalExamMatrix(
          CourseOfferingManagementUtil.getExamOfferingServiceFacade().isUseFinalExamMatrix());

      // adding SOC
      SocInfo socInfo =
          CourseOfferingManagementUtil.getCourseOfferingSetService()
              .getSoc(request.getParameter(CourseOfferingConstants.SOC_ID), contextInfo);
      formObject.setSocInfo(socInfo);

      setTermPropertiesOnFormObject(formObject, termId, contextInfo);
      formObject.setContextBar(
          CourseOfferingContextBar.NEW_INSTANCE(
              formObject.getTerm(),
              formObject.getSocInfo(),
              CourseOfferingManagementUtil.getStateService(),
              CourseOfferingManagementUtil.getAcademicCalendarService(),
              contextInfo));

      document.getNewMaintainableObject().setDataObject(formObject);
      document.getOldMaintainableObject().setDataObject(formObject);
      document.getDocumentHeader().setDocumentDescription("Create CO - " + courseInfo.getCode());

    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
コード例 #8
0
  @Override
  @RequestMapping(params = "methodToCall=docHandler")
  public ModelAndView docHandler(
      @ModelAttribute("KualiForm") DocumentFormBase formBase,
      BindingResult result,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    // TODO getting double view if we call base, not sure how to handle
    // so pasting in superclass code
    // super.docHandler(formBase, request, response);
    // * begin copy/paste from the base
    MaintenanceDocumentForm form = (MaintenanceDocumentForm) formBase;

    // in all of the following cases we want to load the document
    if (ArrayUtils.contains(DOCUMENT_LOAD_COMMANDS, form.getCommand()) && form.getDocId() != null) {
      try {
        loadDocument(form);
        OlePersistableBusinessObjectBase olePersistableBusinessObjectBase =
            (OlePersistableBusinessObjectBase)
                form.getDocument().getNewMaintainableObject().getDataObject();
        olePersistableBusinessObjectBase.setAlertBoList(
            alertService.retrieveAlertList(form.getDocument().getDocumentNumber()));
      } catch (UnknownDocumentIdException udie) {
        ConfigurationService kualiConfigurationService =
            CoreApiServiceLocator.getKualiConfigurationService();
        StringBuffer sb = new StringBuffer();
        sb.append(kualiConfigurationService.getPropertyValueAsString(KRADConstants.KRAD_URL_KEY));
        sb.append(
            kualiConfigurationService.getPropertyValueAsString(
                KRADConstants.KRAD_INITIATED_DOCUMENT_URL_KEY));
        Properties props = new Properties();
        props.put(UifParameters.METHOD_TO_CALL, UifConstants.MethodToCallNames.START);
        GlobalVariables.getUifFormManager().removeSessionForm(form); // removeForm(form);
        return performRedirect(new InitiatedDocumentInfoForm(), sb.toString(), props);
      }
    } else if (KewApiConstants.INITIATE_COMMAND.equals(form.getCommand())) {
      createDocument(form);
    } else {
      LOG.error("docHandler called with invalid parameters");
      throw new IllegalArgumentException("docHandler called with invalid parameters");
    }
    // * end copy/paste from the base

    if (KewApiConstants.ACTIONLIST_COMMAND.equals(form.getCommand())
        || KewApiConstants.DOCSEARCH_COMMAND.equals(form.getCommand())
        || KewApiConstants.SUPERUSER_COMMAND.equals(form.getCommand())
        || KewApiConstants.HELPDESK_ACTIONLIST_COMMAND.equals(form.getCommand())
            && form.getDocId() != null) {
      // TODO: set state in view
      // form.setReadOnly(true);
      form.setMaintenanceAction(
          (form.getDocument()).getNewMaintainableObject().getMaintenanceAction());

      // Retrieving the FileName from BO table
      Maintainable tmpMaintainable = form.getDocument().getNewMaintainableObject();
      if (tmpMaintainable.getDataObject() instanceof PersistableAttachment) {
        PersistableAttachment bo =
            (PersistableAttachment)
                getBusinessObjectService()
                    .retrieve((PersistableBusinessObject) tmpMaintainable.getDataObject());
        if (bo != null) {
          request.setAttribute("fileName", bo.getFileName());
        }
      }
    } else if (KewApiConstants.INITIATE_COMMAND.equals(form.getCommand())) {
      // form.setReadOnly(false);
      setupMaintenance(form, request, KRADConstants.MAINTENANCE_NEW_ACTION);
    } else {
      LOG.error("We should never have gotten to here");
      throw new IllegalArgumentException("docHandler called with invalid parameters");
    }

    return getUIFModelAndView(form);
  }
コード例 #9
0
  @RequestMapping(method = RequestMethod.POST, params = "methodToCall=addAlertLine")
  public ModelAndView addAlertLine(
      @ModelAttribute("KualiForm") DocumentFormBase formBase,
      BindingResult result,
      HttpServletRequest request,
      HttpServletResponse response) {
    String selectedCollectionPath =
        formBase.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH);
    if (StringUtils.isBlank(selectedCollectionPath)) {
      throw new RuntimeException(
          "Selected collection was not set for add line action, cannot add new line");
    }
    CollectionGroup collectionGroup =
        formBase.getPostedView().getViewIndex().getCollectionGroupByPath(selectedCollectionPath);
    String addLinePath = collectionGroup.getAddLineBindingInfo().getBindingPath();
    Object addLine = ObjectPropertyUtils.getPropertyValue(formBase, addLinePath);
    ModelAndView modelAndView = super.addLine(formBase, result, request, response);
    List<String> principalIds = new ArrayList<String>();
    MaintenanceDocumentForm maintenanceDocumentForm =
        (MaintenanceDocumentForm) modelAndView.getModel().get("KualiForm");
    OlePersistableBusinessObjectBase olePersistableBusinessObjectBase =
        (OlePersistableBusinessObjectBase)
            maintenanceDocumentForm.getDocument().getNewMaintainableObject().getDataObject();
    AlertBo alertBo = olePersistableBusinessObjectBase.getAlertBoList().get(0);
    olePersistableBusinessObjectBase.getAlertBoList().remove(0);
    if (StringUtils.isBlank(alertBo.getReceivingGroupId())
        && StringUtils.isBlank(alertBo.getReceivingUserId())
        && StringUtils.isBlank(alertBo.getReceivingRoleId())
        && StringUtils.isBlank(alertBo.getReceivingGroupId())
        && StringUtils.isEmpty(alertBo.getReceivingUserName())
        && StringUtils.isEmpty(alertBo.getReceivingRoleName())
        && StringUtils.isEmpty(alertBo.getReceivingGroupName())) {
      GlobalVariables.getMessageMap()
          .putErrorForSectionId("OLE-AlertSection", OLEConstants.SELECT_USER);
      return modelAndView;
    }
    alertBo.setAlertCreateDate(new Date(System.currentTimeMillis()));
    alertBo.setAlertInitiatorId(GlobalVariables.getUserSession().getPrincipalId());
    alertBo.setAlertInitiatorName(
        alertService.getName(GlobalVariables.getUserSession().getPrincipalId()));

    String status = null;
    if (alertBo.getAlertDate() != null) {
      Date alertDate = alertBo.getAlertDate();
      if (alertDate.toString().equals(new Date(System.currentTimeMillis()).toString())) {
        status = "Active";
      } else {
        int dateCompare = alertBo.getAlertDate().compareTo(new Date(System.currentTimeMillis()));
        if (dateCompare > 0) {
          status = "Future";
        } else if (dateCompare < 0) {
          status = "Complete";
        }
      }
    }
    alertBo.setStatus(status);
    alertBo.setAlertStatus(true);
    List<AlertBo> alerts = new ArrayList<AlertBo>();
    if (StringUtils.isNotBlank(alertBo.getReceivingUserId())
        && (alertBo.getReceivingUserName() == null
            || (alertBo.getReceivingUserName() != null
                && alertBo.getReceivingUserName().trim().isEmpty()))) {
      alertBo.setReceivingUserName(alertService.getName(alertBo.getReceivingUserId()));
    }
    if (StringUtils.isBlank(alertBo.getReceivingUserId())
        && (alertBo.getReceivingUserName() != null
            && !alertBo.getReceivingUserName().trim().isEmpty())) {
      alertBo.setReceivingUserId(alertService.getPersonId(alertBo.getReceivingUserName()));
    }
    if (StringUtils.isNotBlank(alertBo.getReceivingUserId())) {
      principalIds.add(alertBo.getReceivingUserId());
    }
    alerts.addAll(alertService.getAlertBo(alertBo, principalIds, false, false));
    principalIds = new ArrayList<String>();

    if (StringUtils.isNotBlank(alertBo.getReceivingGroupId())
        && (alertBo.getReceivingGroupName() == null
            || (alertBo.getReceivingGroupName() != null
                && alertBo.getReceivingGroupName().trim().isEmpty()))) {
      alertBo.setReceivingGroupName(alertService.getGroupName(alertBo.getReceivingGroupId()));
    }
    if (StringUtils.isBlank(alertBo.getReceivingGroupId())
        && (alertBo.getReceivingGroupName() != null
            && !alertBo.getReceivingGroupName().trim().isEmpty())) {
      alertBo.setReceivingGroupId(alertService.getGroupId((alertBo.getReceivingUserName())));
    }

    if (StringUtils.isNotBlank(alertBo.getReceivingGroupId())) {
      List<String> memberIds = groupService.getMemberPrincipalIds(alertBo.getReceivingGroupId());
      principalIds.addAll(memberIds);
    }
    alerts.addAll(alertService.getAlertBo(alertBo, principalIds, false, true));

    principalIds = new ArrayList<String>();

    if (StringUtils.isNotBlank(alertBo.getReceivingRoleId())
        && (alertBo.getReceivingRoleName() == null
            || (alertBo.getReceivingRoleName() != null
                && alertBo.getReceivingRoleName().trim().isEmpty()))) {
      alertBo.setReceivingRoleName(alertService.getRoleName(alertBo.getReceivingRoleId()));
    }
    if (StringUtils.isBlank(alertBo.getReceivingRoleId())
        && (alertBo.getReceivingRoleName() != null
            && !alertBo.getReceivingRoleName().trim().isEmpty())) {
      alertBo.setReceivingRoleId(alertService.getRoleId((alertBo.getReceivingRoleName())));
    }

    if (StringUtils.isNotBlank(alertBo.getReceivingRoleId())) {
      List<String> roleIds = new ArrayList<String>();
      roleIds.add(alertBo.getReceivingRoleId());
      Role role = roleService.getRole(alertBo.getReceivingRoleId());
      Collection collection =
          (Collection)
              roleService.getRoleMemberPrincipalIds(
                  role.getNamespaceCode(), role.getName(), new HashMap<String, String>());
      List<String> memberIds = new ArrayList<String>();
      memberIds.addAll(collection);
      principalIds.addAll(memberIds);
    }

    alerts.addAll(alertService.getAlertBo(alertBo, principalIds, true, false));

    olePersistableBusinessObjectBase.getAlertBoList().addAll(alerts);
    if (StringUtils.isBlank(alertBo.getReceivingUserId())
        && StringUtils.isNotBlank(alertBo.getReceivingGroupId())) {
      olePersistableBusinessObjectBase.getAlertBoList().remove(0);
    }
    if (StringUtils.isNotBlank(alertBo.getReceivingUserId())
        && StringUtils.isNotBlank(alertBo.getReceivingGroupId())) {
      alertBo.setReceivingGroupName(null);
      alertBo.setReceivingGroupId(null);
    }

    return modelAndView;
  }