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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations