Examples of InvalidDataException


Examples of com.acelet.lib.InvalidDataException

      do {
        setNextRunTime(nextRunTime + 40000)

        if (skipTimes++ > 7200
          throw new InvalidDataException(Phrase.get("ER_CONFLICT_BETWEEN_DATA_AND_WEEKEND_POLICY"));
      } while (! new BusinessCalendar().isBusinessDay(nextRunTime, holidaySet));
    }

    if (baseTime > nextRunTime) {
      nextRunTime = NOT_SPECIFIED;
View Full Code Here

Examples of com.acelet.lib.InvalidDataException

    return isAdjustedNextRunTimeValid();
  }

  void setNextRunTime(long baseTime) throws Exception  {
    if (repeating == NOT_SPECIFIED) {
      throw new InvalidDataException(Phrase.get("TX_REPEATING"));

    } if (repeating == REPEATING_ONCE) {
      if (startTime == NOT_SPECIFIED)
        throw new InvalidDataException(Phrase.get("TX_START_TIME"));

      if (startTime >= System.currentTimeMillis())  
        nextRunTime = startTime;
      else
        status = STATUS_INACTIVE; 

    } else if (repeating == REPEATING_MINUTELY) {
      if (startTime == NOT_SPECIFIED)
        throw new InvalidDataException(Phrase.get("TX_START_TIME"));

      if (minutelyPeriod <= 0)
        throw new InvalidDataException(Phrase.get("TX_MINUTELY_PERIOD") + ": " +
          minutelyPeriod);

      setNextRunTimeForMinutely(baseTime, minutelyPeriod);

    } else if (repeating == REPEATING_HOURLY) {
      if (startTime == NOT_SPECIFIED)
        throw new InvalidDataException(Phrase.get("TX_START_TIME"));

      if (hourlyPeriod <= 0)
        throw new InvalidDataException(Phrase.get("TX_HOURLY_PERIOD") + ": " +
          hourlyPeriod);

      setNextRunTimeForMinutely(baseTime, hourlyPeriod * 60);

    } else if (repeating == REPEATING_DAILY) {
      if (startTime == NOT_SPECIFIED)
        throw new InvalidDataException(Phrase.get("TX_START_TIME"));

      if (dailyPeriod <= 0)
        throw new InvalidDataException(Phrase.get("TX_DAILY_PERIOD") + ": " +
          dailyPeriod);

      setNextRunTimeForDaily(baseTime, dailyPeriod);

    } else if (repeating == REPEATING_WEEKLY) {
      if (startTime == NOT_SPECIFIED)
        throw new InvalidDataException(Phrase.get("TX_START_TIME"));

      if (weeklyPeriod <= 0)
        throw new InvalidDataException(Phrase.get("TX_WEEKLY_PERIOD") + ": " + weeklyPeriod);

      if (weeklyWeekDay <= 0)
        throw new InvalidDataException(Phrase.get("TX_WEEKDAY") + ": " + weeklyWeekDay);

      if ((holidayPolicy != HOLIDAY_POLICY_SAME) &&
          (weeklyWeekDay == Calendar.SATURDAY || weeklyWeekDay == Calendar.SUNDAY))
        throw new InvalidDataException(Phrase.get("ER_CONFLICT_BETWEEN_DATA_AND_WEEKEND_POLICY"));

      setNextRunTimeForWeekly(baseTime);

    } else if (repeating == REPEATING_MONTHLY) {
      if (startTime == NOT_SPECIFIED)
        throw new InvalidDataException(Phrase.get("TX_START_TIME"));

      if (monthlyTheDay <= 0)
        throw new InvalidDataException(Phrase.get("TX_MONTHLY_THE_DAY") + ": " + monthlyTheDay);
      if (monthlyPeriod <= 0)
        throw new InvalidDataException(Phrase.get("TX_MONTHLY_PERIOD") + ": " + monthlyTheDay);

      setNextRunTimeForMonthly(baseTime);

    } else if (repeating == REPEATING_WEEK_DAY_MONTHLY) {
      if (startTime == NOT_SPECIFIED)
        throw new InvalidDataException(Phrase.get("TX_START_TIME"));

      if (monthlyPeriod <= 0)
        throw new InvalidDataException(Phrase.get("TX_MONTHLY_PERIOD") + ": " + monthlyTheDay);

      if ((holidayPolicy != HOLIDAY_POLICY_SAME) &&
          (monthlyWhichWeekWeekDay == Calendar.SATURDAY ||
           monthlyWhichWeekWeekDay == Calendar.SUNDAY))
        throw new InvalidDataException(Phrase.get("ER_CONFLICT_BETWEEN_DATA_AND_WEEKEND_POLICY"));

      setNextRunTimeForWeekDayMonthly(baseTime);

    } else if (repeating == REPEATING_AT_SPECIFIED_TIMES) {
      setNextRunTimeForSpecifiedTimes(baseTime);
View Full Code Here

Examples of com.acelet.lib.InvalidDataException

  void setNextRunTimeForSpecifiedTimes(long baseTime) throws Exception {
    GregorianCalendar calendar = getCalculationCalendarForSpecifiedTimes();
    parseSpecifiedTimes();

    if (holidayPolicy != HOLIDAY_POLICY_SAME && specifiedTimesContainWeekendsOnly())
      throw new InvalidDataException(Phrase.get("ER_CONFLICT_BETWEEN_DATA_AND_WEEKEND_POLICY"));

    int firstEligibleHour = getFirstEligibleHourForSpecifiedTime();
    int firstEligibleMinute = getFirstEligibleMinuteForSpecifiedTime();

    int startMonth = calendar.get(Calendar.MONTH);
View Full Code Here

Examples of com.cedarsolutions.exception.InvalidDataException

    /** Test assertSummary(). */
    @Test public void testAssertSummary() {
        ValidationErrors details1 = new ValidationErrors();
        details1.setSummary(new LocalizableMessage("key1", null, null));
        InvalidDataException e1 = new InvalidDataException("message1", details1);

        ValidationErrors details2 = new ValidationErrors();
        details2.setSummary(new LocalizableMessage("key2", "context2", null));
        InvalidDataException e2 = new InvalidDataException("message2", details2);

        assertSummary(e1, "key1");
        assertSummary(e1, "key1", null);
        assertSummary(e2, "key2", "context2");

View Full Code Here

Examples of com.cedarsolutions.exception.InvalidDataException

    /** Test assertOnlyMessage(). */
    @Test public void testAssertOnlyMessage() {
        ValidationErrors details1 = new ValidationErrors();
        details1.addMessage("key1", null);
        InvalidDataException e1 = new InvalidDataException("message1", details1);

        ValidationErrors details2 = new ValidationErrors();
        details2.addMessage("key2", "context2", null);
        InvalidDataException e2 = new InvalidDataException("message2", details2);

        ValidationErrors details3 = new ValidationErrors();
        details3.addMessage("key3a", "context3a", null);
        details3.addMessage("key3b", null);
        InvalidDataException e3 = new InvalidDataException("message3", details3);

        assertOnlyMessage(e1, "key1");
        assertOnlyMessage(e1, "key1", null);
        assertOnlyMessage(e2, "key2", "context2");

View Full Code Here

Examples of com.cedarsolutions.exception.InvalidDataException

    /** Test assertContainsMessage(). */
    @Test public void testAssertContainsMessage() {
        ValidationErrors details1 = new ValidationErrors();
        details1.addMessage("key1", null);
        InvalidDataException e1 = new InvalidDataException("message1", details1);

        ValidationErrors details2 = new ValidationErrors();
        details2.addMessage("key2", "context2", null);
        InvalidDataException e2 = new InvalidDataException("message2", details2);

        ValidationErrors details3 = new ValidationErrors();
        details3.addMessage("key3a", "context3a", null);
        details3.addMessage("key3b", null);
        InvalidDataException e3 = new InvalidDataException("message3", details3);

        assertContainsMessage(e1, "key1");
        assertContainsMessage(e1, "key1", null);
        assertContainsMessage(e2, "key2", "context2");
        assertContainsMessage(e3, "key3b");
View Full Code Here

Examples of com.cedarsolutions.exception.InvalidDataException

    }

    /** Test showValidationError(), null error. */
    public void testShowValidationError1() {
        View view = new View();
        InvalidDataException error = null;
        ValidationUtils.getInstance().showValidationError(view, error, "style");
        assertFalse(view.validationErrorWidget.isVisible());
        assertEquals("", view.validationErrorWidget.getErrorSummary());
        assertTrue(view.validationErrorWidget.getErrorList().isEmpty());
    }
View Full Code Here

Examples of com.cedarsolutions.exception.InvalidDataException

    }

    /** Test showValidationError(), empty error. */
    public void testShowValidationError2() {
        View view = new View();
        InvalidDataException error = new InvalidDataException();
        ValidationUtils.getInstance().showValidationError(view, error, "style");
        assertTrue(view.validationErrorWidget.isVisible());
        assertEquals(ValidationUtils.INTERNAL_ERROR_MESSAGE, view.validationErrorWidget.getErrorSummary());
        assertTrue(view.validationErrorWidget.getErrorList().isEmpty());
    }
View Full Code Here

Examples of com.cedarsolutions.exception.InvalidDataException

    }

    /** Test showValidationError(), with message, no details. */
    public void testShowValidationError3() {
        View view = new View();
        InvalidDataException error = new InvalidDataException("message");
        ValidationUtils.getInstance().showValidationError(view, error, "style");
        assertTrue(view.validationErrorWidget.isVisible());
        assertEquals("message", view.validationErrorWidget.getErrorSummary());
        assertTrue(view.validationErrorWidget.getErrorList().isEmpty());

        view = new View();
        error = new InvalidDataException(new LocalizableMessage("key", "text"));
        ValidationUtils.getInstance().showValidationError(view, error, "style");
        assertTrue(view.validationErrorWidget.isVisible());
        assertEquals("__key", view.validationErrorWidget.getErrorSummary());
        assertTrue(view.validationErrorWidget.getErrorList().isEmpty());
    }
View Full Code Here

Examples of com.cedarsolutions.exception.InvalidDataException

    /** Test showValidationError(), with message, empty details. */
    public void testShowValidationError4() {
        View view = new View();
        ValidationErrors details = new ValidationErrors();
        InvalidDataException error = new InvalidDataException("message", details);
        ValidationUtils.getInstance().showValidationError(view, error, "style");
        assertTrue(view.validationErrorWidget.isVisible());
        assertEquals("message", view.validationErrorWidget.getErrorSummary());
        assertTrue(view.validationErrorWidget.getErrorList().isEmpty());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.