Package net.sf.json

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


  public String getFileClass() {
    String fileClass = null;
   
    JSONObject descriptionObj = getAttachmentDescription();
    if( null != descriptionObj ) {
      fileClass = descriptionObj.optString(UploadConstants.MIME_CLASS_KEY);
    }
   
    return fileClass;
  }
 
View Full Code Here


  public String getStatus() {
    String status = null;
   
    JSONObject descriptionObj = getAttachmentDescription();
    if( null != descriptionObj ) {
      status = descriptionObj.optString(UploadConstants.UPLOAD_STATUS_KEY);
    }
   
    return status;
  }
 
View Full Code Here

      // This is uploading to an existing document
      JSONObject doc = null;
      try {
        doc = couchDb.getDocument(docId);
       
        logger.info("onLoad fetched: "+doc.optString("_id")+" -> "+doc.optString("_rev"));
      } catch(Exception e) {
        logger.error("Unable to load document for id: "+docId,e);
      }

      if( null != doc ) {
View Full Code Here

      // This is uploading to an existing document
      JSONObject doc = null;
      try {
        doc = couchDb.getDocument(docId);
       
        logger.info("onLoad fetched: "+doc.optString("_id")+" -> "+doc.optString("_rev"));
      } catch(Exception e) {
        logger.error("Unable to load document for id: "+docId,e);
      }

      if( null != doc ) {
View Full Code Here

      // This is uploading to an existing document
      JSONObject doc = null;
      try {
        doc = userCouchDb.getDocument(docId);
       
        logger.info("onLoad fetched: "+doc.optString("_id")+" -> "+doc.optString("_rev")
            + " for: " + userContext.getName() );
      } catch(Exception e) {
        logger.error("Unable to load document for id: "+docId,e);
      }
View Full Code Here

      // This is uploading to an existing document
      JSONObject doc = null;
      try {
        doc = userCouchDb.getDocument(docId);
       
        logger.info("onLoad fetched: "+doc.optString("_id")+" -> "+doc.optString("_rev")
            + " for: " + userContext.getName() );
      } catch(Exception e) {
        logger.error("Unable to load document for id: "+docId,e);
      }
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

            try{
                for(int i=0; i<timezoneMapJson.size(); i++) {
                    JSONObject jsonRecord = timezoneMapJson.getJSONObject(i);
                    final String tzName = jsonRecord.getString("value");
                    final String startDateStr = jsonRecord.getString("startDate");
                    final String endDateStr = jsonRecord.optString("endDate");
                    DateTime startDate;
                    DateTime endDate;
                    DateTimeZone tz;

                    tz = DateTimeZone.forID(tzName);
View Full Code Here

                // Skip deleted objects.  Someday, we might consider deleting them here
                if (change.optBoolean("deleted", false)) {
                    continue;
                }
                JSONObject observation = change.getJSONObject("doc");
                if (observation.optString("type").equals("observation")) {
                    MymeeObservationFacet newFacet = createOrUpdateObservation(updateInfo, rootURL, observation);
                    if(newFacet!=null) {
                        newFacets.add(newFacet);

                        // Channel names have all characters that aren't alphanumeric or underscores replaced with underscores
View Full Code Here

        partsList.add(new StringPart("token", token));
        partsList.add(new StringPart("projectKey", project));
        partsList.add(new StringPart("title", title));
        String[] res = multipartPost(partsList, uri, HttpStatus.SC_CREATED);
        JSONObject obj = JSONObject.fromObject(res[0]);
        return address + "gui/active/" + obj.optString("OnlineID", "N/A") + "/";
    }

    public void sendOnlineData(JSONArray data) throws IOException {
        String uri = address + "api/active/receiver/data/";
        LinkedList<Part> partsList = new LinkedList<Part>();
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.