com.sapportals.wcm.repository

Class MutableMultiLanguagedProperty

java.lang.Object
  extended by com.sapportals.wcm.repository.MutableMultiLanguagedProperty
All Implemented Interfaces:
IMultiLanguagedProperty, IMutableMultiLanguagedProperty, IMutableProperty, IProperty

public class MutableMultiLanguagedProperty
extends Object
implements IMutableMultiLanguagedProperty

Default implementation of an IMutableMultiLanguagedProperty.

Copyright (c) SAP AG 2004


Constructor Summary
MutableMultiLanguagedProperty(IPropertyName name, IPropertyDef def, Locale locale)
           
MutableMultiLanguagedProperty(IPropertyName name, Locale locale)
           
MutableMultiLanguagedProperty(MutableProperty prop, List values, Locale locale)
           
MutableMultiLanguagedProperty(MutableProperty prop, Locale locale)
           
 
Method Summary
 void addValue(Object value)
          Adds a value to the list for a multi-value property
 void deleteValue(String languageTag)
          Removes a language specific value of this property
 String getAttribute(String name)
          Get the value of an attribute
 Properties getAttributes()
          Returns a collection of attributes
 boolean getBooleanValue()
          Get the property value if the type is PropertyType.BOOLEAN
 boolean getBooleanValue(String languageTag)
          Get the property value if the type is PropertyType.BOOLEAN for the desired languageTag
 IMultiLanguagedProperty getClone(Locale locale)
           
 Date getDateValue()
          Get the property value if the type is PropertyType.DATE
 Date getDateValue(String languageTag)
          Get the property value if the type is PropertyType.DATE for the desired languageTag
 String getDefaultLanguage()
           
 String getDescription()
          Returns the description of the property
 String getDescription(IResourceContext context)
           
 int getIntValue()
          Get the property value if the type is PropertyType.INTEGER
 int getIntValue(String languageTag)
          Get the property value if the type is PropertyType.INTEGER for the desired languageTag
 String[] getLanguageTags()
           
 String[] getLanguageTagsNeedingTranslation()
           
 String getLastSetLanguageTag()
           
 long getLongIntValue()
          Get the property value if the type is PropertyType.LONG
 long getLongIntValue(String languageTag)
          Get the property value if the type is PropertyType.LONG for the desired languageTag
 IMutableProperty getMutable()
          Returns a copy of this propertry that can be modified
 IPropertyDef getPropertyDef()
          Get a reference to the proeprty definition.
 IPropertyName getPropertyName()
          Returns the property name
 String getStringValue()
          Get the property value if the type is String
 String getStringValue(String languageTag)
          Get the property value if the type is String for the desired languageTag
 PropertyType getType()
          Return the property's data type
 Object getValue()
          Returns the property value as a Object if this is not a multi-valued property.
 String getValueAsString()
          Get the property value converted to a string.
 String getValueAsString(String languageTag)
          Get the property value converted to a string for the desired languageTag.
 List getValues()
          Returns the property values if this is a multi-valued property.
static boolean isMultiLanguaged(IProperty prop)
           
 boolean isMultivalued()
          Returns true if the property is multi-valued
 void markAsTranslated()
          marks all languages as up-to-date
 void markAsTranslated(String languageTag)
          marks this language as up-to-date
 boolean needsTranslation(String languageTag)
           
 void removeAttribute(String name)
          Removes a attribute
 void removeValue(int index)
          Remove a value of a multi-value property
 void setAttribute(String name, String value)
          Set an attribute
 void setAttributes(Properties attributes)
          Set the complete collection of attributes
 void setBooleanValue(boolean value)
          Sets the property value if the type ist PropertyType.BOOLEAN
 void setBooleanValue(String languageTag, boolean value)
          Sets the property value if the type ist PropertyType.BOOLEAN
 void setDateValue(Date value)
          Sets the property value if the type ist PropertyType.DATE
 void setDateValue(String languageTag, Date value)
          Sets the property value if the type ist PropertyType.DATE
 void setDateValueFromLong(long value)
          Sets the property value if the type ist PropertyType.DATE
 void setDateValueFromLong(String languageTag, long value)
          Sets the property value if the type ist PropertyType.DATE
 void setDefaultLanguage(String languageTag)
          Specifies the default language.
 void setIntValue(int value)
          Sets the property value if the type ist PropertyType.INTEGER
 void setIntValue(String languageTag, int value)
          Sets the property value if the type ist PropertyType.INTEGER
 void setLongIntValue(long value)
          Sets the property value if the type ist PropertyType.LONG
 void setLongIntValue(String languageTag, long value)
          Sets the property value if the type ist PropertyType.LONG
 void setStringValue(String value)
          Sets the property value if the type ist PropertyType.STRING
 void setStringValue(String languageTag, String value)
          Sets the property value if the type ist PropertyType.STRING
 void setValue(int index, Object value)
          Set a value of a multi-value property
 void setValues(List values)
          Sets all values of a multi-value property
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MutableMultiLanguagedProperty

