org.sakaiproject.util.resource
Class BaseResourceProperties

java.lang.Object
  extended byorg.sakaiproject.util.resource.BaseResourceProperties
All Implemented Interfaces:
ResourceProperties, Serializable
Direct Known Subclasses:
BaseResourcePropertiesEdit

public class BaseResourceProperties
extends Object
implements ResourceProperties

BaseResourceProperties is the base class for ResourceProperties implementations.

Author:
Sakai Software Development Team
See Also:
Serialized Form

Field Summary
protected  boolean m_lazy
          If the full properties have not yet been read.
protected  Hashtable m_props
          The hashtable of properties.
 
Fields inherited from interface org.sakaiproject.service.legacy.entity.ResourceProperties
FILE_TYPE, NEW_ASSIGNMENT_CHECK_ADD_DUE_DATE, NEW_ASSIGNMENT_CHECK_AUTO_ANNOUNCE, PROP_ASSIGNMENT_DELETED, PROP_ASSIGNMENT_DUEDATE_CALENDAR_EVENT_ID, PROP_ASSIGNMENT_OPENDATE_ANNOUNCEMENT_MESSAGE_ID, PROP_CALENDAR_EVENT_FIELDS, PROP_CALENDAR_LOCATION, PROP_CALENDAR_TYPE, PROP_CHANNEL_ENABLED, PROP_CHAT_ROOM, PROP_COLLECTION_BODY_QUOTA, PROP_CONTENT_ENCODING, PROP_CONTENT_LENGTH, PROP_CONTENT_TYPE, PROP_COPYRIGHT, PROP_COPYRIGHT_ALERT, PROP_COPYRIGHT_CHOICE, PROP_CREATION_DATE, PROP_CREATOR, PROP_DESCRIPTION, PROP_DISCUSSION_CATEGORIES, PROP_DISPLAY_NAME, PROP_IS_COLLECTION, PROP_MAIL_CHANNEL_OPEN, PROP_MODIFIED_BY, PROP_MODIFIED_DATE, PROP_ORIGINAL_FILENAME, PROP_PUBVIEW, PROP_REPLY_STYLE, PROP_SITE_EMAIL_ARCHIVE, PROP_SITE_EMAIL_NOTIFICATION_ID, PROP_STRUCTOBJ_TYPE, PROP_SUBMISSION_PREVIOUS_FEEDBACK_COMMENT, PROP_SUBMISSION_PREVIOUS_FEEDBACK_TEXT, PROP_SUBMISSION_PREVIOUS_GRADES, PROP_SUBMISSION_SCALED_PREVIOUS_GRADES, PROP_TO, PROP_TOOL_CATEGORY, PROP_TOOL_DESCRIPTION, PROP_TOOL_TITLE, TYPE_URL
 
Constructor Summary
BaseResourceProperties()
          Construct.
BaseResourceProperties(Element el)
          Construct from XML.
 
