com.flexive.shared.value
Class FxNoAccess

java.lang.Object
  extended by com.flexive.shared.value.FxValue<java.lang.Object,FxNoAccess>
      extended by com.flexive.shared.value.FxNoAccess
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<FxValue>

public final class FxNoAccess
extends FxValue<java.lang.Object,FxNoAccess>

A replacement for FxValue objects if the calling user has no access to this value

Author:
Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.flexive.shared.value.FxValue
DEFAULT_MULTILANGUAGE, emptyTranslations, multiLanguage, singleValue, translations
 
Constructor Summary
FxNoAccess(long defaultLanguage, boolean multiLanguage)
          Constructor
FxNoAccess(UserTicket ticket, FxValue wrappedValue)
          Constructor
 
Method Summary
 FxNoAccess copy()
          Creates a copy of the given object (useful if the actual type is unknown).
 boolean equals(java.lang.Object other)
          
 java.lang.Object fromString(java.lang.String value)
          Evaluates the given string value to an object of type T.
 java.lang.String getBestTranslation(long lang)
          Get the translation that best fits the requested language.
 long getDefaultLanguage()
          Get the default language of this value
 java.lang.String getDefaultTranslation()
          Get a representation of this value in the default translation
 java.lang.Object getEmptyValue()
          Returns an empty value object for this FxValue type.
 java.lang.String getOriginalXPath()
          Getter for the original XPath
 long[] getTranslatedLanguages()
          Get all languages for which translations exist
 java.lang.String getTranslation(FxLanguage lang)
          Get a String representation of this value in the requested language or an empty String if the translation does not exist
 java.lang.Class getValueClass()
          Return the class instance of the value type.
 int hashCode()
          
 boolean isEmpty()
          Is this value empty?
 boolean isMultiLanguage()
          Is this value available for multiple languages?
 boolean isReadOnly()
          Is this value editable by the user? This always returns true except it is a FxNoAccess value or flagged as readOnly
 boolean translationExists(long languageId)
          Does a translation exist for the given language?
 
Methods inherited from class com.flexive.shared.value.FxValue
clearDefaultLanguage, compareTo, getBestTranslation, getBestTranslation, getBestTranslation, getErrorValue, getIsEmpty, getMaxInputLength, getSelectedLanguage, getSqlValue, getStringValue, getTranslation, getXPath, getXPathName, hasDefaultLanguage, isAcceptsEmptyDefaultTranslations, isDefaultLanguage, isImmutableValueType, isTranslationEmpty, isTranslationEmpty, isValid, removeLanguage, setDefaultLanguage, setDefaultLanguage, setDefaultTranslation, setEmpty, setEmpty, setMaxInputLength, setReadOnly, setSelectedLanguage, setTranslation, setTranslation, setValue, setXPath, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FxNoAccess

public FxNoAccess(long defaultLanguage,
                  boolean multiLanguage)
Constructor

Parameters:
multiLanguage - multilanguage value?
defaultLanguage - the default language

FxNoAccess

public FxNoAccess(UserTicket ticket,
                  FxValue wrappedValue)
Constructor

Parameters:
ticket - to get the correct tranlsation of the no access text (if null a fallback will be used)
wrappedValue - FxValue to wrap
Method Detail

getOriginalXPath

public java.lang.String getOriginalXPath()
Getter for the original XPath

Returns:
original xpath

isReadOnly

public boolean isReadOnly()
Is this value editable by the user? This always returns true except it is a FxNoAccess value or flagged as readOnly

Overrides:
isReadOnly in class FxValue<java.lang.Object,FxNoAccess>
Returns:
if this value editable?
See Also:
FxNoAccess

getDefaultLanguage

public long getDefaultLanguage()
Get the default language of this value

Overrides:
getDefaultLanguage in class FxValue<java.lang.Object,FxNoAccess>
Returns:
default language

getDefaultTranslation

public java.lang.String getDefaultTranslation()
Get a representation of this value in the default translation

Overrides:
getDefaultTranslation in class FxValue<java.lang.Object,FxNoAccess>
Returns:
T

getTranslation

public java.lang.String getTranslation(FxLanguage lang)
Get a String representation of this value in the requested language or an empty String if the translation does not exist

Overrides:
getTranslation in class FxValue<java.lang.Object,FxNoAccess>
Parameters:
lang - requested language id
Returns:
T translation

getBestTranslation

public java.lang.String getBestTranslation(long lang)
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

Overrides:
getBestTranslation in class FxValue<java.lang.Object,FxNoAccess>
Parameters:
lang - requested best-fit language
Returns:
best fit translation

getTranslatedLanguages

public long[] getTranslatedLanguages()
Get all languages for which translations exist

Overrides:
getTranslatedLanguages in class FxValue<java.lang.Object,FxNoAccess>
Returns:
languages for which translations exist

translationExists

public boolean translationExists(long languageId)
Does a translation exist for the given language?

Overrides:
translationExists in class FxValue<java.lang.Object,FxNoAccess>
Parameters:
languageId - language to query
Returns:
translation exists

isEmpty

public boolean isEmpty()
Is this value empty?

Overrides:
isEmpty in class FxValue<java.lang.Object,FxNoAccess>
Returns:
if value is empty

isMultiLanguage

public boolean isMultiLanguage()
Is this value available for multiple languages?

Overrides:
isMultiLanguage in class FxValue<java.lang.Object,FxNoAccess>
Returns:
value available for multiple languages

fromString

public java.lang.Object fromString(java.lang.String value)
Evaluates the given string value to an object of type T.

Specified by:
fromString in class FxValue<java.lang.Object,FxNoAccess>
Parameters:
value - string value to be evaluated
Returns:
the value interpreted as T

copy

public FxNoAccess copy()
Creates a copy of the given object (useful if the actual type is unknown).

Specified by:
copy in class FxValue<java.lang.Object,FxNoAccess>
Returns:
a copy of the given object (useful if the actual type is unknown).

getValueClass

public java.lang.Class getValueClass()
Return the class instance of the value type.

Specified by:
getValueClass in class FxValue<java.lang.Object,FxNoAccess>
Returns:
the class instance of the value type.

getEmptyValue

public java.lang.Object getEmptyValue()
Returns an empty value object for this FxValue type.

Specified by:
getEmptyValue in class FxValue<java.lang.Object,FxNoAccess>
Returns:
an empty value object for this FxValue type.

equals

public boolean equals(java.lang.Object other)

Overrides:
equals in class FxValue<java.lang.Object,FxNoAccess>

hashCode

public int hashCode()

Overrides:
hashCode in class FxValue<java.lang.Object,FxNoAccess>