/** * Writes the Id encapsulated in the wrapper to XML. * * @param writer the writer * @throws Exception the exception */ @Override protected void writeToXml(EwsServiceXmlWriter writer) throws Exception { this.item.getId().writeToXml(writer); } }
/** * Gets Id of the root item for this item. * * @return the root item id * @throws ServiceLocalException the service local exception */ public ItemId getRootItemId() throws ServiceLocalException { if (this.isAttachment()) { return this.getParentAttachment().getOwner().getRootItemId(); } else { return this.getId(); } }
/** * Creates a copy of this item in the specified folder. Calling this method * results in a call to EWS. Copy returns null if the copy operation is * across two mailboxes or between a mailbox and a public folder. * * @param destinationFolderId the destination folder id * @return The copy of this item. * @throws Exception the exception */ public Item copy(FolderId destinationFolderId) throws Exception { this.throwIfThisIsNew(); this.throwIfThisIsAttachment(); EwsUtilities.validateParam(destinationFolderId, "destinationFolderId"); return this.getService().copyItem(this.getId(), destinationFolderId); }
/** * Moves this item to a the specified folder. Calling this method results in * a call to EWS. Move returns null if the move operation is across two * mailboxes or between a mailbox and a public folder. * * @param destinationFolderId the destination folder id * @return The moved copy of this item. * @throws Exception the exception */ public Item move(FolderId destinationFolderId) throws Exception { this.throwIfThisIsNew(); this.throwIfThisIsAttachment(); EwsUtilities.validateParam(destinationFolderId, "destinationFolderId"); return this.getService().moveItem(this.getId(), destinationFolderId); }
/** * Create the response object. * * @param parentFolderId the parent folder id * @param messageDisposition the message disposition * @throws Exception the exception */ public void internalCreate(FolderId parentFolderId, MessageDisposition messageDisposition) throws Exception { ((ItemId) this.getPropertyBag().getObjectFromPropertyDefinition( ResponseObjectSchema.ReferenceItemId)) .assign(this.referenceItem.getId()); this.getService().internalCreateResponseObject(this, parentFolderId, messageDisposition); } }
/** * Create response object. * * @param parentFolderId The parent folder id. * @param messageDisposition The message disposition. * @return A list of item that were created or modified as a results of * this operation. * @throws Exception the exception */ public List<Item> internalCreate(FolderId parentFolderId, MessageDisposition messageDisposition) throws Exception { ((ItemId) this.getPropertyBag().getObjectFromPropertyDefinition( ResponseObjectSchema.ReferenceItemId)) .assign(this.referenceItem.getId()); return this.getService().internalCreateResponseObject(this, parentFolderId, messageDisposition); }
/** * Create the response object. * * @param destinationFolderId the destination folder id * @param messageDisposition the message disposition * @return The list of item returned by EWS. * @throws Exception the exception */ protected List<Item> internalCreate(FolderId destinationFolderId, MessageDisposition messageDisposition) throws Exception { ((ItemId) this.getPropertyBag().getObjectFromPropertyDefinition( ResponseObjectSchema.ReferenceItemId)) .assign(this.referenceItem.getId()); return this.getService().internalCreateResponseObject(this, destinationFolderId, messageDisposition); }
/** * Create a PostItem response. * * @param parentFolderId the parent folder id * @param messageDisposition the message disposition * @return Created PostItem. * @throws Exception the exception */ protected PostItem internalCreate(FolderId parentFolderId, MessageDisposition messageDisposition) throws Exception { ((ItemId) this .getObjectFromPropertyDefinition( ResponseObjectSchema.ReferenceItemId)) .assign(this.referenceItem.getId()); List<Item> items = this.getService().internalCreateResponseObject(this, parentFolderId, messageDisposition); PostItem postItem = EwsUtilities.findFirstItemOfType(PostItem.class, items); // This should never happen. If it does, we have a bug. EwsUtilities .ewsAssert(postItem != null, "PostReply.InternalCreate", "postItem is null. The CreateItem call did" + " not return the expected PostItem."); return postItem; }
/** * Deletes the object. * * @param deleteMode the delete mode * @param sendCancellationsMode the send cancellations mode * @param affectedTaskOccurrences the affected task occurrences * @throws ServiceLocalException the service local exception * @throws Exception the exception */ @Override protected void internalDelete(DeleteMode deleteMode, SendCancellationsMode sendCancellationsMode, AffectedTaskOccurrence affectedTaskOccurrences) throws ServiceLocalException, Exception { this.throwIfThisIsNew(); this.throwIfThisIsAttachment(); // If sendCancellationsMode is null, use the default value that's // appropriate for item type. if (sendCancellationsMode == null) { sendCancellationsMode = this.getDefaultSendCancellationsMode(); } // If affectedTaskOccurrences is null, use the default value that's // appropriate for item type. if (affectedTaskOccurrences == null) { affectedTaskOccurrences = this.getDefaultAffectedTaskOccurrences(); } this.getService().deleteItem(this.getId(), deleteMode, sendCancellationsMode, affectedTaskOccurrences); }
/** * Writes the elements to XML. * * @param writer the writer * @throws Exception the exception */ @Override protected void writeElementsToXml(EwsServiceXmlWriter writer) throws Exception { writer .writeStartElement(XmlNamespace.Messages, XmlElementNames.ItemIds); for (Item item : this.getItems()) { item.getId().writeToXml(writer, XmlElementNames.ItemId); } writer.writeEndElement(); // ItemIds if (this.savedCopyDestinationFolderId != null) { writer.writeStartElement(XmlNamespace.Messages, XmlElementNames.SavedItemFolderId); this.savedCopyDestinationFolderId.writeToXml(writer); writer.writeEndElement(); } }
} else { this.internalCreateAttachments( this.owner.getId().getUniqueId(), attachments);
/** * Writes the Id encapsulated in the wrapper to XML. * * @param writer the writer * @throws Exception the exception */ @Override protected void writeToXml(EwsServiceXmlWriter writer) throws Exception { this.item.getId().writeToXml(writer); } }
/** * Gets Id of the root item for this item. * * @return the root item id * @throws ServiceLocalException the service local exception */ public ItemId getRootItemId() throws ServiceLocalException { if (this.isAttachment()) { return this.getParentAttachment().getOwner().getRootItemId(); } else { return this.getId(); } }
/** * Create the response object. * * @param parentFolderId the parent folder id * @param messageDisposition the message disposition * @throws Exception the exception */ public void internalCreate(FolderId parentFolderId, MessageDisposition messageDisposition) throws Exception { ((ItemId) this.getPropertyBag().getObjectFromPropertyDefinition( ResponseObjectSchema.ReferenceItemId)) .assign(this.referenceItem.getId()); this.getService().internalCreateResponseObject(this, parentFolderId, messageDisposition); } }
/** * Moves this item to a the specified folder. Calling this method results in * a call to EWS. Move returns null if the move operation is across two * mailboxes or between a mailbox and a public folder. * * @param destinationFolderId the destination folder id * @return The moved copy of this item. * @throws Exception the exception */ public Item move(FolderId destinationFolderId) throws Exception { this.throwIfThisIsNew(); this.throwIfThisIsAttachment(); EwsUtilities.validateParam(destinationFolderId, "destinationFolderId"); return this.getService().moveItem(this.getId(), destinationFolderId); }
/** * Creates a copy of this item in the specified folder. Calling this method * results in a call to EWS. Copy returns null if the copy operation is * across two mailboxes or between a mailbox and a public folder. * * @param destinationFolderId the destination folder id * @return The copy of this item. * @throws Exception the exception */ public Item copy(FolderId destinationFolderId) throws Exception { this.throwIfThisIsNew(); this.throwIfThisIsAttachment(); EwsUtilities.validateParam(destinationFolderId, "destinationFolderId"); return this.getService().copyItem(this.getId(), destinationFolderId); }
/** * Create the response object. * * @param destinationFolderId the destination folder id * @param messageDisposition the message disposition * @return The list of item returned by EWS. * @throws Exception the exception */ protected List<Item> internalCreate(FolderId destinationFolderId, MessageDisposition messageDisposition) throws Exception { ((ItemId) this.getPropertyBag().getObjectFromPropertyDefinition( ResponseObjectSchema.ReferenceItemId)) .assign(this.referenceItem.getId()); return this.getService().internalCreateResponseObject(this, destinationFolderId, messageDisposition); }
/** * Create response object. * * @param parentFolderId The parent folder id. * @param messageDisposition The message disposition. * @return A list of item that were created or modified as a results of * this operation. * @throws Exception the exception */ public List<Item> internalCreate(FolderId parentFolderId, MessageDisposition messageDisposition) throws Exception { ((ItemId) this.getPropertyBag().getObjectFromPropertyDefinition( ResponseObjectSchema.ReferenceItemId)) .assign(this.referenceItem.getId()); return this.getService().internalCreateResponseObject(this, parentFolderId, messageDisposition); }
/** * Writes the elements to XML. * * @param writer the writer * @throws Exception the exception */ @Override protected void writeElementsToXml(EwsServiceXmlWriter writer) throws Exception { writer .writeStartElement(XmlNamespace.Messages, XmlElementNames.ItemIds); for (Item item : this.getItems()) { item.getId().writeToXml(writer, XmlElementNames.ItemId); } writer.writeEndElement(); // ItemIds if (this.savedCopyDestinationFolderId != null) { writer.writeStartElement(XmlNamespace.Messages, XmlElementNames.SavedItemFolderId); this.savedCopyDestinationFolderId.writeToXml(writer); writer.writeEndElement(); } }