@Util public static Map<String, String> parseParameters( CatalogServiceRestRep service, ServiceDescriptorRestRep descriptor) { Map<String, String> parameters = Maps.newLinkedHashMap(); Map<String, String> locked = getLockedFields(service); addFieldValues(service, descriptor.getItems(), parameters, locked); return parameters; }
public static Set<String> getAllAssetTypes(ServiceDescriptorRestRep serviceDescriptor) { Set<String> allAvailableAssets = new HashSet<>(); for (ServiceFieldRestRep field : getAllFields(serviceDescriptor.getItems())) { if (field.isAsset()) { allAvailableAssets.add(field.getAssetType()); } } return allAvailableAssets; }
@Util public static OrderCreateParam createOrder( CatalogServiceRestRep service, ServiceDescriptorRestRep descriptor, Map<String, String> parameters) { OrderCreateParam order = new OrderCreateParam(); order.setTenantId(uri(Models.currentAdminTenant())); order.setCatalogService(service.getId()); List<Parameter> orderParameters = Lists.newArrayList(); List<ServiceFieldRestRep> fields = ServiceDescriptorUtils.getAllFieldList(descriptor.getItems()); for (ServiceFieldRestRep field : fields) { String value = parameters.get(field.getName()); if (StringUtils.isNotBlank(value)) { orderParameters.add(createOrderParameter(field, value)); } } order.setParameters(orderParameters); return order; }