Example #1
0
  /* Called for updating master subjects only. * fires rules to all registrars on whose sites subject is registered */
  private void activateRulesForNewOrUpdatedCorrespondence(Correspondence correspondence) {

    List<Object> objects = new ArrayList<Object>();
    objects.add(correspondence);
    PlannedNotification plannedNotification = getPlannedNotificationsForCorrespondence().get(0);
    plannedNotification.getUserBasedRecipient().clear();
    if (correspondence.getPersonSpokenTo() != null) {
      String email = correspondence.getPersonSpokenTo().getEmail();
      if (!StringUtils.isBlank(email)) {
        UserBasedRecipient ubr = new UserBasedRecipient();
        ubr.setPersonUser(correspondence.getPersonSpokenTo());
        ubr.setEmailAddress(email);
        plannedNotification.getUserBasedRecipient().add(ubr);
      }
    }

    for (PersonUser notifiedPersonUser : correspondence.getNotifiedStudyPersonnel()) {
      String email = notifiedPersonUser.getEmail();
      if (!StringUtils.isBlank(email)) {
        UserBasedRecipient ubr = new UserBasedRecipient();
        ubr.setPersonUser(notifiedPersonUser);
        ubr.setEmailAddress(email);
        plannedNotification.getUserBasedRecipient().add(ubr);
      }
    }

    objects.add(plannedNotification);
    rulesDelegationService.activateRules(
        NotificationEventTypeEnum.CORRESPONDENCE_CREATED_OR_UPDATED_EVENT, objects);
    objects.remove(plannedNotification);
  }
Example #2
0
 /**
  * returns false if input values are %'s or blanks
  *
  * @param firstName
  * @param middleName
  * @param lastName
  * @return boolean
  */
 private boolean isDataValid(String firstName, String middleName, String lastName) {
   if ((StringUtils.isBlank(firstName) || firstName.matches("%+"))
       && (StringUtils.isBlank(middleName) || middleName.matches("%+"))
       && (StringUtils.isBlank(lastName) || lastName.matches("%+"))) {
     return false;
   }
   return true;
 }
Example #3
0
  @Transient
  public boolean isBlank() {

    if (StringUtils.getBlankIfNull(getStreetAddress()).equals("")
        && StringUtils.getBlankIfNull(getCity()).equals("")
        && StringUtils.getBlankIfNull(getCountryCode()).equals("")
        && StringUtils.getBlankIfNull(getPostalCode()).equals("")
        && StringUtils.getBlankIfNull(getStateCode()).equals("")) {
      return true;
    }
    return false;
  }
Example #4
0
 /**
  * Sets the nci code.
  *
  * @param nciCode the nci code
  * @param primaryIndicator the primary indicator
  */
 public void setNCICode(String nciCode, boolean primaryIndicator) {
   if (!StringUtils.isEmpty(nciCode)) {
     OrganizationAssignedIdentifier identifier = null;
     for (OrganizationAssignedIdentifier tempIdentifier : getOrganizationAssignedIdentifiers()) {
       if (tempIdentifier.getType() == OrganizationIdentifierTypeEnum.NCI) {
         identifier = (OrganizationAssignedIdentifier) tempIdentifier;
         break;
       }
     }
     if (identifier == null) {
       identifier = new OrganizationAssignedIdentifier();
       identifier.setType(OrganizationIdentifierTypeEnum.NCI);
       identifier.setPrimaryIndicator(primaryIndicator);
       getIdentifiersAssignedToOrganization().add(identifier);
     }
     identifier.setValue(nciCode);
   }
 }
Example #5
0
  public String getTable(
      Map<String, List> parameterMap, String[] params, HttpServletRequest request) {

    List<StudySubject> studySubjectResults;
    Participant participant;
    SystemAssignedIdentifier id;

    Study study = new LocalStudy(true);
    if (!StringUtils.isEmpty(params[0].toString())) {
      study.setShortTitleText(params[0].toString());
    }
    if (!StringUtils.isEmpty(params[1].toString())) {
      id = new SystemAssignedIdentifier();
      id.setValue(params[1].toString());
      study.addIdentifier(id);
    }

    List<Study> studyList = new ArrayList<Study>();

    // this if -else ensures that participant is null if no data relevant to
    // participant is
    // entered and the studyDao is called.
    if (StringUtils.isEmpty(params[2].toString())
        && StringUtils.isEmpty(params[3].toString())
        && StringUtils.isEmpty(params[4].toString())) {
      participant = null;
      // call the studyDao if participant is null.
      studyList = studyDao.searchByExample(study, true, 0);
    } else {
      participant = new Participant();
      id = new SystemAssignedIdentifier();
      if (!StringUtils.isEmpty(params[2].toString())) {
        id.setValue(params[2].toString());
        participant.addIdentifier(id);
      }

      if (!StringUtils.isEmpty(params[3].toString())) {
        participant.setFirstName(params[3].toString());
      }
      if (!StringUtils.isEmpty(params[4].toString())) {
        participant.setLastName(params[4].toString());
      }

      StudySite studySite = new StudySite();
      study.addStudySite(studySite);

      StudySubject studySubject = new StudySubject();
      studySubject.setStudySite(studySite);
      studySubject.setParticipant(participant);

      // else call the studySubjectDao
      studySubjectResults = studySubjectDao.advancedStudySearch(studySubject);
      Iterator iter = studySubjectResults.iterator();
      while (iter.hasNext()) {
        studyList.add(((StudySubject) iter.next()).getStudySite().getStudy());
      }
    }

    Context context = new HttpServletRequestContext(request, parameterMap);

    TableModel model = new TableModelImpl(context);
    try {
      return build(model, studyList).toString();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return "";
  }