/** * Gets st ring representation of requested server version. In order to support E12 RTM servers, * ExchangeService has another flag indicating that we should use "Exchange2007" as the server version * string rather than Exchange2007_SP1. * * @return String representation of requested server version. */ private String getRequestedServiceVersionString() { if (this.service.getRequestedServerVersion() == ExchangeVersion.Exchange2007_SP1 && this.service .getExchange2007CompatibilityMode()) { return "Exchange2007"; } else { return this.service.getRequestedServerVersion().toString(); } }
/** * Validates this view. * * @param request the request * @throws ServiceVersionException the service version exception * @throws ServiceValidationException the service validation exception */ @Override public void internalValidate(ServiceRequestBase request) throws ServiceVersionException, ServiceValidationException { super.internalValidate(request); EwsUtilities.validateEnumVersionValue(this.traversal, request.getService().getRequestedServerVersion()); }
/** * Validates class version against the request version. * * @param service the service * @param minimumServerVersion The minimum server version that supports the method. * @param className Name of the class. * @throws ServiceVersionException */ public static void validateClassVersion( ExchangeService service, ExchangeVersion minimumServerVersion, String className) throws ServiceVersionException { if (service.getRequestedServerVersion().ordinal() < minimumServerVersion.ordinal()) { throw new ServiceVersionException( String.format("Class %s is only valid for Exchange version %s or later.", className, minimumServerVersion)); } }
/** * 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 property version against the request version. * * @param service The Exchange service. * @param minimumServerVersion The minimum server version * @param propertyName The property name * @throws ServiceVersionException The service version exception */ public static void validatePropertyVersion( ExchangeService service, ExchangeVersion minimumServerVersion, String propertyName) throws ServiceVersionException { if (service.getRequestedServerVersion().ordinal() < minimumServerVersion.ordinal()) { throw new ServiceVersionException( String.format("The property %s is valid only for Exchange %s or later versions.", propertyName, minimumServerVersion)); } }
/** * Throw exception if request is not supported in requested server version. * * @throws ServiceVersionException the service version exception */ protected void throwIfNotSupportedByRequestedServerVersion() throws ServiceVersionException { if (this.service.getRequestedServerVersion().ordinal() < this.getMinimumRequiredServerVersion() .ordinal()) { throw new ServiceVersionException(String.format( "The service request %s is only valid for Exchange version %s or later.", this.getXmlElementName(), this.getMinimumRequiredServerVersion())); } }
/** * Asserts the valid. * * @throws Exception the exception */ @Override protected void validate() throws Exception { super.validate(); EwsUtilities.validateParam(this.items, "Items"); if (this.savedCopyDestinationFolderId != null) { this.savedCopyDestinationFolderId.validate(this.getService() .getRequestedServerVersion()); } }
/** * Validates request. * * @throws Exception the exception */ @Override protected void validate() throws Exception { EwsUtilities.validateParam(this.getDestinationFolderId(), "DestinationFolderId"); this.getDestinationFolderId().validate( this.getService().getRequestedServerVersion()); }
/** * Validates the request. * * @throws Exception the exception */ @Override protected void validate() throws Exception { super.validate(); if (this.getParentFolderId() != null) { this.getParentFolderId().validate( this.getService().getRequestedServerVersion()); } }
@Override protected void validate() throws ServiceLocalException, Exception { super.validate(); EwsUtilities.validateParamCollection(this.getItems().iterator(), "Items"); for (int i = 0; i < this.getItems().size(); i++) { if ((this.getItems().get(i) == null) || this.getItems().get(i).isNew()) { throw new ArgumentException(String.format("Items[%d] is either null or does not have an Id.", i)); } } if (this.savedItemsDestinationFolder != null) { this.savedItemsDestinationFolder.validate(this.getService() .getRequestedServerVersion()); } // Validate each item. for (Item item : this.getItems()) { item.validate(); } }
/** * Validates request. * * @throws Exception on error */ @Override protected void validate() throws Exception { super.validate(); EwsUtilities.validateParam(this.getFolderIds(), "FolderIds"); this.getFolderIds().validate(this.getService(). getRequestedServerVersion()); }
/** * Validate request. * * @throws Exception the exception */ @Override protected void validate() throws Exception { super.validate(); EwsUtilities.validateParam(this.name, "name"); EwsUtilities.validateParam(this.parentFolderId, "parentFolderId"); this.getParentFolderId().validate( this.getService().getRequestedServerVersion()); }
/** * Validate request. * * @throws Exception the exception */ @Override protected void validate() throws Exception { super.validate(); EwsUtilities.validateParam(this.getFolderIds(), "FolderIds"); this.getFolderIds().validate( this.getService().getRequestedServerVersion()); }
/** * Validates request. * * @throws Exception the exception */ @Override protected void validate() throws Exception { super.validate(); EwsUtilities.validateParamCollection(this.getFolderIds().iterator(), "FolderIds"); this.getFolderIds().validate( this.getService().getRequestedServerVersion()); }
/** * Validate request. * * @throws Exception the exception */ protected void validate() throws Exception { super.validate(); EwsUtilities.validateParamCollection(this.getFolderIds().iterator(), "FolderIds"); this.getFolderIds().validate( this.getService().getRequestedServerVersion()); }
/** * Validate request. * * @throws ServiceLocalException the service local exception * @throws Exception the exception */ @Override protected void validate() throws ServiceLocalException, Exception { super.validate(); EwsUtilities.validateParam(this.name, "name"); EwsUtilities.validateParam(this.parentFolderId, "parentFolderId"); this.getParentFolderId().validate( this.getService().getRequestedServerVersion()); }
/** * Initializes a new instance of the class. * * @throws Exception the exception */ @Override protected void validate() throws Exception { super.validate(); EwsUtilities.validateParamCollection(this.getDelegateUsers().iterator(), "DelegateUsers"); for (DelegateUser delegateUser : this.getDelegateUsers()) { delegateUser.validateUpdateDelegate(); } if (this.meetingRequestsDeliveryScope != null) { EwsUtilities.validateEnumVersionValue(this. getMeetingRequestsDeliveryScope(), this.getService().getRequestedServerVersion()); } }
/** * Validates this instance. * * @throws ServiceVersionException the service version exception * @throws Exception the exception */ @Override public void validate() throws ServiceVersionException, Exception { super.validate(); Object fileAsMapping; OutParam<Object> outParam = new OutParam<Object>(); if (this.tryGetProperty(ContactSchema.FileAsMapping, outParam)) { fileAsMapping = outParam.getParam(); // FileAsMapping is extended by 5 new values in 2010 mode. Validate // that they are used according the version. EwsUtilities.validateEnumVersionValue( (FileAsMapping) fileAsMapping, this.getService() .getRequestedServerVersion()); } }
/** * Gets the property instance. * * @param propertyBag The property bag. * @param complexProperty The property instance. * @return True if the instance is newly created. */ private boolean getPropertyInstance( final PropertyBag propertyBag, final OutParam<ComplexProperty> complexProperty ) { final ServiceObject owner = propertyBag.getOwner(); final ExchangeService service = owner.getService(); if (!propertyBag.tryGetValue(this, complexProperty) || !hasFlag(PropertyDefinitionFlags.ReuseInstance, service.getRequestedServerVersion())) { complexProperty.setParam(createPropertyInstance(owner)); return true; } return false; }
/** * Validates request. * * @throws Exception the exception */ @Override protected void validate() throws Exception { super.validate(); EwsUtilities.validateParam(this.getPropertySet(), "PropertySet"); if (this.getSyncFolderId() != null) { this.getSyncFolderId().validate( this.getService().getRequestedServerVersion()); } this.getPropertySet() .validateForRequest(this, false /* summaryPropertiesOnly */); }