@Test public void testTableReference() throws Exception { Session groupSession = getSession("groupDirectory"); try { Reference membersRef = getDirectory("groupDirectory").getReference( "members"); List<String> administrators = membersRef.getTargetIdsForSource("administrators"); assertEquals(1, administrators.size()); assertTrue(administrators.contains("Administrator")); membersRef.addLinks("administrators", Arrays.asList("user_1")); administrators = membersRef.getTargetIdsForSource("administrators"); assertEquals(2, administrators.size()); assertTrue(administrators.contains("Administrator")); assertTrue(administrators.contains("user_1")); membersRef.addLinks("administrators", Arrays.asList("user_1", "user_2")); administrators = membersRef.getTargetIdsForSource("administrators"); assertEquals(3, administrators.size()); assertTrue(administrators.contains("Administrator")); assertTrue(administrators.contains("user_1")); assertTrue(administrators.contains("user_2")); membersRef.removeLinksForTarget("Administrator"); administrators = membersRef.getTargetIdsForSource("administrators"); assertEquals(2, administrators.size()); assertTrue(administrators.contains("user_1")); assertTrue(administrators.contains("user_2")); membersRef.removeLinksForSource("administrators"); administrators = membersRef.getTargetIdsForSource("administrators"); assertEquals(0, administrators.size()); membersRef.setTargetIdsForSource("administrators", Arrays.asList("user_1", "user_2")); administrators = membersRef.getTargetIdsForSource("administrators"); assertEquals(2, administrators.size()); assertTrue(administrators.contains("user_1")); assertTrue(administrators.contains("user_2")); membersRef.setTargetIdsForSource("administrators", Arrays.asList("user_1", "Administrator")); administrators = membersRef.getTargetIdsForSource("administrators"); assertEquals(2, administrators.size()); assertTrue(administrators.contains("user_1")); assertTrue(administrators.contains("Administrator")); membersRef.setSourceIdsForTarget("Administrator", Arrays.asList("members")); administrators = membersRef.getTargetIdsForSource("administrators"); assertEquals(1, administrators.size()); assertTrue(administrators.contains("user_1")); administrators = membersRef.getSourceIdsForTarget("Administrator"); assertEquals(1, administrators.size()); assertTrue(administrators.contains("members")); } finally { groupSession.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; }