public MutableMultiLanguagedProperty(IPropertyName name,
                                     Locale locale)
                              throws ResourceException
Throws:
ResourceException

MutableMultiLanguagedProperty

public MutableMultiLanguagedProperty(IPropertyName name,
                                     IPropertyDef def,
                                     Locale locale)
                              throws ResourceException
Throws:
ResourceException

MutableMultiLanguagedProperty

public MutableMultiLanguagedProperty(MutableProperty prop,
                                     Locale locale)

MutableMultiLanguagedProperty

public MutableMultiLanguagedProperty(MutableProperty prop,
                                     List values,
                                     Locale locale)
Method Detail

isMultiLanguaged

public static boolean isMultiLanguaged(IProperty prop)
                                throws ResourceException
Throws:
ResourceException

getBooleanValue

public boolean getBooleanValue(String languageTag)
                        throws ResourceException
Description copied from interface: IMultiLanguagedProperty
Get the property value if the type is PropertyType.BOOLEAN for the desired languageTag

Specified by:
getBooleanValue in interface IMultiLanguagedProperty
Returns:
The value
Throws:
ResourceException

getIntValue

public int getIntValue(String languageTag)
                throws ResourceException
Description copied from interface: IMultiLanguagedProperty
Get the property value if the type is PropertyType.INTEGER for the desired languageTag

Specified by:
getIntValue in interface IMultiLanguagedProperty
Returns:
The value
Throws:
ResourceException

getLongIntValue

public long getLongIntValue(String languageTag)
                     throws ResourceException
Description copied from interface: IMultiLanguagedProperty
Get the property value if the type is PropertyType.LONG for the desired languageTag

Specified by:
getLongIntValue in interface IMultiLanguagedProperty
Returns:
The value
Throws:
ResourceException

getDateValue

public Date getDateValue(String languageTag)
                  throws ResourceException
Description copied from interface: IMultiLanguagedProperty
Get the property value if the type is PropertyType.DATE for the desired languageTag

Specified by:
getDateValue in interface IMultiLanguagedProperty
Returns:
The value
Throws:
ResourceException

getStringValue

public String getStringValue(String languageTag)
                      throws ResourceException
Description copied from interface: IMultiLanguagedProperty
Get the property value if the type is String for the desired languageTag

Specified by:
getStringValue in interface IMultiLanguagedProperty
Returns:
The value
Throws:
ResourceException

getValueAsString

public String getValueAsString(String languageTag)
                        throws ResourceException
Description copied from interface: IMultiLanguagedProperty
Get the property value converted to a string for the desired languageTag.

Specified by:
getValueAsString in interface IMultiLanguagedProperty
Returns:
A String
Throws:
ResourceException

getLanguageTags

public String[] getLanguageTags()
                         throws ResourceException
Specified by:
getLanguageTags in interface IMultiLanguagedProperty
Returns:
an array with all languageTags
Throws:
ResourceException

getLanguageTagsNeedingTranslation

public String[] getLanguageTagsNeedingTranslation()
                                           throws ResourceException
Specified by:
getLanguageTagsNeedingTranslation in interface IMultiLanguagedProperty
Returns:
an array with all languageTags needing translation
Throws:
ResourceException

