/** * Load from xml. * * @param reader the reader * @throws Exception the exception */ public void loadFromXml(EwsServiceXmlReader reader) throws Exception { this.id = reader.readElementValue(XmlNamespace.Messages, XmlElementNames.SubscriptionId); if (this.getUsesWatermark()) { this.watermark = reader.readElementValue(XmlNamespace.Messages, XmlElementNames.Watermark); } }
/** * Reads the element value as unspecified date. * * @return element value * @throws Exception on error */ public Date readElementValueAsUnspecifiedDate() throws Exception { return DateTimeUtils.convertDateStringToDate(readElementValue()); }
/** * Reads the element value as date time. * * @param xmlNamespace the xml namespace * @param localName the local name * @return the date * @throws Exception the exception */ public Date readElementValueAsDateTime(XmlNamespace xmlNamespace, String localName) throws Exception { return DateTimeUtils.convertDateTimeStringToDate(readElementValue(xmlNamespace, localName)); }
/** * Reads the element value as date time. * * @return Element value * @throws Exception the exception */ public Date readElementValueAsDateTime() throws Exception { return DateTimeUtils.convertDateTimeStringToDate(readElementValue()); }
/** * Reads the element value as date time, assuming it is unbiased (e.g. * 2009/01/01T08:00) and scoped to service's time zone. * * @return Date * @throws Exception the exception */ public Date readElementValueAsUnbiasedDateTimeScopedToServiceTimeZone() throws Exception { // Convert the element's value to a DateTime with no adjustment. String date = this.readElementValue(); try { DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); formatter.setTimeZone(TimeZone.getTimeZone("UTC")); return formatter.parse(date); } catch (Exception e) { DateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS"); formatter.setTimeZone(TimeZone.getTimeZone("UTC")); return formatter.parse(date); } }
/** * Tries to read element from XML. * * @param reader The reader. * @return True if element was read. */ @Override public boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception { if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.MinimumSize)) { this.minimumSize = reader.readElementValue(Integer.class); return true; } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.MaximumSize)) { this.maximumSize = reader.readElementValue(Integer.class); return true; } else { return false; } }
/** * Loads from XML. * * @param reader The reader. * @param xmlElementName Name of the XML element. * @throws Exception the exception */ public void loadFromXml(EwsServiceXmlReader reader, String xmlElementName) throws Exception { reader.ensureCurrentNodeIsStartElement(XmlNamespace.Types, xmlElementName); EwsUtilities.parseEnumValueList(DayOfTheWeek.class, this.items, reader.readElementValue(), ' '); }
/** * Tries to read element from XML. * * @param reader the reader * @return True if element was read. * @throws Exception the exception */ public boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception { if (reader.getLocalName() .equalsIgnoreCase(XmlElementNames.EmailAddress)) { this.setAddress(reader.readElementValue()); return true; } else if (reader.getLocalName().equalsIgnoreCase( XmlElementNames.RoutingType)) { this.setRoutingType(reader.readElementValue()); return true; } else { return false; } }
/** * Tries to read element from XML. * * @param reader the reader * @return True if element was read * @throws Exception the exception */ public 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 the reader * @return True if appropriate element was read. * @throws Exception the exception */ @Override public boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception { if (super.tryReadElementFromXml(reader)) { return true; } else { if (reader.getLocalName().equals(XmlElementNames.DayOfMonth)) { this.dayOfMonth = reader.readElementValue(Integer.class); 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 */ public 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; }
/** * Loads from XML. * * @param reader The reader. * @param propertyBag The property bag. * @throws Exception the exception */ @Override public void loadPropertyValueFromXml(EwsServiceXmlReader reader, PropertyBag propertyBag) throws Exception { String value = reader.readElementValue(XmlNamespace.Types, this .getXmlElement()); if (value != null && !value.isEmpty()) { propertyBag.setObjectFromPropertyDefinition(this, this.parse(value)); } }
/** * Loads from XML. * * @param reader the reader * @param propertyBag the property bag * @throws Exception the exception */ public void loadPropertyValueFromXml(EwsServiceXmlReader reader, PropertyBag propertyBag) throws Exception { String value = reader.readElementValue(XmlNamespace.Types, getXmlElement()); propertyBag.setObjectFromPropertyDefinition(this, DateTimeUtils.convertDateTimeStringToDate(value)); }
/** * Writes elements to XML. * * @param reader the reader * @return true, if successful * @throws Exception the exception */ @Override public 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. * * @return true * @throws Exception */ @Override public 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; } }
/** * Loads a notification event from XML. * * @param reader the reader * @param eventElementName the event element name * @param eventType the event type * @throws Exception the exception */ private void loadNotificationEventFromXml(EwsServiceXmlReader reader, String eventElementName, EventType eventType) throws Exception { Date date = reader.readElementValue(Date.class, XmlNamespace.Types, XmlElementNames.TimeStamp); NotificationEvent notificationEvent; reader.read(); if (reader.getLocalName().equals(XmlElementNames.FolderId)) { notificationEvent = new FolderEvent(eventType, date); } else { notificationEvent = new ItemEvent(eventType, date); } notificationEvent.loadFromXml(reader, eventElementName); this.events.add(notificationEvent); }
/** * Reads response elements from XML. * * @throws Exception */ @Override protected void readElementsFromXml(EwsServiceXmlReader reader) throws Exception { super.readElementsFromXml(reader); reader.read(); if (reader.getLocalName().equals(XmlElementNames.Notifications)) { this.results.loadFromXml(reader); } else if (reader.getLocalName().equals(XmlElementNames.ConnectionStatus)) { String connectionStatus = reader.readElementValue(XmlNamespace. Messages, XmlElementNames.ConnectionStatus); if (connectionStatus.equals(ConnectionStatus.Closed.toString())) { this.request.disconnect( HangingRequestDisconnectReason.Clean, null); } } }
/** * Extracts the dictionary object (key or entry value) type from the * specified reader. * * @param reader The reader. * @return Dictionary object type. * @throws Exception the exception */ private UserConfigurationDictionaryObjectType getObjectType( EwsServiceXmlReader reader) throws Exception { EwsUtilities.ewsAssert(reader != null, "UserConfigurationDictionary.loadFromXml", "reader is null"); reader.readStartElement(this.getNamespace(), XmlElementNames.Type); String type = reader.readElementValue(); return UserConfigurationDictionaryObjectType.valueOf(type); }
/** * Loads from XML. * * @param reader the reader * @param xmlElementName the xml element name * @throws Exception the exception */ public void loadFromXml(EwsServiceXmlReader reader, String xmlElementName) throws Exception { reader.ensureCurrentNodeIsStartElement(XmlNamespace.Types, xmlElementName); if (reader.hasAttributes()) { this.setCulture(reader.readAttributeValue("xml:lang")); } this.message = reader.readElementValue(XmlNamespace.Types, XmlElementNames.Message); reader.readEndElement(XmlNamespace.Types, xmlElementName); }
/** * Reads response elements from XML. * * @param reader The reader. */ @Override protected void readElementsFromXml(EwsServiceXmlReader reader) throws Exception { reader.read(); this.ruleCollection.setOutlookRuleBlobExists(reader. readElementValue(Boolean.class, XmlNamespace.Messages, XmlElementNames.OutlookRuleBlobExists)); reader.read(); if (reader.isStartElement(XmlNamespace.NotSpecified, XmlElementNames.InboxRules)) { this.ruleCollection.loadFromXml(reader, XmlNamespace.NotSpecified, XmlElementNames.InboxRules); } }