new $k.Attribute()
Represents an attribute.
Extends
Methods
hasTranslatedValues() : boolean
True if the attribute has translated values
Returns:
| Type | Description | 
|---|---|
| boolean | 
removeTranslation(language) : $k.Attribute
Removes the translated value for the language
| Name | Type | Description | 
|---|---|---|
language | 
            
            
            string | 
                
                 Language of the value. If not defined, the current language will be used  | 
        
Throws:
| Type | Description | 
|---|---|
| $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:
| Type | Description | 
|---|---|
| $k.Attribute | The attribute itself | 
setValue(value, language) : $k.Attribute
Sets the value of the attribute
| Name | Type | Description | 
|---|---|---|
value | 
            
            
            
                
                    
                    
                        
                    
                
                 The value that should be set.  | 
        |
language | 
            
            
            string | 
                
                    
                        optional
                    
                    
                        
                    
                
                 Language of the value. Either ISO 639-1 (2-letter code, e.g. "en") or ISO 639-2B (3-letter code, e.g. "eng"). If not defined, the current language will be used.  | 
        
Throws:
| Type | Description | 
|---|---|
| $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:
| Type | Description | 
|---|---|
| $k.Attribute | The attribute | 
setValueString(string, language) : $k.Attribute
Sets the value of the attribute from the string representation
| Name | Type | Description | 
|---|---|---|
string | 
            
            
            string | 
                
                    
                    
                        
                    
                
                 The string represantation of the value that should be set.  | 
        
language | 
            
            
            string | 
                
                    
                        optional
                    
                    
                        
                    
                
                 Language of the value. Either ISO 639-1 (2-letter code, e.g. "en") or ISO 639-2B (3-letter code, e.g. "eng"). If not defined, the current language will be used.  | 
        
Throws:
| Type | Description | 
|---|---|
| $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:
| Type | Description | 
|---|---|
| $k.Attribute | The attribute | 
translatedLanguages() : Array.<string>
Returns the translated languages as 3-letter codes (ISO639 2b).
Empty if the attribute is not translated
Returns:
| Type | Description | 
|---|---|
| Array.<string> | 
value(language)
Returns the value of the attribute
| Name | Type | Description | 
|---|---|---|
language | 
            
            
            string | 
                
                    
                        optional
                    
                    
                        
                    
                
                 Language of the value. Either ISO 639-1 (2-letter code, e.g. "en") or ISO 639-2B (3-letter code, e.g. "eng"). If not defined, the current language will be used.  | 
        
Throws:
| Type | Description | 
|---|---|
| $k.exception.InvalidLanguage | If an invalid language was specified  | 
            
Returns:
The value of the attribute. The type depends on the type of the attribute.valueRange() : $k.ValueRange
Returns the range of the values of the attribute
Returns:
| Type | Description | 
|---|---|
| $k.ValueRange | 
valueString(language) : string
Returns the string representation of the value of the attribute
| Name | Type | Description | 
|---|---|---|
language | 
            
            
            string | 
                
                    
                        optional
                    
                    
                        
                    
                
                 Language of the value. Either ISO 639-1 (2-letter code, e.g. "en") or ISO 639-2B (3-letter code, e.g. "eng"). If not defined, the current language will be used.  | 
        
Throws:
| Type | Description | 
|---|---|
| $k.exception.InvalidLanguage | If an invalid language was specified  | 
            
Returns:
| Type | Description | 
|---|---|
| string |