use of org.mx.error.UserInterfaceSystemErrorException in project main by JohnPeng739.
the class RoleManageResource method saveRole.
@Path("roles/new")
@POST
@AuthenticateAround(returnValueClass = DataVO.class)
public DataVO<RoleVO> saveRole(@QueryParam("userCode") String userCode, RoleInfoVO roleInfoVO) {
sessionDataStore.setCurrentUserCode(userCode);
try {
roleInfoVO.setId(null);
Role role = roleManageService.saveRole(roleInfoVO.getRoleInfo());
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("Save 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 RoleManageResource method roles.
@Path("roles")
@POST
@AuthenticateAround(returnValueClass = PaginationDataVO.class)
public PaginationDataVO<List<RoleVO>> roles(Pagination pagination) {
if (pagination == null) {
pagination = new Pagination();
}
try {
List<Role> roles = accessor.list(pagination, Role.class);
List<RoleVO> vos = RoleVO.transform(roles);
return new PaginationDataVO<>(pagination, vos);
} catch (UserInterfaceException ex) {
return new PaginationDataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error("List roles fail.", ex);
}
return new PaginationDataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
use of org.mx.error.UserInterfaceSystemErrorException in project main by JohnPeng739.
the class UserManageResource method listUsersPagination.
@Path("users")
@POST
@AuthenticateAround(returnValueClass = PaginationDataVO.class)
public PaginationDataVO<List<UserVO>> listUsersPagination(Pagination pagination) {
if (pagination == null) {
pagination = new Pagination();
}
try {
List<User> users = accessor.list(pagination, User.class);
List<UserVO> userVOs = UserVO.transform(users);
return new PaginationDataVO<>(pagination, userVOs);
} catch (UserInterfaceException ex) {
return new PaginationDataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error("List users fail.", ex);
}
return new PaginationDataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
use of org.mx.error.UserInterfaceSystemErrorException in project main by JohnPeng739.
the class AccountManageResource method changePersonal.
@Path("accounts/{id}/personal/change")
@POST
@AuthenticateAround(returnValueClass = DataVO.class)
public DataVO<AccountVO> changePersonal(@PathParam("id") String id, @QueryParam("userCode") String userCode, ChangePersonalVO vo) {
sessionDataStore.setCurrentUserCode(userCode);
if (vo == null) {
return new DataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_ILLEGAL_PARAM));
}
try {
Account account = accountManageService.changePersonal(vo.getAccountPersonalInfo());
AccountVO accountVO = AccountVO.transform(account, true);
sessionDataStore.removeCurrentUserCode();
return new DataVO<>(accountVO);
} catch (UserInterfaceException ex) {
return new DataVO<>(ex);
}
}
use of org.mx.error.UserInterfaceSystemErrorException in project main by JohnPeng739.
the class AccountManageResource method logs.
@Path("logs")
@POST
@AuthenticateAround(returnValueClass = PaginationDataVO.class)
public PaginationDataVO<List<OperateLogVO>> logs(Pagination pagination, @Context Request request) {
if (pagination == null) {
pagination = new Pagination();
}
try {
List<OperateLog> logs = accessor.list(pagination, OperateLog.class);
List<OperateLogVO> vos = OperateLogVO.transform(logs);
return new PaginationDataVO(pagination, vos);
} catch (UserInterfaceException ex) {
return new PaginationDataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error("List logs fail.", ex);
}
return new PaginationDataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
Aggregations