Package net.sf.json

Examples of net.sf.json.JSONArray


  public OperResult queryAllEnergyMedia(){
    ArrayList<AllEnergy> output = new ArrayList<AllEnergy>();
    OperResult result = basicInfomationManagement.queryAllEnergyMedia(output);
    if(result.isSUCCEED()){
      JSONArray jsonObject = JSONArray.fromObject(output, jsonConfig);
//      System.out.println(jsonObject);
      result.setInfoMSG(jsonObject.toString());
    }
    return result;
  }
View Full Code Here


  public OperResult queryAllEnergyMedia(Object category_id){
    ArrayList<EnergyMedia> output = new ArrayList<EnergyMedia>();
    OperResult result = basicInfomationManagement.queryAllEnergyMedia(stringValue(category_id),output);
    if(result.isSUCCEED()){
      JSONArray jsonObject = JSONArray.fromObject(output, jsonConfig);
//      System.out.println(jsonObject);
      result.setInfoMSG(jsonObject.toString());
    }
    return result;
  }
View Full Code Here

//                          if (c.equals(Set.class))
//                                 return Set.class;
//                          return c;
//                   }
//            });
      JSONArray jsonObject = JSONArray.fromObject(output, jsonConfig);
//      System.out.println(jsonObject);
      result.setInfoMSG(jsonObject.toString());
    }
    return result;
  }
View Full Code Here

    set.add(p2);
    p0.setEntHierarchies(set);
   
    output.add(p0);
   
    JSONArray jsonObject = JSONArray.fromObject(output, jsonConfig);
    System.out.println(jsonObject);
  }
View Full Code Here

  public OperResult queryAllProcessTemplateCategory(){
    ArrayList<PTemplateCategory> output = new ArrayList<PTemplateCategory>();
    OperResult result = productionProcessManagement.queryAllProcessTemplateCategory(output);
    if(result.isSUCCEED()){
      JSONArray jsonObject = JSONArray.fromObject(output, jsonConfig);
//      System.out.println(jsonObject);
//      result.setInfoMSG(jsonObject.toString());
      result.setData(jsonObject.toString());
    }
    return result;
  }
View Full Code Here

  {
    ArrayList<Equipment> output = new ArrayList<Equipment>();
    OperResult result = equipmentManagement.queryAllEquipment(output);
    if(result.isSUCCEED())
    {
      JSONArray jsonObject = JSONArray.fromObject(output, jsonConfig);
      result.setInfoMSG(jsonObject.toString());
    }
    return result;
  }
View Full Code Here

            result.setFailed(CUBE_NOT_EXIST);
          }else{
            String cube_name = cubeMeta.getMetaName();
            Set<DimMeta> dimMetas = cubeMeta.getDimMetas();
            Set<MeasureMeta> measureMetas = cubeMeta.getMeasureMetas();
            JSONArray dims = json.getJSONArray("dims");
            if(dimMetas.size()!=dims.size()){
              result.setFailed(CUBE_QUERY_NOT_ALL_DIM_SET);
            }else{
              final Hashtable<String,DimMeta> dimMetaHash = new Hashtable<String,DimMeta>();
              for(DimMeta dimMeta:dimMetas){
                dimMetaHash.put(dimMeta.getId(), dimMeta);
View Full Code Here

      JSONObject dim = dims.getJSONObject(i);
      String dim_id = dim.getString("dim_id");//dim_id为维度在dimMeta表中的id(not 一炼钢的id)
      if(dimMetaHash.containsKey(dim_id)){
        DimMeta dimMeta = dimMetaHash.get(dim_id);
        String dimMetaName = dimMeta.getMetaName();
        JSONArray values = dim.getJSONArray("values");
        for(int j=0;j<values.size();j++){
          JSONObject value = values.getJSONObject(j);
          String id_name = value.getString("name");//"能源总量"
          String id_id = value.getString("id");//如果是度量维度,客户端传过来的id即为metaName:"amount"
          if(MEASURE_NAME.equalsIgnoreCase(dimMetaName)){
            if(measureMetaHash.containsKey(id_id)){
              measureNames.add(measureMetaHash.get(id_id).getMetaName());//应该就是id_id
View Full Code Here

      }
     
      JSONObject json=JSONObject.fromObject(zprava);
      pole.add(json.toString());
    }
    JSONArray arr = JSONArray.fromObject(pole);
    //JSONObject json=JSONObject.fromObject(pole);
    System.out.println(arr.toString());
    model.addAttribute("JSON", arr.toString());
    return "JSON";
  }
View Full Code Here

   */
  private static <T> T getObjWithSimpleType(Class<T> objClass, Object json) throws JSONException{
    T rel = null;
    if(java.util.List.class.isAssignableFrom(objClass)){
      java.util.List relLst = new java.util.ArrayList();
      JSONArray jsonArr = (JSONArray)json;
      for(int i=0; i<jsonArr.size(); i++){
        Object subJson = jsonArr.get(i);

        Object valueObj = null;

        if(subJson instanceof JSONArray){
          valueObj = getObjWithSimpleType(java.util.List.class, subJson);
View Full Code Here

TOP

Related Classes of net.sf.json.JSONArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.