com.unboundid.scim.data
Class BaseResource

java.lang.Object
  extended by com.unboundid.scim.data.BaseResource
All Implemented Interfaces:
SCIMResponse
Direct Known Subclasses:
ClientExample.DeviceResource, GroupResource, ResourceDescriptor, ServiceProviderConfig, UserResource

public class BaseResource
extends Object
implements SCIMResponse

This class represents a SCIM resource. It could also be sub-typed for specific resource types (ie. Users or Groups) that provide convenience methods for accessing specific attribute values.


Field Summary
static ResourceFactory<BaseResource> BASE_RESOURCE_FACTORY
          A ResourceFactory for creating BaseResource instances.
 
Constructor Summary
BaseResource(ResourceDescriptor resourceDescriptor)
          Construct an empty BaseResource with the specified ResourceDescriptor.
BaseResource(ResourceDescriptor resourceDescriptor, SCIMObject scimObject)
          Construct a BaseResource with the specified ResourceDescriptor and backed by the given SCIMObject.
 
Method Summary
 boolean equals(Object o)
          
<T> Collection<T>
getAttributeValues(String schema, String name, AttributeValueResolver<T> resolver)
          Retrieves a multi-valued attribute value.
 String getExternalId()
          Retrieves the unique identifier for the Resource as defined by the Service Consumer.
 String getId()
          Retrieves the unique identifier for the SCIM Resource as defined by the Service Provider.
 Meta getMeta()
          Retrieves the metadata about the resource.
 ResourceDescriptor getResourceDescriptor()
          Retrieves the ResourceDescriptor for this resource.
 SCIMObject getScimObject()
          Retrieves the SCIMObject wrapped by this resource.
<T> T
getSingularAttributeValue(String schema, String name, AttributeValueResolver<T> resolver)
          Retrieves a singular attribute value.
 int hashCode()
          
 void marshal(Marshaller marshaller, OutputStream outputStream)
          Marshals this response using the specified Marshaller to the specified OutputStream.
<T> void
setAttributeValues(String schema, String name, AttributeValueResolver<T> resolver, Collection<T> values)
          Sets a multi-valued attribute value.
 void setExternalId(String externalId)
          Sets the unique identifier for the Resource as defined by the Service Consumer.
 void setId(String id)
          Sets the unique identifier for the SCIM Resource.
 void setMeta(Meta meta)
          Sets the metadata about the resource.
<T> void
setSingularAttributeValue(String schema, String name, AttributeValueResolver<T> resolver, T value)
          Sets a singular attribute value.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

BASE_RESOURCE_FACTORY

public static final ResourceFactory<BaseResource> BASE_RESOURCE_FACTORY
A ResourceFactory for creating BaseResource instances.

Constructor Detail

BaseResource

public BaseResource(ResourceDescriptor resourceDescriptor,
                    SCIMObject scimObject)
Construct a BaseResource with the specified ResourceDescriptor and backed by the given SCIMObject.

Parameters:
resourceDescriptor - The resource descriptor for this SCIM resource.
scimObject - The SCIMObject containing all the SCIM attributes and their values.

BaseResource

public BaseResource(ResourceDescriptor resourceDescriptor)
Construct an empty BaseResource with the specified ResourceDescriptor.

Parameters:
resourceDescriptor - The resource descriptor for this SCIM resource.
Method Detail

getResourceDescriptor

public ResourceDescriptor getResourceDescriptor()
Retrieves the ResourceDescriptor for this resource.

Returns:
The ResourceDescriptor for this resource.

getScimObject

public SCIMObject getScimObject()
Retrieves the SCIMObject wrapped by this resource.

Returns:
The SCIMObject wrapped by this resource.

getId

public String getId()
Retrieves the unique identifier for the SCIM Resource as defined by the Service Provider.

Returns:
The unique identifier for the SCIM Resource as defined by the Service Provider.

setId

public void setId(String id)
Sets the unique identifier for the SCIM Resource.

Parameters:
id - The unique identifier for the SCIM Resource.

getExternalId

public String getExternalId()
Retrieves the unique identifier for the Resource as defined by the Service Consumer.

Returns:
The unique identifier for the Resource as defined by the Service Consumer.

setExternalId

public void setExternalId(String externalId)
Sets the unique identifier for the Resource as defined by the Service Consumer.

Parameters:
externalId - The unique identifier for the Resource as defined by the Service Consumer.

getMeta

public Meta getMeta()
Retrieves the metadata about the resource.

Returns:
The metadata about the resource.

setMeta

public void setMeta(Meta meta)
Sets the metadata about the resource.

Parameters:
meta - The metadata about the resource.

getSingularAttributeValue

public <T> T getSingularAttributeValue(String schema,
                                       String name,
                                       AttributeValueResolver<T> resolver)
Retrieves a singular attribute value.

Type Parameters:
T - The type of the resolved instance representing the value of sub-attribute.
Parameters:
schema - The schema URI of the attribute value to retrieve.
name - The name of the attribute value to retrieve.
resolver - The AttributeValueResolver the should be used to resolve the value to an instance.
Returns:
The resolved value instance or null if the specified attribute does not exist.

setSingularAttributeValue

public <T> void setSingularAttributeValue(String schema,
                                          String name,
                                          AttributeValueResolver<T> resolver,
                                          T value)
                               throws InvalidResourceException
Sets a singular attribute value.

Type Parameters:
T - The type of the resolved instance representing the value of sub-attribute.
Parameters:
schema - The schema URI of the attribute value to retrieve.
name - The name of the attribute value to retrieve.
resolver - The AttributeValueResolver the should be used to resolve the instance to attribute value.
value - The value instance.
Throws:
InvalidResourceException - if the attribute is not defined by the resource.

getAttributeValues

public <T> Collection<T> getAttributeValues(String schema,
                                            String name,
                                            AttributeValueResolver<T> resolver)
Retrieves a multi-valued attribute value.

Type Parameters:
T - The type of the resolved instance representing the value of sub-attribute.
Parameters:
schema - The schema URI of the attribute value to retrieve.
name - The name of the attribute value to retrieve.
resolver - The AttributeValueResolver the should be used to resolve the value to an instance.
Returns:
The collection of resolved value instances or null if the specified attribute does not exist.

setAttributeValues

public <T> void setAttributeValues(String schema,
                                   String name,
                                   AttributeValueResolver<T> resolver,
                                   Collection<T> values)
                        throws InvalidResourceException
Sets a multi-valued attribute value.

Type Parameters:
T - The type of the resolved instance representing the value of sub-attribute.
Parameters:
schema - The schema URI of the attribute value to retrieve.
name - The name of the attribute value to retrieve.
resolver - The AttributeValueResolver the should be used to resolve the instance to attribute value.
values - The value instances.
Throws:
InvalidResourceException - if the attribute is not defined by the resource.

marshal

public void marshal(Marshaller marshaller,
                    OutputStream outputStream)
             throws Exception
Marshals this response using the specified Marshaller to the specified OutputStream.

Specified by:
marshal in interface SCIMResponse
Parameters:
marshaller - The Marshaller to use.
outputStream - The OutputStream to write to.
Throws:
Exception - if an error occurs while performing the marshaling.

equals

public boolean equals(Object o)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2011-2012 UnboundID. All Rights Reserved.