Class $k.Attribute

Represents an attribute.

Class Summary
Constructor Attributes Constructor Name and Description
 

Method Summary

Class Detail

$k.Attribute()

Method Detail

  • {boolean} hasTranslatedValues()
    True if the attribute has translated values
    Returns:
    {boolean}
  • {$k.Attribute} removeTranslation(language)
    Removes the translated value for the language
    Parameters:
    {string} language
    Language of the value. If not defined, the current language will be used
    Throws:
    {$k.exception.InvalidLanguage}
    If an invalid language was specified
    {$k.exception.RemoveNotPossible}
    If the language cannot be removed, because it is the last remaining translation
    {$k.exception.TransactionError}
    If no write transaction is active
    Returns:
    {$k.Attribute} The attribute itself
  • {$k.Attribute} setValue(value, language)
    Sets the value of the attribute
    Parameters:
    value
    The value that should be set.
    {string} language Optional
    Language of the value. If not defined, the current language will be used. Ignored if the attribute is not translated
    Throws:
    {$k.exception.InvalidValue}
    If the value is not in the range of allowed values of the attribute
    {$k.exception.AccessDenied}
    If modifying is not allowed
    {$k.exception.InvalidLanguage}
    If an invalid language was specified
    {$k.exception.TransactionError}
    If no write transaction is active
    Returns:
    {$k.Attribute} The attribute
  • {$k.Attribute} setValueString(string, language)
    Sets the value of the attribute from the string representation
    Parameters:
    {string} string
    The string represantation of the value that should be set.
    {string} language Optional
    Language of the value. If not defined, the current language will be used. Ignored if the attribute is not translated
    Throws:
    {$k.exception.InvalidValue}
    If the string is not in the range of allowed values of the attribute
    {$k.exception.AccessDenied}
    If modifying is not allowed
    {$k.exception.InvalidLanguage}
    If an invalid language was specified
    {$k.exception.TransactionError}
    If no write transaction is active
    Returns:
    {$k.Attribute} The attribute
  • {string[]} translatedLanguages()
    Returns the translated languages as 3-letter codes (ISO639 2b). Empty if the attribute is not translated
    Returns:
    {string[]}
  • value(language)
    Returns the value of the attribute
    Parameters:
    {string} language Optional
    Language of the value. If not defined, the current language will be used. Ignored if the attribute is not translated
    Throws:
    {$k.exception.InvalidLanguage}
    If an invalid language was specified
    Returns:
    The value of the attribute. The type depends on the type of the attribute.
  • {$k.ValueRange} valueRange()
    Returns the range of the values of the attribute
    Returns:
    {$k.ValueRange}
  • {string} valueString(language)
    Returns the string representation of the value of the attribute
    Parameters:
    {string} language Optional
    Language of the value. If not defined, the current language will be used. Ignored if the attribute is not translated
    Throws:
    {$k.exception.InvalidLanguage}
    If an invalid language was specified
    Returns:
    {string}