Package com.ettrema.http

Examples of com.ettrema.http.ICalResource


        }

        public CData getValue( PropFindableResource res ) {
            log.trace( "getValue: " + res.getClass());
            if( res instanceof ICalResource) {
                ICalResource ical = (ICalResource) res;
                return new CData( ical.getICalData() );
            } else {
                return null;
            }
        }
View Full Code Here


    private List<ICalResource> findCalendarResources(CalendarResource calendar, Document doc) {
        // build a list of all calendar resources
        List<ICalResource> list = new ArrayList<ICalResource>();
        for(Resource r : calendar.getChildren()) {
            if( r instanceof ICalResource) {
                ICalResource cr = (ICalResource) r;
                list.add(cr);
            }
        }

        // filter out those that don't match
        Element elFilterRoot = doc.getRootElement().getChild("filter", NS_CAL);
        if (elFilterRoot == null) {
            // no filter so return all
            return list;
        }

        Element elSecondFilter = elFilterRoot.getChild("comp-filter", NS_CAL);
        if (elSecondFilter == null) {
            // no second filter so return all
            return list;
        }

        Element elTimeRange = elSecondFilter.getChild("time-range", NS_CAL);
        if (elTimeRange == null) {
            // no time range filter so return all
            return list;
        }

        String sStart = elTimeRange.getAttributeValue("start");
        String sFinish = elTimeRange.getAttributeValue("end");

        Date start = null;
        Date end = null;

        if( sStart != null && sStart.length() > 0) {
            try {
                start = DateUtils.parseDate(sStart);
            } catch (DateParseException ex) {
                log.error("Couldnt parse start date in calendar-query: " + sStart);
            }
        }

        if( sFinish != null && sFinish.length() > 0) {
            try {
                end = DateUtils.parseDate(sFinish);
            } catch (DateParseException ex) {
                log.error("Couldnt parse end date in calendar-query: " + sFinish);
            }
        }

        // So now we have (or might have) start and end dates, so filter list
        Iterator<ICalResource> it = list.iterator();
        while(it.hasNext()) {
            ICalResource r = it.next();
            if( outsideDates(r, start, end)) {
                it.remove();
            }
        }
        return list;
View Full Code Here

TOP

Related Classes of com.ettrema.http.ICalResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.