@SuppressWarnings("unchecked") @Test public void testUpdateEntry() throws Exception { Session session = getSession(); try { DocumentModel dm = session.getEntry("user_1"); dm.setProperty(SCHEMA, "username", "user_2"); dm.setProperty(SCHEMA, "password", "pass_2"); dm.setProperty(SCHEMA, "intField", Long.valueOf(2)); dm.setProperty(SCHEMA, "dateField", getCalendar(2001, 2, 3, 4, 5, 6, 7)); dm.setProperty(SCHEMA, "groups", Arrays.asList("administrators", "members")); session.updateEntry(dm); session.close(); session = getSession(); dm = session.getEntry("user_1"); assertEquals("user_1", dm.getProperty(SCHEMA, "username")); String password = (String) dm.getProperty(SCHEMA, "password"); assertFalse("pass_2".equals(password)); assertTrue(PasswordHelper.verifyPassword("pass_2", password)); assertEquals(Long.valueOf(2), dm.getProperty(SCHEMA, "intField")); assertCalendarEquals(getCalendar(2001, 2, 3, 4, 5, 6, 7), (Calendar) dm.getProperty(SCHEMA, "dateField")); List<String> groups = (List<String>) dm.getProperty(SCHEMA, "groups"); assertEquals(2, groups.size()); assertTrue(groups.contains("administrators")); assertTrue(groups.contains("members")); assertNull(session.getEntry("user_2")); dm.setProperty(SCHEMA, "company", "foo"); session.updateEntry(dm); session.close(); session = getSession(); dm = session.getEntry("user_1"); password = (String) dm.getProperty(SCHEMA, "password"); assertFalse("pass_2".equals(password)); assertTrue(PasswordHelper.verifyPassword("pass_2", password)); } 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; }