{
ps.setString( 8, Serializer.serializeToBase64( profile.getAttributes() ) );
}
catch ( IOException e )
{
throw new WikiSecurityException( "Could not save user profile attribute. Reason: " + e.getMessage(), e );
}
ps.setTimestamp( 9, ts );
ps.execute();
ps.close();
// Insert new role record
ps = conn.prepareStatement( m_findRoles );
ps.setString( 1, profile.getLoginName() );
ResultSet rs = ps.executeQuery();
int roles = 0;
while ( rs.next() )
{
roles++;
}
ps.close();
if( roles == 0 )
{
ps = conn.prepareStatement( m_insertRole );
ps.setString( 1, profile.getLoginName() );
ps.setString( 2, m_initialRole );
ps.execute();
ps.close();
}
// Set the profile creation time
profile.setCreated( modDate );
}
else
{
// User exists: modify existing record
ps = conn.prepareStatement( m_updateProfile );
ps.setString( 1, profile.getUid() );
ps.setString( 2, profile.getEmail() );
ps.setString( 3, profile.getFullname() );
ps.setString( 4, password );
ps.setString( 5, profile.getWikiName() );
ps.setTimestamp( 6, ts );
ps.setString( 7, profile.getLoginName() );
try
{
ps.setString( 8, Serializer.serializeToBase64( profile.getAttributes() ) );
}
catch ( IOException e )
{
throw new WikiSecurityException( "Could not save user profile attribute. Reason: " + e.getMessage(), e );
}
ps.setDate( 9, lockExpiry );
ps.setString( 10, profile.getLoginName() );
ps.execute();
ps.close();
}
// Set the profile mod time
profile.setLastModified( modDate );
// Commit and close connection
if( m_supportsCommits )
{
conn.commit();
}
}
catch( SQLException e )
{
throw new WikiSecurityException( e.getMessage(), e );
}
finally
{
try
{