Search in sources :

Example 1 with CatalogServiceFieldParam

use of com.emc.vipr.model.catalog.CatalogServiceFieldParam in project coprhd-controller by CoprHD.

the class CatalogServiceMapper method createNewObjectList.

public static List<CatalogServiceField> createNewObjectList(CatalogService catalogService, List<CatalogServiceFieldParam> fieldParams) {
    List<CatalogServiceField> catalogServiceFields = Lists.newArrayList();
    if (fieldParams != null) {
        for (CatalogServiceFieldParam fieldParam : fieldParams) {
            CatalogServiceField catalogServiceField = createNewObject(catalogService, fieldParam);
            catalogServiceFields.add(catalogServiceField);
        }
    }
    return catalogServiceFields;
}
Also used : CatalogServiceFieldParam(com.emc.vipr.model.catalog.CatalogServiceFieldParam) CatalogServiceField(com.emc.storageos.db.client.model.uimodels.CatalogServiceField)

Example 2 with CatalogServiceFieldParam

use of com.emc.vipr.model.catalog.CatalogServiceFieldParam in project coprhd-controller by CoprHD.

the class CatalogServiceService method validateParam.

private void validateParam(CatalogServiceCommonParam input, CatalogService existing) {
    ServiceDescriptor descriptor = getServiceDescriptor(input.getBaseService());
    if (descriptor == null) {
        throw APIException.badRequests.baseServiceNotFound(input.getBaseService());
    }
    if (null != input.getWorkflowName() && !input.getWorkflowName().isEmpty()) {
        if (null == catalogServiceManager.getWorkflowDocument(input.getWorkflowName())) {
            throw APIException.badRequests.workflowNotFound(input.getWorkflowName());
        }
    }
    for (CatalogServiceFieldParam field : input.getCatalogServiceFields()) {
        if (!field.getOverride()) {
            continue;
        }
        String fieldName = field.getName();
        String fieldValue = field.getValue();
        ServiceField descriptorField = descriptor.getField(fieldName);
        if (descriptorField != null) {
            ValidationUtils.validateField(input.getMaxSize(), descriptorField, fieldValue);
        }
    }
}
Also used : CatalogServiceFieldParam(com.emc.vipr.model.catalog.CatalogServiceFieldParam) WorkflowServiceDescriptor(com.emc.sa.catalog.WorkflowServiceDescriptor) ServiceDescriptor(com.emc.sa.descriptor.ServiceDescriptor) CatalogServiceField(com.emc.storageos.db.client.model.uimodels.CatalogServiceField) ServiceField(com.emc.sa.descriptor.ServiceField)

Example 3 with CatalogServiceFieldParam

use of com.emc.vipr.model.catalog.CatalogServiceFieldParam in project coprhd-controller by CoprHD.

the class CatalogServiceMapper method updateObjectList.

public static List<CatalogServiceField> updateObjectList(CatalogService catalogService, List<CatalogServiceField> existingCatalogServiceFields, List<CatalogServiceFieldParam> params) {
    List<CatalogServiceField> updatedFields = Lists.newArrayList();
    Map<String, CatalogServiceField> existingFields = toMap(existingCatalogServiceFields);
    for (CatalogServiceFieldParam param : params) {
        if (existingFields.keySet().contains(param.getName())) {
            CatalogServiceField existingField = existingFields.get(param.getName());
            updateObject(existingField, param);
            updatedFields.add(existingField);
        } else {
            CatalogServiceField newField = createNewObject(catalogService, param);
            updatedFields.add(newField);
        }
    }
    return updatedFields;
}
Also used : CatalogServiceFieldParam(com.emc.vipr.model.catalog.CatalogServiceFieldParam) CatalogServiceField(com.emc.storageos.db.client.model.uimodels.CatalogServiceField)

Aggregations

CatalogServiceField (com.emc.storageos.db.client.model.uimodels.CatalogServiceField)3 CatalogServiceFieldParam (com.emc.vipr.model.catalog.CatalogServiceFieldParam)3 WorkflowServiceDescriptor (com.emc.sa.catalog.WorkflowServiceDescriptor)1 ServiceDescriptor (com.emc.sa.descriptor.ServiceDescriptor)1 ServiceField (com.emc.sa.descriptor.ServiceField)1