Search in sources :

Example 76 with NamedRelatedResourceRep

use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.

the class CatalogCategoryService method getCatalogCategories.

/**
 * Gets the list of sub categories within the category
 *
 * @param id the URN of a Catalog Category
 * @brief List Catalog Categories
 * @return a list of sub categories that belong to the category
 * @throws DatabaseException when a DB error occurs
 */
@GET
@Path("/{id}/categories")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public CatalogCategoryList getCatalogCategories(@PathParam("id") URI id) throws DatabaseException {
    CatalogCategory parentCatalogCategory = queryResource(id);
    // check the user permissions
    verifyAuthorizedInTenantOrg(uri(parentCatalogCategory.getTenant()), getUserFromContext());
    List<CatalogCategory> subCatalogCategories = catalogCategoryManager.getSubCategories(id);
    subCatalogCategories = filterCategoriesByACLs(subCatalogCategories);
    CatalogCategoryList subCatalogCategoryList = new CatalogCategoryList();
    for (CatalogCategory subCatalogCategory : subCatalogCategories) {
        NamedRelatedResourceRep subCatalogCategoryRestRep = toNamedRelatedResource(ResourceTypeEnum.CATALOG_CATEGORY, subCatalogCategory.getId(), subCatalogCategory.getLabel());
        subCatalogCategoryList.getCatalogCategories().add(subCatalogCategoryRestRep);
    }
    return subCatalogCategoryList;
}
Also used : CatalogCategoryMapper.createNewCatalogCategory(com.emc.sa.api.mapper.CatalogCategoryMapper.createNewCatalogCategory) CatalogCategory(com.emc.storageos.db.client.model.uimodels.CatalogCategory) CatalogCategoryList(com.emc.vipr.model.catalog.CatalogCategoryList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 77 with NamedRelatedResourceRep

use of com.emc.storageos.model.NamedRelatedResourceRep 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)

Example 78 with NamedRelatedResourceRep

use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.

the class OrderService method toOrderList.

private OrderList toOrderList(List<Order> orders) {
    OrderList list = new OrderList();
    for (Order order : orders) {
        NamedRelatedResourceRep resourceRep = toNamedRelatedResource(ResourceTypeEnum.ORDER, order.getId(), order.getLabel());
        list.getOrders().add(resourceRep);
    }
    return list;
}
Also used : Order(com.emc.storageos.db.client.model.uimodels.Order) OrderList(com.emc.vipr.model.catalog.OrderList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Example 79 with NamedRelatedResourceRep

use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.

the class WFDirectoryService method getWorkflowDirectories.

/**
 * Get workflow directories
 *
 * @prereq none
 * @brief Get workflow directories
 * @return List of workflow directories
 */
@GET
@CheckPermission(roles = { Role.SYSTEM_ADMIN })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public WFDirectoryList getWorkflowDirectories() {
    List<WFDirectory> wfDirectories = wfDirectoryManager.getWFDirectories();
    WFDirectoryList wfDirectoryList = new WFDirectoryList();
    for (WFDirectory dir : wfDirectories) {
        NamedRelatedResourceRep wfDirectoryRestRep = toNamedRelatedResource(ResourceTypeEnum.WF_DIRECTORY, dir.getId(), dir.getLabel());
        wfDirectoryList.getWFDirectories().add(wfDirectoryRestRep);
    }
    return wfDirectoryList;
}
Also used : WFDirectory(com.emc.storageos.db.client.model.uimodels.WFDirectory) WFDirectoryList(com.emc.vipr.model.catalog.WFDirectoryList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 80 with NamedRelatedResourceRep

use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.

the class ApprovalService method getApprovals.

/**
 * Gets the list of approvals
 *
 * @param tenantId the URN of a tenant
 * @brief List Approvals
 * @return a list of approvals
 * @throws DatabaseException when a DB error occurs
 */
@GET
@Path("")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public ApprovalList getApprovals(@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<ApprovalRequest> approvals = approvalManager.getApprovals(uri(tenantId));
    ApprovalList approvalList = new ApprovalList();
    for (ApprovalRequest approval : approvals) {
        NamedRelatedResourceRep approvalRestRep = toNamedRelatedResource(ResourceTypeEnum.APPROVAL, approval.getId(), approval.getLabel());
        approvalList.getApprovals().add(approvalRestRep);
    }
    return approvalList;
}
Also used : ApprovalList(com.emc.vipr.model.catalog.ApprovalList) StorageOSUser(com.emc.storageos.security.authentication.StorageOSUser) ApprovalRequest(com.emc.storageos.db.client.model.uimodels.ApprovalRequest) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)111 URI (java.net.URI)47 ArrayList (java.util.ArrayList)28 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)22 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)18 Asset (com.emc.sa.asset.annotation.Asset)11 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)11 AssetOption (com.emc.vipr.model.catalog.AssetOption)9 HashMap (java.util.HashMap)8 GET (javax.ws.rs.GET)8 Produces (javax.ws.rs.Produces)8 NamedVolumesList (com.emc.storageos.model.block.NamedVolumesList)7 Path (javax.ws.rs.Path)7 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)6 NamedURI (com.emc.storageos.db.client.model.NamedURI)5 SnapshotList (com.emc.storageos.model.SnapshotList)5 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)5 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)5 HashSet (java.util.HashSet)5 List (java.util.List)5