Exemplo n.º 1
0
 public void testValidateDiseaseInformation() {
   getAssignment().setDiseaseHistory(new StudyParticipantDiseaseHistory());
   getAssignment().getDiseaseHistory().setDiagnosisDate(new DateValue(DateUtils.today()));
   command.setParticipant(command.getAssignment().getParticipant());
   tab.validate(command, errors);
   assertEquals(0, errors.getFieldErrorCount("assignment.diseaseHistory.diagnosisDate"));
 }
Exemplo n.º 2
0
  /**
   * Adds the scheduled notifications.
   *
   * @param reportDefinition the report definition
   * @param report the report
   */
  public void addScheduledNotifications(ReportDefinition reportDefinition, Report report) {
    // Note : there is a change in busineess requirement, that at firing time only we generate the
    // message/recipients
    // So only one Scheduled Notification per Planned Notification.
    if (CollectionUtils.isEmpty(reportDefinition.getPlannedNotifications())) return;

    Date now = nowFactory.getNow();
    Calendar cal = GregorianCalendar.getInstance();

    for (PlannedNotification plannedNotification : reportDefinition.getPlannedNotifications()) {
      ScheduledNotification scheduledNotification =
          plannedNotification.createScheduledNotification("dummy");

      if (plannedNotification instanceof PlannedEmailNotification) {
        ScheduledEmailNotification scheduledEmailNotification =
            (ScheduledEmailNotification) scheduledNotification;
        scheduledEmailNotification.setBody("dummy");
        scheduledEmailNotification.setSubjectLine("dummy");
      }

      // set the scheduled dates
      if (reportDefinition.getBaseDate() != null) cal.setTime(reportDefinition.getBaseDate());
      else cal.setTime(now);
      cal.add(
          reportDefinition.getTimeScaleUnitType().getCalendarTypeCode(),
          plannedNotification.getIndexOnTimeScale());
      scheduledNotification.setScheduledOn(cal.getTime());
      if (plannedNotification.getIndexOnTimeScale() == 0
          || DateUtils.compateDateAndTime(now, cal.getTime()) < 0)
        report.addScheduledNotification(scheduledNotification);
    }
  }