Search in sources :

Example 1 with ServerInfoVO

use of com.ds.retl.rest.vo.server.ServerInfoVO in project main by JohnPeng739.

the class ServerManageResource method deleteServerInfo.

@Path("server/{machineName}")
@DELETE
public DataVO<ServerInfoVO> deleteServerInfo(@QueryParam("userCode") String userCode, @PathParam("machineName") String machineName) {
    sessionDataStore.setCurrentUserCode(userCode);
    try {
        JSONObject json = serverManageService.deleteServerInfo(machineName);
        sessionDataStore.removeCurrentUserCode();
        return new DataVO<>(new ServerInfoVO(json));
    } catch (UserInterfaceErrorException ex) {
        return new DataVO<>(ex);
    }
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) PaginationDataVO(org.mx.rest.vo.PaginationDataVO) DataVO(org.mx.rest.vo.DataVO) ServerInfoVO(com.ds.retl.rest.vo.server.ServerInfoVO) UserInterfaceErrorException(com.ds.retl.exception.UserInterfaceErrorException)

Example 2 with ServerInfoVO

use of com.ds.retl.rest.vo.server.ServerInfoVO 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)

Example 3 with ServerInfoVO

use of com.ds.retl.rest.vo.server.ServerInfoVO in project main by JohnPeng739.

the class ServerManageResource method saveServerInfo.

@Path("server")
@POST
public DataVO<ServerInfoVO> saveServerInfo(@QueryParam("userCode") String userCode, String info) {
    sessionDataStore.setCurrentUserCode(userCode);
    try {
        JSONObject json = serverManageService.saveServerInfo(info);
        sessionDataStore.removeCurrentUserCode();
        return new DataVO<>(new ServerInfoVO(json));
    } catch (UserInterfaceErrorException ex) {
        return new DataVO<>(ex);
    }
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) PaginationDataVO(org.mx.rest.vo.PaginationDataVO) DataVO(org.mx.rest.vo.DataVO) ServerInfoVO(com.ds.retl.rest.vo.server.ServerInfoVO) UserInterfaceErrorException(com.ds.retl.exception.UserInterfaceErrorException)

Aggregations

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