Class FileLoaderValueTranslator


  • public class FileLoaderValueTranslator
    extends AbstractValueTranslator
    Generic ValueTranslator that sets a string attribute. The value is loaded from a file. Supports loading files, jar resources or zip file entries.
    • Constructor Detail

      • FileLoaderValueTranslator

        public FileLoaderValueTranslator()
    • Method Detail

      • importValue

        public java.lang.Object importValue​(java.lang.String valueExpr,
                                            Item toItem)
                                     throws JaloInvalidParameterException
        Description copied from class: AbstractValueTranslator
        Translates a tokenized csv value for import usage. This means that the result object must be a instance of the expected attribute type.
        Specified by:
        importValue in class AbstractValueTranslator
        Parameters:
        valueExpr - expression to translate
        toItem - the target item in case it already exist, null otherwise (for partOf attributes!)
        Returns:
        Object translated value
        Throws:
        JaloInvalidParameterException - value can not be translated with this translator or is invalid
      • importData

        public java.lang.String importData​(java.lang.String path)
      • loadFromJarResource

        protected java.lang.String loadFromJarResource​(java.lang.String path)
      • loadFromFile

        protected java.lang.String loadFromFile​(java.lang.String path)
      • readFromStream

        protected java.lang.String readFromStream​(java.io.Reader reader)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • loadFromZipFile

        protected java.lang.String loadFromZipFile​(java.lang.String path)
      • isAbsolutePath

        protected boolean isAbsolutePath​(java.lang.String path)
      • isJarBasedPath

        protected boolean isJarBasedPath​(java.lang.String path)
      • isZipBasedPath

        protected boolean isZipBasedPath​(java.lang.String path)