org.openid4java.message.ax
Class FetchRequest

java.lang.Object
  extended by org.openid4java.message.ax.AxMessage
      extended by org.openid4java.message.ax.FetchRequest
All Implemented Interfaces:
MessageExtension, MessageExtensionFactory

public class FetchRequest
extends AxMessage

Implements the extension for Attribute Exchange fetch requests.

Author:
Marius Scurtescu, Johnny Bufu
See Also:
Message

Field Summary
 
Fields inherited from class org.openid4java.message.ax.AxMessage
_parameters, OPENID_NS_AX
 
Constructor Summary
protected FetchRequest()
          Constructs a Fetch Request with an empty parameter list.
protected FetchRequest(ParameterList params)
          Constructs a FetchRequest from a parameter list.
 
Method Summary
 java.lang.String addAttribute(java.lang.String typeUri, boolean required)
          Adds an attribute to the fetch request, with a default value-count of 1.
 void addAttribute(java.lang.String alias, java.lang.String typeUri, boolean required)
          Adds an attribute to the fetch request, with a default value-count of 1.
 void addAttribute(java.lang.String alias, java.lang.String typeUri, boolean required, int count)
          Adds an attribute to the fetch request.
static FetchRequest createFetchRequest()
          Constructs a Fetch Request with an empty parameter list.
static FetchRequest createFetchRequest(ParameterList params)
          Constructs a FetchRequest from a parameter list.
 java.util.Map getAttributes()
          Gets all requested attributes (required and optional).
 java.util.Map getAttributes(boolean required)
          Returns a map with the requested attributes.
 int getCount(java.lang.String alias)
          Returns the number of values requested for the specified attribute alias.
 java.lang.String getUpdateUrl()
          Gets the optional 'update_url' parameter if available, or null otherwise.
 boolean isValid()
          Checks the validity of the extension.
 void setCount(java.lang.String alias, int count)
          Sets the desired number of attribute vaules requested for the specified attribute alias.
 void setUpdateUrl(java.lang.String updateUrl)
          Sets the optional 'update_url' parameter where the OP can later re-post fetch-response updates to the values of the requested attributes.
 
Methods inherited from class org.openid4java.message.ax.AxMessage
getExtension, getParameters, getParameterValue, getTypeUri, providesIdentifier, setParameters, signRequired
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FetchRequest

protected FetchRequest()
Constructs a Fetch Request with an empty parameter list.


FetchRequest

protected FetchRequest(ParameterList params)
Constructs a FetchRequest from a parameter list.

The parameter list can be extracted from a received message with the getExtensionParams method of the Message class, and MUST NOT contain the "openid.." prefix.

Method Detail

createFetchRequest

public static FetchRequest createFetchRequest()
Constructs a Fetch Request with an empty parameter list.


createFetchRequest

public static FetchRequest createFetchRequest(ParameterList params)
                                       throws MessageException
Constructs a FetchRequest from a parameter list.

The parameter list can be extracted from a received message with the getExtensionParams method of the Message class, and MUST NOT contain the "openid.." prefix.

Throws:
MessageException

addAttribute

public void addAttribute(java.lang.String alias,
                         java.lang.String typeUri,
                         boolean required,
                         int count)
                  throws MessageException
Adds an attribute to the fetch request.

Parameters:
alias - The attribute alias that will be associated with the attribute type URI
typeUri - The attribute type URI
required - If true, marks the attribute as 'required'; 'if_available' otherwise.
count - The number of attribute values requested. 0 for the special value "unlimited".
Throws:
MessageException

addAttribute

public void addAttribute(java.lang.String alias,
                         java.lang.String typeUri,
                         boolean required)
                  throws MessageException
Adds an attribute to the fetch request, with a default value-count of 1.

Throws:
MessageException
See Also:
addAttribute(String, String, boolean, int)

addAttribute

public java.lang.String addAttribute(java.lang.String typeUri,
                                     boolean required)
                              throws MessageException
Adds an attribute to the fetch request, with a default value-count of 1. An alias is generated for the provided type URI.

Throws:
MessageException
See Also:
addAttribute(String, String, boolean, int)

setCount

public void setCount(java.lang.String alias,
                     int count)
Sets the desired number of attribute vaules requested for the specified attribute alias. Special value 0 means "unlimited".

Parameters:
alias - The attribute alias.

getCount

public int getCount(java.lang.String alias)
Returns the number of values requested for the specified attribute alias. 1 (the default number) is returned if the count parameter is absent. 0 is returned if the special value "unlimited" was requested.

Parameters:
alias - The attribute alias.

setUpdateUrl

public void setUpdateUrl(java.lang.String updateUrl)
                  throws MessageException
Sets the optional 'update_url' parameter where the OP can later re-post fetch-response updates to the values of the requested attributes.

Parameters:
updateUrl - The URL where the RP accepts later updates to the requested attributes.
Throws:
MessageException

getUpdateUrl

public java.lang.String getUpdateUrl()
Gets the optional 'update_url' parameter if available, or null otherwise.


getAttributes

public java.util.Map getAttributes(boolean required)
Returns a map with the requested attributes.

Parameters:
required - If set to true the list of 'required' attributes is returned, otherwise the list of 'if_available' attributes.
Returns:
Map of attribute aliases -> attribute type URIs.

getAttributes

public java.util.Map getAttributes()
Gets all requested attributes (required and optional).

Returns:
Map of attribute aliases -> attribute type URIs.

isValid

public boolean isValid()
Checks the validity of the extension.

Used when constructing a extension from a parameter list.

Returns:
True if the extension is valid, false otherwise.


Copyright © 2012 Sxip. All Rights Reserved.