/** * Write field deletion to XML. * * @param writer the writer * @param ewsObject the ews object * @param fieldXmlElementName the field xml element name * @throws XMLStreamException the xML stream exception * @throws ServiceXmlSerializationException the service xml serialization exception */ private void internalWriteDeleteFieldToXml( EwsServiceXmlWriter writer, ServiceObject ewsObject, String fieldXmlElementName) throws XMLStreamException, ServiceXmlSerializationException { writer.writeStartElement(XmlNamespace.Types, ewsObject.getDeleteFieldXmlElementName()); writer.writeStartElement(XmlNamespace.Types, XmlElementNames.IndexedFieldURI); writer.writeAttributeValue(XmlAttributeNames.FieldURI, getFieldUri(fieldXmlElementName)); writer.writeAttributeValue(XmlAttributeNames.FieldIndex, this.getKey().toString()); writer.writeEndElement(); // IndexedFieldURI writer.writeEndElement(); // ewsObject.GetDeleteFieldXmlElementName() }
/** * Writes the update to XML. * * @param writer the writer * @param ewsObject the ews object * @param ownerDictionaryXmlElementName the owner dictionary xml element name * @return True if update XML was written. * @throws XMLStreamException the xML stream exception * @throws ServiceXmlSerializationException the service xml serialization exception */ @Override protected boolean writeSetUpdateToXml( EwsServiceXmlWriter writer, ServiceObject ewsObject, String ownerDictionaryXmlElementName) throws XMLStreamException, ServiceXmlSerializationException { List<String> fieldsToSet = new ArrayList<String>(); for (String xmlElementName : this.propertyBag.getAddedItems()) { fieldsToSet.add(xmlElementName); } for (String xmlElementName : this.propertyBag.getModifiedItems()) { fieldsToSet.add(xmlElementName); } for (String xmlElementName : fieldsToSet) { writer.writeStartElement(XmlNamespace.Types, ewsObject.getSetFieldXmlElementName()); writer.writeStartElement(XmlNamespace.Types, XmlElementNames.IndexedFieldURI); writer.writeAttributeValue(XmlAttributeNames.FieldURI, getFieldUri(xmlElementName)); writer.writeAttributeValue(XmlAttributeNames.FieldIndex, this.getKey().toString()); writer.writeEndElement(); // IndexedFieldURI writer.writeStartElement(XmlNamespace.Types, ewsObject.getXmlElementName()); writer.writeStartElement(XmlNamespace.Types, ownerDictionaryXmlElementName); writer.writeStartElement(XmlNamespace.Types, XmlElementNames.Entry); this.writeAttributesToXml(writer); writer.writeElementValue( XmlNamespace.Types, xmlElementName, this.propertyBag.getSimplePropertyBag(xmlElementName)); writer.writeEndElement(); // Entry writer.writeEndElement(); // ownerDictionaryXmlElementName writer.writeEndElement(); // ewsObject.GetXmlElementName() writer.writeEndElement(); // ewsObject.GetSetFieldXmlElementName() } for (String xmlElementName : this.propertyBag.getRemovedItems()) { this.internalWriteDeleteFieldToXml(writer, ewsObject, xmlElementName); } return true; }