Changeset 257

Show
Ignore:
Timestamp:
03/03/06 15:02:22
Author:
douglm
Message:

Possible fix to serializability problems - and date range checks in user client.

Temporarily limit years to about 10 years either side of present

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/HibSession.java

    r235 r257  
    8080 * @author Mike Douglass douglm@rpi.edu 
    8181 */ 
    82 public class HibSession
     82public class HibSession implements Serializable
    8383  transient Logger log; 
    8484 
    8585  Session sess; 
    86   Transaction tx; 
    87  
    88   Query q; 
    89   Criteria crit; 
     86  transient Transaction tx; 
     87 
     88  transient Query q; 
     89  transient Criteria crit; 
    9090 
    9191  /** Exception from this session. */ 
  • trunk/calendar3/webclient/src/org/bedework/webclient/BwGoToAction.java

    r251 r257  
    146146      Date jdt = CalFacadeUtil.fromISODate(date); 
    147147      dt = new MyCalendarVO(jdt, loc); 
     148      if (!checkDateInRange(form, dt.getYear())) { 
     149        // Set it to today 
     150        jdt = new Date(System.currentTimeMillis()); 
     151        dt = new MyCalendarVO(jdt, loc); 
     152      } 
    148153      newView = true; 
    149154    } 
     
    168173         If so we'll set a new view of the same period as the current. 
    169174       */ 
    170       String vsdate = viewStart.getDateTime().getDtval().substring(0, 8); 
    171       if (debug) { 
    172         action.logIt("vsdate=" + vsdate); 
    173       } 
    174  
    175       if (!(vsdate.equals(form.getCurTimeView().getFirstDay().getDateDigits()))) { 
    176         newView = true; 
    177         newViewTypeI = form.getCurViewPeriod(); 
    178         Date jdt = CalFacadeUtil.fromISODate(vsdate); 
    179         dt = new MyCalendarVO(jdt, loc); 
     175      int year = viewStart.getCalYear(); 
     176       
     177      if (checkDateInRange(form, year)) { 
     178        String vsdate = viewStart.getDateTime().getDtval().substring(0, 8); 
     179        if (debug) { 
     180          action.logIt("vsdate=" + vsdate); 
     181        } 
     182         
     183        if (!(vsdate.equals(form.getCurTimeView().getFirstDay().getDateDigits()))) { 
     184          newView = true; 
     185          newViewTypeI = form.getCurViewPeriod(); 
     186          Date jdt = CalFacadeUtil.fromISODate(vsdate); 
     187          dt = new MyCalendarVO(jdt, loc); 
     188        } 
    180189      } 
    181190    } 
     
    202211    form.getEventEndDate().setDateTime(tv.getCurDay().getTime()); 
    203212  } 
     213   
     214  private static boolean checkDateInRange(BwActionForm form, 
     215                                   int year) throws Throwable { 
     216    // XXX make system parameters for allowable start/end year 
     217    int thisYear = form.getToday().getYear(); 
     218     
     219    if ((year < thisYear - 10) || (year > thisYear + 10)) { 
     220      form.getErr().emit("org.bedework.client.error.baddate"); 
     221      return false; 
     222    } 
     223     
     224    return true; 
     225  } 
    204226} 
  • trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java

    r235 r257  
    339339  } 
    340340 
    341   /** Method to retrieve an event. 
     341  /** Method to retrieve an event. An event is identified by the calendar +  
     342   * guid + recurrence id. We also take the subscription id as a parameter so 
     343   * we can pass it along in the result for display purposes. 
     344   *  
     345   * <p>We cannot just take the calendar from the subscription, because the 
     346   * calendar has to be the actual collection containing the event. A  
     347   * subscription may be to higher up the tree (i.e. a folder). 
     348   *  
     349   * <p>We need to also allow the calendar path instead of the id. External 
     350   * calendars don't have an id. This means changing the api (again) and  
     351   * changing the urls (again). 
     352   *  
     353   * <p>It may be more appropriate to simply encode a url to the event. 
     354   *  
    342355   * <p>Request parameters<ul> 
    343356   *      <li>"subid"    subscription id for event. < 0 if there is none 
    344357   *                     e.g. displayed directly from calendar.</li> 
     358   *      <li>"calid"    id of calendar to search.</li> 
    345359   *      <li>"guid"     guid of event.</li> 
    346360   *      <li>"recurrenceId"   recurrence-id of event instance - possibly null.</li> 
  • trunk/calendar3/webcommon/src/org/bedework/webcommon/TimeDateComponents.java

    r172 r257  
    352352  } 
    353353 
     354  /** 
     355   * @return int year 
     356   */ 
     357  public int getCalYear() { 
     358    return getCal().get(Calendar.YEAR); 
     359  } 
     360 
    354361  /* XXX 
    355362     In the get methods below, we try to translate real values to the