Method Summary
 void addAll(Properties props)
          Add all the properties from the Properties object.
 void addAll(ResourceProperties other)
          Add all the properties from the other ResourceProperties object.
 void addProperty(String name, String value)
          Add a single valued property.
 void addPropertyToList(String name, String value)
          Add a value to a multi-valued property.
 void clear()
          Remove all properties.
 boolean getBooleanProperty(String name)
          Access a named property as a boolean.
 long getLongProperty(String name)
          Access a named property as a long.
 String getNamePropAssignmentDeleted()
          Get the static String of PROP_ASSIGNMENT_DELETED
 String getNamePropCalendarLocation()
          Get the static String of PROP_CALENDAR_LOCATION
 String getNamePropCalendarType()
          Get the static String of PROP_CALENDAR_TYPE
 String getNamePropChatRoom()
          Get the static String of PROP_CHAT_ROOM
 String getNamePropCollectionBodyQuota()
          Get the static String of PROP_COLLECTION_BODY_QUOTA
 String getNamePropContentLength()
          Get the static String of PROP_CONTENT_LENGTH
 String getNamePropContentType()
          Get the static String of PROP_CONTENT_TYPE
 String getNamePropCopyright()
          Get the static String of PROP_COPYRIGHT
 String getNamePropCopyrightAlert()
          Get the static String of PROP_COPYRIGHT_ALERT
 String getNamePropCopyrightChoice()
          Get the static String of PROP_COPYRIGHT_CHOICE
 String getNamePropCreationDate()
          Get the static String of PROP_CREATION_DATE
 String getNamePropCreator()
          Get the static String of PROP_CREATOR
 String getNamePropDescription()
          Get the static String of PROP_DESCRIPTION
 String getNamePropDisplayName()
          Get the static String of PROP_DISPLAY_NAME
 String getNamePropIsCollection()
          Get the static String of PROP_IS_COLLECTION
 String getNamePropModifiedBy()
          Get the static String of PROP_MODIFIED_BY
 String getNamePropModifiedDate()
          Get the static String of PROP_MODIFIED_DATE
 String getNamePropNewAssignmentCheckAddDueDate()
          Get the static String of NEW_ASSIGNMENT_CHECK_ADD_DUE_DATE
 String getNamePropNewAssignmentCheckAutoAnnounce()
          Get the static String of NEW_ASSIGNMENT_CHECK_AUTO_ANNOUNCE
 String getNamePropReplyStyle()
          Get the static String of PROP_REPLY_STYLE
 String getNamePropStructObjType()
          Get the static String of PROP_STRUCTOBJ_TYPE
 String getNamePropSubmissionPreviousFeedbackComment()
          Get the static String of PROP_SUBMISSION_PREVIOUS_FEEDBACK_COMMENT
 String getNamePropSubmissionPreviousFeedbackText()
          Get the static String of PROP_SUBMISSION_PREVIOUS_FEEDBACK_TEXT
 String getNamePropSubmissionPreviousGrades()
          Get the static String of PROP_SUBMISSION_PREVIOUS_GRADES
 String getNamePropSubmissionScaledPreviousGrades()
          Get the static String of PROP_SUBMISSION_SCALED_PREVIOUS_GRADES
 String getNamePropTo()
          Get the static String of PROP_TO
 String getProperty(String name)
          Access a named property as a string (won't find multi-valued ones.)
 String getPropertyFormatted(String name)
          Access a named property as a properly formatted string.
 List getPropertyList(String name)
          Access a named property as a List of (String), good for single or multi-valued properties.
 Iterator getPropertyNames()
          Access an iterator on the names of the defined properties (Strings).
 Time getTimeProperty(String name)
          Access a named property as a Time.
 String getTypeUrl()
          Get the static String of TYPE_URL
 User getUserProperty(String name)
          Access a named property as a User.
 boolean isLazy()
           
 boolean isLiveProperty(String name)
          Check if a named property is a live one (auto updated).
 void removeProperty(String name)
          Remove a property.
 void set(ResourceProperties props)
          Take all values from this object.
 void setLazy(boolean lazy)
          {@inheritDoc}
 Element toXml(Document doc, Stack stack)
          Serialize the resource into XML, adding an element to the doc under the top of the stack element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_props

protected Hashtable m_props
The hashtable of properties.


m_lazy

protected transient boolean m_lazy
If the full properties have not yet been read.

Constructor Detail

BaseResourceProperties

public BaseResourceProperties()
Construct.


BaseResourceProperties

public BaseResourceProperties(Element el)
Construct from XML.

Parameters:
el - The XML DOM element.
Method Detail

toXml

public Element toXml(Document doc,
                     Stack stack)
Serialize the resource into XML, adding an element to the doc under the top of the stack element.

Specified by:
toXml in interface ResourceProperties
Parameters:
doc - The DOM doc to contain the XML (or null for a string return).
stack - The DOM elements, the top of which is the containing element of the new "resource" element.
Returns:
The newly added element.

isLazy

public boolean isLazy()

getPropertyNames

public Iterator getPropertyNames()
Access an iterator on the names of the defined properties (Strings).

Specified by:
getPropertyNames in interface ResourceProperties
Returns:
An iterator on the names of the defined properties (Strings) (may be empty).

getProperty

public String getProperty(String name)
Access a named property as a string (won't find multi-valued ones.)

Specified by:
getProperty in interface ResourceProperties
Parameters:
name - The property name.
Returns:
the property value, or null if not found.

getPropertyList

public List getPropertyList(String name)
Access a named property as a List of (String), good for single or multi-valued properties.

Specified by:
getPropertyList in interface ResourceProperties
Parameters:
name - The property name.
Returns:
the property value, or null if not found.

isLiveProperty

public boolean isLiveProperty(String name)
Check if a named property is a live one (auto updated).

Specified by:
isLiveProperty in interface ResourceProperties
Parameters:
name - The property name.
Returns:
True if the property is a live one, false if not.

getPropertyFormatted

public String getPropertyFormatted(String name)
Access a named property as a properly formatted string.

Specified by:
getPropertyFormatted in interface ResourceProperties
Parameters:
name - The property name.
Returns:
the property value, or an empty string if not found.

getBooleanProperty

public boolean getBooleanProperty(String name)
                           throws EmptyException,
                                  TypeException
Access a named property as a boolean.

Specified by:
getBooleanProperty in interface ResourceProperties
Parameters:
name - The property name.
Returns:
the property value.
Throws:
EmptyException - if not found.
TypeException - if the property is found but not a boolean.

getLongProperty

public long getLongProperty(String name)
                     throws EmptyException,
                            TypeException
Access a named property as a long.

Specified by:
getLongProperty in interface ResourceProperties
Parameters:
name - The property name.
Returns:
the property value.
Throws:
EmptyException - if not found.
TypeException - if the property is found but not a long.

getTimeProperty

public Time getTimeProperty(String name)
                     throws EmptyException,
                            TypeException
Access a named property as a Time.

Specified by:
getTimeProperty in interface ResourceProperties
Parameters:
name - The property name.
Returns:
the property value
Throws:
EmptyException - if not found.
TypeException - if the property is found but not a Time.

getUserProperty

public User getUserProperty(String name)
                     throws EmptyException,
                            TypeException
Access a named property as a User.

Specified by:
getUserProperty in interface ResourceProperties
Parameters:
name - The property name.
Returns:
the property value
Throws:
EmptyException - if not found.
TypeException - if the property is found but not a User.

getNamePropCreator

public String getNamePropCreator()
Get the static String of PROP_CREATOR

Specified by:
getNamePropCreator in interface ResourceProperties
Returns:
The static String of PROP_CREATOR

getNamePropModifiedBy

public String getNamePropModifiedBy()
Get the static String of PROP_MODIFIED_BY

Specified by:
getNamePropModifiedBy in interface ResourceProperties
Returns:
The static String of PROP_MODIFIED_BY

getNamePropCreationDate

public String getNamePropCreationDate()
Get the static String of PROP_CREATION_DATE

Specified by:
getNamePropCreationDate in interface ResourceProperties
Returns:
The static String of PROP_CREATION_DATE

getNamePropDisplayName

public String getNamePropDisplayName()
Get the static String of PROP_DISPLAY_NAME

Specified by:
getNamePropDisplayName in interface ResourceProperties
Returns:
The static String of PROP_DISPLAY_NAME

getNamePropCopyrightChoice

public String getNamePropCopyrightChoice()
Get the static String of PROP_COPYRIGHT_CHOICE

Specified by:
getNamePropCopyrightChoice in interface ResourceProperties
Returns:
The static String of PROP_COPYRIGHT_CHOICE

getNamePropCopyrightAlert

public String getNamePropCopyrightAlert()
Get the static String of PROP_COPYRIGHT_ALERT

Specified by:
getNamePropCopyrightAlert in interface ResourceProperties
Returns:
The static String of PROP_COPYRIGHT_ALERT

getNamePropCopyright

public String getNamePropCopyright()
Get the static String of PROP_COPYRIGHT

Specified by:
getNamePropCopyright in interface ResourceProperties
Returns:
The static String of PROP_COPYRIGHT

getNamePropContentLength

public String getNamePropContentLength()
Get the static String of PROP_CONTENT_LENGTH

Specified by:
getNamePropContentLength in interface ResourceProperties
Returns:
The static String of PROP_CONTENT_LENGTH

getNamePropContentType

public String getNamePropContentType()
Get the static String of PROP_CONTENT_TYPE

Specified by:
getNamePropContentType in interface ResourceProperties
Returns:
The static String of PROP_CONTENT_TYPE

getNamePropModifiedDate

public String getNamePropModifiedDate()
Get the static String of PROP_MODIFIED_DATE

Specified by:
getNamePropModifiedDate in interface ResourceProperties
Returns:
The static String of PROP_MODIFIED_DATE

getNamePropIsCollection

public String getNamePropIsCollection()
Get the static String of PROP_IS_COLLECTION

Specified by:
getNamePropIsCollection in interface ResourceProperties
Returns:
The static String of PROP_IS_COLLECTION

getNamePropCollectionBodyQuota

public String getNamePropCollectionBodyQuota()
Get the static String of PROP_COLLECTION_BODY_QUOTA

Specified by:
getNamePropCollectionBodyQuota in interface ResourceProperties
Returns:
The static String of PROP_COLLECTION_BODY_QUOTA

getNamePropChatRoom

public String getNamePropChatRoom()
Get the static String of PROP_CHAT_ROOM

Specified by:
getNamePropChatRoom in interface ResourceProperties
Returns:
The static String of PROP_CHAT_ROOM

getNamePropTo

public String getNamePropTo()
Get the static String of PROP_TO

Specified by:
getNamePropTo in interface ResourceProperties
Returns:
The static String of PROP_TO

getNamePropDescription

public String getNamePropDescription()
Get the static String of PROP_DESCRIPTION

Specified by:
getNamePropDescription in interface ResourceProperties
Returns:
The static String of PROP_DESCRIPTION

getNamePropCalendarType

public String getNamePropCalendarType()
Get the static String of PROP_CALENDAR_TYPE

Specified by:
getNamePropCalendarType in interface ResourceProperties
Returns:
The static String of PROP_CALENDAR_TYPE

getNamePropCalendarLocation

public String getNamePropCalendarLocation()
Get the static String of PROP_CALENDAR_LOCATION

Specified by:
getNamePropCalendarLocation in interface ResourceProperties
Returns:
The static String of PROP_CALENDAR_LOCATION

getNamePropReplyStyle

public String getNamePropReplyStyle()
Get the static String of PROP_REPLY_STYLE

Specified by:
getNamePropReplyStyle in interface ResourceProperties
Returns:
The static String of PROP_REPLY_STYLE

getNamePropNewAssignmentCheckAddDueDate

public String getNamePropNewAssignmentCheckAddDueDate()
Get the static String of NEW_ASSIGNMENT_CHECK_ADD_DUE_DATE

Specified by:
getNamePropNewAssignmentCheckAddDueDate in interface ResourceProperties
Returns:
The static String of NEW_ASSIGNMENT_CHECK_ADD_DUE_DATE

getNamePropNewAssignmentCheckAutoAnnounce

public String getNamePropNewAssignmentCheckAutoAnnounce()
Get the static String of NEW_ASSIGNMENT_CHECK_AUTO_ANNOUNCE

Specified by:
getNamePropNewAssignmentCheckAutoAnnounce in interface ResourceProperties
Returns:
The static String of NEW_ASSIGNMENT_CHECK_AUTO_ANNOUNCE

getNamePropSubmissionPreviousGrades

public String getNamePropSubmissionPreviousGrades()
Get the static String of PROP_SUBMISSION_PREVIOUS_GRADES

Specified by:
getNamePropSubmissionPreviousGrades in interface ResourceProperties
Returns:
The static String of PROP_SUBMISSION_PREVIOUS_GRADES

getNamePropSubmissionScaledPreviousGrades

public String getNamePropSubmissionScaledPreviousGrades()
Get the static String of PROP_SUBMISSION_SCALED_PREVIOUS_GRADES

Specified by:
getNamePropSubmissionScaledPreviousGrades in interface ResourceProperties
Returns:
The static String of PROP_SUBMISSION_SCALED_PREVIOUS_GRADES

getNamePropSubmissionPreviousFeedbackText

public String getNamePropSubmissionPreviousFeedbackText()
Get the static String of PROP_SUBMISSION_PREVIOUS_FEEDBACK_TEXT

Specified by:
getNamePropSubmissionPreviousFeedbackText in interface ResourceProperties
Returns:
The static String of PROP_SUBMISSION_PREVIOUS_FEEDBACK_TEXT

getNamePropSubmissionPreviousFeedbackComment

public String getNamePropSubmissionPreviousFeedbackComment()
Get the static String of PROP_SUBMISSION_PREVIOUS_FEEDBACK_COMMENT

Specified by:
getNamePropSubmissionPreviousFeedbackComment in interface ResourceProperties
Returns:
The static String of PROP_SUBMISSION_PREVIOUS_FEEDBACK_COMMENT

getNamePropAssignmentDeleted

public String getNamePropAssignmentDeleted()
Get the static String of PROP_ASSIGNMENT_DELETED

Specified by:
getNamePropAssignmentDeleted in interface ResourceProperties
Returns:
The static String of PROP_ASSIGNMENT_DELETED

getTypeUrl

public String getTypeUrl()
Get the static String of TYPE_URL

Specified by:
getTypeUrl in interface ResourceProperties
Returns:
The static String of TYPE_URL

getNamePropStructObjType

public String getNamePropStructObjType()
Get the static String of PROP_STRUCTOBJ_TYPE

Specified by:
getNamePropStructObjType in interface ResourceProperties
Returns:
The static String of PROP_STRUCTOBJ_TYPE

setLazy

public void setLazy(boolean lazy)
{@inheritDoc}


addProperty

public void addProperty(String name,
                        String value)
Add a single valued property.

Specified by:
addProperty in interface ResourceProperties
Parameters:
name - The property name.
value - The property value.

addPropertyToList

public void addPropertyToList(String name,
                              String value)
Add a value to a multi-valued property.

Specified by:
addPropertyToList in interface ResourceProperties
Parameters:
name - The property name.
value - The property value.

addAll

public void addAll(ResourceProperties other)
Add all the properties from the other ResourceProperties object.

Specified by:
addAll in interface ResourceProperties
Parameters:
other - The ResourceProperties to add.

addAll

public void addAll(Properties props)
Add all the properties from the Properties object.

Specified by:
addAll in interface ResourceProperties
Parameters:
props - The Properties to add.

clear

public void clear()
Remove all properties.

Specified by:
clear in interface ResourceProperties

removeProperty

public void removeProperty(String name)
Remove a property.

Specified by:
removeProperty in interface ResourceProperties
Parameters:
name - The property name.

set

public void set(ResourceProperties props)
Take all values from this object.

Specified by:
set in interface ResourceProperties
Parameters:
props - The ResourceProperties object to take values from.