public class FileNameTranslatorCategory extends java.lang.Object implements FileNameTranslator
Modifier and Type | Field and Description |
---|---|
private static java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.String> |
cvCache |
private static long |
serialVersionUID
The class' serialization version id.
|
TYPE_DESCR, TYPE_IMAGE
Constructor and Description |
---|
FileNameTranslatorCategory() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
lookupCategory(java.lang.String prodCode)
Returns the category code for a product code or null if error.
|
boolean |
setArgs(java.lang.String args)
Sets arguments used by the configured translator.
|
java.lang.String |
translate(java.lang.String value,
int type,
int size)
Performs translation for the given value (which would typically be a
product code), file type (TYPE_IMAGE, TYPE_DESCR) and file size
(Product.SIZE_SMALL, Product.SIZE_LARGE) and returns the translated
result, in this case the product's category code.
|
private static final java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.String> cvCache
private static final long serialVersionUID
public boolean setArgs(java.lang.String args)
DBUFactory.getTranslator
method to obtain an instance of the translator,
the arguments are automatically set using the "dbutl.FileNameTranslator.args"
property value.setArgs
in interface FileNameTranslator
args
- (String) The translator's arguments.true
if arguments were succesfully set,
otherwise false
.public java.lang.String translate(java.lang.String value, int type, int size)
translate
in interface FileNameTranslator
value
- (String) The value to be translated.type
- (int) The type of file to be translated. Must be one
of the types defined by this class (TYPE_IMAGE
or
TYPE_DESCR
).size
- (int) The size of file to be translated. Must be one
of the sizes defined by the Product
class (SIZE_SMALL
or SIZE_LARGE
).public java.lang.String lookupCategory(java.lang.String prodCode)
prodCode
- (String) The product code.