Class JSONUtils
java.lang.Object
org.opencastproject.index.service.util.JSONUtils
Utility class providing helpers for all operation related to JSON.
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.entwinemedia.fn.data.json.JValuefiltersToJSON(org.opencastproject.list.api.ResourceListQuery query, org.opencastproject.list.api.ListProvidersService listProvidersService, org.opencastproject.security.api.Organization org) Generate JSON presentation of the given filtersstatic com.entwinemedia.fn.data.json.JValuefiltersToJSONSeriesWriteAccess(org.opencastproject.list.api.ResourceListQuery query, org.opencastproject.list.api.ListProvidersService listProvidersService, Map<String, String> series) Generate JSON presentation of the given filtersstatic org.codehaus.jettison.json.JSONObjectReturns a JSON object with key-value from given mapstatic com.entwinemedia.fn.data.json.JObjectTurn a map into aJObjectobjectstatic com.entwinemedia.fn.data.json.JValueTurn a set into aJObjectobjectstatic voidsetUserRegex(String regex) toMap(org.codehaus.jettison.json.JSONObject json) Converts a JSON object to a map.
-
Method Details
-
mapToJSON
Turn a map into aJObjectobject- Parameters:
map- the source map- Returns:
- a new
JObjectgenerated with the map values
-
setToJSON
Turn a set into aJObjectobject- Parameters:
set- the source set- Returns:
- a new
JObjectgenerated with the map values
-
filtersToJSON
public static com.entwinemedia.fn.data.json.JValue filtersToJSON(org.opencastproject.list.api.ResourceListQuery query, org.opencastproject.list.api.ListProvidersService listProvidersService, org.opencastproject.security.api.Organization org) throws org.opencastproject.list.api.ListProviderException Generate JSON presentation of the given filters- Parameters:
query- TheResourceListQuerylistProvidersService- TheListProvidersServiceto get the possible valuesorg- TheOrganization- Returns:
- Throws:
org.opencastproject.list.api.ListProviderException- if the possible values can not be retrieved correctly from the list provider.
-
filtersToJSONSeriesWriteAccess
public static com.entwinemedia.fn.data.json.JValue filtersToJSONSeriesWriteAccess(org.opencastproject.list.api.ResourceListQuery query, org.opencastproject.list.api.ListProvidersService listProvidersService, Map<String, String> series) throws org.opencastproject.list.api.ListProviderExceptionGenerate JSON presentation of the given filters- Parameters:
query- TheResourceListQuerylistProvidersService- TheListProvidersServiceto get the possible valuesseries- The Series with write access- Returns:
- Throws:
org.opencastproject.list.api.ListProviderException- if the possible values can not be retrieved correctly from the list provider.
-
fromMap
public static org.codehaus.jettison.json.JSONObject fromMap(Map<String, String> map) throws org.codehaus.jettison.json.JSONExceptionReturns a JSON object with key-value from given map- Parameters:
map- The source list for the JSON object- Returns:
- a JSON object containing the all the key-value as parameter
- Throws:
org.codehaus.jettison.json.JSONException
-
toMap
Converts a JSON object to a map. All values are of typeString- Parameters:
json- the JSON object to convert- Returns:
- the map
-
setUserRegex
-