• R/O
  • SSH
  • HTTPS

pal: Commit


Commit MetaInfo

Revision1682 (tree)
Zeit2009-01-20 14:47:24
Autorshinsuke

Log Message

display own evnet for facilities.

Ändern Zusammenfassung

Diff

--- scheduler/trunk/src/main/java/jp/sf/pal/scheduler/service/OnetimeScheduleService.java (revision 1681)
+++ scheduler/trunk/src/main/java/jp/sf/pal/scheduler/service/OnetimeScheduleService.java (revision 1682)
@@ -2,6 +2,7 @@
22
33 import java.io.Serializable;
44 import java.sql.Timestamp;
5+import java.util.ArrayList;
56 import java.util.Date;
67 import java.util.List;
78
@@ -8,6 +9,7 @@
89 import jp.sf.pal.scheduler.SchedulerConstants;
910 import jp.sf.pal.scheduler.common.dxo.PagerDxo;
1011 import jp.sf.pal.scheduler.common.util.PagingResultBeanWrapper;
12+import jp.sf.pal.scheduler.db.allcommon.bhv.setup.ConditionBeanSetupper;
1113 import jp.sf.pal.scheduler.db.allcommon.cbean.PagingResultBean;
1214 import jp.sf.pal.scheduler.db.cbean.EventScheduleCB;
1315 import jp.sf.pal.scheduler.db.cbean.EventScheduleMappingCB;
@@ -39,7 +41,7 @@
3941 private PagerDxo pagerDxo;
4042
4143 public List<FacilityScheduleMapping> getFacilityScheduleMappingList(
42- Integer facilityId, Date fromDate, Date toDate) {
44+ Integer facilityId, Date fromDate, Date toDate, final String userId) {
4345 FacilityScheduleMappingCB cb = new FacilityScheduleMappingCB();
4446
4547 // setup
@@ -54,7 +56,24 @@
5456
5557 cb.query().queryEventSchedule().addOrderBy_StartDate_Asc();
5658
57- return facilityScheduleMappingBhv.selectList(cb);
59+ List<FacilityScheduleMapping> fsmList = facilityScheduleMappingBhv
60+ .selectList(cb);
61+
62+ if (userId != null) {
63+ List<EventSchedule> esList = new ArrayList<EventSchedule>();
64+ for (FacilityScheduleMapping fsm : fsmList) {
65+ esList.add(fsm.getEventSchedule());
66+ }
67+ final ConditionBeanSetupper<EventScheduleMappingCB> setupper = new ConditionBeanSetupper<EventScheduleMappingCB>() {
68+ public void setup(EventScheduleMappingCB cb) {
69+ cb.query().setUserId_Equal(userId);
70+ }
71+ };
72+ eventScheduleBhv.loadEventScheduleMappingList(esList, setupper);
73+ }
74+
75+ // TODO performance
76+ return fsmList;
5877 }
5978
6079 public List<EventScheduleMapping> getPersonalScheduleMappingList(
--- scheduler/trunk/src/main/java/jp/sf/pal/scheduler/service/RepeatScheduleService.java (revision 1681)
+++ scheduler/trunk/src/main/java/jp/sf/pal/scheduler/service/RepeatScheduleService.java (revision 1682)
@@ -2,6 +2,7 @@
22
33 import java.io.Serializable;
44 import java.sql.Timestamp;
5+import java.util.ArrayList;
56 import java.util.Date;
67 import java.util.List;
78
@@ -8,6 +9,7 @@
89 import jp.sf.pal.scheduler.SchedulerConstants;
910 import jp.sf.pal.scheduler.common.dxo.PagerDxo;
1011 import jp.sf.pal.scheduler.common.util.PagingResultBeanWrapper;
12+import jp.sf.pal.scheduler.db.allcommon.bhv.setup.ConditionBeanSetupper;
1113 import jp.sf.pal.scheduler.db.allcommon.cbean.PagingResultBean;
1214 import jp.sf.pal.scheduler.db.allcommon.cbean.UnionQuery;
1315 import jp.sf.pal.scheduler.db.cbean.EventScheduleCB;
@@ -40,7 +42,8 @@
4042 private PagerDxo pagerDxo;
4143
4244 public List<FacilityScheduleMapping> getFacilityScheduleMappingList(
43- final Integer facilityId, final Date fromDate, final Date toDate) {
45+ final Integer facilityId, final Date fromDate, final Date toDate,
46+ final String userId) {
4447 FacilityScheduleMappingCB cb = new FacilityScheduleMappingCB();
4548
4649 // setup
@@ -66,7 +69,24 @@
6669 });
6770 cb.query().queryEventSchedule().addOrderBy_StartDate_Asc();
6871
69- return facilityScheduleMappingBhv.selectList(cb);
72+ List<FacilityScheduleMapping> fsmList = facilityScheduleMappingBhv
73+ .selectList(cb);
74+
75+ if (userId != null) {
76+ List<EventSchedule> esList = new ArrayList<EventSchedule>();
77+ for (FacilityScheduleMapping fsm : fsmList) {
78+ esList.add(fsm.getEventSchedule());
79+ }
80+ final ConditionBeanSetupper<EventScheduleMappingCB> setupper = new ConditionBeanSetupper<EventScheduleMappingCB>() {
81+ public void setup(EventScheduleMappingCB cb) {
82+ cb.query().setUserId_Equal(userId);
83+ }
84+ };
85+ eventScheduleBhv.loadEventScheduleMappingList(esList, setupper);
86+ }
87+
88+ // TODO performance
89+ return fsmList;
7090 }
7191
7292 public List<EventScheduleMapping> getPersonalScheduleMappingList(
--- scheduler/trunk/src/main/java/jp/sf/pal/scheduler/action/user/facility/CalendarAction.java (revision 1681)
+++ scheduler/trunk/src/main/java/jp/sf/pal/scheduler/action/user/facility/CalendarAction.java (revision 1682)
@@ -78,11 +78,12 @@
7878 eventInDayItems.add(new ArrayList<Map<String, Object>>(5));
7979 }
8080
81+ String userId = request.getRemoteUser();
8182 Integer facilityId = Integer.parseInt(calendarForm.facilityId);
8283 facility = facilityService.getFacility(facilityId);
8384 List<FacilityScheduleMapping> ssmList = onetimeScheduleService
8485 .getFacilityScheduleMappingList(facilityId, cal.getTime(),
85- nextCal.getTime());
86+ nextCal.getTime(), userId);
8687 SchedulerUtil.createFacilityDayForOnetime(tYear, tMonth, tDate,
8788 ssmList, eventInDayItems, allDayEventInDayItems);
8889
@@ -104,7 +105,7 @@
104105
105106 List<FacilityScheduleMapping> rsmList = repeatScheduleService
106107 .getFacilityScheduleMappingList(facilityId, cal.getTime(),
107- nextCal.getTime());
108+ nextCal.getTime(), userId);
108109 SchedulerUtil.createFacilityDayForRepeat(tYear, tMonth, tDate, tDay,
109110 rsmList, eventInDayItems, allDayEventInDayItems);
110111
@@ -220,17 +221,18 @@
220221 allDayEventInWeekItems.add(new ArrayList<Map<String, Object>>(5));
221222 }
222223
224+ String userId = request.getRemoteUser();
223225 Integer facilityId = Integer.parseInt(calendarForm.facilityId);
224226 facility = facilityService.getFacility(facilityId);
225227 List<FacilityScheduleMapping> fsmList1 = onetimeScheduleService
226228 .getFacilityScheduleMappingList(facilityId, calendarList.get(0)
227- .getTime(), calendarList.get(6).getTime());
229+ .getTime(), calendarList.get(6).getTime(), userId);
228230 SchedulerUtil.createFacilityWeekForOnetime(indexMap, fsmList1,
229231 eventInWeekItems, allDayEventInWeekItems);
230232
231233 List<FacilityScheduleMapping> fsmList2 = repeatScheduleService
232234 .getFacilityScheduleMappingList(facilityId, calendarList.get(0)
233- .getTime(), calendarList.get(6).getTime());
235+ .getTime(), calendarList.get(6).getTime(), userId);
234236 SchedulerUtil.createFacilityWeekForRepeat(indexMap, fsmList2,
235237 eventInWeekItems, allDayEventInWeekItems, weekDayItems);
236238
@@ -271,17 +273,18 @@
271273 int endDateIndex = indexMap.get(lastYear + "-" + lastMonth + "-"
272274 + lastDate);
273275
276+ String userId = request.getRemoteUser();
274277 Integer facilityId = Integer.parseInt(calendarForm.facilityId);
275278 facility = facilityService.getFacility(facilityId);
276279 List<FacilityScheduleMapping> ssmList = onetimeScheduleService
277280 .getFacilityScheduleMappingList(facilityId, startCal.getTime(),
278- endCal.getTime());
281+ endCal.getTime(), userId);
279282 SchedulerUtil.createFacilityMonthForOnetime(firstDateIndex,
280283 endDateIndex, indexMap, ssmList, calendarDayItems);
281284
282285 List<FacilityScheduleMapping> rsmList = repeatScheduleService
283286 .getFacilityScheduleMappingList(facilityId, startCal.getTime(),
284- endCal.getTime());
287+ endCal.getTime(), userId);
285288 SchedulerUtil.createFacilityMonthForRepeat(firstDateIndex,
286289 endDateIndex, indexMap, rsmList, calendarDayItems);
287290
@@ -387,15 +390,16 @@
387390 allDayEventInWeekItems.add(new ArrayList<Map<String, Object>>(5));
388391 }
389392
393+ String userId = request.getRemoteUser();
390394 List<FacilityScheduleMapping> ssmList = onetimeScheduleService
391395 .getFacilityScheduleMappingList(facility.getId(), startCal
392- .getTime(), endCal.getTime());
396+ .getTime(), endCal.getTime(), userId);
393397 SchedulerUtil.createFacilityWeekForOnetime(indexMap, ssmList,
394398 eventInWeekItems, allDayEventInWeekItems);
395399
396400 List<FacilityScheduleMapping> rsmList = repeatScheduleService
397401 .getFacilityScheduleMappingList(facility.getId(), startCal
398- .getTime(), endCal.getTime());
402+ .getTime(), endCal.getTime(), userId);
399403 SchedulerUtil.createFacilityWeekForRepeat(indexMap, rsmList,
400404 eventInWeekItems, allDayEventInWeekItems, weekDayItems);
401405
--- scheduler/trunk/src/main/java/jp/sf/pal/scheduler/util/SchedulerUtil.java (revision 1681)
+++ scheduler/trunk/src/main/java/jp/sf/pal/scheduler/util/SchedulerUtil.java (revision 1682)
@@ -13,6 +13,7 @@
1313 import java.util.Set;
1414
1515 import jp.sf.pal.scheduler.SchedulerConstants;
16+import jp.sf.pal.scheduler.common.CommonConstants;
1617 import jp.sf.pal.scheduler.common.util.CalendarUtil;
1718 import jp.sf.pal.scheduler.common.util.ConfigUtil;
1819 import jp.sf.pal.scheduler.common.util.DateUtil;
@@ -283,7 +284,7 @@
283284
284285 public static Map<String, Object> createEvent(EventSchedule eventSchedule,
285286 boolean start, boolean end) {
286- Map<String, Object> map = new HashMap<String, Object>(6);
287+ Map<String, Object> map = new HashMap<String, Object>(7);
287288 map.put("id", eventSchedule.getId().toString());
288289 map.put("title", eventSchedule.getTitle());
289290 map.put("secret", eventSchedule.getSecret());
@@ -305,6 +306,12 @@
305306 map.put("repeat", "true");
306307 map.put("type", ((EventSchedule) eventSchedule).getType());
307308 }
309+ if (eventSchedule.getEventScheduleMappingList() != null
310+ && !eventSchedule.getEventScheduleMappingList().isEmpty()) {
311+ map.put("open", CommonConstants.TRUE);
312+ } else {
313+ map.put("open", CommonConstants.FALSE);
314+ }
308315
309316 return map;
310317 }
@@ -312,7 +319,7 @@
312319 public static Map<String, Object> createEventWithCurrentDate(
313320 EventSchedule eventSchedule, boolean start, boolean end,
314321 String currentDate) {
315- Map<String, Object> map = new HashMap<String, Object>(9);
322+ Map<String, Object> map = new HashMap<String, Object>(10);
316323 map.put("id", eventSchedule.getId().toString());
317324 map.put("title", eventSchedule.getTitle());
318325 map.put("secret", eventSchedule.getSecret());
@@ -334,6 +341,12 @@
334341 map.put("repeat", "true");
335342 map.put("type", ((EventSchedule) eventSchedule).getType());
336343 }
344+ if (eventSchedule.getEventScheduleMappingList() != null
345+ && !eventSchedule.getEventScheduleMappingList().isEmpty()) {
346+ map.put("open", CommonConstants.TRUE);
347+ } else {
348+ map.put("open", CommonConstants.FALSE);
349+ }
337350
338351 // set target date
339352 // TODO needs null check?
Show on old repository browser