Changeset 445

Show
Ignore:
Timestamp:
05/04/06 09:34:48
Author:
douglm
Message:

I've been holding off a number of schema changes so they could be grouped together.
The latest changes to the calendar source require the changes shown below.

Developers can either add/rename them for preexisting databases,
or just start again with the quickstart data which will appear on the web site later today.

For those running version 3.0 the dump/restore process will make all necessary changes to your production data.
The following is for reference and for those who want to patch any development data.


Changes are:
Rename some columns because they're reserved names in oracle -

access to bwaccess
link to bwlink
sequence to rfcsequence in events and eventannotations
sequence to bwsequence in the rest

name was renamed to various different names.

BwCalendar?:
Added column caltype - allows us to distinguish special calendars, Trash, etc.

Add Deleted calendar name and busy calendar name to sysprefs

Add user mode (column="bwuser_mode") to user prefs

Add an 'ignoreTransparency' column="ignore_transparency" flag in subscription -
allows us to subscribe to a calendar and have all events affect freebusy whatever the transparency setting

Related changes:
Change to CalIntf? - now we specify allCalendars if we want to retrieve from 'special' calendars.

No longer need to auto-subscribe a user. We create a single subscription to the user root.
Any calendars created will automatically appear in the view.
More advanced users will probably want to manage their own suscriptions in some way.

In addition some significant changes were made to the way access is evaluated and stored.
The access code will continue to recognize the old encoded fom while making any changes in a
slightly modified form. These changes correct handling of multiple aces for the same principal and inheritence.


hsql changes to the db mainly for reference:

alter table ADMINGROUPS alter column name rename to account

alter table ALARMS alter column sequence rename to bwsequence;

alter table ATTENDEES alter column sequence rename to bwsequence

alter table BEDEWORK_SETTINGS add column deletedCalendar longvarchar
alter table BEDEWORK_SETTINGS add column busyCalendar longvarchar
update BEDEWORK_SETTINGS set deletedCalendar='Deleted'
update BEDEWORK_SETTINGS set busyCalendar='Busy'
alter table BEDEWORK_SETTINGS alter column name rename to bwname

alter table CALENDARS alter column access rename to bwaccess
alter table CALENDARS add column caltype integer
update CALENDARS set caltype=0
update CALENDARS set caltype=1 where CALENDAR_COLLECTION='T'
update CALENDARS set caltype=2 where NAME='Trash'
update CALENDARS set caltype=3 where NAME='Deleted'
update CALENDARS set caltype=5 where NAME='Inbox'
update CALENDARS set caltype=6 where NAME='Outbox'
alter table CALENDARS alter column name rename to calname

alter table CATEGORIES alter column access rename to bwaccess

alter table EVENTANNOTATIONS alter column access rename to bwaccess
alter table EVENTANNOTATIONS alter column link rename to bwlink
alter table EVENTANNOTATIONS alter column sequence rename to rfcsequence

alter table EVENTS alter column access rename to bwaccess
alter table EVENTS alter column link rename to bwlink
alter table EVENTS alter column sequence rename to rfcsequence

alter table FILTERs alter column name rename to filtername

alter table LOCATIONS alter column access rename to bwaccess
alter table LOCATIONS alter column link rename to bwlink

alter table PREFERENCES add column bwuser_mode integer
update PREFERENCES set bwuser_mode=0

alter table PROPERTIES alter column name rename to propname
alter table PROPERTIES rename to bwuser_properties

alter table SPONSORS alter column access rename to bwaccess
alter table SPONSORS alter column link rename to bwlink
alter table SPONSORS alter column name rename to sponsorname

alter table SUBSCRIPTIONS add column ignore_transparency char(1)
update SUBSCRIPTIONS set ignore_transparency='F'
alter table SUBSCRIPTIONS alter column name rename to subscrname

