use of com.emc.storageos.model.event.EventList in project coprhd-controller by CoprHD.
the class Events method listByTenant.
@Override
public List<NamedRelatedResourceRep> listByTenant(URI tenantId) {
UriBuilder uriBuilder = client.uriBuilder(baseUrl);
if (tenantId != null) {
uriBuilder.queryParam(TENANT_PARAM, tenantId);
}
EventList response = client.getURI(EventList.class, uriBuilder.build());
return defaultList(response.getEvents());
}
use of com.emc.storageos.model.event.EventList in project coprhd-controller by CoprHD.
the class EventService method listEvents.
/**
* List Events
*
* @param tid
* @brief List events for the queried tenant.
* @return
* @throws DatabaseException
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public EventList listEvents(@QueryParam("tenant") final URI tid) throws DatabaseException {
URI tenantId;
StorageOSUser user = getUserFromContext();
if (tid == null || StringUtils.isBlank(tid.toString())) {
tenantId = URI.create(user.getTenantId());
} else {
tenantId = tid;
}
// this call validates the tenant id
TenantOrg tenant = _permissionsHelper.getObjectById(tenantId, TenantOrg.class);
ArgValidator.checkEntity(tenant, tenantId, isIdEmbeddedInURL(tenantId), true);
// check the user permissions for this tenant org
verifyAuthorizedInTenantOrg(tenantId, user);
// get all host children
EventList list = new EventList();
list.setEvents(DbObjectMapper.map(ResourceTypeEnum.EVENT, listChildren(tenantId, ActionableEvent.class, "label", "tenant")));
return list;
}
Aggregations