needsTranslation

public boolean needsTranslation(String languageTag)
                         throws ResourceException
Specified by:
needsTranslation in interface IMultiLanguagedProperty
Returns:
TRUE if the languageTag is present and marked to be translated
Throws:
ResourceException

getLastSetLanguageTag

public String getLastSetLanguageTag()
                             throws ResourceException
Specified by:
getLastSetLanguageTag in interface IMultiLanguagedProperty
Returns:
null or if known the last language tag used to set a single value
Throws:
ResourceException

getPropertyName

public IPropertyName getPropertyName()
Description copied from interface: IProperty
Returns the property name

Specified by:
getPropertyName in interface IProperty
Returns:
A property name object

getType

public PropertyType getType()
Description copied from interface: IProperty
Return the property's data type

Specified by:
getType in interface IProperty
Returns:
A property type constant

isMultivalued

public boolean isMultivalued()
Description copied from interface: IProperty
Returns true if the property is multi-valued

Specified by:
isMultivalued in interface IProperty
Returns:
multivalued

getPropertyDef

public IPropertyDef getPropertyDef()
Description copied from interface: IProperty
Get a reference to the proeprty definition.

Specified by:
getPropertyDef in interface IProperty
Returns:
The property definition

getValueAsString

public String getValueAsString()
Description copied from interface: IProperty
Get the property value converted to a string.

Specified by:
getValueAsString in interface IProperty
Returns:
A String

getBooleanValue

public boolean getBooleanValue()
Description copied from interface: IProperty
Get the property value if the type is PropertyType.BOOLEAN

Specified by:
getBooleanValue in interface IProperty
Returns:
The value

getIntValue

public int getIntValue()
Description copied from interface: IProperty
Get the property value if the type is PropertyType.INTEGER

Specified by:
getIntValue in interface IProperty
Returns:
The value

getLongIntValue

public long getLongIntValue()
Description copied from interface: IProperty
Get the property value if the type is PropertyType.LONG

Specified by:
getLongIntValue in interface IProperty
Returns:
The value

getDateValue

public Date getDateValue()
Description copied from interface: IProperty
Get the property value if the type is PropertyType.DATE

Specified by:
getDateValue in interface IProperty
Returns:
The value

getStringValue

public String getStringValue()
Description copied from interface: IProperty
Get the property value if the type is String

Specified by:
getStringValue in interface IProperty
Returns:
The value

getValues

public List getValues()
               throws ResourceException
Description copied from interface: IProperty
Returns the property values if this is a multi-valued property.

Specified by:
getValues in interface IProperty
Returns:
An unmodifiable List of value objects (String, Date, Integer, Long, Boolean, XMLMarkup)
Throws:
ResourceException

getValue

public Object getValue()
                throws ResourceException
Description copied from interface: IProperty
Returns the property value as a Object if this is not a multi-valued property.

Specified by:
getValue in interface IProperty
Returns:
The value object (String, Date, Integer, Long, Boolean, XMLMarkup)
Throws:
ResourceException

getMutable

public IMutableProperty getMutable()
Description copied from interface: IProperty
Returns a copy of this propertry that can be modified

Specified by:
getMutable in interface IProperty
Returns:
A mutable property instance

getClone

public IMultiLanguagedProperty getClone(Locale locale)
Specified by:
getClone in interface IMultiLanguagedProperty
Parameters:
locale - the current locale (needed for determing the default language)
Returns:
a copy of this object in the flavour of the locale specified in the argument

getAttribute

public String getAttribute(String name)
                    throws ResourceException
Description copied from interface: IProperty
Get the value of an attribute

Specified by:
getAttribute in interface IProperty
Parameters:
name - Attribute name
Returns:
The value, ot null if the name does not exist
Throws:
ResourceException

getAttributes

public Properties getAttributes()
                         throws ResourceException
Description copied from interface: IProperty
Returns a collection of attributes

Specified by:
getAttributes in interface IProperty
Returns:
The attributes
Throws:
ResourceException

getDescription

public String getDescription()
                      throws WcmException
Description copied from interface: IProperty
Returns the description of the property

