P
- TODO: Make a generic version for IHierarchialReference, once HierarchyService
is updated to accomodate ProductService common methods.
TODO: Fix initialization to not make productService optional when its code base is separated.@Component(value="productContextUtils") public class ProductContextUtils<P extends Product> extends ContextUtils
ContextUtils
that help in deriving Catalog module related Context / configurations and customizations
context, MODULESMAP_BEAN_NAME, springStaticConfigSource
Constructor and Description |
---|
ProductContextUtils() |
Modifier and Type | Method and Description |
---|---|
String |
getConfigProperty(String callerId,
List<P> thisAndParents,
String key) |
protected String |
getConfigProperty(String callerId,
Object o,
Object keyDeriver,
String key)
Derive property config for modelId (if defined) else default from admin.properties
Class name . |
String |
getConfigProperty(String callerId,
ProductReference thisProductRef,
String key)
Scans hierarchy for config property as
SpringStaticConfiguration s and then finally in adminProperties for the key. |
String |
getConfigProperty(String callerId,
P thisProduct,
String key) |
Properties |
getDefaultConfiguration() |
static ProductContextUtils |
getInstance() |
SerializableTransformer |
getNameSpaceDeriveTransformer() |
List<P> |
getThisAndParents(P thisProduct) |
List<P> |
getThisAndParents(ProductReference thisProductRef) |
void |
init() |
void |
setDefaultConfiguration(Properties defaultConfiguration) |
void |
setNameSpaceDeriveTransformer(SerializableTransformer productNameTransformer) |
getConfigProperty, getConfigProperty, getModule, getModuleFromContext
@PostConstruct public void init()
init
in class ContextUtils
public static ProductContextUtils getInstance()
public List<P> getThisAndParents(ProductReference thisProductRef)
thisProductRef
- as ProductReference
for the product/category to fetch it and its parents.protected String getConfigProperty(String callerId, Object o, Object keyDeriver, String key)
SpringStaticConfiguration
, the value is a Map of key, values of the key matching whats in the admin config for default categoriescallerId
- as String. The identifying Calling API for which the configurations exist. Within this nameSpaceDeriveTransformer
will be used to search the configurations for the Category.o
- as Object - Object from which key will be derivedkeyDeriver
- as String or Transformer which can be null, for the model this Panel instance represents for which we expect config overrideskey
- as String, as the key property we wish to fetchpublic String getConfigProperty(String callerId, ProductReference thisProductRef, String key)
SpringStaticConfiguration
s and then finally in adminProperties for the key.callerId
- as String. The identifying Calling API for which the configurations exist. Within this nameSpaceDeriveTransformer
will be used to search the configurations for the Category.thisProductRef
- as Current categorykey
- as Stringpublic String getConfigProperty(String callerId, List<P> thisAndParents, String key)
callerId
- as String. The identifying Calling API for which the configurations exist. Within this nameSpaceDeriveTransformer
will be used to search the configurations for the Category.thisProductRef
- as Current categorythisAndParents
- as List of products to scan for properties in hierarchykey
- public String getConfigProperty(String callerId, P thisProduct, String key)
callerId
- as String. The identifying Calling API for which the configurations exist. Within this nameSpaceDeriveTransformer
will be used to search the configurations for the Category.thisProductRef
- as Current categorythisAndParents
- as List of products to scan for properties in hierarchykey
- public Properties getDefaultConfiguration()
public void setDefaultConfiguration(Properties defaultConfiguration)
public SerializableTransformer getNameSpaceDeriveTransformer()
public void setNameSpaceDeriveTransformer(SerializableTransformer productNameTransformer)
Copyright © 2018. All rights reserved.