microsoft.exchange.webservices.data
Class ServiceObject

java.lang.Object
  extended by microsoft.exchange.webservices.data.ServiceObject
Direct Known Subclasses:
Conversation, Folder, Item, PostReply, ResponseObject

public abstract class ServiceObject
extends java.lang.Object

Represents the base abstract class for all item and folder types.


Constructor Summary
protected ServiceObject(ExchangeService service)
          Internal constructor.
 
Method Summary
 void addServiceObjectChangedEvent(microsoft.exchange.webservices.data.IServiceObjectChangedDelegate change)
          Adds the service object changed event.
protected  void changed()
          Triggers dispatch of the change event.
protected  void clearChangeLog()
          Clear change log.
 void clearServiceObjectChangedEvent()
          Clear service object changed event.
protected  java.lang.String getChangeXmlElementName()
          Gets the name of the change XML element.
protected  java.lang.String getDeleteFieldXmlElementName()
          Gets the name of the delete field XML element.
protected  ExtendedPropertyCollection getExtendedProperties()
          Gets the extended properties.
protected  ServiceId getId()
          Gets the id.
protected  PropertyDefinition getIdPropertyDefinition()
          Gets the id property definition.
protected  boolean getIsCustomDateTimeScopingRequired()
          Determines whether properties defined with ScopedDateTimePropertyDefinition require custom time zone scoping.
protected  boolean getIsTimeZoneHeaderRequired(boolean isUpdateOperation)
          Gets a value indicating whether a time zone SOAP header should be emitted in a CreateItem or UpdateItem request so this item can be property saved or updated.
 java.util.Collection<PropertyDefinitionBase> getLoadedPropertyDefinitions()
          Gets the collection of loaded property definitions.
protected abstract  ExchangeVersion getMinimumRequiredServerVersion()
          Gets the minimum required server version.
 java.lang.Object getObjectFromPropertyDefinition(PropertyDefinitionBase propertyDefinition)
          * Gets the value of specified property in this instance.
protected  microsoft.exchange.webservices.data.PropertyBag getPropertyBag()
          The property bag holding property values for this object.
protected abstract  ServiceObjectSchema getSchema()
          Internal method to return the schema associated with this type of object.
 ExchangeService getService()
          Gets the service.
protected  java.lang.String getSetFieldXmlElementName()
          Gets the name of the set field XML element.
protected  java.lang.String getXmlElementName()
          GetXmlElementName retrieves the XmlElementName of this type based on the EwsObjectDefinition attribute that decorates it, if present.
protected  java.lang.String getXmlElementNameOverride()
          This methods lets subclasses of ServiceObject override the default mechanism by which the XML element name associated with their type is retrieved.
protected abstract  void internalDelete(DeleteMode deleteMode, SendCancellationsMode sendCancellationsMode, AffectedTaskOccurrence affectedTaskOccurrences)
          Internal delete.
protected abstract  void internalLoad(PropertySet propertySet)
          Internal load.
 boolean isDirty()
          Checks if is dirty.
 boolean isNew()
          Checks if is new.
 void load()
          Load.
 void load(PropertySet propertySet)
          Load.
protected  void loadFromXml(microsoft.exchange.webservices.data.EwsServiceXmlReader reader, boolean clearPropertyBag)
          Loads service object from XML.
protected  void loadFromXml(microsoft.exchange.webservices.data.EwsServiceXmlReader reader, boolean clearPropertyBag, PropertySet requestedPropertySet, boolean summaryPropertiesOnly)
          Load from xml.
 void removeServiceObjectChangedEvent(microsoft.exchange.webservices.data.IServiceObjectChangedDelegate change)
          Removes the service object changed event.
 ServiceObjectSchema schema()
          Gets the schema associated with this type of object.
protected  void setService(ExchangeService service)
          Sets the service.
protected  void throwIfThisIsNew()
          Throws exception if this is a new service object.
protected  void throwIfThisIsNotNew()
          Throws exception if this is not a new service object.
protected
<T> boolean
tryGetExtendedProperty(java.lang.Class<T> cls, ExtendedPropertyDefinition propertyDefinition, OutParam<T> propertyValue)
          Try to get the value of a specified extended property in this instance.
<T> boolean
tryGetProperty(java.lang.Class<T> cls, PropertyDefinitionBase propertyDefinition, OutParam<T> propertyValue)
          Try to get the value of a specified property in this instance.
 boolean tryGetProperty(PropertyDefinitionBase propertyDefinition, OutParam<java.lang.Object> propertyValue)
          Try to get the value of a specified property in this instance.
