Package net.sf.json

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


            Map<String, String> parameters = new HashMap<String, String>();
            JSONObject json = JSONObject.fromString(paramsString);
            Iterator keys = json.keys();
            while (keys.hasNext()) {
                String key = keys.next().toString();
                parameters.put(key, json.opt(key).toString());
            }
            event.setParameters(parameters);
        }
       
        event.setElementName(request.getParameter(this.elementParameter));
View Full Code Here


    logMessage.setLocation(json.optString("location"));
    logMessage.setMessageBody(json.optString("messageBody"));
    logMessage.setTimestamp(json.optString("timestamp"));
    logMessage.setLogLevel(json.optInt("logLevel"));

    Object object = json.opt("messageObject");
    //System.out.println("message object type = " + json.opt("messageObject").getClass());
    //System.out.println("message object = " + json.opt("messageObject"));
    if (object instanceof JSONNull)
    {
      object = null;
View Full Code Here

      java.util.Map relMap = new java.util.HashMap();
      JSONObject jsonObj = (JSONObject)json;
      java.util.Iterator<String> keys = ((JSONObject)json).keys();
      while(keys.hasNext()){
        String key = keys.next();
        Object subJson = jsonObj.opt(key);

        Object valueObj = null;

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

  @Override
  public void analyzeFile(FileConversionContext conversionContext) throws Exception {
    // No conversion required.
    JSONObject fileDescription = conversionContext.getAttachmentDescription();
    JSONObject originalObj = fileDescription.optJSONObject("original");
    fileDescription.put(UploadConstants.SIZE_KEY, originalObj.opt(UploadConstants.SIZE_KEY));
    fileDescription.put(UploadConstants.MIME_KEY, originalObj.opt(UploadConstants.MIME_KEY));
    fileDescription.put(UploadConstants.ENCODING_KEY, originalObj.opt(UploadConstants.ENCODING_KEY));
    fileDescription.put(UploadConstants.MEDIA_FILE_KEY, originalObj.opt(UploadConstants.MEDIA_FILE_KEY));
  }
View Full Code Here

  public void analyzeFile(FileConversionContext conversionContext) throws Exception {
    // No conversion required.
    JSONObject fileDescription = conversionContext.getAttachmentDescription();
    JSONObject originalObj = fileDescription.optJSONObject("original");
    fileDescription.put(UploadConstants.SIZE_KEY, originalObj.opt(UploadConstants.SIZE_KEY));
    fileDescription.put(UploadConstants.MIME_KEY, originalObj.opt(UploadConstants.MIME_KEY));
    fileDescription.put(UploadConstants.ENCODING_KEY, originalObj.opt(UploadConstants.ENCODING_KEY));
    fileDescription.put(UploadConstants.MEDIA_FILE_KEY, originalObj.opt(UploadConstants.MEDIA_FILE_KEY));
  }

  @Override
View Full Code Here

    // No conversion required.
    JSONObject fileDescription = conversionContext.getAttachmentDescription();
    JSONObject originalObj = fileDescription.optJSONObject("original");
    fileDescription.put(UploadConstants.SIZE_KEY, originalObj.opt(UploadConstants.SIZE_KEY));
    fileDescription.put(UploadConstants.MIME_KEY, originalObj.opt(UploadConstants.MIME_KEY));
    fileDescription.put(UploadConstants.ENCODING_KEY, originalObj.opt(UploadConstants.ENCODING_KEY));
    fileDescription.put(UploadConstants.MEDIA_FILE_KEY, originalObj.opt(UploadConstants.MEDIA_FILE_KEY));
  }

  @Override
  public void approveFile(FileConversionContext approvedContext) throws Exception {
View Full Code Here

    JSONObject fileDescription = conversionContext.getAttachmentDescription();
    JSONObject originalObj = fileDescription.optJSONObject("original");
    fileDescription.put(UploadConstants.SIZE_KEY, originalObj.opt(UploadConstants.SIZE_KEY));
    fileDescription.put(UploadConstants.MIME_KEY, originalObj.opt(UploadConstants.MIME_KEY));
    fileDescription.put(UploadConstants.ENCODING_KEY, originalObj.opt(UploadConstants.ENCODING_KEY));
    fileDescription.put(UploadConstants.MEDIA_FILE_KEY, originalObj.opt(UploadConstants.MEDIA_FILE_KEY));
  }

  @Override
  public void approveFile(FileConversionContext approvedContext) throws Exception {
   
View Full Code Here

      }
      if( false == pluginFound ) {
        logger.info("No plugin found to analyze file class: "+fileClass);
       
        // By default, original file is used
        analyzedObj.put(UploadConstants.MEDIA_FILE_KEY, originalObj.opt(UploadConstants.MEDIA_FILE_KEY));
        analyzedObj.put(UploadConstants.MIME_KEY, originalObj.opt(UploadConstants.MIME_KEY));
        analyzedObj.put(UploadConstants.ENCODING_KEY, originalObj.opt(UploadConstants.ENCODING_KEY));
        analyzedObj.put(UploadConstants.SIZE_KEY, originalObj.opt(UploadConstants.SIZE_KEY));
      }
     
View Full Code Here

      if( false == pluginFound ) {
        logger.info("No plugin found to analyze file class: "+fileClass);
       
        // By default, original file is used
        analyzedObj.put(UploadConstants.MEDIA_FILE_KEY, originalObj.opt(UploadConstants.MEDIA_FILE_KEY));
        analyzedObj.put(UploadConstants.MIME_KEY, originalObj.opt(UploadConstants.MIME_KEY));
        analyzedObj.put(UploadConstants.ENCODING_KEY, originalObj.opt(UploadConstants.ENCODING_KEY));
        analyzedObj.put(UploadConstants.SIZE_KEY, originalObj.opt(UploadConstants.SIZE_KEY));
      }
     
      // Update document
View Full Code Here

        logger.info("No plugin found to analyze file class: "+fileClass);
       
        // By default, original file is used
        analyzedObj.put(UploadConstants.MEDIA_FILE_KEY, originalObj.opt(UploadConstants.MEDIA_FILE_KEY));
        analyzedObj.put(UploadConstants.MIME_KEY, originalObj.opt(UploadConstants.MIME_KEY));
        analyzedObj.put(UploadConstants.ENCODING_KEY, originalObj.opt(UploadConstants.ENCODING_KEY));
        analyzedObj.put(UploadConstants.SIZE_KEY, originalObj.opt(UploadConstants.SIZE_KEY));
      }
     
      // Update document
      conversionContext.setStatus(UploadConstants.UPLOAD_STATUS_WAITING_FOR_APPROVAL);
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.