Search in sources :

Example 1 with RestorePrincipal

use of org.bedework.dumprestore.nrestore.RestorePrincipal in project bw-calendar-engine by Bedework.

the class Restore method restoreUser.

/**
 * Restore a single user from a new style dump.
 *
 * @param account of user
 * @param merge don't replace entities - add new ones.
 * @param info - to track status
 * @return true if restored - otherwise there's a message
 * @throws CalFacadeException on error
 */
public boolean restoreUser(final String account, final boolean merge, final boolean dryRun, final InfoLines info) throws CalFacadeException {
    globals.setRoots(getSvci());
    final BwPrincipal userPr = BwPrincipal.makeUserPrincipal();
    userPr.setAccount(account);
    userPr.setPrincipalRef(Util.buildPath(colPathEndsWithSlash, RestoreGlobals.getUserPrincipalRoot(), "/", account));
    globals.info = info;
    globals.setPrincipalHref(userPr);
    globals.setMerging(merge);
    globals.setDryRun(dryRun);
    try (RestorePrincipal restorer = new RestorePrincipal(globals)) {
        restorer.open(userPr);
        restorer.doRestore();
    }
    return true;
}
Also used : BwPrincipal(org.bedework.calfacade.BwPrincipal) RestorePrincipal(org.bedework.dumprestore.nrestore.RestorePrincipal)

Aggregations

BwPrincipal (org.bedework.calfacade.BwPrincipal)1 RestorePrincipal (org.bedework.dumprestore.nrestore.RestorePrincipal)1