protected  void validate()
          Validate.
protected  void writeToXml(microsoft.exchange.webservices.data.EwsServiceXmlWriter writer)
          Write to xml.
protected  void writeToXmlForUpdate(microsoft.exchange.webservices.data.EwsServiceXmlWriter writer)
          Write to xml for update.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceObject

protected ServiceObject(ExchangeService service)
                 throws java.lang.Exception
Internal constructor.

Parameters:
service - the service
Throws:
java.lang.Exception - the exception
Method Detail

changed

protected void changed()
Triggers dispatch of the change event.


throwIfThisIsNew

protected void throwIfThisIsNew()
                         throws InvalidOperationException,
                                ServiceLocalException
Throws exception if this is a new service object.

Throws:
InvalidOperationException - the invalid operation exception
ServiceLocalException - the service local exception

throwIfThisIsNotNew

protected void throwIfThisIsNotNew()
                            throws InvalidOperationException,
                                   ServiceLocalException
Throws exception if this is not a new service object.

Throws:
InvalidOperationException - the invalid operation exception
ServiceLocalException - the service local exception

getXmlElementNameOverride

protected java.lang.String getXmlElementNameOverride()
This methods lets subclasses of ServiceObject override the default mechanism by which the XML element name associated with their type is retrieved.

Returns:
String

getXmlElementName

protected java.lang.String getXmlElementName()
GetXmlElementName retrieves the XmlElementName of this type based on the EwsObjectDefinition attribute that decorates it, if present.

Returns:
The XML element name associated with this type.

getChangeXmlElementName

protected java.lang.String getChangeXmlElementName()
Gets the name of the change XML element.

Returns:
the change xml element name

getSetFieldXmlElementName

protected java.lang.String getSetFieldXmlElementName()
Gets the name of the set field XML element.

Returns:
String

getDeleteFieldXmlElementName

protected java.lang.String getDeleteFieldXmlElementName()
Gets the name of the delete field XML element.

Returns:
String

getIsTimeZoneHeaderRequired

protected boolean getIsTimeZoneHeaderRequired(boolean isUpdateOperation)
                                       throws ServiceLocalException,
                                              java.lang.Exception
Gets a value indicating whether a time zone SOAP header should be emitted in a CreateItem or UpdateItem request so this item can be property saved or updated.

Parameters:
isUpdateOperation - the is update operation
Returns:
boolean
Throws:
ServiceLocalException
java.lang.Exception

getIsCustomDateTimeScopingRequired

protected boolean getIsCustomDateTimeScopingRequired()
Determines whether properties defined with ScopedDateTimePropertyDefinition require custom time zone scoping.

Returns:
boolean

getPropertyBag

protected microsoft.exchange.webservices.data.PropertyBag getPropertyBag()
The property bag holding property values for this object.

Returns:
the property bag

schema

public ServiceObjectSchema schema()
Gets the schema associated with this type of object.

Returns:
ServiceObjectSchema

getSchema

protected abstract ServiceObjectSchema getSchema()
Internal method to return the schema associated with this type of object.

Returns:
the schema

getMinimumRequiredServerVersion

protected abstract ExchangeVersion getMinimumRequiredServerVersion()
Gets the minimum required server version.

Returns:
the minimum required server version

loadFromXml

protected void loadFromXml(microsoft.exchange.webservices.data.EwsServiceXmlReader reader,
                           boolean clearPropertyBag)
                    throws java.lang.Exception
Loads service object from XML.

Parameters:
reader - the reader
clearPropertyBag - the clear property bag
Throws:
java.lang.Exception - the exception

validate

protected void validate()
                 throws java.lang.Exception
Validate.

Throws:
java.lang.Exception - the exception

loadFromXml

protected void loadFromXml(microsoft.exchange.webservices.data.EwsServiceXmlReader reader,
                           boolean clearPropertyBag,
                           PropertySet requestedPropertySet,
                           boolean summaryPropertiesOnly)
                    throws java.lang.Exception
Load from xml.

Parameters:
reader - the reader
clearPropertyBag - the clear property bag
requestedPropertySet - the requested property set
summaryPropertiesOnly - the summary properties only
Throws:
java.lang.Exception - the exception

clearChangeLog

protected void clearChangeLog()
Clear change log.


writeToXml

protected void writeToXml(microsoft.exchange.webservices.data.EwsServiceXmlWriter writer)
                   throws java.lang.Exception
Write to xml.

Parameters:
writer - the writer
Throws:
java.lang.Exception - the exception

writeToXmlForUpdate

