Class ServiceObject
- java.lang.Object
-
- microsoft.exchange.webservices.data.core.service.ServiceObject
-
- Direct Known Subclasses:
Conversation,Folder,Item,PostReply,RemoveFromCalendar,ResponseObject,SuppressReadReceipt
public abstract class ServiceObject extends Object
Represents the base abstract class for all item and folder types.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedServiceObject(ExchangeService service)Internal constructor.protectedServiceObject(ExchangeService service, ServiceId serviceId)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddServiceObjectChangedEvent(IServiceObjectChangedDelegate change)Adds the service object changed event.voidchanged()Triggers dispatch of the change event.voidclearChangeLog()Clear change log.voidclearServiceObjectChangedEvent()Clear service object changed event.StringgetChangeXmlElementName()Gets the name of the change XML element.StringgetDeleteFieldXmlElementName()Gets the name of the delete field XML element.protected ExtendedPropertyCollectiongetExtendedProperties()Gets the extended property.ServiceIdgetId()Gets the id.PropertyDefinitiongetIdPropertyDefinition()Gets the id property definition.protected booleangetIsCustomDateTimeScopingRequired()Determines whether property defined with ScopedDateTimePropertyDefinition require custom time zone scoping.protected booleangetIsTimeZoneHeaderRequired(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.Collection<PropertyDefinitionBase>getLoadedPropertyDefinitions()Gets the collection of loaded property definitions.abstract ExchangeVersiongetMinimumRequiredServerVersion()Gets the minimum required server version.ObjectgetObjectFromPropertyDefinition(PropertyDefinitionBase propertyDefinition)Gets the value of specified property in this instance.PropertyBaggetPropertyBag()The property bag holding property values for this object.abstract ServiceObjectSchemagetSchema()Internal method to return the schema associated with this type of object.ExchangeServicegetService()Gets the service.StringgetSetFieldXmlElementName()Gets the name of the set field XML element.StringgetXmlElementName()GetXmlElementName retrieves the XmlElementName of this type based on the EwsObjectDefinition attribute that decorates it, if present.protected StringgetXmlElementNameOverride()This methods lets subclasses of ServiceObject override the default mechanism by which the XML element name associated with their type is retrieved.protected abstract voidinternalDelete(DeleteMode deleteMode, SendCancellationsMode sendCancellationsMode, AffectedTaskOccurrence affectedTaskOccurrences)Internal delete.protected abstract voidinternalLoad(PropertySet propertySet)Internal load.booleanisDirty()Checks if is dirty.booleanisNew()Checks if is new.voidload()Load.voidload(PropertySet propertySet)Load.voidloadFromXml(EwsServiceXmlReader reader, boolean clearPropertyBag)Loads service object from XML.voidloadFromXml(EwsServiceXmlReader reader, boolean clearPropertyBag, PropertySet requestedPropertySet, boolean summaryPropertiesOnly)Load from xml.voidremoveServiceObjectChangedEvent(IServiceObjectChangedDelegate change)Removes the service object changed event.ServiceObjectSchemaschema()Gets the schema associated with this type of object.protected voidsetService(ExchangeService service)Sets the service.voidthrowIfThisIsNew()Throws exception if this is a new service object.protected voidthrowIfThisIsNotNew()Throws exception if this is not a new service object.protected <T> booleantryGetExtendedProperty(Class<T> cls, ExtendedPropertyDefinition propertyDefinition, OutParam<T> propertyValue)Try to get the value of a specified extended property in this instance.<T> booleantryGetProperty(Class<T> cls, PropertyDefinitionBase propertyDefinition, OutParam<T> propertyValue)Try to get the value of a specified property in this instance.booleantryGetProperty(PropertyDefinitionBase propertyDefinition, OutParam<Object> propertyValue)Try to get the value of a specified property in this instance.protected voidvalidate()Validate.voidwriteToXml(EwsServiceXmlWriter writer)Write to xml.voidwriteToXmlForUpdate(EwsServiceXmlWriter writer)Write to xml for update.
-
-
-
Constructor Detail
-
ServiceObject
protected ServiceObject(ExchangeService service) throws Exception
Internal constructor.- Parameters:
service- the service- Throws:
Exception- the exception
-
ServiceObject
protected ServiceObject(ExchangeService service, ServiceId serviceId) throws Exception
- Throws:
Exception
-
-
Method Detail
-
changed
public void changed()
Triggers dispatch of the change event.
-
throwIfThisIsNew
public void throwIfThisIsNew() throws InvalidOperationException, ServiceLocalException
Throws exception if this is a new service object.- Throws:
InvalidOperationException- the invalid operation exceptionServiceLocalException- 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 exceptionServiceLocalException- the service local exception
-
getXmlElementNameOverride
protected 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
public 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
public String getChangeXmlElementName()
Gets the name of the change XML element.- Returns:
- the change xml element name
-
getSetFieldXmlElementName
public String getSetFieldXmlElementName()
Gets the name of the set field XML element.- Returns:
- String
-
getDeleteFieldXmlElementName
public String getDeleteFieldXmlElementName()
Gets the name of the delete field XML element.- Returns:
- String
-
getIsTimeZoneHeaderRequired
protected boolean getIsTimeZoneHeaderRequired(boolean isUpdateOperation) throws ServiceLocalException, 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:
ServiceLocalExceptionException
-
getIsCustomDateTimeScopingRequired
protected boolean getIsCustomDateTimeScopingRequired()
Determines whether property defined with ScopedDateTimePropertyDefinition require custom time zone scoping.- Returns:
- boolean
-
getPropertyBag
public 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
public abstract ServiceObjectSchema getSchema()
Internal method to return the schema associated with this type of object.- Returns:
- the schema
-
getMinimumRequiredServerVersion
public abstract ExchangeVersion getMinimumRequiredServerVersion()
Gets the minimum required server version.- Returns:
- the minimum required server version
-
loadFromXml
public void loadFromXml(EwsServiceXmlReader reader, boolean clearPropertyBag) throws Exception
Loads service object from XML.- Parameters:
reader- the readerclearPropertyBag- the clear property bag- Throws:
Exception- the exception
-
loadFromXml
public void loadFromXml(EwsServiceXmlReader reader, boolean clearPropertyBag, PropertySet requestedPropertySet, boolean summaryPropertiesOnly) throws Exception
Load from xml.- Parameters:
reader- the readerclearPropertyBag- the clear property bagrequestedPropertySet- the requested property setsummaryPropertiesOnly- the summary property only- Throws:
Exception- the exception
-
clearChangeLog
public void clearChangeLog()
Clear change log.
-
writeToXml
public void writeToXml(EwsServiceXmlWriter writer) throws Exception
Write to xml.- Parameters:
writer- the writer- Throws:
Exception- the exception
-
writeToXmlForUpdate
public void writeToXmlForUpdate(EwsServiceXmlWriter writer) throws Exception
Write to xml for update.- Parameters:
writer- the writer- Throws:
Exception- the exception
-
internalLoad
protected abstract void internalLoad(PropertySet propertySet) throws Exception
Internal load.- Parameters:
propertySet- the property set- Throws:
Exception- the exception
-
internalDelete
protected abstract void internalDelete(DeleteMode deleteMode, SendCancellationsMode sendCancellationsMode, AffectedTaskOccurrence affectedTaskOccurrences) throws Exception
Internal delete.- Parameters:
deleteMode- the delete modesendCancellationsMode- the send cancellations modeaffectedTaskOccurrences- the affected task occurrences- Throws:
Exception- the exception
-
load
public void load(PropertySet propertySet) throws Exception
Load.- Parameters:
propertySet- the property set- Throws:
Exception- the exception
-
getObjectFromPropertyDefinition
public Object getObjectFromPropertyDefinition(PropertyDefinitionBase propertyDefinition) throws 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:
Exception- the exception
-
tryGetExtendedProperty
protected <T> boolean tryGetExtendedProperty(Class<T> cls, ExtendedPropertyDefinition propertyDefinition, OutParam<T> propertyValue) throws Exception
Try to get the value of a specified extended property in this instance.- Parameters:
propertyDefinition- the property definitionpropertyValue- the property value- Returns:
- true, if successful
- Throws:
Exception- the exception
-
tryGetProperty
public boolean tryGetProperty(PropertyDefinitionBase propertyDefinition, OutParam<Object> propertyValue) throws 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:
Exception
-
tryGetProperty
public <T> boolean tryGetProperty(Class<T> cls, PropertyDefinitionBase propertyDefinition, OutParam<T> propertyValue) throws Exception
Try to get the value of a specified property in this instance.- Parameters:
propertyDefinition- the property definitionpropertyValue- the property value- Returns:
- true, if successful
- Throws:
Exception- the exception
-
getLoadedPropertyDefinitions
public Collection<PropertyDefinitionBase> getLoadedPropertyDefinitions() throws Exception
Gets the collection of loaded property definitions.- Returns:
- the loaded property definitions
- Throws:
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
public PropertyDefinition getIdPropertyDefinition()
Gets the id property definition.- Returns:
- the id property definition
-
getId
public 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 Exception
Gets the extended property.- Returns:
- the extended property
- Throws:
Exception- the exception
-
addServiceObjectChangedEvent
public void addServiceObjectChangedEvent(IServiceObjectChangedDelegate change)
Adds the service object changed event.- Parameters:
change- the change
-
removeServiceObjectChangedEvent
public void removeServiceObjectChangedEvent(IServiceObjectChangedDelegate change)
Removes the service object changed event.- Parameters:
change- the change
-
clearServiceObjectChangedEvent
public void clearServiceObjectChangedEvent()
Clear service object changed event.
-
-