/** * * Tries to read element from XML. * * @param reader the reader * @return True if element was read. * @throws Exception the exception */ @Override protected boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception { boolean result = super.tryReadElementFromXml(reader); if (!result) { if (reader.getLocalName().equals(XmlElementNames.IsContactPhoto)) { this.isContactPhoto = reader.readElementValue(Boolean.class); } else if (reader.getLocalName().equals(XmlElementNames.Content)) { if (this.loadToStream != null) { reader.readBase64ElementValue(this.loadToStream); } else { // If there's a file attachment content handler, use it. // Otherwise // load the content into a byte array. // TODO: Should we mark the attachment to indicate that // content is stored elsewhere? if (reader.getService().getFileAttachmentContentHandler() != null) { OutputStream outputStream = reader.getService().getFileAttachmentContentHandler().getOutputStream(getId()); if (outputStream != null) { reader.readBase64ElementValue(outputStream); } else { this.content = reader.readBase64ElementValue(); } } else { this.content = reader.readBase64ElementValue(); } } result = true; } } return result; }
/** * Writes elements to XML. * * @param reader the reader * @return true, if successful * @throws Exception the exception */ @Override protected boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception { if (PhysicalAddressSchema.getXmlElementNames().contains(reader.getLocalName())) { this.propertyBag.setSimplePropertyBag(reader.getLocalName(), reader.readElementValue()); return true; } else { return false; } }
/** * Tries to read element from XML. * * @param reader the reader * @return Returns true if element was read. * @throws Exception the exception */ protected boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception { DelegateFolderPermission delegateFolderPermission = null; if (this.delegateFolderPermissions.containsKey(reader.getLocalName())) { delegateFolderPermission = this.delegateFolderPermissions.get(reader.getLocalName()); delegateFolderPermission.initialize( reader.readElementValue(DelegateFolderPermissionLevel.class)); } return delegateFolderPermission != null; }
/** * Tries to read element from XML. * * @return true * @throws Exception */ @Override protected boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception { if (reader.getLocalName().equals(XmlElementNames.OperationIndex)) { this.operationIndex = reader.readElementValue(Integer.class); return true; } else if (reader.getLocalName().equals(XmlElementNames.ValidationErrors)) { this.ruleErrors = new RuleErrorCollection(); this.ruleErrors.loadFromXml(reader, reader.getLocalName()); return true; } else { return false; } }
/** * Tries to read element from XML. * * @param reader accepts EwsServiceXmlReader * @return True if element was read. * @throws Exception throws Exception */ @Override protected boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception { if (super.tryReadElementFromXml(reader)) { return true; } else { if (reader.getLocalName().equals(XmlElementNames.DayOfWeek)) { this.dayOfTheWeek = reader.readElementValue(DayOfTheWeek.class); return true; } else if (reader.getLocalName().equals(XmlElementNames.Occurrence)) { this.weekIndex = reader.readElementValue(Integer.class); return true; } else { return false; } } }
/** * Read items from XML. * * @param reader The reader * @param propertySet The property set * @param destinationList The list in which to add the read items. * @throws javax.xml.stream.XMLStreamException the xML stream exception * @throws ServiceXmlDeserializationException the service xml deserialization exception * @throws Exception the exception */ private void internalReadItemsFromXml( EwsServiceXmlReader reader, PropertySet propertySet, List<TItem> destinationList) throws XMLStreamException, ServiceXmlDeserializationException, Exception { EwsUtilities.EwsAssert( destinationList != null, "FindItemResponse.InternalReadItemsFromXml", "destinationList is null."); reader.readStartElement(XmlNamespace.Types, XmlElementNames.Items); if (!reader.isEmptyElement()) { do { reader.read(); if (reader.getNodeType().nodeType == XmlNodeType.START_ELEMENT) { Item item = EwsUtilities.createEwsObjectFromXmlElementName( Item.class, reader.getService(), reader.getLocalName()); if (item == null) { reader.skipCurrentElement(); } else { item.loadFromXml( reader, true, /* clearPropertyBag */ propertySet, true /* summaryPropertiesOnly */); destinationList.add((TItem) item); } } } while (!reader.isEndElement(XmlNamespace.Types, XmlElementNames.Items)); } else { reader.read(); } }
/** * Tries to read element from XML. * * @param reader the reader * @return True if element was read * @throws Exception the exception */ protected boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception { if (super.tryReadElementFromXml(reader)) { return true; } else { if (reader.getLocalName().equals(XmlElementNames.NumberOfOccurrences)) { this.numberOfOccurrences = reader.readElementValue(Integer.class); return true; } else { return false; } } }
/** * * Tries to read element from XML. * * @param reader accepts EwsServiceXmlReader * @return True if element was read * @throws Exception throws Exception */ @Override protected boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception { if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.Offset)) { this.offset = EwsUtilities.getXSDurationToTimeSpan(reader.readElementValue()); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.RelativeYearlyRecurrence)) { this.recurrence = new TimeChangeRecurrence(); this.recurrence.loadFromXml(reader, reader.getLocalName()); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.AbsoluteDate)) { SimpleDateFormat sdfin = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); Date tempDate = sdfin.parse(reader.readElementValue()); this.absoluteDate = tempDate; return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.Time)) { SimpleDateFormat sdfin = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); Date tempDate = sdfin.parse(reader.readElementValue()); this.time = new Time(tempDate); return true; } else { return false; } }
/** * Tries to read element from XML. * * @param reader The reader * @throws Exception * @return True if element was read. */ @Override protected boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception { if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.Categories)) { this.categories.loadFromXml(reader, reader.getLocalName()); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.ContainsBodyStrings)) { this.containsBodyStrings.loadFromXml(reader, reader.getLocalName()); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.ContainsHeaderStrings)) { this.containsHeaderStrings.loadFromXml(reader, reader.getLocalName()); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.ContainsRecipientStrings)) { this.containsRecipientStrings.loadFromXml(reader, reader.getLocalName()); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.ContainsSenderStrings)) { this.containsSenderStrings.loadFromXml(reader, reader.getLocalName()); return true; } else if (reader .getLocalName() .equalsIgnoreCase(XmlElementNames.ContainsSubjectOrBodyStrings)) { this.containsSubjectOrBodyStrings.loadFromXml(reader, reader.getLocalName()); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.ContainsSubjectStrings)) { this.containsSubjectStrings.loadFromXml(reader, reader.getLocalName()); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.FlaggedForAction)) { this.flaggedForAction = reader.readElementValue(FlaggedForAction.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.FromAddresses)) { this.fromAddresses.loadFromXml(reader, reader.getLocalName()); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.FromConnectedAccounts)) { this.fromConnectedAccounts.loadFromXml(reader, reader.getLocalName()); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.HasAttachments)) { this.hasAttachments = reader.readElementValue(Boolean.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.Importance)) { this.importance = reader.readElementValue(Importance.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsApprovalRequest)) { this.isApprovalRequest = reader.readElementValue(Boolean.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsAutomaticForward)) { this.isAutomaticForward = reader.readElementValue(Boolean.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsAutomaticReply)) { this.isAutomaticReply = reader.readElementValue(Boolean.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsEncrypted)) { this.isEncrypted = reader.readElementValue(Boolean.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsMeetingRequest)) { this.isMeetingRequest = reader.readElementValue(Boolean.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsMeetingResponse)) { this.isMeetingResponse = reader.readElementValue(Boolean.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsNDR)) { this.isNonDeliveryReport = reader.readElementValue(Boolean.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsPermissionControlled)) { this.isPermissionControlled = reader.readElementValue(Boolean.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsSigned)) { this.isSigned = reader.readElementValue(Boolean.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsVoicemail)) { this.isVoicemail = reader.readElementValue(Boolean.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsReadReceipt)) { this.isReadReceipt = reader.readElementValue(Boolean.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.ItemClasses)) { this.itemClasses.loadFromXml(reader, reader.getLocalName()); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.MessageClassifications)) { this.messageClassifications.loadFromXml(reader, reader.getLocalName()); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.NotSentToMe)) { this.notSentToMe = reader.readElementValue(Boolean.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.SentCcMe)) { this.sentCcMe = reader.readElementValue(Boolean.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.SentOnlyToMe)) { this.sentOnlyToMe = reader.readElementValue(Boolean.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.SentToAddresses)) { this.sentToAddresses.loadFromXml(reader, reader.getLocalName()); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.SentToMe)) { this.sentToMe = reader.readElementValue(Boolean.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.SentToOrCcMe)) { this.sentToOrCcMe = reader.readElementValue(Boolean.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.Sensitivity)) { this.sensitivity = reader.readElementValue(Sensitivity.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.WithinDateRange)) { this.withinDateRange.loadFromXml(reader, reader.getLocalName()); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.WithinSizeRange)) { this.withinSizeRange.loadFromXml(reader, reader.getLocalName()); return true; } else { return false; } }