use of com.emc.vipr.model.catalog.ExecutionWindowList in project coprhd-controller by CoprHD.
the class ExecutionWindows2 method listByTenant.
@Override
public List<NamedRelatedResourceRep> listByTenant(URI tenantId) {
UriBuilder uriBuilder = client.uriBuilder(PathConstants.EXECUTION_WINDOWS2_URL);
if (tenantId != null) {
uriBuilder = uriBuilder.queryParam(SearchConstants.TENANT_ID_PARAM, tenantId);
}
ExecutionWindowList response = client.getURI(ExecutionWindowList.class, uriBuilder.build());
return ResourceUtils.defaultList(response.getExecutionWindows());
}
use of com.emc.vipr.model.catalog.ExecutionWindowList in project coprhd-controller by CoprHD.
the class ExecutionWindowService method getExecutionWindows.
/**
* Gets the list of execution windows
*
* @param tenantId the URN of a tenant
* @brief List Execution Windows
* @return a list of execution windows
* @throws DatabaseException when a DB error occurs
*/
@GET
@Path("")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public ExecutionWindowList getExecutionWindows(@DefaultValue("") @QueryParam(SearchConstants.TENANT_ID_PARAM) String tenantId) throws DatabaseException {
StorageOSUser user = getUserFromContext();
if (StringUtils.isBlank(tenantId)) {
tenantId = user.getTenantId();
}
verifyAuthorizedInTenantOrg(uri(tenantId), getUserFromContext());
List<ExecutionWindow> executionWindows = executionWindowManager.getExecutionWindows(uri(tenantId));
ExecutionWindowList list = new ExecutionWindowList();
for (ExecutionWindow executionWindow : executionWindows) {
NamedRelatedResourceRep resourceRep = toNamedRelatedResource(ResourceTypeEnum.EXECUTION_WINDOW, executionWindow.getId(), executionWindow.getLabel());
list.getExecutionWindows().add(resourceRep);
}
return list;
}
Aggregations