com.atlassian.jira.sharing
Class SharePermissionUtils

java.lang.Object
  extended by com.atlassian.jira.sharing.SharePermissionUtils

public class SharePermissionUtils
extends Object

Some utility functions for dealing with SharePermission instances.

TODO move to UI package

Since:
v3.13

Method Summary
static SharedEntity.SharePermissions fromJsonArray(JSONArray array)
          Convert the passed array into SharePermissions.
static SharedEntity.SharePermissions fromJsonArrayString(String jsonString)
           
static SharePermission fromJsonObject(JSONObject json)
          Return a SharePermission from a JSON object.
static SharePermission fromJsonObjectString(String jsonString)
          Create a SharePermission from the passed JSON string.
static JSONObject toJson(SharePermission permission)
          Convert the passed permission into a JSON object.
static JSONArray toJsonArray(Collection<SharePermission> permissions)
          Converts the passed SharePermissions into a JSON array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toJson

public static JSONObject toJson(SharePermission permission)
                         throws JSONException
Convert the passed permission into a JSON object.

Parameters:
permission - the permission to convert.
Returns:
A JSON object representing the permission.
Throws:
JSONException - if an error occurs while creating the JSON object.

toJsonArray

public static JSONArray toJsonArray(Collection<SharePermission> permissions)
                             throws JSONException
Converts the passed SharePermissions into a JSON array.

Parameters:
permissions - the permissions to convert.
Returns:
the JSON array.
Throws:
JSONException - if an error occurs while creating the JSONArray.

fromJsonObject

public static SharePermission fromJsonObject(JSONObject json)
                                      throws JSONException
Return a SharePermission from a JSON object.

Parameters:
json - the JSON object to convert.
Returns:
the converted SharePermission.
Throws:
JSONException - if an error occurs while converting the object.

fromJsonObjectString

public static SharePermission fromJsonObjectString(String jsonString)
                                            throws JSONException
Create a SharePermission from the passed JSON string.

Parameters:
jsonString - the JSON string make a SharePermission from.
Returns:
the new SharePermission.
Throws:
JSONException - if an error occurs while converting the object.

fromJsonArray

public static SharedEntity.SharePermissions fromJsonArray(JSONArray array)
                                                   throws JSONException
Convert the passed array into SharePermissions.

Parameters:
array - the JSON array to convert.
Returns:
the converted SharePermission.
Throws:
JSONException - if an error occurs during convertion.

fromJsonArrayString

public static SharedEntity.SharePermissions fromJsonArrayString(String jsonString)
                                                         throws JSONException
Throws:
JSONException


Copyright © 2002-2012 Atlassian. All Rights Reserved.