@RestResource(id="atg.userprofiling.restresources.currentUserAddressRestSubresource") public class CurrentUserAddressRestSubresource extends AddressRestSubresource implements UpdateableRestResource
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
static java.lang.String |
INVALID_QUERY_PARAMS |
static java.lang.String |
RESOURCE_NAME |
protected static java.util.ResourceBundle |
sResourceBundle
The resource bundle.
|
EMPTY, mProfileTools, 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 |
---|
CurrentUserAddressRestSubresource() |
Modifier and Type | Method and Description |
---|---|
RepresentationModel |
addAddress(org.json.JSONObject pInputJson)
It adds the address.
|
protected Address |
createAddress(RepositoryItem pItem,
java.util.Map<java.lang.String,java.lang.String> pAddressMap)
It creates the address object which includes existing address information
along with update address information supplied in inputs.
|
Response |
deleteAddress(java.lang.String pAddressId)
Removes a specific address from the user's address book.
|
Response |
deleteAddresses(java.lang.String pTypesAndNames)
Delete addresses (using type and nickname) from the current user.
|
protected java.lang.String |
getAddressNickname(java.util.Map pAddressUpdates,
Address pAddress)
This method attempts to retrieve a 'nickname' property from the
pAddressUpdates parameter. |
protected java.util.Map<java.lang.String,java.lang.String> |
getTypesAndNames(java.lang.String pTypeAndName)
Gets the types and names from the comma separated input.
|
java.net.URI |
update(atg.service.jaxrs.ResourceUpdateInfo pRestResourceUpdateInfo)
This method handles updates contained with
pRestResourceUpdateInfo . |
RepresentationModel |
updateAddress(java.lang.String pAddressId,
org.json.JSONObject pInputJson)
Updates an address associated with the current user profile.
|
RepresentationModel |
updateAddresses(org.json.JSONObject pInputJson)
Using the PATCH Merge protocol add/remove/update addresses belonging to the CurrentUser.
|
buildMemberLinks, getAddress, getAddress, getAddresses, getProfile, getProfileTools, getRepresentationModelBuilder, getRepresentationModelBuilder, getSelfLink, getTypeAndName, getTypeAndName, setProfileTools
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
updateEmbeddedResources
public static final java.lang.String CLASS_VERSION
public static final java.lang.String RESOURCE_NAME
public static final java.lang.String INVALID_QUERY_PARAMS
protected static java.util.ResourceBundle sResourceBundle
@Endpoint(id="/addresses/{addressId}#DELETE", isSingular=true) public Response deleteAddress(java.lang.String pAddressId) throws RestException, RepositoryException
pAddressId
- the unique id of the addressRestException
- if an error occurs deleting the addressRepositoryException
- if an error occurs deleting the address@Endpoint(id="/addresses/typesAndNames#DELETE") public Response deleteAddresses(java.lang.String pTypesAndNames) throws RestException, RepositoryException
pTypesAndNames
- the 'types and names' should be passed together as comma separated
values i.e. homeAddress.My Home Address etc.RestException
- if an error occurs deleting the addressesRepositoryException
- if an error occurs deleting the addresses@Endpoint(id="/addresses/#POST", validatorId="addresses.id-Full", filterId="addresses.id-Default", disableChangeTracking=true) public RepresentationModel addAddress(org.json.JSONObject pInputJson) throws RestException, RepositoryException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException, java.beans.IntrospectionException
pInputJson
- JSON representation of the address to be addedRestException
- if an error occurs adding the addressRepositoryException
- if an error occurs adding the addressjava.lang.InstantiationException
- if an error occurs adding the addressjava.lang.IllegalAccessException
- if an error occurs adding the addressjava.lang.ClassNotFoundException
- if an error occurs adding the addressjava.beans.IntrospectionException
- if an error occurs adding the address@PATCH @Endpoint(id="/addresses/{addressId}#PATCH", isSingular=true, validatorId="addresses.id-Full", filterId="addresses.id-Full", updateTarget=true) public RepresentationModel updateAddress(java.lang.String pAddressId, org.json.JSONObject pInputJson) throws RestException
pAddressId
- id of the address to updatepInputJson
- representation of address updates to applyRestException
- if something went wrong updating the address@PATCH @Endpoint(id="/addresses/#PATCH", validatorId="addresses-Full", filterId="addresses-Default") public RepresentationModel updateAddresses(org.json.JSONObject pInputJson) throws RestException
pInputJson
- JSON representation of the updated addresses to be updatedRestException
- if something went wrong updating the addressesprotected java.util.Map<java.lang.String,java.lang.String> getTypesAndNames(java.lang.String pTypeAndName)
pTypeAndName
- the type and nameprotected Address createAddress(RepositoryItem pItem, java.util.Map<java.lang.String,java.lang.String> pAddressMap) throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException, java.beans.IntrospectionException
pItem
- the itempAddressMap
- the address mapjava.lang.InstantiationException
- the instantiation exceptionjava.lang.IllegalAccessException
- the illegal access exceptionjava.lang.ClassNotFoundException
- the class not found exceptionjava.beans.IntrospectionException
- the introspection exceptionpublic java.net.URI update(atg.service.jaxrs.ResourceUpdateInfo pRestResourceUpdateInfo) throws RestException
pRestResourceUpdateInfo
. It will inspect its
memberUpdateInfos for updates to the collection (addresses). Based on the update type (added/changed/removed),
the members of the collection (addresses) and as a result, the whole collection will be modified.update
in interface UpdateableRestResource
pRestResourceUpdateInfo
- - addresses collection update object, containing update data (request inputs and any existing repository data)
to be applied to the collection's members.RestException
- - if an issue occurs performing the update.protected java.lang.String getAddressNickname(java.util.Map pAddressUpdates, Address pAddress)
pAddressUpdates
parameter.pAddressUpdates
- Map of address properties, including nicknamepAddress
- Address object of address being created/updated.