stefanuebe/vaadin-fullcalendar

EntryProvider for ResourceEntry

Closed this issue · 7 comments

LazyInMemoryEntryProvider is provided to lazy load FullCalendar from a database. However there is no equivalent method for Calendar Scheduler, which needs to extend ResourceEntry instead of Entry. It would be nice to see this implemented.

Can you please examine in detail why you need an explicit ResourceEntry support, e. g. use cases, any issues or similar? Since the in memory / crud api been taken from the Full Calendar, I would not have expected any issues here.

The following code leads to an compiler issue since setEntryProvider only accepts EntryProvider<Entry>

List<ResourceEntry> entryList = myService.streamResourceEntries().collect(Collectors.toList());
LazyInMemoryEntryProvider<ResourceEntry> entryProvider = EntryProvider.lazyInMemoryFromItems(entryList);
calendar.setEntryProvider(entryProvider); 

Workaround for now is to cast the list given to the entry provider to List, e. g.

List<ResourceEntry> entryList = myService.streamResourceEntries().collect(Collectors.toList());
LazyInMemoryEntryProvider<ResourceEntry> entryProvider = EntryProvider.lazyInMemoryFromItems((List) entryList);
calendar.setEntryProvider(entryProvider); 

Released in 4.1.2

Thanks - I tried the cast to List, but it still doesn't compile due to the Entry requirement for calendar. My application involves allocating clinic appointments to different meeting rooms (resources) because they run in parallel. So the EntryProvider seemed like a more efficient way of lazy loading the calender with ResourceEntries rather than iterating through a list and doing calender.addEntry. I'll have a look at it again if there's no easy workaround.

Ok. Please try if the new release fixes your problem.

Thanks for the ResourceEntry Provider fixes in 4.1.2. All working nicely.