com.sapportals.wcm.repository

Class Property

java.lang.Object
  extended by com.sapportals.wcm.WcmObject
      extended by com.sapportals.wcm.repository.Property
All Implemented Interfaces:
IProperty, Serializable
Direct Known Subclasses:
MutableProperty

public class Property
extends WcmObject
implements IProperty, Serializable

A read-only property of a resource object.

Copyright (c) SAP AG 2001-2004

See Also:
Serialized Form

Field Summary
protected  Properties m_attributes
          The collection of property attributes
protected  Date m_dateValue
          The value if the type is Date
protected  ResourceBundles m_res
           
protected  String m_value
          The value
protected  Object m_value_object
           
protected  List m_values
          Values of multivalued property
 
Fields inherited from class com.sapportals.wcm.WcmObject
ORDER_TYPE_MANUAL, ORDER_TYPE_NONE
 
Constructor Summary
  Property(IPropertyName name, Boolean value)
          Construct a new property of type BOOLEAN.
  Property(IPropertyName name, Boolean value, Properties attributes)
          Construct a new property of type BOOLEAN.
  Property(IPropertyName name, Date value)
          Construct a new property of type DATE.
  Property(IPropertyName name, Date value, Properties attributes)
          Construct a new property of type DATE.
  Property(IPropertyName name, Integer value)
          Construct a new property of type INTEGER.
  Property(IPropertyName name, Integer value, Properties attributes)
          Construct a new property of type INTEGER.
protected Property(IPropertyName name, IPropertyDef def)
           
  Property(IPropertyName name, IPropertyDef def, Boolean value)
          Construct a new property of type BOOLEAN.
  Property(IPropertyName name, IPropertyDef def, Boolean value, Properties attributes)
          Construct a new property of type BOOLEAN.
  Property(IPropertyName name, IPropertyDef def, Date value)
          Construct a new property of type DATE.
  Property(IPropertyName name, IPropertyDef def, Date value, Properties attributes)
          Construct a new property of type DATE.
  Property(IPropertyName name, IPropertyDef def, Integer value)
          Construct a new property of type INTEGER.
  Property(IPropertyName name, IPropertyDef def, Integer value, Properties attributes)
          Construct a new property of type INTEGER.
  Property(IPropertyName name, IPropertyDef def, List values)
          Construct a new multi-valued property.
  Property(IPropertyName name, IPropertyDef def, List values, Properties attributes)
          Construct a new multi-valued property.
  Property(IPropertyName name, IPropertyDef def, Long value)
          Construct a new property of type LONG.
  Property(IPropertyName name, IPropertyDef def, Long value, Properties attributes)
          Construct a new property of type LONG.
  Property(IPropertyName name, IPropertyDef def, Object value)
          Construct a new property.
  Property(IPropertyName name, IPropertyDef def, Object value, Properties attributes)
          Construct a new property.
  Property(IPropertyName name, IPropertyDef def, String value)
          Construct a new property of type STRING.
  Property(IPropertyName name, IPropertyDef def, String value, Properties attributes)
          Construct a new property of type STRING.
  Property(IPropertyName name, IPropertyDef def, XMLMarkup value)
          Construct a new property of type XML.
  Property(IPropertyName name, IPropertyDef def, XMLMarkup value, Properties attributes)
          Construct a new property of type XML.
  Property(IPropertyName name, Long value)
          Construct a new property of type LONG.
  Property(IPropertyName name, Long value, Properties attributes)
          Construct a new property of type LONG.
  Property(IPropertyName name, Object value)
          Construct a new property.
  Property(IPropertyName name, Object value, Properties attributes)
          Construct a new property.
protected Property(IPropertyName name, PropertyType type, boolean isMultivalued)
           
  Property(IPropertyName name, PropertyType type, List values)
          Construct a new multi-valued property.
  Property(IPropertyName name, PropertyType type, List values, Properties attributes)
          Construct a new multi-valued property.
  Property(IPropertyName name, String value)
          Construct a new property of type STRING.
  Property(IPropertyName name, String value, Properties attributes)
          Construct a new property of type STRING.
  Property(IPropertyName name, XMLMarkup value)
          Construct a new property of type XML.
  Property(IPropertyName name, XMLMarkup value, Properties attributes)
          Construct a new property of type XML.
