fr.paris.lutece.plugins.form.utils
Class JSONUtils

java.lang.Object
  extended by fr.paris.lutece.plugins.form.utils.JSONUtils

public final class JSONUtils
extends java.lang.Object

Provides json utility methods for forms


Field Summary
static java.lang.String JSON_KEY_ERROR_MESSAGE
           
static java.lang.String JSON_KEY_FIELD_NAME
           
static java.lang.String JSON_KEY_FILE_EXTENSION
           
static java.lang.String JSON_KEY_FILE_NAME
           
static java.lang.String JSON_KEY_FORM_ERROR
           
static java.lang.String JSON_KEY_ID_ENTRY
           
static java.lang.String JSON_KEY_ID_FIELD
           
static java.lang.String JSON_KEY_ID_FORM
           
static java.lang.String JSON_KEY_ID_RESPONSE
           
static java.lang.String JSON_KEY_MANDATORY_ERROR
           
static java.lang.String JSON_KEY_MIME_TYPE
           
static java.lang.String JSON_KEY_RESPONSE
           
static java.lang.String JSON_KEY_TITLE_QUESTION
           
static java.lang.String JSON_KEY_VALUE_RESPONSE
           
static java.lang.String MESSAGE_DATA_NOT_FOUND
           
static java.lang.String TAG_ID_BLOB
           
 
Method Summary
static FormError buildFormError(java.lang.String strJson)
          Builds FormError from json string
static java.lang.String buildJson(FormError formError)
          Builds json form FormError
static java.lang.String buildJson(java.util.Map<java.lang.Integer,java.util.List<Response>> mapResponse, int nIdForm)
          Builds the json string for the response map
static net.sf.json.JSONObject buildJson(Response response)
          Builds the json string for the Response
static java.util.Map<java.lang.Integer,java.util.List<Response>> buildListResponses(java.lang.String strJSON, java.util.Locale locale, javax.servlet.http.HttpSession session)
          Builds the responses list - null if JSON_KEY_RESPONSE is missing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAG_ID_BLOB

public static final java.lang.String TAG_ID_BLOB
See Also:
Constant Field Values

MESSAGE_DATA_NOT_FOUND

public static final java.lang.String MESSAGE_DATA_NOT_FOUND
See Also:
Constant Field Values

JSON_KEY_ID_FORM

public static final java.lang.String JSON_KEY_ID_FORM
See Also:
Constant Field Values

JSON_KEY_RESPONSE

public static final java.lang.String JSON_KEY_RESPONSE
See Also:
Constant Field Values

JSON_KEY_ID_ENTRY

public static final java.lang.String JSON_KEY_ID_ENTRY
See Also:
Constant Field Values

JSON_KEY_ID_RESPONSE

public static final java.lang.String JSON_KEY_ID_RESPONSE
See Also:
Constant Field Values

JSON_KEY_ID_FIELD

public static final java.lang.String JSON_KEY_ID_FIELD
See Also:
Constant Field Values

JSON_KEY_VALUE_RESPONSE

public static final java.lang.String JSON_KEY_VALUE_RESPONSE
See Also:
Constant Field Values

JSON_KEY_FILE_NAME

public static final java.lang.String JSON_KEY_FILE_NAME
See Also:
Constant Field Values

JSON_KEY_FILE_EXTENSION

public static final java.lang.String JSON_KEY_FILE_EXTENSION
See Also:
Constant Field Values

JSON_KEY_ERROR_MESSAGE

public static final java.lang.String JSON_KEY_ERROR_MESSAGE
See Also:
Constant Field Values

JSON_KEY_MANDATORY_ERROR

public static final java.lang.String JSON_KEY_MANDATORY_ERROR
See Also:
Constant Field Values

JSON_KEY_TITLE_QUESTION

public static final java.lang.String JSON_KEY_TITLE_QUESTION
See Also:
Constant Field Values

JSON_KEY_FORM_ERROR

public static final java.lang.String JSON_KEY_FORM_ERROR
See Also:
Constant Field Values

JSON_KEY_FIELD_NAME

public static final java.lang.String JSON_KEY_FIELD_NAME
See Also:
Constant Field Values

JSON_KEY_MIME_TYPE

public static final java.lang.String JSON_KEY_MIME_TYPE
See Also:
Constant Field Values
Method Detail

buildJson

public static java.lang.String buildJson(java.util.Map<java.lang.Integer,java.util.List<Response>> mapResponse,
                                         int nIdForm)
Builds the json string for the response map

Parameters:
mapResponse - the response map
nIdForm - the id form
Returns:
the json string

buildListResponses

public static java.util.Map<java.lang.Integer,java.util.List<Response>> buildListResponses(java.lang.String strJSON,
                                                                                           java.util.Locale locale,
                                                                                           javax.servlet.http.HttpSession session)
Builds the responses list - null if JSON_KEY_RESPONSE is missing.

Parameters:
strJSON - the json
locale - the locale
session - the session
Returns:
the responses list - null if JSON_KEY_RESPONSE is missing

buildJson

public static net.sf.json.JSONObject buildJson(Response response)
Builds the json string for the Response

Parameters:
response - the response
Returns:
the json string

buildJson

public static java.lang.String buildJson(FormError formError)
Builds json form FormError

Parameters:
formError - FormError
Returns:
json string

buildFormError

public static FormError buildFormError(java.lang.String strJson)
Builds FormError from json string

Parameters:
strJson - json string
Returns:
the FormError


Copyright © 2012 Mairie de Paris. All Rights Reserved.