Search in sources :

Example 1 with DumpAliases

use of org.bedework.dumprestore.dump.dumpling.DumpAliases in project bw-calendar-engine by Bedework.

the class Dump method doDump.

/**
 * @throws Throwable on error
 */
public void doDump() throws Throwable {
    if (newDumpFormat) {
        // TODO - start a separate thread for public
        final DumpPublic dumpPub = new DumpPublic(globals);
        if (dumpPub.open()) {
            dumpPub.doDump();
            dumpPub.close();
        }
        final DumpSystem dumpSys = new DumpSystem(globals);
        if (dumpSys.open()) {
            dumpSys.doDump();
            dumpSys.close();
        }
        final DumpPrincipal dumpPr = new DumpPrincipal(globals);
        final Iterator<BwPrincipal> it = globals.di.getAllPrincipals();
        while (it.hasNext()) {
            final BwPrincipal pr = it.next();
            final String account = pr.getAccount().toLowerCase().trim();
            if (!account.equals(pr.getAccount())) {
                globals.info.addLn("WARNING: Principal " + pr + " has possible invalid account");
            }
            boolean open = false;
            try {
                if (dumpPr.open(pr)) {
                    open = true;
                    dumpPr.doDump();
                }
            } catch (final CalFacadeException cfe) {
                error(cfe);
            } finally {
                if (open) {
                    try {
                        dumpPr.close();
                    } catch (final CalFacadeException cfe) {
                        error(cfe);
                    }
                }
            }
        }
    } else {
        new DumpAll(globals).dumpSection(null);
        new DumpAliases(globals).dumpSection(null);
    }
}
Also used : BwPrincipal(org.bedework.calfacade.BwPrincipal) DumpAliases(org.bedework.dumprestore.dump.dumpling.DumpAliases) DumpSystem(org.bedework.dumprestore.prdump.DumpSystem) DumpPublic(org.bedework.dumprestore.prdump.DumpPublic) DumpPrincipal(org.bedework.dumprestore.prdump.DumpPrincipal) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException) DumpAll(org.bedework.dumprestore.dump.dumpling.DumpAll)

Aggregations

BwPrincipal (org.bedework.calfacade.BwPrincipal)1 CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)1 DumpAliases (org.bedework.dumprestore.dump.dumpling.DumpAliases)1 DumpAll (org.bedework.dumprestore.dump.dumpling.DumpAll)1 DumpPrincipal (org.bedework.dumprestore.prdump.DumpPrincipal)1 DumpPublic (org.bedework.dumprestore.prdump.DumpPublic)1 DumpSystem (org.bedework.dumprestore.prdump.DumpSystem)1