protected Property(Property p)
          Construct a property as a copy
 
Method Summary
static IProperty createContentLanguageProp(String value)
           
static IProperty createContentLengthProp(long length)
           
static IProperty createContentTypeProp(String value)
           
static IProperty createCreatedByProp(String value)
           
static IProperty createCreationDateProp(Date date)
           
static IProperty createDescriptionProp(String value)
           
static IProperty createDisplaynameProp(String value)
           
static IProperty createETagProp(String value)
           
static IProperty createHiddenProp(boolean value)
           
static IProperty createLastModifiedByProp(String value)
           
static IProperty createLastModifiedProp(Date date)
           
static IProperty createPropertyFromStringValue(IPropertyName name, PropertyType type, String svalue)
           
static IProperty createReadOnlyProp(boolean value)
           
static IProperty createResourceTypeProp(String value)
           
 boolean equals(Object prop)
           
 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
 Date getDateValue()
          Get the property value if the type is PropertyType.DATE
protected  Date getDateValueRaw()
          As opposed to getDateValue(), this method tries to return the underlying date object and not a cloned copy of it (for performance reasons) However you shoult note, that modifying the returned Date object will result in undefined behaviour!
 String getDescription()
          Returns the description of the property
 String getDescription(IResourceContext context)
           
 int getIntValue()
          Get the property value if the type is PropertyType.INTEGER
 long getLongIntValue()
          Get the property value if the type is PropertyType.LONG
 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
 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.
 List getValues()
          Returns the property values if this is a multi-valued property.
 int hashCode()
           
 boolean isMultivalued()
          Returns true if the property is multi-valued
static boolean isSystemProperty(IPropertyName propName)
          Returns true if it is the name of a system property
 String toString()
          Returns a string for debugging purposes.
protected  void validateType(Object v)
          Validates the instance of the property value
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

m_value

protected String m_value
The value


m_value_object

protected Object m_value_object

m_dateValue

protected Date m_dateValue
The value if the type is Date


m_values

protected List m_values
Values of multivalued property


m_attributes

protected Properties m_attributes
The collection of property attributes


m_res

protected transient ResourceBundles m_res
Constructor Detail

Property

public Property(IPropertyName name,
                String value)
         throws ResourceException
Construct a new property of type STRING.

Parameters:
name - The property name
value - The property string value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                Date value)
         throws ResourceException
Construct a new property of type DATE.

Parameters:
name - The property name
value - The property date value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                Boolean value)
         throws ResourceException
Construct a new property of type BOOLEAN.

Parameters:
name - The property name
value - The property boolean value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                Integer value)
         throws ResourceException
Construct a new property of type INTEGER.

Parameters:
name - The property name
value - The property integer value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                Long value)
         throws ResourceException
Construct a new property of type LONG.

Parameters:
name - The property name
value - The property long value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                XMLMarkup value)
         throws ResourceException
Construct a new property of type XML.

Parameters:
name - The property name
value - The property xml value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                PropertyType type,
                List values)
         throws ResourceException
Construct a new multi-valued property.

Parameters:
name - The property name
type - The property data type
values - A list of values. The list must contain suitable object instances (String, Date, Integer, Long, Boolean, XMLMarkup) for the specified property type.
Throws:
ResourceException - If the instance of the value does not match the property type

Property

public Property(IPropertyName name,
                Object value)
         throws ResourceException
Construct a new property. The value object's instance must be one of String, Integer, Long, Boolean, Date or XMLMarkup.

Parameters:
name - The property name
value - The value object
Throws:
ResourceException - If the instance of the value parameter is not allowed

Property

public Property(IPropertyName name,
                IPropertyDef def,
                String value)
         throws ResourceException
Construct a new property of type STRING.

Parameters:
name - The property name
def - The property definition
value - The property string value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                IPropertyDef def,
                Date value)
         throws ResourceException
Construct a new property of type DATE.

Parameters:
name - The property name
def - The property definition
value - The property string value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                IPropertyDef def,
                Boolean value)
         throws ResourceException
Construct a new property of type BOOLEAN.

