use of org.smartdata.common.actions.ActionInfoComparator in project SSM by Intel-bigdata.
the class CommandExecutor method listNewCreatedActions.
public List<ActionInfo> listNewCreatedActions(int maxNumActions) throws IOException {
ArrayList<ActionInfo> actionInfos = new ArrayList<>();
boolean flag = true;
for (Command cmd : commandPool.getcommands()) {
long cmdId = cmd.getId();
for (SmartAction smartAction : cmd.getActions()) {
ActionStatus status = smartAction.getActionStatus();
actionInfos.add(new ActionInfo(status.getId(), cmdId, smartAction.getName(), smartAction.getArguments(), status.getResultPrintStream().toString(), status.getLogPrintStream().toString(), status.isSuccessful(), status.getStartTime(), status.isSuccessful(), status.getRunningTime(), status.getPercentage()));
}
}
// Sort and get top maxNumActions
Collections.sort(actionInfos, new ActionInfoComparator());
if (maxNumActions >= actionInfos.size()) {
return actionInfos;
} else {
return actionInfos.subList(0, maxNumActions);
}
}
Aggregations