class ChecklistExporter {

    static void ensureNamespaces(final @NotNull Session session,
                                 final @NotNull NamespaceMapping namespaces) throws RepositoryException {
        NamespaceRegistry registry = session.getWorkspace().getNamespaceRegistry();
        List<String> registered = Arrays.asList(registry.getURIs());
        namespaces.getURIToPrefixMapping().entrySet().stream()
                .filter(entry -> !entry.getKey().isEmpty() && !entry.getValue().isEmpty())
                .forEachOrdered(uncheckVoid1(entry -> {
                    if (registered.contains(entry.getKey())) {
                        session.setNamespacePrefix(entry.getValue(), entry.getKey());
                    } else {
                        registry.registerNamespace(entry.getValue(), entry.getKey());
                    }
                }));
    }

    private  ChecklistExporter(final List<Op> operations,
                              final List<String> exportTypeDefs,
                              final List<Rule> pathScopes,
                              final List<Rule> nodeTypeFilters,
                              final List<JcrNs> jcrNamespaces);

}