@Test public void testGetEntries() throws Exception { Session session = getSession(); try { DocumentModelList entries = session.getEntries(); assertEquals(3, entries.size()); Map<String, DocumentModel> entryMap = new HashMap<String, DocumentModel>(); for (DocumentModel entry : entries) { entryMap.put(entry.getId(), entry); } DocumentModel dm = entryMap.get("user_1"); assertNotNull(dm); assertEquals("user_1", dm.getProperty(SCHEMA, "username")); assertEquals("pass_1", dm.getProperty(SCHEMA, "password")); assertCalendarEquals(getCalendar(2007, 9, 7, 14, 36, 28, 0), (Calendar) dm.getProperty(SCHEMA, "dateField")); assertEquals(Long.valueOf(3), dm.getProperty(SCHEMA, "intField")); assertTrue((Boolean) dm.getProperty(SCHEMA, "booleanField")); dm = entryMap.get("Administrator"); assertNotNull(dm); assertEquals("Administrator", dm.getProperty(SCHEMA, "username")); assertEquals("Administrator", dm.getProperty(SCHEMA, "password")); assertEquals(Long.valueOf(10), dm.getProperty(SCHEMA, "intField")); assertCalendarEquals(getCalendar(1982, 3, 25, 16, 30, 47, 123), (Calendar) dm.getProperty(SCHEMA, "dateField")); dm = entryMap.get("user_3"); assertFalse((Boolean) dm.getProperty(SCHEMA, "booleanField")); } finally { session.close(); } session = getSession("groupDirectory"); try { DocumentModel doc = session.getEntry("administrators"); assertEquals("administrators", doc.getPropertyValue("group:groupname")); assertEquals("Administrators group", doc.getPropertyValue("group:grouplabel")); doc = session.getEntry("group_1"); assertEquals("group_1", doc.getPropertyValue("group:groupname")); Serializable label = doc.getPropertyValue("group:grouplabel"); if (label != null) { assertEquals("", label); } } finally { session.close(); } }
@Override public synchronized Session getSession() throws DirectoryException { if (dialect == null) { initConnection(); } SQLSession session = new SQLSession(this, config, managedSQLSession); addSession(session); return session; }
SQLDirectory extends AbstractDirectory { @Override public synchronized Session getSession() throws DirectoryException { if (dialect == null) { initConnection(); } SQLSession session = new SQLSession(this, config, managedSQLSession); addSession(session); return session; } }
SQLDirectory extends AbstractDirectory { @Override public synchronized Session getSession() throws DirectoryException { if (dialect == null) { initConnection(); } SQLSession session = new SQLSession(this, config, managedSQLSession); addSession(session); return session; } SQLDirectory(SQLDirectoryDescriptor config); }
SQLDirectory extends AbstractDirectory { @Override public synchronized Session getSession() throws DirectoryException { if (dialect == null) { initConnection(); } SQLSession session = new SQLSession(this, config, managedSQLSession); addSession(session); return session; } SQLDirectory(SQLDirectoryDescriptor config); SQLDirectoryDescriptor getConfig(); Connection getConnection(); @Override String getName(); @Override String getSchema(); @Override String getParentDirectory(); @Override String getIdField(); @Override String getPasswordField(); @Override synchronized Session getSession(); Map<String, Field> getSchemaFieldMap(); List<String> getStoredFieldNames(); Table getTable(); Dialect getDialect(); boolean useNativeCase(); @Override boolean isMultiTenant(); @Override String toString(); }
SQLDirectory extends AbstractDirectory { @Override public synchronized Session getSession() throws DirectoryException { if (dialect == null) { initConnection(); } SQLSession session = new SQLSession(this, config, managedSQLSession); addSession(session); return session; } SQLDirectory(SQLDirectoryDescriptor config); SQLDirectoryDescriptor getConfig(); Connection getConnection(); @Override String getName(); @Override String getSchema(); @Override String getParentDirectory(); @Override String getIdField(); @Override String getPasswordField(); @Override synchronized Session getSession(); Map<String, Field> getSchemaFieldMap(); List<String> getStoredFieldNames(); Table getTable(); Dialect getDialect(); boolean useNativeCase(); @Override boolean isMultiTenant(); @Override String toString(); static final Log log; static final String TENANT_ID_FIELD; static final int MAX_CONNECTION_TRIES; }