use of com.emc.vipr.model.catalog.ServiceDescriptorRestRep in project coprhd-controller by CoprHD.
the class EditCatalog method addFieldOptions.
private static void addFieldOptions(String baseService) {
// Base service may be null for a new service
if (StringUtils.isNotBlank(baseService)) {
ServiceDescriptorRestRep serviceDescriptor = getServiceDescriptorForEditing(baseService);
// Load any Asset Options for root fields so they are rendered directly onto the form
List<ServiceFieldRestRep> fields = ServiceDescriptorUtils.getAllFieldList(serviceDescriptor.getItems());
for (ServiceFieldRestRep field : fields) {
if (field.isAsset() && field.isLockable()) {
try {
List<AssetOption> options = AssetOptionUtils.getAssetOptions(field.getAssetType());
request.current().args.put(field.getType() + "-options", options);
} catch (RuntimeException e) {
request.current().args.put(field.getType() + "-error", e.getMessage());
}
}
}
}
}
use of com.emc.vipr.model.catalog.ServiceDescriptorRestRep in project coprhd-controller by CoprHD.
the class EditCatalog method edit.
private static void edit(ServiceForm service) {
addImagesToRenderArgs();
addExecutionWindowsToRenderArgs();
addBaseServicesToRenderArgs();
addCategoriesToRenderArgs();
addBreadCrumbToRenderArgs(Models.currentAdminTenant(), service);
addACLsToRenderArgs();
// Add information for service fields
ServiceDescriptorRestRep serviceDescriptor = null;
if (service.baseService != null) {
serviceDescriptor = getServiceDescriptorForEditing(service.baseService);
addFieldOptions(service.baseService);
}
render("@editService", service, serviceDescriptor);
}
use of com.emc.vipr.model.catalog.ServiceDescriptorRestRep in project coprhd-controller by CoprHD.
the class EditCatalog method serviceFields.
public static void serviceFields(String baseService, String serviceId) {
ServiceDescriptorRestRep serviceDescriptor = ServiceDescriptorUtils.getDescriptor(baseService);
ServiceForm service = null;
if (StringUtils.isNotBlank(serviceId)) {
CatalogServiceRestRep dbService = CatalogServiceUtils.getCatalogService(uri(serviceId));
if (dbService != null) {
service = new ServiceForm(dbService);
} else {
service = new ServiceForm();
service.baseService = baseService;
}
}
addFieldOptions(baseService);
render(serviceDescriptor, service);
}
use of com.emc.vipr.model.catalog.ServiceDescriptorRestRep in project coprhd-controller by CoprHD.
the class EditCatalog method addBaseServicesToRenderArgs.
private static void addBaseServicesToRenderArgs() {
Map<String, List<ServiceDescriptorRestRep>> descriptors = Maps.newTreeMap();
for (ServiceDescriptorRestRep descriptor : ServiceDescriptorUtils.getDescriptors()) {
String category = StringUtils.defaultString(descriptor.getCategory());
List<ServiceDescriptorRestRep> values = descriptors.get(category);
if (values == null) {
values = Lists.newArrayList();
descriptors.put(category, values);
}
values.add(descriptor);
}
for (List<ServiceDescriptorRestRep> values : descriptors.values()) {
Collections.sort(values, new ServiceDescriptorComparator());
}
renderArgs.put("baseServices", descriptors);
}
use of com.emc.vipr.model.catalog.ServiceDescriptorRestRep in project coprhd-controller by CoprHD.
the class Orders method createAndValidateOrder.
@Util
public static OrderCreateParam createAndValidateOrder(String serviceId) {
CatalogServiceRestRep service = CatalogServiceUtils.getCatalogService(uri(serviceId));
ServiceDescriptorRestRep descriptor = service.getServiceDescriptor();
if (descriptor == null) {
flash.error("order.submitFailedWithDetail", " The Workflow or Service Descriptor is deleted");
Logger.error("Service Descriptor not found");
throw new IllegalStateException("No Service Descriptor found. Might be Customservices Workflow is deleted ");
}
// Filter out actual Service Parameters
Map<String, String> parameters = parseParameters(service, descriptor);
if (Validation.hasErrors()) {
Validation.keep();
Common.flashParamsExcept("json", "body");
Services.showForm(serviceId);
}
return createOrder(service, descriptor, parameters);
}
Aggregations