use of org.bimserver.database.actions.GetUserByUserNameDatabaseAction in project BIMserver by opensourceBIM.
the class ServiceImpl method getUserByUserName.
@Override
public SUser getUserByUserName(String username) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
BimDatabaseAction<User> action = new GetUserByUserNameDatabaseAction(session, getInternalAccessMethod(), username);
SUser convert = getBimServer().getSConverter().convertToSObject(session.executeAndCommitAction(action));
if (convert == null) {
throw new UserException("User with username \"" + username + "\" not found");
}
return convert;
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
Aggregations