Parameters:
name - The property name
def - The property definition
value - The property string value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                IPropertyDef def,
                Integer value)
         throws ResourceException
Construct a new property of type INTEGER.

Parameters:
name - The property name
def - The property definition
value - The property string value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                IPropertyDef def,
                Long value)
         throws ResourceException
Construct a new property of type LONG.

Parameters:
name - The property name
def - The property definition
value - The property string value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                IPropertyDef def,
                XMLMarkup value)
         throws ResourceException
Construct a new property of type XML.

Parameters:
name - The property name
def - The property definition
value - The property string value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                IPropertyDef def,
                Object value)
         throws ResourceException
Construct a new property. The value object's instance must be one of String, Integer, Long, Boolean, Date or XMLMarkup and must match the PropertyDef's type.

Parameters:
name - The property name
def - The property definition
value - The value object
Throws:
ResourceException - If the instance of the value parameter is not allowed or does not matach the type

Property

public Property(IPropertyName name,
                IPropertyDef def,
                List values)
         throws ResourceException
Construct a new multi-valued property.

Parameters:
name - The property name
def - The property definition
values - A list of values. The list must contain suitable object instances (String, Date, Integer, Long, Boolean, XMLMarkup) for the specified property type.
Throws:
ResourceException - If the instance of the value does not match the property type

Property

public Property(IPropertyName name,
                String value,
                Properties attributes)
         throws ResourceException
Construct a new property of type STRING.

Parameters:
name - The property name
value - The property string value
attributes -
Throws:
ResourceException

Property

public Property(IPropertyName name,
                Date value,
                Properties attributes)
         throws ResourceException
Construct a new property of type DATE.

Parameters:
name - The property name
value - The property date value
attributes -
Throws:
ResourceException

Property

public Property(IPropertyName name,
                Boolean value,
                Properties attributes)
         throws ResourceException
Construct a new property of type BOOLEAN.

Parameters:
name - The property name
value - The property booelan value
attributes -
Throws:
ResourceException

Property

public Property(IPropertyName name,
                Integer value,
                Properties attributes)
         throws ResourceException
Construct a new property of type INTEGER.

Parameters:
name - The property name
value - The property integer value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                Long value,
                Properties attributes)
         throws ResourceException
Construct a new property of type LONG.

Parameters:
name - The property name
value - The property long value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                XMLMarkup value,
                Properties attributes)
         throws ResourceException
Construct a new property of type XML.

Parameters:
name - The property name
value - The property xml value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                Object value,
                Properties attributes)
         throws ResourceException
Construct a new property. The value object's instance must be one of String, Integer, Long, Boolean, Date or XMLMarkup.

Parameters:
name - The property name
value - The value object
attributes -
Throws:
ResourceException - If the instance of the value parameter is not allowed

Property

public Property(IPropertyName name,
                PropertyType type,
                List values,
                Properties attributes)
         throws ResourceException
Construct a new multi-valued property.

Parameters:
name - The property name
type - The property data type
values - A list of values. The list must contain suitable object instances (String, Date, Integer, Long, Boolean, XMLMarkup) for the specified property type.
attributes -
Throws:
ResourceException - If the instance of the value does not match the property type

Property

public Property(IPropertyName name,
                IPropertyDef def,
                String value,
                Properties attributes)
         throws ResourceException
Construct a new property of type STRING.

Parameters:
name - The property name
def - The property definition
value - The property string value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                IPropertyDef def,
                Date value,
                Properties attributes)
         throws ResourceException
Construct a new property of type DATE.

Parameters:
name - The property name
def - The property definition
value - The property string value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                IPropertyDef def,
                Boolean value,
                Properties attributes)
         throws ResourceException
Construct a new property of type BOOLEAN.

Parameters:
name - The property name
def - The property definition
value - The property string value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                IPropertyDef def,
                Integer value,
                Properties attributes)
         throws ResourceException
Construct a new property of type INTEGER.

Parameters:
name - The property name
def - The property definition
value - The property string value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                IPropertyDef def,
                Long value,
                Properties attributes)
         throws ResourceException
Construct a new property of type LONG.