protected void writeToXmlForUpdate(microsoft.exchange.webservices.data.EwsServiceXmlWriter writer)
                            throws java.lang.Exception
Write to xml for update.

Parameters:
writer - the writer
Throws:
java.lang.Exception - the exception

internalLoad

protected abstract void internalLoad(PropertySet propertySet)
                              throws java.lang.Exception
Internal load.

Parameters:
propertySet - the property set
Throws:
java.lang.Exception - the exception

internalDelete

protected abstract void internalDelete(DeleteMode deleteMode,
                                       SendCancellationsMode sendCancellationsMode,
                                       AffectedTaskOccurrence affectedTaskOccurrences)
                                throws java.lang.Exception
Internal delete.

Parameters:
deleteMode - the delete mode
sendCancellationsMode - the send cancellations mode
affectedTaskOccurrences - the affected task occurrences
Throws:
java.lang.Exception - the exception

load

public void load(PropertySet propertySet)
          throws java.lang.Exception
Load.

Parameters:
propertySet - the property set
Throws:
java.lang.Exception - the exception

load

public void load()
          throws java.lang.Exception
Load.

Throws:
java.lang.Exception - the exception

getObjectFromPropertyDefinition

public java.lang.Object getObjectFromPropertyDefinition(PropertyDefinitionBase propertyDefinition)
                                                 throws java.lang.Exception
* Gets the value of specified property in this instance.

Parameters:
propertyDefinition - Definition of the property to get.
Returns:
The value of specified property in this instance.
Throws:
java.lang.Exception - the exception

tryGetExtendedProperty

protected <T> boolean tryGetExtendedProperty(java.lang.Class<T> cls,
                                             ExtendedPropertyDefinition propertyDefinition,
                                             OutParam<T> propertyValue)
                                  throws java.lang.Exception
Try to get the value of a specified extended property in this instance.

Parameters:
propertyDefinition - the property definition
propertyValue - the property value
Returns:
true, if successful
Throws:
java.lang.Exception - the exception

tryGetProperty

public boolean tryGetProperty(PropertyDefinitionBase propertyDefinition,
                              OutParam<java.lang.Object> propertyValue)
                       throws java.lang.Exception
Try to get the value of a specified property in this instance.

Parameters:
propertyDefinition - The property definition.
propertyValue - The property value
Returns:
True if property retrieved, false otherwise.
Throws:
java.lang.Exception

tryGetProperty

public <T> boolean tryGetProperty(java.lang.Class<T> cls,
                                  PropertyDefinitionBase propertyDefinition,
                                  OutParam<T> propertyValue)
                       throws java.lang.Exception
Try to get the value of a specified property in this instance.

Parameters:
propertyDefinition - the property definition
propertyValue - the property value
Returns:
true, if successful
Throws:
java.lang.Exception - the exception

getLoadedPropertyDefinitions

public java.util.Collection<PropertyDefinitionBase> getLoadedPropertyDefinitions()
                                                                          throws java.lang.Exception
Gets the collection of loaded property definitions.

Returns:
the loaded property definitions
Throws:
java.lang.Exception - the exception

getService

public ExchangeService getService()
Gets the service.

Returns:
the service

setService

protected void setService(ExchangeService service)
Sets the service.

Parameters:
service - the new service

getIdPropertyDefinition

protected PropertyDefinition getIdPropertyDefinition()
Gets the id property definition.

Returns:
the id property definition

getId

protected ServiceId getId()
                   throws ServiceLocalException
Gets the id.

Returns:
the id
Throws:
ServiceLocalException - the service local exception

isNew

public boolean isNew()
              throws ServiceLocalException
Checks if is new.

Returns:
true, if is new
Throws:
ServiceLocalException - the service local exception

isDirty

public boolean isDirty()
Checks if is dirty.

Returns:
true, if is dirty

getExtendedProperties

protected ExtendedPropertyCollection getExtendedProperties()
                                                    throws java.lang.Exception
Gets the extended properties.

Returns:
the extended properties
Throws:
java.lang.Exception - the exception

addServiceObjectChangedEvent

public void addServiceObjectChangedEvent(microsoft.exchange.webservices.data.IServiceObjectChangedDelegate change)
Adds the service object changed event.

Parameters:
change - the change

removeServiceObjectChangedEvent

public void removeServiceObjectChangedEvent(microsoft.exchange.webservices.data.IServiceObjectChangedDelegate change)
Removes the service object changed event.

Parameters:
change - the change

clearServiceObjectChangedEvent

public void clearServiceObjectChangedEvent()
Clear service object changed event.