Java Code Examples for microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion#ordinal()
The following examples show how to use
microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion#ordinal() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EwsUtilities.java From ews-java-api with MIT License | 5 votes |
/** * Validates service object version against the request version. * * @param serviceObject The service object. * @param requestVersion The request version. * @throws ServiceVersionException Raised if this service object type requires a later version * of Exchange. */ public static void validateServiceObjectVersion( ServiceObject serviceObject, ExchangeVersion requestVersion) throws ServiceVersionException { ExchangeVersion minimumRequiredServerVersion = serviceObject .getMinimumRequiredServerVersion(); if (requestVersion.ordinal() < minimumRequiredServerVersion.ordinal()) { String msg = String.format( "The object type %s is only valid for Exchange Server version %s or later versions.", serviceObject.getClass().getName(), minimumRequiredServerVersion.toString()); throw new ServiceVersionException(msg); } }
Example 2
Source File: EwsUtilities.java From ews-java-api with MIT License | 5 votes |
/** * 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)); } }
Example 3
Source File: EwsUtilities.java From ews-java-api with MIT License | 5 votes |
/** * Validate method version. * * @param service the service * @param minimumServerVersion the minimum server version * @param methodName the method name * @throws ServiceVersionException the service version exception */ public static void validateMethodVersion(ExchangeService service, ExchangeVersion minimumServerVersion, String methodName) throws ServiceVersionException { if (service.getRequestedServerVersion().ordinal() < minimumServerVersion.ordinal()) { throw new ServiceVersionException(String.format( "Method %s is only valid for Exchange Server version %s or later.", methodName, minimumServerVersion)); } }
Example 4
Source File: EwsUtilities.java From ews-java-api with MIT License | 5 votes |
/** * 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)); } }