Changeset 321
- Timestamp:
- 04/03/06 14:27:37
- Files:
-
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java (modified) (3 diffs)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java (modified) (23 diffs)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Filters.java (modified) (3 diffs)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/CoreEventInfo.java (added)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/base/CalintfBase.java (modified) (2 diffs)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/EventsI.java (modified) (5 diffs)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/EventInfo.java (modified) (4 diffs)
- trunk/calendar3/caldavClientApi/src/org/bedework/caldav/client/CalintfCaldavImpl.java (modified) (2 diffs)
- trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java (modified) (5 diffs)
- trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java (modified) (1 diff)
- trunk/calendar3/webclient/war/docs/event/emitEventDetail.jsp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java
r314 r321 76 76 import org.bedework.calfacade.CalFacadeDefs; 77 77 import org.bedework.calfacade.CalFacadeException; 78 import org.bedework.calfacade.CoreEventInfo; 78 79 import org.bedework.calfacade.base.BwShareableDbentity; 79 80 import org.bedework.calfacade.filter.BwFilter; … … 1062 1063 } 1063 1064 1064 public BwEventgetEvent(int id) throws CalFacadeException {1065 public CoreEventInfo getEvent(int id) throws CalFacadeException { 1065 1066 checkOpen(); 1066 1067 return events.getEvent(id); … … 1089 1090 } 1090 1091 1091 public boolean editable(BwEvent val) throws CalFacadeException {1092 /*public boolean editable(BwEvent val) throws CalFacadeException { 1092 1093 checkOpen(); 1093 1094 1094 1095 return events.editable(val); 1095 } 1096 }*/ 1096 1097 1097 1098 public Collection getEventsByName(BwCalendar cal, String val) trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java
r301 r321 64 64 import org.bedework.calfacade.CalFacadeDefs; 65 65 import org.bedework.calfacade.CalFacadeUtil; 66 import org.bedework.calfacade.CoreEventInfo; 66 67 import org.bedework.calfacade.filter.BwFilter; 67 68 import org.bedework.calfacade.ifs.CalTimezones; … … 70 71 import org.bedework.calfacade.CalFacadeException; 71 72 import org.bedework.icalendar.VEventUtil; 73 74 import edu.rpi.cct.uwcal.access.Acl.CurrentAccess; 72 75 73 76 import net.fortuna.ical4j.model.component.VEvent; … … 111 114 public Collection getEvent(BwCalendar calendar, String guid, String rid, 112 115 int recurRetrieval) throws CalFacadeException { 113 BwEvent ev= null;116 CoreEventInfo cei = null; 114 117 BwEvent master = null; 115 118 TreeSet ts = new TreeSet(); … … 133 136 /* There should be one only */ 134 137 135 ev= postGetEvent((BwEvent)sess.getUnique(), privRead, noAccessReturnsNull);136 137 if ( ev== null) {138 cei = postGetEvent((BwEvent)sess.getUnique(), privRead, noAccessReturnsNull); 139 140 if (cei == null) { 138 141 /* Look for an annotation to that event by the current user. 139 142 */ 140 143 eventQuery(BwEventAnnotation.class, calendar, guid, rid, true); 141 BwEventAnnotation ann = (BwEventAnnotation)postGetEvent((BwEvent)sess.getUnique(),142 privRead, noAccessReturnsNull);143 144 if ( ann!= null) {145 ev = new BwEventProxy(ann);144 cei = postGetEvent((BwEvent)sess.getUnique(), 145 privRead, noAccessReturnsNull); 146 147 if (cei != null) { 148 cei.setEvent(new BwEventProxy((BwEventAnnotation)cei.getEvent())); 146 149 } 147 150 } 148 151 149 if ( ev== null) {152 if (cei == null) { 150 153 return ts; 151 154 } 152 155 153 master = ev;154 155 ts.add( ev);156 master = cei.getEvent(); 157 158 ts.add(cei); 156 159 if ((recurRetrieval == CalFacadeDefs.retrieveRecurMaster) || 157 (! ev.getRecurring())) {160 (!master.getRecurring())) { 158 161 return ts; 159 162 } … … 200 203 while (it.hasNext()) { 201 204 BwEventAnnotation override = (BwEventAnnotation)it.next(); 202 BwEventProxy proxy = (BwEventProxy)postGetEvent( 203 makeProxy(null, override, null, 204 CalFacadeDefs.retrieveRecurExpanded), 205 privRead, noAccessReturnsNull); 206 if (proxy != null) { 207 overrides.add(proxy); 205 cei = makeProxy(null, override, null, 206 CalFacadeDefs.retrieveRecurExpanded); 207 if (cei != null) { 208 overrides.add(cei); 208 209 } 209 210 } … … 232 233 while (it.hasNext()) { 233 234 BwRecurrenceInstance instance = (BwRecurrenceInstance)it.next(); 234 BwEventProxy proxy = makeProxy(instance, null, null, 235 CalFacadeDefs.retrieveRecurExpanded); 236 ts.add(proxy); 235 ts.add(makeProxy(instance, null, null, 236 CalFacadeDefs.retrieveRecurExpanded)); 237 237 } 238 238 … … 245 245 BwEventAnnotation override = (BwEventAnnotation)sess.getUnique(); 246 246 247 BwEventProxy proxy;248 249 247 if (override != null) { 250 proxy= makeProxy(null, override, null, CalFacadeDefs.retrieveRecurExpanded);248 cei = makeProxy(null, override, null, CalFacadeDefs.retrieveRecurExpanded); 251 249 } else { 252 250 // Look in the recurrences table … … 271 269 } 272 270 273 proxy = makeProxy(inst, null, null, CalFacadeDefs.retrieveRecurExpanded); 274 } 275 276 if ((proxy != null) && 277 (access.accessible(proxy, privRead, noAccessReturnsNull))) { 278 ts.add(proxy); 271 cei = makeProxy(inst, null, null, CalFacadeDefs.retrieveRecurExpanded); 272 } 273 274 if (cei != null) { 275 ts.add(cei); 279 276 } 280 277 … … 282 279 } 283 280 284 public BwEventgetEvent(int id) throws CalFacadeException {281 public CoreEventInfo getEvent(int id) throws CalFacadeException { 285 282 HibSession sess = getSess(); 286 283 Criteria cr = sess.createCriteria(BwEventObj.class); … … 290 287 BwEvent ev = (BwEvent)sess.getUnique(); 291 288 292 if (!access.accessible(ev, privRead, noAccessReturnsNull)) { 293 return null; 294 } 295 296 return ev; 289 return postGetEvent(ev, privRead, noAccessReturnsNull); 297 290 } 298 291 … … 637 630 } 638 631 639 Collection es = sess.getList();632 Collection ceis = sess.getList(); 640 633 641 634 if (debug) { 642 trace("Found " + es.size() + " events");643 } 644 645 es = postGetEvents(es, privRead, noAccessReturnsNull);635 trace("Found " + ceis.size() + " events"); 636 } 637 638 ceis = postGetEvents(ceis, privRead, noAccessReturnsNull); 646 639 647 640 /** Run the events we got through the filters 648 641 */ 649 es = flt.postExec(es);650 651 Collection r s = getLimitedRecurrences(calendar, filter, startDate, endDate,652 currentMode, cal.getSuperUser(),653 recurRetrieval);654 if (r s != null) {655 es.addAll(rs);656 } 657 658 return es;642 ceis = flt.postExec(ceis); 643 644 Collection rceis = getLimitedRecurrences(calendar, filter, startDate, endDate, 645 currentMode, cal.getSuperUser(), 646 recurRetrieval); 647 if (rceis != null) { 648 ceis.addAll(rceis); 649 } 650 651 return ceis; 659 652 } 660 653 … … 860 853 * @param currentMode 861 854 * @param ignoreCreator 862 * @return Collection populated event valueobjects855 * @return Collection of CoreEventInfo objects 863 856 * @throws CalFacadeException 864 857 */ … … 941 934 942 935 CheckMap checked = new CheckMap(); 943 TreeSet evs = new TreeSet();936 TreeSet ceis = new TreeSet(); 944 937 945 938 Iterator it = rs.iterator(); … … 949 942 /* XXX should have a list of overrides that cover 950 943 */ 951 BwEventProxy proxy= makeProxy(inst, null, checked, recurRetrieval);952 if ( proxy!= null) {944 CoreEventInfo cei = makeProxy(inst, null, checked, recurRetrieval); 945 if (cei != null) { 953 946 //if (debug) { 954 947 // debugMsg("Ev: " + proxy); 955 948 //} 956 evs.add(proxy);949 ceis.add(cei); 957 950 } 958 951 } … … 964 957 /** Run the events we got through the filters 965 958 */ 966 return flt.postExec( evs);959 return flt.postExec(ceis); 967 960 } 968 961 … … 1061 1054 * @param override May be null if we retrieved the instance 1062 1055 * @param checked 1063 * @return BwEventProxy1056 * @return CoreEventInfo 1064 1057 * @throws CalFacadeException 1065 1058 */ 1066 private BwEventProxymakeProxy(BwRecurrenceInstance inst,1067 BwEventAnnotation override,1068 CheckMap checked,1069 int recurRetrieval) throws CalFacadeException {1059 private CoreEventInfo makeProxy(BwRecurrenceInstance inst, 1060 BwEventAnnotation override, 1061 CheckMap checked, 1062 int recurRetrieval) throws CalFacadeException { 1070 1063 BwEvent mstr; 1071 1064 if (inst != null) { … … 1075 1068 } 1076 1069 1077 int res = 0; 1070 //int res = 0; 1071 CurrentAccess ca = null; 1078 1072 1079 1073 if (checked != null) { 1080 res = checked.test(mstr);1081 if ( res < 0) {1074 ca = checked.getca(mstr); 1075 if ((ca != null) && !ca.accessAllowed) { 1082 1076 // failed 1083 1077 return null; … … 1086 1080 1087 1081 if ((recurRetrieval == CalFacadeDefs.retrieveRecurMaster) && 1088 (checked != null) && ( res != 0)) {1089 // Master only and we've already seen it 1082 (checked != null) && (ca != null)) { 1083 // Master only and we've already seen it - we don't want it again 1090 1084 return null; 1091 1085 } 1092 1086 1093 if ((checked == null) || ( res == 0)) {1087 if ((checked == null) || (ca == null)) { 1094 1088 // untested 1095 if (!access.accessible(mstr, privRead, noAccessReturnsNull)) { 1096 if (checked != null) { 1097 checked.setChecked(mstr, false); 1098 } 1089 ca = access.checkAccess(mstr, privRead, noAccessReturnsNull); 1090 if (checked != null) { 1091 checked.setChecked(mstr, ca); 1092 } 1093 1094 if (!ca.accessAllowed) { 1099 1095 return null; 1100 1096 } 1101 }1102 1103 if (checked != null) {1104 checked.setChecked(mstr, true);1105 1097 } 1106 1098 … … 1124 1116 override.setOwner(getUser()); 1125 1117 1126 return new BwEventProxy(override);1118 return new CoreEventInfo(new BwEventProxy(override), ca); 1127 1119 } 1128 1120 … … 1176 1168 } 1177 1169 1178 return new BwEventProxy(override);1170 return new CoreEventInfo(new BwEventProxy(override), ca); 1179 1171 } 1180 1172 1181 1173 private static class CheckMap extends HashMap { 1182 void setChecked(BwEvent ev, boolean ok) { 1183 put(new Integer(ev.getId()), new Boolean(ok)); 1184 } 1185 1186 /* Return 0 for not found, 1 for OK, -1 for not allowed. 1187 */ 1188 int test(BwEvent ev) { 1189 Boolean b = (Boolean)get(new Integer(ev.getId())); 1190 1191 if (b == null) { 1192 return 0; 1193 } 1194 1195 if (b.booleanValue()) { 1196 return 1; 1197 } 1198 1199 return -1; 1174 void setChecked(BwEvent ev, CurrentAccess ca) { 1175 put(new Integer(ev.getId()), ca); 1176 } 1177 1178 /* Return null for not found. 1179 */ 1180 CurrentAccess getca(BwEvent ev) { 1181 return (CurrentAccess)get(new Integer(ev.getId())); 1200 1182 } 1201 1183 } … … 1300 1282 1301 1283 while (it.hasNext()) { 1302 BwEvent ev = (BwEvent)it.next(); 1303 1304 if (access.accessible(ev, desiredAccess, nullForNoAccess)) { 1305 outevs.add(ev); 1284 CoreEventInfo cei = postGetEvent((BwEvent)it.next(), 1285 desiredAccess, nullForNoAccess); 1286 1287 if (cei != null) { 1288 outevs.add(cei); 1306 1289 } 1307 1290 } … … 1310 1293 } 1311 1294 1312 /* Post processing of event. Return null for no access1295 /* Post processing of event. Return null or throw exception for no access 1313 1296 */ 1314 private BwEventpostGetEvent(BwEvent ev, int desiredAccess,1315 boolean nullForNoAccess) throws CalFacadeException {1297 private CoreEventInfo postGetEvent(BwEvent ev, int desiredAccess, 1298 boolean nullForNoAccess) throws CalFacadeException { 1316 1299 if (ev == null) { 1317 1300 return null; 1318 1301 } 1319 1302 1320 if (!access.accessible(ev, desiredAccess, nullForNoAccess)) { 1303 CurrentAccess ca = access.checkAccess(ev, desiredAccess, nullForNoAccess); 1304 1305 if (!ca.accessAllowed) { 1321 1306 return null; 1322 1307 } … … 1328 1313 */ 1329 1314 1330 return ev; 1315 CoreEventInfo cei = new CoreEventInfo(ev, ca); 1316 1317 return cei; 1331 1318 } 1332 1319 trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Filters.java
r2 r321 56 56 import org.bedework.calfacade.BwEvent; 57 57 import org.bedework.calfacade.CalFacadeException; 58 import org.bedework.calfacade.CoreEventInfo; 58 59 import org.bedework.calfacade.filter.BwAndFilter; 59 60 import org.bedework.calfacade.filter.BwCategoryFilter; … … 246 247 * result and handle any filters that could not be handled by the query. 247 248 * 248 * @param val Collection to be filtered249 * @param val Collection of CoreEventInfo to be filtered 249 250 * @return Collection filtered 250 251 * @throws CalFacadeException … … 259 260 260 261 while (it.hasNext()) { 261 BwEvent ev = (BwEvent)it.next(); 262 CoreEventInfo cei = (CoreEventInfo)it.next(); 263 BwEvent ev = cei.getEvent(); 262 264 263 265 if (matches(filter, ev)) { 264 l.add( ev);266 l.add(cei); 265 267 } 266 268 } trunk/calendar3/calFacade/src/org/bedework/calfacade/base/CalintfBase.java
r314 r321 71 71 import org.bedework.calfacade.CalFacadeException; 72 72 import org.bedework.calfacade.CalintfDefs; 73 import org.bedework.calfacade.CoreEventInfo; 73 74 import org.bedework.calfacade.filter.BwFilter; 74 75 import org.bedework.calfacade.ifs.CalTimezones; … … 689 690 * ==================================================================== */ 690 691 691 public BwEventgetEvent(int id) throws CalFacadeException {692 public CoreEventInfo getEvent(int id) throws CalFacadeException { 692 693 checkOpen(); 693 694 throw new CalFacadeUnimplementedException(); trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/EventsI.java
r207 r321 5 5 import org.bedework.calfacade.BwEvent; 6 6 import org.bedework.calfacade.CalFacadeException; 7 import org.bedework.calfacade.CoreEventInfo; 7 8 import org.bedework.calfacade.filter.BwFilter; 8 9 … … 41 42 * master or non-null-valued for particular occurrence. 42 43 * @param recurRetrieval Takes value defined in CalFacadeDefs. 43 * @return Collection of EventInfo objects representing event(s).44 * @return Collection of CoreEventInfo objects representing event(s). 44 45 * @throws CalFacadeException 45 46 */ … … 49 50 /** Return a single event for the current user 50 51 * 51 * @param eventId int id of the event52 * @return EventVO valueobject representing event.52 * @param eventId int id of the event 53 * @return CoreEventInfo object representing event. 53 54 * @throws CalFacadeException 55 * 56 * @deprecated - other calendar systems won't support this. Doesn't make sense 57 * for recurring events. 54 58 */ 55 public BwEventgetEvent(int eventId) throws CalFacadeException;59 public CoreEventInfo getEvent(int eventId) throws CalFacadeException; 56 60 57 61 /** Add an event to the database. The id and uid will be set in the parameter … … 124 128 * @param endDate DateTimeVO end - may be null. 125 129 * @param recurRetrieval Takes value defined in CalFacadeDefs 126 * @return Collection populated event valueobjects130 * @return Collection of CoreEventInfo objects 127 131 * @throws CalFacadeException 128 132 */ … … 132 136 throws CalFacadeException; 133 137 134 /* * Return true if this event is editable by the current user138 /* * Return true if this event is editable by the current user 135 139 * 136 140 * @param val EventVO object to be tested 137 141 * @return boolean 138 142 * @throws CalFacadeException 139 * /140 public boolean editable(BwEvent val) throws CalFacadeException; 143 * / 144 public boolean editable(BwEvent val) throws CalFacadeException;*/ 141 145 142 146 /* ==================================================================== trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/EventInfo.java
r151 r321 58 58 import org.bedework.calfacade.BwEventAnnotation; 59 59 60 import edu.rpi.cct.uwcal.access.Acl.CurrentAccess; 61 60 62 import java.io.Serializable; 61 63 import java.util.Collection; … … 69 71 * <p>This class allows us to handle thread, or user, specific information. 70 72 * 71 * @author Mike Douglass douglm @rpi.edu73 * @author Mike Douglass douglm @ rpi.edu 72 74 */ 73 75 public class EventInfo implements Comparable, Comparator, Serializable { … … 127 129 */ 128 130 private String recurrenceId; 131 132 /* This object contains information giving the current users access rights to 133 * the entity. 134 */ 135 private CurrentAccess currentAccess; 129 136 130 137 /** … … 303 310 public String getRecurrenceId() { 304 311 return recurrenceId; 312 } 313 314 /* Set the current users access rights. 315 * 316 * @param val CurrentAccess 317 */ 318 public void setCurrentAccess(CurrentAccess val) { 319 currentAccess = val; 320 } 321 322 /* Get the current users access rights. 323 * 324 * @return CurrentAccess 325 */ 326 public CurrentAccess getCurrentAccess() { 327 return currentAccess; 305 328 } 306 329 trunk/calendar3/caldavClientApi/src/org/bedework/caldav/client/CalintfCaldavImpl.java
r301 r321 63 63 import org.bedework.calfacade.BwSponsor; 64 64 import org.bedework.calfacade.BwStats; 65 import org.bedework.calfacade.CoreEventInfo; 65 66 //import org.bedework.calfacade.BwSynchData; 66 67 import org.bedework.calfacade.BwSynchInfo; … … 577 578 * ==================================================================== */ 578 579 579 public BwEventgetEvent(int id) throws CalFacadeException {580 public CoreEventInfo getEvent(int id) throws CalFacadeException { 580 581 checkOpen(); 581 582 throw new CalFacadeUnimplementedException(); trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java
r314 r321 80 80 import org.bedework.calfacade.CalFacadeException; 81 81 import org.bedework.calfacade.CalFacadeUtil; 82 import org.bedework.calfacade.CoreEventInfo; 82 83 import org.bedework.calfacade.filter.BwFilter; 83 84 import org.bedework.calfacade.ifs.CalTimezones; … … 1929 1930 }*/ 1930 1931 1931 private EventInfo postProcess( BwEvent ev, BwSubscription sub,1932 private EventInfo postProcess(CoreEventInfo cei, BwSubscription sub, 1932 1933 HashMap sublookup) 1933 1934 throws CalFacadeException { 1934 if ( ev== null) {1935 if (cei == null) { 1935 1936 return null; 1936 1937 } … … 1941 1942 * proxy and return that object. 1942 1943 */ 1944 BwEvent ev = cei.getEvent(); 1945 1943 1946 if (ev instanceof BwEventAnnotation) { 1944 1947 ev = new BwEventProxy((BwEventAnnotation)ev); … … 1954 1957 } 1955 1958 ei.setRecurrenceId(ev.getRecurrence().getRecurrenceId()); 1959 ei.setCurrentAccess(cei.getCurrentAccess()); 1956 1960 1957 1961 return ei; 1958 1962 } 1959 1963 1960 private Collection postProcess(Collection evs, BwSubscription sub)1964 private Collection postProcess(Collection ceis, BwSubscription sub) 1961 1965 throws CalFacadeException { 1962 1966 ArrayList al = new ArrayList(); 1963 1967 1964 Iterator it = evs.iterator();1968 Iterator it = ceis.iterator(); 1965 1969 1966 1970 while (it.hasNext()) { 1967 BwEvent ev = (BwEvent)it.next(); 1968 EventInfo ei = postProcess(ev, sub, null); 1971 EventInfo ei = postProcess((CoreEventInfo)it.next(), sub, null); 1969 1972 al.add(ei); 1970 1973 } … … 1973 1976 } 1974 1977 1975 private Collection postProcess(Collection evs, HashMap sublookup)1978 private Collection postProcess(Collection ceis, HashMap sublookup) 1976 1979 throws CalFacadeException { 1977 1980 ArrayList al = new ArrayList(); 1978 1981 1979 Iterator it = evs.iterator();1982 Iterator it = ceis.iterator(); 1980 1983 1981 1984 while (it.hasNext()) { 1982 BwEvent ev = (BwEvent)it.next(); 1983 EventInfo ei = postProcess(ev, null, sublookup); 1985 EventInfo ei = postProcess((CoreEventInfo)it.next(), null, sublookup); 1984 1986 al.add(ei); 1985 1987 } trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java
r314 r321 1089 1089 * @return EventInfo value object representing event. 1090 1090 * @throws CalFacadeException 1091 * 1092 * @deprecated - other calendar systems won't support this. Doesn't make sense 1093 * for recurring events. 1091 1094 */ 1092 1095 public abstract EventInfo getEvent(int eventId) throws CalFacadeException; trunk/calendar3/webclient/war/docs/event/emitEventDetail.jsp
r312 r321 70 70 </sponsor> 71 71 </logic:present> 72 <bw:emitCurrentPrivs name="eventInfo" property="currentAccess" /> 72 73
