Search in sources :

Example 1 with CalDavBindingProvider

use of org.openhab.binding.caldav_personal.CalDavBindingProvider in project openhab1-addons by openhab.

the class CalDavBinding method updateItemsForEvent.

private void updateItemsForEvent() {
    CalDavBindingProvider bindingProvider = null;
    for (CalDavBindingProvider bindingProvider_ : this.providers) {
        bindingProvider = bindingProvider_;
    }
    if (bindingProvider == null) {
        logger.error("no binding provider found");
        return;
    }
    Map<Integer, List<CalDavEvent>> eventCache = new HashMap<Integer, List<CalDavEvent>>();
    for (String item : bindingProvider.getItemNames()) {
        CalDavConfig config = bindingProvider.getConfig(item);
        List<CalDavEvent> events = eventCache.get(config.getUniqueEventListKey());
        if (events == null) {
            CalDavQuery query = getQueryForConfig(config);
            events = this.calDavLoader.getEvents(query);
            eventCache.put(config.getUniqueEventListKey(), events);
        }
        this.updateItem(item, config, events);
    }
}
Also used : HashMap(java.util.HashMap) CalDavEvent(org.openhab.io.caldav.CalDavEvent) CalDavBindingProvider(org.openhab.binding.caldav_personal.CalDavBindingProvider) ArrayList(java.util.ArrayList) List(java.util.List) CalDavQuery(org.openhab.io.caldav.CalDavQuery)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 CalDavBindingProvider (org.openhab.binding.caldav_personal.CalDavBindingProvider)1 CalDavEvent (org.openhab.io.caldav.CalDavEvent)1 CalDavQuery (org.openhab.io.caldav.CalDavQuery)1