Search in sources :

Example 1 with PaginationDataVO

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

the class ServerManageResource method getServers.

@Path("servers")
@POST
public PaginationDataVO<List<ServerInfoVO>> getServers(Pagination pagination) {
    if (pagination == null) {
        pagination = new Pagination();
    }
    try {
        Map<String, JSONObject> map = serverManageService.getServerInfos(pagination);
        List<ServerInfoVO> list = new ArrayList<>();
        map.values().forEach(json -> list.add(new ServerInfoVO(json)));
        return new PaginationDataVO<>(pagination, list);
    } catch (UserInterfaceErrorException ex) {
        return new PaginationDataVO<>(ex);
    }
}
Also used : Pagination(org.mx.dal.Pagination) PaginationDataVO(org.mx.rest.vo.PaginationDataVO) JSONObject(com.alibaba.fastjson.JSONObject) ServerInfoVO(com.ds.retl.rest.vo.server.ServerInfoVO) UserInterfaceErrorException(com.ds.retl.exception.UserInterfaceErrorException) ArrayList(java.util.ArrayList)

Aggregations

JSONObject (com.alibaba.fastjson.JSONObject)1 UserInterfaceErrorException (com.ds.retl.exception.UserInterfaceErrorException)1 ServerInfoVO (com.ds.retl.rest.vo.server.ServerInfoVO)1 ArrayList (java.util.ArrayList)1 Pagination (org.mx.dal.Pagination)1 PaginationDataVO (org.mx.rest.vo.PaginationDataVO)1