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