Search in sources :

Example 1 with EventRestRep

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;
}
Also used : RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) EventRestRep(com.emc.storageos.model.event.EventRestRep) ArrayList(java.util.ArrayList)

Example 2 with EventRestRep

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);
}
Also used : EventDetailsRestRep(com.emc.storageos.model.event.EventDetailsRestRep) EventRestRep(com.emc.storageos.model.event.EventRestRep) TaskResourceRep(com.emc.storageos.model.TaskResourceRep)

Example 3 with EventRestRep

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;
}
Also used : EventRestRep(com.emc.storageos.model.event.EventRestRep)

Example 4 with EventRestRep

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);
}
Also used : EventsDataTable(models.datatable.EventsDataTable) EventRestRep(com.emc.storageos.model.event.EventRestRep) ActionableEvent(com.emc.storageos.db.client.model.ActionableEvent)

Example 5 with EventRestRep

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));
}
Also used : EventRestRep(com.emc.storageos.model.event.EventRestRep)

Aggregations

EventRestRep (com.emc.storageos.model.event.EventRestRep)7 ActionableEvent (com.emc.storageos.db.client.model.ActionableEvent)2 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)2 EventDetailsRestRep (com.emc.storageos.model.event.EventDetailsRestRep)2 EventsDataTable (models.datatable.EventsDataTable)2 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)1 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)1 ArrayList (java.util.ArrayList)1