Class PropertySet
- java.lang.Object
-
- microsoft.exchange.webservices.data.core.PropertySet
-
- All Implemented Interfaces:
Iterable<PropertyDefinitionBase>,ISelfValidate
public final class PropertySet extends Object implements ISelfValidate, Iterable<PropertyDefinitionBase>
Represents a set of item or folder property. Property sets are used to indicate what property of an item or folder should be loaded when binding to an existing item or folder or when loading an item or folder's property.
-
-
Field Summary
Fields Modifier and Type Field Description static PropertySetFirstClassPropertiesThe Constant FirstClassProperties.static PropertySetIdOnlyThe Constant IdOnly.
-
Constructor Summary
Constructors Constructor Description PropertySet()Initializes a new instance of PropertySet based upon BasePropertySet.IdOnly.PropertySet(Iterator<PropertyDefinitionBase> additionalProperties)Initializes a new instance of PropertySet based upon BasePropertySet.IdOnly.PropertySet(BasePropertySet basePropertySet)Initializes a new instance of PropertySet.PropertySet(BasePropertySet basePropertySet, Iterator<PropertyDefinitionBase> additionalProperties)Initializes a new instance of PropertySet.PropertySet(BasePropertySet basePropertySet, PropertyDefinitionBase... additionalProperties)Initializes a new instance of PropertySet.PropertySet(PropertyDefinitionBase... additionalProperties)Initializes a new instance of PropertySet based upon BasePropertySet.IdOnly.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(PropertyDefinitionBase property)Adds the specified property to the property set.voidaddRange(Iterable<PropertyDefinitionBase> properties)Adds the specified property to the property set.voidclear()Remove all explicitly added property from the property set.booleancontains(PropertyDefinitionBase property)Determines whether the specified property has been explicitly added to this property set using the Add or AddRange methods.BasePropertySetgetBasePropertySet()Gets the base property set, the property set is based upon.BooleangetConvertHtmlCodePageToUTF8()Gets value indicating whether or not to convert HTML code page to UTF8 encoding.intgetCount()Gets the number of explicitly added property in this set.static LazyMember<Map<BasePropertySet,String>>getDefaultPropertySetMap()Maps BasePropertySet values to EWS's BaseShape values.BooleangetFilterHtmlContent()Gets value indicating whether or not to filter potentially unsafe HTML content from message bodies.static PropertySetgetFirstClassProperties()Returns a predefined property set that includes the first class property of an item or folder.static PropertySetgetIdOnly()Returns a predefined property set that only includes the Id property.PropertyDefinitionBasegetPropertyDefinitionBaseAt(int index)Gets the PropertyDefinitionBase at the specified index.static PropertySetgetPropertySetFromBasePropertySet(BasePropertySet basePropertySet)Implements an implicit conversion between PropertySet and BasePropertySet.BodyTypegetRequestedBodyType()Gets type of body that should be loaded on item.voidinternalValidate()Validates this property set.Iterator<PropertyDefinitionBase>iterator()booleanremove(PropertyDefinitionBase property)Removes the specified property from the set.voidsetBasePropertySet(BasePropertySet basePropertySet)Sets the base property set, the property set is based upon.voidsetConvertHtmlCodePageToUTF8(Boolean value)Sets value indicating whether or not to convert HTML code page to UTF8 encoding.voidsetFilterHtmlContent(Boolean filterHtml)Sets value indicating whether or not to filter potentially unsafe HTML content from message bodies.voidsetRequestedBodyType(BodyType requestedBodyType)Sets type of body that should be loaded on item.voidvalidate()Validate.voidvalidateForRequest(ServiceRequestBase request, boolean summaryPropertiesOnly)Validates this property set instance for request to ensure that: 1.static voidwriteAdditionalPropertiesToXml(EwsServiceXmlWriter writer, Iterator<PropertyDefinitionBase> propertyDefinitions)Writes additional property to XML.voidwriteToXml(EwsServiceXmlWriter writer, ServiceObjectType serviceObjectType)Writes the property set to XML.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
IdOnly
public static final PropertySet IdOnly
The Constant IdOnly.
-
FirstClassProperties
public static final PropertySet FirstClassProperties
The Constant FirstClassProperties.
-
-
Constructor Detail
-
PropertySet
public PropertySet(BasePropertySet basePropertySet, PropertyDefinitionBase... additionalProperties)
Initializes a new instance of PropertySet.- Parameters:
basePropertySet- The base property set to base the property set upon.additionalProperties- Additional property to include in the property set. Property definitions are available as static members from schema classes (for example, EmailMessageSchema.Subject, AppointmentSchema.Start, ContactSchema.GivenName, etc.)
-
PropertySet
public PropertySet(BasePropertySet basePropertySet, Iterator<PropertyDefinitionBase> additionalProperties)
Initializes a new instance of PropertySet.- Parameters:
basePropertySet- The base property set to base the property set upon.additionalProperties- Additional property to include in the property set. Property definitions are available as static members from schema classes (for example, EmailMessageSchema.Subject, AppointmentSchema.Start, ContactSchema.GivenName, etc.)
-
PropertySet
public PropertySet()
Initializes a new instance of PropertySet based upon BasePropertySet.IdOnly.
-
PropertySet
public PropertySet(BasePropertySet basePropertySet)
Initializes a new instance of PropertySet.- Parameters:
basePropertySet- The base property set to base the property set upon.
-
PropertySet
public PropertySet(PropertyDefinitionBase... additionalProperties)
Initializes a new instance of PropertySet based upon BasePropertySet.IdOnly.- Parameters:
additionalProperties- Additional property to include in the property set. Property definitions are available as static members from schema classes (for example, EmailMessageSchema.Subject, AppointmentSchema.Start, ContactSchema.GivenName, etc.)
-
PropertySet
public PropertySet(Iterator<PropertyDefinitionBase> additionalProperties)
Initializes a new instance of PropertySet based upon BasePropertySet.IdOnly.- Parameters:
additionalProperties- Additional property to include in the property set. Property definitions are available as static members from schema classes (for example, EmailMessageSchema.Subject, AppointmentSchema.Start, ContactSchema.GivenName, etc.)
-
-
Method Detail
-
getIdOnly
public static PropertySet getIdOnly()
Returns a predefined property set that only includes the Id property.- Returns:
- Returns a predefined property set that only includes the Id property.
-
getFirstClassProperties
public static PropertySet getFirstClassProperties()
Returns a predefined property set that includes the first class property of an item or folder.- Returns:
- A predefined property set that includes the first class property of an item or folder.
-
getPropertySetFromBasePropertySet
public static PropertySet getPropertySetFromBasePropertySet(BasePropertySet basePropertySet)
Implements an implicit conversion between PropertySet and BasePropertySet.- Parameters:
basePropertySet- The BasePropertySet value to convert from.- Returns:
- A PropertySet instance based on the specified base property set.
-
add
public void add(PropertyDefinitionBase property) throws Exception
Adds the specified property to the property set.- Parameters:
property- The property to add.- Throws:
Exception- the exception
-
addRange
public void addRange(Iterable<PropertyDefinitionBase> properties) throws Exception
Adds the specified property to the property set.- Parameters:
properties- The property to add.- Throws:
Exception- the exception
-
clear
public void clear()
Remove all explicitly added property from the property set.
-
contains
public boolean contains(PropertyDefinitionBase property)
Determines whether the specified property has been explicitly added to this property set using the Add or AddRange methods.- Parameters:
property- The property.- Returns:
- true if this property set contains the specified property otherwise, false
-
remove
public boolean remove(PropertyDefinitionBase property)
Removes the specified property from the set.- Parameters:
property- The property to remove.- Returns:
- true if the property was successfully removed, false otherwise.
-
getBasePropertySet
public BasePropertySet getBasePropertySet()
Gets the base property set, the property set is based upon.- Returns:
- the base property set
-
getDefaultPropertySetMap
public static LazyMember<Map<BasePropertySet,String>> getDefaultPropertySetMap()
Maps BasePropertySet values to EWS's BaseShape values.- Returns:
- the base property set
-
setBasePropertySet
public void setBasePropertySet(BasePropertySet basePropertySet)
Sets the base property set, the property set is based upon.- Parameters:
basePropertySet- Base property set.
-
getRequestedBodyType
public BodyType getRequestedBodyType()
Gets type of body that should be loaded on item. If RequestedBodyType is null, body is returned as HTML if available, plain text otherwise.- Returns:
- the requested body type
-
setRequestedBodyType
public void setRequestedBodyType(BodyType requestedBodyType)
Sets type of body that should be loaded on item. If RequestedBodyType is null, body is returned as HTML if available, plain text otherwise.- Parameters:
requestedBodyType- Type of body that should be loaded on item.
-
getCount
public int getCount()
Gets the number of explicitly added property in this set.- Returns:
- the count
-
getFilterHtmlContent
public Boolean getFilterHtmlContent()
Gets value indicating whether or not to filter potentially unsafe HTML content from message bodies.- Returns:
- the filter html content
-
setFilterHtmlContent
public void setFilterHtmlContent(Boolean filterHtml)
Sets value indicating whether or not to filter potentially unsafe HTML content from message bodies.- Parameters:
filterHtml- true to filter otherwise false.
-
getConvertHtmlCodePageToUTF8
public Boolean getConvertHtmlCodePageToUTF8()
Gets value indicating whether or not to convert HTML code page to UTF8 encoding.
-
setConvertHtmlCodePageToUTF8
public void setConvertHtmlCodePageToUTF8(Boolean value)
Sets value indicating whether or not to convert HTML code page to UTF8 encoding.
-
getPropertyDefinitionBaseAt
public PropertyDefinitionBase getPropertyDefinitionBaseAt(int index)
Gets the PropertyDefinitionBase at the specified index.- Parameters:
index- Index.- Returns:
- the property definition base at
-
validate
public void validate() throws ServiceValidationException
Validate.- Specified by:
validatein interfaceISelfValidate- Throws:
ServiceValidationException- the service validation exception
-
writeAdditionalPropertiesToXml
public static void writeAdditionalPropertiesToXml(EwsServiceXmlWriter writer, Iterator<PropertyDefinitionBase> propertyDefinitions) throws XMLStreamException, ServiceXmlSerializationException
Writes additional property to XML.- Parameters:
writer- The writer to write topropertyDefinitions- The property definitions to write- Throws:
XMLStreamException- the XML stream exceptionServiceXmlSerializationException- the service xml serialization exception
-
internalValidate
public void internalValidate() throws ServiceValidationException
Validates this property set.- Throws:
ServiceValidationException- the service validation exception
-
validateForRequest
public void validateForRequest(ServiceRequestBase request, boolean summaryPropertiesOnly) throws ServiceVersionException, ServiceValidationException
Validates this property set instance for request to ensure that: 1. Properties are valid for the request server version 2. If only summary property are legal for this request (e.g. FindItem) then only summary property were specified.- Parameters:
request- The request.summaryPropertiesOnly- if set to true then only summary property are allowed.- Throws:
ServiceVersionException- the service version exceptionServiceValidationException- the service validation exception
-
writeToXml
public void writeToXml(EwsServiceXmlWriter writer, ServiceObjectType serviceObjectType) throws XMLStreamException, ServiceXmlSerializationException
Writes the property set to XML.- Parameters:
writer- The writer to write toserviceObjectType- The type of service object the property set is emitted for- Throws:
XMLStreamException- the XML stream exceptionServiceXmlSerializationException- the service xml serialization exception
-
iterator
public Iterator<PropertyDefinitionBase> iterator()
- Specified by:
iteratorin interfaceIterable<PropertyDefinitionBase>
-
-