| java.lang.Object com.flexive.shared.value.FxValue
FxValue | abstract public class FxValue implements Serializable,Comparable<FxValue>(Code) | | Abstract base class of all value objects.
Common base classed is used for multilingual properties, etc.
To check if a value is empty a flag is used for each language resp. the single value.
Use the setEmpty() method to explicity set a value to be empty
author: Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at) |
Constructor Summary | |
protected | FxValue() | protected | FxValue(boolean multiLanguage, long defaultLanguage, Map<Long, T> translations) | protected | FxValue(long defaultLanguage, Map<Long, T> translations) | protected | FxValue(boolean multiLanguage, Map<Long, T> translations) | protected | FxValue(Map<Long, T> translations) | protected | FxValue(Map<Long, T[]> translations, int pos) | protected | FxValue(boolean multiLanguage, long defaultLanguage, T value) | protected | FxValue(long defaultLanguage, T value) | protected | FxValue(boolean multiLanguage, T value) | protected | FxValue(T value) | protected | FxValue(FxValue<T, TDerived> clone) |
DEFAULT_MULTILANGUAGE | final public static boolean DEFAULT_MULTILANGUAGE(Code) | | |
singleValue | protected T singleValue(Code) | | Data if multiLanguage is disabled
|
translations | protected Map<Long, T> translations(Code) | | Data if multiLanguage is enabled
|
FxValue | protected FxValue()(Code) | | |
FxValue | protected FxValue(boolean multiLanguage, long defaultLanguage, Map<Long, T> translations)(Code) | | Constructor
Parameters: multiLanguage - multilanguage value? Parameters: defaultLanguage - the default language Parameters: translations - HashMap containing language->translation mapping |
FxValue | protected FxValue(long defaultLanguage, Map<Long, T> translations)(Code) | | Constructor
Parameters: defaultLanguage - the default language Parameters: translations - HashMap containing language->translation mapping |
FxValue | protected FxValue(boolean multiLanguage, Map<Long, T> translations)(Code) | | Constructor
Parameters: multiLanguage - multilanguage value? Parameters: translations - HashMap containing language->translation mapping |
FxValue | protected FxValue(Map<Long, T> translations)(Code) | | Constructor
Parameters: translations - HashMap containing language->translation mapping |
FxValue | protected FxValue(Map<Long, T[]> translations, int pos)(Code) | | Constructor - create value from an array of translations
Parameters: translations - HashMap containing language->translation mapping Parameters: pos - position (index) in the array to use |
FxValue | protected FxValue(boolean multiLanguage, long defaultLanguage, T value)(Code) | | Constructor
Parameters: multiLanguage - multilanguage value? Parameters: defaultLanguage - the default language Parameters: value - single initializing value |
FxValue | protected FxValue(long defaultLanguage, T value)(Code) | | Constructor
Parameters: defaultLanguage - the default language Parameters: value - single initializing value |
FxValue | protected FxValue(boolean multiLanguage, T value)(Code) | | Constructor
Parameters: multiLanguage - multilanguage value? Parameters: value - single initializing value |
FxValue | protected FxValue(T value)(Code) | | Constructor
Parameters: value - single initializing value |
FxValue | protected FxValue(FxValue<T, TDerived> clone)(Code) | | Constructor
Parameters: clone - original FxValue to be cloned |
clearDefaultLanguage | public void clearDefaultLanguage()(Code) | | Reset the default language to the system language
|
compareTo | public int compareTo(FxValue o)(Code) | | A generic comparable implementation based on the value's string representation.
Parameters: o - the other object see Comparable.compareTo. |
copy | abstract public TDerived copy()(Code) | | Creates a copy of the given object (useful if the actual type is unknown).
a copy of the given object (useful if the actual type is unknown). |
fromString | abstract public T fromString(String value)(Code) | | Evaluates the given string value to an object of type T.
Parameters: value - string value to be evaluated the value interpreted as T |
fromXML | public static FxValue fromXML(String xml)(Code) | | Get an FxValue from its XML representation
Parameters: xml - XML representation FxValue instance |
getBestTranslation | public T getBestTranslation(long lang)(Code) | | Get the translation that best fits the requested language.
The requested language is queried and if it does not exist the
default translation is returned
Parameters: lang - requested best-fit language best fit translation |
getBestTranslation | public T getBestTranslation(FxLanguage language)(Code) | | Get the translation that best fits the requested language.
The requested language is queried and if it does not exist the
default translation is returned
Parameters: language - requested best-fit language best fit translation |
getBestTranslation | public T getBestTranslation(UserTicket ticket)(Code) | | Get the translation that best fits the requested users language.
The requested users language is queried and if it does not exist the
default translation is returned
Parameters: ticket - UserTicket to obtain the users language best fit translation |
getBestTranslation | public T getBestTranslation()(Code) | | Get the translation that best fits the current users language.
The user language is obtained from the FxContext thread local.
best fit translation |
getDefaultLanguage | public long getDefaultLanguage()(Code) | | Get the default language of this value
default language |
getDefaultTranslation | public T getDefaultTranslation()(Code) | | Get a representation of this value in the default translation
T |
getIsEmpty | public boolean getIsEmpty()(Code) | | Like empty(), for JSF EL, since empty cannot be used.
true if the value is empty |
getMaxInputLength | public int getMaxInputLength()(Code) | | Returns the maximum input length an input field should have for this value
(or -1 for unlimited length).
the maximum input length an input field should have for this value |
getSelectedLanguage | public long getSelectedLanguage()(Code) | | Get the language selected in user interfaces
selected language |
getSqlValue | public String getSqlValue()(Code) | | Format this FxValue for inclusion in a SQL statement. For example,
a string is wrapped in single quotes and escaped properly (' --> '').
For multilanguage values the default translation is used. If the value is
empty (@link #isEmpty()), a runtime exception is thrown.
the formatted value |
getTranslatedLanguages | public Long[] getTranslatedLanguages()(Code) | | Get all languages for which translations exist
languages for which translations exist |
getTranslation | public T getTranslation(long lang)(Code) | | Get the translation for a requested language
Parameters: lang - requested language translation or an empty String if it does not exist |
getTranslation | public T getTranslation(FxLanguage lang)(Code) | | Get a String representation of this value in the requested language or
an empty String if the translation does not exist
Parameters: lang - requested language id T translation |
getValueClass | abstract public Class<T> getValueClass()(Code) | | Return the class instance of the value type.
the class instance of the value type. |
getXPath | public String getXPath()(Code) | | Get the XPath for this value - the XPath is optional and can be an empty String if
not explicitly assigned!
XPath (optional! can be an empty String) |
getXPathName | public String getXPathName()(Code) | | Returns the name of the value from the xpath.
If the xpath is an empty string the name will also return an emptry String.
the property name |
hasDefaultLanguage | public boolean hasDefaultLanguage()(Code) | | Is a default value set for this FxValue?
default value set |
hashCode | public int hashCode()(Code) | | |
isAcceptsEmptyDefaultTranslations | protected boolean isAcceptsEmptyDefaultTranslations()(Code) | | |
isDefaultLanguage | public boolean isDefaultLanguage(long language)(Code) | | Check if the passed language is the default language
Parameters: language - the language to check passed language is the default language |
isEmpty | public boolean isEmpty()(Code) | | Is this value empty?
if value is empty |
isImmutableValueType | public boolean isImmutableValueType()(Code) | | Return true if T is immutable (e.g. java.lang.String). This prevents cloning
of the translations in copy constructors.
true if T is immutable (e.g. java.lang.String) |
isMultiLanguage | public boolean isMultiLanguage()(Code) | | Is this value available for multiple languages?
value available for multiple languages |
isReadOnly | public boolean isReadOnly()(Code) | | Is this value editable by the user?
This always returns true except it is a FxNoAccess value or flagged as readOnly
if this value editable? See Also: FxNoAccess |
isTranslationEmpty | public boolean isTranslationEmpty(FxLanguage lang)(Code) | | Check if the translation for the given language is empty
Parameters: lang - language to check if translation for the given language is empty |
isTranslationEmpty | public boolean isTranslationEmpty(long lang)(Code) | | Check if the translation for the given language is empty
Parameters: lang - language to check if translation for the given language is empty |
isValid | public boolean isValid()(Code) | | Returns true if this value is valid for the actual type (e.g. if
a FxNumber property actually contains only valid numbers).
true if this value is valid for the actual type |
removeLanguage | public void removeLanguage(long language)(Code) | | Remove the translation for the given language
Parameters: language - the language to remove the translation for |
setDefaultLanguage | public void setDefaultLanguage(long defaultLanguage)(Code) | | Set the default language.
It will only be set if a translation in the requested default language
exists!
Parameters: defaultLanguage - requested default language |
setDefaultLanguage | public void setDefaultLanguage(long defaultLanguage, boolean force)(Code) | | Set the default language. Will have no effect if the value is not multi language enabled
Parameters: defaultLanguage - requested default language Parameters: force - if true, the default language will also be updated if no translation exists (for UI input) |
setDefaultTranslation | public FxValue setDefaultTranslation(T translation)(Code) | | Set the translation in the default language. For single-language values,
sets the value.
Parameters: translation - the default translation this |
setEmpty | public TDerived setEmpty()(Code) | | Mark this FxValue as empty
this |
setEmpty | public void setEmpty(long language)(Code) | | Mark the entry for the given language as empty
Parameters: language - the language to flag as empty |
setMaxInputLength | public void setMaxInputLength(int maxInputLength)(Code) | | Set the maximum input length for this value (-1 for unlimited length).
Parameters: maxInputLength - the maximum input length for this value (-1 for unlimited length). |
setReadOnly | public void setReadOnly()(Code) | | One-time operation to flag this FxValue as read only.
This is not reversible!
|
setSelectedLanguage | public FxValue setSelectedLanguage(long selectedLanguage) throws FxNoAccessException(Code) | | Set the user selected language
Parameters: selectedLanguage - selected language ID self throws: FxNoAccessException - if the selected Language is not contained |
setTranslation | final public TDerived setTranslation(long language, T value)(Code) | | Set the translation for a language or override the single language value if
this value is not flagged as multi language enabled. This method cannot be
overridden since it not only accepts parameters of type T, but also of type
String for web form handling.
Parameters: language - language to set the translation for Parameters: value - translation this |
setTranslation | public TDerived setTranslation(FxLanguage lang, T translation)(Code) | | Set the translation for a language or override the single language value if
this value is not flagged as multi language enabled
Parameters: lang - language to set the translation for Parameters: translation - translation this |
setValue | public void setValue(T value)(Code) | | For multilanguage values, set the default translation.
For single language values, set the value.
Parameters: value - the value to be stored |
setXPath | public TDerived setXPath(String XPath)(Code) | | Set the XPath (unless readonly)
Parameters: XPath - the XPath to set, will be ignored if readonly this |
translationExists | public boolean translationExists(long languageId)(Code) | | Does a translation exist for the given language?
Parameters: languageId - language to query translation exists |
|
|