1 /*global $k*/ 2 3 /** 4 * @class Represents an attribute. 5 * @extends $k.Property 6 **/ 7 $k.Attribute = function() { }; 8 9 /** 10 * True if the attribute has translated values 11 * 12 * @function 13 * @returns {boolean} 14 **/ 15 $k.Attribute.prototype.hasTranslatedValues = function() { }; 16 17 /** 18 * Removes the translated value for the language 19 * 20 * @function 21 * @param {string} language Language of the value. If not defined, the current language will be used 22 * @returns {$k.Attribute} The attribute itself 23 * @throws {$k.exception.InvalidLanguage} If an invalid language was specified 24 * @throws {$k.exception.RemoveNotPossible} If the language cannot be removed, because it is the last remaining translation 25 * @throws {$k.exception.TransactionError} If no write transaction is active 26 **/ 27 $k.Attribute.prototype.removeTranslation = function(language) { }; 28 29 /** 30 * Sets the value of the attribute 31 * 32 * @function 33 * @param value The value that should be set. 34 * @param {string} [language] Language of the value. If not defined, the current language will be used. 35 * Ignored if the attribute is not translated 36 * @returns {$k.Attribute} The attribute 37 * @throws {$k.exception.InvalidValue} If the value is not in the range of allowed values of the attribute 38 * @throws {$k.exception.AccessDenied} If modifying is not allowed 39 * @throws {$k.exception.InvalidLanguage} If an invalid language was specified 40 * @throws {$k.exception.TransactionError} If no write transaction is active 41 **/ 42 $k.Attribute.prototype.setValue = function(value, language) { }; 43 44 /** 45 * Sets the value of the attribute from the string representation 46 * 47 * @function 48 * @param {string} string The string represantation of the value that should be set. 49 * @param {string} [language] Language of the value. If not defined, the current language will be used. 50 * Ignored if the attribute is not translated 51 * @returns {$k.Attribute} The attribute 52 * @throws {$k.exception.InvalidValue} If the string is not in the range of allowed values of the attribute 53 * @throws {$k.exception.AccessDenied} If modifying is not allowed 54 * @throws {$k.exception.InvalidLanguage} If an invalid language was specified 55 * @throws {$k.exception.TransactionError} If no write transaction is active 56 **/ 57 $k.Attribute.prototype.setValueString = function(string, language) { }; 58 59 /** 60 * Returns the translated languages as 3-letter codes (ISO639 2b). 61 * Empty if the attribute is not translated 62 * 63 * @function 64 * @returns {string[]} 65 **/ 66 $k.Attribute.prototype.translatedLanguages = function() { }; 67 68 /** 69 * Returns the value of the attribute 70 * 71 * @function 72 * @param {string} [language] Language of the value. If not defined, the current language will be used. 73 * Ignored if the attribute is not translated 74 * @throws {$k.exception.InvalidLanguage} If an invalid language was specified 75 * @returns The value of the attribute. The type depends on the type of the attribute. 76 **/ 77 $k.Attribute.prototype.value = function(language) { }; 78 79 /** 80 * Returns the range of the values of the attribute 81 * 82 * @function 83 * @returns {$k.ValueRange} 84 **/ 85 $k.Attribute.prototype.valueRange = function() { }; 86 87 /** 88 * Returns the string representation of the value of the attribute 89 * 90 * @function 91 * @param {string} [language] Language of the value. If not defined, the current language will be used. 92 * Ignored if the attribute is not translated 93 * @throws {$k.exception.InvalidLanguage} If an invalid language was specified 94 * @returns {string} 95 **/ 96 $k.Attribute.prototype.valueString = function(language) { }; 97 98