Search in sources :

Example 6 with CatalogService

use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.

the class CatalogServiceService method getCatalogServiceById.

private CatalogService getCatalogServiceById(URI id, boolean checkInactive) {
    CatalogService catalogService = catalogServiceManager.getCatalogServiceById(id);
    ArgValidator.checkEntity(catalogService, id, isIdEmbeddedInURL(id), checkInactive);
    return catalogService;
}
Also used : CatalogService(com.emc.storageos.db.client.model.uimodels.CatalogService)

Example 7 with CatalogService

use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.

the class CatalogServiceService method queryBulkResourceReps.

private CatalogServiceBulkRep queryBulkResourceReps(List<URI> ids, CatalogServiceFilter filter) {
    List<CatalogServiceRestRep> catalogServiceRestReps = new ArrayList<CatalogServiceRestRep>();
    List<CatalogServiceAndFields> catalogServicesWithFields = catalogServiceManager.getCatalogServicesWithFields(ids);
    Map<String, ServiceDescriptor> descriptors = getServiceDescriptors();
    for (CatalogServiceAndFields catalogServiceAndField : catalogServicesWithFields) {
        if ((filter == null) || filter.isAccessible(catalogServiceAndField.getCatalogService())) {
            CatalogService service = catalogServiceAndField.getCatalogService();
            ServiceDescriptor descriptor = descriptors.get(service.getBaseService());
            List<CatalogServiceField> serviceFields = catalogServiceAndField.getCatalogServiceFields();
            catalogServiceRestReps.add(map(service, descriptor, serviceFields));
        }
    }
    catalogServiceRestReps = SortedIndexUtils.createSortedList(catalogServiceRestReps.iterator());
    return new CatalogServiceBulkRep(catalogServiceRestReps);
}
Also used : CatalogServiceField(com.emc.storageos.db.client.model.uimodels.CatalogServiceField) WorkflowServiceDescriptor(com.emc.sa.catalog.WorkflowServiceDescriptor) ServiceDescriptor(com.emc.sa.descriptor.ServiceDescriptor) CatalogServiceBulkRep(com.emc.vipr.model.catalog.CatalogServiceBulkRep) ArrayList(java.util.ArrayList) CatalogService(com.emc.storageos.db.client.model.uimodels.CatalogService) CatalogServiceRestRep(com.emc.vipr.model.catalog.CatalogServiceRestRep) CatalogServiceAndFields(com.emc.storageos.db.client.model.uimodels.CatalogServiceAndFields)

Example 8 with CatalogService

use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.

the class CatalogServiceService method getRecentCatalogServices.

/**
 * Gets the list a user's recent services
 *
 * @brief List user's recent catalog services
 * @return a list of user's recent services
 * @throws DatabaseException when a DB error occurs
 */
@GET
@Path("/recent")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public CatalogServiceList getRecentCatalogServices() throws DatabaseException {
    StorageOSUser user = getUserFromContext();
    List<CatalogService> catalogServices = catalogServiceManager.getRecentCatalogServices(user);
    return toCatalogServiceList(catalogServices);
}
Also used : StorageOSUser(com.emc.storageos.security.authentication.StorageOSUser) CatalogService(com.emc.storageos.db.client.model.uimodels.CatalogService) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 9 with CatalogService

use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.

the class OrderService method createNewOrder.

public Order createNewOrder(StorageOSUser user, URI tenantId, OrderCreateParam createParam) {
    ArgValidator.checkFieldNotNull(createParam.getCatalogService(), "catalogService");
    CatalogService service = catalogServiceManager.getCatalogServiceById(createParam.getCatalogService());
    if (service == null) {
        throw APIException.badRequests.orderServiceNotFound(asString(createParam.getCatalogService()));
    }
    final ServiceDescriptor descriptor = ServiceDescriptorUtil.getServiceDescriptorByName(serviceDescriptors, workflowServiceDescriptor, service.getBaseService());
    if (descriptor == null) {
        throw APIException.badRequests.orderServiceDescriptorNotFound(service.getBaseService());
    }
    // Getting and setting workflow document (if its workflow service)
    if (null != descriptor.getWorkflowId()) {
        final String workflowDocument = catalogServiceManager.getWorkflowDocument(service.getBaseService());
        if (null == workflowDocument) {
            throw APIException.badRequests.workflowNotFound(service.getBaseService());
        }
        createParam.setWorkflowDocument(workflowDocument);
    }
    Order order = createNewObject(tenantId, createParam);
    addLockedFields(service.getId(), descriptor, createParam);
    validateParameters(descriptor, createParam.getParameters(), service.getMaxSize());
    List<OrderParameter> orderParams = createOrderParameters(order, createParam, encryptionProvider);
    orderManager.createOrder(order, orderParams, user);
    return order;
}
Also used : Order(com.emc.storageos.db.client.model.uimodels.Order) ServiceDescriptor(com.emc.sa.descriptor.ServiceDescriptor) WorkflowServiceDescriptor(com.emc.sa.catalog.WorkflowServiceDescriptor) OrderParameter(com.emc.storageos.db.client.model.uimodels.OrderParameter) CatalogService(com.emc.storageos.db.client.model.uimodels.CatalogService) URIUtil.asString(com.emc.storageos.db.client.URIUtil.asString)

Example 10 with CatalogService

use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.

the class CatalogServiceMapper method toCatalogServiceList.

public static CatalogServiceList toCatalogServiceList(List<CatalogService> catalogServices) {
    CatalogServiceList list = new CatalogServiceList();
    for (CatalogService catalogService : catalogServices) {
        NamedRelatedResourceRep resourceRep = toNamedRelatedResource(ResourceTypeEnum.CATALOG_SERVICE, catalogService.getId(), catalogService.getLabel());
        list.getCatalogServices().add(resourceRep);
    }
    return list;
}
Also used : CatalogService(com.emc.storageos.db.client.model.uimodels.CatalogService) CatalogServiceList(com.emc.vipr.model.catalog.CatalogServiceList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Aggregations

CatalogService (com.emc.storageos.db.client.model.uimodels.CatalogService)34 ServiceDescriptor (com.emc.sa.descriptor.ServiceDescriptor)8 URI (java.net.URI)8 NamedURI (com.emc.storageos.db.client.model.NamedURI)7 CatalogCategory (com.emc.storageos.db.client.model.uimodels.CatalogCategory)7 CatalogServiceField (com.emc.storageos.db.client.model.uimodels.CatalogServiceField)6 Path (javax.ws.rs.Path)6 WorkflowServiceDescriptor (com.emc.sa.catalog.WorkflowServiceDescriptor)5 Produces (javax.ws.rs.Produces)5 StorageOSUser (com.emc.storageos.security.authentication.StorageOSUser)4 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)4 Test (org.junit.Test)4 BaseModelTest (com.emc.sa.model.BaseModelTest)3 ExecutionState (com.emc.storageos.db.client.model.uimodels.ExecutionState)3 Order (com.emc.storageos.db.client.model.uimodels.Order)3 OrderParameter (com.emc.storageos.db.client.model.uimodels.OrderParameter)3 Consumes (javax.ws.rs.Consumes)3 ModelClient (com.emc.sa.model.dao.ModelClient)2 CatalogServiceAndFields (com.emc.storageos.db.client.model.uimodels.CatalogServiceAndFields)2 ArrayList (java.util.ArrayList)2