Package net.sf.json

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


        JSONObject obj = (JSONObject) json;
        assertTrue(obj.containsKey("scales"));
        assertTrue(obj.containsKey("dpis"));
        assertTrue(obj.containsKey("layouts"));
        assertTrue(obj.containsKey("printURL"));
        assertTrue(obj.containsKey("createURL"));
    }
}
View Full Code Here


          // Compute name for attachment
          String attachmentName = null;
          {
            File tempFile = new File(originalName);
            attachmentName = tempFile.getName();
            if( fileDic.containsKey(attachmentName) ) {
              // Select a different file name
              String prefix = "";
              String suffix = "";
              int pos = attachmentName.indexOf('.', 1);
              if( pos < 0 ) {
View Full Code Here

              } else {
                prefix = attachmentName.substring(0, pos-1);
                suffix = attachmentName.substring(pos);
              }
              int counter = 0;
              while( fileDic.containsKey(attachmentName) ) {
                attachmentName = prefix + counter + suffix;
                ++counter;
              }
            }
          }
View Full Code Here

            Set<Map.Entry<String, String>> paramSet = this.parentRemoteRequest.outMap.entrySet();
            Iterator<Map.Entry<String, String>> paramIter = paramSet.iterator();
            Map<String, Object> parentDataMap = this.parentRemoteRequest.parent.getMap();
            while (paramIter.hasNext()) {
                Map.Entry<String, String> paramPair = paramIter.next();
                if (jsonObject.containsKey(paramPair.getKey())) {
                   Object obj = jsonObject.get(paramPair.getKey());
                   System.out.println("RemoteRequest, param-out, name: " + paramPair.getKey() + ", value: " + obj);
                   parentDataMap.put(paramPair.getKey(), obj);
                }
            }
View Full Code Here

      if( false == couchDb.documentExists("_design/"+DESIGN_DOC_NAME) ) {
        creationRequired = true;
      } else {
        // Check if it is the right signature
        JSONObject currentDesignDoc = couchDb.getDocument("_design/"+DESIGN_DOC_NAME);
        if( false == currentDesignDoc.containsKey(DESIGN_DOC_SIG_KEY) ) {
          updateNeeded = true;
        } else {
          String currentSignature = currentDesignDoc.getString(DESIGN_DOC_SIG_KEY);
          if( false == signature.equals(currentSignature) ) {
            updateNeeded = true;
View Full Code Here

      if( false == couchDb.documentExists(docId) ) {
        creationRequired = true;
      } else {
        // Check if it is the right signature
        JSONObject currentDoc = couchDb.getDocument(docId);
        if( false == currentDoc.containsKey(DOC_SIG_KEY) ) {
          updateNeeded = true;
        } else {
          String currentSignature = currentDoc.getString(DOC_SIG_KEY);
          if( false == signature.equals(currentSignature) ) {
            updateNeeded = true;
View Full Code Here

          // Compute name for attachment
          String attachmentName = null;
          {
            File tempFile = new File(originalName);
            attachmentName = tempFile.getName();
            if( fileDic.containsKey(attachmentName) ) {
              // Select a different file name
              String prefix = "";
              String suffix = "";
              int pos = attachmentName.indexOf('.', 1);
              if( pos < 0 ) {
View Full Code Here

              } else {
                prefix = attachmentName.substring(0, pos-1);
                suffix = attachmentName.substring(pos);
              }
              int counter = 0;
              while( fileDic.containsKey(attachmentName) ) {
                attachmentName = prefix + counter + suffix;
                ++counter;
              }
            }
          }
View Full Code Here

  public File getMediaFile(){
    File file = null;
   
    JSONObject originalObj = getJson();
    if( originalObj.containsKey(UploadConstants.MEDIA_FILE_KEY) ) {
      String mediaFileName = originalObj.optString(UploadConstants.MEDIA_FILE_KEY);
      file = new File(attDescription.getMediaDir(), mediaFileName);
    }
   
    return file;
View Full Code Here

  public String getStringAttribute(String key) {
    String value = null;

    JSONObject descriptionObj = getJson();
    if( descriptionObj.containsKey(key) ) {
      value = descriptionObj.getString(key);
    }
   
    return value;
  }
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.