Specified by:
getDescription in interface IProperty
Returns:
description
Throws:
WcmException - Exception raised in failure situation

getDescription

public String getDescription(IResourceContext context)
                      throws WcmException
Specified by:
getDescription in interface IProperty
Throws:
WcmException

setIntValue

public void setIntValue(int value)
                 throws ResourceException
Description copied from interface: IMutableProperty
Sets the property value if the type ist PropertyType.INTEGER

Specified by:
setIntValue in interface IMutableProperty
Parameters:
value - The new value
Throws:
ResourceException

setDateValue

public void setDateValue(Date value)
                  throws ResourceException
Description copied from interface: IMutableProperty
Sets the property value if the type ist PropertyType.DATE

Specified by:
setDateValue in interface IMutableProperty
Parameters:
value - The new value
Throws:
ResourceException

setDateValueFromLong

public void setDateValueFromLong(long value)
                          throws ResourceException
Description copied from interface: IMutableProperty
Sets the property value if the type ist PropertyType.DATE

Specified by:
setDateValueFromLong in interface IMutableProperty
Parameters:
value - The new value
Throws:
ResourceException

setStringValue

public void setStringValue(String value)
                    throws ResourceException
Description copied from interface: IMutableProperty
Sets the property value if the type ist PropertyType.STRING

Specified by:
setStringValue in interface IMutableProperty
Parameters:
value - The new value
Throws:
ResourceException

setLongIntValue

public void setLongIntValue(long value)
                     throws ResourceException
Description copied from interface: IMutableProperty
Sets the property value if the type ist PropertyType.LONG

Specified by:
setLongIntValue in interface IMutableProperty
Parameters:
value - The new value
Throws:
ResourceException

setBooleanValue

public void setBooleanValue(boolean value)
                     throws ResourceException
Description copied from interface: IMutableProperty
Sets the property value if the type ist PropertyType.BOOLEAN

Specified by:
setBooleanValue in interface IMutableProperty
Parameters:
value - The new value
Throws:
ResourceException

setValues

public void setValues(List values)
               throws ResourceException
Description copied from interface: IMutableProperty
Sets all values of a multi-value property

Specified by:
setValues in interface IMutableProperty
Parameters:
values - The new values. The following table shows the instance that has to be used for each type. PropertyType | instanceof ------------------------- STRING | String BOOLEAN | Boolean INTEGER | Integer LONG | Long DATE | Date XML | String
Throws:
ResourceException - If the property is not defined as multi-valued If a instance of a value does not match the property type

addValue

public void addValue(Object value)
              throws ResourceException
Description copied from interface: IMutableProperty
Adds a value to the list for a multi-value property

Specified by:
addValue in interface IMutableProperty
Parameters:
value - The value to add. The following table shows the instance that has to be used for each type. PropertyType | instanceof ------------------------- STRING | String BOOLEAN | Boolean INTEGER | Integer LONG | Long DATE | Date XML | String
Throws:
ResourceException - If the property is not defined as multi-valued If the instance of the value does not match the property type

setValue

public void setValue(int index,
                     Object value)
              throws ResourceException
Description copied from interface: IMutableProperty
Set a value of a multi-value property

Specified by:
setValue in interface IMutableProperty
Parameters:
index - The zero-based index
value - The new value
Throws:
ResourceException - If the property is not defined as multi-valued If the instance of the value does not match the property type If the index it out of bounds

removeValue

public void removeValue(int index)
                 throws ResourceException
Description copied from interface: IMutableProperty
Remove a value of a multi-value property

Specified by:
removeValue in interface IMutableProperty
Parameters:
index - The zero-based index
Throws:
ResourceException - If the property is not defined as multi-valued If the index it out of bounds

setAttribute

public void setAttribute(String name,
                         String value)
                  throws ResourceException
Description copied from interface: IMutableProperty
Set an attribute

Specified by:
setAttribute in interface IMutableProperty
Parameters:
name - Attribute name
value - Attribute value
Throws:
ResourceException

setAttributes

public void setAttributes(Properties attributes)
                   throws ResourceException
Description copied from interface: IMutableProperty
Set the complete collection of attributes

