Package net.sf.json

Examples of net.sf.json.JSONObject.keySet()


  private TaskSubmissionRequest generateTaskSubmissionRequest(JSONObject j) throws InvalidRequestParameterException {
    if (ProcessUtils.validateTaskRequestJSON(j)) {
      JSONObject s = j.getJSONObject("submit");
      Map<String, String> params = new HashMap<String, String>();
      JSONObject jparams = s.getJSONObject("params");
      for (Object key : jparams.keySet()) {
        String k = (String)key;
        params.put(k, jparams.getString(k));
      }
      return new TaskSubmissionRequest(s.getString("priority"), s.getString("pipeline"), params);
    }
View Full Code Here


            writer.writeAttribute(name, (String)value);
          } else if (value instanceof JSONObject){
            JSONObject valueObj = (JSONObject) value;
            String namespace = null;
            JSONObject valueAttrs = valueObj.getJSONObject("attributes");
            for (Object vkey : valueAttrs.keySet()) {
              namespace = valueAttrs.getString((String) vkey);
              break;
            }
            String[] namesplit = name.split(":",2);
            writer.writeAttribute(
View Full Code Here

  private static void writeJsonObject(
    JSONObject object,
    StreamWriter writer) {
      String namespace = null;
      JSONObject valueAttrs = object.getJSONObject("attributes");
      for (Object vkey : valueAttrs.keySet()) {
        String svkey = (String) vkey;
        if (svkey.startsWith("xmlns:"))
          namespace = valueAttrs.getString(svkey);
        break;
      }
View Full Code Here

        idToParent.put(id, parent);
        if (!parents.contains(parent)) {
          parents.add(parent);
        }

        if (parentToChildMap.keySet().contains(parent)) {
          JSONArray childs = (JSONArray) parentToChildMap.get(parent);
          childs.add(id);
          parentToChildMap.put(parent, childs);
        } else {
          JSONArray childs = new JSONArray();
View Full Code Here

    jd.setAuto((persist.getAuto()!=null &&persist.getAuto()==1)?true:false);
    jd.setCronExpression(persist.getCronExpression());
    if(persist.getConfigs()!=null){
      JSONObject object=JSONObject.fromObject(persist.getConfigs());
      jd.setProperties(new HashMap<String, String>());
      for(Object key:object.keySet()){
        jd.getProperties().put(key.toString(), object.getString(key.toString()));
      }
    }
    if(persist.getDependencies()!=null){
      jd.setDependencies(Arrays.asList(persist.getDependencies().split(",")));
View Full Code Here

      List<Map<String, String>> tempRes=new ArrayList<Map<String,String>>();
      JSONArray resArray=JSONArray.fromObject(res);
      for(int i=0;i<resArray.size();i++){
        JSONObject o=resArray.getJSONObject(i);
        Map<String, String> map=new HashMap<String, String>();
        for(Object key:o.keySet()){
          map.put(key.toString(), o.getString(key.toString()));
        }
        tempRes.add(map);
      }
      jd.setResources(tempRes);
View Full Code Here

    status.setStatus(Status.parser(persist.getStatus()));
    status.setHistoryId(persist.getHistoryId()==null?null:persist.getHistoryId().toString());
    status.setReadyDependency(new HashMap<String, String>());
    if(persist.getReadyDependency()!=null){
      JSONObject o=JSONObject.fromObject(persist.getReadyDependency());
      for(Object key:o.keySet()){
        status.getReadyDependency().put(key.toString(), o.getString(key.toString()));
      }
    }
    return new Tuple<JobDescriptor, JobStatus>(jd, status);
  }
View Full Code Here

    gd.setDesc(persist.getDescr());
    gd.setDirectory(persist.getDirectory()==0?true:false);
    if(persist.getConfigs()!=null){
      JSONObject object=JSONObject.fromObject(persist.getConfigs());
      gd.setProperties(new HashMap<String, String>());
      for(Object key:object.keySet()){
        gd.getProperties().put(key.toString(), object.getString(key.toString()));
      }
    }
    String cp=persist.getResources();
    gd.setResources(new ArrayList<Map<String,String>>());
View Full Code Here

    if(persist.getResources()!=null){
      JSONArray resArray=JSONArray.fromObject(cp);
      for(int i=0;i<resArray.size();i++){
        Map<String, String> map=new HashMap<String, String>();
        JSONObject o=resArray.getJSONObject(i);
        for(Object key:o.keySet()){
          map.put(key.toString(), o.getString(key.toString()));
        }
        gd.getResources().add(map);
      }
    }
View Full Code Here

    history.setIllustrate(persist.getIllustrate());
    history.setOperator(persist.getOperator());
    Map<String, String> prop=new HashMap<String, String>();
    if(persist.getProperties()!=null){
      JSONObject json=JSONObject.fromObject(persist.getProperties());
      for(Object key:json.keySet()){
        prop.put(key.toString(), json.getString(key.toString()));
      }
    }
    history.setProperties(prop);
    return history;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.