@RestResource(id="atg.userprofiling.restresources.addressRestSubresource") public class AddressRestSubresource extends GenericService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
protected static java.lang.String |
EMPTY |
ProfileTools |
mProfileTools
The profile tools.
|
protected static java.lang.String |
TYPE_AND_NAME |
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
AddressRestSubresource() |
Modifier and Type | Method and Description |
---|---|
protected Link[] |
buildMemberLinks(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> pMembers)
Build the members URIs for the given list of addresses.
|
protected RepositoryItem |
getAddress(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> pAddresses,
java.lang.String pAddressId)
Searches for and returns an address in the given map of address, based on the given id.
|
RepresentationModel |
getAddress(java.lang.String pAddressId)
Gets the address for a user.
|
RepresentationModel |
getAddresses(java.lang.String pType)
Returns all (or specified type) the addresses in the user's address book.
|
protected RepositoryItem |
getProfile()
Returns the profile, which is retrieved from the rest request data.
|
ProfileTools |
getProfileTools()
Returns the profileTools component.
|
protected RepresentationModel.Builder |
getRepresentationModelBuilder(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> pMembers)
Gets the RepresentationModel.Builder with the given map of addresses
being used to build member URIs.
|
protected RepresentationModel.Builder |
getRepresentationModelBuilder(java.lang.Object pState)
Gets the RepresentationModel.Builder with the given object acting as the state.
|
protected Link |
getSelfLink(java.lang.String pItemId,
java.lang.String pParam,
java.lang.String pValue)
Build a self link for the item resource.
|
protected java.lang.String |
getTypeAndName(java.util.Map<java.lang.String,java.lang.String> pMap)
Gets the type and name as homeAddress.My Home Address etc.
|
protected java.lang.String |
getTypeAndName(java.lang.String pType,
java.lang.String pName)
Builds a type and name string for an address, in the format: homeAddress.My Home Address
|
void |
setProfileTools(ProfileTools pProfileTools)
Sets the profileTools component.
|
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService, toString
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public static final java.lang.String CLASS_VERSION
protected static final java.lang.String TYPE_AND_NAME
protected static final java.lang.String EMPTY
public ProfileTools mProfileTools
public void setProfileTools(ProfileTools pProfileTools)
pProfileTools
- The profileTools componentpublic ProfileTools getProfileTools()
@Endpoint(id="/addresses#GET", isSingular=false, filterId="addresses-Default") public RepresentationModel getAddresses(java.lang.String pType) throws RestException
pType
- the address type (homeAddress). If pType not passed in
then all the addresses are returned.RestException
- if an error occurred retrieving the addresses@Endpoint(id="/addresses/{addressId}#GET", isSingular=true, filterId="addresses.id-Default") public RepresentationModel getAddress(java.lang.String pAddressId) throws RestException
pAddressId
- the unique id of the addressRestException
- if an error occurred whilst retrieving the addressprotected java.lang.String getTypeAndName(java.lang.String pType, java.lang.String pName)
pType
- the address typepName
- the address nameprotected java.lang.String getTypeAndName(java.util.Map<java.lang.String,java.lang.String> pMap)
pMap
- the mapprotected RepositoryItem getProfile() throws RestException
RestException
- if the profile is not found in the rest request dataprotected RepositoryItem getAddress(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> pAddresses, java.lang.String pAddressId) throws RestException
pAddresses
- a map of addressespAddressId
- the id of the address that we wish to findRestException
- if the address could not be foundprotected RepresentationModel.Builder getRepresentationModelBuilder(java.lang.Object pState)
pState
- the state that will be added to the representation modelprotected RepresentationModel.Builder getRepresentationModelBuilder(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> pMembers) throws RestException
pMembers
- the members that will be added to the representation modelRestException
- if the member URIs could not be builtprotected Link[] buildMemberLinks(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> pMembers) throws RestException
pMembers
- a map of address from which to build the member URIsRestException
- if a problem occurred whilst building the member URIsprotected Link getSelfLink(java.lang.String pItemId, java.lang.String pParam, java.lang.String pValue)
pItemId
- item id from which to build the self linkpParam
- name of parameter to be added to the linkpValue
- value for the parameter