Search in sources :

Example 1 with ExecutionWindowList

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());
}
Also used : ExecutionWindowList(com.emc.vipr.model.catalog.ExecutionWindowList) UriBuilder(javax.ws.rs.core.UriBuilder)

Example 2 with ExecutionWindowList

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;
}
Also used : ExecutionWindow(com.emc.storageos.db.client.model.uimodels.ExecutionWindow) StorageOSUser(com.emc.storageos.security.authentication.StorageOSUser) ExecutionWindowList(com.emc.vipr.model.catalog.ExecutionWindowList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

ExecutionWindowList (com.emc.vipr.model.catalog.ExecutionWindowList)2 ExecutionWindow (com.emc.storageos.db.client.model.uimodels.ExecutionWindow)1 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)1 StorageOSUser (com.emc.storageos.security.authentication.StorageOSUser)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 UriBuilder (javax.ws.rs.core.UriBuilder)1