Search in sources :

Example 51 with BwCalendar

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

the class BwIndexEsImpl method fetchCol.

@Override
public BwCalendar fetchCol(final String val, final PropertyInfoIndex... index) throws CalFacadeException {
    final EntityBuilder eb = fetchEntity(docTypeCollection, val, index);
    if (eb == null) {
        return null;
    }
    final BwCalendar col = eb.makeCollection();
    return accessCheck.checkAccess(col);
}
Also used : BwCalendar(org.bedework.calfacade.BwCalendar)

Example 52 with BwCalendar

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

the class Dumpling method dumpCollection.

private void dumpCollection(final BwCalendar col) throws Throwable {
    col.dump(xml);
    if (col.getInternalAlias() && !col.getTombstoned()) {
        final String target = col.getInternalAliasPath();
        final AliasInfo ai = new AliasInfo(col.getPath(), target, col.getPublick(), col.getOwnerHref());
        AliasEntry ae = globals.aliasInfo.get(target);
        if (ae == null) {
            ae = new AliasEntry();
            ae.setTargetPath(target);
            globals.aliasInfo.put(target, ae);
        }
        ae.getAliases().add(ai);
        globals.counts[globals.aliases]++;
    }
    if (col.getExternalSub() && !col.getTombstoned()) {
        globals.counts[globals.externalSubscriptions]++;
        globals.externalSubs.add(AliasInfo.getExternalSubInfo(col.getPath(), col.getAliasUri(), col.getPublick(), col.getOwnerHref()));
    }
    // Should I be dumping external subscriptions?
    final Collection<BwCalendar> cs = globals.di.getChildren(col);
    if (cs != null) {
        // noinspection unchecked
        dumpCollection((Iterator<T>) cs.iterator());
    }
}
Also used : AliasInfo(org.bedework.dumprestore.AliasInfo) AliasEntry(org.bedework.dumprestore.AliasEntry) BwCalendar(org.bedework.calfacade.BwCalendar)

Example 53 with BwCalendar

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

the class Dumpling method dumpCollection.

private void dumpCollection(final Iterator<T> it) throws Throwable {
    while (it.hasNext()) {
        final DumpEntity d = unwrap(it.next());
        globals.counts[countIndex]++;
        if ((globals.counts[countIndex] % 100) == 0) {
            info("        ... " + globals.counts[countIndex]);
        }
        if (d instanceof BwResource) {
            dumpResource((BwResource) d);
            continue;
        }
        if (d instanceof BwCalendar) {
            dumpCollection((BwCalendar) d);
            continue;
        }
        if (d instanceof BwEvent) {
            dumpEvent((BwEvent) d);
            continue;
        }
        /* Just dump any remaining classes - no special treatment */
        d.dump(xml);
    }
}
Also used : DumpEntity(org.bedework.calfacade.base.DumpEntity) BwResource(org.bedework.calfacade.BwResource) BwEvent(org.bedework.calfacade.BwEvent) BwCalendar(org.bedework.calfacade.BwCalendar)

Example 54 with BwCalendar

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

the class Restorer method restoreCollections.

protected void restoreCollections(final Path p) throws CalFacadeException {
    try {
        final DirRestore<BwCalendar> colRestore = new DirRestore<>(p, restoreCol);
        final EnumSet<FileVisitOption> opts = EnumSet.of(FileVisitOption.FOLLOW_LINKS);
        Files.walkFileTree(p, opts, Integer.MAX_VALUE, colRestore);
    } catch (final IOException ie) {
        throw new CalFacadeException(ie);
    } finally {
        popPath();
    }
}
Also used : FileVisitOption(java.nio.file.FileVisitOption) BwCalendar(org.bedework.calfacade.BwCalendar) IOException(java.io.IOException) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 55 with BwCalendar

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

the class DumpPrincipal method dumpCol.

protected void dumpCol(final BwCalendar col, final boolean doChildren) throws CalFacadeException {
    final CalendarsI colsI = getSvc().getCalendarsHandler();
    try {
        incCount(DumpGlobals.collections);
        makeDir(col.getName(), false);
        col.dump(makeFile(col.getName() + ".xml"));
        /* Dump any events in this collection */
        final Iterable<EventInfo> eis = getDi().getEventInfos(col.getPath());
        eis.forEach(new EventConsumer());
        if (!doChildren || !col.getCollectionInfo().childrenAllowed) {
            return;
        }
        final Collection<BwCalendar> cols = colsI.getChildren(col);
        if (Util.isEmpty(cols)) {
            return;
        }
        for (final BwCalendar ch : cols) {
            dumpCol(ch, true);
        }
    } finally {
        popPath();
    }
}
Also used : EventInfo(org.bedework.calfacade.svc.EventInfo) CalendarsI(org.bedework.calsvci.CalendarsI) BwCalendar(org.bedework.calfacade.BwCalendar)

Aggregations

BwCalendar (org.bedework.calfacade.BwCalendar)134 CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)46 EventInfo (org.bedework.calfacade.svc.EventInfo)23 BwEvent (org.bedework.calfacade.BwEvent)19 ArrayList (java.util.ArrayList)18 CalFacadeAccessException (org.bedework.calfacade.exc.CalFacadeAccessException)18 BwPrincipal (org.bedework.calfacade.BwPrincipal)15 TreeSet (java.util.TreeSet)10 CoreEventInfo (org.bedework.calcorei.CoreEventInfo)10 BwCategory (org.bedework.calfacade.BwCategory)10 BwResource (org.bedework.calfacade.BwResource)10 WebdavException (org.bedework.webdav.servlet.shared.WebdavException)9 FilterBase (org.bedework.caldav.util.filter.FilterBase)8 BwPreferences (org.bedework.calfacade.svc.BwPreferences)8 BwEventProxy (org.bedework.calfacade.BwEventProxy)7 CalendarWrapper (org.bedework.calfacade.wrappers.CalendarWrapper)7 CurrentAccess (org.bedework.access.Acl.CurrentAccess)6 CalendarsI (org.bedework.calsvci.CalendarsI)6 Acl (org.bedework.access.Acl)5 BwEventAnnotation (org.bedework.calfacade.BwEventAnnotation)5