use of org.mx.error.UserInterfaceSystemErrorException in project main by JohnPeng739.
the class RoleManageResource method deleteRole.
@Path("roles/{id}")
@DELETE
@AuthenticateAround(returnValueClass = DataVO.class)
public DataVO<RoleVO> deleteRole(@QueryParam("userCode") String userCode, @PathParam("id") String id) {
sessionDataStore.setCurrentUserCode(userCode);
try {
Role role = accessor.remove(id, Role.class);
RoleVO vo = RoleVO.transform(role, true);
sessionDataStore.removeCurrentUserCode();
return new DataVO<>(vo);
} catch (UserInterfaceException ex) {
return new DataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error("Delete role fail.", ex);
}
return new DataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
use of org.mx.error.UserInterfaceSystemErrorException in project main by JohnPeng739.
the class UserManageResource method allocateAccount.
@Path("users/{userId}/allocate")
@POST
@AuthenticateAround(returnValueClass = DataVO.class)
public DataVO<AccountVO> allocateAccount(@QueryParam("userCode") String userCode, @PathParam("userId") String userId, AccountInfoVO accountInfoVO) {
sessionDataStore.setCurrentUserCode(userCode);
try {
accountInfoVO.setOwnerId(userId);
Account account = userManageService.allocateAccount(accountInfoVO.getAccountInfo());
AccountVO accountVO = AccountVO.transform(account, true);
sessionDataStore.removeCurrentUserCode();
return new DataVO<>(accountVO);
} catch (UserInterfaceException ex) {
return new DataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error("Allocate account fail.", ex);
}
return new DataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
use of org.mx.error.UserInterfaceSystemErrorException in project main by JohnPeng739.
the class UserManageResource method newUser.
@Path("users/new")
@POST
@AuthenticateAround(returnValueClass = DataVO.class)
public DataVO<UserVO> newUser(@QueryParam("userCode") String userCode, UserInfoVO userInfoVO) {
sessionDataStore.setCurrentUserCode(userCode);
try {
userInfoVO.setId(null);
User user = userManageService.saveUser(userInfoVO.getUserInfo());
UserVO userVO = UserVO.transform(user);
sessionDataStore.removeCurrentUserCode();
return new DataVO<>(userVO);
} catch (UserInterfaceException ex) {
return new DataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error("Create a user fail.", ex);
}
return new DataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
use of org.mx.error.UserInterfaceSystemErrorException in project main by JohnPeng739.
the class UserManageResource method deleteUser.
@Path("users/{userId}")
@DELETE
@AuthenticateAround(returnValueClass = DataVO.class)
public DataVO<UserVO> deleteUser(@QueryParam("userCode") String userCode, @PathParam("userId") String userId) {
sessionDataStore.setCurrentUserCode(userCode);
try {
User user = accessor.remove(userId, User.class);
UserVO userVO = UserVO.transform(user);
sessionDataStore.removeCurrentUserCode();
return new DataVO<>(userVO);
} catch (UserInterfaceException ex) {
return new DataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error("Delete user fail.", ex);
}
return new DataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
use of org.mx.error.UserInterfaceSystemErrorException in project main by JohnPeng739.
the class UserManageResource method saveUser.
@Path("users/{userId}")
@PUT
@AuthenticateAround(returnValueClass = DataVO.class)
public DataVO<UserVO> saveUser(@QueryParam("userCode") String userCode, @PathParam("userId") String userId, UserInfoVO userInfoVO) {
sessionDataStore.setCurrentUserCode(userCode);
try {
userInfoVO.setId(userId);
User user = userManageService.saveUser(userInfoVO.getUserInfo());
UserVO userVO = UserVO.transform(user);
sessionDataStore.removeCurrentUserCode();
return new DataVO<>(userVO);
} catch (UserInterfaceException ex) {
return new DataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error("Save user fail.", ex);
}
return new DataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
Aggregations