Class UserImporter

  • All Implemented Interfaces:
    ProtectedItemImporter, ProtectedNodeImporter, ProtectedPropertyImporter

    public class UserImporter
    extends Object
    implements ProtectedPropertyImporter, ProtectedNodeImporter
    UserImporter implements a DefaultProtectedPropertyImporter and DefaultProtectedNodeImporter that is able to deal with user/group content as defined by the default user related node types present with jackrabbit-core.

    The importer is intended to be used by applications that import user content extracted from another repository instance and immediately persist the imported content using Session.save(). Omitting the save call will lead to transient, semi-validated user content and eventually to inconsistencies.

    Note the following restrictions:

    • The importer will only be initialized if the user manager is an instance of UserPerWorkspaceUserManager.
    • The importer will only be initialized if the editing session starting this import is the same as the UserManager's Session instance.
    • The jcr:uuid property of user and groups is defined to represent the hashed authorizable id as calculated by the UserManager. This importer is therefore not able to handle imports with ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW.
    • Importing user/group nodes outside of the hierarchy defined by UserManagerImpl.getUsersPath() and UserManagerImpl.getGroupsPath() will fail upon save as the mandatory properties will not be imported. The same may be true in case of ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING inserting the user/group node at some other place in the node hierarchy.
    • While creating user/groups through the API the UserManagerImpl makes sure that authorizables are never nested and are created below a hierarchy of nt:AuthorizableFolder nodes. This isn't enforced by means of node type constraints but only by the API. This importer currently doesn't perform such a validation check.
    • Any attempt to import conflicting data will cause the import to fail either immediately or upon calling Session.save() with the following exceptions:
      • rep:members : Group membership
      • rep:impersonators : Impersonators of a User.
      The import behavior of these two properties is defined by the PARAM_IMPORT_BEHAVIOR configuration parameter, which can be set to
      • ignore: A warning is logged.
      • best effort: A warning is logged and the importer tries to fix the problem.
      • abort: The import is immediately aborted with a ConstraintViolationException. (default)
    Known Issue:
    Importing rep:impersonators property referring to principals that are created during this import AND have principalName different from the ID will no succeed, as the validation in ImpersonationImpl isn't able to find the authorizable with the given principal (reason: query will only find persisted content).