Changeset 1779


Ignore:
Timestamp:
02/27/12 15:36:59 (12 years ago)
Author:
twagoo
Message:

Created wicket page that allows a logged in user to set configure its display name

Location:
ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/UserDao.java

    r1696 r1779  
    5050     */
    5151    public Number insertUser(RegistryUser user) throws DataAccessException {
    52         SimpleJdbcInsert insert = new SimpleJdbcInsert(getDataSource()).
    53                 withTableName(TABLE_REGISTRY_USER).usingGeneratedKeyColumns(
     52        SimpleJdbcInsert insert = new SimpleJdbcInsert(getDataSource()).withTableName(TABLE_REGISTRY_USER).usingGeneratedKeyColumns(
    5453                COLUMN_ID);
    5554
     
    5857        params.put("principal_name", user.getPrincipalName());
    5958        return insert.executeAndReturnKey(params);
     59    }
     60
     61    /**
     62     * Updates some data stored about the user. At this point only the display name will be updated. ID is taken from 'id' parameter,
     63     * not user object.
     64     * @param id ID of user to update
     65     * @param user object containing new info
     66     */
     67    public void updateUser(Number id, RegistryUser user) throws DataAccessException {
     68        String updateString = String.format("UPDATE %1$s SET name = ? WHERE %2$s = ?", TABLE_REGISTRY_USER, COLUMN_ID);
     69        getSimpleJdbcTemplate().update(updateString, user.getName(), id);
    6070    }
    6171
Note: See TracChangeset for help on using the changeset viewer.