Changeset 187

Show
Ignore:
Timestamp:
02/22/06 23:26:00
Author:
douglm
Message:

Zero duration for dates now disallowed.

New error property org.bedework.validation.error.invalid.duration

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/BwDuration.java

    r2 r187  
    244244    return new Duration(d); 
    245245  } 
     246   
     247  public boolean isZero() { 
     248    if (getWeeks() != 0) { 
     249      return false; 
     250    } 
     251     
     252    return ((getDays() == 0) &&  
     253            (getHours() == 0) && 
     254            (getMinutes() == 0) && 
     255            (getSeconds() == 0)); 
     256  } 
    246257 
    247258  /* ==================================================================== 
  • trunk/calendar3/webcommon/src/org/bedework/webcommon/EventDates.java

    r27 r187  
    168168      BwDateTime end = getEndDate().getDateTime(); 
    169169      end.setDateType(val.getDtstart().getDateType()); 
    170  
     170       
    171171      if ((getEndType() == null) || 
    172172          (getEndType().length() != 1)) { 
     
    175175      } 
    176176      val.setEndType(getEndType().charAt(0)); 
     177 
     178      if (val.getDtstart().getDateType() && 
     179          (val.getEndType() == BwEvent.endTypeDuration)) { 
     180        getDuration().setHours(0); 
     181        getDuration().setMinutes(0); 
     182        getDuration().setSeconds(0); 
     183         
     184        if (getDuration().isZero()) { 
     185          err.emit("org.bedework.validation.error.invalid.duration"); 
     186          return false; 
     187        } 
     188      } 
    177189 
    178190      if (val.getEndType() == BwEvent.endTypeDate) {