Specified by:
setAttributes in interface IMutableProperty
Parameters:
attributes - All attributes
Throws:
ResourceException

removeAttribute

public void removeAttribute(String name)
                     throws ResourceException
Description copied from interface: IMutableProperty
Removes a attribute

Specified by:
removeAttribute in interface IMutableProperty
Parameters:
name - Attribute name
Throws:
ResourceException

getDefaultLanguage

public String getDefaultLanguage()
                          throws ResourceException
Throws:
ResourceException

setIntValue

public void setIntValue(String languageTag,
                        int value)
                 throws ResourceException
Description copied from interface: IMutableMultiLanguagedProperty
Sets the property value if the type ist PropertyType.INTEGER

Specified by:
setIntValue in interface IMutableMultiLanguagedProperty
Throws:
ResourceException

setDateValue

public void setDateValue(String languageTag,
                         Date value)
                  throws ResourceException
Description copied from interface: IMutableMultiLanguagedProperty
Sets the property value if the type ist PropertyType.DATE

Specified by:
setDateValue in interface IMutableMultiLanguagedProperty
Throws:
ResourceException

setDateValueFromLong

public void setDateValueFromLong(String languageTag,
                                 long value)
                          throws ResourceException
Description copied from interface: IMutableMultiLanguagedProperty
Sets the property value if the type ist PropertyType.DATE

Specified by:
setDateValueFromLong in interface IMutableMultiLanguagedProperty
Throws:
ResourceException

setStringValue

public void setStringValue(String languageTag,
                           String value)
                    throws ResourceException
Description copied from interface: IMutableMultiLanguagedProperty
Sets the property value if the type ist PropertyType.STRING

Specified by:
setStringValue in interface IMutableMultiLanguagedProperty
Throws:
ResourceException

setLongIntValue

public void setLongIntValue(String languageTag,
                            long value)
                     throws ResourceException
Description copied from interface: IMutableMultiLanguagedProperty
Sets the property value if the type ist PropertyType.LONG

Specified by:
setLongIntValue in interface IMutableMultiLanguagedProperty
Throws:
ResourceException

setBooleanValue

public void setBooleanValue(String languageTag,
                            boolean value)
                     throws ResourceException
Description copied from interface: IMutableMultiLanguagedProperty
Sets the property value if the type ist PropertyType.BOOLEAN

Specified by:
setBooleanValue in interface IMutableMultiLanguagedProperty
Throws:
ResourceException

deleteValue

public void deleteValue(String languageTag)
                 throws ResourceException
Description copied from interface: IMutableMultiLanguagedProperty
Removes a language specific value of this property

Specified by:
deleteValue in interface IMutableMultiLanguagedProperty
Throws:
ResourceException

markAsTranslated

public void markAsTranslated(String languageTag)
                      throws ResourceException
Description copied from interface: IMutableMultiLanguagedProperty
marks this language as up-to-date

Specified by:
markAsTranslated in interface IMutableMultiLanguagedProperty
Throws:
ResourceException

markAsTranslated

public void markAsTranslated()
                      throws ResourceException
Description copied from interface: IMutableMultiLanguagedProperty
marks all languages as up-to-date

Specified by:
markAsTranslated in interface IMutableMultiLanguagedProperty
Throws:
ResourceException

setDefaultLanguage

public void setDefaultLanguage(String languageTag)
                        throws ResourceException
Description copied from interface: IMutableMultiLanguagedProperty
Specifies the default language. The value of the default language is returned if getXXValue methods are called without a desired language and the language in the resource context has no corresponding value in this IMultiLanguagedProperty.

Specified by:
setDefaultLanguage in interface IMutableMultiLanguagedProperty
Parameters:
languageTag - the default language
Throws:
ResourceException
See Also:
IMultiLanguagedProperty

toString

public final String toString()
Overrides:
toString in class Object
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] KMC-CM [sap.com] tc/km/frwk api EP-KM-CM
[sap.com] KMC-WPC [sap.com] tc/kmc/wpc/wpcfacade api EP-PIN-WPC-WCM


Copyright 2014 SAP AG Complete Copyright Notice