/** * Convert instance to string. * * @param value The value. * @return String representation of property value. */ @Override /** * Convert instance to string. * @param value The value. * @return String representation of Boolean property. */ protected String toString(Boolean value) { return EwsUtilities.boolToXSBool((Boolean) value); } }
private static String formatDate(Date date, String format) { final DateFormat utcFormatter = createDateFormat(format); return utcFormatter.format(date); }
/** * Gets Item instance. * * @param service the service * @param xmlElementName the xml element name * @return the object instance * @throws Exception the exception */ private Item getObjectInstance(ExchangeService service, String xmlElementName) throws Exception { return EwsUtilities.createEwsObjectFromXmlElementName(Item.class, service, xmlElementName); }
/** * Adds a member to the collection. * * @param member the member * @throws Exception the exception */ public void add(GroupMember member) throws Exception { EwsUtilities.validateParam(member, "member"); EwsUtilities.ewsAssert(member.getKey() == null, "GroupMemberCollection.Add", "member.Key is not null."); EwsUtilities.ewsAssert(!this.contains(member), "GroupMemberCollection.Add", "The member is already in the collection"); this.internalAdd(member); }
/** * Initializes a new instance of ItemIdWrapper. * * @param itemId the item id */ protected ItemIdWrapper(ItemId itemId) { EwsUtilities.ewsAssert(itemId != null, "ItemIdWrapper.ctor", "itemId is null"); this.itemId = itemId; }
protected void readElementsFromXml(EwsServiceXmlReader reader) throws Exception { EwsUtilities.ewsAssert(conversations != null, "FindConversationResponse.ReadElementsFromXml", "conversations is null."); createEwsObjectFromXmlElementName(Conversation.class, reader.getService(), reader.getLocalName());
/** * Writes elements to XML. * * @param writer accepts EwsServiceXmlWriter * @throws Exception throws Exception */ @Override public void writeElementsToXml(EwsServiceXmlWriter writer) throws Exception { if (this.offset != null) { writer.writeElementValue(XmlNamespace.Types, XmlElementNames.Offset, EwsUtilities .getTimeSpanToXSDuration(this.getOffset())); } if (this.recurrence != null) { this.recurrence.writeToXml(writer, XmlElementNames.RelativeYearlyRecurrence); } if (this.absoluteDate != null) { writer.writeElementValue(XmlNamespace.Types, XmlElementNames.AbsoluteDate, EwsUtilities .dateTimeToXSDate(this.getAbsoluteDate())); } if (this.time != null) { writer.writeElementValue(XmlNamespace.Types, XmlElementNames.Time, this.getTime().toXSTime()); } }
if (value != null) { if (value.getClass().isEnum()) { str.setParam(EwsUtilities.serializeEnum(value)); } else if (value.getClass().equals(Boolean.class)) { str.setParam(EwsUtilities.boolToXSBool((Boolean) value)); } else if (value instanceof Date) { str
XmlNamespace.Types, XmlElementNames.ProcessRightAway, EwsUtilities.boolToXSBool(this.getProcessRightAway())); XmlNamespace.Types, XmlElementNames.EnableAlwaysDelete, EwsUtilities.boolToXSBool(this. getEnableAlwaysDelete())); } else if (this.getAction() == ConversationActionType.AlwaysMove) { EwsUtilities.ewsAssert(this.getDestinationFolderId() != null, "ApplyconversationActionRequest", "DestinationFolderId should be set when performing copy action"); writer.writeEndElement(); } else if (this.getAction() == ConversationActionType.Move) { EwsUtilities.ewsAssert(this.getDestinationFolderId() != null, "ApplyconversationActionRequest", "DestinationFolderId should be set when performing move action"); writer.writeEndElement(); } else if (this.getAction() == ConversationActionType.Delete) { EwsUtilities.ewsAssert(this.getDeleteType() != null, "ApplyconversationActionRequest", "DeleteType should be specified when deleting a conversation."); this.getDeleteType()); } else if (this.getAction() == ConversationActionType.SetReadState) { EwsUtilities.ewsAssert(this.getIsRead() != null,
OutParam<Integer> currentHop) throws Exception { String domainName = EwsUtilities.domainFromEmailAddress(emailAddress); default: EwsUtilities .ewsAssert(false, "Autodiscover.GetConfigurationSettings", "An unexpected error has occured. This code path should never be reached."); break;
public String func(final Object o) { return EwsUtilities.dateTimeToXSDateTime((Date) o); } }
/** * Creates the item from xml element name. * * @param itemAttachment the item attachment * @param xmlElementName the xml element name * @return the item * @throws Exception the exception */ public static Item createItemFromXmlElementName( ItemAttachment itemAttachment, String xmlElementName) throws Exception { final ServiceObjectInfo member = EwsUtilities.SERVICE_OBJECT_INFO.getMember(); final Map<String, Class<?>> map = member.getXmlElementNameToServiceObjectClassMap(); final Class<?> itemClass = map.get(xmlElementName); if (itemClass != null) { return createItemFromItemClass(itemAttachment, itemClass, false); } return null; }
public String func() throws FormatException { return EwsUtilities .domainFromEmailAddress(smtpAddresses.get(0)); } });
/** * Tries to read the element at the current position of the reader. * * @param reader the reader * @return True if the element was read, false otherwise. * @throws Exception the exception */ @Override public boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception { boolean result = super.tryReadElementFromXml(reader); if (!result) { this.item = EwsUtilities.createItemFromXmlElementName(this, reader.getLocalName()); if (this.item != null) { try { this.item.loadFromXml(reader, true /* clearPropertyBag */); } catch (Exception e) { LOG.error(e); } } } return result; }
/** * Validates string parameter to be non-empty string (null value allowed). * * @param param The string parameter. * @param paramName Name of the parameter. * @throws ArgumentException * @throws ServiceLocalException */ public static void validateNonBlankStringParamAllowNull(String param, String paramName) throws ArgumentException, ServiceLocalException { if (param != null) { // Non-empty string has at least one character //which is *not* a whitespace character if (param.length() == countMatchingChars(param, new IPredicate<Character>() { @Override public boolean predicate(Character obj) { return Character.isWhitespace(obj); } })) { throw new ArgumentException("The string argument contains only white space characters.", paramName); } } }
/** * Initializes a new instance of FolderIdWrapper. * * @param folderId the folder id */ public FolderIdWrapper(FolderId folderId) { EwsUtilities.ewsAssert(folderId != null, "FolderIdWrapper.ctor", "folderId is null"); this.folderId = folderId; }
throws XMLStreamException, ServiceXmlDeserializationException, Exception { EwsUtilities.ewsAssert(destinationList != null, "FindItemResponse.InternalReadItemsFromXml", "destinationList is null."); Item item = EwsUtilities.createEwsObjectFromXmlElementName( Item.class, reader.getService(), reader .getLocalName());
/** * Writes elements to XML. * * @param writer accepts EwsServiceXmlWriter * @throws Exception throws Exception */ @Override public void writeElementsToXml(EwsServiceXmlWriter writer) throws Exception { if (this.offset != null) { writer.writeElementValue(XmlNamespace.Types, XmlElementNames.Offset, EwsUtilities .getTimeSpanToXSDuration(this.getOffset())); } if (this.recurrence != null) { this.recurrence.writeToXml(writer, XmlElementNames.RelativeYearlyRecurrence); } if (this.absoluteDate != null) { writer.writeElementValue(XmlNamespace.Types, XmlElementNames.AbsoluteDate, EwsUtilities .dateTimeToXSDate(this.getAbsoluteDate())); } if (this.time != null) { writer.writeElementValue(XmlNamespace.Types, XmlElementNames.Time, this.getTime().toXSTime()); } }
if (value != null) { if (value.getClass().isEnum()) { str.setParam(EwsUtilities.serializeEnum(value)); } else if (value.getClass().equals(Boolean.class)) { str.setParam(EwsUtilities.boolToXSBool((Boolean) value)); } else if (value instanceof Date) { str
XmlNamespace.Types, XmlElementNames.ProcessRightAway, EwsUtilities.boolToXSBool(this.getProcessRightAway())); XmlNamespace.Types, XmlElementNames.EnableAlwaysDelete, EwsUtilities.boolToXSBool(this. getEnableAlwaysDelete())); } else if (this.getAction() == ConversationActionType.AlwaysMove) { EwsUtilities.ewsAssert(this.getDestinationFolderId() != null, "ApplyconversationActionRequest", "DestinationFolderId should be set when performing copy action"); writer.writeEndElement(); } else if (this.getAction() == ConversationActionType.Move) { EwsUtilities.ewsAssert(this.getDestinationFolderId() != null, "ApplyconversationActionRequest", "DestinationFolderId should be set when performing move action"); writer.writeEndElement(); } else if (this.getAction() == ConversationActionType.Delete) { EwsUtilities.ewsAssert(this.getDeleteType() != null, "ApplyconversationActionRequest", "DeleteType should be specified when deleting a conversation."); this.getDeleteType()); } else if (this.getAction() == ConversationActionType.SetReadState) { EwsUtilities.ewsAssert(this.getIsRead() != null,