The import mode defines how importing content is applied to existing content in the repository. It is controlled by the ImportOptions and the WorkspaceFilter and defaults to REPLACE.
It is important to note, that the import mode always operates on entire nodes and subtrees, and never just on properties (with an exception of the group membership). For example an ImportMode.MERGE does not merge the properties from an existing node with those of the package.
If 2 filters overlap, import modes can nest. The filter root that is closest to the node defines which import mode is relevant. for example:
<filter root="/content/foo" mode="replace"/> <filter root="/content/foo/custom" mode="merge"/>
this has the effect, that the node /content/foo is replaced, but the subtree at /content/foo/custom is merged. however, this only works if the package contains /content/foo. if it is missing, the entire subtree at /content/foo is removed.
If an authorizable with the same name already exists, the active ImportMode controls how the existing authorizables are affected:
<filter root="/home/users/test"> <exclude pattern="/home/users/test/.*" /> </filter>
The authorizable are imported using the JCR import content handler and rely on the fact that authorizables have a their UUID computed based on their id. If a repository implementation does not follow this assumption, filevault will need to find a different strategy to import authorizables.
ImportMode.MERGE has special semantics for Groups. In this case, the group members of the package are merged with the existing group members in the repository. This is especially useful when adding a new authorizable including its group membership.
Note that the workspace filter of the package refers on the content of the package and not the existing authorizable. For example, if the package contains a user at /home/users/t/test which already exists in the repository at /home/users/custom/te/test then the workspace filter /home/users/t covers the user, but not /home/users/custom.
However, the importer keeps track of potential remapping of existing users and tries to calculate the filters accordingly.