alter table VIEWS alter column name rename to viewname

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Ace.java

    r415 r445  
    5555 
    5656import java.io.Serializable; 
     57import java.util.ArrayList; 
    5758import java.util.Collection; 
    5859import java.util.Iterator; 
    59 import java.util.Vector; 
    6060 
    6161/** Oject to represent an ace for a calendar entity or service. 
     
    8989 *  @author Mike Douglass   douglm@rpi.edu 
    9090 */ 
    91 public class Ace implements Serializable, Comparable { 
     91public class Ace implements PrivilegeDefs, Serializable, Comparable { 
    9292  boolean debug; 
    9393 
     
    315315  public Collection getPrivs() { 
    316316    if (privs == null) { 
    317       privs = new Vector(); 
     317      privs = new ArrayList(); 
    318318    } 
    319319    return privs; 
     
    343343  } 
    344344 
    345   /** Return an ace which matches the name and whoType. 
     345  /** Return the merged privileges for all aces which match the name and whoType. 
    346346   * 
    347347   * @param acl 
    348348   * @param name 
    349349   * @param whoType 
    350    * @return Ace  if we find a match else null 
     350   * @return char[]    merged privileges if we find a match else null 
    351351   * @throws AccessException 
    352352   */ 
    353   public static Ace find(Acl acl, 
    354                          String name, int whoType) throws AccessException { 
     353  public static char[] findMergedPrivilege(Acl acl, 
     354                                           String name, int whoType) throws AccessException { 
     355    char[] privileges = null; 
    355356    Iterator it = acl.getAces().iterator(); 
    356357 
     
    362363           (whoType == whoTypeOwner) || 
    363364            ace.whoMatch(name))) { 
    364         return ace; 
     365        privileges = mergePrivileges(privileges, ace.getHow(), 
     366                                     ace.getInherited()); 
    365367      } 
    366368    } 
    367369 
    368     return null; 
     370    return privileges; 
     371  } 
     372 
     373  /** If current is null it is set to a cloned copy of morePriv otherwise the 
     374   * privilege(s) in morePriv are merged into current. 
     375   * 
     376   * <p>Specified access overrides inherited access,<br/> 
     377   * allowed overrides denied overrides unspecified so the order is, from 
     378   * highest to lowest:<br/> 
     379   * 
     380   * allowed, denied, allowedInherited, deniedInherited, unspecified. 
     381   * 
     382   * <p>Only allowed and denied appear in encoded aces. 
     383   * 
     384   * @param current 
     385   * @param morePriv 
     386   * @param inherited   true if the ace was an inherited ace 
     387   * @return char[]  mergedPrivileges 
     388   */ 
     389  public static char[] mergePrivileges(char[] current, char[] morePriv, 
     390                                       boolean inherited) { 
     391    char[] mp = (char[])morePriv.clone(); 
     392 
     393    if (inherited) { 
     394      for (int i = 0; i <= privMaxType; i++) { 
     395        char p = mp[i]; 
     396        if (p == allowed) { 
     397          mp[i] = allowedInherited; 
     398        } else if (p == denied) { 
     399          mp[i] = deniedInherited; 
     400        } 
     401      } 
     402    } 
     403    if (current == null) { 
     404      return mp; 
     405    } 
     406 
     407    for (int i = 0; i <= privMaxType; i++) { 
     408      if (current[i] < mp[i]) { 
     409        current[i] = mp[i]; 
     410      } 
     411    } 
     412 
     413    return current; 
    369414  } 
    370415 
     
    662707        } 
    663708      } 
    664       /* 
    665     if (c == whoFlagOwner) { 
    666       whoType = whoTypeOwner; 
    667     } else if (c == whoFlagUser) { 
    668       whoType = whoTypeUser; 
    669     } else if (c == whoFlagGroup) { 
    670       whoType = whoTypeGroup; 
    671     } else if (c == whoFlagHost) { 
    672       whoType = whoTypeHost; 
    673     } else if (c == whoFlagOther) { 
    674       whoType = whoTypeOther; 
    675     } else if (c == whoFlagUnauthenticated) { 
    676       whoType = whoTypeUnauthenticated; 
    677     } else if (c == whoFlagUnauthenticated) { 
    678       whoType = whoTypeUnauthenticated; 
    679     } else { 
    680       */ 
     709 
    681710      throw AccessException.badACE("who type"); 
    682711    } 
  • trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Acl.java

    r336 r445  
    8888 
    8989  /** Used while evaluating access */ 
    90 //  private Ace ace = new Ace(); 
    9190 
    9291  /** Constructor 
     
    119118    aces = null; 
    120119  } 
    121    
     120 
    122121  /** Result of evaluating access to an object for a principal 
    123122   */ 
    124123  public static class CurrentAccess { 
    125     /** The Acl used to evaluate the access. We should not necessarily  
     124    /** The Acl used to evaluate the access. We should not necessarily 
    126125     * make this available to the client. 
    127126     */ 
    128127    public Acl acl; 
    129      
    130     /**  Allowed access for each privilege type  
     128 
     129    /**  Allowed access for each privilege type 
    131130     * @see PrivilegeDefs 
    132131     */ 
     
    138137    /** Was it succesful */ 
    139138    public boolean accessAllowed; 
    140      
     139 
    141140    public String toString() { 
    142141      StringBuffer sb = new StringBuffer("CurrentAccess{"); 
    143142      sb.append("acl="); 
    144143      sb.append(acl); 
    145        
     144 
    146145      sb.append("accessAllowed="); 
    147146      sb.append(accessAllowed); 
     
    166165   * <li>If the principal is the owner then use the given access or the default.</li> 
    167166   * 
    168    * <li>If there is a specific ACE for the user use that. </li> 
     167   * <li>If there are specific ACEs for the user use the merged access. </li> 
    169168   * 
    170169   * <li>Find all group entries for the given user's groups. If there is more than 
     
    196195    ca.acl = this; 
    197196 
    198     /* 
    199     setEncoded(acl); 
     197    decode(acl); 
    200198 
    201199    if (authenticated) { 
     
    216214    getPrivileges: { 
    217215      if (!authenticated) { 
    218         if (ace.decode(this, false, null, Ace.whoTypeUnauthenticated)) { 
    219           ca.privileges = ace.getHow(); 
    220         } 
     216        ca.privileges = Ace.findMergedPrivilege(this, null, Ace.whoTypeUnauthenticated); 
    221217 
    222218        break getPrivileges; 
     
    224220 
    225221      if (isOwner) { 
    226         if (ace.decode(this, false, null, Ace.whoTypeOwner)) { 
    227           ca.privileges = ace.getHow(); 
    228         } else { 
     222        ca.privileges = Ace.findMergedPrivilege(this, null, Ace.whoTypeOwner); 
     223        if (ca.privileges == null) { 
    229224          ca.privileges = defaultOwnerPrivileges; 
    230225        } 
     
    234229 
    235230      // Not owner - look for user 
    236       if (ace.decode(this, false, who.getAccount(), Ace.whoTypeUser)) { 
    237         ca.privileges = ace.getHow(); 
     231      ca.privileges = Ace.findMergedPrivilege(this, who.getAccount(), Ace.whoTypeUser); 
     232      if (ca.privileges != null) { 
    238233        if (debug) { 
    239234          debugsb.append("... For user got: " + new String(ca.privileges)); 
     
    253248            debugsb.append("...Try access for group " + group); 
    254249          } 
    255           if (ace.decode(this, false, group, Ace.whoTypeGroup)) { 
    256             ca.privileges = mergePrivileges(ca.privileges, ace.getHow()); 
     250          char[] privs = Ace.findMergedPrivilege(this, group, Ace.whoTypeGroup); 
     251          if (privs != null) { 
     252            ca.privileges = Ace.mergePrivileges(ca.privileges, privs, false); 
    257253          } 
    258254        } 
     
    268264 
    269265      // "other" access set? 
    270       if (ace.decode(this, false, null, Ace.whoTypeOther)) { 
    271         ca.privileges = ace.getHow(); 
    272  
    273         if (debug) { 
    274           debugsb.append("...For other got: " + new String(ca.privileges)); 
    275         } 
    276  
    277         break getPrivileges; 
    278       } 
    279     } // getPrivileges 
    280     */ 
    281     decode(acl); 
    282  
    283     if (authenticated) { 
    284       isOwner = who.getAccount().equals(owner); 
    285     } 
    286  
    287     StringBuffer debugsb = null; 
    288  
    289     if (debug) { 
    290       debugsb = new StringBuffer("Check access for '"); 
    291       debugsb.append(new String(acl)); 
    292       debugsb.append("' with authenticated = "); 
    293       debugsb.append(authenticated); 
    294       debugsb.append(" isOwner = "); 
    295       debugsb.append(isOwner); 
    296     } 
    297  
    298     Ace ace; 
    299      
    300     getPrivileges: { 
    301       if (!authenticated) { 
    302         ace = Ace.find(this, null, Ace.whoTypeUnauthenticated); 
    303         if (ace != null) { 
    304           ca.privileges = ace.getHow(); 
    305         } 
    306  
    307         break getPrivileges; 
    308       } 
    309  
    310       if (isOwner) { 
    311         ace = Ace.find(this, null, Ace.whoTypeOwner); 
    312         if (ace != null) { 
    313           ca.privileges = ace.getHow(); 
    314         } else { 
    315           ca.privileges = defaultOwnerPrivileges; 
    316         } 
    317  
    318         break getPrivileges; 
    319       } 
    320  
    321       // Not owner - look for user 
    322       ace = Ace.find(this, who.getAccount(), Ace.whoTypeUser); 
    323       if (ace != null) { 
    324         ca.privileges = ace.getHow(); 
    325         if (debug) { 
    326           debugsb.append("... For user got: " + new String(ca.privileges)); 
    327         } 
    328  
    329         break getPrivileges; 
    330       } 
    331  
    332       // No specific user access - look for group access 
    333  
    334       if (who.getGroupNames() != null) { 
    335         Iterator it = who.getGroupNames().iterator(); 
    336  
    337         while (it.hasNext()) { 
    338           String group = (String)it.next(); 
    339           if (debug) { 
    340             debugsb.append("...Try access for group " + group); 
    341           } 
    342           ace = Ace.find(this, group, Ace.whoTypeGroup); 
    343           if (ace != null) { 
    344             ca.privileges = mergePrivileges(ca.privileges, ace.getHow()); 
    345           } 
    346         } 
    347       } 
    348  
     266      ca.privileges = Ace.findMergedPrivilege(this, null, Ace.whoTypeOther); 
    349267      if (ca.privileges != null) { 
    350         if (debug) { 
    351           debugsb.append("...For groups got: " + new String(ca.privileges)); 
    352         } 
    353  
    354         break getPrivileges; 
    355       } 
    356  
    357       // "other" access set? 
    358       ace = Ace.find(this, null, Ace.whoTypeOther); 
    359       if (ace != null) { 
    360         ca.privileges = ace.getHow(); 
    361  
    362268        if (debug) { 
    363269          debugsb.append("...For other got: " + new String(ca.privileges)); 
     
    385291      } 
    386292    } 
    387      
     293 
    388294    for (int i = 0; i < how.length; i++) { 
    389295      char priv = ca.privileges[how[i].getIndex()]; 
    390296 
    391       if (priv != allowed) { 
     297      if ((priv != allowed) && (priv != allowedInherited)) { 
    392298        if (debug) { 
    393299          debugMsg(debugsb.toString() + "...Check access denied (!allowed)"); 
     
    403309    ca.accessAllowed = true; 
    404310    return ca; 
    405   } 
    406  
    407   private char[] mergePrivileges(char[] current, char[] morePriv) { 
    408     if (current == null) { 
    409       return morePriv; 
    410     } 
    411  
    412     for (int i = 0; i <= privMaxType; i++) { 
    413       if (current[i] < morePriv[i]) { 
    414         current[i] = morePriv[i]; 
    415       } 
    416     } 
    417  
    418     return current; 
    419311  } 
    420312 
  • trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Privilege.java

    r331 r445  
    222222 
    223223    /* Expect the privilege allowed/denied flag 
     224     * (or the oldDenied or oldAllowed flag) 
    224225     */ 
    225     if (c == denied) { 
     226    if ((c == denied) || (c == oldDenied)) { 
    226227      denial = true; 
    227     } else if (c == allowed) { 
     228    } else if ((c == allowed) || (c == oldAllowed)) { 
    228229      denial = false; 
    229230    } else { 
  • trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/PrivilegeDefs.java

    r415 r445  
    6161 */ 
    6262public interface PrivilegeDefs extends Serializable { 
     63  /* old allowed and old denied allow us to respecify the flags allowing for 
     64   * inherited access 
     65   */ 
     66  /** Old allowed flag - appears in old acls being converted to new form 
     67   */ 
     68  public static final char oldAllowed = '3'; 
     69 
     70  /** Old denied privilege. 
     71   */ 
     72  public static final char oldDenied = '2'; 
     73 
     74  /* The following flags must sort with values in the order: 
     75   * allowed, denied, allowedInherited, deniedInherited, unspecified. 
     76   */ 
     77 
     78  /** Allowed flag - appears in acls 
     79   */ 
     80  public static final char allowed = 'y'; 
     81 
    6382  /** A denied privilege is a privilege, e.g. read which is denied to the 
    64      associated 'who'. The following must have the order:<br/> 
    65        unspecified - denied - allowed<br/> 
    66      from least to most. 
    67    */ 
    68   public static final char allowed = '3'; 
    69  
    70   /** Denied access 
    71    */ 
    72   public static final char denied = '2'; 
     83     associated 'who' - appears in ace. 
     84   */ 
     85  public static final char denied = 'n'; 
    7386 
    7487  /** This only appears in the final result from Privileges.fromEncoding 
    7588   */ 
    76   public static final char unspecified = '1'; 
    77  
    78   /** Shows an ace was inherited 
     89  public static final char allowedInherited = 'Y'; 
     90 
     91  /** This only appears in the final result from Privileges.fromEncoding 
     92   */ 
     93  public static final char deniedInherited = 'N'; 
     94 
     95  /** This only appears in the final result from Privileges.fromEncoding 
     96   */ 
     97  public static final char unspecified = '?'; 
     98 
     99  /** Shows an ace was inherited - appears in ace 
    79100   */ 
    80101  public static final char inheritedFlag = 'I'; 
  • trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Privileges.java

    r376 r445  
    5454package edu.rpi.cct.uwcal.access; 
    5555 
     56import java.util.ArrayList; 
    5657import java.util.Collection; 
    5758import java.util.Iterator; 
    58 import java.util.Vector; 
    5959 
    6060/** Define the privileges we recognize for the calendar. 
     
    254254   */ 
    255255  public static Collection getPrivs(EncodedAcl acl) throws AccessException { 
    256     Vector v = new Vector(); 
     256    ArrayList al = new ArrayList(); 
    257257 
    258258    while (acl.hasMore()) { 
     
    268268      } 
    269269 
    270       v.add(p); 
    271     } 
    272  
    273     return v
     270      al.add(p); 
     271    } 
     272 
     273    return al
    274274  } 
    275275 
  • trunk/calendar3/appcommon/src/org/bedework/appcommon/AccessAppUtil.java

    r415 r445  
    233233 
    234234      for (int pi = 0; pi < privileges.length; pi++) { 
    235         if (privileges[pi] == PrivilegeDefs.allowed) { 
     235        if ((privileges[pi] == PrivilegeDefs.allowed) || 
     236            (privileges[pi] == PrivilegeDefs.allowedInherited)) { 
    236237          // XXX further work - don't emit abstract privs or contained privs. 
    237238          QName pr = privTags[pi]; 
  • trunk/calendar3/calCore/resources/hbms/AdminGroup.hbm.xml

    r309 r445  
    1717    <version name="seq" column="seq" type="integer" /> 
    1818 
    19     <property name="account" column="name" type="text"/> 
     19    <property name="account" column="account" type="text"/> 
    2020 
    2121    <!-- 
  • trunk/calendar3/calCore/resources/hbms/Alarm.hbm.xml

    r235 r445  
    5858    </discriminator> 
    5959 
    60     <version name="seq" column="sequence" type="integer" /> 
     60    <version name="seq" column="bwsequence" type="integer" /> 
    6161 
    6262    <property name="alarmType" column="alarm_type" type="integer" /> 
  • trunk/calendar3/calCore/resources/hbms/Attendee.hbm.xml

    r2 r445  
    1515    </id> 
    1616 
    17     <version name="seq" column="sequence" type="integer" /> 
     17    <version name="seq" column="bwsequence" type="integer" /> 
    1818 
    1919    <property name="cn" type="text"/> 
  • trunk/calendar3/calCore/resources/hbms/Calendar.hbm.xml

    r436 r445  
    3131    </many-to-one> 
    3232 
    33     <property name="access" column="access" type="text" /> 
     33    <property name="access" column="bwaccess" type="text" /> 
    3434 
    3535    <property name="publick" type="true_false" > 
     
    3737    </property> 
    3838 
    39     <property name="name" column="name" type="text" not-null="true"/> 
     39    <property name="name" column="calname" type="text" not-null="true"/> 
    4040 
    4141    <!-- I wanted to specify unique="true" on this but mysql complains. 
     
    5757 
    5858    <set name="children" inverse="true" cascade="all-delete-orphan" 
    59          order-by="name" > 
     59         order-by="calname" > 
    6060      <cache usage="read-write"/> 
    6161      <key column="parent" /> 
    6262      <one-to-many class="org.bedework.calfacade.BwCalendar" /> 
    6363    </set> 
     64 
     65    <property name="calType" column="caltype" type="integer" not-null="true"/> 
    6466  </class> 
    6567 
  • trunk/calendar3/calCore/resources/hbms/Category.hbm.xml

    r176 r445  
    3232    </many-to-one> 
    3333 
    34     <property name="access" column="access" type="text" /> 
     34    <property name="access" column="bwaccess" type="text" /> 
    3535 
    3636    <property name="publick" type="true_false" > 
  • trunk/calendar3/calCore/resources/hbms/Event.hbm.xml

    r246 r445  
    2929    </many-to-one> 
    3030 
    31     <property name="access" column="access" type="text" /> 
     31    <property name="access" column="bwaccess" type="text" /> 
    3232 
    3333    <property name="publick" type="true_false" > 
     
    7373    <property name="description" column="description" type="text"/> 
    7474 
    75     <property name="link" column="link" type="string" /> 
     75    <property name="link" column="bwlink" type="string" /> 
    7676 
    7777    <property name="status" type="string" /> 
     
    122122    <property name="guid" type="string" length="500" unique-key="event-key" /> 
    123123 
    124     <property name="sequence" type="integer" /> 
     124    <property name="sequence" column="rfcsequence" type="integer" /> 
    125125 
    126126    <property name="transparency" column="transparency" type="text"/> 
  • trunk/calendar3/calCore/resources/hbms/EventAnnotation.hbm.xml

    r441 r445  
    3535    </many-to-one> 
    3636 
    37     <property name="access" column="access" type="text" /> 
     37    <property name="access" column="bwaccess" type="text" /> 
    3838 
    3939    <property name="publick" type="true_false" > 
     
    7878    <property name="description" column="description" type="text"/> 
    7979 
    80     <property name="link" column="link" type="string" /> 
     80    <property name="link" column="bwlink" type="string" /> 
    8181 
    8282    <property name="status" type="string" /> 
     
    123123    <property name="guid" type="string" length="500" unique-key="eventann-key" /> 
    124124 
    125     <property name="sequence" type="integer" /> 
     125    <property name="sequence" column="rfcsequence" type="integer" /> 
    126126 
    127127    <property name="transparency" column="transparency" type="text"/> 
  • trunk/calendar3/calCore/resources/hbms/Filter.hbm.xml

    r2 r445  
    3636 
    3737    <property name="name" type="string" > 
    38       <column name="name" length="200" /> 
     38      <column name="filtername" length="200" /> 
    3939    </property> 
    4040 
     
    110110        discriminator-value="A" > 
    111111      <set name="children" inverse="true" cascade="all-delete-orphan" 
    112            order-by="name"  > 
     112           order-by="filtername"  > 
    113113        <key column="parent" /> 
    114114        <one-to-many class="org.bedework.calfacade.filter.BwFilter" /> 
     
    119119        discriminator-value="O" > 
    120120      <set name="children" inverse="true" cascade="all-delete-orphan" 
    121            order-by="name" > 
     121           order-by="filtername" > 
    122122        <key column="parent" /> 
    123123        <one-to-many class="org.bedework.calfacade.filter.BwFilter" /> 
     
    192192        discriminator-value="A" > 
    193193      <set name="children" inverse="true" cascade="all-delete-orphan" 
    194            order-by="name"  > 
     194           order-by="filtername"  > 
    195195        <key column="parent" /> 
    196196        <one-to-many class="org.bedework.calfacade.filter.BwFilter" /> 
     
    201201        discriminator-value="O" > 
    202202      <set name="children" inverse="true" cascade="all-delete-orphan" 
    203            order-by="name" > 
     203           order-by="filtername" > 
    204204        <key column="parent" /> 
    205205        <one-to-many class="org.bedework.calfacade.filter.BwFilter" /> 
  • trunk/calendar3/calCore/resources/hbms/Location.hbm.xml

    r176 r445  
    3232    </many-to-one> 
    3333 
    34     <property name="access" column="access" type="text" /> 
     34    <property name="access" column="bwaccess" type="text" /> 
    3535 
    3636    <property name="publick" type="true_false" > 
     
    4242    </property> 
    4343    <property name="subaddress" column="subaddress" type="string"/> 
    44     <property name="link" column="link" type="string"/> 
     44    <property name="link" column="bwlink" type="string"/> 
    4545  </class> 
    4646 
  • trunk/calendar3/calCore/resources/hbms/Preferences.hbm.xml

    r86 r445  
    5555    <property name="workdayEnd" column="workday_end" type="integer" /> 
    5656    <property name="preferredEndType" column="preferred_endtype" type="string" /> 
     57 
     58    <property name="userMode" column="bwuser_mode" type="integer" /> 
    5759  </class> 
    5860 
  • trunk/calendar3/calCore/resources/hbms/Sponsor.hbm.xml

    r176 r445  
    3232    </many-to-one> 
    3333 
    34     <property name="access" column="access" type="text" /> 
     34    <property name="access" column="bwaccess" type="text" /> 
    3535 
    3636    <property name="publick" type="true_false" > 
     
    3939 
    4040    <property name="name" type="string" > 
    41       <column name="name" not-null="true" unique-key="sponsor_key" /> 
     41      <column name="sponsorname" not-null="true" unique-key="sponsor_key" /> 
    4242    </property> 
    4343    <property name="phone" column="phone" type="string"/> 
    4444    <property name="email" column="email" type="string"/> 
    45     <property name="link" column="link" type="string"/> 
     45    <property name="link" column="bwlink" type="string"/> 
    4646  </class> 
    4747 
  • trunk/calendar3/calCore/resources/hbms/Subscription.hbm.xml

    r54 r445  
    1818    <version name="seq" column="seq" type="integer" /> 
    1919 
    20     <property name="name" column="name" type="text" not-null="true"/> 
     20    <property name="name" column="subscrname" type="text" not-null="true"/> 
    2121 
    2222    <many-to-one name="owner" 
     
    2929    <property name="affectsFreeBusy" type="true_false" 
    3030              column="affects_free_busy" not-null="true" /> 
     31 
     32    <property name="ignoreTransparency" type="true_false" 
     33              column="ignore_transparency" not-null="true" /> 
    3134 
    3235    <property name="display" type="true_false" 
  • trunk/calendar3/calCore/resources/hbms/System.hbm.xml

    r64 r445  
    1818    <version name="seq" column="seq" type="integer" /> 
    1919 
    20     <property name="name" column="name" type="text" /> 
     20    <property name="name" column="bwname" type="text" /> 
    2121    <property name="tzid" column="tzid" type="text" /> 
    2222    <property name="systemid" column="systemid" type="text" /> 
     
    2727    <property name="userInbox" column="userInbox" type="text" /> 
    2828    <property name="userOutbox" column="userOutbox" type="text" /> 
     29    <property name="deletedCalendar" column="deletedCalendar" type="text" /> 
     30    <property name="busyCalendar" column="busyCalendar" type="text" /> 
    2931    <property name="defaultUserViewName" column="defaultUserViewName" type="text" /> 
    3032 
  • trunk/calendar3/calCore/resources/hbms/UserInfo.hbm.xml

    r2 r445  
    3232    <property name="dept" column="department" type="string"/> 
    3333 
    34     <set name="properties" order-by="name asc"> 
     34    <set name="properties" 
     35         table="bwuser_properties" order-by="name asc"> 
    3536      <key column="user_info" /> 
    3637      <composite-element class="org.bedework.calfacade.BwUserInfo$UserProperty"> 
    37         <property name="name" column="name" not-null="true"/> 
     38        <property name="name" column="propname" not-null="true"/> 
    3839        <property name="val" column="val" /> 
    3940      </composite-element> 
  • trunk/calendar3/calCore/resources/hbms/View.hbm.xml

    r2 r445  
    1717    <version name="seq" column="seq" type="integer" /> 
    1818 
    19     <property name="name" column="name" type="text" not-null="true"/> 
     19    <property name="name" column="viewname" type="text" not-null="true"/> 
    2020 
    2121    <many-to-one name="owner" 
  • trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/AccessUtil.java

    r376 r445  
    231231    } 
    232232 
     233    // XXX 
     234    // XXX 
     235    // XXX 
     236    // XXX 
     237    /* We need to special case the access to the user root e.g /user and 
     238     * the 'home' directory, e.g. /user/douglm 
     239     * 
     240     * We deny access to /user to anybody without superuser access. This 
     241     * prevents user browsing. 
     242     * 
     243     * Default access to the home directory is read, write-content to the owner 
     244     * only and unlimited to superuser. 
     245     * 
     246     * Specific access should be no more than read, write-content to the home 
     247     * directory. 
     248     */ 
     249 
    233250    try { 
    234251      CurrentAccess ca; 
  • trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Calendars.java

    r436 r445  
    143143    cal.setCalendar(usercal); 
    144144    cal.setCalendarCollection(true); 
     145    cal.setCalType(BwCalendar.calTypeCollection); 
    145146    usercal.addChild(cal); 
    146147 
     
    154155    cal.setCalendar(usercal); 
    155156    cal.setCalendarCollection(true); 
     157    cal.setCalType(BwCalendar.calTypeTrash); 
    156158    usercal.addChild(cal); 
    157159 
     
    165167    cal.setCalendar(usercal); 
    166168    cal.setCalendarCollection(true); 
     169    cal.setCalType(BwCalendar.calTypeInbox); 
    167170    usercal.addChild(cal); 
    168171 
     
    176179    cal.setCalendar(usercal); 
    177180    cal.setCalendarCollection(true); 
     181    cal.setCalType(BwCalendar.calTypeOutbox); 
    178182    usercal.addChild(cal); 
    179183 
    180184    /* Add the deleted calendar */ 
    181185    cal = new BwCalendar(); 
    182     // XXX new syspar cal.setName(getSyspars().getUserOutbox()); 
    183     cal.setName("Deleted"); 
     186    cal.setName(getSyspars().getDeletedCalendar()); 
    184187    cal.setCreator(user); 
    185188    cal.setOwner(user); 
    186189    cal.setPublick(false); 
    187     // XXX new syspar cal.setPath(path + "/" + getSyspars().getUserOutbox()); 
    188     cal.setPath(path + "/" + "Deleted"); 
     190    cal.setPath(path + "/" + getSyspars().getDeletedCalendar()); 
    189191    cal.setCalendar(usercal); 
    190192    cal.setCalendarCollection(true); 
     193    cal.setCalType(BwCalendar.calTypeDeleted); 
     194    usercal.addChild(cal); 
     195 
     196    /* Add the busy calendar */ 
     197    cal = new BwCalendar(); 
     198    cal.setName(getSyspars().getBusyCalendar()); 
     199    cal.setCreator(user); 
     200    cal.setOwner(user); 
     201    cal.setPublick(false); 
     202    cal.setPath(path + "/" + getSyspars().getBusyCalendar()); 
     203    cal.setCalendar(usercal); 
     204    cal.setCalendarCollection(true); 
     205    cal.setCalType(BwCalendar.calTypeBusy); 
    191206    usercal.addChild(cal); 
    192207 
     
    380395 
    381396    BwCalendar cal = new BwCalendar(); 
    382     cal.setName("Deleted"); 
    383     cal.setOwner(user); 
    384     cal.setCreator(user); 
    385     cal.setCalendarCollection(true); 
     397    cal.setName(getSyspars().getDeletedCalendar()); 
     398    cal.setOwner(user); 
     399    cal.setCreator(user); 
     400    cal.setCalendarCollection(true); 
     401    cal.setCalType(BwCalendar.calTypeDeleted); 
    386402    addCalendar(cal, pathTo); 
    387403  } 
     
    424440    val.setCalendar(parent); 
    425441    val.setPublick(parent.getPublick()); 
     442    if (val.getCalendarCollection()) { 
     443      val.setCalType(BwCalendar.calTypeCollection); 
     444    } else { 
     445      val.setCalType(BwCalendar.calTypeFolder); 
     446    } 
    426447    parent.addChild(val); 
    427448 
     
    443464    /* Objects are probably clones - fetch the real ones. 
    444465     */ 
    445     parent = getCalendar(parent.getPath(), privRead); 
     466    parent = getCalendar(parent.getPath(), privRead, false); 
    446467    if (parent == null) { 
    447468      throw new CalFacadeException(CalFacadeException.cannotDeleteCalendarRoot); 
    448469    } 
    449470 
    450     val = getCalendar(val.getPath(), privUnbind); 
     471    val = getCalendar(val.getPath(), privUnbind, false); 
    451472    if (val == null) { 
    452473      throw new CalFacadeException(CalFacadeException.calendarNotFound); 
  • trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java

    r436 r445  
    10751075                              BwDateTime startDate, BwDateTime endDate, 
    10761076                              int recurRetrieval, 
    1077                               boolean freeBusy) throws CalFacadeException { 
     1077                              boolean freeBusy, 
     1078                              boolean allCalendars) throws CalFacadeException { 
    10781079    return events.getEvents(calendar, filter, 
    10791080                            startDate, endDate, recurRetrieval, 
    1080                             freeBusy); 
     1081                            freeBusy, allCalendars); 
    10811082  } 
    10821083 
  • trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java

    r441 r445  
    585585                              BwDateTime startDate, BwDateTime endDate, 
    586586                              int recurRetrieval, 
    587                               boolean freeBusy) throws CalFacadeException { 
     587                              boolean freeBusy, 
     588                              boolean allCalendars) throws CalFacadeException { 
    588589    HibSession sess = getSess(); 
    589590    StringBuffer sb = new StringBuffer(); 
     
    629630 
    630631    boolean setUser = doCalendarClause(sb, qevName, calendar, 
    631                                        currentMode, cal.getSuperUser()); 
     632                                       currentMode, cal.getSuperUser(), 
     633                                       allCalendars); 
    632634 
    633635    sb.append(") "); 
     
    662664    //} 
    663665 
    664     doCalendarEntities(setUser, calendar); 
     666    doCalendarEntities(setUser, calendar, allCalendars); 
    665667 
    666668    flt.parPass(sess); 
     
    689691    Collection rceis = getLimitedRecurrences(calendar, filter, startDate, endDate, 
    690692                                             currentMode, cal.getSuperUser(), 
    691                                              recurRetrieval, freeBusy); 
     693                                             recurRetrieval, freeBusy, 
     694                                             allCalendars); 
    692695    if (rceis != null) { 
    693696      ceis.addAll(rceis); 
     
    893896                                           int currentMode, boolean ignoreCreator, 
    894897                                           int recurRetrieval, 
    895                                            boolean freeBusy) 
     898                                           boolean freeBusy, 
     899                                           boolean allCalendars) 
    896900          throws CalFacadeException { 
    897901    HibSession sess = getSess(); 
     
    925929 
    926930    boolean setUser = doCalendarClause(sb, qevName + ".master", calendar, 
    927                                        currentMode, ignoreCreator); 
     931                                       currentMode, ignoreCreator, 
     932                                       allCalendars); 
    928933 
    929934    sb.append(") "); 
     
    949954    } 
    950955 
    951     doCalendarEntities(setUser, calendar); 
     956    doCalendarEntities(setUser, calendar, allCalendars); 
    952957 
    953958    flt.parPass(sess); 
     
    10021007   */ 
    10031008  private boolean doCalendarClause(StringBuffer sb, String qevName, BwCalendar calendar, 
    1004                                    int currentMode, boolean ignoreCreator) throws CalFacadeException { 
     1009                                   int currentMode, boolean ignoreCreator, 
     1010                                   boolean allCalendars) throws CalFacadeException { 
    10051011    /* if no calendar set 
    10061012          if public 
     
    10151021 
    10161022    if (calendar.getCalendarCollection()) { 
    1017       // Single leaf calendar 
     1023      // Single leaf calendar - always include 
    10181024      sb.append("("); 
    10191025      sb.append(qevName); 
     
    10251031    // Non leaf - build a query 
    10261032    sb.append("("); 
    1027     appendCalendarClause(sb, qevName, calendar, new CalTerm()); 
     1033    appendCalendarClause(sb, qevName, calendar, new CalTerm(), allCalendars); 
    10281034    sb.append(") "); 
    10291035 
     
    10321038 
    10331039  private void appendCalendarClause(StringBuffer sb, String qevName, BwCalendar calendar, 
    1034                                     CalTerm calTerm) throws CalFacadeException { 
     1040                                    CalTerm calTerm, 
     1041                                    boolean allCalendars) throws CalFacadeException { 
    10351042    if (calendar.getCalendarCollection()) { 
    1036       // leaf calendar 
    1037       if (calTerm.i > 1) { 
    1038         sb.append(" or "); 
    1039       } 
    1040       sb.append(qevName); 
    1041       sb.append(".calendar=:calendar" + calTerm.i); 
    1042       calTerm.i++; 
     1043      if (allCalendars || (calendar.getCalType() == BwCalendar.calTypeCollection)) { 
     1044        // leaf calendar 
     1045        if (calTerm.i > 1) { 
     1046          sb.append(" or "); 
     1047        } 
     1048        sb.append(qevName); 
     1049        sb.append(".calendar=:calendar" + calTerm.i); 
     1050        calTerm.i++; 
     1051      } 
    10431052    } else { 
    10441053      Iterator it = calendar.getChildren().iterator(); 
    10451054      while (it.hasNext()) { 
    1046         appendCalendarClause(sb, qevName, (BwCalendar)it.next(), calTerm); 
    1047       } 
    1048     } 
    1049   } 
    1050  
    1051   private void doCalendarEntities(boolean setUser, BwCalendar calendar) 
     1055        appendCalendarClause(sb, qevName, (BwCalendar)it.next(), calTerm, 
     1056                             allCalendars); 
     1057      } 
     1058    } 
     1059  } 
     1060 
     1061  private void doCalendarEntities(boolean setUser, BwCalendar calendar, 
     1062                                  boolean allCalendars) 
    10521063          throws CalFacadeException { 
    10531064    HibSession sess = getSess(); 
     
    10581069    if (calendar != null) { 
    10591070      if (calendar.getCalendarCollection()) { 
    1060         // Single leaf calendar 
     1071        // Single leaf calendar - always include 
    10611072        sess.setEntity("calendar", calendar); 
    10621073      } else { 
    10631074        // Non leaf - add entities 
    1064         setCalendarEntities(calendar, new CalTerm()); 
    1065       } 
    1066     } 
    1067   } 
    1068  
    1069   private void setCalendarEntities(BwCalendar calendar, CalTerm calTerm) 
     1075        setCalendarEntities(calendar, new CalTerm(), allCalendars); 
     1076      } 
     1077    } 
     1078  } 
     1079 
     1080  private void setCalendarEntities(BwCalendar calendar, CalTerm calTerm, 
     1081                                   boolean allCalendars) 
    10701082          throws CalFacadeException { 
    10711083    if (calendar.getCalendarCollection()) { 
    1072       // leaf calendar 
    1073       getSess().setEntity("calendar" + calTerm.i, calendar); 
    1074       calTerm.i++; 
     1084      if (allCalendars || (calendar.getCalType() == BwCalendar.calTypeCollection)) { 
     1085        // leaf calendar 
     1086        getSess().setEntity("calendar" + calTerm.i, calendar); 
     1087        calTerm.i++; 
     1088      } 
    10751089    } else { 
    10761090      Iterator it = calendar.getChildren().iterator(); 
    10771091      while (it.hasNext()) { 
    1078         setCalendarEntities((BwCalendar)it.next(), calTerm); 
     1092        setCalendarEntities((BwCalendar)it.next(), calTerm, allCalendars); 
    10791093      } 
    10801094    } 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/BwCalendar.java

    r415 r445  
    103103  private Collection children; 
    104104 
     105  /* The type of calendar */ 
     106  // ENUM 
     107  private int calType; 
     108 
     109  /** Normal folder */ 
     110  public final static int calTypeFolder = 0; 
     111 
     112  /** Normal calendar collection */ 
     113  public final static int calTypeCollection = 1; 
     114 
     115  /** Trash  */ 
     116  public final static int calTypeTrash = 2; 
     117 
     118  /** Deleted  */ 
     119  public final static int calTypeDeleted = 3; 
     120 
     121  /** Busy */ 
     122  public final static int calTypeBusy = 4; 
     123 
     124  /** Inbox  */ 
     125  public final static int calTypeInbox = 5; 
     126 
     127  /** Outbox  */ 
     128  public final static int calTypeOutbox = 6; 
     129 
    105130  /* This field must only be used for cloned copies of an entity as it is 
    106131   * specific to a current thread. 
     
    128153   * @param parent 
    129154   * @param children 
     155   * @param calType 
    130156   */ 
    131157  public BwCalendar(BwUser owner, 
     
    140166                    boolean calendarCollection, 
    141167                    BwCalendar parent, 
    142                     Collection children) { 
     168                    Collection children, 
     169                    int calType) { 
    143170    super(owner, publick, creator, access); 
    144171    this.name = name; 
     
    150177    setCalendar(parent); 
    151178    this.children = children; 
     179    this.calType = calType; 
    152180  } 
    153181 
     
    268296    } 
    269297    return children; 
     298  } 
     299 
     300  /** Set the type 
     301   * 
     302   * @param val    type 
     303   */ 
     304  public void setCalType(int val) { 
     305    calType = val; 
     306  } 
     307 
     308  /** Get the description 
     309   * 
     310   *  @return String   description 
     311   */ 
     312  public int getCalType() { 
     313    return calType; 
    270314  } 
    271315 
     
    382426                          getCalendarCollection(), 
    383427                          getCalendar(), 
    384                           null); 
     428                          null, 
     429                          getCalType()); 
    385430  } 
    386431 
     
    470515                          getCalendarCollection(), 
    471516                          getCalendar(), 
    472                           getChildren()); 
     517                          getChildren(), 
     518                          getCalType()); 
    473519  } 
    474520} 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/BwSystem.java

    r418 r445  
    8282  private String userInbox; 
    8383  private String userOutbox; 
     84  private String deletedCalendar; 
     85  private String busyCalendar; 
    8486  private String defaultUserViewName; 
    8587 
     
    215217  } 
    216218 
    217   /** Set the user inbox 
     219  /** Set the user inbox name 
    218220   * 
    219221   * @param val    String 
     
    223225  } 
    224226 
    225   /** Get the userCalendar 
     227  /** Get the user inbox name 
    226228   * 
    227229   * @return String   user inbox 
     
    245247  public String getUserOutbox() { 
    246248    return userOutbox; 
     249  } 
     250 
     251  /** Set the user deleted calendar name 
     252   * 
     253   * @param val    String 
     254   */ 
     255  public void setDeletedCalendar(String val) { 
     256    deletedCalendar = val; 
     257  } 
     258 
     259  /** Get the user deleted calendar name 
     260   * 
     261   * @return String   user deleted calendar name 
     262   */ 
     263  public String getDeletedCalendar() { 
     264    return deletedCalendar; 
     265  } 
     266 
     267  /** Set the user busy calendar name 
     268   * 
     269   * @param val    String 
     270   */ 
     271  public void setBusyCalendar(String val) { 
     272    busyCalendar = val; 
     273  } 
     274 
     275  /** Get the user busy calendar name 
     276   * 
     277   * @return String   user busy calendar name 
     278   */ 
     279  public String getBusyCalendar() { 
     280    return busyCalendar; 
    247281  } 
    248282 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/base/CalintfBase.java

    r436 r445  
    714714                              BwDateTime startDate, BwDateTime endDate, 
    715715                              int recurRetrieval, 
    716                               boolean freeBusy) throws CalFacadeException { 
     716                              boolean freeBusy, 
     717                              boolean allCalendars) throws CalFacadeException { 
    717718    throw new CalFacadeUnimplementedException(); 
    718719  } 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/EventsI.java

    r415 r445  
    130130   * @param freeBusy     Return skeleton events with date/times and skip 
    131131   *                     transparent events. 
     132   * @param allCalendars False - ignore any 'special' calendars. 
    132133   * @return Collection  of CoreEventInfo objects 
    133134   * @throws CalFacadeException 
     
    136137                              BwDateTime startDate, BwDateTime endDate, 
    137138                              int recurRetrieval, 
    138                               boolean freeBusy) throws CalFacadeException; 
     139                              boolean freeBusy, 
     140                              boolean allCalendars) throws CalFacadeException; 
    139141 
    140142  /** XXX temp I think 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/BwSubscription.java

    r253 r445  
    5858  private boolean affectsFreeBusy; 
    5959 
     60  /** Ignore the transparency setting? 
     61   */ 
     62  private boolean ignoreTransparency; 
     63 
    6064  /** Should this subscription be displayed by default? 
    6165   */ 
     
    145149  public boolean getAffectsFreeBusy() { 
    146150    return affectsFreeBusy; 
     151  } 
     152 
     153  /** Set the ignoreTransparency flag 
     154   * 
     155   *  @param val    true if the subscription takes part in free/busy calculations 
     156   */ 
     157  public void setIgnoreTransparency(boolean val) { 
     158    ignoreTransparency = val; 
     159  } 
     160 
     161  /** Do we ignore transparency? 
     162   * 
     163   *  @return boolean    true for ignoreTransparency 
     164   */ 
     165  public boolean getIgnoreTransparency() { 
     166    return ignoreTransparency; 
    147167  } 
    148168 
  • trunk/calendar3/caldavClientApi/src/org/bedework/caldav/client/CalintfCaldavImpl.java

    r436 r445  
    598598                              BwDateTime startDate, BwDateTime endDate, 
    599599                              int recurRetrieval, 
    600                               boolean freeBusy) throws CalFacadeException { 
     600                              boolean freeBusy, 
     601                              boolean allCalendars) throws CalFacadeException { 
    601602    throw new CalFacadeUnimplementedException(); 
    602603  } 
  • trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java

    r439 r445  
    10781078        BwEvent ev = ei.getEvent(); 
    10791079 
    1080         // XXX Need to add sub.ignoreTransparency 
    1081         if (BwEvent.transparencyTransparent.equals(ev.getTransparency())) { 
     1080        if (!sub.getIgnoreTransparency() && 
     1081            BwEvent.transparencyTransparent.equals(ev.getTransparency())) { 
     1082          // Ignore this one. 
    10821083          continue; 
    10831084        } 
     
    19021903    TreeSet ts = new TreeSet(); 
    19031904 
    1904 //    if (pars.getPublicAdmin() || (sub != null)) { 
    19051905    if (sub != null) { 
    1906       BwCalendar cal = null; 
    1907       if (sub != null) { 
    1908         cal = sub.getCalendar(); 
    1909       } 
    1910       return postProcess(getCal().getEvents(cal, filter, startDate, 
     1906      // Explicitly selected calendar - via a subscription. 
     1907 
     1908      return postProcess(getCal().getEvents(sub.getCalendar(), filter, startDate, 
    19111909                                            endDate, recurRetrieval, 
    1912                                             freeBusy), 
     1910                                            freeBusy, true), 
    19131911                         sub); 
    19141912    } 
    19151913 
    19161914    Collection subs = null; 
     1915 
     1916    /* Through a view or the complete set of subscriptions. Do not include 
     1917     * 'special' calendars. 
     1918     */ 
    19171919 
    19181920    if (currentView != null) { 
     
    19471949        return postProcess(getCal().getEvents(null, filter, startDate, 
    19481950                                              endDate, recurRetrieval, 
    1949                                               freeBusy), 
     1951                                              freeBusy, false), 
    19501952                           sub); 
    19511953      } 
     
    19881990    ts.addAll(postProcess(getCal().getEvents(internal, filter, 
    19891991                          startDate, endDate, 
    1990                           recurRetrieval, freeBusy), 
     1992                          recurRetrieval, freeBusy, false), 
    19911993              sublookup)); 
    19921994 
     
    22652267    prefs.setDefaultCalendar(cal); 
    22662268 
    2267     // Add default subscription for default calendar. 
    2268     BwSubscription defSub = BwSubscription.makeSubscription(cal, 
    2269                                           cal.getName(), true, true, false); 
     2269    BwCalendar userrootCal = cal.getCalendar(); 
     2270 
     2271    // Add default subscription to the user root. 
     2272    BwSubscription defSub = BwSubscription.makeSubscription(userrootCal, 
     2273                                                            userrootCal.getName(), 
     2274                                                            true, true, false); 
    22702275    defSub.setOwner(user); 
    22712276    setupOwnedEntity(defSub); 
    22722277 
    22732278    prefs.addSubscription(defSub); 
    2274  
    2275     // Add default subscription for trash calendar. 
    2276  
    2277     cal = cali.getTrashCalendar(user); 
    2278     BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), 
    2279                                                          false, false, false); 
    2280     sub.setOwner(user); 
    2281     setupOwnedEntity(sub); 
    2282  
    2283     prefs.addSubscription(sub); 
    22842279 
    22852280    // Add a default view for the default calendar subscription 
  • trunk/calendar3/webcommon/src/org/bedework/webcommon/calendars/UpdateCalendarAction.java

    r436 r445  
    5656 
    5757import org.bedework.calfacade.BwCalendar; 
    58 import org.bedework.calfacade.CalFacadeException; 
    59 import org.bedework.calfacade.svc.BwPreferences; 
    60 import org.bedework.calfacade.svc.BwSubscription; 
    6158import org.bedework.calsvci.CalSvcI; 
    6259import org.bedework.webcommon.BwAbstractAction; 
     
    133130        updateAuthPrefs(form, null, null, null, cal); 
    134131      } 
    135     } else if (svci.getUserPrefs().getUserMode() == BwPreferences.basicMode) { 
    136       // Auto subscribe. 
    137       // XXX name should be derived from path. 
    138       BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), 
    139                                                            true, true, false); 
    140       try { 
    141         svci.addSubscription(sub); 
    142       } catch (CalFacadeException cfe) { 
    143         if (CalFacadeException.duplicateSubscription.equals(cfe.getMessage())) { 
    144           form.getErr().emit(cfe.getMessage()); 
    145           return "success"; // User will see message and we'll stay on page 
    146         } 
    147  
    148         throw cfe; 
    149       } 
    150  
    151       // Add it to the default view 
    152       svci.addViewSubscription(null, sub); 
    153  
    154       form.setSubscriptions(svci.getSubscriptions()); 
    155132    } 
    156133