Search in sources :

Example 26 with DataVO

use of org.mx.service.rest.vo.DataVO in project main by JohnPeng739.

the class UserManageResource method getUser.

@Path("users/{id}")
@GET
@AuthenticateAround(returnValueClass = DataVO.class)
public DataVO<UserVO> getUser(@PathParam("id") String id) {
    try {
        User user = accessor.getById(id, User.class);
        UserVO userVO = UserVO.transform(user);
        return new DataVO<>(userVO);
    } catch (UserInterfaceException ex) {
        return new DataVO<>(ex);
    } catch (Exception ex) {
        if (logger.isErrorEnabled()) {
            logger.error("Get user fail.", ex);
        }
        return new DataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
    }
}
Also used : User(org.mx.comps.rbac.dal.entity.User) UserVO(org.mx.comps.rbac.rest.vo.UserVO) DataVO(org.mx.service.rest.vo.DataVO) PaginationDataVO(org.mx.service.rest.vo.PaginationDataVO) UserInterfaceException(org.mx.error.UserInterfaceException) UserInterfaceSystemErrorException(org.mx.error.UserInterfaceSystemErrorException) UserInterfaceException(org.mx.error.UserInterfaceException) UserInterfaceSystemErrorException(org.mx.error.UserInterfaceSystemErrorException) AuthenticateAround(org.mx.comps.jwt.AuthenticateAround)

Aggregations

DataVO (org.mx.service.rest.vo.DataVO)26 UserInterfaceException (org.mx.error.UserInterfaceException)24 PaginationDataVO (org.mx.service.rest.vo.PaginationDataVO)24 UserInterfaceSystemErrorException (org.mx.error.UserInterfaceSystemErrorException)23 AuthenticateAround (org.mx.comps.jwt.AuthenticateAround)20 Account (org.mx.comps.rbac.dal.entity.Account)5 User (org.mx.comps.rbac.dal.entity.User)4 UserVO (org.mx.comps.rbac.rest.vo.UserVO)4 Accredit (org.mx.comps.rbac.dal.entity.Accredit)3 Department (org.mx.comps.rbac.dal.entity.Department)3 Privilege (org.mx.comps.rbac.dal.entity.Privilege)3 Role (org.mx.comps.rbac.dal.entity.Role)3 AccreditVO (org.mx.comps.rbac.rest.vo.AccreditVO)3 DepartmentVO (org.mx.comps.rbac.rest.vo.DepartmentVO)3 PrivilegeVO (org.mx.comps.rbac.rest.vo.PrivilegeVO)3 RoleVO (org.mx.comps.rbac.rest.vo.RoleVO)3 LoginHistory (org.mx.comps.rbac.dal.entity.LoginHistory)2 JSONObject (com.alibaba.fastjson.JSONObject)1 Server (org.eclipse.jetty.server.Server)1 Test (org.junit.Test)1