use of com.emc.storageos.db.client.model.uimodels.CatalogServiceField in project coprhd-controller by CoprHD.
the class CatalogBuilder method createService.
public CatalogService createService(ServiceDef def, NamedURI parentId) {
ServiceDescriptor descriptor = descriptors.getDescriptor(Locale.getDefault(), def.baseService);
String label = StringUtils.defaultString(getMessage(getLabel(def)), descriptor.getTitle());
String title = StringUtils.defaultString(getMessage(def.title), descriptor.getTitle());
String description = StringUtils.defaultString(getMessage(def.description), descriptor.getDescription());
CatalogService service = new CatalogService();
service.setBaseService(def.baseService);
service.setLabel(StringUtils.deleteWhitespace(label));
service.setTitle(title);
service.setDescription(description);
service.setImage(def.image);
service.setCatalogCategoryId(parentId);
service.setSortedIndex(sortedIndexCounter++);
log.info("Create new service" + def.baseService);
if (AllowRecurringSchedulerMigration.RECURRING_ALLOWED_CATALOG_SERVICES.contains(def.baseService) || AllowRecurringSchedulerForApplicationServicesMigration.RECURRING_ALLOWED_CATALOG_SERVICES.contains(def.baseService)) {
service.setRecurringAllowed(true);
}
models.save(service);
if (def.lockFields != null) {
for (Map.Entry<String, String> lockField : def.lockFields.entrySet()) {
CatalogServiceField field = new CatalogServiceField();
field.setLabel(lockField.getKey());
field.setValue(lockField.getValue());
field.setCatalogServiceId(new NamedURI(service.getId(), service.getLabel()));
models.save(field);
}
}
return service;
}
use of com.emc.storageos.db.client.model.uimodels.CatalogServiceField in project coprhd-controller by CoprHD.
the class CatalogServiceManagerImpl method deleteCatalogService.
public void deleteCatalogService(CatalogService catalogService) {
CatalogCategory parentCatalogCategory = catalogCategoryManager.getCatalogCategoryById(catalogService.getCatalogCategoryId().getURI());
URI tenantId = uri(parentCatalogCategory.getTenant());
if (isServiceUsedForOrders(tenantId, catalogService)) {
URI deletedCategoryURI = URI.create(CatalogCategory.DELETED_CATEGORY);
String deletedCategoryLabel = CatalogCategory.DELETED_CATEGORY;
catalogService.setCatalogCategoryId(new NamedURI(deletedCategoryURI, deletedCategoryLabel));
client.save(catalogService);
} else {
List<CatalogServiceField> serviceFields = getCatalogServiceFields(catalogService.getId());
log.debug(String.format("Deleting Service Fields: %s", catalogService.getTitle()));
client.delete(serviceFields);
log.info(String.format("Deleting Service: %s", catalogService.getTitle()));
client.delete(catalogService);
}
}
use of com.emc.storageos.db.client.model.uimodels.CatalogServiceField in project coprhd-controller by CoprHD.
the class CatalogServiceFieldTest method create.
protected static CatalogServiceField create(String label, String value) {
CatalogServiceField model = new CatalogServiceField();
model.setLabel("foo");
model.setValue("my value");
return model;
}
Aggregations