/** * @see io.apiman.manager.api.core.IStorage#getUser(java.lang.String) */ @Override public UserBean getUser(String userId) throws StorageException { return this.delegate.getUser(userId); }
/** * @see io.apiman.manager.api.rest.contract.IUserResource#get(java.lang.String) */ @Override public UserBean get(String userId) throws UserNotFoundException { try { storage.beginTx(); UserBean user = storage.getUser(userId); if (user == null) { throw ExceptionFactory.userNotFoundException(userId); } return user; } catch (StorageException e) { throw new SystemErrorException(e); } finally { storage.rollbackTx(); } }
/** * @see io.apiman.manager.api.rest.contract.IUserResource#get(java.lang.String) */ @Override public UserBean get(String userId) throws UserNotFoundException { try { storage.beginTx(); UserBean user = storage.getUser(userId); if (user == null) { throw ExceptionFactory.userNotFoundException(userId); } return user; } catch (StorageException e) { throw new SystemErrorException(e); } finally { storage.rollbackTx(); } }
/** * @see io.apiman.manager.api.exportimport.read.IImportReaderDispatcher#user(io.apiman.manager.api.beans.idm.UserBean) */ @Override public void user(UserBean user) { try { logger.info(Messages.i18n.format("StorageImportDispatcher.ImportingUser") + user.getUsername()); //$NON-NLS-1$ UserBean userBean = storage.getUser(user.getUsername()); if (userBean == null) { storage.createUser(user); } else { storage.updateUser(user); } } catch (StorageException e) { error(e); } }
UserBean user = storage.getUser(userId); member = new MemberBean(); member.setEmail(user.getEmail());
UserBean user = storage.getUser(userId); member = new MemberBean(); member.setEmail(user.getEmail());
/** * @see io.apiman.manager.api.rest.contract.IUserResource#update(java.lang.String, io.apiman.manager.api.beans.idm.UpdateUserBean) */ @Override public void update(String userId, UpdateUserBean user) throws UserNotFoundException, NotAuthorizedException { if (!securityContext.isAdmin() && !securityContext.getCurrentUser().equals(userId)) throw ExceptionFactory.notAuthorizedException(); try { storage.beginTx(); UserBean updatedUser = storage.getUser(userId); if (updatedUser == null) { throw ExceptionFactory.userNotFoundException(userId); } if (user.getEmail() != null) { updatedUser.setEmail(user.getEmail()); } if (user.getFullName() != null) { updatedUser.setFullName(user.getFullName()); } storage.updateUser(updatedUser); storage.commitTx(); } catch (StorageException e) { storage.rollbackTx(); throw new SystemErrorException(e); } }
/** * @see io.apiman.manager.api.rest.contract.ICurrentUserResource#updateInfo(io.apiman.manager.api.beans.idm.UpdateUserBean) */ @Override public void updateInfo(UpdateUserBean info) { try { storage.beginTx(); UserBean user = storage.getUser(securityContext.getCurrentUser()); if (user == null) { throw new StorageException("User not found: " + securityContext.getCurrentUser()); //$NON-NLS-1$ } if (info.getEmail() != null) { user.setEmail(info.getEmail()); } if (info.getFullName() != null) { user.setFullName(info.getFullName()); } storage.updateUser(user); storage.commitTx(); log.debug(String.format("Successfully updated user %s: %s", user.getUsername(), user)); //$NON-NLS-1$ } catch (StorageException e) { storage.rollbackTx(); throw new SystemErrorException(e); } }
/** * @see io.apiman.manager.api.rest.contract.IUserResource#update(java.lang.String, io.apiman.manager.api.beans.idm.UpdateUserBean) */ @Override public void update(String userId, UpdateUserBean user) throws UserNotFoundException, NotAuthorizedException { if (!securityContext.isAdmin() && !securityContext.getCurrentUser().equals(userId)) throw ExceptionFactory.notAuthorizedException(); try { storage.beginTx(); UserBean updatedUser = storage.getUser(userId); if (updatedUser == null) { throw ExceptionFactory.userNotFoundException(userId); } if (user.getEmail() != null) { updatedUser.setEmail(user.getEmail()); } if (user.getFullName() != null) { updatedUser.setFullName(user.getFullName()); } storage.updateUser(updatedUser); storage.commitTx(); } catch (StorageException e) { storage.rollbackTx(); throw new SystemErrorException(e); } }
/** * @see io.apiman.manager.api.rest.contract.ICurrentUserResource#updateInfo(io.apiman.manager.api.beans.idm.UpdateUserBean) */ @Override public void updateInfo(UpdateUserBean info) { try { storage.beginTx(); UserBean user = storage.getUser(securityContext.getCurrentUser()); if (user == null) { throw new StorageException("User not found: " + securityContext.getCurrentUser()); //$NON-NLS-1$ } if (info.getEmail() != null) { user.setEmail(info.getEmail()); } if (info.getFullName() != null) { user.setFullName(info.getFullName()); } storage.updateUser(user); storage.commitTx(); log.debug(String.format("Successfully updated user %s: %s", user.getUsername(), user)); //$NON-NLS-1$ } catch (StorageException e) { storage.rollbackTx(); throw new SystemErrorException(e); } }
storage.beginTx(); try { user = storage.getUser(userId); } finally { storage.rollbackTx();
storage.beginTx(); try { user = storage.getUser(userId); } finally { storage.rollbackTx();