com.tinkerpop.rexster.util
Class RequestObjectHelper

java.lang.Object
  extended by com.tinkerpop.rexster.util.RequestObjectHelper

public class RequestObjectHelper
extends Object

Author:
Marko A. Rodriguez (http://markorodriguez.com)

Field Summary
static String DEFAULT_WILDCARD
           
 
Constructor Summary
RequestObjectHelper()
           
 
Method Summary
static Long getEndOffset(org.codehaus.jettison.json.JSONObject requestObject)
          Given a request object, return the end offset for paging purposes.
static List<String> getReturnKeys(org.codehaus.jettison.json.JSONArray arrayOfKeys, String wildcard)
          Given an array of keys from the request object, return the desired returnKeys.
static List<String> getReturnKeys(org.codehaus.jettison.json.JSONObject requestObject)
          Given a request object, return the desired returnKeys.
static List<String> getReturnKeys(org.codehaus.jettison.json.JSONObject requestObject, String wildcard)
          Given a request object, return the desired returnKeys.
static org.codehaus.jettison.json.JSONObject getRexsterRequest(org.codehaus.jettison.json.JSONObject requestObject)
          Given a request object, return the fragment of JSON that deals with Rexster-reserved parameters.
static boolean getShowTypes(org.codehaus.jettison.json.JSONObject requestObject)
          Given a request object, return the show types.
static Long getStartOffset(org.codehaus.jettison.json.JSONObject requestObject)
          Given a request object, return the start offset for paging purposes.
static boolean hasElementProperties(org.codehaus.jettison.json.JSONObject requestObject)
          Given a request object, determine if it has graph element properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_WILDCARD

public static final String DEFAULT_WILDCARD
See Also:
Constant Field Values
Constructor Detail

RequestObjectHelper

public RequestObjectHelper()
Method Detail

getRexsterRequest

public static org.codehaus.jettison.json.JSONObject getRexsterRequest(org.codehaus.jettison.json.JSONObject requestObject)
Given a request object, return the fragment of JSON that deals with Rexster-reserved parameters.

These parameters are the returnKeys, showTypes, and offset.

Parameters:
requestObject - the request object
Returns:
the JSON

getReturnKeys

public static List<String> getReturnKeys(org.codehaus.jettison.json.JSONObject requestObject)
Given a request object, return the desired returnKeys. Utilizes the value of the DEFAULT_WILDCARD.

Parameters:
requestObject - the request object
Returns:
the return keys

getReturnKeys

public static List<String> getReturnKeys(org.codehaus.jettison.json.JSONObject requestObject,
                                         String wildcard)
Given a request object, return the desired returnKeys.

Parameters:
requestObject - the request object
wildcard - a value that represents the specification of all keys
Returns:
the return keys

getReturnKeys

public static List<String> getReturnKeys(org.codehaus.jettison.json.JSONArray arrayOfKeys,
                                         String wildcard)
Given an array of keys from the request object, return the desired returnKeys.

Useful for when the return keys are being passed in as a parameter to an extension method.

Parameters:
arrayOfKeys - array of keys from the request object.
wildcard - a value that represents the specification of all keys
Returns:
the return keys

getShowTypes

public static boolean getShowTypes(org.codehaus.jettison.json.JSONObject requestObject)
Given a request object, return the show types.

Parameters:
requestObject - the request object
Returns:
whether the user specified a show types (default is false)

getStartOffset

public static Long getStartOffset(org.codehaus.jettison.json.JSONObject requestObject)
Given a request object, return the start offset for paging purposes.

Parameters:
requestObject - the request object.
Returns:
the start offset

getEndOffset

public static Long getEndOffset(org.codehaus.jettison.json.JSONObject requestObject)
Given a request object, return the end offset for paging purposes.

Parameters:
requestObject - the request object.
Returns:
the end offset

hasElementProperties

public static boolean hasElementProperties(org.codehaus.jettison.json.JSONObject requestObject)
Given a request object, determine if it has graph element properties.

Graph element properties are those that do not have an underscore.

Parameters:
requestObject - the request object.
Returns:
true if the element has properties and false otherwise.


Copyright © 2009-2012. All Rights Reserved.