Changeset 54

Show
Ignore:
Timestamp:
01/31/06 09:50:28
Author:
douglm
Message:

Added a number of fields to the system parameters - some not yet used:

maxPublicDescriptionLength
will be used to limit the size of the description for public events
maxUserDescriptionLength;
will be used to limit the size of the description for user events

maxUserEntitySize, defaultUserQuota
will be used when we have quotas working.
defaultUserViewName
Used to set the name of the default view created when a user is added.
Add the above to dump/restore. Changes to CalSvc? to set default view

Add unremoveable flag to subscriptions. Add to dump/restore

Add quota to BwUser?, Add to dump/restore. Set it in CalintfImpl? from syspars.
Add value to users when converting from 2.3

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/calCore/resources/hbms/Subscription.hbm.xml

    r2 r54  
    55 
    66<!-- =================================================================== 
    7      SubscriptionS 
     7     Subscriptions 
    88     =================================================================== --> 
    99 
     
    3838    <property name="calendarDeleted" type="true_false" 
    3939              column="calendar_deleted" not-null="true" /> 
     40 
     41    <property name="unremoveable" type="true_false" 
     42              column="unremoveable" not-null="true" /> 
    4043  </class> 
    4144 
  • trunk/calendar3/calCore/resources/hbms/System.hbm.xml

    r19 r54  
    2727    <property name="userInbox" column="userInbox" type="text" /> 
    2828    <property name="userOutbox" column="userOutbox" type="text" /> 
     29    <property name="defaultUserViewName" column="defaultUserViewName" type="text" /> 
    2930 
    3031    <property name="publicUser" column="public_user" type="text" /> 
     
    3738    <property name="httpConnectionsPerHost" column="http_connections_per_host" type="integer" /> 
    3839    <property name="httpConnections" column="http_connections" type="integer" /> 
     40 
     41    <property name="maxPublicDescriptionLength" column="maxPublicDescriptionLength" type="integer" /> 
     42    <property name="maxUserDescriptionLength" column="maxUserDescriptionLength" type="integer" /> 
     43    <property name="maxUserEntitySize" column="maxUserEntitySize" type="integer" /> 
     44    <property name="defaultUserQuota" column="defaultUserQuota" type="long" /> 
    3945 
    4046    <property name="userauthClass" column="userauth_class" type="text" /> 
  • trunk/calendar3/calCore/resources/hbms/User.hbm.xml

    r2 r54  
    4444    <property name="locationAccess" 
    4545              column="location_access" type="text"/> 
     46 
     47    <property name="quota" type="long"/> 
    4648  </class> 
    4749</hibernate-mapping> 
  • trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java

    r36 r54  
    617617    user.setSponsorAccess(access.getDefaultPersonalAccess()); 
    618618 
     619    user.setQuota(getSyspars().getDefaultUserQuota()); 
     620 
    619621    sess.save(user); 
    620622 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/BwSystem.java

    r18 r54  
    7575  private String systemid; 
    7676 
    77   /* Default calendara names */ 
     77  /* Default calendar names */ 
    7878  private String publicCalendarRoot; 
    7979  private String userCalendarRoot; 
     
    8282  private String userInbox; 
    8383  private String userOutbox; 
     84  private String defaultUserViewName; 
    8485 
    8586  private String publicUser; 
     
    9091  private int httpConnectionsPerHost; 
    9192  private int httpConnections; 
     93 
     94  /* Limits */ 
     95  private int maxPublicDescriptionLength = 500; 
     96  private int maxUserDescriptionLength = 1000; 
     97  private int maxUserEntitySize = 100000; 
     98  private long defaultUserQuota = 1000000 * 10; // 10 Meg OK? 
    9299 
    93100  private String userauthClass; 
     
    240247  } 
    241248 
     249  /** Set the user default view name 
     250   * 
     251   * @param val    String 
     252   */ 
     253  public void setDefaultUserViewName(String val) { 
     254    defaultUserViewName = val; 
     255  } 
     256 
     257  /** Get the userCalendar 
     258   * 
     259   * @return String   userTrashCalendar 
     260   */ 
     261  public String getDefaultUserViewName() { 
     262    return defaultUserViewName; 
     263  } 
     264 
    242265  /** Set the public user 
    243266   * 
     
    318341  public int getHttpConnections() { 
    319342    return httpConnections; 
     343  } 
     344 
     345  /** Set the max description length for public events 
     346   * 
     347   * @param val    int max 
     348   */ 
     349  public void setMaxPublicDescriptionLength(int val) { 
     350    maxPublicDescriptionLength = val; 
     351  } 
     352 
     353  /** 
     354   * 
     355   * @return int 
     356   */ 
     357  public int getMaxPublicDescriptionLength() { 
     358    return maxPublicDescriptionLength; 
     359  } 
     360 
     361  /** Set the max description length for user events 
     362   * 
     363   * @param val    int max 
     364   */ 
     365  public void setMaxUserDescriptionLength(int val) { 
     366    maxUserDescriptionLength = val; 
     367  } 
     368 
     369  /** 
     370   * 
     371   * @return int 
     372   */ 
     373  public int getMaxUserDescriptionLength() { 
     374    return maxUserDescriptionLength; 
     375  } 
     376 
     377  /** Set the max entity length for users. Probably an estimate 
     378   * 
     379   * @param val    int max 
     380   */ 
     381  public void setMaxUserEntitySize(int val) { 
     382    maxUserEntitySize = val; 
     383  } 
     384 
     385  /** 
     386   * 
     387   * @return int 
     388   */ 
     389  public int getMaxUserEntitySize() { 
     390    return maxUserEntitySize; 
     391  } 
     392 
     393  /** Set the default quota for users. Probably an estimate 
     394   * 
     395   * @param val    long default 
     396   */ 
     397  public void setDefaultUserQuota(long val) { 
     398    defaultUserQuota = val; 
     399  } 
     400 
     401  /** 
     402   * 
     403   * @return long 
     404   */ 
     405  public long getDefaultUserQuota() { 
     406    return defaultUserQuota; 
    320407  } 
    321408 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/BwUser.java

    r2 r54  
    6060 */ 
    6161public class BwUser extends BwPrincipal { 
     62  private long quota; 
     63 
    6264  private boolean instanceOwner; 
    6365 
     
    8284  public int getKind() { 
    8385    return principalUser; 
     86  } 
     87 
     88  /** Quota for this user. This will have to be an estimate I imagine. 
     89   * 
     90   * @param val 
     91   */ 
     92  public void setQuota(long val) { 
     93    quota = val; 
     94  } 
     95 
     96  /** 
     97   * @return long 
     98   */ 
     99  public long getQuota() { 
     100    return quota; 
    84101  } 
    85102 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/BwSubscription.java

    r50 r54  
    7979  private boolean calendarDeleted; 
    8080 
     81  /** Mark this subscription as unremovable by the user. 
     82   */ 
     83  private boolean unremoveable; 
     84 
    8185  /* Non-db fields */ 
    8286 
     
    221225  public boolean getCalendarDeleted() { 
    222226    return calendarDeleted; 
     227  } 
     228 
     229  /** Is the subscription unremoveable? 
     230   * 
     231   * @param val   boolean true if the subscription is unremoveable 
     232   */ 
     233  public void setUnremoveable(boolean val) { 
     234    unremoveable = val; 
     235  } 
     236 
     237  /** Is the subscription unremoveable? 
     238   * 
     239   * @return boolean  true if the subscription is unremoveable 
     240   */ 
     241  public boolean getUnremoveable() { 
     242    return unremoveable; 
    223243  } 
    224244 
     
    364384    sb.append(", uri="); 
    365385    sb.append(String.valueOf(getUri())); 
     386    sb.append(", unremoveable="); 
     387    sb.append(getUnremoveable()); 
    366388    sb.append(")"); 
    367389 
  • trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java

    r48 r54  
    18321832 
    18331833        // Add default subscription for default calendar. 
    1834         BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); 
     1834        BwSubscription defSub = BwSubscription.makeSubscription(cal, 
     1835                                              cal.getName(), true, true, false); 
     1836        setupOwnedEntity(defSub); 
     1837 
     1838        prefs.addSubscription(defSub); 
     1839 
     1840        // Add default subscription for trash calendar. 
     1841 
     1842        cal = cali.getTrashCalendar(); 
     1843        BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), 
     1844                                                             false, false, false); 
    18351845        setupOwnedEntity(sub); 
    18361846 
    18371847        prefs.addSubscription(sub); 
    18381848 
    1839         // Add default subscription for trash calendar. 
    1840  
    1841         cal = cali.getTrashCalendar(); 
    1842         sub = BwSubscription.makeSubscription(cal, cal.getName(), false, false, false); 
    1843         setupOwnedEntity(sub); 
    1844  
    1845         prefs.addSubscription(sub); 
     1849        // Add a default view for the default calendar subscription 
     1850 
     1851        BwView view = new BwView(); 
     1852 
     1853        view.setName(getSyspars().getDefaultUserViewName()); 
     1854        view.addSubscription(defSub); 
     1855        view.setOwner(auth); 
     1856 
     1857        prefs.addView(view); 
    18461858 
    18471859        dbi.updatePreferences(prefs); 
  • trunk/calendar3/docs/todo.txt

    r50 r54  
    22 
    33-------------------------------------------------------------------------------- 
    4 Web-client - ensure no unexpeected data modifications. 
    5 -------------------------------------------------------------------------------- 
    64maxDescriptionLength out of BwEvent - into syspars? 
    75-------------------------------------------------------------------------------- 
     6Unremovable subscriptions 
     7-------------------------------------------------------------------------------- 
     8Personal users need default subscriptions and views 
     9-------------------------------------------------------------------------------- 
     10Web-client - ensure no unexpected data modifications. 
     11-------------------------------------------------------------------------------- 
    812Check all day events are correct in all clients. 
    9 -------------------------------------------------------------------------------- 
    10 Unremovable subscriptions 
    11 -------------------------------------------------------------------------------- 
    12 Personal users need default subscriptions and views 
    1313-------------------------------------------------------------------------------- 
    1414Finish off moving calendar labelling stuff out of TimeDateComponents 
  • trunk/calendar3/dumprestore/build.xml

    r50 r54  
    264264      <arg value="-defoutbox" /> 
    265265      <arg value="${org.bedework.env.default.user.outbox}" /> 
     266      <arg value="-defuview" /> 
     267      <arg line="${org.bedework.env.default.user.view}" /> 
    266268 
    267269      <arg line="${org.bedework.restore.arg.public.user}" /> 
  • trunk/calendar3/dumprestore/properties/dumprestore.properties

    r50 r54  
    5757org.bedework.restore.arg.timezones= 
    5858 
    59 # -------------------- System parameters ---------------------------- 
     59# ----------------- System parameters for 2.3.2 conversion ------------------- 
    6060org.bedework.restore.arg.sysname=bedework 
    6161org.bedework.restore.arg.tzid=America/New_York 
     
    6868org.bedework.env.default.user.inbox=Inbox 
    6969org.bedework.env.default.user.outbox=Outbox 
     70org.bedework.env.default.user.view=All 
    7071 
    7172org.bedework.restore.arg.public.user=-pu public-user 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/dumpling/DumpSyspars.java

    r49 r54  
    8383    taggedVal("userInbox", s.getUserInbox()); 
    8484    taggedVal("userOutbox", s.getUserOutbox()); 
     85    taggedVal("defaultUserViewName", s.getDefaultUserViewName()); 
    8586 
    8687    taggedVal("publicUser", s.getPublicUser()); 
     
    9192    taggedVal("httpConnectionsPerHost", s.getHttpConnectionsPerHost()); 
    9293    taggedVal("httpConnections", s.getHttpConnections()); 
     94 
     95    taggedVal("maxPublicDescriptionLength", s.getMaxPublicDescriptionLength()); 
     96    taggedVal("maxUserDescriptionLength", s.getMaxUserDescriptionLength()); 
     97    taggedVal("maxUserEntitySize", s.getMaxUserEntitySize()); 
     98    taggedVal("defaultUserQuota", s.getDefaultUserQuota()); 
    9399 
    94100    taggedVal("userauthClass", s.getUserauthClass()); 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/dumpling/DumpUserPrefs.java

    r50 r54  
    9494        taggedVal("sub-emailNotifications", sub.getEmailNotifications()); 
    9595        taggedVal("sub-calendarDeleted", sub.getCalendarDeleted()); 
     96        taggedVal("sub-unremoveable=", sub.getUnremoveable()); 
    9697 
    9798        tagEnd("subscription"); 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/dumpling/DumpUsers.java

    r50 r54  
    6767 
    6868    principalTags(u); 
     69    taggedVal("instanceOwner", u.getInstanceOwner()); 
     70    taggedVal("quota", u.getQuota()); 
    6971 
    7072    tagEnd(objectUser); 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/Restore.java

    r50 r54  
    334334        i++; 
    335335        globals.syspars.setUserOutbox(args[i]); 
     336      } else if (argpar("-defuview", args, i)) { 
     337        i++; 
     338        globals.syspars.setDefaultUserViewName(args[i]); 
    336339 
    337340      } else if (argpar("-pu", args, i)) { 
     
    352355        i++; 
    353356        globals.syspars.setHttpConnections(intPar(args[i])); 
     357 
     358      } else if (argpar("-defuquota", args, i)) { 
     359        i++; 
     360        globals.syspars.setDefaultUserQuota(longPar(args[i])); 
    354361 
    355362      } else if (argpar("-userauthClass", args, i)) { 
     
    377384  private int intPar(String par) throws Throwable { 
    378385    return Integer.parseInt(par); 
     386  } 
     387 
     388  private long longPar(String par) throws Throwable { 
     389    return Long.parseLong(par); 
    379390  } 
    380391 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/RestoreGlobals.java

    r50 r54  
    116116  public BwSystem syspars = new BwSystem(); 
    117117 
    118   /** * / 
    119   public String publicCalendarRoot; 
    120   /** * / 
    121   public String userCalendarRoot; 
    122   /** * / 
    123   public String userDefaultCalendar; 
    124   /** * / 
    125   public String defaultTrashCalendar; 
    126  
    127   /** Account name for owner of public entities* / 
    128   public String publicUserAccount; 
    129  
    130   /** * / 
    131   public String systemId; // required for fixing guids 
    132  
    133   */ 
    134  
    135118  /* Used when processing timezones */ 
    136119  private CalTimezones tzcache; 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/CalendarRule.java

    r50 r54  
    8080        globals.rintf.restoreCalendar(entity); 
    8181      } 
     82      globals.calendarsTbl.put(new Integer(entity.getId()), entity); 
    8283    } catch (Throwable t) { 
    8384      throw new Exception(t); 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/SysparsFieldRule.java

    r50 r54  
    9191    } else if (name.equals("userOutbox")) { 
    9292      ent.setUserOutbox(stringFld()); 
     93    } else if (name.equals("defaultUserViewName")) { 
     94      ent.setDefaultUserViewName(stringFld()); 
    9395 
    9496    } else if (name.equals("publicUser")) { 
     
    105107      ent.setHttpConnections(intFld()); 
    106108 
     109    } else if (name.equals("maxPublicDescriptionLength")) { 
     110      ent.setMaxPublicDescriptionLength(intFld()); 
     111    } else if (name.equals("maxUserDescriptionLength")) { 
     112      ent.setMaxUserDescriptionLength(intFld()); 
     113    } else if (name.equals("maxUserEntitySize")) { 
     114      ent.setMaxUserEntitySize(intFld()); 
     115    } else if (name.equals("defaultUserQuota")) { 
     116      ent.setDefaultUserQuota(longFld()); 
     117 
    107118    } else if (name.equals("userauthClass")) { 
    108119      ent.setUserauthClass(stringFld()); 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/UserFieldRule.java

    r50 r54  
    7373    } 
    7474 
    75     if (name.equals("calendarid")) {      // 2.3.2 
     75    if (name.equals("instanceOwner")) { 
     76      u.setInstanceOwner(booleanFld()); 
     77    } else if (name.equals("quota")) { 
     78        u.setQuota(longFld()); 
     79    } else if (name.equals("calendarid")) {      // 2.3.2 
    7680      // Fix it later 
    7781      globals.subscriptionsTbl.put(u, intFld()); 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/UserPrefsFieldRule.java

    r50 r54  
    127127    } else if (name.equals("sub-calendarDeleted")) { 
    128128      globals.curSub.setCalendarDeleted(booleanFld()); 
     129    } else if (name.equals("sub-unremoveable")) { 
     130      globals.curSub.setUnremoveable(booleanFld()); 
    129131 
    130132    // view fields 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/UserRule.java

    r49 r54  
    7878      entity.setLocationAccess(globals.getDefaultPersonalAccess()); 
    7979      entity.setSponsorAccess(globals.getDefaultPersonalAccess()); 
     80      entity.setQuota(globals.syspars.getDefaultUserQuota()); 
    8081    } 
    8182