public class PropertyBag extends Object implements IComplexPropertyChanged, IComplexPropertyChangedDelegate
Constructor and Description |
---|
PropertyBag(ServiceObject owner)
Initializes a new instance of PropertyBag.
|
Modifier and Type | Method and Description |
---|---|
protected static void |
addToChangeList(PropertyDefinition propertyDefinition,
List<PropertyDefinition> changeList)
Adds the specified property to the specified change list if it is not
already present.
|
void |
changed()
Sets the isDirty flag to true and triggers dispatch of the change event
to the owner of the property bag.
|
protected void |
clear()
Clears the bag.
|
void |
clearChangeLog()
Clears the bag's change log.
|
void |
complexPropertyChanged(ComplexProperty complexProperty)
Indicates that a complex property changed.
|
boolean |
contains(PropertyDefinition propertyDefinition)
Determines whether the property bag contains a specific property.
|
protected void |
deleteProperty(PropertyDefinition propertyDefinition)
Deletes the property from the bag.
|
boolean |
getIsDirty()
Indicates if a bag has pending changes.
|
boolean |
getIsUpdateCallNecessary()
Determines whether an EWS UpdateItem/UpdateFolder call is necessary to
save the changes that occurred in the bag.
|
<T> T |
getObjectFromPropertyDefinition(PropertyDefinition propertyDefinition)
Gets the value of a property.
|
ServiceObject |
getOwner()
Gets the owner of this bag.
|
Map<PropertyDefinition,Object> |
getProperties()
Gets a Map holding the bag's property.
|
boolean |
isPropertyLoaded(PropertyDefinition propertyDefinition)
Checks if is property loaded.
|
boolean |
isPropertyUpdated(PropertyDefinition propertyDefinition)
Determines whether the specified property has been updated.
|
void |
loadFromXml(EwsServiceXmlReader reader,
boolean clear,
PropertySet requestedPropertySet,
boolean onlySummaryPropertiesRequested)
Loads property from XML and inserts them in the bag.
|
protected void |
propertyChanged(ComplexProperty complexProperty)
Handles a change event for the specified property.
|
void |
setObjectFromPropertyDefinition(PropertyDefinition propertyDefinition,
Object object)
Gets the value of a property.
|
protected boolean |
tryGetProperty(PropertyDefinition propertyDefinition,
OutParam<Object> propertyValueOutParam)
Tries to get a property value based on a property definition.
|
<T> boolean |
tryGetPropertyType(Class<T> cls,
PropertyDefinition propertyDefinition,
OutParam<T> propertyValue)
Tries to get a property value based on a property definition.
|
<T> boolean |
tryGetValue(PropertyDefinition propertyDefinition,
OutParam<T> propertyValueOutParam)
Tries to retrieve the value of the specified property.
|
void |
validate()
Validate property bag instance.
|
void |
writeToXml(EwsServiceXmlWriter writer)
Writes the bag's property to XML.
|
void |
writeToXmlForUpdate(EwsServiceXmlWriter writer)
Writes the EWS update operations corresponding to the changes that
occurred in the bag to XML.
|
public PropertyBag(ServiceObject owner)
owner
- The owner of the bag.public Map<PropertyDefinition,Object> getProperties()
public ServiceObject getOwner()
public boolean getIsDirty()
protected static void addToChangeList(PropertyDefinition propertyDefinition, List<PropertyDefinition> changeList)
propertyDefinition
- The property to add to the change list.changeList
- The change list to add the property to.public boolean isPropertyLoaded(PropertyDefinition propertyDefinition)
propertyDefinition
- the property definitionpublic boolean isPropertyUpdated(PropertyDefinition propertyDefinition)
propertyDefinition
- The property definition.protected boolean tryGetProperty(PropertyDefinition propertyDefinition, OutParam<Object> propertyValueOutParam)
propertyDefinition
- The property definition.propertyValueOutParam
- The property value.public <T> boolean tryGetPropertyType(Class<T> cls, PropertyDefinition propertyDefinition, OutParam<T> propertyValue) throws ArgumentException
T
- the types of the propertypropertyDefinition
- the property definitionpropertyValue
- the property valueArgumentException
- on validation errorpublic void changed()
public boolean contains(PropertyDefinition propertyDefinition)
propertyDefinition
- The property to check against.public <T> boolean tryGetValue(PropertyDefinition propertyDefinition, OutParam<T> propertyValueOutParam)
propertyDefinition
- the property for which to retrieve a valuepropertyValueOutParam
- if the method succeeds, contains the value of the propertyprotected void propertyChanged(ComplexProperty complexProperty)
complexProperty
- The property that changes.protected void deleteProperty(PropertyDefinition propertyDefinition)
propertyDefinition
- The property to delete.protected void clear()
public void clearChangeLog()
public void loadFromXml(EwsServiceXmlReader reader, boolean clear, PropertySet requestedPropertySet, boolean onlySummaryPropertiesRequested) throws Exception
reader
- The reader from which to read the property.clear
- Indicates whether the bag should be cleared before property
are loaded.requestedPropertySet
- The requested property set.onlySummaryPropertiesRequested
- Indicates whether summary or full property were requested.Exception
- the exceptionpublic void writeToXml(EwsServiceXmlWriter writer) throws Exception
writer
- The writer to write the property to.Exception
- the exceptionpublic void writeToXmlForUpdate(EwsServiceXmlWriter writer) throws Exception
writer
- The writer to write the updates to.Exception
- the exceptionpublic boolean getIsUpdateCallNecessary()
public void validate() throws Exception
Exception
- the exceptionpublic <T> T getObjectFromPropertyDefinition(PropertyDefinition propertyDefinition) throws ServiceLocalException
propertyDefinition
- The property to get or set.ServiceLocalException
- ServiceVersionException will be raised if this property
requires a later version of Exchange.
ServiceObjectPropertyException will be raised for get if
property hasn't been assigned or loaded, raised for set if
property cannot be updated or deleted.public void setObjectFromPropertyDefinition(PropertyDefinition propertyDefinition, Object object) throws Exception
propertyDefinition
- The property to get or set.object
- An object representing the value of the property.Exception
- the exceptionpublic void complexPropertyChanged(ComplexProperty complexProperty)
IComplexPropertyChanged
complexPropertyChanged
in interface IComplexPropertyChanged
complexPropertyChanged
in interface IComplexPropertyChangedDelegate
complexProperty
- Complex property.Copyright © 2012–2015 Microsoft. All rights reserved.