public class YContextResourceResolver
extends java.lang.Object
1) creating URL's for specified model instance
2) retrieving specified model from information contained in the URL
| Modifier and Type | Field and Description |
|---|---|
static int |
FROM_TYPE_OR_VALUE |
static java.lang.String |
QUERY_PARAMETERS_KEY_SEPARATOR |
static java.lang.String |
QUERY_PARAMETERS_PAIRSEPARATOR |
static java.lang.String |
QUERY_PARAMETERS_PREFIX |
static java.lang.String |
QUERY_PARAMETERS_VALUE_SEPARATOR |
static int |
TO_TYPE_OR_VALUE |
| Constructor and Description |
|---|
YContextResourceResolver(ServiceLocator serviceLocator) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
buildUri(java.lang.Object modelValue,
java.lang.Object propValue)
Method creates appropriate URL for the given model.
|
java.lang.String |
getBaseUrl() |
ServiceLocator |
getServiceLocator() |
java.lang.String |
getUniquePropertyName(ComposedTypeModel composedTypeModel)
Method returns unique primitive attribute name of the given composedTypeModel.
|
ItemModel |
readResourceInternal(ItemModel modelToSet,
java.lang.String composedType,
UriInfo uriInfo,
ItemModel uniqueMember)
Method obtains existing(saved) model from empty(not saved) model which is bulit from information that are pull out
from URL path(uniqueMember attribute) and query parameter.
|
void |
setBaseUrl(java.lang.String baseUrl) |
public static final java.lang.String QUERY_PARAMETERS_PREFIX
public static final java.lang.String QUERY_PARAMETERS_PAIRSEPARATOR
public static final java.lang.String QUERY_PARAMETERS_KEY_SEPARATOR
public static final java.lang.String QUERY_PARAMETERS_VALUE_SEPARATOR
public static final int TO_TYPE_OR_VALUE
public static final int FROM_TYPE_OR_VALUE
public YContextResourceResolver(ServiceLocator serviceLocator)
public ServiceLocator getServiceLocator()
public java.lang.String getBaseUrl()
public void setBaseUrl(java.lang.String baseUrl)
public java.lang.String buildUri(java.lang.Object modelValue,
java.lang.Object propValue)
Example:
1) given model - CarModel(unique primitive attribute: c1)
2) its three non-primitive unique attributes:
2a) ManufacturerModel(m1)
2b) UserModel(u1)
2c) ProductModel(p1) and its unique:
3) CatalogVersionModel(Online) and its unique:
4) CatalogModel(hwcatalog)
Result url:
http://{host_port_webroot}/catalogs/hwcatalog/catalogversions/Online/products/p1/cars/c1?um__car;manufacturer__car;user=c1;m1,c1:u1
modelValue - model ValuepropValue - value of the non-primitive unique attribute of the modelValuepublic ItemModel readResourceInternal(ItemModel modelToSet, java.lang.String composedType, UriInfo uriInfo, ItemModel uniqueMember) throws BadRequestException
modelToSet - empty(not saved) model(template)composedType - the code of the composedType of the modelToSeturiInfo - uri information and by the way the special query parameter with information about unique members of
modelToSet.uniqueMember - the unique member(of modelToSet) which is passed from resource to resource(via URL path)BadRequestExceptionpublic java.lang.String getUniquePropertyName(ComposedTypeModel composedTypeModel)
composedTypeModel - the given modelCopyright © 2018 SAP SE. All Rights Reserved.