@Test public void testCreate() throws Exception { try (Session dir1 = memdir1.getSession(); Session dir2 = memdir2.getSession(); Session dir3 = memdir3.getSession()) { Map<String, Object> map = new HashMap<>(); map.put("uid", "5"); map.put("thefoo", "foo5"); map.put("thebar", "bar5"); DocumentModel entry = dir.createEntry(map); assertEquals("5", entry.getProperty("schema3", "uid")); assertEquals("foo5", entry.getProperty("schema3", "thefoo")); assertEquals("bar5", entry.getProperty("schema3", "thebar")); boolean exceptionThrwon = false; try { assertNull(entry.getProperty("schema3", "xyz")); } catch (PropertyNotFoundException ce) { exceptionThrwon = true; } assertTrue(exceptionThrwon); assertNotNull(dir1.getEntry("5")); assertEquals("foo5", dir1.getEntry("5").getProperty("schema1", "foo")); assertNotNull(dir2.getEntry("5")); assertEquals("bar5", dir2.getEntry("5").getProperty("schema2", "bar")); assertNull(dir3.getEntry("5")); map = new HashMap<>(); map.put("uid", "5"); try { entry = dir.createEntry(map); fail("Should raise an error, entry already exists"); } catch (DirectoryException e) { } } }
@Override public MultiDirectorySession getSession() { MultiDirectorySession session = new MultiDirectorySession(this); addSession(session); return session; }
MultiDirectory extends AbstractDirectory { @Override public MultiDirectorySession getSession() { MultiDirectorySession session = new MultiDirectorySession(this); addSession(session); return session; } }
MultiDirectory extends AbstractDirectory { @Override public MultiDirectorySession getSession() { MultiDirectorySession session = new MultiDirectorySession(this); addSession(session); return session; } MultiDirectory(MultiDirectoryDescriptor descriptor); }
MultiDirectory extends AbstractDirectory { @Override public MultiDirectorySession getSession() { MultiDirectorySession session = new MultiDirectorySession(this); addSession(session); return session; } MultiDirectory(MultiDirectoryDescriptor descriptor); @Override MultiDirectoryDescriptor getDescriptor(); @Override MultiDirectorySession getSession(); @Override List<Reference> getReferences(String referenceFieldName); @Override void invalidateDirectoryCache(); }
MultiDirectory extends AbstractDirectory { @Override public MultiDirectorySession getSession() { MultiDirectorySession session = new MultiDirectorySession(this); addSession(session); return session; } MultiDirectory(MultiDirectoryDescriptor descriptor); @Override MultiDirectoryDescriptor getDescriptor(); @Override MultiDirectorySession getSession(); @Override List<Reference> getReferences(String referenceFieldName); @Override void invalidateDirectoryCache();  }