use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.
the class ExecutionEngineImplTest method testErrorCreatingService.
@Test
public void testErrorCreatingService() {
ExecutionEngineImpl engine = new ExecutionEngineImpl();
engine.setModelClient(modelClient);
engine.setServiceFactory(new ExecutionServiceFactory() {
@Override
public ExecutionService createService(Order order, CatalogService catalogService) throws ServiceNotFoundException {
throw new RuntimeException("Unexpected error");
}
});
Order order = executeOrder(engine, createOrder("ErrorCreatingService"));
Assert.assertEquals(OrderStatus.ERROR.name(), order.getOrderStatus());
}
use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.
the class CatalogCategoryManagerImpl method updateMatchingServices.
private void updateMatchingServices(CatalogCategory currentCategory, List<CatalogService> services, ServiceDef newService) {
int pristineService = 0;
for (CatalogService service : services) {
if (isMatch(service, newService)) {
if (pristineService == 0) {
log.info(String.format("Updating Existing Matching Service %s: for tenant: %s", service.getLabel(), currentCategory.getTenant()));
ServiceDescriptor descriptor = serviceDescriptors.getDescriptor(Locale.getDefault(), newService.baseService);
if (descriptor != null) {
service.setLabel(StringUtils.deleteWhitespace(StringUtils.defaultString(getMessage(getLabel(newService)), descriptor.getTitle())));
service.setTitle(StringUtils.defaultString(getMessage(newService.title), descriptor.getTitle()));
service.setDescription(StringUtils.defaultString(getMessage(newService.description), descriptor.getDescription()));
}
service.setImage(newService.image);
catalogServiceManager.updateCatalogService(service, catalogServiceManager.getCatalogServiceFields(service.getId()));
pristineService++;
} else {
log.info(String.format("Removing Duplicate Service %s: for tenant: %s", service.getLabel(), currentCategory.getTenant()));
catalogServiceManager.deleteCatalogService(service);
}
}
}
}
use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.
the class CatalogServiceManagerImpl method getRecentCatalogServices.
@Deprecated
public List<CatalogService> getRecentCatalogServices(StorageOSUser user) {
List<CatalogService> catalogServices = Lists.newArrayList();
List<RecentService> recentServices = getRecentServices(user.getUserName());
for (RecentService recentService : recentServices) {
CatalogService catalogService = client.catalogServices().findById(recentService.getCatalogServiceId());
if (catalogService != null) {
catalogServices.add(catalogService);
}
}
SortedIndexUtils.sort(catalogServices);
return catalogServices;
}
use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.
the class CatalogServiceManagerImpl method createCatalogService.
public CatalogService createCatalogService(ServiceDef serviceDef, CatalogCategory parentCategory) {
CatalogBuilder builder = new CatalogBuilder(client, serviceDescriptors);
NamedURI namedUri = new NamedURI(parentCategory.getId(), parentCategory.getLabel());
CatalogService newService = builder.createService(serviceDef, namedUri);
newService.setSortedIndex(null);
client.save(newService);
return newService;
}
use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.
the class CatalogServiceManagerImpl method getCatalogServicesWithFields.
public List<CatalogServiceAndFields> getCatalogServicesWithFields(List<URI> ids) {
List<CatalogServiceAndFields> catalogServicesWithFields = new ArrayList<CatalogServiceAndFields>();
if (ids == null) {
return null;
}
for (URI id : ids) {
CatalogService catalogService = client.catalogServices().findById(id);
if (catalogService != null) {
List<CatalogServiceField> fields = getCatalogServiceFields(catalogService.getId());
SortedIndexUtils.sort(fields);
CatalogServiceAndFields catalogServiceWithFields = new CatalogServiceAndFields();
catalogServiceWithFields.setCatalogService(catalogService);
catalogServiceWithFields.setCatalogServiceFields(fields);
catalogServicesWithFields.add(catalogServiceWithFields);
}
}
return catalogServicesWithFields;
}
Aggregations