Search in sources :

Example 1 with ActionInfoProto

use of org.smartdata.protocol.AdminServerProto.ActionInfoProto in project SSM by Intel-bigdata.

the class ServerProtocolsServerSideTranslator method listActionInfoOfLastActions.

@Override
public ListActionInfoOfLastActionsResponseProto listActionInfoOfLastActions(RpcController controller, ListActionInfoOfLastActionsRequestProto request) throws ServiceException {
    try {
        List<ActionInfo> list = server.listActionInfoOfLastActions(request.getMaxNumActions());
        if (list == null) {
            return ListActionInfoOfLastActionsResponseProto.newBuilder().build();
        }
        List<ActionInfoProto> protoList = new ArrayList<>();
        for (ActionInfo a : list) {
            protoList.add(ProtoBufferHelper.convert(a));
        }
        return ListActionInfoOfLastActionsResponseProto.newBuilder().addAllActionInfoList(protoList).build();
    } catch (IOException e) {
        throw new ServiceException(e);
    }
}
Also used : ActionInfoProto(org.smartdata.protocol.AdminServerProto.ActionInfoProto) ServiceException(com.google.protobuf.ServiceException) ArrayList(java.util.ArrayList) ActionInfo(org.smartdata.model.ActionInfo) IOException(java.io.IOException)

Example 2 with ActionInfoProto

use of org.smartdata.protocol.AdminServerProto.ActionInfoProto in project SSM by Intel-bigdata.

the class AdminProtocolClientSideTranslator method listActionInfoOfLastActions.

@Override
public List<ActionInfo> listActionInfoOfLastActions(int maxNumActions) throws IOException {
    ListActionInfoOfLastActionsRequestProto req = ListActionInfoOfLastActionsRequestProto.newBuilder().setMaxNumActions(maxNumActions).build();
    try {
        List<ActionInfoProto> protoslist = rpcProxy.listActionInfoOfLastActions(null, req).getActionInfoListList();
        if (protoslist == null) {
            return new ArrayList<>();
        }
        List<ActionInfo> list = new ArrayList<>();
        for (ActionInfoProto infoProto : protoslist) {
            list.add(ProtoBufferHelper.convert(infoProto));
        }
        return list;
    } catch (ServiceException e) {
        throw ProtoBufferHelper.getRemoteException(e);
    }
}
Also used : ListActionInfoOfLastActionsRequestProto(org.smartdata.protocol.AdminServerProto.ListActionInfoOfLastActionsRequestProto) ActionInfoProto(org.smartdata.protocol.AdminServerProto.ActionInfoProto) ServiceException(com.google.protobuf.ServiceException) ArrayList(java.util.ArrayList) ActionInfo(org.smartdata.model.ActionInfo)

Aggregations

ServiceException (com.google.protobuf.ServiceException)2 ArrayList (java.util.ArrayList)2 ActionInfo (org.smartdata.model.ActionInfo)2 ActionInfoProto (org.smartdata.protocol.AdminServerProto.ActionInfoProto)2 IOException (java.io.IOException)1 ListActionInfoOfLastActionsRequestProto (org.smartdata.protocol.AdminServerProto.ListActionInfoOfLastActionsRequestProto)1