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);
}
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());
}
}
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);
}
}
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();
}
}
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();
}
}
Aggregations