View Javadoc
1   /*******************************************************************************
2    * Copyhacked (H) 2012-2025.
3    * This program and the accompanying materials
4    * are made available under no term at all, use it like
5    * you want, but share and discuss it
6    * every time possible with every body.
7    * 
8    * Contributors:
9    *      ron190 at ymail dot com - initial implementation
10   ******************************************************************************/
11  package com.jsql.view.swing.list;
12  
13  import org.json.JSONObject;
14  
15  /**
16   * Basic object to avoid String incompatibility with drag and drop feature.
17   */
18  public class ItemListScan extends ItemList {
19      
20      private final BeanInjection beanInjection;
21  
22      public ItemListScan(BeanInjection newString) {
23          super(newString.getUrl());
24          this.beanInjection = newString;
25      }
26  
27      public ItemListScan(JSONObject json) {
28          this(new BeanInjection(
29              json.optString("url"),
30              json.optString("request"),
31              json.optString("header"),
32              json.optString("method"),
33              json.optString("vendor"),
34              json.optString("requestType")
35          ));
36      }
37  
38      public BeanInjection getBeanInjection() {
39          return this.beanInjection;
40      }
41      
42      public String getBeanInjectionToJSON() {
43          return new JSONObject(this.beanInjection).toString();
44      }
45  }