コード例 #1
0
 @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;
 }
コード例 #2
0
 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;
 }
コード例 #3
0
  @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;
  }