use of com.cloud.alert.Alert in project CloudStack-archive by CloudStack-extras.
the class ListAlertsCmd method execute.
@Override
public void execute() {
List<? extends Alert> result = _mgr.searchForAlerts(this);
ListResponse<AlertResponse> response = new ListResponse<AlertResponse>();
List<AlertResponse> alertResponseList = new ArrayList<AlertResponse>();
for (Alert alert : result) {
AlertResponse alertResponse = new AlertResponse();
alertResponse.setId(alert.getId());
alertResponse.setAlertType(alert.getType());
alertResponse.setDescription(alert.getSubject());
alertResponse.setLastSent(alert.getLastSent());
alertResponse.setObjectName("alert");
alertResponseList.add(alertResponse);
}
response.setResponses(alertResponseList);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.alert.Alert in project cloudstack by apache.
the class ListAlertsCmd method execute.
@Override
public void execute() {
Pair<List<? extends Alert>, Integer> result = _mgr.searchForAlerts(this);
ListResponse<AlertResponse> response = new ListResponse<AlertResponse>();
List<AlertResponse> alertResponseList = new ArrayList<AlertResponse>();
for (Alert alert : result.first()) {
AlertResponse alertResponse = new AlertResponse();
alertResponse.setId(alert.getUuid());
alertResponse.setAlertType(alert.getType());
alertResponse.setDescription(alert.getSubject());
alertResponse.setLastSent(alert.getLastSent());
alertResponse.setName(alert.getName());
alertResponse.setObjectName("alert");
alertResponseList.add(alertResponse);
}
response.setResponses(alertResponseList, result.second());
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
Aggregations