/** * Handles a change event for the specified property. * * @param complexProperty The property that changes. */ protected void propertyChanged(ComplexProperty complexProperty) { Iterator<Entry<PropertyDefinition, Object>> it = this.properties .entrySet().iterator(); while (it.hasNext()) { Entry<PropertyDefinition, Object> keyValuePair = it.next(); if (keyValuePair.getValue().equals(complexProperty)) { if (!this.deletedProperties.containsKey(keyValuePair.getKey())) { addToChangeList(keyValuePair.getKey(), this.modifiedProperties); this.changed(); } } } }
/** * Clears the bag. */ protected void clear() { this.clearChangeLog(); this.properties.clear(); this.loadedProperties.clear(); this.requestedPropertySet = null; }
/** * Checks if is dirty. * * @return true, if is dirty */ public boolean isDirty() { return this.getPropertyBag().getIsDirty(); }
/** * Gets the start time of the appointment. * * @return the start * @throws ServiceLocalException the service local exception */ public Date getStart() throws ServiceLocalException { return getPropertyBag().getObjectFromPropertyDefinition( AppointmentSchema.Start); }
if (propertyDefinition.getVersion().ordinal() > this.getOwner() .getService().getRequestedServerVersion().ordinal()) { throw new ServiceVersionException(String.format( if (this.getOwner().isNew() && !propertyDefinition .hasFlag(PropertyDefinitionFlags.CanSet, this.getOwner() .getService().getRequestedServerVersion())) { throw new ServiceObjectPropertyException("This property is read-only and can't be set.", propertyDefinition); if (!this.getOwner().isNew()) { if ((this.getOwner() instanceof Item)) { Item ownerItem = (Item) this.getOwner(); if (ownerItem.isAttachment()) { throw new ServiceObjectPropertyException("Item attachments can't be updated.", this.deleteProperty(propertyDefinition); } else { ComplexProperty complexProperty = null; addToChangeList(propertyDefinition, this.modifiedProperties); } else { addToChangeList(propertyDefinition, this.addedProperties); } else { addToChangeList(propertyDefinition, this.modifiedProperties);
/** * Gets the total number of unread messages in this * conversation across all folder in the mailbox. * * @return returnValue * @throws ArgumentException */ public int getGlobalUnreadCount() throws ArgumentException { int returnValue = 0; if (this.getPropertyBag().contains(ConversationSchema.GlobalUnreadCount)) { OutParam<Integer> out = new OutParam<Integer>(); this.getPropertyBag().tryGetPropertyType(Integer.class, ConversationSchema.GlobalUnreadCount, out); returnValue = out.getParam().intValue(); } return returnValue; }
boolean onlySummaryPropertiesRequested) throws Exception { if (clear) { this.clear(); PropertyDefinition propertyDefinition; if (this.getOwner().schema().tryGetPropertyDefinition( reader.getLocalName(), propertyDefinitionOut)) { propertyDefinition = propertyDefinitionOut.getParam(); } while (!reader.isEndElement(XmlNamespace.Types, this.getOwner() .getXmlElementName())); this.clearChangeLog(); } finally { this.loading = false;
/** * Writes the bag's property to XML. * * @param writer The writer to write the property to. * @throws Exception the exception */ public void writeToXml(EwsServiceXmlWriter writer) throws Exception { writer.writeStartElement(XmlNamespace.Types, this.getOwner() .getXmlElementName()); Iterator<PropertyDefinition> it = this.getOwner().getSchema() .iterator(); while (it.hasNext()) { PropertyDefinition propertyDefinition = it.next(); // The following test should not be necessary since the property bag // prevents // property to be set if they don't have the CanSet flag, but it // doesn't hurt... if (propertyDefinition .hasFlag(PropertyDefinitionFlags.CanSet, writer.getService().getRequestedServerVersion())) { if (this.contains(propertyDefinition)) { propertyDefinition.writePropertyValueToXml(writer, this, false /* isUpdateOperation */); } } } writer.writeEndElement(); }
if (this.getPropertyBag().isPropertyUpdated(AppointmentSchema.Start) || this.getPropertyBag().isPropertyUpdated(AppointmentSchema.End) || this.getPropertyBag().isPropertyUpdated(AppointmentSchema.IsAllDayEvent) || this.getPropertyBag().isPropertyUpdated(AppointmentSchema.Recurrence)) { if (!this.getPropertyBag().contains(AppointmentSchema.StartTimeZone)) { throw new ServiceLocalException("StartTimeZone required when setting the Start, End, IsAllDayEvent, " + "or Recurrence property. You must load or assign this property "
/** * Applies the local changes that have been made to this folder. Calling * this method results in a call to EWS. * * @throws Exception the exception */ public void update() throws Exception { if (this.isDirty()) { if (this.getPropertyBag().getIsUpdateCallNecessary()) { this.getService().updateFolder(this); } } }
/** * Implements the OnChange event handler for the item associated with the * attachment. * * @param serviceObject ,The service object that triggered the OnChange event. */ private void itemChanged(ServiceObject serviceObject) { this.item.getPropertyBag().changed(); }
/** * Internal constructor. * * @param service the service * @throws Exception the exception */ protected ServiceObject(ExchangeService service) throws Exception { EwsUtilities.validateParam(service, "service"); EwsUtilities.validateServiceObjectVersion(this, service .getRequestedServerVersion()); this.service = service; this.propertyBag = new PropertyBag(this); }
/** * Validates this instance. * * @throws Exception the exception */ @Override public void validate() throws Exception { super.validate(); // Validate folder permissions try { if (this.getPropertyBag().contains(FolderSchema.Permissions)) { this.getPermissions().validate(); } } catch (ServiceLocalException e) { LOG.error(e); } }
/** * Gets a value indicating whether the appointment is a meeting. * * @return the checks if is meeting * @throws ServiceLocalException the service local exception */ public boolean getIsMeeting() throws ServiceLocalException { return getPropertyBag().getObjectFromPropertyDefinition( AppointmentSchema.IsMeeting) != null; }
if (propertyDefinition.getVersion().ordinal() > this.getOwner() .getService().getRequestedServerVersion().ordinal()) { throw new ServiceVersionException(String.format( if (this.getOwner().isNew() && !propertyDefinition .hasFlag(PropertyDefinitionFlags.CanSet, this.getOwner() .getService().getRequestedServerVersion())) { throw new ServiceObjectPropertyException("This property is read-only and can't be set.", propertyDefinition); if (!this.getOwner().isNew()) { if ((this.getOwner() instanceof Item)) { Item ownerItem = (Item) this.getOwner(); if (ownerItem.isAttachment()) { throw new ServiceObjectPropertyException("Item attachments can't be updated.", this.deleteProperty(propertyDefinition); } else { ComplexProperty complexProperty = null; addToChangeList(propertyDefinition, this.modifiedProperties); } else { addToChangeList(propertyDefinition, this.addedProperties); } else { addToChangeList(propertyDefinition, this.modifiedProperties);
/** * Gets the total number of unread messages in this * conversation in the current folder only. * * @return returnValue * @throws ArgumentException */ public int getUnreadCount() throws ArgumentException { int returnValue = 0; /**This property need not be present hence the * property bag may not contain it. * Check for the presence of this property before accessing it. */ if (this.getPropertyBag().contains(ConversationSchema.UnreadCount)) { OutParam<Integer> out = new OutParam<Integer>(); this.getPropertyBag().tryGetPropertyType(Integer.class, ConversationSchema.UnreadCount, out); returnValue = out.getParam().intValue(); } return returnValue; }
boolean onlySummaryPropertiesRequested) throws Exception { if (clear) { this.clear(); PropertyDefinition propertyDefinition; if (this.getOwner().schema().tryGetPropertyDefinition( reader.getLocalName(), propertyDefinitionOut)) { propertyDefinition = propertyDefinitionOut.getParam(); } while (!reader.isEndElement(XmlNamespace.Types, this.getOwner() .getXmlElementName())); this.clearChangeLog(); } finally { this.loading = false;
if (this.isDirty() && this.getPropertyBag().getIsUpdateCallNecessary()) { returnedItem = this .getService()
/** * Implements the OnChange event handler for the item associated with the * attachment. * * @param serviceObject ,The service object that triggered the OnChange event. */ private void itemChanged(ServiceObject serviceObject) { this.item.getPropertyBag().changed(); }
/** * Internal constructor. * * @param service the service * @throws Exception the exception */ protected ServiceObject(ExchangeService service) throws Exception { EwsUtilities.validateParam(service, "service"); EwsUtilities.validateServiceObjectVersion(this, service .getRequestedServerVersion()); this.service = service; this.propertyBag = new PropertyBag(this); }