Search in sources :

Example 1 with Pagination

use of org.mx.dal.Pagination in project main by JohnPeng739.

the class AccountManageResource method loginHistories.

@Path("loginHistories")
@POST
@AuthenticateAround(returnValueClass = PaginationDataVO.class)
public PaginationDataVO<List<LoginHistoryVO>> loginHistories(Pagination pagination) {
    if (pagination == null) {
        pagination = new Pagination();
    }
    try {
        List<LoginHistory> histories = accessor.list(pagination, LoginHistory.class);
        List<LoginHistoryVO> vos = LoginHistoryVO.transform(histories);
        return new PaginationDataVO(pagination, vos);
    } catch (UserInterfaceException ex) {
        return new PaginationDataVO<>(ex);
    } catch (Exception ex) {
        if (logger.isErrorEnabled()) {
            logger.error("List login histories fail.", ex);
        }
        return new PaginationDataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
    }
}
Also used : Pagination(org.mx.dal.Pagination) PaginationDataVO(org.mx.service.rest.vo.PaginationDataVO) LoginHistory(org.mx.comps.rbac.dal.entity.LoginHistory) 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)

Example 2 with Pagination

use of org.mx.dal.Pagination in project main by JohnPeng739.

the class AccreditManageResource method accredits.

@Path("accredits")
@POST
@AuthenticateAround(returnValueClass = PaginationDataVO.class)
public PaginationDataVO<List<AccreditVO>> accredits(Pagination pagination) {
    if (pagination == null) {
        pagination = new Pagination();
    }
    try {
        List<Accredit> accredits = accessor.list(pagination, Accredit.class);
        List<AccreditVO> list = AccreditVO.transform(accredits);
        return new PaginationDataVO<>(pagination, list);
    } catch (UserInterfaceException ex) {
        return new PaginationDataVO<>(ex);
    } catch (Exception ex) {
        if (logger.isErrorEnabled()) {
            logger.error("List accredits fail.", ex);
        }
        return new PaginationDataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
    }
}
Also used : Pagination(org.mx.dal.Pagination) Accredit(org.mx.comps.rbac.dal.entity.Accredit) PaginationDataVO(org.mx.service.rest.vo.PaginationDataVO) AccreditVO(org.mx.comps.rbac.rest.vo.AccreditVO) 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)

Example 3 with Pagination

use of org.mx.dal.Pagination in project main by JohnPeng739.

the class DepartmentManageResource method departments.

@Path("departments")
@POST
@AuthenticateAround(returnValueClass = PaginationDataVO.class)
public PaginationDataVO<List<DepartmentVO>> departments(Pagination pagination) {
    if (pagination == null) {
        pagination = new Pagination();
    }
    try {
        List<Department> departments = accessor.list(pagination, Department.class);
        List<DepartmentVO> vos = DepartmentVO.transform(departments);
        return new PaginationDataVO<>(pagination, vos);
    } catch (UserInterfaceException ex) {
        return new PaginationDataVO<>(ex);
    } catch (Exception ex) {
        if (logger.isErrorEnabled()) {
            logger.error("List departments fail.", ex);
        }
        return new PaginationDataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
    }
}
Also used : Pagination(org.mx.dal.Pagination) Department(org.mx.comps.rbac.dal.entity.Department) PaginationDataVO(org.mx.service.rest.vo.PaginationDataVO) UserInterfaceException(org.mx.error.UserInterfaceException) UserInterfaceSystemErrorException(org.mx.error.UserInterfaceSystemErrorException) DepartmentVO(org.mx.comps.rbac.rest.vo.DepartmentVO) UserInterfaceException(org.mx.error.UserInterfaceException) UserInterfaceSystemErrorException(org.mx.error.UserInterfaceSystemErrorException) AuthenticateAround(org.mx.comps.jwt.AuthenticateAround)

Example 4 with Pagination

use of org.mx.dal.Pagination in project main by JohnPeng739.

the class PrivilegeManageResource method privileges.

@Path("privileges")
@POST
@AuthenticateAround(returnValueClass = PaginationDataVO.class)
public PaginationDataVO<List<PrivilegeVO>> privileges(Pagination pagination) {
    if (pagination == null) {
        pagination = new Pagination();
    }
    try {
        List<Privilege> privileges = accessor.list(pagination, Privilege.class);
        List<PrivilegeVO> vos = PrivilegeVO.transform(privileges);
        return new PaginationDataVO<>(pagination, vos);
    } catch (UserInterfaceException ex) {
        return new PaginationDataVO<>(ex);
    } catch (Exception ex) {
        if (logger.isErrorEnabled()) {
            logger.error("List privileges fail.", ex);
        }
        return new PaginationDataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
    }
}
Also used : Pagination(org.mx.dal.Pagination) PaginationDataVO(org.mx.service.rest.vo.PaginationDataVO) UserInterfaceException(org.mx.error.UserInterfaceException) UserInterfaceSystemErrorException(org.mx.error.UserInterfaceSystemErrorException) PrivilegeVO(org.mx.comps.rbac.rest.vo.PrivilegeVO) Privilege(org.mx.comps.rbac.dal.entity.Privilege) UserInterfaceException(org.mx.error.UserInterfaceException) UserInterfaceSystemErrorException(org.mx.error.UserInterfaceSystemErrorException) AuthenticateAround(org.mx.comps.jwt.AuthenticateAround)

Example 5 with Pagination

use of org.mx.dal.Pagination 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));
    }
}
Also used : Role(org.mx.comps.rbac.dal.entity.Role) Pagination(org.mx.dal.Pagination) RoleVO(org.mx.comps.rbac.rest.vo.RoleVO) 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

Pagination (org.mx.dal.Pagination)10 PaginationDataVO (org.mx.service.rest.vo.PaginationDataVO)8 AuthenticateAround (org.mx.comps.jwt.AuthenticateAround)7 UserInterfaceException (org.mx.error.UserInterfaceException)7 UserInterfaceSystemErrorException (org.mx.error.UserInterfaceSystemErrorException)7 ArrayList (java.util.ArrayList)2 JSONObject (com.alibaba.fastjson.JSONObject)1 UserInterfaceErrorException (com.ds.retl.exception.UserInterfaceErrorException)1 ServerInfoVO (com.ds.retl.rest.vo.server.ServerInfoVO)1 Predicate (java.util.function.Predicate)1 OnlineDevice (org.mx.comps.notify.online.OnlineDevice)1 Accredit (org.mx.comps.rbac.dal.entity.Accredit)1 Department (org.mx.comps.rbac.dal.entity.Department)1 LoginHistory (org.mx.comps.rbac.dal.entity.LoginHistory)1 Privilege (org.mx.comps.rbac.dal.entity.Privilege)1 Role (org.mx.comps.rbac.dal.entity.Role)1 User (org.mx.comps.rbac.dal.entity.User)1 AccreditVO (org.mx.comps.rbac.rest.vo.AccreditVO)1 DepartmentVO (org.mx.comps.rbac.rest.vo.DepartmentVO)1 PrivilegeVO (org.mx.comps.rbac.rest.vo.PrivilegeVO)1