Class AbstractValueTranslator

    • Constructor Detail

      • AbstractValueTranslator

        public AbstractValueTranslator()
    • Method Detail

      • clearStatus

        protected void clearStatus()
        Resets the empty and unresolved flag.
        Unresolved flag says that the last imported value was unresolved.
        Empty flag says that the last imported value was empty.
      • setError

        protected void setError()
        Sets the unresolved flag. Unresolved flag says that the last imported value was unresolved.
      • setEmpty

        protected void setEmpty()
        Sets the empty flag. Empty flag says that the last imported value was empty.
      • init

        public void init​(StandardColumnDescriptor descriptor)
        Called once per header creation to allow configuring this translator using column modifiers etc.
        Parameters:
        descriptor - descriptor where the value to translate belongs to
      • isDebugEnabled

        @Deprecated
        protected boolean isDebugEnabled()
        Deprecated.
        since ages - use logging methodCategory.isDebugEnabled() directly
        Checks if the debug method of the reader is enabled or if no reader set the logger will be checked.
        Returns:
        is debug mode enabled?
      • debug

        @Deprecated
        protected void debug​(java.lang.String msg)
        Deprecated.
        since ages - use logging methodCategory.debug(Object) directly
        Debugs a message with the reader or the current logger instance.
        Parameters:
        msg - debug message
      • isInfoEnabled

        @Deprecated
        protected boolean isInfoEnabled()
        Deprecated.
        since ages - use logging methodCategory.isInfoEnabled() directly
        Checks if the info method of the reader is enabled or if no reader set the logger will be checked.
        Returns:
        is info mode enabled?
      • info

        @Deprecated
        protected void info​(java.lang.String msg)
        Deprecated.
        since ages - use logging methodCategory.info(Object) directly
        Logs an info message with the reader or the current logger instance.
        Parameters:
        msg - info message
      • warn

        @Deprecated
        protected void warn​(java.lang.String msg)
        Deprecated.
        since ages - use logging methodCategory.warn(Object) directly
        Logs an warn message with the reader or the current logger instance.
        Parameters:
        msg - warn message
      • error

        @Deprecated
        protected void error​(java.lang.String msg)
        Deprecated.
        since ages - use logging methodCategory.error(Object) directly
        Logs an error message with the reader or the current logger instance.
        Parameters:
        msg - error message
      • importValue

        public abstract java.lang.Object importValue​(java.lang.String valueExpr,
                                                     Item toItem)
                                              throws JaloInvalidParameterException
        Translates a tokenized csv value for import usage. This means that the result object must be a instance of the expected attribute type.
        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
      • exportValue

        public abstract java.lang.String exportValue​(java.lang.Object value)
                                              throws JaloInvalidParameterException
        Translates an attribute value for export usage. This means the attribute value must be transformed into a string which should be re-importable again.
        Parameters:
        value - value to translate
        Returns:
        String translated value
        Throws:
        JaloInvalidParameterException - value can not be translated with this translator or is invalid
      • wasUnresolved

        public boolean wasUnresolved()
        Indicates that the last call to importValue(String, Item) or exportValue(Object) could not translate the value yet but may be tried later again.

        This applies mostly to importing item references which require the referenced item to be created first .

        Returns:
        true if the last value could not be translated yet
      • wasEmpty

        public boolean wasEmpty()
        Indicates that the last call to importValue(String, Item) has produced an empty value in respect to the target attribute.

        E.g. collection attributes may consider empty collections as empty value contrary to single valued attributes which will only see null as empty value.

        Returns:
        true if last call of importValue(String, Item) has produced an empty value, false otherwise