Beispiel #1
0
 @SuppressWarnings("unchecked")
 public static SataMap sataMapGetSubSataMap(SataMap sataMap) {
   SataMap tempSataMap = new SataMapImpl();
   for (Iterator<Map.Entry<String, Object>> it = sataMap.entrySet().iterator(); it.hasNext(); ) {
     Entry<String, Object> entry = it.next();
     if (entry.getValue() instanceof SataList) {
       String key = entry.getKey();
       SataList sataList = (SataList) entry.getValue();
       for (int i = 0; i < sataList.size(); i++) {
         if (sataList.get(i) instanceof SataMap) {
           SataMap map = (SataMap) sataList.get(i);
           if (map.containsKey("PARA_ID")) {
             String para_id = map.getString("PARA_ID").toUpperCase();
             String para_value = map.getString("PARA_VALUE");
             tempSataMap.put(para_id, para_value);
           }
         }
       }
       // sataMap.remove(key);
     } else {
       tempSataMap.put(entry.getKey(), entry.getValue());
     }
   }
   return tempSataMap;
 }
Beispiel #2
0
 public static String getInConditions(SataList params, String param_name) {
   StringBuffer buffer = new StringBuffer();
   buffer.append(param_name + " IN ('");
   for (int i = 0; i < params.size() - 1; i++) {
     buffer.append(params.getSataMap(i).getString(param_name)).append("','");
   }
   buffer.append(params.getSataMap(params.size() - 1).getString(param_name)).append("') ");
   return buffer.toString();
 }
Beispiel #3
0
 private static JSONArray getSubJsonArray(SataList list) {
   JSONArray array = new JSONArray();
   for (int i = 0; i < list.size(); i++) {
     SataMap sataMap = list.getSataMap(i);
     JSONObject jsonObject = new JSONObject();
     jsonObject.putAll(sataMap2JSON(sataMap));
     array.add(jsonObject);
   }
   return array;
 }
Beispiel #4
0
 @SuppressWarnings("unchecked")
 private static SataList getSubSataList(JSONArray jsonArray) {
   SataList list = new SataListImpl();
   for (int i = 0; i < jsonArray.size(); i++) {
     JSONObject object = jsonArray.getJSONObject(i);
     SataMap sataMap = new SataMapImpl();
     sataMap.putAll(json2SataMap(object));
     list.add(sataMap);
   }
   return list;
 }
Beispiel #5
0
  @SuppressWarnings("unchecked")
  public static SataMap sataMap2SataMap(SataMap subSataMap) {
    SataMap sataMap = new SataMapImpl();
    for (Iterator<Map.Entry<String, Object>> it = subSataMap.entrySet().iterator();
        it.hasNext(); ) {
      Entry<String, Object> entry = it.next();
      if (entry.getValue() instanceof SataList) {
        SataList sataList = (SataList) entry.getValue();
        for (int i = 0; i < sataList.size(); i++) {
          if (sataList.get(i) instanceof SataMap) {
            sataMap.putAll(sataMap2SataMap((SataMap) sataList.get(i)));
          }
        }
      } else {

        sataMap.put(entry.getKey().toString(), entry.getValue());
      }
    }
    return sataMap;
  }