use of com.emc.storageos.model.event.EventRestRep in project coprhd-controller by CoprHD.
the class EventMapper method map.
public static EventRestRep map(ActionableEvent from) {
if (from == null) {
return null;
}
EventRestRep to = new EventRestRep();
mapDataObjectFields(from, to);
to.setTenant(toRelatedResource(ResourceTypeEnum.TENANT, from.getTenant()));
to.setResource(toNamedRelatedResource(from.getResource()));
to.setEventStatus(from.getEventStatus());
to.setDescription(from.getDescription());
to.setWarning(from.getWarning());
to.setEventCode(from.getEventCode());
to.setEventExecutionTime(from.getEventExecutionTime());
if ((from.getTaskIds() != null) && (!from.getTaskIds().isEmpty())) {
List<RelatedResourceRep> taskIds = new ArrayList<RelatedResourceRep>();
for (String task : from.getTaskIds()) {
taskIds.add(toRelatedResource(ResourceTypeEnum.TASK, URI.create(task)));
}
to.setTaskIds(taskIds);
}
if ((from.getApproveDetails() != null) && (!from.getApproveDetails().isEmpty())) {
List<String> approveDetails = new ArrayList<String>();
for (String details : from.getApproveDetails()) {
approveDetails.add(details);
}
to.setApproveDetails(approveDetails);
}
if ((from.getDeclineDetails() != null) && (!from.getDeclineDetails().isEmpty())) {
List<String> declineDetails = new ArrayList<String>();
for (String details : from.getDeclineDetails()) {
declineDetails.add(details);
}
to.setDeclineDetails(declineDetails);
}
return to;
}
use of com.emc.storageos.model.event.EventRestRep in project coprhd-controller by CoprHD.
the class Events method details.
public static void details(String eventId) {
if (StringUtils.isBlank(eventId)) {
listAll();
}
EventRestRep event = EventUtils.getEvent(uri(eventId));
if (event == null) {
flash.error(MessagesUtils.get(UNKNOWN, eventId));
listAll();
}
Common.angularRenderArgs().put("event", getEventSummary(event));
List<String> approveDetails = Lists.newArrayList();
List<String> declineDetails = Lists.newArrayList();
if (event.getEventStatus().equalsIgnoreCase(ActionableEvent.Status.pending.name().toString()) || event.getEventStatus().equalsIgnoreCase(ActionableEvent.Status.failed.name().toString())) {
EventDetailsRestRep details = getViprClient().events().getDetails(uri(eventId));
approveDetails = details.getApproveDetails();
declineDetails = details.getDeclineDetails();
} else {
approveDetails = event.getApproveDetails();
declineDetails = event.getDeclineDetails();
}
Common.angularRenderArgs().put("approveDetails", approveDetails);
Common.angularRenderArgs().put("declineDetails", declineDetails);
List<TaskResourceRep> tasks = Lists.newArrayList();
if (event != null && event.getTaskIds() != null) {
tasks = getViprClient().tasks().getByRefs(event.getTaskIds());
}
render(event, approveDetails, declineDetails, tasks);
}
use of com.emc.storageos.model.event.EventRestRep in project coprhd-controller by CoprHD.
the class Events method toEventSummaries.
private static List<EventSummary> toEventSummaries(List<EventRestRep> events) {
List<EventSummary> eventSummaries = Lists.newArrayList();
for (EventRestRep event : events) {
EventSummary eventSummary = new EventSummary(event);
eventSummaries.add(eventSummary);
}
return eventSummaries;
}
use of com.emc.storageos.model.event.EventRestRep in project coprhd-controller by CoprHD.
the class Events method itemsJson.
public static void itemsJson(@As(",") String[] ids) {
List<EventsDataTable.Event> results = Lists.newArrayList();
if (ids != null && ids.length > 0) {
for (String id : ids) {
if (StringUtils.isNotBlank(id)) {
EventRestRep event = EventUtils.getEvent(uri(id));
if (event != null) {
results.add(new EventsDataTable.Event(event));
}
}
}
}
renderJSON(results);
}
use of com.emc.storageos.model.event.EventRestRep in project coprhd-controller by CoprHD.
the class Events method detailsJson.
public static void detailsJson(String eventId) {
if (StringUtils.isBlank(eventId)) {
notFound("Event [" + eventId + "]");
}
EventRestRep event = EventUtils.getEvent(uri(eventId));
if (event == null) {
notFound("Event [" + eventId + "]");
}
renderJSON(getEventSummary(event));
}
Aggregations