Search in sources :

Example 26 with CalFacadeAccessException

use of org.bedework.calfacade.exc.CalFacadeAccessException in project bw-calendar-engine by Bedework.

the class ProcessorBase method indexCollection.

protected void indexCollection(final CalSvcI svci, final String path) throws CalFacadeException {
    if (skipThis(path)) {
        if (debug) {
            debug("Skipping " + path);
        }
        return;
    }
    if (debug) {
        debug("indexCollection(" + path + ")");
    }
    status.currentStatus = "indexCollection(" + path + ")";
    status.stats.inc(IndexedType.collections);
    try {
        BwCalendar col = null;
        try {
            col = svci.getCalendarsHandler().get(path);
        } catch (final CalFacadeAccessException cfe) {
            error("No access to " + path);
        }
        if ((col == null) || !hasAccess(col)) {
            if (debug) {
                debug("path " + path + " not found");
            }
            return;
        }
        final BwIndexer indexer = svci.getIndexer(principal, indexRootPath);
        indexer.indexEntity(col);
        // close();
        final BwCalendar.CollectionInfo ci = col.getCollectionInfo();
        if (!ci.childrenAllowed) {
            return;
        }
        Refs refs = null;
        for (; ; ) {
            refs = getChildCollections(path, refs);
            if (refs == null) {
                break;
            }
            for (final String cpath : refs.refs) {
                indexCollection(svci, cpath);
            }
        }
        if (!ci.onlyCalEntities || !ci.indexable) {
            return;
        }
        refs = null;
        for (; ; ) {
            refs = getChildEntities(path, refs);
            if (refs == null) {
                break;
            }
            final EntityProcessor ep = new EntityProcessor(status, name + ":Entity", adminAccount, principal, entityDelay, path, refs.refs, indexRootPath);
            final IndexerThread eit = getEntityThread(ep);
            eit.start();
        }
    } catch (final Throwable t) {
        error(t);
    }
}
Also used : BwIndexer(org.bedework.calfacade.indexing.BwIndexer) BwCalendar(org.bedework.calfacade.BwCalendar) CalFacadeAccessException(org.bedework.calfacade.exc.CalFacadeAccessException)

Example 27 with CalFacadeAccessException

use of org.bedework.calfacade.exc.CalFacadeAccessException in project bw-calendar-engine by Bedework.

the class ProcessDelete method deleteEvent.

private boolean deleteEvent() throws Throwable {
    final String path = wordOrQuotedVal();
    if (path == null) {
        error("Expected a path");
        return false;
    }
    final String name = wordOrQuotedVal();
    if (name == null) {
        error("Expected a name");
        return false;
    }
    try {
        open();
        final EventInfo ei = getEvent(path, name);
        if (ei == null) {
            return false;
        }
        getSvci().getEventsHandler().delete(ei, false);
        return true;
    } catch (final CalFacadeAccessException cae) {
        pstate.addError("No access to event " + path + "/" + name);
        return false;
    } finally {
        close();
    }
}
Also used : EventInfo(org.bedework.calfacade.svc.EventInfo) CalFacadeAccessException(org.bedework.calfacade.exc.CalFacadeAccessException)

Example 28 with CalFacadeAccessException

use of org.bedework.calfacade.exc.CalFacadeAccessException in project bw-calendar-engine by Bedework.

the class ProcessDelete method deleteCollection.

private boolean deleteCollection() throws Throwable {
    BwCalendar cal = null;
    try {
        open();
        cal = getCal();
        if (cal == null) {
            return false;
        }
        final boolean emptyIt = "recursive".equals(word());
        getSvci().getCalendarsHandler().delete(cal, emptyIt, false);
        return true;
    } catch (final CalFacadeAccessException cae) {
        pstate.addError("No access to collection " + cal.getPath());
        return false;
    } finally {
        close();
    }
}
Also used : BwCalendar(org.bedework.calfacade.BwCalendar) CalFacadeAccessException(org.bedework.calfacade.exc.CalFacadeAccessException)

Example 29 with CalFacadeAccessException

use of org.bedework.calfacade.exc.CalFacadeAccessException in project bw-calendar-engine by Bedework.

the class ProcessReindex method indexCollection.

protected int indexCollection(final String path, final BwIndexer indexer) throws CalFacadeException {
    int reindexed = 0;
    try {
        BwCalendar col = null;
        try {
            col = getSvci().getCalendarsHandler().get(path);
        } catch (final CalFacadeAccessException cfe) {
            error("No access to " + path);
        }
        if (col == null) {
            if (debug) {
                debug("path " + path + " not found");
            }
            return 0;
        }
        indexer.indexEntity(col);
        // close();
        reindexed++;
        final BwCalendar.CollectionInfo ci = col.getCollectionInfo();
        if (!ci.childrenAllowed) {
            return reindexed;
        }
        Refs refs = null;
        for (; ; ) {
            refs = getChildCollections(path, refs);
            if (refs == null) {
                break;
            }
            for (final String cpath : refs.refs) {
                reindexed += indexCollection(cpath, indexer);
            }
        }
    } catch (final Throwable t) {
        error(t);
    }
    return reindexed;
}
Also used : BwCalendar(org.bedework.calfacade.BwCalendar) CalFacadeAccessException(org.bedework.calfacade.exc.CalFacadeAccessException)

Aggregations

CalFacadeAccessException (org.bedework.calfacade.exc.CalFacadeAccessException)29 BwCalendar (org.bedework.calfacade.BwCalendar)18 CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)16 WebdavException (org.bedework.webdav.servlet.shared.WebdavException)13 WebdavForbidden (org.bedework.webdav.servlet.shared.WebdavForbidden)13 EventInfo (org.bedework.calfacade.svc.EventInfo)7 BwEvent (org.bedework.calfacade.BwEvent)6 WebdavBadRequest (org.bedework.webdav.servlet.shared.WebdavBadRequest)6 ArrayList (java.util.ArrayList)5 TreeSet (java.util.TreeSet)3 CalFacadeForbidden (org.bedework.calfacade.exc.CalFacadeForbidden)3 Collection (java.util.Collection)2 CurrentAccess (org.bedework.access.Acl.CurrentAccess)2 CalDAVEvent (org.bedework.caldav.server.CalDAVEvent)2 FilterBase (org.bedework.caldav.util.filter.FilterBase)2 BwAttendee (org.bedework.calfacade.BwAttendee)2 BwCategory (org.bedework.calfacade.BwCategory)2 BwEventProxy (org.bedework.calfacade.BwEventProxy)2 BwPrincipal (org.bedework.calfacade.BwPrincipal)2 ScheduleResult (org.bedework.calfacade.ScheduleResult)2