Changeset 677
- Timestamp:
- 07/01/06 14:45:50
- Files:
-
- freebusy/trunk/webclient/src/org/bedework/fbaggregator/FormattedFreeBusy.java (modified) (9 diffs)
- freebusy/trunk/webclient/src/org/bedework/fbaggregator/FreeBusyAggregator.java (modified) (1 diff)
- freebusy/trunk/webclient/src/org/bedework/fbaggregator/GetFreeBusy.java (modified) (3 diffs)
- freebusy/trunk/webclient/src/org/bedework/fbaggregator/RenderFreeBusy.java (deleted)
- freebusy/trunk/webclient/war/docs/freeBusy.jsp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freebusy/trunk/webclient/src/org/bedework/fbaggregator/FormattedFreeBusy.java
r669 r677 32 32 import org.bedework.fbaggregator.FreeBusyAggregator.FbResponse; 33 33 34 import java.io.Serializable; 34 35 import java.util.ArrayList; 36 import java.util.Calendar; 35 37 import java.util.Collection; 36 38 import java.util.Iterator; 39 import java.util.Locale; 37 40 38 41 /** Reformatted free busy information for display. … … 47 50 * 48 51 */ 49 public class FormattedFreeBusy {52 public class FormattedFreeBusy implements Serializable { 50 53 /** Who's free busy? Normally a user - could be a room. 51 54 */ … … 55 58 private BwDateTime end; 56 59 57 /** Collection of FbPeriod58 */ 59 private Collection times;60 /** Collection of Collections of FbPeriod 61 */ 62 private Collection days = new ArrayList(); 60 63 61 64 /** Class to represent a free busy period … … 63 66 * @author Mike Douglass 64 67 */ 65 public static class FbPeriod {68 public static class FbPeriod implements Serializable { 66 69 int minutesStart; 67 70 int minutesLength; … … 156 159 * @throws CalFacadeException 157 160 */ 158 public FormattedFreeBusy(FbResponse fbresp) throws CalFacadeException { 159 setAccount(fbresp.ui.getAccount()); 161 public FormattedFreeBusy(FbResponse fbresp, Locale loc) throws CalFacadeException { 162 if (fbresp.ui != null) { 163 setAccount(fbresp.ui.getAccount()); 164 } else { 165 // Aggregated response 166 setAccount(null); 167 } 168 160 169 setStart(fbresp.getStart()); 161 170 setEnd(fbresp.getEnd()); 162 171 172 /* We use Calendar objects to determine the start of the next day. 173 * This should allow for daylisght savings problems to some extent 174 * though there is going to be some confusion at the boundaries I suspect. 175 * 176 * Maybe we should flag when the current locale goes over a daylight savings 177 * boundary? 178 */ 179 Calendar startCal = Calendar.getInstance(loc); 180 Calendar endDayCal = Calendar.getInstance(loc); 181 182 startCal.setTime(getStart().makeDate()); 183 184 endDayCal.setTime(getStart().makeDate()); 185 endDayCal.add(Calendar.DATE, 1); 186 163 187 /* We expect a number of BwFreeBusyComponent each containing a single 164 188 * free busy period. … … 168 192 Iterator it = fbresp.eps.iterator(); 169 193 194 // setup first day. 195 Collection day = new ArrayList(); 196 days.add(day); 197 int dayStartMinutes = -1; 198 170 199 while (it.hasNext()) { 200 if (!startCal.before(endDayCal)) { 201 // new day 202 203 day = new ArrayList(); 204 days.add(day); 205 endDayCal.add(Calendar.DATE, 1); 206 207 /* Needs to be set to start value of next period. */ 208 dayStartMinutes = -1; 209 } 210 171 211 EventPeriod ep = (EventPeriod)it.next(); 172 212 … … 175 215 int pstart = Math.round((pstartMillis - startMillis) / 60000); 176 216 177 addTime(new FbPeriod(pstart, plen, ep.getType(), 217 /* Decrement period start by start of day value. 218 */ 219 if (dayStartMinutes < 0) { 220 dayStartMinutes = pstart; 221 } 222 223 pstart -= dayStartMinutes; 224 225 day.add(new FbPeriod(pstart, plen, ep.getType(), 178 226 ep.getNumBusy(), ep.getNumTentative())); 227 228 startCal.add(Calendar.MINUTE, plen); 179 229 } 180 230 } … … 191 241 * @return String 192 242 */ 193 public String get Who() {243 public String getAccount() { 194 244 return account; 195 245 } … … 227 277 * @return Collection of FbPeriod 228 278 */ 229 public Collection getTimes() { 230 if (times == null) { 231 times = new ArrayList(); 232 } 233 return times; 234 } 235 236 /** Add a free/busy period 237 * 238 * @param val 239 */ 240 public void addTime(FbPeriod val) { 241 getTimes().add(val); 242 } 243 244 /** Iterate over free/busy periods 245 * 246 * @return Iterator 247 */ 248 public Iterator iterateTimes() { 249 return getTimes().iterator(); 279 public Collection getDays() { 280 if (days == null) { 281 days = new ArrayList(); 282 } 283 return days; 250 284 } 251 285 } freebusy/trunk/webclient/src/org/bedework/fbaggregator/FreeBusyAggregator.java
r676 r677 261 261 gpp.tzcache = trans.getTimezones(); 262 262 263 BwDateTime bwend = gpp.startDt =CalFacadeUtil.getDateTime(end,264 false, // dateOnly265 true, // UTC266 trans.getTimezones());263 BwDateTime bwend = CalFacadeUtil.getDateTime(end, 264 false, // dateOnly 265 true, // UTC 266 trans.getTimezones()); 267 267 268 268 Collection respeps = new ArrayList(); freebusy/trunk/webclient/src/org/bedework/fbaggregator/GetFreeBusy.java
r676 r677 101 101 } 102 102 103 FbResponse resp = sess.getFba().getFreeBusy(ui, start, end, granularity);103 FbResponse resp = fba.getFreeBusy(ui, start, end, granularity); 104 104 form.assignResponse(resp); 105 105 … … 107 107 } else { 108 108 // All 109 form.assignResponses( sess.getFba().getFreeBusy(sess.getInfoset().getAll().iterator(),110 start, end, granularity));109 form.assignResponses(fba.getFreeBusy(sess.getInfoset().getAll().iterator(), 110 start, end, granularity)); 111 111 /* Combine the responses into one big collection */ 112 112 FbResponse allResponses = new FbResponse(); … … 128 128 } 129 129 130 FormattedFreeBusy ffb = new FormattedFreeBusy(form.getAggregatedResp(), 131 request.getLocale()); 132 133 form.assignFormattedFreeBusy(ffb); 134 130 135 return forwardSuccess; 131 136 } freebusy/trunk/webclient/war/docs/freeBusy.jsp
r671 r677 13 13 14 14 <freebusy> 15 <logic:iterate id="freeBusyObj" name="calForm" property="freeBusy" > 16 <day> 17 <bw:emitText name="freeBusyObj" property="who.account" tagName="who" /> 15 <%-- 16 <logic:iterate id="freeBusyObj" name="bwForm" property="formattedFreeBusy" > 17 <day> 18 <bw:emitText name="freeBusyObj" property="account" tagName="who" /> 19 <bw:emitText name="freeBusyObj" property="start.dtval" tagName="start" /> 20 <bw:emitText name="freeBusyObj" property="end.dtval" tagName="end" /> 21 <logic:iterate id="fbperiod" name="freeBusyObj" property="times" > 22 <period> 23 <fbtype><bean:write name="fbperiod" property="type" /></fbtype> 24 <start><bean:write name="fbperiod" property="startTime" /></start> 25 <length><bean:write name="fbperiod" property="minutesLength" /></length> 26 </period> 27 </logic:iterate> 28 </day> 29 </logic:iterate> 30 --%> 31 <logic:present name="bwForm" property="formattedFreeBusy" > 32 <bean:define id="freeBusyObj" name="bwForm" property="formattedFreeBusy" /> 33 <bw:emitText name="freeBusyObj" property="account" tagName="who" /> 18 34 <bw:emitText name="freeBusyObj" property="start.dtval" tagName="start" /> 19 35 <bw:emitText name="freeBusyObj" property="end.dtval" tagName="end" /> 20 <logic:iterate id="fbperiod" name="freeBusyObj" property="times" > 21 <period> 22 <fbtype><bean:write name="fbperiod" property="type" /></fbtype> 23 <start><bean:write name="fbperiod" property="startTime" /></start> 24 <length><bean:write name="fbperiod" property="minutesLength" /></length> 25 </period> 36 <logic:iterate id="day" name="freeBusyObj" property="days" > 37 <day> 38 <logic:iterate id="fbperiod" name="day" > 39 <period> 40 <fbtype><bean:write name="fbperiod" property="type" /></fbtype> 41 <start><bean:write name="fbperiod" property="startTime" /></start> 42 <length><bean:write name="fbperiod" property="minutesLength" /></length> 43 </period> 44 </logic:iterate> 45 </day> 26 46 </logic:iterate> 27 </day> 28 </logic:iterate> 47 </logic:present> 29 48 </freebusy> 30 49
