@Test public void testPropertiesCompletedClearsCache() throws Exception { Tree userTree = createUserTree(); Tree cacheTree = userTree.addChild(CacheConstants.REP_CACHE); cacheTree.setProperty(JcrConstants.JCR_PRIMARYTYPE, CacheConstants.NT_REP_CACHE); importer.propertiesCompleted(cacheTree); assertFalse(cacheTree.exists()); assertFalse(userTree.hasChild(CacheConstants.REP_CACHE)); }
@Override public void propertiesCompleted(@NotNull Tree protectedParent) throws RepositoryException { if (isCacheNode(protectedParent)) { protectedParent.remove(); } else { Authorizable a = userManager.getAuthorizable(protectedParent); if (a == null) { return; } if (!protectedParent.hasProperty(REP_AUTHORIZABLE_ID)) { protectedParent.setProperty(REP_AUTHORIZABLE_ID, a.getID(), Type.STRING); } if (protectedParent.getStatus() == Tree.Status.NEW) { if (a.isGroup()) { userManager.onCreate((Group) a); } else { userManager.onCreate((User) a, currentPw); } } currentPw = null; } }
UserImporter implements ProtectedPropertyImporter, ProtectedNodeImporter, UserConstants { @Override public void propertiesCompleted(@NotNull Tree protectedParent) throws RepositoryException { if (isCacheNode(protectedParent)) { protectedParent.remove(); } else { Authorizable a = userManager.getAuthorizable(protectedParent); if (a == null) { return; } if (!protectedParent.hasProperty(REP_AUTHORIZABLE_ID)) { protectedParent.setProperty(REP_AUTHORIZABLE_ID, a.getID(), Type.STRING); } if (protectedParent.getStatus() == Tree.Status.NEW) { if (a.isGroup()) { userManager.onCreate((Group) a); } else { userManager.onCreate((User) a, currentPw); } } currentPw = null; } } }
UserImporter implements ProtectedPropertyImporter, ProtectedNodeImporter, UserConstants { @Override public void propertiesCompleted(@NotNull Tree protectedParent) throws RepositoryException { if (isCacheNode(protectedParent)) { protectedParent.remove(); } else { Authorizable a = userManager.getAuthorizable(protectedParent); if (a == null) { return; } if (!protectedParent.hasProperty(REP_AUTHORIZABLE_ID)) { protectedParent.setProperty(REP_AUTHORIZABLE_ID, a.getID(), Type.STRING); } if (protectedParent.getStatus() == Tree.Status.NEW) { if (a.isGroup()) { userManager.onCreate((Group) a); } else { userManager.onCreate((User) a, currentPw); } } currentPw = null; } } UserImporter(ConfigurationParameters config); }
UserImporter implements ProtectedPropertyImporter, ProtectedNodeImporter, UserConstants { @Override public void propertiesCompleted(@NotNull Tree protectedParent) throws RepositoryException { if (isCacheNode(protectedParent)) { protectedParent.remove(); } else { Authorizable a = userManager.getAuthorizable(protectedParent); if (a == null) { return; } if (!protectedParent.hasProperty(REP_AUTHORIZABLE_ID)) { protectedParent.setProperty(REP_AUTHORIZABLE_ID, a.getID(), Type.STRING); } if (protectedParent.getStatus() == Tree.Status.NEW) { if (a.isGroup()) { userManager.onCreate((Group) a); } else { userManager.onCreate((User) a, currentPw); } } currentPw = null; } } UserImporter(ConfigurationParameters config); @Override boolean init(@NotNull Session session, @NotNull Root root, @NotNull NamePathMapper namePathMapper,
            boolean isWorkspaceImport, int uuidBehavior,
            @NotNull ReferenceChangeTracker referenceTracker, @NotNull SecurityProvider securityProvider); @Override boolean handlePropInfo(@NotNull Tree parent, @NotNull PropInfo propInfo, @NotNull PropertyDefinition def); @Override void propertiesCompleted(@NotNull Tree protectedParent); @Override void processReferences(); @Override boolean start(@NotNull Tree protectedParent); @Override void startChildInfo(@NotNull NodeInfo childInfo, @NotNull List<PropInfo> propInfos); @Override void endChildInfo(); @Override void end(@NotNull Tree protectedParent); }
UserImporter implements ProtectedPropertyImporter, ProtectedNodeImporter, UserConstants { @Override public void propertiesCompleted(@NotNull Tree protectedParent) throws RepositoryException { if (isCacheNode(protectedParent)) { protectedParent.remove(); } else { Authorizable a = userManager.getAuthorizable(protectedParent); if (a == null) { return; } if (!protectedParent.hasProperty(REP_AUTHORIZABLE_ID)) { protectedParent.setProperty(REP_AUTHORIZABLE_ID, a.getID(), Type.STRING); } if (protectedParent.getStatus() == Tree.Status.NEW) { if (a.isGroup()) { userManager.onCreate((Group) a); } else { userManager.onCreate((User) a, currentPw); } } currentPw = null; } } UserImporter(ConfigurationParameters config); @Override boolean init(@NotNull Session session, @NotNull Root root, @NotNull NamePathMapper namePathMapper,
            boolean isWorkspaceImport, int uuidBehavior,
            @NotNull ReferenceChangeTracker referenceTracker, @NotNull SecurityProvider securityProvider); @Override boolean handlePropInfo(@NotNull Tree parent, @NotNull PropInfo propInfo, @NotNull PropertyDefinition def); @Override void propertiesCompleted(@NotNull Tree protectedParent); @Override void processReferences(); @Override boolean start(@NotNull Tree protectedParent); @Override void startChildInfo(@NotNull NodeInfo childInfo, @NotNull List<PropInfo> propInfos); @Override void endChildInfo(); @Override void end(@NotNull Tree protectedParent);  }