public class FileToProductLookup<P extends Product> extends FileToEntityLookup<P>
File
, identify which Product
it related to
ChangeGenerator
,
FileToEntityLookup} for event callbacks
listeners
Constructor and Description |
---|
FileToProductLookup() |
FileToProductLookup(FileToProductLookup<P> parent) |
Modifier and Type | Method and Description |
---|---|
protected List<P> |
getEntities(Query<P> entityQuery)
Override to implement custom services that will execute the
Query and return result(s) |
org.apache.commons.collections.Transformer |
getPartialMatchTransformer()
If defined, this will be applied over the value of the
FileToEntityLookup.getRelatedFieldName() just before it is searched on the DB.For example if SKU's = "0102-37", "0102-38" etc; and we want the same file mapped to all SKU that match ="0102-". Hence in this example, by having a transformer that applies partialMatchTransformer("0102-37") ~> "0102-%" and then the partial match will match SKU values that start with 0102- If not partialMatchTransformer is supplied then the match is conducted with %fieldValue%. If partialMatchTransformer is used then it is the role of the transformer to also provide the DB like match characters '%' |
ProductService<P> |
getProductService() |
protected P |
getQueryInstance()
Construct Query Object; get base instance entity for
Query |
Pattern |
getSupportPartialMatchOn()
If
Pattern set; it will see if the value being looked for contains supportPartialMatchOn as a subsequence using Matcher.find() ; and then if FileToEntityLookup.getRelatedFieldName() matches the file name partially also, if so it will
include it in the Lookup for Product s. |
protected void |
modify(Query<P> entityQuery)
Override to implement any further modification to the
Query . |
void |
setPartialMatchTransformer(org.apache.commons.collections.Transformer partialMatchTransformer)
If defined, this will be applied over the value of the
FileToEntityLookup.getRelatedFieldName() just before it is searched on the DB.For example if SKU's = "0102-37", "0102-38" etc; and we want the same file mapped to all SKU that match ="0102-". Hence in this example, by having a transformer that applies partialMatchTransformer("0102-37") ~> "0102-%" and then the partial match will match SKU values that start with 0102- If not partialMatchTransformer is supplied then the match is conducted with %fieldValue%. If partialMatchTransformer is used then it is the role of the transformer to also provide the DB like match characters '%' |
void |
setProductService(ProductService<P> productService) |
void |
setSupportPartialMatchOn(Pattern supportPartialMatchOn)
If
Pattern set; it will see if the value being looked for contains supportPartialMatchOn as a subsequence using Matcher.find() ; and then if FileToEntityLookup.getRelatedFieldName() matches the file name partially also, if so it will
include it in the Lookup for Product s. |
addChangeListener, deriveIdRelatedInfo, getExtractedNameTransformer, getExtractionPattern, getListeners, getRelatedFieldName, notifyAllListeners, setExtractedNameTransformer, setExtractionPattern, setListeners, setRelatedFieldName, transform
public FileToProductLookup()
public FileToProductLookup(FileToProductLookup<P> parent) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
protected List<P> getEntities(Query<P> entityQuery) throws Exception
FileToEntityLookup
Query
and return result(s)getEntities
in class FileToEntityLookup<P extends Product>
entityQuery
- as Query
Exception
public ProductService<P> getProductService()
public void setProductService(ProductService<P> productService)
protected P getQueryInstance() throws Exception
FileToEntityLookup
Query
getQueryInstance
in class FileToEntityLookup<P extends Product>
Exception
protected void modify(Query<P> entityQuery)
Query
. The Query passed here will already have the FileToEntityLookup.relatedFieldName
set.
In addition to that if one wants to do things like range searches or regular expression matches etc, one may customize that here.entityQuery
- as Query
public Pattern getSupportPartialMatchOn()
Pattern
set; it will see if the value being looked for contains supportPartialMatchOn
as a subsequence using Matcher.find()
; and then if FileToEntityLookup.getRelatedFieldName()
matches the file name partially also, if so it will
include it in the Lookup for Product
s. If false it will only look for exact matches.
Query.getEntity()
is NOT Queryable.exactMatch()
; then one can skip this as it is expected that
the underlying DAO will support partial search on Queryable
fields that are marked as false for exact match.public void setSupportPartialMatchOn(Pattern supportPartialMatchOn)
Pattern
set; it will see if the value being looked for contains supportPartialMatchOn
as a subsequence using Matcher.find()
; and then if FileToEntityLookup.getRelatedFieldName()
matches the file name partially also, if so it will
include it in the Lookup for Product
s. If false it will only look for exact matches.
Query.getEntity()
is NOT Queryable.exactMatch()
; then one can skip this as it is expected that
the underlying DAO will support partial search on Queryable
fields that are marked as false for exact match.public org.apache.commons.collections.Transformer getPartialMatchTransformer()
FileToEntityLookup.getRelatedFieldName()
just before it is searched on the DB.partialMatchTransformer
is used then it is the role of the transformer to also provide the DB like match characters '%'public void setPartialMatchTransformer(org.apache.commons.collections.Transformer partialMatchTransformer)
FileToEntityLookup.getRelatedFieldName()
just before it is searched on the DB.partialMatchTransformer
is used then it is the role of the transformer to also provide the DB like match characters '%'Copyright © 2018. All rights reserved.