Parameters:
name - The property name
def - The property definition
value - The property string value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                IPropertyDef def,
                XMLMarkup value,
                Properties attributes)
         throws ResourceException
Construct a new property of type XML.

Parameters:
name - The property name
def - The property definition
value - The property string value
Throws:
ResourceException

Property

public Property(IPropertyName name,
                IPropertyDef def,
                Object value,
                Properties attributes)
         throws ResourceException
Construct a new property. The value object's instance must be one of String, Integer, Long, Boolean, Date or XMLMarkup and must match the PropertyDef's type.

Parameters:
name - The property name
def - The property definition
value - The value object
attributes -
Throws:
ResourceException - If the instance of the value parameter is not allowed or does not matach the type

Property

public Property(IPropertyName name,
                IPropertyDef def,
                List values,
                Properties attributes)
         throws ResourceException
Construct a new multi-valued property.

Parameters:
name - The property name
def - The property definition
values - A list of values. The list must contain suitable object instances (String, Date, Integer, Long, Boolean, XMLMarkup) for the specified property type.
attributes -
Throws:
ResourceException - If the instance of the value does not match the property type

Property

protected Property(Property p)
Construct a property as a copy

Parameters:
p -

Property

protected Property(IPropertyName name,
                   IPropertyDef def)
            throws ResourceException
Throws:
ResourceException

Property

protected Property(IPropertyName name,
                   PropertyType type,
                   boolean isMultivalued)
            throws ResourceException
Throws:
ResourceException
Method Detail

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

getDateValueRaw

protected Date getDateValueRaw()
As opposed to getDateValue(), this method tries to return the underlying date object and not a cloned copy of it (for performance reasons) However you shoult note, that modifying the returned Date object will result in undefined behaviour!

Returns:
A date represantation of this Property, which must not be modified!

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

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

toString

public String toString()
Returns a string for debugging purposes. Do not use it for further processing, persistence or display in user interfaces.

Overrides:
toString in class Object

equals

public boolean equals(Object prop)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

validateType

protected void validateType(Object v)
                     throws ResourceException
Validates the instance of the property value

Parameters:
v - The value to set
Throws:
ResourceException

isSystemProperty

public static boolean isSystemProperty(IPropertyName propName)
                                throws ResourceException
Returns true if it is the name of a system property

Parameters:
propName -
Returns:
Boolean value
Throws:
ResourceException

createCreatedByProp

public static IProperty createCreatedByProp(String value)
                                     throws ResourceException
Throws:
ResourceException

createLastModifiedByProp

public static IProperty createLastModifiedByProp(String value)
                                          throws ResourceException
Throws:
ResourceException

createCreationDateProp

public static IProperty createCreationDateProp(Date date)
                                        throws ResourceException
Throws:
ResourceException

createHiddenProp

public static IProperty createHiddenProp(boolean value)
                                  throws ResourceException
Throws:
ResourceException

createLastModifiedProp

public static IProperty createLastModifiedProp(Date date)
                                        throws ResourceException
Throws:
ResourceException

createDescriptionProp

public static IProperty createDescriptionProp(String value)
                                       throws ResourceException
Throws:
ResourceException

createDisplaynameProp

public static IProperty createDisplaynameProp(String value)
                                       throws ResourceException
Throws:
ResourceException

createReadOnlyProp

public static IProperty createReadOnlyProp(boolean value)
                                    throws ResourceException
Throws:
ResourceException

createContentLengthProp

public static IProperty createContentLengthProp(long length)
                                         throws ResourceException
Throws:
ResourceException

createContentTypeProp

public static IProperty createContentTypeProp(String value)
                                       throws ResourceException
Throws:
ResourceException

createETagProp

public static IProperty createETagProp(String value)
                                throws ResourceException
Throws:
ResourceException

createContentLanguageProp

public static IProperty createContentLanguageProp(String value)
                                           throws ResourceException
Throws:
ResourceException

createResourceTypeProp

public static IProperty createResourceTypeProp(String value)
                                        throws ResourceException
Throws:
ResourceException

createPropertyFromStringValue

public static IProperty createPropertyFromStringValue(IPropertyName name,
                                                      PropertyType type,
                                                      String svalue)
                                               throws ResourceException
Throws:
ResourceException
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