From c1df42fd29b77937c96113fedc0093e71857b31e Mon Sep 17 00:00:00 2001 From: Marcos Torres Date: Mon, 17 Nov 2014 18:30:06 -0300 Subject: [PATCH 1/9] merging core branch into dev. big refactor, merging packages into odata-engine-core now --- sdk/directory-services/build.gradle | 3 +- ...AppRoleAssignmentCollectionOperations.java | 26 +- .../odata/AppRoleAssignmentFetcher.java | 37 +- .../odata/AppRoleAssignmentOperations.java | 38 +- .../ApplicationCollectionOperations.java | 26 +- .../odata/ApplicationFetcher.java | 50 ++- .../odata/ApplicationOperations.java | 71 ++-- .../odata/BaseODataContainer.java | 34 -- .../directoryservices/odata/Constants.java | 23 -- .../odata/ContactCollectionOperations.java | 26 +- .../odata/ContactFetcher.java | 37 +- .../odata/ContactOperations.java | 38 +- .../odata/DeviceCollectionOperations.java | 26 +- ...viceConfigurationCollectionOperations.java | 26 +- .../odata/DeviceConfigurationFetcher.java | 37 +- .../odata/DeviceConfigurationOperations.java | 38 +- .../odata/DeviceFetcher.java | 63 ++- .../odata/DeviceOperations.java | 38 +- .../odata/DirectoryClient.java | 77 ++-- ...rectoryLinkChangeCollectionOperations.java | 26 +- .../odata/DirectoryLinkChangeFetcher.java | 37 +- .../odata/DirectoryLinkChangeOperations.java | 38 +- .../DirectoryObjectCollectionOperations.java | 26 +- .../odata/DirectoryObjectFetcher.java | 216 +++++++--- .../odata/DirectoryObjectOperations.java | 137 ++++--- .../DirectoryRoleCollectionOperations.java | 26 +- .../odata/DirectoryRoleFetcher.java | 37 +- .../odata/DirectoryRoleOperations.java | 38 +- ...ctoryRoleTemplateCollectionOperations.java | 26 +- .../odata/DirectoryRoleTemplateFetcher.java | 37 +- .../DirectoryRoleTemplateOperations.java | 38 +- ...ExtensionPropertyCollectionOperations.java | 26 +- .../odata/ExtensionPropertyFetcher.java | 37 +- .../odata/ExtensionPropertyOperations.java | 38 +- .../odata/GroupCollectionOperations.java | 26 +- .../directoryservices/odata/GroupFetcher.java | 50 ++- .../odata/GroupOperations.java | 38 +- ...h2PermissionGrantCollectionOperations.java | 26 +- .../odata/OAuth2PermissionGrantFetcher.java | 37 +- .../OAuth2PermissionGrantOperations.java | 38 +- .../odata/ODataCollectionFetcher.java | 202 ---------- .../odata/ODataEntityFetcher.java | 114 ------ .../odata/ODataExecutable.java | 82 ---- .../odata/ODataMediaEntityFetcher.java | 52 --- .../odata/ODataOperations.java | 41 -- .../directoryservices/odata/Readable.java | 16 - .../ServicePrincipalCollectionOperations.java | 26 +- .../odata/ServicePrincipalFetcher.java | 76 +++- .../odata/ServicePrincipalOperations.java | 38 +- .../SubscribedSkuCollectionOperations.java | 26 +- .../odata/SubscribedSkuFetcher.java | 37 +- .../odata/SubscribedSkuOperations.java | 38 +- .../TenantDetailCollectionOperations.java | 26 +- .../odata/TenantDetailFetcher.java | 37 +- .../odata/TenantDetailOperations.java | 38 +- .../odata/UserCollectionOperations.java | 26 +- .../directoryservices/odata/UserFetcher.java | 89 ++++- .../odata/UserOperations.java | 71 ++-- sdk/discovery-services/build.gradle | 3 +- .../odata/BaseODataContainer.java | 34 -- .../discoveryservices/odata/Constants.java | 23 -- .../odata/DiscoveryClient.java | 37 +- .../odata/ODataCollectionFetcher.java | 202 ---------- .../odata/ODataEntityFetcher.java | 114 ------ .../odata/ODataExecutable.java | 82 ---- .../odata/ODataMediaEntityFetcher.java | 52 --- .../odata/ODataOperations.java | 41 -- .../discoveryservices/odata/Readable.java | 16 - .../ServiceInfoCollectionOperations.java | 26 +- .../odata/ServiceInfoFetcher.java | 37 +- .../odata/ServiceInfoOperations.java | 38 +- sdk/file-services/build.gradle | 3 +- .../odata/BaseODataContainer.java | 39 -- .../fileservices/odata/Constants.java | 23 -- .../odata/DriveCollectionOperations.java | 26 +- .../fileservices/odata/DriveFetcher.java | 37 +- .../fileservices/odata/DriveOperations.java | 38 +- .../odata/FileCollectionOperations.java | 26 +- .../fileservices/odata/FileFetcher.java | 37 +- .../fileservices/odata/FileOperations.java | 69 ++-- .../odata/FolderCollectionOperations.java | 26 +- .../fileservices/odata/FolderFetcher.java | 50 ++- .../fileservices/odata/FolderOperations.java | 69 ++-- .../odata/ItemCollectionOperations.java | 57 +-- .../fileservices/odata/ItemFetcher.java | 49 ++- .../fileservices/odata/ItemOperations.java | 38 +- .../odata/ODataCollectionFetcher.java | 207 ---------- .../odata/ODataEntityFetcher.java | 116 ------ .../fileservices/odata/ODataExecutable.java | 82 ---- .../odata/ODataMediaEntityFetcher.java | 52 --- .../fileservices/odata/ODataOperations.java | 47 --- .../odata/SharePointClient.java | 38 +- sdk/java-libraries.gradle | 2 +- sdk/odata-engine-android-impl/build.gradle | 3 +- .../odata/impl/DefaultDependencyResolver.java | 7 +- .../impl/http/AndroidNetworkRunnable.java | 3 +- .../.gitignore | 0 .../build.gradle | 5 +- .../services/odata/BaseODataContainer.java} | 377 +++++++++--------- .../services/odata/CalendarSerializer.java | 0 .../microsoft/services/odata/Constants.java | 16 +- .../com/microsoft/services/odata/Helpers.java | 3 +- .../odata/ODataCollectionFetcher.java | 288 +++++++++++++ .../services/odata/ODataEntityFetcher.java | 117 ++++++ .../services/odata/ODataException.java | 22 + .../services/odata/ODataExecutable.java | 96 +++++ .../services/odata/ODataFetcher.java | 108 +++++ .../odata/ODataMediaEntityFetcher.java | 81 ++++ .../services/odata/ODataOperations.java | 69 ++++ .../services/odata/ODataResponseImpl.java | 25 ++ .../microsoft/services}/odata/Readable.java | 2 +- .../odata/impl/ByteArrayTypeAdapterBase.java | 0 .../odata/impl/CalendarTypeAdapter.java | 4 - .../odata/impl/GsonSerializerBase.java | 0 .../services/odata/impl/LoggerBase.java | 0 .../services/odata/impl}/ODataURLImpl.java | 2 +- .../odata/impl/http/BaseHttpTransport.java | 0 .../impl/http/CredentialsFactoryImpl.java | 0 .../odata/impl/http/EmptyResponse.java | 0 .../odata/impl/http/NetworkRunnable.java | 1 + .../odata/impl/http/NetworkThread.java | 0 .../services/odata/impl/http/RequestImpl.java | 11 +- .../odata/impl/http/ResponseImpl.java | 0 .../odata/interfaces/Base64Encoder.java | 0 .../odata/interfaces/Credentials.java | 0 .../odata/interfaces/CredentialsFactory.java | 0 .../odata/interfaces/DependencyResolver.java | 7 + .../odata/interfaces/HttpTransport.java | 0 .../services/odata/interfaces/HttpVerb.java | 0 .../odata/interfaces/JsonSerializer.java | 0 .../services/odata/interfaces/LogLevel.java | 0 .../services/odata/interfaces/Logger.java | 0 .../odata/interfaces/ODataResponse.java | 21 + .../services/odata/interfaces/ODataURL.java | 0 .../services/odata/interfaces/Request.java | 4 +- .../services/odata/interfaces/Response.java | 2 +- .../odata/EntityCollectionFetcherHelper.java | 44 -- .../services/odata/EntityFetcherHelper.java | 138 ------- sdk/odata-engine-interfaces/build.gradle | 7 - sdk/odata-engine-java-desktop-impl/.gitignore | 1 - sdk/odata-engine-java-impl/.gitignore | 1 - sdk/odata-engine-java-impl/build.gradle | 10 - .../.gitignore | 0 .../build.gradle | 2 +- .../odata/impl/desktop/Base64EncoderImpl.java | 0 .../desktop/ByteArrayTypeAdapterImpl.java | 0 .../desktop/DesktopDependencyResolver.java | 10 +- .../odata/impl/desktop/GsonSerializer.java | 0 .../odata/impl/desktop/LoggerImpl.java | 0 .../desktop/http/DesktopHttpTransport.java | 0 .../desktop/http/DesktopNetworkRunnable.java | 2 +- sdk/outlook-services/build.gradle | 3 +- .../odata/AttachmentCollectionOperations.java | 26 +- .../odata/AttachmentFetcher.java | 44 +- .../odata/AttachmentOperations.java | 38 +- .../odata/BaseODataContainer.java | 37 -- .../odata/CalendarCollectionOperations.java | 26 +- .../odata/CalendarFetcher.java | 30 +- .../CalendarGroupCollectionOperations.java | 26 +- .../odata/CalendarGroupFetcher.java | 30 +- .../odata/CalendarGroupOperations.java | 38 +- .../odata/CalendarOperations.java | 38 +- .../outlookservices/odata/Constants.java | 23 -- .../odata/ContactCollectionOperations.java | 26 +- .../outlookservices/odata/ContactFetcher.java | 30 +- .../ContactFolderCollectionOperations.java | 26 +- .../odata/ContactFolderFetcher.java | 30 +- .../odata/ContactFolderOperations.java | 38 +- .../odata/ContactOperations.java | 38 +- .../odata/EntityCollectionOperations.java | 26 +- .../outlookservices/odata/EntityFetcher.java | 79 ++-- .../odata/EntityOperations.java | 38 +- .../odata/EventCollectionOperations.java | 26 +- .../outlookservices/odata/EventFetcher.java | 32 +- .../odata/EventOperations.java | 131 +++--- .../FileAttachmentCollectionOperations.java | 26 +- .../odata/FileAttachmentFetcher.java | 30 +- .../odata/FileAttachmentOperations.java | 38 +- .../odata/FolderCollectionOperations.java | 26 +- .../outlookservices/odata/FolderFetcher.java | 30 +- .../odata/FolderOperations.java | 100 ++--- .../ItemAttachmentCollectionOperations.java | 26 +- .../odata/ItemAttachmentFetcher.java | 32 +- .../odata/ItemAttachmentOperations.java | 38 +- .../odata/ItemCollectionOperations.java | 26 +- .../outlookservices/odata/ItemFetcher.java | 51 ++- .../outlookservices/odata/ItemOperations.java | 38 +- .../odata/MessageCollectionOperations.java | 26 +- .../outlookservices/odata/MessageFetcher.java | 30 +- .../odata/MessageOperations.java | 325 +++++++-------- .../odata/ODataCollectionFetcher.java | 207 ---------- .../odata/ODataEntityFetcher.java | 116 ------ .../odata/ODataExecutable.java | 82 ---- .../odata/ODataMediaEntityFetcher.java | 52 --- .../odata/ODataOperations.java | 44 -- .../outlookservices/odata/OutlookClient.java | 40 +- .../outlookservices/odata/Readable.java | 16 - .../odata/UserCollectionOperations.java | 26 +- .../outlookservices/odata/UserFetcher.java | 34 +- .../outlookservices/odata/UserOperations.java | 69 ++-- sdk/settings.gradle | 14 +- tests/e2e-test-app/app/build.gradle | 6 +- .../test/integration/TestPlatformContext.java | 26 +- .../android/AndroidTestPlatformContext.java | 16 +- .../integration/android/MainActivity.java | 90 ++--- .../test/integration/tests/AllTests.java | 31 +- .../integration/tests/DirectoryTests.java | 5 + .../integration/tests/DiscoveryTests.java | 16 +- .../test/integration/tests/ExchangeTests.java | 117 +++--- .../test/integration/tests/FilesTests.java | 27 +- .../test/integration/tests/ListsTests.java | 2 + .../src/main/res/values/general_settings.xml | 2 +- tests/e2e-test-app/settings.gradle | 20 +- 213 files changed, 4595 insertions(+), 4256 deletions(-) delete mode 100755 sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/BaseODataContainer.java delete mode 100755 sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/Constants.java delete mode 100755 sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ODataCollectionFetcher.java delete mode 100755 sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ODataEntityFetcher.java delete mode 100755 sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ODataExecutable.java delete mode 100755 sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ODataMediaEntityFetcher.java delete mode 100755 sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ODataOperations.java delete mode 100755 sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/Readable.java delete mode 100755 sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/BaseODataContainer.java delete mode 100755 sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/Constants.java delete mode 100755 sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataCollectionFetcher.java delete mode 100755 sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataEntityFetcher.java delete mode 100755 sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataExecutable.java delete mode 100755 sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataMediaEntityFetcher.java delete mode 100755 sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataOperations.java delete mode 100755 sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/Readable.java delete mode 100755 sdk/file-services/src/main/java/com/microsoft/fileservices/odata/BaseODataContainer.java delete mode 100755 sdk/file-services/src/main/java/com/microsoft/fileservices/odata/Constants.java delete mode 100755 sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataCollectionFetcher.java delete mode 100755 sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataEntityFetcher.java delete mode 100755 sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataExecutable.java delete mode 100755 sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataMediaEntityFetcher.java delete mode 100755 sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataOperations.java rename sdk/{odata-engine-helpers => odata-engine-core}/.gitignore (100%) rename sdk/{odata-engine-helpers => odata-engine-core}/build.gradle (66%) rename sdk/{odata-engine-helpers/src/main/java/com/microsoft/services/odata/BaseODataContainerHelper.java => odata-engine-core/src/main/java/com/microsoft/services/odata/BaseODataContainer.java} (71%) mode change 100644 => 100755 rename sdk/{odata-engine-helpers => odata-engine-core}/src/main/java/com/microsoft/services/odata/CalendarSerializer.java (100%) rename sdk/{odata-engine-helpers => odata-engine-core}/src/main/java/com/microsoft/services/odata/Constants.java (88%) rename sdk/{odata-engine-helpers => odata-engine-core}/src/main/java/com/microsoft/services/odata/Helpers.java (98%) create mode 100755 sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataCollectionFetcher.java create mode 100755 sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataEntityFetcher.java create mode 100644 sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataException.java create mode 100755 sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataExecutable.java create mode 100644 sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataFetcher.java create mode 100755 sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataMediaEntityFetcher.java create mode 100755 sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataOperations.java create mode 100644 sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataResponseImpl.java rename sdk/{file-services/src/main/java/com/microsoft/fileservices => odata-engine-core/src/main/java/com/microsoft/services}/odata/Readable.java (89%) rename sdk/{odata-engine-java-impl => odata-engine-core}/src/main/java/com/microsoft/services/odata/impl/ByteArrayTypeAdapterBase.java (100%) rename sdk/{odata-engine-java-impl => odata-engine-core}/src/main/java/com/microsoft/services/odata/impl/CalendarTypeAdapter.java (99%) rename sdk/{odata-engine-java-impl => odata-engine-core}/src/main/java/com/microsoft/services/odata/impl/GsonSerializerBase.java (100%) rename sdk/{odata-engine-java-impl => odata-engine-core}/src/main/java/com/microsoft/services/odata/impl/LoggerBase.java (100%) rename sdk/{odata-engine-helpers/src/main/java/com/microsoft/services/odata => odata-engine-core/src/main/java/com/microsoft/services/odata/impl}/ODataURLImpl.java (98%) rename sdk/{odata-engine-java-impl => odata-engine-core}/src/main/java/com/microsoft/services/odata/impl/http/BaseHttpTransport.java (100%) rename sdk/{odata-engine-java-impl => odata-engine-core}/src/main/java/com/microsoft/services/odata/impl/http/CredentialsFactoryImpl.java (100%) rename sdk/{odata-engine-java-impl => odata-engine-core}/src/main/java/com/microsoft/services/odata/impl/http/EmptyResponse.java (100%) rename sdk/{odata-engine-java-impl => odata-engine-core}/src/main/java/com/microsoft/services/odata/impl/http/NetworkRunnable.java (96%) rename sdk/{odata-engine-java-impl => odata-engine-core}/src/main/java/com/microsoft/services/odata/impl/http/NetworkThread.java (100%) rename sdk/{odata-engine-java-impl => odata-engine-core}/src/main/java/com/microsoft/services/odata/impl/http/RequestImpl.java (84%) rename sdk/{odata-engine-java-impl => odata-engine-core}/src/main/java/com/microsoft/services/odata/impl/http/ResponseImpl.java (100%) rename sdk/{odata-engine-interfaces => odata-engine-core}/src/main/java/com/microsoft/services/odata/interfaces/Base64Encoder.java (100%) rename sdk/{odata-engine-interfaces => odata-engine-core}/src/main/java/com/microsoft/services/odata/interfaces/Credentials.java (100%) rename sdk/{odata-engine-interfaces => odata-engine-core}/src/main/java/com/microsoft/services/odata/interfaces/CredentialsFactory.java (100%) rename sdk/{odata-engine-interfaces => odata-engine-core}/src/main/java/com/microsoft/services/odata/interfaces/DependencyResolver.java (90%) rename sdk/{odata-engine-interfaces => odata-engine-core}/src/main/java/com/microsoft/services/odata/interfaces/HttpTransport.java (100%) rename sdk/{odata-engine-interfaces => odata-engine-core}/src/main/java/com/microsoft/services/odata/interfaces/HttpVerb.java (100%) rename sdk/{odata-engine-interfaces => odata-engine-core}/src/main/java/com/microsoft/services/odata/interfaces/JsonSerializer.java (100%) rename sdk/{odata-engine-interfaces => odata-engine-core}/src/main/java/com/microsoft/services/odata/interfaces/LogLevel.java (100%) rename sdk/{odata-engine-interfaces => odata-engine-core}/src/main/java/com/microsoft/services/odata/interfaces/Logger.java (100%) create mode 100644 sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/ODataResponse.java rename sdk/{odata-engine-interfaces => odata-engine-core}/src/main/java/com/microsoft/services/odata/interfaces/ODataURL.java (100%) rename sdk/{odata-engine-interfaces => odata-engine-core}/src/main/java/com/microsoft/services/odata/interfaces/Request.java (94%) rename sdk/{odata-engine-interfaces => odata-engine-core}/src/main/java/com/microsoft/services/odata/interfaces/Response.java (93%) delete mode 100644 sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/EntityCollectionFetcherHelper.java delete mode 100644 sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/EntityFetcherHelper.java delete mode 100644 sdk/odata-engine-interfaces/build.gradle delete mode 100644 sdk/odata-engine-java-desktop-impl/.gitignore delete mode 100644 sdk/odata-engine-java-impl/.gitignore delete mode 100644 sdk/odata-engine-java-impl/build.gradle rename sdk/{odata-engine-interfaces => odata-engine-jvm-impl}/.gitignore (100%) rename sdk/{odata-engine-java-desktop-impl => odata-engine-jvm-impl}/build.gradle (82%) rename sdk/{odata-engine-java-desktop-impl => odata-engine-jvm-impl}/src/main/java/com/microsoft/services/odata/impl/desktop/Base64EncoderImpl.java (100%) rename sdk/{odata-engine-java-desktop-impl => odata-engine-jvm-impl}/src/main/java/com/microsoft/services/odata/impl/desktop/ByteArrayTypeAdapterImpl.java (100%) rename sdk/{odata-engine-java-desktop-impl => odata-engine-jvm-impl}/src/main/java/com/microsoft/services/odata/impl/desktop/DesktopDependencyResolver.java (87%) rename sdk/{odata-engine-java-desktop-impl => odata-engine-jvm-impl}/src/main/java/com/microsoft/services/odata/impl/desktop/GsonSerializer.java (100%) rename sdk/{odata-engine-java-desktop-impl => odata-engine-jvm-impl}/src/main/java/com/microsoft/services/odata/impl/desktop/LoggerImpl.java (100%) rename sdk/{odata-engine-java-desktop-impl => odata-engine-jvm-impl}/src/main/java/com/microsoft/services/odata/impl/desktop/http/DesktopHttpTransport.java (100%) rename sdk/{odata-engine-java-desktop-impl => odata-engine-jvm-impl}/src/main/java/com/microsoft/services/odata/impl/desktop/http/DesktopNetworkRunnable.java (99%) delete mode 100755 sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/BaseODataContainer.java delete mode 100755 sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/Constants.java delete mode 100755 sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataCollectionFetcher.java delete mode 100755 sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataEntityFetcher.java delete mode 100755 sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataExecutable.java delete mode 100755 sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataMediaEntityFetcher.java delete mode 100755 sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataOperations.java delete mode 100755 sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/Readable.java diff --git a/sdk/directory-services/build.gradle b/sdk/directory-services/build.gradle index 8f1a7424..7e86452e 100644 --- a/sdk/directory-services/build.gradle +++ b/sdk/directory-services/build.gradle @@ -2,8 +2,7 @@ apply plugin: 'java' dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile project(':odata-engine-interfaces') - compile project(':odata-engine-helpers') + compile project(':odata-engine-core') } apply from :'../java-libraries.gradle' diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/AppRoleAssignmentCollectionOperations.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/AppRoleAssignmentCollectionOperations.java index 48994f14..c3160d7d 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/AppRoleAssignmentCollectionOperations.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/AppRoleAssignmentCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,10 +34,22 @@ public AppRoleAssignmentCollectionOperations(String urlComponent, ODataExecutabl * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public AppRoleAssignmentCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } + public AppRoleAssignmentCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public AppRoleAssignmentCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } } diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/AppRoleAssignmentFetcher.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/AppRoleAssignmentFetcher.java index 1bf71ae8..7f5c0ab0 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/AppRoleAssignmentFetcher.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/AppRoleAssignmentFetcher.java @@ -6,14 +6,17 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; -import com.microsoft.directoryservices.*; +import com.microsoft.directoryservices.*; /** * The type AppRoleAssignmentFetcher. */ -public class AppRoleAssignmentFetcher extends ODataEntityFetcher implements Readable { +public class AppRoleAssignmentFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new AppRoleAssignmentFetcher. @@ -21,8 +24,32 @@ public class AppRoleAssignmentFetcher extends ODataEntityFetcher implements Readable { +public class ApplicationFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new ApplicationFetcher. @@ -21,16 +24,49 @@ public class ApplicationFetcher extends ODataEntityFetcher getextensionProperties() { - return new ODataCollectionFetcher("extensionProperties", this, ExtensionProperty.class,ExtensionPropertyCollectionOperations.class); + public ODataCollectionFetcher getextensionProperties() { + return new ODataCollectionFetcher("extensionProperties", this, ExtensionProperty.class,ExtensionPropertyCollectionOperations.class); + } + + /** + * Gets extension property. + * + * @return the extension property + */ + public ExtensionPropertyFetcher getextensionProperty(String id){ + return new ODataCollectionFetcher("extensionProperties", this, ExtensionProperty.class,ExtensionPropertyCollectionOperations.class).getById(id); } } \ No newline at end of file diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ApplicationOperations.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ApplicationOperations.java index 9297ec33..43292bc7 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ApplicationOperations.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ApplicationOperations.java @@ -6,12 +6,11 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; /** @@ -25,42 +24,54 @@ public class ApplicationOperations extends DirectoryObjectOperations { * @param urlComponent the url component * @param parent the parent */ - public ApplicationOperations(String urlComponent, ODataExecutable parent) { + public ApplicationOperations(String urlComponent, ODataExecutable parent) { super(urlComponent, parent); } - /** - * Add parameter. - * - * @param name the name - * @param value the value - * @return the application operations. - */ - public ApplicationOperations addParameter(String name, Object value) { - addCustomParameter(name, value); + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the operations + */ + public ApplicationOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the operations + */ + public ApplicationOperations addHeader(String name, String value) { + addCustomHeader(name, value); return this; - } - + } + + /** * restore listenable future. * @param identifierUris the identifierUris - * @return the listenable future - */ - public ListenableFuture restore(java.util.List identifierUris) { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("identifierUris", identifierUris); - - ODataURL url = getResolver().createODataURL(); - - String parameters = getFunctionParameters(map); - url.appendPathComponent("restore(" + parameters + ")"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.GET); - - addEntityResultCallback(result, future, getResolver(), Application.class); + * @return the listenable future + */ + public ListenableFuture restore(java.util.List identifierUris) { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + map.put("identifierUris", identifierUris); - return result; + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + String parameters = getFunctionParameters(map); +request.getUrl().appendPathComponent("restore(" + parameters + ")"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, Application.class); + + return result; } } \ No newline at end of file diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/BaseODataContainer.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/BaseODataContainer.java deleted file mode 100755 index 04e65bdc..00000000 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/BaseODataContainer.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.directoryservices.odata; - -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.services.odata.BaseODataContainerHelper; -import com.microsoft.services.odata.interfaces.*; - -/** - * The type BaseODataContainer. -*/ -public abstract class BaseODataContainer extends ODataExecutable { - - private String url; - private DependencyResolver resolver; - - public BaseODataContainer(String url, DependencyResolver resolver) { - this.url = url; - this.resolver = resolver; - } - - @Override - ListenableFuture oDataExecute(ODataURL path, byte[] content, HttpVerb verb) { - return BaseODataContainerHelper.oDataExecute(path, content, verb, url, getCustomHeaders(), getResolver(), this.getClass().getCanonicalName()); - } - - @Override - DependencyResolver getResolver() { - return resolver; - } -} \ No newline at end of file diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/Constants.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/Constants.java deleted file mode 100755 index d4f64684..00000000 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/Constants.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.directoryservices.odata; - -import java.nio.charset.Charset; - -/** - * Constants used through the framework - */ -public class Constants { - /** - * UTF-8 Encoding name - */ - public static final String UTF8_NAME = "UTF-8"; - - /** - * UTF-8 Charset instance - */ - public static final Charset UTF8 = Charset.forName(UTF8_NAME); -} diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ContactCollectionOperations.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ContactCollectionOperations.java index 55c49478..c732506b 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ContactCollectionOperations.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ContactCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,10 +34,22 @@ public ContactCollectionOperations(String urlComponent, ODataExecutable parent) * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public ContactCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } + public ContactCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public ContactCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } } diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ContactFetcher.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ContactFetcher.java index 63c69456..64690923 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ContactFetcher.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ContactFetcher.java @@ -6,14 +6,17 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; -import com.microsoft.directoryservices.*; +import com.microsoft.directoryservices.*; /** * The type ContactFetcher. */ -public class ContactFetcher extends ODataEntityFetcher implements Readable { +public class ContactFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new ContactFetcher. @@ -21,8 +24,32 @@ public class ContactFetcher extends ODataEntityFetcher implements Readable { +public class DeviceConfigurationFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new DeviceConfigurationFetcher. @@ -21,8 +24,32 @@ public class DeviceConfigurationFetcher extends ODataEntityFetcher implements Readable { +public class DeviceFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new DeviceFetcher. @@ -21,24 +24,66 @@ public class DeviceFetcher extends ODataEntityFetcher i * @param urlComponent the url component * @param parent the parent */ - public DeviceFetcher(String urlComponent, ODataExecutable parent) { - super(urlComponent, parent, Device.class,DeviceOperations.class); + public DeviceFetcher(String urlComponent, ODataExecutable parent) { + super(urlComponent, parent, Device.class, DeviceOperations.class); } - /** + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public DeviceFetcher addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public DeviceFetcher addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } + + /** * Gets registered owners. * * @return the registered owners */ - public ODataCollectionFetcher getregisteredOwners() { - return new ODataCollectionFetcher("registeredOwners", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + public ODataCollectionFetcher getregisteredOwners() { + return new ODataCollectionFetcher("registeredOwners", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + } + + /** + * Gets registered owner. + * + * @return the registered owner + */ + public DirectoryObjectFetcher getregisteredOwner(String id){ + return new ODataCollectionFetcher("registeredOwners", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class).getById(id); } /** * Gets registered users. * * @return the registered users */ - public ODataCollectionFetcher getregisteredUsers() { - return new ODataCollectionFetcher("registeredUsers", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + public ODataCollectionFetcher getregisteredUsers() { + return new ODataCollectionFetcher("registeredUsers", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + } + + /** + * Gets registered user. + * + * @return the registered user + */ + public DirectoryObjectFetcher getregisteredUser(String id){ + return new ODataCollectionFetcher("registeredUsers", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class).getById(id); } } \ No newline at end of file diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DeviceOperations.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DeviceOperations.java index 1992dc28..c38c69c9 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DeviceOperations.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DeviceOperations.java @@ -6,12 +6,11 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; /** @@ -25,19 +24,32 @@ public class DeviceOperations extends DirectoryObjectOperations { * @param urlComponent the url component * @param parent the parent */ - public DeviceOperations(String urlComponent, ODataExecutable parent) { + public DeviceOperations(String urlComponent, ODataExecutable parent) { super(urlComponent, parent); } - /** - * Add parameter. - * - * @param name the name - * @param value the value - * @return the device operations. - */ - public DeviceOperations addParameter(String name, Object value) { - addCustomParameter(name, value); + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the operations + */ + public DeviceOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the operations + */ + public DeviceOperations addHeader(String name, String value) { + addCustomHeader(name, value); return this; - } + } + } \ No newline at end of file diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryClient.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryClient.java index 91dbed6e..33bb7cde 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryClient.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryClient.java @@ -5,16 +5,16 @@ ******************************************************************************/ package com.microsoft.directoryservices.odata; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.DependencyResolver; import com.microsoft.directoryservices.*; -import com.microsoft.directoryservices.odata.*; /** * The type DirectoryClient. */ public class DirectoryClient extends BaseODataContainer { - /** + /** * Instantiates a new DirectoryClient. * * @param url the url @@ -23,100 +23,125 @@ public class DirectoryClient extends BaseODataContainer { public DirectoryClient(String url, DependencyResolver resolver) { super(url, resolver); } - /** + + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the client + */ + public DirectoryClient addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the client + */ + public DirectoryClient addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } + + /** * Gets DirectoryObject. * * @return the DirectoryObject */ - public ODataCollectionFetcher getdirectoryObjects() { + public ODataCollectionFetcher getdirectoryObjects() { return new ODataCollectionFetcher("directoryObjects", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); } - /** + /** * Gets OAuth2PermissionGrant. * * @return the OAuth2PermissionGrant */ - public ODataCollectionFetcher getoauth2PermissionGrants() { + public ODataCollectionFetcher getoauth2PermissionGrants() { return new ODataCollectionFetcher("oauth2PermissionGrants", this, OAuth2PermissionGrant.class,OAuth2PermissionGrantCollectionOperations.class); } - /** + /** * Gets SubscribedSku. * * @return the SubscribedSku */ - public ODataCollectionFetcher getsubscribedSkus() { + public ODataCollectionFetcher getsubscribedSkus() { return new ODataCollectionFetcher("subscribedSkus", this, SubscribedSku.class,SubscribedSkuCollectionOperations.class); } - /** + /** * Gets DirectoryObject. * * @return the DirectoryObject */ - public ODataCollectionFetcher getdeletedDirectoryObjects() { + public ODataCollectionFetcher getdeletedDirectoryObjects() { return new ODataCollectionFetcher("deletedDirectoryObjects", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); } - /** + /** * Gets User. * * @return the User */ - public ODataCollectionFetcher getusers() { + public ODataCollectionFetcher getusers() { return new ODataCollectionFetcher("users", this, User.class,UserCollectionOperations.class); } - /** + /** * Gets Application. * * @return the Application */ - public ODataCollectionFetcher getapplications() { + public ODataCollectionFetcher getapplications() { return new ODataCollectionFetcher("applications", this, Application.class,ApplicationCollectionOperations.class); } - /** + /** * Gets Contact. * * @return the Contact */ - public ODataCollectionFetcher getcontacts() { + public ODataCollectionFetcher getcontacts() { return new ODataCollectionFetcher("contacts", this, Contact.class,ContactCollectionOperations.class); } - /** + /** * Gets Group. * * @return the Group */ - public ODataCollectionFetcher getgroups() { + public ODataCollectionFetcher getgroups() { return new ODataCollectionFetcher("groups", this, Group.class,GroupCollectionOperations.class); } - /** + /** * Gets DirectoryRole. * * @return the DirectoryRole */ - public ODataCollectionFetcher getroles() { + public ODataCollectionFetcher getroles() { return new ODataCollectionFetcher("roles", this, DirectoryRole.class,DirectoryRoleCollectionOperations.class); } - /** + /** * Gets ServicePrincipal. * * @return the ServicePrincipal */ - public ODataCollectionFetcher getservicePrincipals() { + public ODataCollectionFetcher getservicePrincipals() { return new ODataCollectionFetcher("servicePrincipals", this, ServicePrincipal.class,ServicePrincipalCollectionOperations.class); } - /** + /** * Gets TenantDetail. * * @return the TenantDetail */ - public ODataCollectionFetcher gettenantDetails() { + public ODataCollectionFetcher gettenantDetails() { return new ODataCollectionFetcher("tenantDetails", this, TenantDetail.class,TenantDetailCollectionOperations.class); } - /** + /** * Gets Device. * * @return the Device */ - public ODataCollectionFetcher getdevices() { + public ODataCollectionFetcher getdevices() { return new ODataCollectionFetcher("devices", this, Device.class,DeviceCollectionOperations.class); } } \ No newline at end of file diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryLinkChangeCollectionOperations.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryLinkChangeCollectionOperations.java index 725656f4..b378dbda 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryLinkChangeCollectionOperations.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryLinkChangeCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,10 +34,22 @@ public DirectoryLinkChangeCollectionOperations(String urlComponent, ODataExecuta * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public DirectoryLinkChangeCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } + public DirectoryLinkChangeCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public DirectoryLinkChangeCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } } diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryLinkChangeFetcher.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryLinkChangeFetcher.java index 5c53fb87..fa45358d 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryLinkChangeFetcher.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryLinkChangeFetcher.java @@ -6,14 +6,17 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; -import com.microsoft.directoryservices.*; +import com.microsoft.directoryservices.*; /** * The type DirectoryLinkChangeFetcher. */ -public class DirectoryLinkChangeFetcher extends ODataEntityFetcher implements Readable { +public class DirectoryLinkChangeFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new DirectoryLinkChangeFetcher. @@ -21,8 +24,32 @@ public class DirectoryLinkChangeFetcher extends ODataEntityFetcher implements Readable { +public class DirectoryObjectFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new DirectoryObjectFetcher. @@ -21,111 +24,202 @@ public class DirectoryObjectFetcher extends ODataEntityFetcher getcreatedObjects() { - return new ODataCollectionFetcher("createdObjects", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + public ODataCollectionFetcher getcreatedObjects() { + return new ODataCollectionFetcher("createdObjects", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); } - /** + + /** + * Gets created object. + * + * @return the created object + */ + public DirectoryObjectFetcher getcreatedObject(String id){ + return new ODataCollectionFetcher("createdObjects", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class).getById(id); + } + /** * Gets manager. * * @return the manager */ public DirectoryObjectFetcher getmanager() { - return new DirectoryObjectFetcher("manager", this); + return new DirectoryObjectFetcher("manager", this); } /** * Gets direct reports. * * @return the direct reports */ - public ODataCollectionFetcher getdirectReports() { - return new ODataCollectionFetcher("directReports", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + public ODataCollectionFetcher getdirectReports() { + return new ODataCollectionFetcher("directReports", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + } + + /** + * Gets direct report. + * + * @return the direct report + */ + public DirectoryObjectFetcher getdirectReport(String id){ + return new ODataCollectionFetcher("directReports", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class).getById(id); } /** * Gets members. * * @return the members */ - public ODataCollectionFetcher getmembers() { - return new ODataCollectionFetcher("members", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + public ODataCollectionFetcher getmembers() { + return new ODataCollectionFetcher("members", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + } + + /** + * Gets member. + * + * @return the member + */ + public DirectoryObjectFetcher getmember(String id){ + return new ODataCollectionFetcher("members", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class).getById(id); } /** * Gets member of. * * @return the member of */ - public ODataCollectionFetcher getmemberOf() { - return new ODataCollectionFetcher("memberOf", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + public ODataCollectionFetcher getmemberOf() { + return new ODataCollectionFetcher("memberOf", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + } + + /** + * Gets member of. + * + * @return the member of + */ + public DirectoryObjectFetcher getmemberOf(String id){ + return new ODataCollectionFetcher("memberOf", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class).getById(id); } /** * Gets owners. * * @return the owners */ - public ODataCollectionFetcher getowners() { - return new ODataCollectionFetcher("owners", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + public ODataCollectionFetcher getowners() { + return new ODataCollectionFetcher("owners", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + } + + /** + * Gets owner. + * + * @return the owner + */ + public DirectoryObjectFetcher getowner(String id){ + return new ODataCollectionFetcher("owners", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class).getById(id); } /** * Gets owned objects. * * @return the owned objects */ - public ODataCollectionFetcher getownedObjects() { - return new ODataCollectionFetcher("ownedObjects", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + public ODataCollectionFetcher getownedObjects() { + return new ODataCollectionFetcher("ownedObjects", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + } + + /** + * Gets owned object. + * + * @return the owned object + */ + public DirectoryObjectFetcher getownedObject(String id){ + return new ODataCollectionFetcher("ownedObjects", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class).getById(id); } } \ No newline at end of file diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryObjectOperations.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryObjectOperations.java index 4cd6da73..291b82ec 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryObjectOperations.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryObjectOperations.java @@ -6,12 +6,11 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; /** @@ -25,88 +24,98 @@ public class DirectoryObjectOperations extends ODataOperations { * @param urlComponent the url component * @param parent the parent */ - public DirectoryObjectOperations(String urlComponent, ODataExecutable parent) { + public DirectoryObjectOperations(String urlComponent, ODataExecutable parent) { super(urlComponent, parent); } - /** - * Add parameter. - * - * @param name the name - * @param value the value - * @return the directoryobject operations. - */ - public DirectoryObjectOperations addParameter(String name, Object value) { - addCustomParameter(name, value); + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the operations + */ + public DirectoryObjectOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the operations + */ + public DirectoryObjectOperations addHeader(String name, String value) { + addCustomHeader(name, value); return this; - } - + } + + /** * checkMemberGroups listenable future. * @param groupIds the groupIds - * @return the listenable future - */ - public ListenableFuture checkMemberGroups(java.util.List groupIds) { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("groupIds", groupIds); - - ODataURL url = getResolver().createODataURL(); - - String parameters = getFunctionParameters(map); - url.appendPathComponent("checkMemberGroups(" + parameters + ")"); + * @return the listenable future + */ + public ListenableFuture checkMemberGroups(java.util.List groupIds) { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + map.put("groupIds", groupIds); - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.GET); - - addEntityResultCallback(result, future, getResolver(), String.class); - - return result; + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + String parameters = getFunctionParameters(map); +request.getUrl().appendPathComponent("checkMemberGroups(" + parameters + ")"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, String.class); + + return result; } - + /** * getMemberGroups listenable future. * @param securityEnabledOnly the securityEnabledOnly - * @return the listenable future - */ - public ListenableFuture getMemberGroups(Boolean securityEnabledOnly) { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("securityEnabledOnly", securityEnabledOnly); - - ODataURL url = getResolver().createODataURL(); - - String parameters = getFunctionParameters(map); - url.appendPathComponent("getMemberGroups(" + parameters + ")"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.GET); + * @return the listenable future + */ + public ListenableFuture getMemberGroups(Boolean securityEnabledOnly) { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + map.put("securityEnabledOnly", securityEnabledOnly); - addEntityResultCallback(result, future, getResolver(), String.class); - - return result; + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + String parameters = getFunctionParameters(map); +request.getUrl().appendPathComponent("getMemberGroups(" + parameters + ")"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, String.class); + + return result; } - + /** * getMemberObjects listenable future. * @param securityEnabledOnly the securityEnabledOnly - * @return the listenable future - */ - public ListenableFuture getMemberObjects(Boolean securityEnabledOnly) { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("securityEnabledOnly", securityEnabledOnly); - - ODataURL url = getResolver().createODataURL(); - - String parameters = getFunctionParameters(map); - url.appendPathComponent("getMemberObjects(" + parameters + ")"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.GET); - - addEntityResultCallback(result, future, getResolver(), String.class); + * @return the listenable future + */ + public ListenableFuture getMemberObjects(Boolean securityEnabledOnly) { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + map.put("securityEnabledOnly", securityEnabledOnly); - return result; + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + String parameters = getFunctionParameters(map); +request.getUrl().appendPathComponent("getMemberObjects(" + parameters + ")"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, String.class); + + return result; } } \ No newline at end of file diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryRoleCollectionOperations.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryRoleCollectionOperations.java index b50903ea..8e3a4e19 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryRoleCollectionOperations.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryRoleCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,10 +34,22 @@ public DirectoryRoleCollectionOperations(String urlComponent, ODataExecutable pa * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public DirectoryRoleCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } + public DirectoryRoleCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public DirectoryRoleCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } } diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryRoleFetcher.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryRoleFetcher.java index f9249a06..b80569d6 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryRoleFetcher.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/DirectoryRoleFetcher.java @@ -6,14 +6,17 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; -import com.microsoft.directoryservices.*; +import com.microsoft.directoryservices.*; /** * The type DirectoryRoleFetcher. */ -public class DirectoryRoleFetcher extends ODataEntityFetcher implements Readable { +public class DirectoryRoleFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new DirectoryRoleFetcher. @@ -21,8 +24,32 @@ public class DirectoryRoleFetcher extends ODataEntityFetcher implements Readable { +public class DirectoryRoleTemplateFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new DirectoryRoleTemplateFetcher. @@ -21,8 +24,32 @@ public class DirectoryRoleTemplateFetcher extends ODataEntityFetcher implements Readable { +public class ExtensionPropertyFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new ExtensionPropertyFetcher. @@ -21,8 +24,32 @@ public class ExtensionPropertyFetcher extends ODataEntityFetcher implements Readable { +public class GroupFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new GroupFetcher. @@ -21,16 +24,49 @@ public class GroupFetcher extends ODataEntityFetcher impl * @param urlComponent the url component * @param parent the parent */ - public GroupFetcher(String urlComponent, ODataExecutable parent) { - super(urlComponent, parent, Group.class,GroupOperations.class); + public GroupFetcher(String urlComponent, ODataExecutable parent) { + super(urlComponent, parent, Group.class, GroupOperations.class); } - /** + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public GroupFetcher addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public GroupFetcher addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } + + /** * Gets app role assignments. * * @return the app role assignments */ - public ODataCollectionFetcher getappRoleAssignments() { - return new ODataCollectionFetcher("appRoleAssignments", this, AppRoleAssignment.class,AppRoleAssignmentCollectionOperations.class); + public ODataCollectionFetcher getappRoleAssignments() { + return new ODataCollectionFetcher("appRoleAssignments", this, AppRoleAssignment.class,AppRoleAssignmentCollectionOperations.class); + } + + /** + * Gets app role assignment. + * + * @return the app role assignment + */ + public AppRoleAssignmentFetcher getappRoleAssignment(String id){ + return new ODataCollectionFetcher("appRoleAssignments", this, AppRoleAssignment.class,AppRoleAssignmentCollectionOperations.class).getById(id); } } \ No newline at end of file diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/GroupOperations.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/GroupOperations.java index 2c5c6da4..39f7b397 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/GroupOperations.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/GroupOperations.java @@ -6,12 +6,11 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; /** @@ -25,19 +24,32 @@ public class GroupOperations extends DirectoryObjectOperations { * @param urlComponent the url component * @param parent the parent */ - public GroupOperations(String urlComponent, ODataExecutable parent) { + public GroupOperations(String urlComponent, ODataExecutable parent) { super(urlComponent, parent); } - /** - * Add parameter. - * - * @param name the name - * @param value the value - * @return the group operations. - */ - public GroupOperations addParameter(String name, Object value) { - addCustomParameter(name, value); + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the operations + */ + public GroupOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the operations + */ + public GroupOperations addHeader(String name, String value) { + addCustomHeader(name, value); return this; - } + } + } \ No newline at end of file diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/OAuth2PermissionGrantCollectionOperations.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/OAuth2PermissionGrantCollectionOperations.java index 2ffe3bcd..d2d68628 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/OAuth2PermissionGrantCollectionOperations.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/OAuth2PermissionGrantCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,10 +34,22 @@ public OAuth2PermissionGrantCollectionOperations(String urlComponent, ODataExecu * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public OAuth2PermissionGrantCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } + public OAuth2PermissionGrantCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public OAuth2PermissionGrantCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } } diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/OAuth2PermissionGrantFetcher.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/OAuth2PermissionGrantFetcher.java index 4641f008..9d847206 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/OAuth2PermissionGrantFetcher.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/OAuth2PermissionGrantFetcher.java @@ -6,14 +6,17 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; -import com.microsoft.directoryservices.*; +import com.microsoft.directoryservices.*; /** * The type OAuth2PermissionGrantFetcher. */ -public class OAuth2PermissionGrantFetcher extends ODataEntityFetcher implements Readable { +public class OAuth2PermissionGrantFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new OAuth2PermissionGrantFetcher. @@ -21,8 +24,32 @@ public class OAuth2PermissionGrantFetcher extends ODataEntityFetcher the type parameter - * @param the type parameter - * @param the type parameter - */ -public class ODataCollectionFetcher extends ODataExecutable implements Readable> { - - private int top = -1; - private int skip = -1; - private String selectedId = null; - private String urlComponent; - private ODataExecutable parent; - private Class clazz; - private V operations; - private String select = null; - private String expand = null; - private String filter = null; - - /** - * Instantiates a new ODataCollectionFetcher. - * - * @param urlComponent the url component - * @param parent the parent - * @param clazz the clazz - * @param operationClazz the operation clazz - */ - public ODataCollectionFetcher(String urlComponent, ODataExecutable parent, - Class clazz, Class operationClazz) { - this.urlComponent = urlComponent; - this.parent = parent; - this.clazz = clazz; - - this.reset(); - - try { - this.operations = operationClazz.getConstructor(String.class, - ODataExecutable.class).newInstance("", this); - } catch (Throwable ignored) { - } - } - - /** - * Reset void. - */ - public void reset() { - this.top = -1; - this.skip = -1; - this.selectedId = null; - this.select = null; - this.expand = null; - this.filter = null; - } - - /** - * Top ODataCollectionFetcher. - * - * @param top the top - * @return the o data collection fetcher - */ - public ODataCollectionFetcher top(int top) { - this.top = top; - return this; - } - - /** - * Skip ODataCollectionFetcher. - * - * @param skip the skip - * @return the o data collection fetcher - */ - public ODataCollectionFetcher skip(int skip) { - this.skip = skip; - return this; - } - - /** - * Select ODataCollectionFetcher. - * - * @param select the select - * @return the o data collection fetcher - */ - public ODataCollectionFetcher select(String select) { - this.select = select; - return this; - } - - /** - * Expand ODataCollectionFetcher. - * - * @param expand the expand - * @return the o data collection fetcher - */ - public ODataCollectionFetcher expand(String expand) { - this.expand = expand; - return this; - } - - /** - * Filter ODataCollectionFetcher. - * - * @param filter the filter - * @return the o data collection fetcher - */ - public ODataCollectionFetcher filter(String filter) { - this.filter = filter; - return this; - } - - /** - * Gets by id. - * - * @param id the id - * @return the by id - */ - public U getById(String id) { - this.selectedId = id; - String packageName = operations.getClass().getPackage().getName(); - String[] classNameParts = (clazz.getCanonicalName() + "Fetcher").split("\\."); - String className = packageName + "." + classNameParts[classNameParts.length - 1]; - - try { - Class entityQueryClass = Class.forName(className); - ODataEntityFetcher odataEntityQuery = (ODataEntityFetcher) entityQueryClass - .getConstructor(String.class, ODataExecutable.class) - .newInstance("", this); - - return (U) odataEntityQuery; - } catch (Throwable e) { - // if this happens, we couldn't find the xxxQuery class at runtime. - // this must NEVER happen - throw new RuntimeException(e); - } - } - - @Override - ListenableFuture oDataExecute(ODataURL path, byte[] content, HttpVerb verb) { - if (selectedId == null) { - setPathForCollections(path, urlComponent, top, skip, select, expand, filter); - } else { - setSelectorUrl(path, urlComponent, selectedId); - } - addCustomParametersToODataURL(path, getCustomParameters(), getResolver()); - return parent.oDataExecute(path, content, verb); - } - - @Override - public DependencyResolver getResolver() { - return parent.getResolver(); - } - - @Override - public ListenableFuture> read() { - final SettableFuture> result = SettableFuture.create(); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), null, HttpVerb.GET); - addListResultCallback(result, future, getResolver(), clazz); - - return result; - } - - /** - * Add listenable future. - * - * @param entity the entity - * @return the listenable future - */ - public ListenableFuture add(T entity) { - final SettableFuture result = SettableFuture.create(); - byte[] payloadBytes = serializeToJsonByteArray(entity, getResolver()); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), payloadBytes, HttpVerb.POST); - addEntityResultCallback(result, future, getResolver(), clazz); - - return result; - } - - /** - * Gets operations. - * - * @return the operations - */ - public V getOperations() { - return this.operations; - } -} \ No newline at end of file diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ODataEntityFetcher.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ODataEntityFetcher.java deleted file mode 100755 index 04d06c16..00000000 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ODataEntityFetcher.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.directoryservices.odata; - -import com.google.common.util.concurrent.*; -import com.microsoft.services.odata.interfaces.*; - -import java.util.HashMap; -import java.util.Map; - -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addNullResultCallback; -import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; -import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; - -/** - * The type ODataEntityFetcher. - * @param the type parameter - * @param the type parameter - */ -public abstract class ODataEntityFetcher extends ODataExecutable implements Readable { - - protected String urlComponent; - protected ODataExecutable parent; - private Class clazz; - private V operations; - - /** - * Instantiates a new ODataEntityFetcher. - * - * @param urlComponent the url component - * @param parent the parent - * @param clazz the clazz - * @param operationClazz the operation clazz - */ - public ODataEntityFetcher(String urlComponent, ODataExecutable parent, Class clazz, Class operationClazz) { - this.urlComponent = urlComponent; - this.parent = parent; - this.clazz = clazz; - - try { - this.operations = operationClazz.getConstructor(String.class, - ODataExecutable.class).newInstance("", this); - } catch (Throwable ignored) { - } - } - - public ODataEntityFetcher addHeader(String name, String value) { - this.addCustomHeader(name, value); - return this; - } - - @Override - ListenableFuture oDataExecute(ODataURL path, byte[] content, HttpVerb verb) { - path.prependPathComponent(urlComponent); - addCustomParametersToODataURL(path, getCustomParameters(), getResolver()); - return parent.oDataExecute(path, content, verb); - } - - @Override - DependencyResolver getResolver() { - return parent.getResolver(); - } - - /** - * Updates the given entity. - * - * @param updatedEntity the updated entity - * @return the listenable future - */ - public ListenableFuture update(E updatedEntity) { - final SettableFuture result = SettableFuture.create(); - byte[] payloadBytes = serializeToJsonByteArray(updatedEntity, getResolver()); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), payloadBytes, HttpVerb.PATCH); - addEntityResultCallback(result, future, getResolver(), clazz); - return result; - } - - /** - * Deletes - * - * @return the listenable future - */ - public ListenableFuture delete() { - final SettableFuture result = SettableFuture.create(); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), null, HttpVerb.DELETE); - addNullResultCallback(result, future); - return result; - } - - /** - * Reads - * - * @return the listenable future - */ - public ListenableFuture read() { - final SettableFuture result = SettableFuture.create(); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), null, HttpVerb.GET); - addEntityResultCallback(result, future, getResolver(), clazz); - return result; - } - - /** - * Gets operations. - * - * @return the operations - */ - public V getOperations() { - return this.operations; - } -} \ No newline at end of file diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ODataExecutable.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ODataExecutable.java deleted file mode 100755 index 6ba0156a..00000000 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ODataExecutable.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.directoryservices.odata; - -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.services.odata.interfaces.*; -import java.util.*; - -/** - * The type ODataExecutable. - */ -abstract class ODataExecutable { - - /** - * oDataExecute. - * - * @param path the path - * @param content the content - * @param verb the verb - * @return the listenable future - */ - abstract ListenableFuture oDataExecute(ODataURL path, byte[] content, HttpVerb verb); - - /** - * Gets resolver. - * - * @return the resolver - */ - abstract DependencyResolver getResolver(); - - /** - * The Custom parameters. - */ - Map customParameters = new HashMap(); - - /** - * The Custom headers. - */ - Map customHeaders = new HashMap(); - - /** - * Add custom parameter. - * - * @param name the name - * @param value the value - */ - void addCustomParameter(String name, Object value) { - this.customParameters.put(name, value); - } - - /** - * Gets custom parameters. - * - * @return the custom parameters - */ - Map getCustomParameters() { - return this.customParameters; - } - - - /** - * Add custom headers. - * - * @param name the name - * @param value the value - */ - void addCustomHeader(String name, String value) { - this.customHeaders.put(name, value); - } - - /** - * Gets custom headers. - * - * @return the custom headers - */ - Map getCustomHeaders() { - return this.customHeaders; - } -} diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ODataMediaEntityFetcher.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ODataMediaEntityFetcher.java deleted file mode 100755 index d639496c..00000000 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ODataMediaEntityFetcher.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.directoryservices.odata; - -import com.google.common.util.concurrent.*; -import com.microsoft.services.odata.interfaces.*; - -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addNullResultCallback; -import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; -import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; - -/** - * The type ODataMediaEntityFetcher. - * @param the type parameter - * @param the type parameter - */ -public abstract class ODataMediaEntityFetcher extends ODataEntityFetcher implements Readable { - - /** - * Instantiates a new ODataMediaEntityFetcher. - * - * @param urlComponent the url component - * @param parent the parent - * @param clazz the clazz - * @param operationClazz the operation clazz - */ - - public ODataMediaEntityFetcher(String urlComponent, ODataExecutable parent, Class clazz, Class operationClazz) { - super(urlComponent, parent, clazz, operationClazz); - } - - public ListenableFuture getContent() { - ODataURL url = getResolver().createODataURL(); - url.appendPathComponent("$value"); - return oDataExecute(url, null, HttpVerb.GET); - } - - public ListenableFuture putContent(byte[] content) { - ODataURL url = getResolver().createODataURL(); - url.appendPathComponent("$value"); - ListenableFuture future = oDataExecute(url, content, HttpVerb.PUT); - - SettableFuture result = SettableFuture.create(); - addNullResultCallback(result, future); - - return result; - } -} \ No newline at end of file diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ODataOperations.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ODataOperations.java deleted file mode 100755 index 23cfdccf..00000000 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ODataOperations.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.directoryservices.odata; - -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.services.odata.interfaces.*; -import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; - -/** - * The type ODataOperations. - */ -public abstract class ODataOperations extends ODataExecutable { - private String urlComponent; - private ODataExecutable parent; - - /** - * Instantiates a new ODataOperation. - * - * @param urlComponent the url component - * @param parent the parent - */ - public ODataOperations(String urlComponent, ODataExecutable parent) { - this.urlComponent = urlComponent; - this.parent = parent; - } - - @Override - ListenableFuture oDataExecute(ODataURL path, byte[] content, HttpVerb verb) { - path.prependPathComponent(urlComponent); - addCustomParametersToODataURL(path, getCustomParameters(), getResolver()); - return parent.oDataExecute(path, content, verb); - } - - @Override - DependencyResolver getResolver() { - return parent.getResolver(); - } -} diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/Readable.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/Readable.java deleted file mode 100755 index fcc337e3..00000000 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/Readable.java +++ /dev/null @@ -1,16 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.directoryservices.odata; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * The interface Readable. - * @param the type parameter - */ -public interface Readable { - public ListenableFuture read(); -} diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ServicePrincipalCollectionOperations.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ServicePrincipalCollectionOperations.java index 972368e6..9dd3ac36 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ServicePrincipalCollectionOperations.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ServicePrincipalCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,10 +34,22 @@ public ServicePrincipalCollectionOperations(String urlComponent, ODataExecutable * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public ServicePrincipalCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } + public ServicePrincipalCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public ServicePrincipalCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } } diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ServicePrincipalFetcher.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ServicePrincipalFetcher.java index 409498d0..5d4c0d67 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ServicePrincipalFetcher.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ServicePrincipalFetcher.java @@ -6,14 +6,17 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; -import com.microsoft.directoryservices.*; +import com.microsoft.directoryservices.*; /** * The type ServicePrincipalFetcher. */ -public class ServicePrincipalFetcher extends ODataEntityFetcher implements Readable { +public class ServicePrincipalFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new ServicePrincipalFetcher. @@ -21,32 +24,83 @@ public class ServicePrincipalFetcher extends ODataEntityFetcher getappRoleAssignedTo() { + return new ODataCollectionFetcher("appRoleAssignedTo", this, AppRoleAssignment.class,AppRoleAssignmentCollectionOperations.class); + } + + /** * Gets app role assigned to. * * @return the app role assigned to */ - public ODataCollectionFetcher getappRoleAssignedTo() { - return new ODataCollectionFetcher("appRoleAssignedTo", this, AppRoleAssignment.class,AppRoleAssignmentCollectionOperations.class); + public AppRoleAssignmentFetcher getappRoleAssignedTo(String id){ + return new ODataCollectionFetcher("appRoleAssignedTo", this, AppRoleAssignment.class,AppRoleAssignmentCollectionOperations.class).getById(id); } /** * Gets app role assignments. * * @return the app role assignments */ - public ODataCollectionFetcher getappRoleAssignments() { - return new ODataCollectionFetcher("appRoleAssignments", this, AppRoleAssignment.class,AppRoleAssignmentCollectionOperations.class); + public ODataCollectionFetcher getappRoleAssignments() { + return new ODataCollectionFetcher("appRoleAssignments", this, AppRoleAssignment.class,AppRoleAssignmentCollectionOperations.class); + } + + /** + * Gets app role assignment. + * + * @return the app role assignment + */ + public AppRoleAssignmentFetcher getappRoleAssignment(String id){ + return new ODataCollectionFetcher("appRoleAssignments", this, AppRoleAssignment.class,AppRoleAssignmentCollectionOperations.class).getById(id); } /** * Gets oauth2permission grants. * * @return the oauth2permission grants */ - public ODataCollectionFetcher getoauth2PermissionGrants() { - return new ODataCollectionFetcher("oauth2PermissionGrants", this, OAuth2PermissionGrant.class,OAuth2PermissionGrantCollectionOperations.class); + public ODataCollectionFetcher getoauth2PermissionGrants() { + return new ODataCollectionFetcher("oauth2PermissionGrants", this, OAuth2PermissionGrant.class,OAuth2PermissionGrantCollectionOperations.class); + } + + /** + * Gets oauth2permission grants. + * + * @return the oauth2permission grants + */ + public OAuth2PermissionGrantFetcher getoauth2PermissionGrants(String id){ + return new ODataCollectionFetcher("oauth2PermissionGrants", this, OAuth2PermissionGrant.class,OAuth2PermissionGrantCollectionOperations.class).getById(id); } } \ No newline at end of file diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ServicePrincipalOperations.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ServicePrincipalOperations.java index 849c2a78..92cbc2b9 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ServicePrincipalOperations.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/ServicePrincipalOperations.java @@ -6,12 +6,11 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; /** @@ -25,19 +24,32 @@ public class ServicePrincipalOperations extends DirectoryObjectOperations { * @param urlComponent the url component * @param parent the parent */ - public ServicePrincipalOperations(String urlComponent, ODataExecutable parent) { + public ServicePrincipalOperations(String urlComponent, ODataExecutable parent) { super(urlComponent, parent); } - /** - * Add parameter. - * - * @param name the name - * @param value the value - * @return the serviceprincipal operations. - */ - public ServicePrincipalOperations addParameter(String name, Object value) { - addCustomParameter(name, value); + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the operations + */ + public ServicePrincipalOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the operations + */ + public ServicePrincipalOperations addHeader(String name, String value) { + addCustomHeader(name, value); return this; - } + } + } \ No newline at end of file diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/SubscribedSkuCollectionOperations.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/SubscribedSkuCollectionOperations.java index 2dd70531..703fffd8 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/SubscribedSkuCollectionOperations.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/SubscribedSkuCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,10 +34,22 @@ public SubscribedSkuCollectionOperations(String urlComponent, ODataExecutable pa * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public SubscribedSkuCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } + public SubscribedSkuCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public SubscribedSkuCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } } diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/SubscribedSkuFetcher.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/SubscribedSkuFetcher.java index 190e9c34..8bc23ecb 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/SubscribedSkuFetcher.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/SubscribedSkuFetcher.java @@ -6,14 +6,17 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; -import com.microsoft.directoryservices.*; +import com.microsoft.directoryservices.*; /** * The type SubscribedSkuFetcher. */ -public class SubscribedSkuFetcher extends ODataEntityFetcher implements Readable { +public class SubscribedSkuFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new SubscribedSkuFetcher. @@ -21,8 +24,32 @@ public class SubscribedSkuFetcher extends ODataEntityFetcher implements Readable { +public class TenantDetailFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new TenantDetailFetcher. @@ -21,8 +24,32 @@ public class TenantDetailFetcher extends ODataEntityFetcher implements Readable { +public class UserFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new UserFetcher. @@ -21,40 +24,100 @@ public class UserFetcher extends ODataEntityFetcher impleme * @param urlComponent the url component * @param parent the parent */ - public UserFetcher(String urlComponent, ODataExecutable parent) { - super(urlComponent, parent, User.class,UserOperations.class); + public UserFetcher(String urlComponent, ODataExecutable parent) { + super(urlComponent, parent, User.class, UserOperations.class); } - /** + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public UserFetcher addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public UserFetcher addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } + + /** * Gets app role assignments. * * @return the app role assignments */ - public ODataCollectionFetcher getappRoleAssignments() { - return new ODataCollectionFetcher("appRoleAssignments", this, AppRoleAssignment.class,AppRoleAssignmentCollectionOperations.class); + public ODataCollectionFetcher getappRoleAssignments() { + return new ODataCollectionFetcher("appRoleAssignments", this, AppRoleAssignment.class,AppRoleAssignmentCollectionOperations.class); + } + + /** + * Gets app role assignment. + * + * @return the app role assignment + */ + public AppRoleAssignmentFetcher getappRoleAssignment(String id){ + return new ODataCollectionFetcher("appRoleAssignments", this, AppRoleAssignment.class,AppRoleAssignmentCollectionOperations.class).getById(id); } /** * Gets oauth2permission grants. * * @return the oauth2permission grants */ - public ODataCollectionFetcher getoauth2PermissionGrants() { - return new ODataCollectionFetcher("oauth2PermissionGrants", this, OAuth2PermissionGrant.class,OAuth2PermissionGrantCollectionOperations.class); + public ODataCollectionFetcher getoauth2PermissionGrants() { + return new ODataCollectionFetcher("oauth2PermissionGrants", this, OAuth2PermissionGrant.class,OAuth2PermissionGrantCollectionOperations.class); + } + + /** + * Gets oauth2permission grants. + * + * @return the oauth2permission grants + */ + public OAuth2PermissionGrantFetcher getoauth2PermissionGrants(String id){ + return new ODataCollectionFetcher("oauth2PermissionGrants", this, OAuth2PermissionGrant.class,OAuth2PermissionGrantCollectionOperations.class).getById(id); } /** * Gets owned devices. * * @return the owned devices */ - public ODataCollectionFetcher getownedDevices() { - return new ODataCollectionFetcher("ownedDevices", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + public ODataCollectionFetcher getownedDevices() { + return new ODataCollectionFetcher("ownedDevices", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + } + + /** + * Gets owned device. + * + * @return the owned device + */ + public DirectoryObjectFetcher getownedDevice(String id){ + return new ODataCollectionFetcher("ownedDevices", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class).getById(id); } /** * Gets registered devices. * * @return the registered devices */ - public ODataCollectionFetcher getregisteredDevices() { - return new ODataCollectionFetcher("registeredDevices", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + public ODataCollectionFetcher getregisteredDevices() { + return new ODataCollectionFetcher("registeredDevices", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class); + } + + /** + * Gets registered device. + * + * @return the registered device + */ + public DirectoryObjectFetcher getregisteredDevice(String id){ + return new ODataCollectionFetcher("registeredDevices", this, DirectoryObject.class,DirectoryObjectCollectionOperations.class).getById(id); } } \ No newline at end of file diff --git a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/UserOperations.java b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/UserOperations.java index 4ab1055e..ca57697b 100755 --- a/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/UserOperations.java +++ b/sdk/directory-services/src/main/java/com/microsoft/directoryservices/odata/UserOperations.java @@ -6,12 +6,11 @@ package com.microsoft.directoryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.directoryservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; /** @@ -25,44 +24,56 @@ public class UserOperations extends DirectoryObjectOperations { * @param urlComponent the url component * @param parent the parent */ - public UserOperations(String urlComponent, ODataExecutable parent) { + public UserOperations(String urlComponent, ODataExecutable parent) { super(urlComponent, parent); } - /** - * Add parameter. - * - * @param name the name - * @param value the value - * @return the user operations. - */ - public UserOperations addParameter(String name, Object value) { - addCustomParameter(name, value); + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the operations + */ + public UserOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the operations + */ + public UserOperations addHeader(String name, String value) { + addCustomHeader(name, value); return this; - } - + } + + /** * assignLicense listenable future. * @param addLicenses the addLicenses * @param removeLicenses the removeLicenses - * @return the listenable future - */ - public ListenableFuture assignLicense(java.util.List addLicenses, java.util.List removeLicenses) { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("addLicenses", addLicenses); + * @return the listenable future + */ + public ListenableFuture assignLicense(java.util.List addLicenses, java.util.List removeLicenses) { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + map.put("addLicenses", addLicenses); map.put("removeLicenses", removeLicenses); - ODataURL url = getResolver().createODataURL(); - - String parameters = getFunctionParameters(map); - url.appendPathComponent("assignLicense(" + parameters + ")"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.GET); - - addEntityResultCallback(result, future, getResolver(), User.class); - - return result; + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + String parameters = getFunctionParameters(map); +request.getUrl().appendPathComponent("assignLicense(" + parameters + ")"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, User.class); + + return result; } } \ No newline at end of file diff --git a/sdk/discovery-services/build.gradle b/sdk/discovery-services/build.gradle index 8f1a7424..7e86452e 100644 --- a/sdk/discovery-services/build.gradle +++ b/sdk/discovery-services/build.gradle @@ -2,8 +2,7 @@ apply plugin: 'java' dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile project(':odata-engine-interfaces') - compile project(':odata-engine-helpers') + compile project(':odata-engine-core') } apply from :'../java-libraries.gradle' diff --git a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/BaseODataContainer.java b/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/BaseODataContainer.java deleted file mode 100755 index 227a007b..00000000 --- a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/BaseODataContainer.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.discoveryservices.odata; - -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.services.odata.BaseODataContainerHelper; -import com.microsoft.services.odata.interfaces.*; - -/** - * The type BaseODataContainer. -*/ -public abstract class BaseODataContainer extends ODataExecutable { - - private String url; - private DependencyResolver resolver; - - public BaseODataContainer(String url, DependencyResolver resolver) { - this.url = url; - this.resolver = resolver; - } - - @Override - ListenableFuture oDataExecute(ODataURL path, byte[] content, HttpVerb verb) { - return BaseODataContainerHelper.oDataExecute(path, content, verb, url, getCustomHeaders(), getResolver(), this.getClass().getCanonicalName()); - } - - @Override - DependencyResolver getResolver() { - return resolver; - } -} \ No newline at end of file diff --git a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/Constants.java b/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/Constants.java deleted file mode 100755 index fba8ca29..00000000 --- a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/Constants.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.discoveryservices.odata; - -import java.nio.charset.Charset; - -/** - * Constants used through the framework - */ -public class Constants { - /** - * UTF-8 Encoding name - */ - public static final String UTF8_NAME = "UTF-8"; - - /** - * UTF-8 Charset instance - */ - public static final Charset UTF8 = Charset.forName(UTF8_NAME); -} diff --git a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/DiscoveryClient.java b/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/DiscoveryClient.java index 8e5cc07b..c0d88da3 100755 --- a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/DiscoveryClient.java +++ b/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/DiscoveryClient.java @@ -5,16 +5,16 @@ ******************************************************************************/ package com.microsoft.discoveryservices.odata; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.DependencyResolver; import com.microsoft.discoveryservices.*; -import com.microsoft.discoveryservices.odata.*; /** * The type DiscoveryClient. */ public class DiscoveryClient extends BaseODataContainer { - /** + /** * Instantiates a new DiscoveryClient. * * @param url the url @@ -23,20 +23,45 @@ public class DiscoveryClient extends BaseODataContainer { public DiscoveryClient(String url, DependencyResolver resolver) { super(url, resolver); } - /** + + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the client + */ + public DiscoveryClient addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the client + */ + public DiscoveryClient addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } + + /** * Gets ServiceInfo. * * @return the ServiceInfo */ - public ODataCollectionFetcher getallServices() { + public ODataCollectionFetcher getallServices() { return new ODataCollectionFetcher("allServices", this, ServiceInfo.class,ServiceInfoCollectionOperations.class); } - /** + /** * Gets ServiceInfo. * * @return the ServiceInfo */ - public ODataCollectionFetcher getservices() { + public ODataCollectionFetcher getservices() { return new ODataCollectionFetcher("services", this, ServiceInfo.class,ServiceInfoCollectionOperations.class); } } \ No newline at end of file diff --git a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataCollectionFetcher.java b/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataCollectionFetcher.java deleted file mode 100755 index da438974..00000000 --- a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataCollectionFetcher.java +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.discoveryservices.odata; - -import com.google.common.util.concurrent.*; -import com.microsoft.services.odata.interfaces.*; -import java.util.List; - -import static com.microsoft.services.odata.EntityCollectionFetcherHelper.addListResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.setPathForCollections; -import static com.microsoft.services.odata.EntityFetcherHelper.setSelectorUrl; -import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; -import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; - -/** - * The type ODataCollectionFetcher. - * @param the type parameter - * @param the type parameter - * @param the type parameter - */ -public class ODataCollectionFetcher extends ODataExecutable implements Readable> { - - private int top = -1; - private int skip = -1; - private String selectedId = null; - private String urlComponent; - private ODataExecutable parent; - private Class clazz; - private V operations; - private String select = null; - private String expand = null; - private String filter = null; - - /** - * Instantiates a new ODataCollectionFetcher. - * - * @param urlComponent the url component - * @param parent the parent - * @param clazz the clazz - * @param operationClazz the operation clazz - */ - public ODataCollectionFetcher(String urlComponent, ODataExecutable parent, - Class clazz, Class operationClazz) { - this.urlComponent = urlComponent; - this.parent = parent; - this.clazz = clazz; - - this.reset(); - - try { - this.operations = operationClazz.getConstructor(String.class, - ODataExecutable.class).newInstance("", this); - } catch (Throwable ignored) { - } - } - - /** - * Reset void. - */ - public void reset() { - this.top = -1; - this.skip = -1; - this.selectedId = null; - this.select = null; - this.expand = null; - this.filter = null; - } - - /** - * Top ODataCollectionFetcher. - * - * @param top the top - * @return the o data collection fetcher - */ - public ODataCollectionFetcher top(int top) { - this.top = top; - return this; - } - - /** - * Skip ODataCollectionFetcher. - * - * @param skip the skip - * @return the o data collection fetcher - */ - public ODataCollectionFetcher skip(int skip) { - this.skip = skip; - return this; - } - - /** - * Select ODataCollectionFetcher. - * - * @param select the select - * @return the o data collection fetcher - */ - public ODataCollectionFetcher select(String select) { - this.select = select; - return this; - } - - /** - * Expand ODataCollectionFetcher. - * - * @param expand the expand - * @return the o data collection fetcher - */ - public ODataCollectionFetcher expand(String expand) { - this.expand = expand; - return this; - } - - /** - * Filter ODataCollectionFetcher. - * - * @param filter the filter - * @return the o data collection fetcher - */ - public ODataCollectionFetcher filter(String filter) { - this.filter = filter; - return this; - } - - /** - * Gets by id. - * - * @param id the id - * @return the by id - */ - public U getById(String id) { - this.selectedId = id; - String packageName = operations.getClass().getPackage().getName(); - String[] classNameParts = (clazz.getCanonicalName() + "Fetcher").split("\\."); - String className = packageName + "." + classNameParts[classNameParts.length - 1]; - - try { - Class entityQueryClass = Class.forName(className); - ODataEntityFetcher odataEntityQuery = (ODataEntityFetcher) entityQueryClass - .getConstructor(String.class, ODataExecutable.class) - .newInstance("", this); - - return (U) odataEntityQuery; - } catch (Throwable e) { - // if this happens, we couldn't find the xxxQuery class at runtime. - // this must NEVER happen - throw new RuntimeException(e); - } - } - - @Override - ListenableFuture oDataExecute(ODataURL path, byte[] content, HttpVerb verb) { - if (selectedId == null) { - setPathForCollections(path, urlComponent, top, skip, select, expand, filter); - } else { - setSelectorUrl(path, urlComponent, selectedId); - } - addCustomParametersToODataURL(path, getCustomParameters(), getResolver()); - return parent.oDataExecute(path, content, verb); - } - - @Override - public DependencyResolver getResolver() { - return parent.getResolver(); - } - - @Override - public ListenableFuture> read() { - final SettableFuture> result = SettableFuture.create(); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), null, HttpVerb.GET); - addListResultCallback(result, future, getResolver(), clazz); - - return result; - } - - /** - * Add listenable future. - * - * @param entity the entity - * @return the listenable future - */ - public ListenableFuture add(T entity) { - final SettableFuture result = SettableFuture.create(); - byte[] payloadBytes = serializeToJsonByteArray(entity, getResolver()); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), payloadBytes, HttpVerb.POST); - addEntityResultCallback(result, future, getResolver(), clazz); - - return result; - } - - /** - * Gets operations. - * - * @return the operations - */ - public V getOperations() { - return this.operations; - } -} \ No newline at end of file diff --git a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataEntityFetcher.java b/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataEntityFetcher.java deleted file mode 100755 index c77f08ae..00000000 --- a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataEntityFetcher.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.discoveryservices.odata; - -import com.google.common.util.concurrent.*; -import com.microsoft.services.odata.interfaces.*; - -import java.util.HashMap; -import java.util.Map; - -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addNullResultCallback; -import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; -import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; - -/** - * The type ODataEntityFetcher. - * @param the type parameter - * @param the type parameter - */ -public abstract class ODataEntityFetcher extends ODataExecutable implements Readable { - - protected String urlComponent; - protected ODataExecutable parent; - private Class clazz; - private V operations; - - /** - * Instantiates a new ODataEntityFetcher. - * - * @param urlComponent the url component - * @param parent the parent - * @param clazz the clazz - * @param operationClazz the operation clazz - */ - public ODataEntityFetcher(String urlComponent, ODataExecutable parent, Class clazz, Class operationClazz) { - this.urlComponent = urlComponent; - this.parent = parent; - this.clazz = clazz; - - try { - this.operations = operationClazz.getConstructor(String.class, - ODataExecutable.class).newInstance("", this); - } catch (Throwable ignored) { - } - } - - public ODataEntityFetcher addHeader(String name, String value) { - this.addCustomHeader(name, value); - return this; - } - - @Override - ListenableFuture oDataExecute(ODataURL path, byte[] content, HttpVerb verb) { - path.prependPathComponent(urlComponent); - addCustomParametersToODataURL(path, getCustomParameters(), getResolver()); - return parent.oDataExecute(path, content, verb); - } - - @Override - DependencyResolver getResolver() { - return parent.getResolver(); - } - - /** - * Updates the given entity. - * - * @param updatedEntity the updated entity - * @return the listenable future - */ - public ListenableFuture update(E updatedEntity) { - final SettableFuture result = SettableFuture.create(); - byte[] payloadBytes = serializeToJsonByteArray(updatedEntity, getResolver()); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), payloadBytes, HttpVerb.PATCH); - addEntityResultCallback(result, future, getResolver(), clazz); - return result; - } - - /** - * Deletes - * - * @return the listenable future - */ - public ListenableFuture delete() { - final SettableFuture result = SettableFuture.create(); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), null, HttpVerb.DELETE); - addNullResultCallback(result, future); - return result; - } - - /** - * Reads - * - * @return the listenable future - */ - public ListenableFuture read() { - final SettableFuture result = SettableFuture.create(); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), null, HttpVerb.GET); - addEntityResultCallback(result, future, getResolver(), clazz); - return result; - } - - /** - * Gets operations. - * - * @return the operations - */ - public V getOperations() { - return this.operations; - } -} \ No newline at end of file diff --git a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataExecutable.java b/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataExecutable.java deleted file mode 100755 index a64959f5..00000000 --- a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataExecutable.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.discoveryservices.odata; - -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.services.odata.interfaces.*; -import java.util.*; - -/** - * The type ODataExecutable. - */ -abstract class ODataExecutable { - - /** - * oDataExecute. - * - * @param path the path - * @param content the content - * @param verb the verb - * @return the listenable future - */ - abstract ListenableFuture oDataExecute(ODataURL path, byte[] content, HttpVerb verb); - - /** - * Gets resolver. - * - * @return the resolver - */ - abstract DependencyResolver getResolver(); - - /** - * The Custom parameters. - */ - Map customParameters = new HashMap(); - - /** - * The Custom headers. - */ - Map customHeaders = new HashMap(); - - /** - * Add custom parameter. - * - * @param name the name - * @param value the value - */ - void addCustomParameter(String name, Object value) { - this.customParameters.put(name, value); - } - - /** - * Gets custom parameters. - * - * @return the custom parameters - */ - Map getCustomParameters() { - return this.customParameters; - } - - - /** - * Add custom headers. - * - * @param name the name - * @param value the value - */ - void addCustomHeader(String name, String value) { - this.customHeaders.put(name, value); - } - - /** - * Gets custom headers. - * - * @return the custom headers - */ - Map getCustomHeaders() { - return this.customHeaders; - } -} diff --git a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataMediaEntityFetcher.java b/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataMediaEntityFetcher.java deleted file mode 100755 index 26797b08..00000000 --- a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataMediaEntityFetcher.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.discoveryservices.odata; - -import com.google.common.util.concurrent.*; -import com.microsoft.services.odata.interfaces.*; - -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addNullResultCallback; -import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; -import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; - -/** - * The type ODataMediaEntityFetcher. - * @param the type parameter - * @param the type parameter - */ -public abstract class ODataMediaEntityFetcher extends ODataEntityFetcher implements Readable { - - /** - * Instantiates a new ODataMediaEntityFetcher. - * - * @param urlComponent the url component - * @param parent the parent - * @param clazz the clazz - * @param operationClazz the operation clazz - */ - - public ODataMediaEntityFetcher(String urlComponent, ODataExecutable parent, Class clazz, Class operationClazz) { - super(urlComponent, parent, clazz, operationClazz); - } - - public ListenableFuture getContent() { - ODataURL url = getResolver().createODataURL(); - url.appendPathComponent("$value"); - return oDataExecute(url, null, HttpVerb.GET); - } - - public ListenableFuture putContent(byte[] content) { - ODataURL url = getResolver().createODataURL(); - url.appendPathComponent("$value"); - ListenableFuture future = oDataExecute(url, content, HttpVerb.PUT); - - SettableFuture result = SettableFuture.create(); - addNullResultCallback(result, future); - - return result; - } -} \ No newline at end of file diff --git a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataOperations.java b/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataOperations.java deleted file mode 100755 index 6235f5b2..00000000 --- a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ODataOperations.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.discoveryservices.odata; - -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.services.odata.interfaces.*; -import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; - -/** - * The type ODataOperations. - */ -public abstract class ODataOperations extends ODataExecutable { - private String urlComponent; - private ODataExecutable parent; - - /** - * Instantiates a new ODataOperation. - * - * @param urlComponent the url component - * @param parent the parent - */ - public ODataOperations(String urlComponent, ODataExecutable parent) { - this.urlComponent = urlComponent; - this.parent = parent; - } - - @Override - ListenableFuture oDataExecute(ODataURL path, byte[] content, HttpVerb verb) { - path.prependPathComponent(urlComponent); - addCustomParametersToODataURL(path, getCustomParameters(), getResolver()); - return parent.oDataExecute(path, content, verb); - } - - @Override - DependencyResolver getResolver() { - return parent.getResolver(); - } -} diff --git a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/Readable.java b/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/Readable.java deleted file mode 100755 index 171e9176..00000000 --- a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/Readable.java +++ /dev/null @@ -1,16 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.discoveryservices.odata; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * The interface Readable. - * @param the type parameter - */ -public interface Readable { - public ListenableFuture read(); -} diff --git a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ServiceInfoCollectionOperations.java b/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ServiceInfoCollectionOperations.java index 2b3d60f5..98b3a157 100755 --- a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ServiceInfoCollectionOperations.java +++ b/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ServiceInfoCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.discoveryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.discoveryservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,10 +34,22 @@ public ServiceInfoCollectionOperations(String urlComponent, ODataExecutable pare * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public ServiceInfoCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } + public ServiceInfoCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public ServiceInfoCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } } diff --git a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ServiceInfoFetcher.java b/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ServiceInfoFetcher.java index 95e01366..5fa3e129 100755 --- a/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ServiceInfoFetcher.java +++ b/sdk/discovery-services/src/main/java/com/microsoft/discoveryservices/odata/ServiceInfoFetcher.java @@ -6,14 +6,17 @@ package com.microsoft.discoveryservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.discoveryservices.*; -import com.microsoft.discoveryservices.*; +import com.microsoft.discoveryservices.*; /** * The type ServiceInfoFetcher. */ -public class ServiceInfoFetcher extends ODataEntityFetcher implements Readable { +public class ServiceInfoFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new ServiceInfoFetcher. @@ -21,8 +24,32 @@ public class ServiceInfoFetcher extends ODataEntityFetcher oDataExecute(ODataURL path, byte[] content, HttpVerb verb, Map headers) { - Map newHeaders = new HashMap(getCustomHeaders()); - newHeaders.putAll(headers); - return BaseODataContainerHelper.oDataExecute(path, content, verb, url, newHeaders, getResolver(), this.getClass().getCanonicalName()); - } - - @Override - DependencyResolver getResolver() { - return resolver; - } -} \ No newline at end of file diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/Constants.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/Constants.java deleted file mode 100755 index c5b0d08a..00000000 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/Constants.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.fileservices.odata; - -import java.nio.charset.Charset; - -/** - * Constants used through the framework - */ -public class Constants { - /** - * UTF-8 Encoding name - */ - public static final String UTF8_NAME = "UTF-8"; - - /** - * UTF-8 Charset instance - */ - public static final Charset UTF8 = Charset.forName(UTF8_NAME); -} diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/DriveCollectionOperations.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/DriveCollectionOperations.java index ba9dcf0d..2be7e1b3 100755 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/DriveCollectionOperations.java +++ b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/DriveCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.fileservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.fileservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,10 +34,22 @@ public DriveCollectionOperations(String urlComponent, ODataExecutable parent) { * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public DriveCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } + public DriveCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public DriveCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } } diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/DriveFetcher.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/DriveFetcher.java index 9f6cbe23..b8b9bece 100755 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/DriveFetcher.java +++ b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/DriveFetcher.java @@ -6,14 +6,17 @@ package com.microsoft.fileservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.fileservices.*; -import com.microsoft.fileservices.*; +import com.microsoft.fileservices.*; /** * The type DriveFetcher. */ -public class DriveFetcher extends ODataEntityFetcher implements Readable { +public class DriveFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new DriveFetcher. @@ -21,8 +24,32 @@ public class DriveFetcher extends ODataEntityFetcher impl * @param urlComponent the url component * @param parent the parent */ - public DriveFetcher(String urlComponent, ODataExecutable parent) { - super(urlComponent, parent, Drive.class,DriveOperations.class); + public DriveFetcher(String urlComponent, ODataExecutable parent) { + super(urlComponent, parent, Drive.class, DriveOperations.class); } - } \ No newline at end of file + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public DriveFetcher addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public DriveFetcher addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } + + } \ No newline at end of file diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/DriveOperations.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/DriveOperations.java index ea8aaed7..053ebe28 100755 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/DriveOperations.java +++ b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/DriveOperations.java @@ -6,12 +6,11 @@ package com.microsoft.fileservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.fileservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; /** @@ -25,19 +24,32 @@ public class DriveOperations extends ODataOperations { * @param urlComponent the url component * @param parent the parent */ - public DriveOperations(String urlComponent, ODataExecutable parent) { + public DriveOperations(String urlComponent, ODataExecutable parent) { super(urlComponent, parent); } - /** - * Add parameter. - * - * @param name the name - * @param value the value - * @return the drive operations. - */ - public DriveOperations addParameter(String name, Object value) { - addCustomParameter(name, value); + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the operations + */ + public DriveOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the operations + */ + public DriveOperations addHeader(String name, String value) { + addCustomHeader(name, value); return this; - } + } + } \ No newline at end of file diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FileCollectionOperations.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FileCollectionOperations.java index c17d79b2..8b1fc2e1 100755 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FileCollectionOperations.java +++ b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FileCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.fileservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.fileservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,10 +34,22 @@ public FileCollectionOperations(String urlComponent, ODataExecutable parent) { * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public FileCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } + public FileCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public FileCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } } diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FileFetcher.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FileFetcher.java index 6e03062c..953162e1 100755 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FileFetcher.java +++ b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FileFetcher.java @@ -6,14 +6,17 @@ package com.microsoft.fileservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.fileservices.*; -import com.microsoft.fileservices.*; +import com.microsoft.fileservices.*; /** * The type FileFetcher. */ -public class FileFetcher extends ODataMediaEntityFetcher implements Readable { +public class FileFetcher extends ODataMediaEntityFetcher + implements Readable { /** * Instantiates a new FileFetcher. @@ -21,8 +24,32 @@ public class FileFetcher extends ODataMediaEntityFetcher im * @param urlComponent the url component * @param parent the parent */ - public FileFetcher(String urlComponent, ODataExecutable parent) { - super(urlComponent, parent, File.class,FileOperations.class); + public FileFetcher(String urlComponent, ODataExecutable parent) { + super(urlComponent, parent, File.class, FileOperations.class); } - } \ No newline at end of file + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public FileFetcher addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public FileFetcher addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } + + } \ No newline at end of file diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FileOperations.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FileOperations.java index fd84fc4c..a1ce591d 100755 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FileOperations.java +++ b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FileOperations.java @@ -6,12 +6,11 @@ package com.microsoft.fileservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.fileservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; /** @@ -25,45 +24,57 @@ public class FileOperations extends ItemOperations { * @param urlComponent the url component * @param parent the parent */ - public FileOperations(String urlComponent, ODataExecutable parent) { + public FileOperations(String urlComponent, ODataExecutable parent) { super(urlComponent, parent); } - /** - * Add parameter. - * - * @param name the name - * @param value the value - * @return the file operations. - */ - public FileOperations addParameter(String name, Object value) { - addCustomParameter(name, value); + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the operations + */ + public FileOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the operations + */ + public FileOperations addHeader(String name, String value) { + addCustomHeader(name, value); return this; - } - + } + + /** * copy listenable future. * @param destFolderId the destFolderId * @param destFolderPath the destFolderPath * @param newName the newName - * @return the listenable future - */ - public ListenableFuture copy(String destFolderId, String destFolderPath, String newName) { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("destFolderId", destFolderId); + * @return the listenable future + */ + public ListenableFuture copy(String destFolderId, String destFolderPath, String newName) { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + map.put("destFolderId", destFolderId); map.put("destFolderPath", destFolderPath); map.put("newName", newName); - ODataURL url = getResolver().createODataURL(); - - url.appendPathComponent("copy"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.POST, getCustomHeaders()); - - addEntityResultCallback(result, future, getResolver(), File.class); - - return result; + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + request.getUrl().appendPathComponent("copy"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, File.class); + + return result; } } \ No newline at end of file diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FolderCollectionOperations.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FolderCollectionOperations.java index 520f2116..ce5a87f7 100755 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FolderCollectionOperations.java +++ b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FolderCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.fileservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.fileservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,10 +34,22 @@ public FolderCollectionOperations(String urlComponent, ODataExecutable parent) { * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public FolderCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } + public FolderCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public FolderCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } } diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FolderFetcher.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FolderFetcher.java index 4a5dd9f5..6dad10be 100755 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FolderFetcher.java +++ b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FolderFetcher.java @@ -6,14 +6,17 @@ package com.microsoft.fileservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.fileservices.*; -import com.microsoft.fileservices.*; +import com.microsoft.fileservices.*; /** * The type FolderFetcher. */ -public class FolderFetcher extends ODataEntityFetcher implements Readable { +public class FolderFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new FolderFetcher. @@ -21,16 +24,49 @@ public class FolderFetcher extends ODataEntityFetcher i * @param urlComponent the url component * @param parent the parent */ - public FolderFetcher(String urlComponent, ODataExecutable parent) { - super(urlComponent, parent, Folder.class,FolderOperations.class); + public FolderFetcher(String urlComponent, ODataExecutable parent) { + super(urlComponent, parent, Folder.class, FolderOperations.class); } - /** + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public FolderFetcher addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public FolderFetcher addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } + + /** * Gets children. * * @return the children */ - public ODataCollectionFetcher getchildren() { - return new ODataCollectionFetcher("children", this, Item.class,ItemCollectionOperations.class); + public ODataCollectionFetcher getchildren() { + return new ODataCollectionFetcher("children", this, Item.class,ItemCollectionOperations.class); + } + + /** + * Gets child. + * + * @return the child + */ + public ItemFetcher getchild(String id){ + return new ODataCollectionFetcher("children", this, Item.class,ItemCollectionOperations.class).getById(id); } } \ No newline at end of file diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FolderOperations.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FolderOperations.java index 162b1674..40f137d4 100755 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FolderOperations.java +++ b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/FolderOperations.java @@ -6,12 +6,11 @@ package com.microsoft.fileservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.fileservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; /** @@ -25,45 +24,57 @@ public class FolderOperations extends ItemOperations { * @param urlComponent the url component * @param parent the parent */ - public FolderOperations(String urlComponent, ODataExecutable parent) { + public FolderOperations(String urlComponent, ODataExecutable parent) { super(urlComponent, parent); } - /** - * Add parameter. - * - * @param name the name - * @param value the value - * @return the folder operations. - */ - public FolderOperations addParameter(String name, Object value) { - addCustomParameter(name, value); + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the operations + */ + public FolderOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the operations + */ + public FolderOperations addHeader(String name, String value) { + addCustomHeader(name, value); return this; - } - + } + + /** * copy listenable future. * @param destFolderId the destFolderId * @param destFolderPath the destFolderPath * @param newName the newName - * @return the listenable future - */ - public ListenableFuture copy(String destFolderId, String destFolderPath, String newName) { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("destFolderId", destFolderId); + * @return the listenable future + */ + public ListenableFuture copy(String destFolderId, String destFolderPath, String newName) { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + map.put("destFolderId", destFolderId); map.put("destFolderPath", destFolderPath); map.put("newName", newName); - ODataURL url = getResolver().createODataURL(); - - url.appendPathComponent("copy"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.POST, getCustomHeaders()); - - addEntityResultCallback(result, future, getResolver(), Folder.class); - - return result; + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + request.getUrl().appendPathComponent("copy"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, Folder.class); + + return result; } } \ No newline at end of file diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ItemCollectionOperations.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ItemCollectionOperations.java index ed6f184d..a84b9c28 100755 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ItemCollectionOperations.java +++ b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ItemCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.fileservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.fileservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,34 +34,45 @@ public ItemCollectionOperations(String urlComponent, ODataExecutable parent) { * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public ItemCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } - /** + public ItemCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public ItemCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } + /** * getByPath listenable future. * @param path the path - * @return the listenable future - */ - public ListenableFuture getByPath(String path) { + * @return the listenable future + */ + public ListenableFuture getByPath(String path) { final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("path", path); - - ODataURL url = getResolver().createODataURL(); + java.util.Map map = new java.util.HashMap(); + map.put("path", path); + + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + String parameters = getFunctionParameters(map); + request.getUrl().appendPathComponent("getByPath(" + parameters + ")"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, Item.class); - String parameters = getFunctionParameters(map); - url.appendPathComponent("getByPath(" + parameters + ")"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.GET, getCustomHeaders()); - - addEntityResultCallback(result, future, getResolver(), Item.class); - return result; } - + } diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ItemFetcher.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ItemFetcher.java index 10707ca8..351916c8 100755 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ItemFetcher.java +++ b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ItemFetcher.java @@ -6,14 +6,17 @@ package com.microsoft.fileservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.fileservices.*; -import com.microsoft.fileservices.*; +import com.microsoft.fileservices.*; /** * The type ItemFetcher. */ -public class ItemFetcher extends ODataEntityFetcher implements Readable { +public class ItemFetcher extends ODataEntityFetcher + implements Readable { /** * Instantiates a new ItemFetcher. @@ -21,14 +24,40 @@ public class ItemFetcher extends ODataEntityFetcher impleme * @param urlComponent the url component * @param parent the parent */ - public ItemFetcher(String urlComponent, ODataExecutable parent) { - super(urlComponent, parent, Item.class,ItemOperations.class); + public ItemFetcher(String urlComponent, ODataExecutable parent) { + super(urlComponent, parent, Item.class, ItemOperations.class); } - public FileFetcher asFile(){ - return new FileFetcher(this.urlComponent, this.parent); - } - public FolderFetcher asFolder(){ - return new FolderFetcher(this.urlComponent, this.parent); - } + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public ItemFetcher addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public ItemFetcher addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } + + + public FileFetcher asFile(){ + return new FileFetcher(this.urlComponent, this.parent); + } + + public FolderFetcher asFolder(){ + return new FolderFetcher(this.urlComponent, this.parent); + } } \ No newline at end of file diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ItemOperations.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ItemOperations.java index 5360ebcf..22ad8342 100755 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ItemOperations.java +++ b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ItemOperations.java @@ -6,12 +6,11 @@ package com.microsoft.fileservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.fileservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; /** @@ -25,19 +24,32 @@ public class ItemOperations extends ODataOperations { * @param urlComponent the url component * @param parent the parent */ - public ItemOperations(String urlComponent, ODataExecutable parent) { + public ItemOperations(String urlComponent, ODataExecutable parent) { super(urlComponent, parent); } - /** - * Add parameter. - * - * @param name the name - * @param value the value - * @return the item operations. - */ - public ItemOperations addParameter(String name, Object value) { - addCustomParameter(name, value); + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the operations + */ + public ItemOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the operations + */ + public ItemOperations addHeader(String name, String value) { + addCustomHeader(name, value); return this; - } + } + } \ No newline at end of file diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataCollectionFetcher.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataCollectionFetcher.java deleted file mode 100755 index ee4d2b0c..00000000 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataCollectionFetcher.java +++ /dev/null @@ -1,207 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.fileservices.odata; - -import com.google.common.util.concurrent.*; -import com.microsoft.services.odata.interfaces.*; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static com.microsoft.services.odata.EntityCollectionFetcherHelper.addListResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.setPathForCollections; -import static com.microsoft.services.odata.EntityFetcherHelper.setSelectorUrl; -import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; -import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; - -/** - * The type ODataCollectionFetcher. - * @param the type parameter - * @param the type parameter - * @param the type parameter - */ -public class ODataCollectionFetcher extends ODataExecutable implements Readable> { - - private int top = -1; - private int skip = -1; - private String selectedId = null; - private String urlComponent; - private ODataExecutable parent; - private Class clazz; - private V operations; - private String select = null; - private String expand = null; - private String filter = null; - - /** - * Instantiates a new ODataCollectionFetcher. - * - * @param urlComponent the url component - * @param parent the parent - * @param clazz the clazz - * @param operationClazz the operation clazz - */ - public ODataCollectionFetcher(String urlComponent, ODataExecutable parent, - Class clazz, Class operationClazz) { - this.urlComponent = urlComponent; - this.parent = parent; - this.clazz = clazz; - - this.reset(); - - try { - this.operations = operationClazz.getConstructor(String.class, - ODataExecutable.class).newInstance("", this); - } catch (Throwable ignored) { - } - } - - /** - * Reset void. - */ - public void reset() { - this.top = -1; - this.skip = -1; - this.selectedId = null; - this.select = null; - this.expand = null; - this.filter = null; - } - - /** - * Top ODataCollectionFetcher. - * - * @param top the top - * @return the o data collection fetcher - */ - public ODataCollectionFetcher top(int top) { - this.top = top; - return this; - } - - /** - * Skip ODataCollectionFetcher. - * - * @param skip the skip - * @return the o data collection fetcher - */ - public ODataCollectionFetcher skip(int skip) { - this.skip = skip; - return this; - } - - /** - * Select ODataCollectionFetcher. - * - * @param select the select - * @return the o data collection fetcher - */ - public ODataCollectionFetcher select(String select) { - this.select = select; - return this; - } - - /** - * Expand ODataCollectionFetcher. - * - * @param expand the expand - * @return the o data collection fetcher - */ - public ODataCollectionFetcher expand(String expand) { - this.expand = expand; - return this; - } - - /** - * Filter ODataCollectionFetcher. - * - * @param filter the filter - * @return the o data collection fetcher - */ - public ODataCollectionFetcher filter(String filter) { - this.filter = filter; - return this; - } - - /** - * Gets by id. - * - * @param id the id - * @return the by id - */ - public U getById(String id) { - this.selectedId = id; - String packageName = operations.getClass().getPackage().getName(); - String[] classNameParts = (clazz.getCanonicalName() + "Fetcher").split("\\."); - String className = packageName + "." + classNameParts[classNameParts.length - 1]; - - try { - Class entityQueryClass = Class.forName(className); - ODataEntityFetcher odataEntityQuery = (ODataEntityFetcher) entityQueryClass - .getConstructor(String.class, ODataExecutable.class) - .newInstance("", this); - - return (U) odataEntityQuery; - } catch (Throwable e) { - // if this happens, we couldn't find the xxxQuery class at runtime. - // this must NEVER happen - throw new RuntimeException(e); - } - } - - @Override - ListenableFuture oDataExecute(ODataURL path, byte[] content, HttpVerb verb, Map headers) { - if (selectedId == null) { - setPathForCollections(path, urlComponent, top, skip, select, expand, filter); - } else { - setSelectorUrl(path, urlComponent, selectedId); - } - addCustomParametersToODataURL(path, getCustomParameters(), getResolver()); - Map newHeaders = new HashMap(getCustomHeaders()); - newHeaders.putAll(headers); - return parent.oDataExecute(path, content, verb, newHeaders); - } - - @Override - public DependencyResolver getResolver() { - return parent.getResolver(); - } - - @Override - public ListenableFuture> read() { - final SettableFuture> result = SettableFuture.create(); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), null, HttpVerb.GET, getCustomHeaders()); - addListResultCallback(result, future, getResolver(), clazz); - - return result; - } - - /** - * Add listenable future. - * - * @param entity the entity - * @return the listenable future - */ - public ListenableFuture add(T entity) { - final SettableFuture result = SettableFuture.create(); - byte[] payloadBytes = serializeToJsonByteArray(entity, getResolver()); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), payloadBytes, HttpVerb.POST, getCustomHeaders()); - addEntityResultCallback(result, future, getResolver(), clazz); - - return result; - } - - /** - * Gets operations. - * - * @return the operations - */ - public V getOperations() { - return this.operations; - } -} \ No newline at end of file diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataEntityFetcher.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataEntityFetcher.java deleted file mode 100755 index b79eef76..00000000 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataEntityFetcher.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.fileservices.odata; - -import com.google.common.util.concurrent.*; -import com.microsoft.services.odata.interfaces.*; - -import java.util.HashMap; -import java.util.Map; - -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addNullResultCallback; -import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; -import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; - -/** - * The type ODataEntityFetcher. - * @param the type parameter - * @param the type parameter - */ -public abstract class ODataEntityFetcher extends ODataExecutable implements Readable { - - protected String urlComponent; - protected ODataExecutable parent; - private Class clazz; - private V operations; - - /** - * Instantiates a new ODataEntityFetcher. - * - * @param urlComponent the url component - * @param parent the parent - * @param clazz the clazz - * @param operationClazz the operation clazz - */ - public ODataEntityFetcher(String urlComponent, ODataExecutable parent, Class clazz, Class operationClazz) { - this.urlComponent = urlComponent; - this.parent = parent; - this.clazz = clazz; - - try { - this.operations = operationClazz.getConstructor(String.class, - ODataExecutable.class).newInstance("", this); - } catch (Throwable ignored) { - } - } - - public ODataEntityFetcher addHeader(String name, String value) { - this.addCustomHeader(name, value); - return this; - } - - @Override - ListenableFuture oDataExecute(ODataURL path, byte[] content, HttpVerb verb, Map headers) { - path.prependPathComponent(urlComponent); - addCustomParametersToODataURL(path, getCustomParameters(), getResolver()); - Map newHeaders = new HashMap(getCustomHeaders()); - newHeaders.putAll(headers); - return parent.oDataExecute(path, content, verb, newHeaders); - } - - @Override - DependencyResolver getResolver() { - return parent.getResolver(); - } - - /** - * Updates the given entity. - * - * @param updatedEntity the updated entity - * @return the listenable future - */ - public ListenableFuture update(E updatedEntity) { - final SettableFuture result = SettableFuture.create(); - byte[] payloadBytes = serializeToJsonByteArray(updatedEntity, getResolver()); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), payloadBytes, HttpVerb.PATCH, getCustomHeaders()); - addEntityResultCallback(result, future, getResolver(), clazz); - return result; - } - - /** - * Deletes - * - * @return the listenable future - */ - public ListenableFuture delete() { - final SettableFuture result = SettableFuture.create(); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), null, HttpVerb.DELETE, getCustomHeaders()); - addNullResultCallback(result, future); - return result; - } - - /** - * Reads - * - * @return the listenable future - */ - public ListenableFuture read() { - final SettableFuture result = SettableFuture.create(); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), null, HttpVerb.GET, getCustomHeaders()); - addEntityResultCallback(result, future, getResolver(), clazz); - return result; - } - - /** - * Gets operations. - * - * @return the operations - */ - public V getOperations() { - return this.operations; - } -} \ No newline at end of file diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataExecutable.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataExecutable.java deleted file mode 100755 index 7a646d69..00000000 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataExecutable.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.fileservices.odata; - -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.services.odata.interfaces.*; -import java.util.*; - -/** - * The type ODataExecutable. - */ -abstract class ODataExecutable { - - /** - * oDataExecute. - * - * @param path the path - * @param content the content - * @param verb the verb - * @return the listenable future - */ - abstract ListenableFuture oDataExecute(ODataURL path, byte[] content, HttpVerb verb, Map headers); - - /** - * Gets resolver. - * - * @return the resolver - */ - abstract DependencyResolver getResolver(); - - /** - * The Custom parameters. - */ - Map customParameters = new HashMap(); - - /** - * The Custom headers. - */ - Map customHeaders = new HashMap(); - - /** - * Add custom parameter. - * - * @param name the name - * @param value the value - */ - void addCustomParameter(String name, Object value) { - this.customParameters.put(name, value); - } - - /** - * Gets custom parameters. - * - * @return the custom parameters - */ - Map getCustomParameters() { - return this.customParameters; - } - - - /** - * Add custom headers. - * - * @param name the name - * @param value the value - */ - void addCustomHeader(String name, String value) { - this.customHeaders.put(name, value); - } - - /** - * Gets custom headers. - * - * @return the custom headers - */ - Map getCustomHeaders() { - return this.customHeaders; - } -} diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataMediaEntityFetcher.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataMediaEntityFetcher.java deleted file mode 100755 index 79f66cee..00000000 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataMediaEntityFetcher.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.fileservices.odata; - -import com.google.common.util.concurrent.*; -import com.microsoft.services.odata.interfaces.*; - -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addNullResultCallback; -import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; -import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; - -/** - * The type ODataMediaEntityFetcher. - * @param the type parameter - * @param the type parameter - */ -public abstract class ODataMediaEntityFetcher extends ODataEntityFetcher implements Readable { - - /** - * Instantiates a new ODataMediaEntityFetcher. - * - * @param urlComponent the url component - * @param parent the parent - * @param clazz the clazz - * @param operationClazz the operation clazz - */ - - public ODataMediaEntityFetcher(String urlComponent, ODataExecutable parent, Class clazz, Class operationClazz) { - super(urlComponent, parent, clazz, operationClazz); - } - - public ListenableFuture getContent() { - ODataURL url = getResolver().createODataURL(); - url.appendPathComponent("$value"); - return oDataExecute(url, null, HttpVerb.GET, getCustomHeaders()); - } - - public ListenableFuture putContent(byte[] content) { - ODataURL url = getResolver().createODataURL(); - url.appendPathComponent("$value"); - ListenableFuture future = oDataExecute(url, content, HttpVerb.PUT, getCustomHeaders()); - - SettableFuture result = SettableFuture.create(); - addNullResultCallback(result, future); - - return result; - } -} \ No newline at end of file diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataOperations.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataOperations.java deleted file mode 100755 index a74e520b..00000000 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/ODataOperations.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.fileservices.odata; - -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.services.odata.interfaces.*; - -import java.util.HashMap; -import java.util.Map; - -import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; - -/** - * The type ODataOperations. - */ -public abstract class ODataOperations extends ODataExecutable { - private String urlComponent; - private ODataExecutable parent; - - /** - * Instantiates a new ODataOperation. - * - * @param urlComponent the url component - * @param parent the parent - */ - public ODataOperations(String urlComponent, ODataExecutable parent) { - this.urlComponent = urlComponent; - this.parent = parent; - } - - @Override - ListenableFuture oDataExecute(ODataURL path, byte[] content, HttpVerb verb, Map headers) { - path.prependPathComponent(urlComponent); - addCustomParametersToODataURL(path, getCustomParameters(), getResolver()); - Map newHeaders = new HashMap(getCustomHeaders()); - newHeaders.putAll(headers); - return parent.oDataExecute(path, content, verb, newHeaders); - } - - @Override - DependencyResolver getResolver() { - return parent.getResolver(); - } -} diff --git a/sdk/file-services/src/main/java/com/microsoft/sharepointservices/odata/SharePointClient.java b/sdk/file-services/src/main/java/com/microsoft/sharepointservices/odata/SharePointClient.java index e344b7cb..6be2aba2 100755 --- a/sdk/file-services/src/main/java/com/microsoft/sharepointservices/odata/SharePointClient.java +++ b/sdk/file-services/src/main/java/com/microsoft/sharepointservices/odata/SharePointClient.java @@ -5,16 +5,19 @@ ******************************************************************************/ package com.microsoft.sharepointservices.odata; +import com.microsoft.fileservices.odata.DriveFetcher; +import com.microsoft.fileservices.odata.ItemCollectionOperations; +import com.microsoft.fileservices.odata.ItemFetcher; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.DependencyResolver; import com.microsoft.fileservices.*; -import com.microsoft.fileservices.odata.*; /** * The type SharePointClient. */ public class SharePointClient extends BaseODataContainer { - /** + /** * Instantiates a new SharePointClient. * * @param url the url @@ -23,7 +26,32 @@ public class SharePointClient extends BaseODataContainer { public SharePointClient(String url, DependencyResolver resolver) { super(url, resolver); } - /** + + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the client + */ + public SharePointClient addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the client + */ + public SharePointClient addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } + + /** * Gets drive. * * @return the drive @@ -31,12 +59,12 @@ public SharePointClient(String url, DependencyResolver resolver) { public DriveFetcher getdrive() { return new DriveFetcher("drive", this); } - /** + /** * Gets Item. * * @return the Item */ - public ODataCollectionFetcher getfiles() { + public ODataCollectionFetcher getfiles() { return new ODataCollectionFetcher("files", this, Item.class,ItemCollectionOperations.class); } } \ No newline at end of file diff --git a/sdk/java-libraries.gradle b/sdk/java-libraries.gradle index 4823ef99..73174265 100644 --- a/sdk/java-libraries.gradle +++ b/sdk/java-libraries.gradle @@ -48,7 +48,7 @@ bintray { configurations = ['published'] //When uploading configuration files apiUrl = "https://api.bintray.com" user = 'user' - key = 'foo' + key = 'key' dryRun = false filesSpec { diff --git a/sdk/odata-engine-android-impl/build.gradle b/sdk/odata-engine-android-impl/build.gradle index 8a89ae97..637b0909 100644 --- a/sdk/odata-engine-android-impl/build.gradle +++ b/sdk/odata-engine-android-impl/build.gradle @@ -26,8 +26,7 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.code.gson:gson:2.3' - compile project(':odata-engine-interfaces') - compile project(':odata-engine-java-impl') + compile project(':odata-engine-core') } apply from : '../android-libraries.gradle' \ No newline at end of file diff --git a/sdk/odata-engine-android-impl/src/main/java/com/microsoft/services/odata/impl/DefaultDependencyResolver.java b/sdk/odata-engine-android-impl/src/main/java/com/microsoft/services/odata/impl/DefaultDependencyResolver.java index 140a511c..bb273a9b 100644 --- a/sdk/odata-engine-android-impl/src/main/java/com/microsoft/services/odata/impl/DefaultDependencyResolver.java +++ b/sdk/odata-engine-android-impl/src/main/java/com/microsoft/services/odata/impl/DefaultDependencyResolver.java @@ -3,8 +3,8 @@ import android.os.Build; import com.microsoft.services.odata.Constants; -import com.microsoft.services.odata.ODataURLImpl; import com.microsoft.services.odata.impl.http.AndroidHttpTransport; +import com.microsoft.services.odata.impl.http.RequestImpl; import com.microsoft.services.odata.interfaces.*; /** @@ -47,6 +47,11 @@ public ODataURL createODataURL() { return new ODataURLImpl(); } + @Override + public Request createRequest() { + return new RequestImpl(); + } + @Override public String getPlatformUserAgent(String productName) { diff --git a/sdk/odata-engine-android-impl/src/main/java/com/microsoft/services/odata/impl/http/AndroidNetworkRunnable.java b/sdk/odata-engine-android-impl/src/main/java/com/microsoft/services/odata/impl/http/AndroidNetworkRunnable.java index 706edae9..bffa428c 100755 --- a/sdk/odata-engine-android-impl/src/main/java/com/microsoft/services/odata/impl/http/AndroidNetworkRunnable.java +++ b/sdk/odata-engine-android-impl/src/main/java/com/microsoft/services/odata/impl/http/AndroidNetworkRunnable.java @@ -58,7 +58,8 @@ public void run() { client = AndroidHttpClient.newInstance(userAgent); - BasicHttpEntityEnclosingRequest realRequest = new BasicHttpEntityEnclosingRequest(mRequest.getVerb().toString(), mRequest.getUrl()); + BasicHttpEntityEnclosingRequest realRequest = new BasicHttpEntityEnclosingRequest(mRequest.getVerb().toString(), + mRequest.getUrl().toString()); EntityEnclosingRequestWrapper wrapper = new EntityEnclosingRequestWrapper(realRequest); Map headers = mRequest.getHeaders(); diff --git a/sdk/odata-engine-helpers/.gitignore b/sdk/odata-engine-core/.gitignore similarity index 100% rename from sdk/odata-engine-helpers/.gitignore rename to sdk/odata-engine-core/.gitignore diff --git a/sdk/odata-engine-helpers/build.gradle b/sdk/odata-engine-core/build.gradle similarity index 66% rename from sdk/odata-engine-helpers/build.gradle rename to sdk/odata-engine-core/build.gradle index f81b5a2b..f6cdb164 100644 --- a/sdk/odata-engine-helpers/build.gradle +++ b/sdk/odata-engine-core/build.gradle @@ -4,7 +4,4 @@ dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.guava:guava:18.0' compile 'com.google.code.gson:gson:2.3' - compile project(':odata-engine-interfaces') -} - -apply from :'../java-libraries.gradle' \ No newline at end of file +} \ No newline at end of file diff --git a/sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/BaseODataContainerHelper.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/BaseODataContainer.java old mode 100644 new mode 100755 similarity index 71% rename from sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/BaseODataContainerHelper.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/BaseODataContainer.java index 13531188..ded72619 --- a/sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/BaseODataContainerHelper.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/BaseODataContainer.java @@ -1,195 +1,182 @@ -package com.microsoft.services.odata; - -import com.google.common.util.concurrent.FutureCallback; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.SettableFuture; -import com.microsoft.services.odata.interfaces.Credentials; -import com.microsoft.services.odata.interfaces.CredentialsFactory; -import com.microsoft.services.odata.interfaces.DependencyResolver; -import com.microsoft.services.odata.interfaces.HttpTransport; -import com.microsoft.services.odata.interfaces.HttpVerb; -import com.microsoft.services.odata.interfaces.LogLevel; -import com.microsoft.services.odata.interfaces.Logger; -import com.microsoft.services.odata.interfaces.ODataURL; -import com.microsoft.services.odata.interfaces.Request; -import com.microsoft.services.odata.interfaces.Response; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Map; - -import static com.microsoft.services.odata.Helpers.urlEncode; - -/** - * The type Base o data container helper. - */ -public class BaseODataContainerHelper { - - /** - * Gets OData parameter value. - * - * @param resolver the resolver - * @param value the value - * @return the o data parameter value - */ - public static String getODataParameterValue(DependencyResolver resolver, Object value) { - - String serialized = resolver.getJsonSerializer().serialize(value); - return urlEncode(serialized); - } - - /** - * ODataExecute. - * - * @param path the path - * @param content the content - * @param verb the verb - * @param url the url - * @param headers the headers - * @param resolver the resolver - * @param productName the product name - * @return the listenable future - */ - public static ListenableFuture oDataExecute(ODataURL path, byte[] content, - HttpVerb verb, String url, Map headers, - DependencyResolver resolver, String productName) { - - final Logger logger = resolver.getLogger(); - path.setBaseUrl(url); - - String fullUrl = path.toString(); - String executionInfo = String.format("URL: %s - HTTP VERB: %s", fullUrl, verb); - logger.log("Start preparing OData execution for " + executionInfo, LogLevel.INFO); - - if (content != null) { - logger.log("With " + content.length + " bytes of payload", LogLevel.INFO); - //logger.log("Payload: " + new String(content), LogLevel.VERBOSE); - } - - HttpTransport httpTransport = resolver.getHttpTransport(); - Request request = httpTransport.createRequest(); - request.setVerb(verb); - request.setUrl(fullUrl); - request.setContent(content); - - String userAgent = resolver.getPlatformUserAgent(productName); - request.addHeader(Constants.USER_AGENT_HEADER, userAgent); - request.addHeader(Constants.TELEMETRY_HEADER, userAgent); - request.addHeader(Constants.CONTENT_TYPE_HEADER, Constants.JSON_CONTENT_TYPE); - request.addHeader(Constants.ACCEPT_HEADER, Constants.JSON_CONTENT_TYPE); - request.addHeader(Constants.ODATA_VERSION_HEADER, Constants.ODATA_VERSION); - request.addHeader(Constants.ODATA_MAXVERSION_HEADER, Constants.ODATA_MAXVERSION); - - if (headers != null){ - for (String key: headers.keySet() ){ - request.addHeader(key, headers.get(key)); - } - } - - boolean credentialsSet = false; - CredentialsFactory credFactory = resolver.getCredentialsFactory(); - if (credFactory != null) { - Credentials cred = credFactory.getCredentials(); - if (cred != null) { - cred.prepareRequest(request); - credentialsSet = true; - } - } - - if (!credentialsSet) { - logger.log("Executing request without setting credentials", LogLevel.WARNING); - } - - - logger.log("Request Headers: ", LogLevel.VERBOSE); - for (String key : request.getHeaders().keySet()) { - logger.log(key + " : " + request.getHeaders().get(key).toString(), LogLevel.VERBOSE); - } - - final ListenableFuture future = httpTransport.execute(request); - logger.log("OData request executed", LogLevel.INFO); - - final SettableFuture result = SettableFuture.create(); - - Futures.addCallback(future, new FutureCallback() { - - @Override - public void onSuccess(Response response) { - try { - logger.log("OData response received", LogLevel.INFO); - - logger.log("Reading response data...", LogLevel.VERBOSE); - byte[] data = readAllBytes(response.getStream()); - logger.log(data.length + " bytes read from response", LogLevel.VERBOSE); - - int status = response.getStatus(); - logger.log("Response Status Code: " + status, LogLevel.INFO); - - try { - logger.log("Closing response", LogLevel.VERBOSE); - response.close(); - } catch (Throwable t) { - logger.log("Error closing response: " + t.toString(), LogLevel.ERROR); - result.setException(t); - return; - } - - if (status < 200 || status > 299) { - logger.log("Invalid status code. Processing response content as String", LogLevel.VERBOSE); - String responseData = new String(data, Constants.UTF8_NAME); - String message = "Response status: " + response.getStatus() + "\n" + "Response content: " + responseData; - logger.log(message, LogLevel.ERROR); - result.setException(new IllegalStateException(message)); - return; - } - result.set(data); - } catch (Throwable t) { - logger.log("Unexpected error: " + t.toString(), LogLevel.ERROR); - result.setException(t); - } - } - - @Override - public void onFailure(Throwable throwable) { - result.setException(throwable); - } - }); - return result; - } - - /** - * Read all bytes. - * - * @param stream the stream - * @return the byte [ ] - * @throws IOException the iO exception - */ - public static byte[] readAllBytes(InputStream stream) throws IOException { - if (stream == null) { - return new byte[0]; - } - - ByteArrayOutputStream os = new ByteArrayOutputStream(); - int nRead; - byte[] data = new byte[1024]; - - while ((nRead = stream.read(data, 0, data.length)) != -1) { - os.write(data, 0, nRead); - } - return os.toByteArray(); - } - - /** - * Generate parameters payload. - * - * @param parameters the parameters - * @param resolver the resolver - * @return the string - */ - public static String generateParametersPayload(Map parameters, DependencyResolver resolver) { - return resolver.getJsonSerializer().serialize(parameters); - } - -} +/******************************************************************************* + * Copyright (c) Microsoft Open Technologies, Inc. + * All Rights Reserved + * See License.txt in the project root for license information. + ******************************************************************************/ +package com.microsoft.services.odata; + +import com.google.common.util.concurrent.FutureCallback; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.SettableFuture; +import com.microsoft.services.odata.interfaces.Credentials; +import com.microsoft.services.odata.interfaces.CredentialsFactory; +import com.microsoft.services.odata.interfaces.DependencyResolver; +import com.microsoft.services.odata.interfaces.HttpTransport; +import com.microsoft.services.odata.interfaces.LogLevel; +import com.microsoft.services.odata.interfaces.Logger; +import com.microsoft.services.odata.interfaces.ODataResponse; +import com.microsoft.services.odata.interfaces.Request; +import com.microsoft.services.odata.interfaces.Response; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Map; + +/** + * The type BaseODataContainer. + */ +public abstract class BaseODataContainer extends ODataExecutable { + + private String url; + private DependencyResolver resolver; + + public BaseODataContainer(String url, DependencyResolver resolver) { + this.url = url; + this.resolver = resolver; + } + + @Override + protected ListenableFuture oDataExecute(Request request) { + final Logger logger = resolver.getLogger(); + + request.getUrl().setBaseUrl(this.url); + String fullUrl = request.getUrl().toString(); + + String executionInfo = String.format("URL: %s - HTTP VERB: %s", fullUrl, request.getVerb()); + logger.log("Start preparing OData execution for " + executionInfo, LogLevel.INFO); + + if (request.getContent() != null) { + logger.log("With " + request.getContent().length + " bytes of payload", LogLevel.INFO); + //logger.log("Payload: " + new String(content), LogLevel.VERBOSE); + } + + HttpTransport httpTransport = resolver.getHttpTransport(); + + String userAgent = resolver.getPlatformUserAgent(this.getClass().getCanonicalName()); + request.addHeader(Constants.USER_AGENT_HEADER, userAgent); + request.addHeader(Constants.TELEMETRY_HEADER, userAgent); + request.addHeader(Constants.CONTENT_TYPE_HEADER, Constants.JSON_CONTENT_TYPE); + request.addHeader(Constants.ACCEPT_HEADER, Constants.JSON_CONTENT_TYPE); + request.addHeader(Constants.ODATA_VERSION_HEADER, Constants.ODATA_VERSION); + request.addHeader(Constants.ODATA_MAXVERSION_HEADER, Constants.ODATA_MAXVERSION); + + if (request.getHeaders() != null) { + for (String key : request.getHeaders().keySet()) { + request.addHeader(key, request.getHeaders().get(key)); + } + } + + boolean credentialsSet = false; + CredentialsFactory credFactory = resolver.getCredentialsFactory(); + if (credFactory != null) { + Credentials cred = credFactory.getCredentials(); + if (cred != null) { + cred.prepareRequest(request); + credentialsSet = true; + } + } + + if (!credentialsSet) { + logger.log("Executing request without setting credentials", LogLevel.WARNING); + } + + + logger.log("Request Headers: ", LogLevel.VERBOSE); + for (String key : request.getHeaders().keySet()) { + logger.log(key + " : " + request.getHeaders().get(key), LogLevel.VERBOSE); + } + + final ListenableFuture future = httpTransport.execute(request); + logger.log("OData request executed", LogLevel.INFO); + + final SettableFuture result = SettableFuture.create(); + + Futures.addCallback(future, new FutureCallback() { + + @Override + public void onSuccess(Response response) { + try { + logger.log("OData response received", LogLevel.INFO); + + logger.log("Reading response data...", LogLevel.VERBOSE); + byte[] data = readAllBytes(response.getStream()); + logger.log(data.length + " bytes read from response", LogLevel.VERBOSE); + + int status = response.getStatus(); + logger.log("Response Status Code: " + status, LogLevel.INFO); + + try { + logger.log("Closing response", LogLevel.VERBOSE); + response.close(); + } catch (Throwable t) { + logger.log("Error closing response: " + t.toString(), LogLevel.ERROR); + result.setException(t); + return; + } + + ODataResponse odataResponse = new ODataResponseImpl(data, response); + if (status < 200 || status > 299) { + logger.log("Invalid status code. Processing response content as String", LogLevel.VERBOSE); + String responseData = new String(data, Constants.UTF8_NAME); + String message = "Response status: " + response.getStatus() + "\n" + "Response content: " + responseData; + logger.log(message, LogLevel.ERROR); + result.setException(new ODataException(odataResponse, message)); + return; + } + result.set(odataResponse); + } catch (Throwable t) { + logger.log("Unexpected error: " + t.toString(), LogLevel.ERROR); + ODataResponse odataResponse = new ODataResponseImpl(null, response); + result.setException(new ODataException(odataResponse, t)); + } + } + + @Override + public void onFailure(Throwable throwable) { + result.setException(throwable); + } + }); + return result; + + } + + /** + * Read all bytes. + * + * @param stream the stream + * @return the byte [ ] + * @throws java.io.IOException the iO exception + */ + public static byte[] readAllBytes(InputStream stream) throws IOException { + if (stream == null) { + return new byte[0]; + } + + ByteArrayOutputStream os = new ByteArrayOutputStream(); + int nRead; + byte[] data = new byte[1024]; + + while ((nRead = stream.read(data, 0, data.length)) != -1) { + os.write(data, 0, nRead); + } + return os.toByteArray(); + } + + /** + * Generate parameters payload. + * + * @param parameters the parameters + * @param resolver the resolver + * @return the string + */ + public static String generateParametersPayload(Map parameters, DependencyResolver resolver) { + return resolver.getJsonSerializer().serialize(parameters); + } + + @Override + protected DependencyResolver getResolver() { + return resolver; + } +} \ No newline at end of file diff --git a/sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/CalendarSerializer.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/CalendarSerializer.java similarity index 100% rename from sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/CalendarSerializer.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/CalendarSerializer.java diff --git a/sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/Constants.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/Constants.java similarity index 88% rename from sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/Constants.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/Constants.java index 427ad2c9..8d108075 100755 --- a/sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/Constants.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/Constants.java @@ -11,15 +11,15 @@ * Constants used through the framework */ public class Constants { - /** - * UTF-8 Encoding name - */ + /** + * UTF-8 Encoding name + */ public static final String UTF8_NAME = "UTF-8"; - - /** - * The constant UTF8. - */ - public static final Charset UTF8 = Charset.forName(UTF8_NAME); + + /** + * UTF-8 Charset instance + */ + public static final Charset UTF8 = Charset.forName(UTF8_NAME); /** * The constant SDK_VERSION. diff --git a/sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/Helpers.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/Helpers.java similarity index 98% rename from sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/Helpers.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/Helpers.java index 353c9932..7f58e6bc 100644 --- a/sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/Helpers.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/Helpers.java @@ -90,9 +90,8 @@ public static String getReservedPrefix() { * * @param url the url * @param parameters the parameters - * @param resolver the resolver */ - public static void addCustomParametersToODataURL(ODataURL url, Map parameters, DependencyResolver resolver) { + public static void addCustomParametersToODataURL(ODataURL url, Map parameters) { Set keys = parameters.keySet(); for (String name : keys) { diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataCollectionFetcher.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataCollectionFetcher.java new file mode 100755 index 00000000..bb7d94e0 --- /dev/null +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataCollectionFetcher.java @@ -0,0 +1,288 @@ +/******************************************************************************* + * Copyright (c) Microsoft Open Technologies, Inc. + * All Rights Reserved + * See License.txt in the project root for license information. + ******************************************************************************/ +package com.microsoft.services.odata; + +import com.google.common.util.concurrent.FutureCallback; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.SettableFuture; +import com.microsoft.services.odata.interfaces.HttpVerb; +import com.microsoft.services.odata.interfaces.ODataResponse; +import com.microsoft.services.odata.interfaces.ODataURL; +import com.microsoft.services.odata.interfaces.Request; + +import java.util.List; + +import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; +import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; + +/** + * The type ODataCollectionFetcher. + * + * @param the type parameter + * @param the type parameter + * @param the type parameter + */ +public class ODataCollectionFetcher + extends ODataFetcher + implements Readable> { + + private int top = -1; + private int skip = -1; + private String selectedId = null; + private TOperations operations; + private String select = null; + private String expand = null; + private String filter = null; + + /** + * Instantiates a new ODataCollectionFetcher. + * + * @param urlComponent the url component + * @param parent the parent + * @param clazz the clazz + * @param operationClazz the operation clazz + */ + public ODataCollectionFetcher(String urlComponent, ODataExecutable parent, + Class clazz, Class operationClazz) { + super(urlComponent, parent, clazz); + + this.reset(); + + try { + this.operations = operationClazz.getConstructor(String.class, + ODataExecutable.class).newInstance("", this); + } catch (Throwable ignored) { + } + } + + /** + * Reset void. + */ + public void reset() { + this.top = -1; + this.skip = -1; + this.selectedId = null; + this.select = null; + this.expand = null; + this.filter = null; + } + + /** + * Top ODataCollectionFetcher. + * + * @param top the top + * @return the o data collection fetcher + */ + public ODataCollectionFetcher top(int top) { + this.top = top; + return this; + } + + /** + * Skip ODataCollectionFetcher. + * + * @param skip the skip + * @return the o data collection fetcher + */ + public ODataCollectionFetcher skip(int skip) { + this.skip = skip; + return this; + } + + /** + * Select ODataCollectionFetcher. + * + * @param select the select + * @return the o data collection fetcher + */ + public ODataCollectionFetcher select(String select) { + this.select = select; + return this; + } + + /** + * Expand ODataCollectionFetcher. + * + * @param expand the expand + * @return the o data collection fetcher + */ + public ODataCollectionFetcher expand(String expand) { + this.expand = expand; + return this; + } + + /** + * Filter ODataCollectionFetcher. + * + * @param filter the filter + * @return the o data collection fetcher + */ + public ODataCollectionFetcher filter(String filter) { + this.filter = filter; + return this; + } + + /** + * Gets by id. + * + * @param id the id + * @return the by id + */ + public TFetcher getById(String id) { + this.selectedId = id; + String packageName = operations.getClass().getPackage().getName(); + String[] classNameParts = (clazz.getCanonicalName() + "Fetcher").split("\\."); + String className = packageName + "." + classNameParts[classNameParts.length - 1]; + + try { + Class entityQueryClass = Class.forName(className); + ODataEntityFetcher odataEntityQuery = (ODataEntityFetcher) entityQueryClass + .getConstructor(String.class, ODataExecutable.class) + .newInstance("", this); + + return (TFetcher) odataEntityQuery; + } catch (Throwable e) { + // if this happens, we couldn't find the xxxQuery class at runtime. + // this must NEVER happen + throw new RuntimeException(e); + } + } + + @Override + protected ListenableFuture oDataExecute(Request request) { + if (selectedId == null) { + setPathForCollections(request.getUrl(), urlComponent, top, skip, select, expand, filter); + } else { + setSelectorUrl(request.getUrl(), urlComponent, selectedId); + } + addCustomParametersToODataURL(request.getUrl(), getParameters()); + return parent.oDataExecute(request); + } + + + @Override + public ListenableFuture> read() { + final SettableFuture> result = SettableFuture.create(); + + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.GET); + + ListenableFuture future = oDataExecute(request); + addListResultCallback(result, future); + + return result; + } + + /** + * Add listenable future. + * + * @param entity the entity + * @return the listenable future + */ + public ListenableFuture add(TEntity entity) { + final SettableFuture result = SettableFuture.create(); + byte[] payloadBytes = serializeToJsonByteArray(entity, getResolver()); + + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(payloadBytes); + + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future); + + return result; + } + + /** + * Gets operations. + * + * @return the operations + */ + public TOperations getOperations() { + return this.operations; + } + + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the ODataCollectionFetcher + */ + public ODataCollectionFetcher addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the ODataCollectionFetcher + */ + public ODataCollectionFetcher addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } + + public void addListResultCallback(final SettableFuture> result, ListenableFuture future) { + Futures.addCallback(future, new FutureCallback() { + @Override + public void onSuccess(ODataResponse payload) { + List list; + try { + String string = new String(payload.getPayload(), Constants.UTF8_NAME); + list = getResolver().getJsonSerializer().deserializeList(string, clazz); + result.set(list); + } catch (Throwable e) { + result.setException(e); + } + } + + @Override + public void onFailure(Throwable throwable) { + result.setException(throwable); + } + }); + } + + /** + * Sets path for collections. + * + * @param url the url + * @param urlComponent the url component + * @param top the top + * @param skip the skip + * @param select the select + * @param expand the expand + * @param filter the filter + */ + protected void setPathForCollections(ODataURL url, String urlComponent, int top, int skip, String select, String expand, String filter) { + if (top > -1) { + url.addQueryStringParameter("$top", Integer.valueOf(top).toString()); + } + + if (skip > -1) { + url.addQueryStringParameter("$skip", Integer.valueOf(skip).toString()); + } + + if (select != null) { + url.addQueryStringParameter("$select", select); + } + + if (expand != null) { + url.addQueryStringParameter("$expand", expand); + } + + if (filter != null) { + url.addQueryStringParameter("$filter", filter); + } + + url.prependPathComponent(urlComponent); + } +} \ No newline at end of file diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataEntityFetcher.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataEntityFetcher.java new file mode 100755 index 00000000..d6cae9eb --- /dev/null +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataEntityFetcher.java @@ -0,0 +1,117 @@ +/******************************************************************************* + * Copyright (c) Microsoft Open Technologies, Inc. + * All Rights Reserved + * See License.txt in the project root for license information. + ******************************************************************************/ +package com.microsoft.services.odata; + +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.SettableFuture; +import com.microsoft.services.odata.interfaces.HttpVerb; +import com.microsoft.services.odata.interfaces.ODataResponse; +import com.microsoft.services.odata.interfaces.ODataURL; +import com.microsoft.services.odata.interfaces.Request; + +import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; +import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; + +/** + * The type ODataEntityFetcher. + * + * @param the type parameter + * @param the type parameter + */ +public abstract class ODataEntityFetcher + extends ODataFetcher + implements Readable { + private TOperations operations; + + /** + * Instantiates a new ODataEntityFetcher. + * + * @param urlComponent the url component + * @param parent the parent + * @param clazz the clazz + * @param operationClazz the operation clazz + */ + public ODataEntityFetcher(String urlComponent, ODataExecutable parent, Class clazz, Class operationClazz) { + super(urlComponent, parent, clazz); + + try { + this.operations = operationClazz.getConstructor(String.class, + ODataExecutable.class).newInstance("", this); + } catch (Throwable ignored) { + } + } + + @Override + protected ListenableFuture oDataExecute(Request request) { + + ODataURL oDataURL = request.getUrl(); + oDataURL.prependPathComponent(urlComponent); + + addCustomParametersToODataURL(oDataURL, getParameters()); + return parent.oDataExecute(request); + } + + + /** + * Updates the given entity. + * + * @param updatedEntity the updated entity + * @return the listenable future + */ + public ListenableFuture update(TEntity updatedEntity) { + final SettableFuture result = SettableFuture.create(); + byte[] payloadBytes = serializeToJsonByteArray(updatedEntity, getResolver()); + + Request request = getResolver().createRequest(); + request.setContent(payloadBytes); + request.setVerb(HttpVerb.PATCH); + + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future); + return result; + } + + /** + * Deletes + * + * @return the listenable future + */ + public ListenableFuture delete() { + final SettableFuture result = SettableFuture.create(); + + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.DELETE); + + ListenableFuture future = oDataExecute(request); + addNullResultCallback(result, future); + return result; + } + + /** + * Reads + * + * @return the listenable future + */ + public ListenableFuture read() { + final SettableFuture result = SettableFuture.create(); + + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.GET); + + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future); + return result; + } + + /** + * Gets operations. + * + * @return the operations + */ + public TOperations getOperations() { + return this.operations; + } +} \ No newline at end of file diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataException.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataException.java new file mode 100644 index 00000000..428d3e0f --- /dev/null +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataException.java @@ -0,0 +1,22 @@ +package com.microsoft.services.odata; + +import com.microsoft.services.odata.interfaces.ODataResponse; + +public class ODataException extends Exception { + + private ODataResponse response; + + public ODataException(ODataResponse response, String message) { + super(message); + this.response = response; + } + + public ODataException(ODataResponse response, Throwable inner) { + super(inner); + this.response = response; + } + + public ODataResponse getODataResponse() { + return this.response; + } +} diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataExecutable.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataExecutable.java new file mode 100755 index 00000000..b1784512 --- /dev/null +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataExecutable.java @@ -0,0 +1,96 @@ +/******************************************************************************* + * Copyright (c) Microsoft Open Technologies, Inc. + * All Rights Reserved + * See License.txt in the project root for license information. + ******************************************************************************/ +package com.microsoft.services.odata; + +import com.google.common.util.concurrent.ListenableFuture; +import com.microsoft.services.odata.interfaces.DependencyResolver; +import com.microsoft.services.odata.interfaces.HttpVerb; +import com.microsoft.services.odata.interfaces.ODataResponse; +import com.microsoft.services.odata.interfaces.ODataURL; +import com.microsoft.services.odata.interfaces.Request; + +import java.util.HashMap; +import java.util.Map; + +/** + * The type ODataExecutable. + */ +public abstract class ODataExecutable { + + /** + * OData execute. + * + * @param request the request + * @return the listenable future + */ + protected abstract ListenableFuture oDataExecute(Request request); + + /** + * Gets resolver. + * + * @return the resolver + */ + protected abstract DependencyResolver getResolver(); + + /** + * The Custom parameters. + */ + Map customParameters = new HashMap(); + + /** + * The Custom headers. + */ + Map customHeaders = new HashMap(); + + /** + * Add custom parameter. + * + * @param name the name + * @param value the value + */ + public void addCustomParameter(String name, Object value) { + this.customParameters.put(name, value); + } + + /** + * Gets custom parameters. + * + * @return the custom parameters + */ + public Map getParameters() { + return new HashMap(this.customParameters); + } + + /** + * Add custom headers. + * + * @param name the name + * @param value the value + */ + public void addCustomHeader(String name, String value) { + this.customHeaders.put(name, value); + } + + /** + * Gets custom headers. + * + * @return the custom headers + */ + public Map getHeaders() { + return new HashMap(this.customHeaders); + } + + /** + * As t. + * + * @param the type parameter + * @param inference the inference + * @return the t + */ + public T as(Class inference) { + return (T)this; + } +} diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataFetcher.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataFetcher.java new file mode 100644 index 00000000..903d5245 --- /dev/null +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataFetcher.java @@ -0,0 +1,108 @@ +package com.microsoft.services.odata; + +import com.google.common.util.concurrent.FutureCallback; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.SettableFuture; +import com.microsoft.services.odata.interfaces.DependencyResolver; +import com.microsoft.services.odata.interfaces.ODataResponse; +import com.microsoft.services.odata.interfaces.ODataURL; + +public abstract class ODataFetcher extends ODataExecutable { + + protected Class clazz; + protected String urlComponent; + protected ODataExecutable parent; + + + public ODataFetcher(String urlComponent, ODataExecutable parent, Class clazz) { + this.clazz = clazz; + this.urlComponent = urlComponent; + this.parent = parent; + } + + @Override + protected DependencyResolver getResolver() { + return parent.getResolver(); + } + + protected void addEntityResultCallback(final SettableFuture result, + ListenableFuture future) { + Futures.addCallback(future, new FutureCallback() { + @Override + public void onSuccess(ODataResponse response) { + try { + String string = new String(response.getPayload(), Constants.UTF8_NAME); + TEntity entity = getResolver().getJsonSerializer().deserialize(string, clazz); + result.set(entity); + } catch (Throwable e) { + result.setException(e); + } + } + + @Override + public void onFailure(Throwable throwable) { + result.setException(throwable); + } + }); + } + + /** + * Add byte array result callback. + * + * @param result the result + * @param future the future + */ + protected void addByteArrayResultCallback(final SettableFuture result, + ListenableFuture future) { + Futures.addCallback(future, new FutureCallback() { + @Override + public void onSuccess(byte[] payload) { + try { + result.set(payload); + } catch (Throwable e) { + result.setException(e); + } + } + + @Override + public void onFailure(Throwable throwable) { + result.setException(throwable); + } + }); + } + + /** + * Add null result callback. + * + * @param result the result + * @param future the future + */ + protected void addNullResultCallback(final SettableFuture result, ListenableFuture future) { + Futures.addCallback(future, new FutureCallback() { + @Override + public void onSuccess(ODataResponse response) { + result.set(null); + } + + @Override + public void onFailure(Throwable throwable) { + result.setException(throwable); + } + }); + } + + + + /** + * Sets selector url. + * + * @param url the url + * @param urlComponent the url component + * @param selectedId the selected id + */ + protected void setSelectorUrl(ODataURL url, String urlComponent, String selectedId) { + String selector = "('" + selectedId + "')"; + url.prependPathComponent(urlComponent + selector); + } +} diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataMediaEntityFetcher.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataMediaEntityFetcher.java new file mode 100755 index 00000000..f09a55f6 --- /dev/null +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataMediaEntityFetcher.java @@ -0,0 +1,81 @@ +/******************************************************************************* + * Copyright (c) Microsoft Open Technologies, Inc. + * All Rights Reserved + * See License.txt in the project root for license information. + ******************************************************************************/ +package com.microsoft.services.odata; + +import com.google.common.util.concurrent.FutureCallback; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.SettableFuture; +import com.microsoft.services.odata.interfaces.HttpVerb; +import com.microsoft.services.odata.interfaces.ODataResponse; +import com.microsoft.services.odata.interfaces.ODataURL; +import com.microsoft.services.odata.interfaces.Request; + + +/** + * The type ODataMediaEntityFetcher. + * + * @param the type parameter + * @param the type parameter + */ +public abstract class ODataMediaEntityFetcher + extends ODataEntityFetcher + implements Readable { + + /** + * Instantiates a new ODataMediaEntityFetcher. + * + * @param urlComponent the url component + * @param parent the parent + * @param clazz the clazz + * @param operationClazz the operation clazz + */ + + public ODataMediaEntityFetcher(String urlComponent, ODataExecutable parent, Class clazz, Class operationClazz) { + super(urlComponent, parent, clazz, operationClazz); + } + + public ListenableFuture getContent() { + + final SettableFuture result = SettableFuture.create(); + + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.GET); + ODataURL url = request.getUrl(); + url.appendPathComponent("$value"); + + ListenableFuture future = oDataExecute(request); + Futures.addCallback(future, new FutureCallback() { + @Override + public void onSuccess(ODataResponse response) { + result.set(response.getPayload()); + } + + @Override + public void onFailure(Throwable t) { + result.setException(t); + } + } + ); + return result; + } + + public ListenableFuture putContent(byte[] content) { + + Request request = getResolver().createRequest(); + request.setContent(content); + request.setVerb(HttpVerb.PUT); + ODataURL url = request.getUrl(); + url.appendPathComponent("$value"); + + ListenableFuture future = oDataExecute(request); + + SettableFuture result = SettableFuture.create(); + addNullResultCallback(result, future); + + return result; + } +} \ No newline at end of file diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataOperations.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataOperations.java new file mode 100755 index 00000000..4bc74547 --- /dev/null +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataOperations.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) Microsoft Open Technologies, Inc. + * All Rights Reserved + * See License.txt in the project root for license information. + ******************************************************************************/ +package com.microsoft.services.odata; + +import com.google.common.util.concurrent.FutureCallback; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.SettableFuture; +import com.microsoft.services.odata.interfaces.DependencyResolver; +import com.microsoft.services.odata.interfaces.ODataResponse; +import com.microsoft.services.odata.interfaces.Request; + +import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; + +/** + * The type ODataOperations. + */ +public abstract class ODataOperations extends ODataExecutable { + private String urlComponent; + private ODataExecutable parent; + + /** + * Instantiates a new ODataOperation. + * + * @param urlComponent the url component + * @param parent the parent + */ + public ODataOperations(String urlComponent, ODataExecutable parent) { + this.urlComponent = urlComponent; + this.parent = parent; + } + + @Override + protected ListenableFuture oDataExecute(Request request) { + request.getUrl().prependPathComponent(urlComponent); + addCustomParametersToODataURL(request.getUrl(), getParameters()); + return parent.oDataExecute(request); + } + + public void addEntityResultCallback(final SettableFuture result, + ListenableFuture future, + final Class clazz) { + Futures.addCallback(future, new FutureCallback() { + @Override + public void onSuccess(ODataResponse response) { + try { + String string = new String(response.getPayload(), Constants.UTF8_NAME); + TEntity entity = getResolver().getJsonSerializer().deserialize(string, clazz); + result.set(entity); + } catch (Throwable e) { + result.setException(e); + } + } + + @Override + public void onFailure(Throwable throwable) { + result.setException(throwable); + } + }); + } + + @Override + protected DependencyResolver getResolver() { + return parent.getResolver(); + } +} diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataResponseImpl.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataResponseImpl.java new file mode 100644 index 00000000..1b1c3cc6 --- /dev/null +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataResponseImpl.java @@ -0,0 +1,25 @@ +package com.microsoft.services.odata; + +import com.microsoft.services.odata.interfaces.ODataResponse; +import com.microsoft.services.odata.interfaces.Response; + +class ODataResponseImpl implements ODataResponse { + + private byte[] payload; + private Response response; + + public ODataResponseImpl(byte[] payload, Response response) { + this.payload = payload; + this.response = response; + } + + @Override + public byte[] getPayload() { + return this.payload; + } + + @Override + public Response getResponse() { + return this.response; + } +} diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/Readable.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/Readable.java similarity index 89% rename from sdk/file-services/src/main/java/com/microsoft/fileservices/odata/Readable.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/Readable.java index a97ee083..b3b957bd 100755 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/odata/Readable.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/Readable.java @@ -3,7 +3,7 @@ * All Rights Reserved * See License.txt in the project root for license information. ******************************************************************************/ -package com.microsoft.fileservices.odata; +package com.microsoft.services.odata; import com.google.common.util.concurrent.ListenableFuture; diff --git a/sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/ByteArrayTypeAdapterBase.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/ByteArrayTypeAdapterBase.java similarity index 100% rename from sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/ByteArrayTypeAdapterBase.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/ByteArrayTypeAdapterBase.java diff --git a/sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/CalendarTypeAdapter.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/CalendarTypeAdapter.java similarity index 99% rename from sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/CalendarTypeAdapter.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/CalendarTypeAdapter.java index c08783f0..a8923f2b 100644 --- a/sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/CalendarTypeAdapter.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/CalendarTypeAdapter.java @@ -28,14 +28,10 @@ public Calendar deserialize(JsonElement json, Type typeOfT, JsonDeserializationC } } - @Override public JsonElement serialize(Calendar src, Type typeOfSrc, JsonSerializationContext context) { String formatted = CalendarSerializer.serialize(src); return new JsonPrimitive(formatted); } - - - } diff --git a/sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/GsonSerializerBase.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/GsonSerializerBase.java similarity index 100% rename from sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/GsonSerializerBase.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/GsonSerializerBase.java diff --git a/sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/LoggerBase.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/LoggerBase.java similarity index 100% rename from sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/LoggerBase.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/LoggerBase.java diff --git a/sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/ODataURLImpl.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/ODataURLImpl.java similarity index 98% rename from sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/ODataURLImpl.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/ODataURLImpl.java index 4a4fabd7..cd363dd9 100644 --- a/sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/ODataURLImpl.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/ODataURLImpl.java @@ -1,4 +1,4 @@ -package com.microsoft.services.odata; +package com.microsoft.services.odata.impl; import com.microsoft.services.odata.interfaces.ODataURL; diff --git a/sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/http/BaseHttpTransport.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/BaseHttpTransport.java similarity index 100% rename from sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/http/BaseHttpTransport.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/BaseHttpTransport.java diff --git a/sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/http/CredentialsFactoryImpl.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/CredentialsFactoryImpl.java similarity index 100% rename from sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/http/CredentialsFactoryImpl.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/CredentialsFactoryImpl.java diff --git a/sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/http/EmptyResponse.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/EmptyResponse.java similarity index 100% rename from sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/http/EmptyResponse.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/EmptyResponse.java diff --git a/sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/http/NetworkRunnable.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/NetworkRunnable.java similarity index 96% rename from sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/http/NetworkRunnable.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/NetworkRunnable.java index 562152ca..1ff47c0c 100755 --- a/sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/http/NetworkRunnable.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/NetworkRunnable.java @@ -9,6 +9,7 @@ import com.google.common.util.concurrent.SettableFuture; import com.microsoft.services.odata.interfaces.Request; import com.microsoft.services.odata.interfaces.Response; + import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; diff --git a/sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/http/NetworkThread.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/NetworkThread.java similarity index 100% rename from sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/http/NetworkThread.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/NetworkThread.java diff --git a/sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/http/RequestImpl.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/RequestImpl.java similarity index 84% rename from sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/http/RequestImpl.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/RequestImpl.java index 68b2d784..977041b6 100755 --- a/sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/http/RequestImpl.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/RequestImpl.java @@ -5,7 +5,9 @@ ******************************************************************************/ package com.microsoft.services.odata.impl.http; +import com.microsoft.services.odata.impl.ODataURLImpl; import com.microsoft.services.odata.interfaces.HttpVerb; +import com.microsoft.services.odata.interfaces.ODataURL; import com.microsoft.services.odata.interfaces.Request; import java.util.HashMap; @@ -23,7 +25,7 @@ public class RequestImpl implements Request { private HashMap mHeaders = new HashMap(); - private String mUrl = ""; + private ODataURL mUrl = new ODataURLImpl(); /** * Sets the request content @@ -93,15 +95,16 @@ public HttpVerb getVerb() { /** * Sets the request URL - */ - public void setUrl(String url) { + * @param url + */ + public void setUrl(ODataURL url) { mUrl = url; } /** * Returns the request URL */ - public String getUrl() { + public ODataURL getUrl() { return mUrl; } } diff --git a/sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/http/ResponseImpl.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/ResponseImpl.java similarity index 100% rename from sdk/odata-engine-java-impl/src/main/java/com/microsoft/services/odata/impl/http/ResponseImpl.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/ResponseImpl.java diff --git a/sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/Base64Encoder.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/Base64Encoder.java similarity index 100% rename from sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/Base64Encoder.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/Base64Encoder.java diff --git a/sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/Credentials.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/Credentials.java similarity index 100% rename from sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/Credentials.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/Credentials.java diff --git a/sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/CredentialsFactory.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/CredentialsFactory.java similarity index 100% rename from sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/CredentialsFactory.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/CredentialsFactory.java diff --git a/sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/DependencyResolver.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/DependencyResolver.java similarity index 90% rename from sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/DependencyResolver.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/DependencyResolver.java index 0a0acd03..1eec5f17 100644 --- a/sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/DependencyResolver.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/DependencyResolver.java @@ -39,6 +39,13 @@ public interface DependencyResolver { */ ODataURL createODataURL(); + /** + * Create request. + * + * @return the request + */ + Request createRequest(); + /** * Gets the user agent for a specific platform * @param productName the product name diff --git a/sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/HttpTransport.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/HttpTransport.java similarity index 100% rename from sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/HttpTransport.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/HttpTransport.java diff --git a/sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/HttpVerb.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/HttpVerb.java similarity index 100% rename from sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/HttpVerb.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/HttpVerb.java diff --git a/sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/JsonSerializer.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/JsonSerializer.java similarity index 100% rename from sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/JsonSerializer.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/JsonSerializer.java diff --git a/sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/LogLevel.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/LogLevel.java similarity index 100% rename from sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/LogLevel.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/LogLevel.java diff --git a/sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/Logger.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/Logger.java similarity index 100% rename from sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/Logger.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/Logger.java diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/ODataResponse.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/ODataResponse.java new file mode 100644 index 00000000..c69b3d19 --- /dev/null +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/ODataResponse.java @@ -0,0 +1,21 @@ +package com.microsoft.services.odata.interfaces; + +/** + * The interface ODataResponse. + */ +public interface ODataResponse { + + /** + * Get payload. + * + * @return the byte [ ] + */ + public byte[] getPayload(); + + /** + * Gets response. + * + * @return the response + */ + public Response getResponse(); +} diff --git a/sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/ODataURL.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/ODataURL.java similarity index 100% rename from sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/ODataURL.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/ODataURL.java diff --git a/sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/Request.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/Request.java similarity index 94% rename from sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/Request.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/Request.java index 2b9ec91d..d209893a 100644 --- a/sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/Request.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/Request.java @@ -68,12 +68,12 @@ public interface Request { * * @param url the url */ - public void setUrl(String url); + public void setUrl(ODataURL url); /** * Gets url. * * @return the url */ - public String getUrl(); + public ODataURL getUrl(); } diff --git a/sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/Response.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/Response.java similarity index 93% rename from sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/Response.java rename to sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/Response.java index 76f54581..36483979 100644 --- a/sdk/odata-engine-interfaces/src/main/java/com/microsoft/services/odata/interfaces/Response.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/Response.java @@ -41,7 +41,7 @@ public interface Response { /** * Close void. * - * @throws IOException the iO exception + * @throws java.io.IOException the iO exception */ public void close() throws IOException; } diff --git a/sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/EntityCollectionFetcherHelper.java b/sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/EntityCollectionFetcherHelper.java deleted file mode 100644 index baa2c0d1..00000000 --- a/sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/EntityCollectionFetcherHelper.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.microsoft.services.odata; - -import com.google.common.util.concurrent.FutureCallback; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.SettableFuture; -import com.microsoft.services.odata.interfaces.DependencyResolver; - -import java.util.List; - -/** - * The type Entity collection fetcher helper. - */ -public class EntityCollectionFetcherHelper { - /** - * Add list result callback. - * - * @param the type parameter - * @param result the result - * @param future the future - * @param resolver the resolver - * @param clazz the clazz - */ - public static void addListResultCallback(final SettableFuture> result, ListenableFuture future, final DependencyResolver resolver, final Class clazz) { - Futures.addCallback(future, new FutureCallback() { - @Override - public void onSuccess(byte[] payload) { - List list; - try { - String string = new String(payload, Constants.UTF8_NAME); - list = resolver.getJsonSerializer().deserializeList(string, clazz); - result.set(list); - } catch (Throwable e) { - result.setException(e); - } - } - - @Override - public void onFailure(Throwable throwable) { - result.setException(throwable); - } - }); - } -} diff --git a/sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/EntityFetcherHelper.java b/sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/EntityFetcherHelper.java deleted file mode 100644 index f64e1ee7..00000000 --- a/sdk/odata-engine-helpers/src/main/java/com/microsoft/services/odata/EntityFetcherHelper.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.microsoft.services.odata; - -import com.google.common.util.concurrent.FutureCallback; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.SettableFuture; -import com.microsoft.services.odata.interfaces.DependencyResolver; -import com.microsoft.services.odata.interfaces.ODataURL; - -/** - * The type Entity fetcher helper. - */ -public class EntityFetcherHelper { - - /** - * Add entity result callback. - * - * @param the type parameter - * @param result the result - * @param future the future - * @param resolver the resolver - * @param clazz the clazz - */ - public static void addEntityResultCallback(final SettableFuture result, ListenableFuture future, final DependencyResolver resolver, final Class clazz) { - Futures.addCallback(future, new FutureCallback() { - @Override - public void onSuccess(byte[] payload) { - try { - String string = new String(payload, Constants.UTF8_NAME); - E entity = resolver.getJsonSerializer().deserialize(string, clazz); - result.set(entity); - } catch (Throwable e) { - result.setException(e); - } - } - - @Override - public void onFailure(Throwable throwable) { - result.setException(throwable); - } - }); - } - - /** - * Add byte array result callback. - * - * @param the type parameter - * @param result the result - * @param future the future - * @param resolver the resolver - * @param clazz the clazz - */ - public static void addByteArrayResultCallback(final SettableFuture result, ListenableFuture future, final DependencyResolver resolver, final Class clazz) { - Futures.addCallback(future, new FutureCallback() { - @Override - public void onSuccess(byte[] payload) { - try { - result.set(payload); - } catch (Throwable e) { - result.setException(e); - } - } - - @Override - public void onFailure(Throwable throwable) { - result.setException(throwable); - } - }); - } - - /** - * Add null result callback. - * - * @param the type parameter - * @param result the result - * @param future the future - */ - public static void addNullResultCallback(final SettableFuture result, ListenableFuture future) { - Futures.addCallback(future, new FutureCallback() { - @Override - public void onSuccess(byte[] payload) { - result.set(null); - } - - @Override - public void onFailure(Throwable throwable) { - result.setException(throwable); - } - }); - } - - /** - * Sets path for collections. - * - * @param url the url - * @param urlComponent the url component - * @param top the top - * @param skip the skip - * @param select the select - * @param expand the expand - * @param filter the filter - */ - public static void setPathForCollections(ODataURL url, String urlComponent, int top, int skip, String select, String expand, String filter) { - if (top > -1) { - url.addQueryStringParameter("$top", Integer.valueOf(top).toString()); - } - - if (skip> -1) { - url.addQueryStringParameter("$skip", Integer.valueOf(skip).toString()); - } - - if (select != null) { - url.addQueryStringParameter("$select", select); - } - - if (expand != null) { - url.addQueryStringParameter("$expand", expand); - } - - if (filter!= null) { - url.addQueryStringParameter("$filter", filter); - } - - url.prependPathComponent(urlComponent); - } - - /** - * Sets selector url. - * - * @param url the url - * @param urlComponent the url component - * @param selectedId the selected id - */ - public static void setSelectorUrl(ODataURL url, String urlComponent, String selectedId) { - String selector = "('" + selectedId + "')"; - url.prependPathComponent(urlComponent + selector); - } -} diff --git a/sdk/odata-engine-interfaces/build.gradle b/sdk/odata-engine-interfaces/build.gradle deleted file mode 100644 index daf676ea..00000000 --- a/sdk/odata-engine-interfaces/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -apply plugin: 'java' - -dependencies { - compile group: 'com.google.guava', name: 'guava', version: '18.0' -} - -apply from :'../java-libraries.gradle' \ No newline at end of file diff --git a/sdk/odata-engine-java-desktop-impl/.gitignore b/sdk/odata-engine-java-desktop-impl/.gitignore deleted file mode 100644 index 796b96d1..00000000 --- a/sdk/odata-engine-java-desktop-impl/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/sdk/odata-engine-java-impl/.gitignore b/sdk/odata-engine-java-impl/.gitignore deleted file mode 100644 index 796b96d1..00000000 --- a/sdk/odata-engine-java-impl/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/sdk/odata-engine-java-impl/build.gradle b/sdk/odata-engine-java-impl/build.gradle deleted file mode 100644 index e4002815..00000000 --- a/sdk/odata-engine-java-impl/build.gradle +++ /dev/null @@ -1,10 +0,0 @@ -apply plugin: 'java' - -dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile project(':odata-engine-helpers') - compile project(':odata-engine-interfaces') - compile 'com.google.code.gson:gson:2.3' -} - -apply from :'../java-libraries.gradle' \ No newline at end of file diff --git a/sdk/odata-engine-interfaces/.gitignore b/sdk/odata-engine-jvm-impl/.gitignore similarity index 100% rename from sdk/odata-engine-interfaces/.gitignore rename to sdk/odata-engine-jvm-impl/.gitignore diff --git a/sdk/odata-engine-java-desktop-impl/build.gradle b/sdk/odata-engine-jvm-impl/build.gradle similarity index 82% rename from sdk/odata-engine-java-desktop-impl/build.gradle rename to sdk/odata-engine-jvm-impl/build.gradle index d460943c..5245aded 100644 --- a/sdk/odata-engine-java-desktop-impl/build.gradle +++ b/sdk/odata-engine-jvm-impl/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'java' dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile project(':odata-engine-java-impl') + compile project(':odata-engine-core') compile group: 'org.apache.httpcomponents' , name: 'httpclient' , version: '4.3.5' } diff --git a/sdk/odata-engine-java-desktop-impl/src/main/java/com/microsoft/services/odata/impl/desktop/Base64EncoderImpl.java b/sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/Base64EncoderImpl.java similarity index 100% rename from sdk/odata-engine-java-desktop-impl/src/main/java/com/microsoft/services/odata/impl/desktop/Base64EncoderImpl.java rename to sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/Base64EncoderImpl.java diff --git a/sdk/odata-engine-java-desktop-impl/src/main/java/com/microsoft/services/odata/impl/desktop/ByteArrayTypeAdapterImpl.java b/sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/ByteArrayTypeAdapterImpl.java similarity index 100% rename from sdk/odata-engine-java-desktop-impl/src/main/java/com/microsoft/services/odata/impl/desktop/ByteArrayTypeAdapterImpl.java rename to sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/ByteArrayTypeAdapterImpl.java diff --git a/sdk/odata-engine-java-desktop-impl/src/main/java/com/microsoft/services/odata/impl/desktop/DesktopDependencyResolver.java b/sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/DesktopDependencyResolver.java similarity index 87% rename from sdk/odata-engine-java-desktop-impl/src/main/java/com/microsoft/services/odata/impl/desktop/DesktopDependencyResolver.java rename to sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/DesktopDependencyResolver.java index 492157e1..a928511b 100644 --- a/sdk/odata-engine-java-desktop-impl/src/main/java/com/microsoft/services/odata/impl/desktop/DesktopDependencyResolver.java +++ b/sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/DesktopDependencyResolver.java @@ -1,14 +1,15 @@ package com.microsoft.services.odata.impl.desktop; import com.microsoft.services.odata.Constants; -import com.microsoft.services.odata.ODataURLImpl; +import com.microsoft.services.odata.impl.ODataURLImpl; import com.microsoft.services.odata.impl.desktop.http.DesktopHttpTransport; -import com.microsoft.services.odata.impl.http.BaseHttpTransport; +import com.microsoft.services.odata.impl.http.RequestImpl; import com.microsoft.services.odata.interfaces.CredentialsFactory; import com.microsoft.services.odata.interfaces.DependencyResolver; import com.microsoft.services.odata.interfaces.HttpTransport; import com.microsoft.services.odata.interfaces.JsonSerializer; import com.microsoft.services.odata.interfaces.ODataURL; +import com.microsoft.services.odata.interfaces.Request; /** * The type Default dependency resolver. @@ -50,6 +51,11 @@ public ODataURL createODataURL() { return new ODataURLImpl(); } + @Override + public Request createRequest() { + return new RequestImpl(); + } + @Override public String getPlatformUserAgent(String productName) { diff --git a/sdk/odata-engine-java-desktop-impl/src/main/java/com/microsoft/services/odata/impl/desktop/GsonSerializer.java b/sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/GsonSerializer.java similarity index 100% rename from sdk/odata-engine-java-desktop-impl/src/main/java/com/microsoft/services/odata/impl/desktop/GsonSerializer.java rename to sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/GsonSerializer.java diff --git a/sdk/odata-engine-java-desktop-impl/src/main/java/com/microsoft/services/odata/impl/desktop/LoggerImpl.java b/sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/LoggerImpl.java similarity index 100% rename from sdk/odata-engine-java-desktop-impl/src/main/java/com/microsoft/services/odata/impl/desktop/LoggerImpl.java rename to sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/LoggerImpl.java diff --git a/sdk/odata-engine-java-desktop-impl/src/main/java/com/microsoft/services/odata/impl/desktop/http/DesktopHttpTransport.java b/sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/http/DesktopHttpTransport.java similarity index 100% rename from sdk/odata-engine-java-desktop-impl/src/main/java/com/microsoft/services/odata/impl/desktop/http/DesktopHttpTransport.java rename to sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/http/DesktopHttpTransport.java diff --git a/sdk/odata-engine-java-desktop-impl/src/main/java/com/microsoft/services/odata/impl/desktop/http/DesktopNetworkRunnable.java b/sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/http/DesktopNetworkRunnable.java similarity index 99% rename from sdk/odata-engine-java-desktop-impl/src/main/java/com/microsoft/services/odata/impl/desktop/http/DesktopNetworkRunnable.java rename to sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/http/DesktopNetworkRunnable.java index 5bcacbb9..cac77d2c 100644 --- a/sdk/odata-engine-java-desktop-impl/src/main/java/com/microsoft/services/odata/impl/desktop/http/DesktopNetworkRunnable.java +++ b/sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/http/DesktopNetworkRunnable.java @@ -37,7 +37,7 @@ public void run() { client = HttpClients.createDefault(); - BasicHttpEntityEnclosingRequest realRequest = new BasicHttpEntityEnclosingRequest(mRequest.getVerb().toString(), mRequest.getUrl()); + BasicHttpEntityEnclosingRequest realRequest = new BasicHttpEntityEnclosingRequest(mRequest.getVerb().toString(), mRequest.getUrl().toString()); EntityEnclosingRequestWrapper wrapper = new EntityEnclosingRequestWrapper(realRequest); Map headers = mRequest.getHeaders(); diff --git a/sdk/outlook-services/build.gradle b/sdk/outlook-services/build.gradle index db1a1a32..c7efda61 100644 --- a/sdk/outlook-services/build.gradle +++ b/sdk/outlook-services/build.gradle @@ -2,8 +2,7 @@ apply plugin: 'java' dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile project(':odata-engine-interfaces') - compile project(':odata-engine-helpers') + compile project(':odata-engine-core') } apply from :'../java-libraries.gradle' \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/AttachmentCollectionOperations.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/AttachmentCollectionOperations.java index 22bfe863..9a14c44d 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/AttachmentCollectionOperations.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/AttachmentCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,10 +34,22 @@ public AttachmentCollectionOperations(String urlComponent, ODataExecutable paren * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public AttachmentCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } + public AttachmentCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public AttachmentCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } } diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/AttachmentFetcher.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/AttachmentFetcher.java index df60724a..9d924ac2 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/AttachmentFetcher.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/AttachmentFetcher.java @@ -6,6 +6,8 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import com.microsoft.outlookservices.*; @@ -23,13 +25,39 @@ public class AttachmentFetcher extends ODataEntityFetcher oDataExecute(ODataURL path, byte[] content, HttpVerb verb, Map headers) { - Map newHeaders = new HashMap(getCustomHeaders()); - newHeaders.putAll(headers); - return BaseODataContainerHelper.oDataExecute(path, content, verb, url, newHeaders, getResolver(), this.getClass().getCanonicalName()); - } - - @Override - DependencyResolver getResolver() { - return resolver; - } -} \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/CalendarCollectionOperations.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/CalendarCollectionOperations.java index 76ab4042..f6faeb98 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/CalendarCollectionOperations.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/CalendarCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,10 +34,22 @@ public CalendarCollectionOperations(String urlComponent, ODataExecutable parent) * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public CalendarCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } + public CalendarCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public CalendarCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } } diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/CalendarFetcher.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/CalendarFetcher.java index bd853395..89776ae0 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/CalendarFetcher.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/CalendarFetcher.java @@ -6,6 +6,8 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import com.microsoft.outlookservices.*; @@ -23,10 +25,34 @@ public class CalendarFetcher extends ODataEntityFetcher * @param parent the parent */ public EntityFetcher(String urlComponent, ODataExecutable parent) { - super(urlComponent, parent, Entity.class,EntityOperations.class); + super(urlComponent, parent, Entity.class, EntityOperations.class); } - public UserFetcher asUser(){ - return new UserFetcher(this.urlComponent, this.parent); - } - public FolderFetcher asFolder(){ - return new FolderFetcher(this.urlComponent, this.parent); - } - public ItemFetcher asItem(){ - return new ItemFetcher(this.urlComponent, this.parent); - } - public AttachmentFetcher asAttachment(){ - return new AttachmentFetcher(this.urlComponent, this.parent); - } - public CalendarFetcher asCalendar(){ - return new CalendarFetcher(this.urlComponent, this.parent); - } - public CalendarGroupFetcher asCalendarGroup(){ - return new CalendarGroupFetcher(this.urlComponent, this.parent); - } - public ContactFolderFetcher asContactFolder(){ - return new ContactFolderFetcher(this.urlComponent, this.parent); - } - } \ No newline at end of file + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public EntityFetcher addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public EntityFetcher addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } + + + public UserFetcher asUser(){ + return new UserFetcher(this.urlComponent, this.parent); + } + + public FolderFetcher asFolder(){ + return new FolderFetcher(this.urlComponent, this.parent); + } + + public ItemFetcher asItem(){ + return new ItemFetcher(this.urlComponent, this.parent); + } + + public AttachmentFetcher asAttachment(){ + return new AttachmentFetcher(this.urlComponent, this.parent); + } + + public CalendarFetcher asCalendar(){ + return new CalendarFetcher(this.urlComponent, this.parent); + } + + public CalendarGroupFetcher asCalendarGroup(){ + return new CalendarGroupFetcher(this.urlComponent, this.parent); + } + + public ContactFolderFetcher asContactFolder(){ + return new ContactFolderFetcher(this.urlComponent, this.parent); + } + } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/EntityOperations.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/EntityOperations.java index ff6bd177..cd60a218 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/EntityOperations.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/EntityOperations.java @@ -6,12 +6,11 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; /** @@ -25,19 +24,32 @@ public class EntityOperations extends ODataOperations { * @param urlComponent the url component * @param parent the parent */ - public EntityOperations(String urlComponent, ODataExecutable parent) { + public EntityOperations(String urlComponent, ODataExecutable parent) { super(urlComponent, parent); } - /** - * Add parameter. - * - * @param name the name - * @param value the value - * @return the entity operations. - */ - public EntityOperations addParameter(String name, Object value) { - addCustomParameter(name, value); + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the operations + */ + public EntityOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the operations + */ + public EntityOperations addHeader(String name, String value) { + addCustomHeader(name, value); return this; - } + } + } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/EventCollectionOperations.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/EventCollectionOperations.java index da8f1fbb..c081bbd4 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/EventCollectionOperations.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/EventCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,10 +34,22 @@ public EventCollectionOperations(String urlComponent, ODataExecutable parent) { * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public EventCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } + public EventCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public EventCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } } diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/EventFetcher.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/EventFetcher.java index 1f443b8c..765a1c53 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/EventFetcher.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/EventFetcher.java @@ -6,6 +6,8 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import com.microsoft.outlookservices.*; @@ -23,10 +25,34 @@ public class EventFetcher extends ODataEntityFetcher * @param parent the parent */ public EventFetcher(String urlComponent, ODataExecutable parent) { - super(urlComponent, parent, Event.class,EventOperations.class); + super(urlComponent, parent, Event.class, EventOperations.class); } - /** + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public EventFetcher addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public EventFetcher addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } + + /** * Gets attachments. * * @return the attachments @@ -48,7 +74,7 @@ public AttachmentFetcher getAttachment(String id){ * * @return the calendar */ - public CalendarFetcher getCalendar() { + public CalendarFetcher getCalendar() { return new CalendarFetcher("Calendar", this); } /** diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/EventOperations.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/EventOperations.java index 510306b8..b147bafb 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/EventOperations.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/EventOperations.java @@ -6,12 +6,11 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; /** @@ -25,85 +24,95 @@ public class EventOperations extends ItemOperations { * @param urlComponent the url component * @param parent the parent */ - public EventOperations(String urlComponent, ODataExecutable parent) { + public EventOperations(String urlComponent, ODataExecutable parent) { super(urlComponent, parent); } - /** - * Add parameter. - * - * @param name the name - * @param value the value - * @return the event operations. - */ - public EventOperations addParameter(String name, Object value) { - addCustomParameter(name, value); + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the operations + */ + public EventOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the operations + */ + public EventOperations addHeader(String name, String value) { + addCustomHeader(name, value); return this; - } - + } + + /** * Accept listenable future. * @param comment the comment - * @return the listenable future - */ - public ListenableFuture accept(String comment) { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("Comment", comment); - - ODataURL url = getResolver().createODataURL(); - - url.appendPathComponent("Accept"); + * @return the listenable future + */ + public ListenableFuture accept(String comment) { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + map.put("Comment", comment); - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.POST, getCustomHeaders()); - - addEntityResultCallback(result, future, getResolver(), Integer.class); - - return result; + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + request.getUrl().appendPathComponent("Accept"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, Integer.class); + + return result; } - + /** * Decline listenable future. * @param comment the comment - * @return the listenable future - */ - public ListenableFuture decline(String comment) { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("Comment", comment); - - ODataURL url = getResolver().createODataURL(); - - url.appendPathComponent("Decline"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.POST, getCustomHeaders()); + * @return the listenable future + */ + public ListenableFuture decline(String comment) { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + map.put("Comment", comment); - addEntityResultCallback(result, future, getResolver(), Integer.class); - - return result; + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + request.getUrl().appendPathComponent("Decline"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, Integer.class); + + return result; } - + /** * TentativelyAccept listenable future. * @param comment the comment - * @return the listenable future - */ - public ListenableFuture tentativelyAccept(String comment) { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("Comment", comment); - - ODataURL url = getResolver().createODataURL(); - - url.appendPathComponent("TentativelyAccept"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.POST, getCustomHeaders()); - - addEntityResultCallback(result, future, getResolver(), Integer.class); + * @return the listenable future + */ + public ListenableFuture tentativelyAccept(String comment) { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + map.put("Comment", comment); - return result; + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + request.getUrl().appendPathComponent("TentativelyAccept"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, Integer.class); + + return result; } } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/FileAttachmentCollectionOperations.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/FileAttachmentCollectionOperations.java index 21fd4d92..f29bc6c2 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/FileAttachmentCollectionOperations.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/FileAttachmentCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,10 +34,22 @@ public FileAttachmentCollectionOperations(String urlComponent, ODataExecutable p * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public FileAttachmentCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } + public FileAttachmentCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public FileAttachmentCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } } diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/FileAttachmentFetcher.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/FileAttachmentFetcher.java index 08f1476e..04ac9b11 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/FileAttachmentFetcher.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/FileAttachmentFetcher.java @@ -6,6 +6,8 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import com.microsoft.outlookservices.*; @@ -23,7 +25,31 @@ public class FileAttachmentFetcher extends ODataEntityFetcher * @param parent the parent */ public FolderFetcher(String urlComponent, ODataExecutable parent) { - super(urlComponent, parent, Folder.class,FolderOperations.class); + super(urlComponent, parent, Folder.class, FolderOperations.class); } - /** + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public FolderFetcher addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public FolderFetcher addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } + + /** * Gets child folders. * * @return the child folders diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/FolderOperations.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/FolderOperations.java index 3880de4a..aa612667 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/FolderOperations.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/FolderOperations.java @@ -6,12 +6,11 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; /** @@ -25,63 +24,74 @@ public class FolderOperations extends EntityOperations { * @param urlComponent the url component * @param parent the parent */ - public FolderOperations(String urlComponent, ODataExecutable parent) { + public FolderOperations(String urlComponent, ODataExecutable parent) { super(urlComponent, parent); } - /** - * Add parameter. - * - * @param name the name - * @param value the value - * @return the folder operations. - */ - public FolderOperations addParameter(String name, Object value) { - addCustomParameter(name, value); + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the operations + */ + public FolderOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the operations + */ + public FolderOperations addHeader(String name, String value) { + addCustomHeader(name, value); return this; - } - + } + + /** * Copy listenable future. * @param destinationId the destinationId - * @return the listenable future - */ - public ListenableFuture copy(String destinationId) { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("DestinationId", destinationId); + * @return the listenable future + */ + public ListenableFuture copy(String destinationId) { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + map.put("DestinationId", destinationId); - ODataURL url = getResolver().createODataURL(); - - url.appendPathComponent("Copy"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.POST, getCustomHeaders()); - - addEntityResultCallback(result, future, getResolver(), Folder.class); - - return result; + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + request.getUrl().appendPathComponent("Copy"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, Folder.class); + + return result; } - + /** * Move listenable future. * @param destinationId the destinationId - * @return the listenable future - */ - public ListenableFuture move(String destinationId) { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("DestinationId", destinationId); - - ODataURL url = getResolver().createODataURL(); - - url.appendPathComponent("Move"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.POST, getCustomHeaders()); - - addEntityResultCallback(result, future, getResolver(), Folder.class); + * @return the listenable future + */ + public ListenableFuture move(String destinationId) { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + map.put("DestinationId", destinationId); - return result; + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + request.getUrl().appendPathComponent("Move"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, Folder.class); + + return result; } } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ItemAttachmentCollectionOperations.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ItemAttachmentCollectionOperations.java index 179bddfe..cc0a658e 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ItemAttachmentCollectionOperations.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ItemAttachmentCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,10 +34,22 @@ public ItemAttachmentCollectionOperations(String urlComponent, ODataExecutable p * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public ItemAttachmentCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } + public ItemAttachmentCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public ItemAttachmentCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } } diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ItemAttachmentFetcher.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ItemAttachmentFetcher.java index 34169c02..6334d1b9 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ItemAttachmentFetcher.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ItemAttachmentFetcher.java @@ -6,6 +6,8 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import com.microsoft.outlookservices.*; @@ -23,15 +25,39 @@ public class ItemAttachmentFetcher extends ODataEntityFetcher * @param parent the parent */ public ItemFetcher(String urlComponent, ODataExecutable parent) { - super(urlComponent, parent, Item.class,ItemOperations.class); + super(urlComponent, parent, Item.class, ItemOperations.class); } - public MessageFetcher asMessage(){ - return new MessageFetcher(this.urlComponent, this.parent); - } - public EventFetcher asEvent(){ - return new EventFetcher(this.urlComponent, this.parent); - } - public ContactFetcher asContact(){ - return new ContactFetcher(this.urlComponent, this.parent); - } - } \ No newline at end of file + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public ItemFetcher addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public ItemFetcher addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } + + + public MessageFetcher asMessage(){ + return new MessageFetcher(this.urlComponent, this.parent); + } + + public EventFetcher asEvent(){ + return new EventFetcher(this.urlComponent, this.parent); + } + + public ContactFetcher asContact(){ + return new ContactFetcher(this.urlComponent, this.parent); + } + } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ItemOperations.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ItemOperations.java index e0dcbdce..2d036fa3 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ItemOperations.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ItemOperations.java @@ -6,12 +6,11 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; /** @@ -25,19 +24,32 @@ public class ItemOperations extends EntityOperations { * @param urlComponent the url component * @param parent the parent */ - public ItemOperations(String urlComponent, ODataExecutable parent) { + public ItemOperations(String urlComponent, ODataExecutable parent) { super(urlComponent, parent); } - /** - * Add parameter. - * - * @param name the name - * @param value the value - * @return the item operations. - */ - public ItemOperations addParameter(String name, Object value) { - addCustomParameter(name, value); + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the operations + */ + public ItemOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the operations + */ + public ItemOperations addHeader(String name, String value) { + addCustomHeader(name, value); return this; - } + } + } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/MessageCollectionOperations.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/MessageCollectionOperations.java index b8b6c61c..b280ffbd 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/MessageCollectionOperations.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/MessageCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,10 +34,22 @@ public MessageCollectionOperations(String urlComponent, ODataExecutable parent) * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public MessageCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } + public MessageCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public MessageCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } } diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/MessageFetcher.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/MessageFetcher.java index ece40610..1c109ede 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/MessageFetcher.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/MessageFetcher.java @@ -6,6 +6,8 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import com.microsoft.outlookservices.*; @@ -23,10 +25,34 @@ public class MessageFetcher extends ODataEntityFetcher copy(String destinationId) { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("DestinationId", destinationId); - - ODataURL url = getResolver().createODataURL(); - - url.appendPathComponent("Copy"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.POST, getCustomHeaders()); - - addEntityResultCallback(result, future, getResolver(), Message.class); - - return result; + * @return the listenable future + */ + public ListenableFuture copy(String destinationId) { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + map.put("DestinationId", destinationId); + + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + request.getUrl().appendPathComponent("Copy"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, Message.class); + + return result; } - + /** * Move listenable future. * @param destinationId the destinationId - * @return the listenable future - */ - public ListenableFuture move(String destinationId) { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("DestinationId", destinationId); - - ODataURL url = getResolver().createODataURL(); - - url.appendPathComponent("Move"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.POST, getCustomHeaders()); - - addEntityResultCallback(result, future, getResolver(), Message.class); - - return result; + * @return the listenable future + */ + public ListenableFuture move(String destinationId) { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + map.put("DestinationId", destinationId); + + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + request.getUrl().appendPathComponent("Move"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, Message.class); + + return result; } - + /** * CreateReply listenable future. - * @return the listenable future - */ - public ListenableFuture createReply() { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - - ODataURL url = getResolver().createODataURL(); - - url.appendPathComponent("CreateReply"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.POST, getCustomHeaders()); - - addEntityResultCallback(result, future, getResolver(), Message.class); - - return result; + * @return the listenable future + */ + public ListenableFuture createReply() { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + request.getUrl().appendPathComponent("CreateReply"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, Message.class); + + return result; } - + /** * CreateReplyAll listenable future. - * @return the listenable future - */ - public ListenableFuture createReplyAll() { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - - ODataURL url = getResolver().createODataURL(); - - url.appendPathComponent("CreateReplyAll"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.POST, getCustomHeaders()); - - addEntityResultCallback(result, future, getResolver(), Message.class); - - return result; + * @return the listenable future + */ + public ListenableFuture createReplyAll() { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + request.getUrl().appendPathComponent("CreateReplyAll"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, Message.class); + + return result; } - + /** * CreateForward listenable future. - * @return the listenable future - */ - public ListenableFuture createForward() { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - - ODataURL url = getResolver().createODataURL(); - - url.appendPathComponent("CreateForward"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.POST, getCustomHeaders()); - - addEntityResultCallback(result, future, getResolver(), Message.class); - - return result; + * @return the listenable future + */ + public ListenableFuture createForward() { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + request.getUrl().appendPathComponent("CreateForward"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, Message.class); + + return result; } - + /** * Reply listenable future. * @param comment the comment - * @return the listenable future - */ - public ListenableFuture reply(String comment) { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("Comment", comment); - - ODataURL url = getResolver().createODataURL(); - - url.appendPathComponent("Reply"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.POST, getCustomHeaders()); - - addEntityResultCallback(result, future, getResolver(), Integer.class); - - return result; + * @return the listenable future + */ + public ListenableFuture reply(String comment) { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + map.put("Comment", comment); + + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + request.getUrl().appendPathComponent("Reply"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, Integer.class); + + return result; } - + /** * ReplyAll listenable future. * @param comment the comment - * @return the listenable future - */ - public ListenableFuture replyAll(String comment) { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("Comment", comment); - - ODataURL url = getResolver().createODataURL(); - - url.appendPathComponent("ReplyAll"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.POST, getCustomHeaders()); - - addEntityResultCallback(result, future, getResolver(), Integer.class); - - return result; + * @return the listenable future + */ + public ListenableFuture replyAll(String comment) { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + map.put("Comment", comment); + + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + request.getUrl().appendPathComponent("ReplyAll"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, Integer.class); + + return result; } - + /** * Forward listenable future. * @param comment the comment * @param toRecipients the toRecipients - * @return the listenable future - */ - public ListenableFuture forward(String comment, java.util.List toRecipients) { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("Comment", comment); + * @return the listenable future + */ + public ListenableFuture forward(String comment, java.util.List toRecipients) { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + map.put("Comment", comment); map.put("ToRecipients", toRecipients); - ODataURL url = getResolver().createODataURL(); - - url.appendPathComponent("Forward"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.POST, getCustomHeaders()); - - addEntityResultCallback(result, future, getResolver(), Integer.class); - - return result; + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + request.getUrl().appendPathComponent("Forward"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, Integer.class); + + return result; } - + /** * Send listenable future. - * @return the listenable future - */ - public ListenableFuture send() { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - - ODataURL url = getResolver().createODataURL(); - - url.appendPathComponent("Send"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.POST, getCustomHeaders()); - - addEntityResultCallback(result, future, getResolver(), Integer.class); - - return result; + * @return the listenable future + */ + public ListenableFuture send() { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + request.getUrl().appendPathComponent("Send"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, Integer.class); + + return result; } } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataCollectionFetcher.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataCollectionFetcher.java deleted file mode 100755 index 2fbec028..00000000 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataCollectionFetcher.java +++ /dev/null @@ -1,207 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.outlookservices.odata; - -import com.google.common.util.concurrent.*; -import com.microsoft.services.odata.interfaces.*; - -import static com.microsoft.services.odata.EntityCollectionFetcherHelper.addListResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.setPathForCollections; -import static com.microsoft.services.odata.EntityFetcherHelper.setSelectorUrl; -import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; -import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; -import java.util.*; - -/** - * The type ODataCollectionFetcher. - * @param the type parameter - * @param the type parameter - * @param the type parameter - */ -public class ODataCollectionFetcher extends ODataExecutable implements Readable> { - - private int top = -1; - private int skip = -1; - private String selectedId = null; - private String urlComponent; - private ODataExecutable parent; - private Class clazz; - private TOperation operations; - private String select = null; - private String expand = null; - private String filter = null; - - private ODataEntityFetcher fetcher = null; - - /** - * Instantiates a new ODataCollectionFetcher. - * - * @param urlComponent the url component - * @param parent the parent - * @param clazz the clazz - * @param operationClazz the operation clazz - */ - @SuppressWarnings("unchecked") - public ODataCollectionFetcher(String urlComponent, ODataExecutable parent, - Class clazz, Class operationClazz) { - this.urlComponent = urlComponent; - this.parent = parent; - this.clazz = clazz; - - this.reset(); - - try { - this.operations = operationClazz.getConstructor(String.class, - ODataExecutable.class).newInstance("", this); - - String packageName = this.operations.getClass().getPackage().getName(); - String[] classNameParts = (clazz.getCanonicalName() + "Fetcher").split("\\."); - String className = packageName + "." + classNameParts[classNameParts.length - 1]; - Class entityQueryClass = Class.forName(className); - this.fetcher = (ODataEntityFetcher) entityQueryClass.getConstructor(String.class, ODataExecutable.class) - .newInstance("", this); - } catch (Throwable t) { - throw new RuntimeException(t); - } - } - - /** - * Reset void. - */ - public void reset() { - this.top = -1; - this.skip = -1; - this.selectedId = null; - this.select = null; - this.expand = null; - this.filter = null; - } - - /** - * Top ODataCollectionFetcher. - * - * @param top the top - * @return the o data collection fetcher - */ - public ODataCollectionFetcher top(int top) { - this.top = top; - return this; - } - - /** - * Skip ODataCollectionFetcher. - * - * @param skip the skip - * @return the o data collection fetcher - */ - public ODataCollectionFetcher skip(int skip) { - this.skip = skip; - return this; - } - - /** - * Select ODataCollectionFetcher. - * - * @param select the select - * @return the o data collection fetcher - */ - public ODataCollectionFetcher select(String select) { - this.select = select; - return this; - } - - /** - * Expand ODataCollectionFetcher. - * - * @param expand the expand - * @return the o data collection fetcher - */ - public ODataCollectionFetcher expand(String expand) { - this.expand = expand; - return this; - } - - /** - * Filter ODataCollectionFetcher. - * - * @param filter the filter - * @return the o data collection fetcher - */ - public ODataCollectionFetcher filter(String filter) { - this.filter = filter; - return this; - } - - /** - * Gets by id. - * - * @param id the id - * @return the by id - */ - @SuppressWarnings("unchecked") - public TFetcher getById(String id) { - this.selectedId = id; - try { - return (TFetcher) this.fetcher; - } catch (Throwable e) { - // if this happens, we couldn't find the xxxQuery class at runtime. - // this must NEVER happen - throw new RuntimeException(e); - } - } - - @Override - ListenableFuture oDataExecute(ODataURL path, byte[] content, HttpVerb verb, Map headers) { - if (selectedId == null) { - setPathForCollections(path, urlComponent, top, skip, select, expand, filter); - } else { - setSelectorUrl(path, urlComponent, selectedId); - } - addCustomParametersToODataURL(path, getCustomParameters(), getResolver()); - Map newHeaders = new HashMap(getCustomHeaders()); - newHeaders.putAll(headers); - return parent.oDataExecute(path, content, verb, newHeaders); - } - - @Override - public DependencyResolver getResolver() { - return parent.getResolver(); - } - - @Override - public ListenableFuture> read() { - final SettableFuture> result = SettableFuture.create(); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), null, HttpVerb.GET, getCustomHeaders()); - addListResultCallback(result, future, getResolver(), clazz); - - return result; - } - - /** - * Add listenable future. - * - * @param entity the entity - * @return the listenable future - */ - public ListenableFuture add(TEntity entity) { - final SettableFuture result = SettableFuture.create(); - byte[] payloadBytes = serializeToJsonByteArray(entity, getResolver()); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), payloadBytes, HttpVerb.POST, getCustomHeaders()); - addEntityResultCallback(result, future, getResolver(), clazz); - - return result; - } - - /** - * Gets operations. - * - * @return the operations - */ - public TOperation getOperations() { - return this.operations; - } -} \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataEntityFetcher.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataEntityFetcher.java deleted file mode 100755 index 316c30d3..00000000 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataEntityFetcher.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.outlookservices.odata; - -import com.google.common.util.concurrent.*; -import com.microsoft.services.odata.interfaces.*; - -import java.util.HashMap; -import java.util.Map; - -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addNullResultCallback; -import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; -import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; - -/** - * The type ODataEntityFetcher. - * @param the type parameter - * @param the type parameter - */ -public abstract class ODataEntityFetcher extends ODataExecutable implements Readable { - - protected String urlComponent; - protected ODataExecutable parent; - private Class clazz; - private TOperation operations; - - /** - * Instantiates a new ODataEntityFetcher. - * - * @param urlComponent the url component - * @param parent the parent - * @param clazz the clazz - * @param operationClazz the operation clazz - */ - public ODataEntityFetcher(String urlComponent, ODataExecutable parent, Class clazz, Class operationClazz) { - this.urlComponent = urlComponent; - this.parent = parent; - this.clazz = clazz; - - try { - this.operations = operationClazz.getConstructor(String.class, - ODataExecutable.class).newInstance("", this); - } catch (Throwable ignored) { - } - } - - public ODataEntityFetcher addHeader(String name, String value) { - this.addCustomHeader(name, value); - return this; - } - - @Override - ListenableFuture oDataExecute(ODataURL path, byte[] content, HttpVerb verb, Map headers) { - path.prependPathComponent(urlComponent); - addCustomParametersToODataURL(path, getCustomParameters(), getResolver()); - Map newHeaders = new HashMap(getCustomHeaders()); - newHeaders.putAll(headers); - return parent.oDataExecute(path, content, verb, newHeaders); - } - - @Override - DependencyResolver getResolver() { - return parent.getResolver(); - } - - /** - * Updates the given entity. - * - * @param updatedEntity the updated entity - * @return the listenable future - */ - public ListenableFuture update(TEntity updatedEntity) { - final SettableFuture result = SettableFuture.create(); - byte[] payloadBytes = serializeToJsonByteArray(updatedEntity, getResolver()); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), payloadBytes, HttpVerb.PATCH, getCustomHeaders()); - addEntityResultCallback(result, future, getResolver(), clazz); - return result; - } - - /** - * Deletes - * - * @return the listenable future - */ - public ListenableFuture delete() { - final SettableFuture result = SettableFuture.create(); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), null, HttpVerb.DELETE, getCustomHeaders()); - addNullResultCallback(result, future); - return result; - } - - /** - * Reads - * - * @return the listenable future - */ - public ListenableFuture read() { - final SettableFuture result = SettableFuture.create(); - ListenableFuture future = oDataExecute(getResolver().createODataURL(), null, HttpVerb.GET, getCustomHeaders()); - addEntityResultCallback(result, future, getResolver(), clazz); - return result; - } - - /** - * Gets operations. - * - * @return the operations - */ - public TOperation getOperations() { - return this.operations; - } -} \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataExecutable.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataExecutable.java deleted file mode 100755 index 2abacf65..00000000 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataExecutable.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.outlookservices.odata; - -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.services.odata.interfaces.*; -import java.util.*; - -/** - * The type ODataExecutable. - */ -abstract class ODataExecutable { - - /** - * oDataExecute. - * - * @param path the path - * @param content the content - * @param verb the verb - * @return the listenable future - */ - abstract ListenableFuture oDataExecute(ODataURL path, byte[] content, HttpVerb verb, Map headers); - - /** - * Gets resolver. - * - * @return the resolver - */ - abstract DependencyResolver getResolver(); - - /** - * The Custom parameters. - */ - Map customParameters = new HashMap(); - - /** - * The Custom headers. - */ - Map customHeaders = new HashMap(); - - /** - * Add custom parameter. - * - * @param name the name - * @param value the value - */ - void addCustomParameter(String name, Object value) { - this.customParameters.put(name, value); - } - - /** - * Gets custom parameters. - * - * @return the custom parameters - */ - Map getCustomParameters() { - return this.customParameters; - } - - - /** - * Add custom headers. - * - * @param name the name - * @param value the value - */ - void addCustomHeader(String name, String value) { - this.customHeaders.put(name, value); - } - - /** - * Gets custom headers. - * - * @return the custom headers - */ - Map getCustomHeaders() { - return this.customHeaders; - } -} diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataMediaEntityFetcher.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataMediaEntityFetcher.java deleted file mode 100755 index 872b76d5..00000000 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataMediaEntityFetcher.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.outlookservices.odata; - -import com.google.common.util.concurrent.*; -import com.microsoft.services.odata.interfaces.*; - -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addNullResultCallback; -import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; -import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; - -/** - * The type ODataMediaEntityFetcher. - * @param the type parameter - * @param the type parameter - */ -public abstract class ODataMediaEntityFetcher extends ODataEntityFetcher implements Readable { - - /** - * Instantiates a new ODataMediaEntityFetcher. - * - * @param urlComponent the url component - * @param parent the parent - * @param clazz the clazz - * @param operationClazz the operation clazz - */ - - public ODataMediaEntityFetcher(String urlComponent, ODataExecutable parent, Class clazz, Class operationClazz) { - super(urlComponent, parent, clazz, operationClazz); - } - - public ListenableFuture getContent() { - ODataURL url = getResolver().createODataURL(); - url.appendPathComponent("$value"); - return oDataExecute(url, null, HttpVerb.GET, getCustomHeaders()); - } - - public ListenableFuture putContent(byte[] content) { - ODataURL url = getResolver().createODataURL(); - url.appendPathComponent("$value"); - ListenableFuture future = oDataExecute(url, content, HttpVerb.PUT, getCustomHeaders()); - - SettableFuture result = SettableFuture.create(); - addNullResultCallback(result, future); - - return result; - } -} \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataOperations.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataOperations.java deleted file mode 100755 index a12cfb0d..00000000 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/ODataOperations.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.outlookservices.odata; - -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.services.odata.interfaces.*; -import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; -import java.util.*; - -/** - * The type ODataOperations. - */ -public abstract class ODataOperations extends ODataExecutable { - private String urlComponent; - private ODataExecutable parent; - - /** - * Instantiates a new ODataOperation. - * - * @param urlComponent the url component - * @param parent the parent - */ - public ODataOperations(String urlComponent, ODataExecutable parent) { - this.urlComponent = urlComponent; - this.parent = parent; - } - - @Override - ListenableFuture oDataExecute(ODataURL path, byte[] content, HttpVerb verb, Map headers) { - path.prependPathComponent(urlComponent); - addCustomParametersToODataURL(path, getCustomParameters(), getResolver()); - Map newHeaders = new HashMap(getCustomHeaders()); - newHeaders.putAll(headers); - return parent.oDataExecute(path, content, verb, newHeaders); - } - - @Override - DependencyResolver getResolver() { - return parent.getResolver(); - } -} diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/OutlookClient.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/OutlookClient.java index b0a844ee..01c7cebf 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/OutlookClient.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/OutlookClient.java @@ -5,16 +5,16 @@ ******************************************************************************/ package com.microsoft.outlookservices.odata; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.DependencyResolver; import com.microsoft.outlookservices.*; -import com.microsoft.outlookservices.odata.*; /** * The type OutlookClient. */ public class OutlookClient extends BaseODataContainer { - /** + /** * Instantiates a new OutlookClient. * * @param url the url @@ -23,7 +23,32 @@ public class OutlookClient extends BaseODataContainer { public OutlookClient(String url, DependencyResolver resolver) { super(url, resolver); } - /** + + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the client + */ + public OutlookClient addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the client + */ + public OutlookClient addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } + + /** * Gets Me. * * @return the Me @@ -31,17 +56,12 @@ public OutlookClient(String url, DependencyResolver resolver) { public UserFetcher getMe() { return new UserFetcher("Me", this); } - /** + /** * Gets User. * * @return the User */ - public ODataCollectionFetcher getUsers() { + public ODataCollectionFetcher getUsers() { return new ODataCollectionFetcher("Users", this, User.class,UserCollectionOperations.class); } - - public UserFetcher getUsers(String id) { - return new ODataCollectionFetcher("Users", - this, User.class, UserCollectionOperations.class).getById(id); - } } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/Readable.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/Readable.java deleted file mode 100755 index 3c817e19..00000000 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/Readable.java +++ /dev/null @@ -1,16 +0,0 @@ -/******************************************************************************* - * Copyright (c) Microsoft Open Technologies, Inc. - * All Rights Reserved - * See License.txt in the project root for license information. - ******************************************************************************/ -package com.microsoft.outlookservices.odata; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * The interface Readable. - * @param the type parameter - */ -public interface Readable { - public ListenableFuture read(); -} diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/UserCollectionOperations.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/UserCollectionOperations.java index d33ac0d4..6aa61789 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/UserCollectionOperations.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/UserCollectionOperations.java @@ -6,12 +6,12 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; + /** @@ -34,10 +34,22 @@ public UserCollectionOperations(String urlComponent, ODataExecutable parent) { * * @param name the name * @param value the value - * @return the file attachment collection operations + * @return the collection operations */ - public UserCollectionOperations addParameter(String name, Object value) { - addCustomParameter(name, value); - return this; - } + public UserCollectionOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the collection operations + */ + public UserCollectionOperations addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } } diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/UserFetcher.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/UserFetcher.java index 290495f0..8579745b 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/UserFetcher.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/UserFetcher.java @@ -6,6 +6,8 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; +import com.microsoft.services.odata.Readable; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import com.microsoft.outlookservices.*; @@ -23,10 +25,34 @@ public class UserFetcher extends ODataEntityFetcher * @param parent the parent */ public UserFetcher(String urlComponent, ODataExecutable parent) { - super(urlComponent, parent, User.class,UserOperations.class); + super(urlComponent, parent, User.class, UserOperations.class); } - /** + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public UserFetcher addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the fetcher + */ + public UserFetcher addHeader(String name, String value) { + addCustomHeader(name, value); + return this; + } + + /** * Gets folders. * * @return the folders @@ -65,7 +91,7 @@ public MessageFetcher getMessage(String id){ * * @return the root folder */ - public FolderFetcher getRootFolder() { + public FolderFetcher getRootFolder() { return new FolderFetcher("RootFolder", this); } /** @@ -90,7 +116,7 @@ public CalendarFetcher getCalendar(String id){ * * @return the calendar */ - public CalendarFetcher getCalendar() { + public CalendarFetcher getCalendar() { return new CalendarFetcher("Calendar", this); } /** diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/UserOperations.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/UserOperations.java index 62556693..127cb406 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/UserOperations.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/odata/UserOperations.java @@ -6,12 +6,11 @@ package com.microsoft.outlookservices.odata; import com.google.common.util.concurrent.*; +import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import com.microsoft.outlookservices.*; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; import static com.microsoft.services.odata.Helpers.getFunctionParameters; -import static com.microsoft.services.odata.EntityFetcherHelper.addEntityResultCallback; -import static com.microsoft.services.odata.EntityFetcherHelper.addByteArrayResultCallback; /** @@ -25,43 +24,55 @@ public class UserOperations extends EntityOperations { * @param urlComponent the url component * @param parent the parent */ - public UserOperations(String urlComponent, ODataExecutable parent) { + public UserOperations(String urlComponent, ODataExecutable parent) { super(urlComponent, parent); } - /** - * Add parameter. - * - * @param name the name - * @param value the value - * @return the user operations. - */ - public UserOperations addParameter(String name, Object value) { - addCustomParameter(name, value); + /** + * Add parameter. + * + * @param name the name + * @param value the value + * @return the operations + */ + public UserOperations addParameter(String name, Object value) { + addCustomParameter(name, value); + return this; + } + + /** + * Add header. + * + * @param name the name + * @param value the value + * @return the operations + */ + public UserOperations addHeader(String name, String value) { + addCustomHeader(name, value); return this; - } - + } + + /** * SendMail listenable future. * @param message the message * @param saveToSentItems the saveToSentItems - * @return the listenable future - */ - public ListenableFuture sendMail(Message message, Boolean saveToSentItems) { - final SettableFuture result = SettableFuture.create(); - java.util.Map map = new java.util.HashMap(); - map.put("Message", message); + * @return the listenable future + */ + public ListenableFuture sendMail(Message message, Boolean saveToSentItems) { + final SettableFuture result = SettableFuture.create(); + java.util.Map map = new java.util.HashMap(); + map.put("Message", message); map.put("SaveToSentItems", saveToSentItems); - ODataURL url = getResolver().createODataURL(); - - url.appendPathComponent("SendMail"); - - ListenableFuture future = oDataExecute(url, serializeToJsonByteArray(map, getResolver()), HttpVerb.POST, getCustomHeaders()); - - addEntityResultCallback(result, future, getResolver(), Integer.class); - - return result; + Request request = getResolver().createRequest(); + request.setVerb(HttpVerb.POST); + request.setContent(serializeToJsonByteArray(map, getResolver())); + request.getUrl().appendPathComponent("SendMail"); + ListenableFuture future = oDataExecute(request); + addEntityResultCallback(result, future, Integer.class); + + return result; } } \ No newline at end of file diff --git a/sdk/settings.gradle b/sdk/settings.gradle index 78f3b62d..9ad875dc 100644 --- a/sdk/settings.gradle +++ b/sdk/settings.gradle @@ -1,10 +1,10 @@ include ':list-services', - ':odata-engine-android-impl', - ':odata-engine-interfaces', - ':odata-engine-java-impl', - ':odata-engine-helpers', + ':outlook-services', + ':file-services', ':directory-services', ':discovery-services', - ':odata-engine-java-desktop-impl', - ':outlook-services', - ':file-services' + ':odata-engine-core', + ':odata-engine-android-impl', + ':odata-engine-jvm-impl' + + diff --git a/tests/e2e-test-app/app/build.gradle b/tests/e2e-test-app/app/build.gradle index 9c3c9444..8ccf1700 100644 --- a/tests/e2e-test-app/app/build.gradle +++ b/tests/e2e-test-app/app/build.gradle @@ -38,10 +38,10 @@ dependencies { compile('com.microsoft.aad:adal:(,2.0)') { exclude group: 'com.android.support' } - compile project(':outlook-services') - compile project(':file-services') compile project(':odata-engine-android-impl') + compile project(':outlook-services') compile project(':directory-services') - compile project(':list-services') compile project(':discovery-services') + compile project(':list-services') + compile project(':file-services') } diff --git a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/TestPlatformContext.java b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/TestPlatformContext.java index afd68dc3..77dfeb27 100644 --- a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/TestPlatformContext.java +++ b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/TestPlatformContext.java @@ -1,27 +1,31 @@ package com.microsoft.office365.test.integration; -import java.util.concurrent.Future; - - import com.microsoft.directoryservices.odata.DirectoryClient; import com.microsoft.discoveryservices.odata.DiscoveryClient; -import com.microsoft.listservices.SharepointClient; import com.microsoft.listservices.SharepointListsClient; import com.microsoft.office365.test.integration.framework.TestCase; import com.microsoft.office365.test.integration.framework.TestExecutionCallback; import com.microsoft.outlookservices.odata.OutlookClient; import com.microsoft.sharepointservices.odata.SharePointClient; +import java.util.concurrent.Future; + +//import com.microsoft.directoryservices.odata.DirectoryClient; +//import com.microsoft.discoveryservices.odata.DiscoveryClient; +//import com.microsoft.listservices.SharepointClient; +//import com.microsoft.listservices.SharepointListsClient; +//import com.microsoft.sharepointservices.odata.SharePointClient; + public interface TestPlatformContext { - String getExchangeServerUrl(); + String getExchangeServerUrl(); String getFileServerUrl(); - String getClientId(); + String getClientId(); - String getRedirectUrl(); + String getRedirectUrl(); String getExchangeEndpointUrl(); @@ -45,13 +49,13 @@ public interface TestPlatformContext { String getDirectoryServerUrl(); - Future showMessage(String message); + Future showMessage(String message); - void executeTest(TestCase testCase, TestExecutionCallback callback); + void executeTest(TestCase testCase, TestExecutionCallback callback); - void sleep(int seconds) throws Exception; + void sleep(int seconds) throws Exception; - String getAuthenticationMethod(); + String getAuthenticationMethod(); OutlookClient getMailCalendarContactClient(); diff --git a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/android/AndroidTestPlatformContext.java b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/android/AndroidTestPlatformContext.java index 48cab573..4e7b8beb 100644 --- a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/android/AndroidTestPlatformContext.java +++ b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/android/AndroidTestPlatformContext.java @@ -28,6 +28,7 @@ import com.microsoft.services.odata.interfaces.LogLevel; import com.microsoft.sharepointservices.odata.SharePointClient; + public class AndroidTestPlatformContext implements TestPlatformContext { private static Activity mActivity; @@ -60,7 +61,7 @@ public String getSharepointServerUrl() { } @Override - public String getDiscoveryServerUrl(){ + public String getDiscoveryServerUrl() { return PreferenceManager.getDefaultSharedPreferences(mActivity).getString(Constants.PREFERENCE_DISCOVERY_RESOURCE_URL, ""); } @@ -192,7 +193,7 @@ public void sleep(int seconds) throws Exception { @Override public OutlookClient getMailCalendarContactClient() { - return getExchangeEntityContainerClientAAD(); + return getExchangeEntityContainerClientAAD(); } @Override @@ -206,7 +207,9 @@ public SharepointListsClient getSharePointListClient() { } @Override - public DiscoveryClient getDiscoveryClient() { return getDiscoveryClientAAD(); } + public DiscoveryClient getDiscoveryClient() { + return getDiscoveryClientAAD(); + } @Override public DirectoryClient getDirectoryClient() { @@ -235,7 +238,7 @@ private TClient getTClientAAD(String serverUrl, final String endpointU try { getAuthenticationContext().acquireToken( mActivity, serverUrl, - getClientId(),getRedirectUrl(), PromptBehavior.Auto, + getClientId(), getRedirectUrl(), PromptBehavior.Auto, new AuthenticationCallback() { @Override @@ -255,6 +258,7 @@ public void onSuccess(AuthenticationResult result) { } }); + } catch (Throwable t) { future.setException(t); } @@ -266,12 +270,12 @@ public void onSuccess(AuthenticationResult result) { } } - private SharepointListsClient getSharePointListClientAAD(){ + private SharepointListsClient getSharePointListClientAAD() { final SettableFuture future = SettableFuture.create(); try { getAuthenticationContext().acquireToken( mActivity, getSharepointServerUrl(), - getClientId(),getRedirectUrl(), PromptBehavior.Auto, + getClientId(), getRedirectUrl(), PromptBehavior.Auto, new AuthenticationCallback() { @Override diff --git a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/android/MainActivity.java b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/android/MainActivity.java index 874e56c7..2572f16a 100644 --- a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/android/MainActivity.java +++ b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/android/MainActivity.java @@ -19,8 +19,6 @@ */ package com.microsoft.office365.test.integration.android; -import java.util.List; - import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; @@ -48,27 +46,29 @@ import com.microsoft.office365.test.integration.framework.TestResult; import com.microsoft.office365.test.integration.framework.TestResultsPostManager; import com.microsoft.office365.test.integration.tests.AllTests; -import com.microsoft.office365.test.integration.tests.ExchangeTests; import com.microsoft.office365.test.integration.tests.DirectoryTests; import com.microsoft.office365.test.integration.tests.DiscoveryTests; +import com.microsoft.office365.test.integration.tests.ExchangeTests; import com.microsoft.office365.test.integration.tests.FilesTests; import com.microsoft.office365.test.integration.tests.ListsTests; +import java.util.List; + @SuppressWarnings("deprecation") public class MainActivity extends Activity { - private String mPostUrl = ""; - private boolean mIsAutomatedRun = false; - private StringBuilder mLog; + private String mPostUrl = ""; + private boolean mIsAutomatedRun = false; + private StringBuilder mLog; - private ListView mTestCaseList; + private ListView mTestCaseList; - private Spinner mTestGroupSpinner; + private Spinner mTestGroupSpinner; - @Override - public void onConfigurationChanged(Configuration newConfig) { - // don't restart the activity. Just process the configuration change - super.onConfigurationChanged(newConfig); - } + @Override + public void onConfigurationChanged(Configuration newConfig) { + // don't restart the activity. Just process the configuration change + super.onConfigurationChanged(newConfig); + } @Override protected void onCreate(Bundle savedInstanceState) { @@ -87,49 +87,49 @@ protected void onCreate(Bundle savedInstanceState) { AndroidTestPlatformContext testPlatformContext = new AndroidTestPlatformContext(this); ApplicationContext.setTestPlatformContext(testPlatformContext); - setContentView(R.layout.activity_main); + setContentView(R.layout.activity_main); - mTestCaseList = (ListView) findViewById(R.id.testCaseList); - TestCaseAdapter testCaseAdapter = new TestCaseAdapter(this, R.layout.row_list_test_case); - mTestCaseList.setAdapter(testCaseAdapter); + mTestCaseList = (ListView) findViewById(R.id.testCaseList); + TestCaseAdapter testCaseAdapter = new TestCaseAdapter(this, R.layout.row_list_test_case); + mTestCaseList.setAdapter(testCaseAdapter); - mTestGroupSpinner = (Spinner) findViewById(R.id.testGroupSpinner); + mTestGroupSpinner = (Spinner) findViewById(R.id.testGroupSpinner); - ArrayAdapter testGroupAdapter = new ArrayAdapter(this, - android.R.layout.simple_spinner_item); - mTestGroupSpinner.setAdapter(testGroupAdapter); - mTestGroupSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + ArrayAdapter testGroupAdapter = new ArrayAdapter(this, + android.R.layout.simple_spinner_item); + mTestGroupSpinner.setAdapter(testGroupAdapter); + mTestGroupSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { - @Override - public void onItemSelected(AdapterView parent, View view, int pos, long id) { - selectTestGroup(pos); - } + @Override + public void onItemSelected(AdapterView parent, View view, int pos, long id) { + selectTestGroup(pos); + } - @Override - public void onNothingSelected(AdapterView arg0) { - // do nothing - } - }); + @Override + public void onNothingSelected(AdapterView arg0) { + // do nothing + } + }); - refreshTestGroupsAndLog(); + refreshTestGroupsAndLog(); - checkForCIServer(); - } + checkForCIServer(); + } - private void selectTestGroup(int pos) { - TestGroup tg = (TestGroup) mTestGroupSpinner.getItemAtPosition(pos); - List testCases = tg.getTestCases(); + private void selectTestGroup(int pos) { + TestGroup tg = (TestGroup) mTestGroupSpinner.getItemAtPosition(pos); + List testCases = tg.getTestCases(); - fillTestList(testCases); - } + fillTestList(testCases); + } - @SuppressWarnings("unchecked") - private void refreshTestGroupsAndLog() { - mLog = new StringBuilder(); + @SuppressWarnings("unchecked") + private void refreshTestGroupsAndLog() { + mLog = new StringBuilder(); - ArrayAdapter adapter = (ArrayAdapter) mTestGroupSpinner.getAdapter(); - adapter.clear(); - adapter.add(new AllTests()); + ArrayAdapter adapter = (ArrayAdapter) mTestGroupSpinner.getAdapter(); + adapter.clear(); + adapter.add(new AllTests()); adapter.add(new ExchangeTests()); adapter.add(new FilesTests()); adapter.add(new ListsTests()); diff --git a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/AllTests.java b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/AllTests.java index cbe63a35..ccade568 100644 --- a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/AllTests.java +++ b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/AllTests.java @@ -1,33 +1,32 @@ package com.microsoft.office365.test.integration.tests; -import java.util.ArrayList; -import java.util.List; - import com.microsoft.office365.test.integration.framework.TestCase; import com.microsoft.office365.test.integration.framework.TestGroup; +import java.util.ArrayList; +import java.util.List; + public class AllTests extends TestGroup { - public AllTests() { - super("All available tests"); + public AllTests() { + super("All available tests"); - for (TestGroup testGroup : getTestGroups()) { - for (TestCase testCase : testGroup.getTestCases()){ - this.addTest(testCase); - } - } - } + for (TestGroup testGroup : getTestGroups()) { + for (TestCase testCase : testGroup.getTestCases()) { + this.addTest(testCase); + } + } + } - private List getTestGroups(){ + private List getTestGroups() { - List testGroups = new ArrayList(); + List testGroups = new ArrayList(); testGroups.add(new ExchangeTests()); testGroups.add(new FilesTests()); testGroups.add(new ListsTests()); testGroups.add(new DiscoveryTests()); testGroups.add(new DirectoryTests()); - - return testGroups; - } + return testGroups; + } } diff --git a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/DirectoryTests.java b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/DirectoryTests.java index a82ea014..80de1cb2 100644 --- a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/DirectoryTests.java +++ b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/DirectoryTests.java @@ -1,3 +1,4 @@ + package com.microsoft.office365.test.integration.tests; import com.microsoft.directoryservices.Application; @@ -57,6 +58,7 @@ public DirectoryTests() { // ********* Users Tests ************* + private TestCase canGetUsers(String name, boolean enabled) { TestCase test = new TestCase() { @@ -229,6 +231,8 @@ public TestResult executeTest() { test.setEnabled(enabled); return test; } + //* + // ********* Application Tests ************* @@ -606,3 +610,4 @@ private User getUser(){ return user; } } + diff --git a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/DiscoveryTests.java b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/DiscoveryTests.java index 4045c506..fe6c509a 100644 --- a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/DiscoveryTests.java +++ b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/DiscoveryTests.java @@ -9,7 +9,6 @@ import com.microsoft.office365.test.integration.framework.TestResult; import com.microsoft.office365.test.integration.framework.TestStatus; -import java.text.SimpleDateFormat; import java.util.List; public class DiscoveryTests extends TestGroup { @@ -43,7 +42,7 @@ public TestResult executeTest() { List allServices = client.getallServices().read().get(); //Assert - if(allServices != null && allServices.size() > 0) + if (allServices != null && allServices.size() > 0) result.setStatus(TestStatus.Passed); return result; @@ -74,7 +73,7 @@ public TestResult executeTest() { List services = client.getservices().read().get(); //Assert - if(services != null && services.size() > 0) + if (services != null && services.size() > 0) result.setStatus(TestStatus.Passed); return result; @@ -106,11 +105,11 @@ public TestResult executeTest() { //Act ServiceInfo service = null; - if(services.size() > 0) + if (services.size() > 0) service = client.getservices().getById(services.get(0).getentityKey()).read().get(); //Assert - if(service != null && service.getserviceId() != null) + if (service != null && service.getserviceId() != null) result.setStatus(TestStatus.Passed); return result; @@ -137,7 +136,6 @@ public TestResult executeTest() { result.setTestCase(this); - DiscoveryClient client = ApplicationContext.getDiscoveryClient(); //Prepare @@ -150,7 +148,7 @@ public TestResult executeTest() { .read().get(); //Assert - if(filteredServices.size() == 1) + if (filteredServices.size() == 1) result.setStatus(TestStatus.Passed); return result; @@ -187,7 +185,7 @@ public TestResult executeTest() { .read().get(); //Assert - if(filteredServices.size() > 0 && !filteredServices.get(0).getproviderName().equals("") && filteredServices.get(0).getserviceName() == null) + if (filteredServices.size() > 0 && !filteredServices.get(0).getproviderName().equals("") && filteredServices.get(0).getserviceName() == null) result.setStatus(TestStatus.Passed); return result; @@ -221,7 +219,7 @@ public TestResult executeTest() { .read().get(); //Assert - if(filteredServices.size() == 1) + if (filteredServices.size() == 1) result.setStatus(TestStatus.Passed); return result; diff --git a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java index 24dd840d..dc93f2d0 100644 --- a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java +++ b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java @@ -226,7 +226,8 @@ public TestResult executeTest() { result.setStatus(TestStatus.Passed); result.setTestCase(this); - String newFolderName = "TestFolder" + UUID.randomUUID();; + String newFolderName = "TestFolder" + UUID.randomUUID(); + ; String parentFolderName = "Inbox"; //Prepare for test @@ -292,7 +293,8 @@ public TestResult executeTest() { result.setStatus(TestStatus.Failed); result.setTestCase(this); - String newFolderName = "TestFolder" + UUID.randomUUID();; + String newFolderName = "TestFolder" + UUID.randomUUID(); + ; String parentFolderName = "Inbox"; String destinationFolderName = "Drafts"; @@ -361,7 +363,8 @@ public TestResult executeTest() { result.setStatus(TestStatus.Failed); result.setTestCase(this); - String newFolderName = "TestFolder" + UUID.randomUUID();; + String newFolderName = "TestFolder" + UUID.randomUUID(); + ; String parentFolderName = "Inbox"; String destinationFolderName = "Drafts"; @@ -438,8 +441,10 @@ public TestResult executeTest() { result.setStatus(TestStatus.Passed); result.setTestCase(this); - String folderName = "TestFolder" + UUID.randomUUID();; - String updatedFolderName = "UpdatedTestFolder" + UUID.randomUUID();; + String folderName = "TestFolder" + UUID.randomUUID(); + ; + String updatedFolderName = "UpdatedTestFolder" + UUID.randomUUID(); + ; String parentFolderName = "Inbox"; //Create new folder @@ -507,8 +512,7 @@ public TestResult executeTest() { OutlookClient client = ApplicationContext.getMailCalendarContactClient(); List inboxMessages = client.getMe().getFolders().getById("Inbox").getMessages().top(3).read().get(); - if(inboxMessages.size()== 0) - { + if (inboxMessages.size() == 0) { String mailSubject = "Test get Message"; Message message = getSampleMessage(mailSubject, ApplicationContext.getTestMail(), ""); @@ -697,7 +701,7 @@ public TestResult executeTest() { //Assert Message storedMessage = client.getMe().getMessages().getById(added.getId()).read().get(); - if(!storedMessage.getHasAttachments()) + if (!storedMessage.getHasAttachments()) result.setStatus(TestStatus.Failed); return result; @@ -1008,8 +1012,7 @@ public TestResult executeTest() { OutlookClient client = ApplicationContext.getMailCalendarContactClient(); List inboxMessages = client.getMe().getFolders().getById("Inbox").getMessages().top(1).read().get(); - if(inboxMessages.size()== 0) - { + if (inboxMessages.size() == 0) { String mailSubject = "Test reply Message"; Message message = getSampleMessage(mailSubject, ApplicationContext.getTestMail(), ""); client.getMe().getOperations().sendMail(message, true).get(); @@ -1033,12 +1036,12 @@ public TestResult executeTest() { .getMessages().read().get(); boolean exists = false; - for(Message m : messages){ - if(m.getConversationId().equals(messageToReply.getConversationId())) + for (Message m : messages) { + if (m.getConversationId().equals(messageToReply.getConversationId())) exists = true; } - if(!exists) + if (!exists) result.setStatus(TestStatus.Failed); //Cleanup @@ -1076,8 +1079,7 @@ public TestResult executeTest() { OutlookClient client = ApplicationContext.getMailCalendarContactClient(); List inboxMessages = client.getMe().getFolders().getById("Inbox").getMessages().top(1).read().get(); - if(inboxMessages.size()== 0) - { + if (inboxMessages.size() == 0) { String mailSubject = "Test reply all Message"; Message message = getSampleMessage(mailSubject, ApplicationContext.getTestMail(), ""); client.getMe().getOperations().sendMail(message, true).get(); @@ -1101,12 +1103,12 @@ public TestResult executeTest() { .getMessages().read().get(); boolean exists = false; - for(Message m : messages){ - if(m.getConversationId().equals(messageToReply.getConversationId())) + for (Message m : messages) { + if (m.getConversationId().equals(messageToReply.getConversationId())) exists = true; } - if(!exists) + if (!exists) result.setStatus(TestStatus.Failed); //Cleanup @@ -1144,8 +1146,7 @@ public TestResult executeTest() { OutlookClient client = ApplicationContext.getMailCalendarContactClient(); List inboxMessages = client.getMe().getFolders().getById("Inbox").getMessages().top(1).read().get(); - if(inboxMessages.size()== 0) - { + if (inboxMessages.size() == 0) { String mailSubject = "Test fw Message"; Message message = getSampleMessage(mailSubject, ApplicationContext.getTestMail(), ""); @@ -1170,12 +1171,12 @@ public TestResult executeTest() { .getMessages().read().get(); boolean exists = false; - for(Message m : messages){ - if(m.getConversationId().equals(messageToReply.getConversationId())) + for (Message m : messages) { + if (m.getConversationId().equals(messageToReply.getConversationId())) exists = true; } - if(!exists) + if (!exists) result.setStatus(TestStatus.Failed); //Cleanup @@ -1200,7 +1201,7 @@ public TestResult executeTest() { return test; } - private Message getSampleMessage(String subject, String to, String cc){ + private Message getSampleMessage(String subject, String to, String cc) { Message m = new Message(); // To Recipient final Recipient toRecipient = new Recipient(); @@ -1212,7 +1213,7 @@ private Message getSampleMessage(String subject, String to, String cc){ m.setToRecipients(toRecipients); // CC recipient - if(!cc.isEmpty()){ + if (!cc.isEmpty()) { final Recipient ccRecipient = new Recipient(); EmailAddress ccEmailAddress = new EmailAddress(); ccEmailAddress.setAddress(cc); @@ -1261,7 +1262,7 @@ public TestResult executeTest() { .add(calendarGroup).get(); //Assert - if(!addedCalendarGroup.getName().equals(calendarGroup.getName())) + if (!addedCalendarGroup.getName().equals(calendarGroup.getName())) result.setStatus(TestStatus.Failed); //Cleanup @@ -1304,7 +1305,7 @@ public TestResult executeTest() { List calendarGroups = client.getMe().getCalendarGroups().read().get(); //Assert - if(calendarGroups.size() == 0) + if (calendarGroups.size() == 0) result.setStatus(TestStatus.Failed); //Cleanup @@ -1348,7 +1349,7 @@ public TestResult executeTest() { .getById(addedCalendarGroup.getId()).read().get(); //Assert - if(!storedCalendarGroup.getName().equals(addedCalendarGroup.getName())) + if (!storedCalendarGroup.getName().equals(addedCalendarGroup.getName())) result.setStatus(TestStatus.Failed); //Cleanup @@ -1394,7 +1395,7 @@ public TestResult executeTest() { .update(calendarGroup).get(); //Assert - if(!updatedCalendarGroup.getName().equals("Updated Calendar Group")) + if (!updatedCalendarGroup.getName().equals("Updated Calendar Group")) result.setStatus(TestStatus.Failed); //Cleanup @@ -1443,8 +1444,7 @@ public TestResult executeTest() { try { client.getMe().getCalendarGroups() .getById(addedCalendarGroup.getId()).read().get(); - } - catch (Exception e){ + } catch (Exception e) { //It's supposed to fail result.setStatus(TestStatus.Passed); } @@ -1485,7 +1485,7 @@ public TestResult executeTest() { List calendars = client.getMe().getCalendars().read().get(); //Assert - if(calendars.size() == 0) + if (calendars.size() == 0) result.setStatus(TestStatus.Failed); //Cleanup @@ -1521,7 +1521,7 @@ public TestResult executeTest() { Calendar calendar = client.getMe().getCalendar().read().get(); //Assert - if(calendar.getName().equals("")) + if (calendar.getName().equals("")) result.setStatus(TestStatus.Failed); return result; @@ -1557,7 +1557,7 @@ public TestResult executeTest() { .add(calendar).get(); //Assert - if(!addedCalendar.getName().equals(calendar.getName())) + if (!addedCalendar.getName().equals(calendar.getName())) result.setStatus(TestStatus.Failed); //Cleanup @@ -1602,7 +1602,7 @@ public TestResult executeTest() { .getById(addedCalendar.getId()).read().get(); //Assert - if(!storedCalendar.getName().equals(addedCalendar.getName())) + if (!storedCalendar.getName().equals(addedCalendar.getName())) result.setStatus(TestStatus.Failed); //Cleanup @@ -1650,7 +1650,7 @@ public TestResult executeTest() { .update(calendar).get(); //Assert - if(!updatedCalendar.getName().equals(updatedCalendarName)) + if (!updatedCalendar.getName().equals(updatedCalendarName)) result.setStatus(TestStatus.Failed); //Cleanup @@ -1699,8 +1699,7 @@ public TestResult executeTest() { try { client.getMe().getCalendars() .getById(addedCalendar.getId()).read().get(); - } - catch (Exception e){ + } catch (Exception e) { //It's supposed to fail result.setStatus(TestStatus.Passed); } @@ -1789,7 +1788,7 @@ public TestResult executeTest() { List events = client.getMe().getCalendars().getById("Calendar").getEvents().read().get(); //Assert - if(events.size() == 0) + if (events.size() == 0) result.setStatus(TestStatus.Failed); //Cleanup @@ -1830,7 +1829,7 @@ public TestResult executeTest() { Event addedEvent = client.getMe().getCalendars().getById("Calendar").getEvents().add(event).get(); //Assert - if(!addedEvent.getSubject().equals(event.getSubject())) + if (!addedEvent.getSubject().equals(event.getSubject())) result.setStatus(TestStatus.Failed); //Cleanup @@ -1874,7 +1873,7 @@ public TestResult executeTest() { Event updatedEvent = client.getMe().getEvents().getById(addedEvent.getId()).update(event).get(); //Assert - if(updatedEvent.getImportance() != Importance.Low || !updatedEvent.getSubject().equals("Updated Subject")) + if (updatedEvent.getImportance() != Importance.Low || !updatedEvent.getSubject().equals("Updated Subject")) result.setStatus(TestStatus.Failed); //Cleanup @@ -1921,8 +1920,7 @@ public TestResult executeTest() { try { client.getMe().getEvents() .getById(addedEvent.getId()).read().get(); - } - catch (Exception e){ + } catch (Exception e) { //It's supposed to fail result.setStatus(TestStatus.Passed); } @@ -1962,14 +1960,14 @@ public TestResult executeTest() { .getOperations().accept("Accepted").get(); //Assert - if(!addedEvent.getSubject().equals(event.getSubject())) + if (!addedEvent.getSubject().equals(event.getSubject())) result.setStatus(TestStatus.Failed); //Cleanup client.getMe() - .getEvents() - .getById(addedEvent.getId()) - .delete().get(); + .getEvents() + .getById(addedEvent.getId()) + .delete().get(); return result; } catch (Exception e) { @@ -1983,7 +1981,7 @@ public TestResult executeTest() { return test; } - private Event getSampleEvent(){ + private Event getSampleEvent() { Event event = new Event(); event.setSubject("Today's appointment"); event.setStart(java.util.Calendar.getInstance()); @@ -2028,7 +2026,7 @@ public TestResult executeTest() { .getContacts().read().get(); //Assert - if(contacts == null) + if (contacts == null) result.setStatus(TestStatus.Failed); return result; @@ -2062,7 +2060,7 @@ public TestResult executeTest() { List contacts = client.getMe().getContacts().top(2).read().get(); //Assert - if(contacts.size() == 0 || contacts.size() >2) + if (contacts.size() == 0 || contacts.size() > 2) result.setStatus(TestStatus.Failed); //Cleanup @@ -2100,7 +2098,7 @@ public TestResult executeTest() { .getById(addedContact.getId()).read().get(); //Assert - if(!storedContact.getId().equals(addedContact.getId())) + if (!storedContact.getId().equals(addedContact.getId())) result.setStatus(TestStatus.Failed); //Cleanup @@ -2139,13 +2137,12 @@ public TestResult executeTest() { List contacts = client.getMe().getContacts().read().get(); boolean exists = false; - for(Contact c : contacts) - { - if(c.getId().equals(addedContact.getId())) + for (Contact c : contacts) { + if (c.getId().equals(addedContact.getId())) exists = true; } - if(exists) + if (exists) result.setStatus(TestStatus.Failed); return result; @@ -2184,7 +2181,7 @@ public TestResult executeTest() { .getById(addedContact.getId()).read().get(); //Assert - if(!updatedContact.getId().equals(addedContact.getId()) || !updatedContact.getGivenName().equals("Updated given name")) + if (!updatedContact.getId().equals(addedContact.getId()) || !updatedContact.getGivenName().equals("Updated given name")) result.setStatus(TestStatus.Failed); //Cleanup @@ -2201,7 +2198,7 @@ public TestResult executeTest() { return test; } - private Contact getContact(){ + private Contact getContact() { final Contact newContact = new Contact(); newContact.setDisplayName("Test Contact"); newContact.setGivenName("Test Contact Name"); @@ -2245,7 +2242,7 @@ public TestResult executeTest() { .read().get(); //Assert - if(messages.size() == 1) + if (messages.size() == 1) result.setStatus(TestStatus.Passed); //Cleanup @@ -2288,7 +2285,7 @@ public TestResult executeTest() { .read().get(); //Assert - if(messages.size() > 0 && !messages.get(0).getSubject().equals("") && messages.get(0).getDateTimeReceived() == null) + if (messages.size() > 0 && !messages.get(0).getSubject().equals("") && messages.get(0).getDateTimeReceived() == null) result.setStatus(TestStatus.Passed); //Cleanup @@ -2333,7 +2330,7 @@ public TestResult executeTest() { .read().get(); //Assert - if(messages.size() == 1 && messages.get(0).getSubject().equals(subject)) + if (messages.size() == 1 && messages.get(0).getSubject().equals(subject)) result.setStatus(TestStatus.Passed); //Cleanup diff --git a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/FilesTests.java b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/FilesTests.java index 23c8952c..f36ae8bc 100644 --- a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/FilesTests.java +++ b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/FilesTests.java @@ -12,10 +12,7 @@ import com.microsoft.services.odata.Constants; import com.microsoft.sharepointservices.odata.SharePointClient; -import java.text.SimpleDateFormat; import java.util.List; -import java.util.Locale; -import java.util.TimeZone; import java.util.UUID; @@ -51,7 +48,7 @@ public TestResult executeTest() { List files = client.getfiles().read().get(); //Assert - if(files == null) + if (files == null) result.setStatus(TestStatus.Failed); return result; @@ -87,11 +84,11 @@ public TestResult executeTest() { File storedFile = client.getfiles().getById(addedFile.getid()).asFile().read().get(); //Assert - if(storedFile == null) + if (storedFile == null) result.setStatus(TestStatus.Failed); //Cleanup - client.getfiles().getById(addedFile.getid()).asFile().addHeader(Constants.IF_MATCH_HEADER,"*").delete().get(); + client.getfiles().getById(addedFile.getid()).asFile().addHeader(Constants.IF_MATCH_HEADER, "*").delete().get(); return result; } catch (Exception e) { @@ -127,14 +124,14 @@ public TestResult executeTest() { byte[] content = client.getfiles().getById(addedFile.getid()).asFile().getContent().get(); //Assert - if(addedFile == null) + if (addedFile == null) result.setStatus(TestStatus.Failed); - if(content.length == 0) + if (content.length == 0) result.setStatus(TestStatus.Failed); //Cleanup - client.getfiles().getById(addedFile.getid()).asFile().addHeader(Constants.IF_MATCH_HEADER,"*").delete().get(); + client.getfiles().getById(addedFile.getid()).asFile().addHeader(Constants.IF_MATCH_HEADER, "*").delete().get(); return result; } catch (Exception e) { @@ -174,7 +171,7 @@ public TestResult executeTest() { //Assert byte[] content = client.getfiles().getById(addedFile.getid()).asFile().getContent().get(); String strContent = new String(content); - if(addedFile != null && strContent.equals("My other Content")) + if (addedFile != null && strContent.equals("My other Content")) result.setStatus(TestStatus.Passed); //Cleanup @@ -216,11 +213,11 @@ public TestResult executeTest() { client.getfiles().getById(addedFile.getid()).update(newFile); //Assert - if(addedFile == null) + if (addedFile == null) result.setStatus(TestStatus.Failed); //Cleanup - client.getfiles().getById(addedFile.getid()).asFile().addHeader(Constants.IF_MATCH_HEADER, "*").delete().get(); + client.getfiles().getById(addedFile.getid()).addHeader(Constants.IF_MATCH_HEADER, "*").delete().get(); return result; } catch (Exception e) { @@ -249,7 +246,7 @@ public TestResult executeTest() { Drive drive = client.getdrive().read().get(); //Assert - if(drive == null || drive.getquota() == null || drive.getquota().gettotal() == 0 || drive.getid().equals("")) + if (drive == null || drive.getquota() == null || drive.getquota().gettotal() == 0 || drive.getid().equals("")) result.setStatus(TestStatus.Failed); return result; @@ -292,7 +289,7 @@ public TestResult executeTest() { .read().get(); //Assert - if(files.size() > 0 && !files.get(0).getname().equals("") && files.get(0).getdateTimeLastModified() == null) + if (files.size() > 0 && !files.get(0).getname().equals("") && files.get(0).getdateTimeLastModified() == null) result.setStatus(TestStatus.Passed); //Cleanup @@ -343,7 +340,7 @@ public TestResult executeTest() { .read().get(); //Assert - if(files.size() == 1) + if (files.size() == 1) result.setStatus(TestStatus.Passed); //Cleanup diff --git a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ListsTests.java b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ListsTests.java index c63f9f57..4edf6da3 100644 --- a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ListsTests.java +++ b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ListsTests.java @@ -17,6 +17,7 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. */ + package com.microsoft.office365.test.integration.tests; import com.microsoft.listservices.SPList; @@ -351,3 +352,4 @@ public TestResult executeTest() { return test; } } + diff --git a/tests/e2e-test-app/app/src/main/res/values/general_settings.xml b/tests/e2e-test-app/app/src/main/res/values/general_settings.xml index ab50dfc8..3a21877c 100644 --- a/tests/e2e-test-app/app/src/main/res/values/general_settings.xml +++ b/tests/e2e-test-app/app/src/main/res/values/general_settings.xml @@ -15,4 +15,4 @@ TestEnd2EndDocLib 00000000-0000-0000-0000-000000000000 https://redirecturi.com - + \ No newline at end of file diff --git a/tests/e2e-test-app/settings.gradle b/tests/e2e-test-app/settings.gradle index cc0918a2..4c20cf2e 100644 --- a/tests/e2e-test-app/settings.gradle +++ b/tests/e2e-test-app/settings.gradle @@ -1,23 +1,19 @@ include ':app', ':outlook-services', - ':file-services', ':directory-services', - ':list-services', ':discovery-services', - ':odata-engine-java-impl', - ':odata-engine-java-desktop-impl', - ':odata-engine-interfaces', - ':odata-engine-helpers', - ':odata-engine-android-impl' + ':file-services', + ':list-services', + ':odata-engine-android-impl', + ':odata-engine-jvm-impl', + ':odata-engine-core' project (':outlook-services').projectDir = file('../../sdk/outlook-services') -project (':file-services').projectDir = file('../../sdk/file-services') project (':directory-services').projectDir = file('../../sdk/directory-services') project (':discovery-services').projectDir = file('../../sdk/discovery-services') +project (':file-services').projectDir = file('../../sdk/file-services') project (':list-services').projectDir = file('../../sdk/list-services') -project (':odata-engine-interfaces').projectDir = file('../../sdk/odata-engine-interfaces') -project (':odata-engine-helpers').projectDir = file('../../sdk/odata-engine-helpers') project (':odata-engine-android-impl').projectDir = file('../../sdk/odata-engine-android-impl') -project (':odata-engine-java-desktop-impl').projectDir = file('../../sdk/odata-engine-java-desktop-impl') -project (':odata-engine-java-impl').projectDir = file('../../sdk/odata-engine-java-impl') +project (':odata-engine-jvm-impl').projectDir = file('../../sdk/odata-engine-jvm-impl') +project (':odata-engine-core').projectDir = file('../../sdk/odata-engine-core') From e49ce58832e2d43b94bdcdadd15132baaca5906d Mon Sep 17 00:00:00 2001 From: Anahi Hojnadel Date: Tue, 18 Nov 2014 10:19:34 -0300 Subject: [PATCH 2/9] Fixed issue with custom headers that were not being added properly --- .../com/microsoft/services/odata/Helpers.java | 18 +++++++++++++----- .../services/odata/ODataCollectionFetcher.java | 4 ++-- .../services/odata/ODataEntityFetcher.java | 4 ++-- .../services/odata/ODataOperations.java | 4 ++-- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/Helpers.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/Helpers.java index 7f58e6bc..3c7f1f9f 100644 --- a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/Helpers.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/Helpers.java @@ -2,6 +2,7 @@ import com.microsoft.services.odata.interfaces.DependencyResolver; import com.microsoft.services.odata.interfaces.ODataURL; +import com.microsoft.services.odata.interfaces.Request; import java.io.UnsupportedEncodingException; import java.util.ArrayList; @@ -88,16 +89,23 @@ public static String getReservedPrefix() { /** * Add custom parameters to o data uRL. * - * @param url the url + * @param request the request * @param parameters the parameters + * @param headers the custom headers */ - public static void addCustomParametersToODataURL(ODataURL url, Map parameters) { - Set keys = parameters.keySet(); - - for (String name : keys) { + public static void addCustomParametersToODataRequest(Request request, Map parameters, Map headers) { + ODataURL url = request.getUrl(); + Set parameterKeys = parameters.keySet(); + for (String name : parameterKeys) { Object val = parameters.get(name); url.addQueryStringParameter(name, toODataURLValue(val)); } + + Set headerKeys = headers.keySet(); + for (String name : headerKeys) { + String val = headers.get(name); + request.addHeader(name, val); + } } public static String getFunctionParameters(Map map) { diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataCollectionFetcher.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataCollectionFetcher.java index bb7d94e0..80dda39b 100755 --- a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataCollectionFetcher.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataCollectionFetcher.java @@ -16,7 +16,7 @@ import java.util.List; -import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; +import static com.microsoft.services.odata.Helpers.addCustomParametersToODataRequest; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; /** @@ -159,7 +159,7 @@ protected ListenableFuture oDataExecute(Request request) { } else { setSelectorUrl(request.getUrl(), urlComponent, selectedId); } - addCustomParametersToODataURL(request.getUrl(), getParameters()); + addCustomParametersToODataRequest(request, getParameters(), getHeaders()); return parent.oDataExecute(request); } diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataEntityFetcher.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataEntityFetcher.java index d6cae9eb..2deb45bf 100755 --- a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataEntityFetcher.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataEntityFetcher.java @@ -12,7 +12,7 @@ import com.microsoft.services.odata.interfaces.ODataURL; import com.microsoft.services.odata.interfaces.Request; -import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; +import static com.microsoft.services.odata.Helpers.addCustomParametersToODataRequest; import static com.microsoft.services.odata.Helpers.serializeToJsonByteArray; /** @@ -50,7 +50,7 @@ protected ListenableFuture oDataExecute(Request request) { ODataURL oDataURL = request.getUrl(); oDataURL.prependPathComponent(urlComponent); - addCustomParametersToODataURL(oDataURL, getParameters()); + addCustomParametersToODataRequest(request, getParameters(), getHeaders()); return parent.oDataExecute(request); } diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataOperations.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataOperations.java index 4bc74547..a813350d 100755 --- a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataOperations.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataOperations.java @@ -13,7 +13,7 @@ import com.microsoft.services.odata.interfaces.ODataResponse; import com.microsoft.services.odata.interfaces.Request; -import static com.microsoft.services.odata.Helpers.addCustomParametersToODataURL; +import static com.microsoft.services.odata.Helpers.addCustomParametersToODataRequest; /** * The type ODataOperations. @@ -36,7 +36,7 @@ public ODataOperations(String urlComponent, ODataExecutable parent) { @Override protected ListenableFuture oDataExecute(Request request) { request.getUrl().prependPathComponent(urlComponent); - addCustomParametersToODataURL(request.getUrl(), getParameters()); + addCustomParametersToODataRequest(request, getParameters(), getHeaders()); return parent.oDataExecute(request); } From e709126fb237f03dee0a4db734ac11bcf662fe83 Mon Sep 17 00:00:00 2001 From: Marcos Torres Date: Tue, 18 Nov 2014 18:08:12 -0300 Subject: [PATCH 3/9] updating outlook services --- .../microsoft/outlookservices/Attachment.java | 171 +-- .../microsoft/outlookservices/Calendar.java | 98 +- .../outlookservices/CalendarGroup.java | 116 +- .../microsoft/outlookservices/Contact.java | 1056 +++++++++-------- .../outlookservices/ContactFolder.java | 98 +- .../com/microsoft/outlookservices/Entity.java | 39 +- .../com/microsoft/outlookservices/Event.java | 680 ++++++----- .../outlookservices/FileAttachment.java | 138 +-- .../com/microsoft/outlookservices/Folder.java | 127 +- .../com/microsoft/outlookservices/Item.java | 138 +-- .../outlookservices/ItemAttachment.java | 28 +- .../microsoft/outlookservices/Message.java | 719 +++++------ .../com/microsoft/outlookservices/User.java | 239 +++- 13 files changed, 2010 insertions(+), 1637 deletions(-) diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Attachment.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Attachment.java index df2bdb30..3011fbfe 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Attachment.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Attachment.java @@ -10,103 +10,108 @@ */ public class Attachment extends Entity { - public Attachment(){ - setODataType("#Microsoft.OutlookServices.Attachment"); - } + public Attachment(){ + setODataType("#Microsoft.OutlookServices.Attachment"); + } + private String Name; - /** - * Gets the Name. - * - * @return the String - */ - public String getName() { - return this.Name; - } + /** + * Gets the Name. + * + * @return the String + */ + public String getName() { + return this.Name; + } - /** - * Sets the Name. - * - * @param value the String - */ - public void setName(String value) { - this.Name = value; - } + /** + * Sets the Name. + * + * @param value the String + */ + public void setName(String value) { + this.Name = value; + } + private String ContentType; - /** - * Gets the Content Type. - * - * @return the String - */ - public String getContentType() { - return this.ContentType; - } + /** + * Gets the Content Type. + * + * @return the String + */ + public String getContentType() { + return this.ContentType; + } - /** - * Sets the Content Type. - * - * @param value the String - */ - public void setContentType(String value) { - this.ContentType = value; - } + /** + * Sets the Content Type. + * + * @param value the String + */ + public void setContentType(String value) { + this.ContentType = value; + } + private Integer Size; - /** - * Gets the Size. - * - * @return the Integer - */ - public Integer getSize() { - return this.Size; - } + /** + * Gets the Size. + * + * @return the Integer + */ + public Integer getSize() { + return this.Size; + } - /** - * Sets the Size. - * - * @param value the Integer - */ - public void setSize(Integer value) { - this.Size = value; - } + /** + * Sets the Size. + * + * @param value the Integer + */ + public void setSize(Integer value) { + this.Size = value; + } + private Boolean IsInline; - /** - * Gets the Is Inline. - * - * @return the Boolean - */ - public Boolean getIsInline() { - return this.IsInline; - } + /** + * Gets the Is Inline. + * + * @return the Boolean + */ + public Boolean getIsInline() { + return this.IsInline; + } - /** - * Sets the Is Inline. - * - * @param value the Boolean - */ - public void setIsInline(Boolean value) { - this.IsInline = value; - } + /** + * Sets the Is Inline. + * + * @param value the Boolean + */ + public void setIsInline(Boolean value) { + this.IsInline = value; + } + private java.util.Calendar DateTimeLastModified; - /** - * Gets the Date Time Last Modified. - * - * @return the java.util.Calendar - */ - public java.util.Calendar getDateTimeLastModified() { - return this.DateTimeLastModified; - } + /** + * Gets the Date Time Last Modified. + * + * @return the java.util.Calendar + */ + public java.util.Calendar getDateTimeLastModified() { + return this.DateTimeLastModified; + } - /** - * Sets the Date Time Last Modified. - * - * @param value the java.util.Calendar - */ - public void setDateTimeLastModified(java.util.Calendar value) { - this.DateTimeLastModified = value; - } + /** + * Sets the Date Time Last Modified. + * + * @param value the java.util.Calendar + */ + public void setDateTimeLastModified(java.util.Calendar value) { + this.DateTimeLastModified = value; + } } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Calendar.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Calendar.java index 15855f88..00002cfd 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Calendar.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Calendar.java @@ -10,46 +10,70 @@ */ public class Calendar extends Entity { - public Calendar(){ - setODataType("#Microsoft.OutlookServices.Calendar"); - } + public Calendar(){ + setODataType("#Microsoft.OutlookServices.Calendar"); + } + + private java.util.List CalendarView = new java.util.ArrayList(); + + /** + * Gets the Calendar View. + * + * @return the CalendarView + */ + public java.util.List getCalendarView() { + return this.CalendarView; + } + + private java.util.List Events = new java.util.ArrayList(); + + /** + * Gets the Events. + * + * @return the Events + */ + public java.util.List getEvents() { + return this.Events; + } + private String Name; - /** - * Gets the Name. - * - * @return the String - */ - public String getName() { - return this.Name; - } - - /** - * Sets the Name. - * - * @param value the String - */ - public void setName(String value) { - this.Name = value; - } + /** + * Gets the Name. + * + * @return the String + */ + public String getName() { + return this.Name; + } + + /** + * Sets the Name. + * + * @param value the String + */ + public void setName(String value) { + this.Name = value; + } + private String ChangeKey; - /** - * Gets the Change Key. - * - * @return the String - */ - public String getChangeKey() { - return this.ChangeKey; - } - - /** - * Sets the Change Key. - * - * @param value the String - */ - public void setChangeKey(String value) { - this.ChangeKey = value; - } + /** + * Gets the Change Key. + * + * @return the String + */ + public String getChangeKey() { + return this.ChangeKey; + } + + /** + * Sets the Change Key. + * + * @param value the String + */ + public void setChangeKey(String value) { + this.ChangeKey = value; + } } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/CalendarGroup.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/CalendarGroup.java index e6ad8082..0da46142 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/CalendarGroup.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/CalendarGroup.java @@ -10,65 +10,79 @@ */ public class CalendarGroup extends Entity { - public CalendarGroup(){ - setODataType("#Microsoft.OutlookServices.CalendarGroup"); - } + public CalendarGroup(){ + setODataType("#Microsoft.OutlookServices.CalendarGroup"); + } + + private java.util.List Calendars = new java.util.ArrayList(); + + /** + * Gets the Calendars. + * + * @return the Calendars + */ + public java.util.List getCalendars() { + return this.Calendars; + } + private String Name; - /** - * Gets the Name. - * - * @return the String - */ - public String getName() { - return this.Name; - } + /** + * Gets the Name. + * + * @return the String + */ + public String getName() { + return this.Name; + } - /** - * Sets the Name. - * - * @param value the String - */ - public void setName(String value) { - this.Name = value; - } + /** + * Sets the Name. + * + * @param value the String + */ + public void setName(String value) { + this.Name = value; + } + private String ChangeKey; - /** - * Gets the Change Key. - * - * @return the String - */ - public String getChangeKey() { - return this.ChangeKey; - } + /** + * Gets the Change Key. + * + * @return the String + */ + public String getChangeKey() { + return this.ChangeKey; + } - /** - * Sets the Change Key. - * - * @param value the String - */ - public void setChangeKey(String value) { - this.ChangeKey = value; - } + /** + * Sets the Change Key. + * + * @param value the String + */ + public void setChangeKey(String value) { + this.ChangeKey = value; + } + private java.util.UUID ClassId; - /** - * Gets the Class Id. - * - * @return the java.util.UUID - */ - public java.util.UUID getClassId() { - return this.ClassId; - } + /** + * Gets the Class Id. + * + * @return the java.util.UUID + */ + public java.util.UUID getClassId() { + return this.ClassId; + } - /** - * Sets the Class Id. - * - * @param value the java.util.UUID - */ - public void setClassId(java.util.UUID value) { - this.ClassId = value; - } + /** + * Sets the Class Id. + * + * @param value the java.util.UUID + */ + public void setClassId(java.util.UUID value) { + this.ClassId = value; + } } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Contact.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Contact.java index 7a458918..4b4ba6be 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Contact.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Contact.java @@ -10,578 +10,608 @@ */ public class Contact extends Item { - public Contact(){ - setODataType("#Microsoft.OutlookServices.Contact"); - } + public Contact(){ + setODataType("#Microsoft.OutlookServices.Contact"); + } + private String ParentFolderId; - /** - * Gets the Parent Folder Id. - * - * @return the String - */ - public String getParentFolderId() { - return this.ParentFolderId; - } - - /** - * Sets the Parent Folder Id. - * - * @param value the String - */ - public void setParentFolderId(String value) { - this.ParentFolderId = value; - } + /** + * Gets the Parent Folder Id. + * + * @return the String + */ + public String getParentFolderId() { + return this.ParentFolderId; + } + + /** + * Sets the Parent Folder Id. + * + * @param value the String + */ + public void setParentFolderId(String value) { + this.ParentFolderId = value; + } + private java.util.Calendar Birthday; - /** - * Gets the Birthday. - * - * @return the java.util.Calendar - */ - public java.util.Calendar getBirthday() { - return this.Birthday; - } - - /** - * Sets the Birthday. - * - * @param value the java.util.Calendar - */ - public void setBirthday(java.util.Calendar value) { - this.Birthday = value; - } + /** + * Gets the Birthday. + * + * @return the java.util.Calendar + */ + public java.util.Calendar getBirthday() { + return this.Birthday; + } + + /** + * Sets the Birthday. + * + * @param value the java.util.Calendar + */ + public void setBirthday(java.util.Calendar value) { + this.Birthday = value; + } + private String FileAs; - /** - * Gets the File As. - * - * @return the String - */ - public String getFileAs() { - return this.FileAs; - } - - /** - * Sets the File As. - * - * @param value the String - */ - public void setFileAs(String value) { - this.FileAs = value; - } + /** + * Gets the File As. + * + * @return the String + */ + public String getFileAs() { + return this.FileAs; + } + + /** + * Sets the File As. + * + * @param value the String + */ + public void setFileAs(String value) { + this.FileAs = value; + } + private String DisplayName; - /** - * Gets the Display Name. - * - * @return the String - */ - public String getDisplayName() { - return this.DisplayName; - } - - /** - * Sets the Display Name. - * - * @param value the String - */ - public void setDisplayName(String value) { - this.DisplayName = value; - } + /** + * Gets the Display Name. + * + * @return the String + */ + public String getDisplayName() { + return this.DisplayName; + } + + /** + * Sets the Display Name. + * + * @param value the String + */ + public void setDisplayName(String value) { + this.DisplayName = value; + } + private String GivenName; - /** - * Gets the Given Name. - * - * @return the String - */ - public String getGivenName() { - return this.GivenName; - } - - /** - * Sets the Given Name. - * - * @param value the String - */ - public void setGivenName(String value) { - this.GivenName = value; - } + /** + * Gets the Given Name. + * + * @return the String + */ + public String getGivenName() { + return this.GivenName; + } + + /** + * Sets the Given Name. + * + * @param value the String + */ + public void setGivenName(String value) { + this.GivenName = value; + } + private String Initials; - /** - * Gets the Initials. - * - * @return the String - */ - public String getInitials() { - return this.Initials; - } - - /** - * Sets the Initials. - * - * @param value the String - */ - public void setInitials(String value) { - this.Initials = value; - } + /** + * Gets the Initials. + * + * @return the String + */ + public String getInitials() { + return this.Initials; + } + + /** + * Sets the Initials. + * + * @param value the String + */ + public void setInitials(String value) { + this.Initials = value; + } + private String MiddleName; - /** - * Gets the Middle Name. - * - * @return the String - */ - public String getMiddleName() { - return this.MiddleName; - } - - /** - * Sets the Middle Name. - * - * @param value the String - */ - public void setMiddleName(String value) { - this.MiddleName = value; - } + /** + * Gets the Middle Name. + * + * @return the String + */ + public String getMiddleName() { + return this.MiddleName; + } + + /** + * Sets the Middle Name. + * + * @param value the String + */ + public void setMiddleName(String value) { + this.MiddleName = value; + } + private String NickName; - /** - * Gets the Nick Name. - * - * @return the String - */ - public String getNickName() { - return this.NickName; - } - - /** - * Sets the Nick Name. - * - * @param value the String - */ - public void setNickName(String value) { - this.NickName = value; - } + /** + * Gets the Nick Name. + * + * @return the String + */ + public String getNickName() { + return this.NickName; + } + + /** + * Sets the Nick Name. + * + * @param value the String + */ + public void setNickName(String value) { + this.NickName = value; + } + private String Surname; - /** - * Gets the Surname. - * - * @return the String - */ - public String getSurname() { - return this.Surname; - } - - /** - * Sets the Surname. - * - * @param value the String - */ - public void setSurname(String value) { - this.Surname = value; - } + /** + * Gets the Surname. + * + * @return the String + */ + public String getSurname() { + return this.Surname; + } + + /** + * Sets the Surname. + * + * @param value the String + */ + public void setSurname(String value) { + this.Surname = value; + } + private String Title; - /** - * Gets the Title. - * - * @return the String - */ - public String getTitle() { - return this.Title; - } - - /** - * Sets the Title. - * - * @param value the String - */ - public void setTitle(String value) { - this.Title = value; - } + /** + * Gets the Title. + * + * @return the String + */ + public String getTitle() { + return this.Title; + } + + /** + * Sets the Title. + * + * @param value the String + */ + public void setTitle(String value) { + this.Title = value; + } + private String Generation; - /** - * Gets the Generation. - * - * @return the String - */ - public String getGeneration() { - return this.Generation; - } - - /** - * Sets the Generation. - * - * @param value the String - */ - public void setGeneration(String value) { - this.Generation = value; - } + /** + * Gets the Generation. + * + * @return the String + */ + public String getGeneration() { + return this.Generation; + } + + /** + * Sets the Generation. + * + * @param value the String + */ + public void setGeneration(String value) { + this.Generation = value; + } + private java.util.List EmailAddresses; - /** - * Gets the Email Addresses. - * - * @return the java.util.List - */ - public java.util.List getEmailAddresses() { - return this.EmailAddresses; - } - - /** - * Sets the Email Addresses. - * - * @param value the java.util.List - */ - public void setEmailAddresses(java.util.List value) { - this.EmailAddresses = value; - } + /** + * Gets the Email Addresses. + * + * @return the java.util.List + */ + public java.util.List getEmailAddresses() { + return this.EmailAddresses; + } + + /** + * Sets the Email Addresses. + * + * @param value the java.util.List + */ + public void setEmailAddresses(java.util.List value) { + this.EmailAddresses = value; + } + private java.util.List ImAddresses; - /** - * Gets the Im Addresses. - * - * @return the java.util.List - */ - public java.util.List getImAddresses() { - return this.ImAddresses; - } - - /** - * Sets the Im Addresses. - * - * @param value the java.util.List - */ - public void setImAddresses(java.util.List value) { - this.ImAddresses = value; - } + /** + * Gets the Im Addresses. + * + * @return the java.util.List + */ + public java.util.List getImAddresses() { + return this.ImAddresses; + } + + /** + * Sets the Im Addresses. + * + * @param value the java.util.List + */ + public void setImAddresses(java.util.List value) { + this.ImAddresses = value; + } + private String JobTitle; - /** - * Gets the Job Title. - * - * @return the String - */ - public String getJobTitle() { - return this.JobTitle; - } - - /** - * Sets the Job Title. - * - * @param value the String - */ - public void setJobTitle(String value) { - this.JobTitle = value; - } + /** + * Gets the Job Title. + * + * @return the String + */ + public String getJobTitle() { + return this.JobTitle; + } + + /** + * Sets the Job Title. + * + * @param value the String + */ + public void setJobTitle(String value) { + this.JobTitle = value; + } + private String CompanyName; - /** - * Gets the Company Name. - * - * @return the String - */ - public String getCompanyName() { - return this.CompanyName; - } - - /** - * Sets the Company Name. - * - * @param value the String - */ - public void setCompanyName(String value) { - this.CompanyName = value; - } + /** + * Gets the Company Name. + * + * @return the String + */ + public String getCompanyName() { + return this.CompanyName; + } + + /** + * Sets the Company Name. + * + * @param value the String + */ + public void setCompanyName(String value) { + this.CompanyName = value; + } + private String Department; - /** - * Gets the Department. - * - * @return the String - */ - public String getDepartment() { - return this.Department; - } - - /** - * Sets the Department. - * - * @param value the String - */ - public void setDepartment(String value) { - this.Department = value; - } + /** + * Gets the Department. + * + * @return the String + */ + public String getDepartment() { + return this.Department; + } + + /** + * Sets the Department. + * + * @param value the String + */ + public void setDepartment(String value) { + this.Department = value; + } + private String OfficeLocation; - /** - * Gets the Office Location. - * - * @return the String - */ - public String getOfficeLocation() { - return this.OfficeLocation; - } - - /** - * Sets the Office Location. - * - * @param value the String - */ - public void setOfficeLocation(String value) { - this.OfficeLocation = value; - } + /** + * Gets the Office Location. + * + * @return the String + */ + public String getOfficeLocation() { + return this.OfficeLocation; + } + + /** + * Sets the Office Location. + * + * @param value the String + */ + public void setOfficeLocation(String value) { + this.OfficeLocation = value; + } + private String Profession; - /** - * Gets the Profession. - * - * @return the String - */ - public String getProfession() { - return this.Profession; - } - - /** - * Sets the Profession. - * - * @param value the String - */ - public void setProfession(String value) { - this.Profession = value; - } + /** + * Gets the Profession. + * + * @return the String + */ + public String getProfession() { + return this.Profession; + } + + /** + * Sets the Profession. + * + * @param value the String + */ + public void setProfession(String value) { + this.Profession = value; + } + private String BusinessHomePage; - /** - * Gets the Business Home Page. - * - * @return the String - */ - public String getBusinessHomePage() { - return this.BusinessHomePage; - } - - /** - * Sets the Business Home Page. - * - * @param value the String - */ - public void setBusinessHomePage(String value) { - this.BusinessHomePage = value; - } + /** + * Gets the Business Home Page. + * + * @return the String + */ + public String getBusinessHomePage() { + return this.BusinessHomePage; + } + + /** + * Sets the Business Home Page. + * + * @param value the String + */ + public void setBusinessHomePage(String value) { + this.BusinessHomePage = value; + } + private String AssistantName; - /** - * Gets the Assistant Name. - * - * @return the String - */ - public String getAssistantName() { - return this.AssistantName; - } - - /** - * Sets the Assistant Name. - * - * @param value the String - */ - public void setAssistantName(String value) { - this.AssistantName = value; - } + /** + * Gets the Assistant Name. + * + * @return the String + */ + public String getAssistantName() { + return this.AssistantName; + } + + /** + * Sets the Assistant Name. + * + * @param value the String + */ + public void setAssistantName(String value) { + this.AssistantName = value; + } + private String Manager; - /** - * Gets the Manager. - * - * @return the String - */ - public String getManager() { - return this.Manager; - } - - /** - * Sets the Manager. - * - * @param value the String - */ - public void setManager(String value) { - this.Manager = value; - } + /** + * Gets the Manager. + * + * @return the String + */ + public String getManager() { + return this.Manager; + } + + /** + * Sets the Manager. + * + * @param value the String + */ + public void setManager(String value) { + this.Manager = value; + } + private java.util.List HomePhones; - /** - * Gets the Home Phones. - * - * @return the java.util.List - */ - public java.util.List getHomePhones() { - return this.HomePhones; - } - - /** - * Sets the Home Phones. - * - * @param value the java.util.List - */ - public void setHomePhones(java.util.List value) { - this.HomePhones = value; - } + /** + * Gets the Home Phones. + * + * @return the java.util.List + */ + public java.util.List getHomePhones() { + return this.HomePhones; + } + + /** + * Sets the Home Phones. + * + * @param value the java.util.List + */ + public void setHomePhones(java.util.List value) { + this.HomePhones = value; + } + private java.util.List BusinessPhones; - /** - * Gets the Business Phones. - * - * @return the java.util.List - */ - public java.util.List getBusinessPhones() { - return this.BusinessPhones; - } - - /** - * Sets the Business Phones. - * - * @param value the java.util.List - */ - public void setBusinessPhones(java.util.List value) { - this.BusinessPhones = value; - } + /** + * Gets the Business Phones. + * + * @return the java.util.List + */ + public java.util.List getBusinessPhones() { + return this.BusinessPhones; + } + + /** + * Sets the Business Phones. + * + * @param value the java.util.List + */ + public void setBusinessPhones(java.util.List value) { + this.BusinessPhones = value; + } + private String MobilePhone1; - /** - * Gets the Mobile Phone1. - * - * @return the String - */ - public String getMobilePhone1() { - return this.MobilePhone1; - } - - /** - * Sets the Mobile Phone1. - * - * @param value the String - */ - public void setMobilePhone1(String value) { - this.MobilePhone1 = value; - } + /** + * Gets the Mobile Phone1. + * + * @return the String + */ + public String getMobilePhone1() { + return this.MobilePhone1; + } + + /** + * Sets the Mobile Phone1. + * + * @param value the String + */ + public void setMobilePhone1(String value) { + this.MobilePhone1 = value; + } + private PhysicalAddress HomeAddress; - /** - * Gets the Home Address. - * - * @return the PhysicalAddress - */ - public PhysicalAddress getHomeAddress() { - return this.HomeAddress; - } - - /** - * Sets the Home Address. - * - * @param value the PhysicalAddress - */ - public void setHomeAddress(PhysicalAddress value) { - this.HomeAddress = value; - } + /** + * Gets the Home Address. + * + * @return the PhysicalAddress + */ + public PhysicalAddress getHomeAddress() { + return this.HomeAddress; + } + + /** + * Sets the Home Address. + * + * @param value the PhysicalAddress + */ + public void setHomeAddress(PhysicalAddress value) { + this.HomeAddress = value; + } + private PhysicalAddress BusinessAddress; - /** - * Gets the Business Address. - * - * @return the PhysicalAddress - */ - public PhysicalAddress getBusinessAddress() { - return this.BusinessAddress; - } - - /** - * Sets the Business Address. - * - * @param value the PhysicalAddress - */ - public void setBusinessAddress(PhysicalAddress value) { - this.BusinessAddress = value; - } + /** + * Gets the Business Address. + * + * @return the PhysicalAddress + */ + public PhysicalAddress getBusinessAddress() { + return this.BusinessAddress; + } + + /** + * Sets the Business Address. + * + * @param value the PhysicalAddress + */ + public void setBusinessAddress(PhysicalAddress value) { + this.BusinessAddress = value; + } + private PhysicalAddress OtherAddress; - /** - * Gets the Other Address. - * - * @return the PhysicalAddress - */ - public PhysicalAddress getOtherAddress() { - return this.OtherAddress; - } - - /** - * Sets the Other Address. - * - * @param value the PhysicalAddress - */ - public void setOtherAddress(PhysicalAddress value) { - this.OtherAddress = value; - } + /** + * Gets the Other Address. + * + * @return the PhysicalAddress + */ + public PhysicalAddress getOtherAddress() { + return this.OtherAddress; + } + + /** + * Sets the Other Address. + * + * @param value the PhysicalAddress + */ + public void setOtherAddress(PhysicalAddress value) { + this.OtherAddress = value; + } + private String YomiCompanyName; - /** - * Gets the Yomi Company Name. - * - * @return the String - */ - public String getYomiCompanyName() { - return this.YomiCompanyName; - } - - /** - * Sets the Yomi Company Name. - * - * @param value the String - */ - public void setYomiCompanyName(String value) { - this.YomiCompanyName = value; - } + /** + * Gets the Yomi Company Name. + * + * @return the String + */ + public String getYomiCompanyName() { + return this.YomiCompanyName; + } + + /** + * Sets the Yomi Company Name. + * + * @param value the String + */ + public void setYomiCompanyName(String value) { + this.YomiCompanyName = value; + } + private String YomiGivenName; - /** - * Gets the Yomi Given Name. - * - * @return the String - */ - public String getYomiGivenName() { - return this.YomiGivenName; - } - - /** - * Sets the Yomi Given Name. - * - * @param value the String - */ - public void setYomiGivenName(String value) { - this.YomiGivenName = value; - } + /** + * Gets the Yomi Given Name. + * + * @return the String + */ + public String getYomiGivenName() { + return this.YomiGivenName; + } + + /** + * Sets the Yomi Given Name. + * + * @param value the String + */ + public void setYomiGivenName(String value) { + this.YomiGivenName = value; + } + private String YomiSurname; - /** - * Gets the Yomi Surname. - * - * @return the String - */ - public String getYomiSurname() { - return this.YomiSurname; - } - - /** - * Sets the Yomi Surname. - * - * @param value the String - */ - public void setYomiSurname(String value) { - this.YomiSurname = value; - } + /** + * Gets the Yomi Surname. + * + * @return the String + */ + public String getYomiSurname() { + return this.YomiSurname; + } + + /** + * Sets the Yomi Surname. + * + * @param value the String + */ + public void setYomiSurname(String value) { + this.YomiSurname = value; + } } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/ContactFolder.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/ContactFolder.java index 6a464e4f..2c58752b 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/ContactFolder.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/ContactFolder.java @@ -10,46 +10,70 @@ */ public class ContactFolder extends Entity { - public ContactFolder(){ - setODataType("#Microsoft.OutlookServices.ContactFolder"); - } + public ContactFolder(){ + setODataType("#Microsoft.OutlookServices.ContactFolder"); + } + + private java.util.List Contacts = new java.util.ArrayList(); + + /** + * Gets the Contacts. + * + * @return the Contacts + */ + public java.util.List getContacts() { + return this.Contacts; + } + + private java.util.List ChildFolders = new java.util.ArrayList(); + + /** + * Gets the Child Folders. + * + * @return the ChildFolders + */ + public java.util.List getChildFolders() { + return this.ChildFolders; + } + private String ParentFolderId; - /** - * Gets the Parent Folder Id. - * - * @return the String - */ - public String getParentFolderId() { - return this.ParentFolderId; - } - - /** - * Sets the Parent Folder Id. - * - * @param value the String - */ - public void setParentFolderId(String value) { - this.ParentFolderId = value; - } + /** + * Gets the Parent Folder Id. + * + * @return the String + */ + public String getParentFolderId() { + return this.ParentFolderId; + } + + /** + * Sets the Parent Folder Id. + * + * @param value the String + */ + public void setParentFolderId(String value) { + this.ParentFolderId = value; + } + private String DisplayName; - /** - * Gets the Display Name. - * - * @return the String - */ - public String getDisplayName() { - return this.DisplayName; - } - - /** - * Sets the Display Name. - * - * @param value the String - */ - public void setDisplayName(String value) { - this.DisplayName = value; - } + /** + * Gets the Display Name. + * + * @return the String + */ + public String getDisplayName() { + return this.DisplayName; + } + + /** + * Sets the Display Name. + * + * @param value the String + */ + public void setDisplayName(String value) { + this.DisplayName = value; + } } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Entity.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Entity.java index b4cc9b0b..f0c36c77 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Entity.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Entity.java @@ -10,27 +10,28 @@ */ public class Entity extends ODataBaseEntity { - public Entity(){ - setODataType("#Microsoft.OutlookServices.Entity"); - } + public Entity(){ + setODataType("#Microsoft.OutlookServices.Entity"); + } + private String Id; - /** - * Gets the Id. - * - * @return the String - */ - public String getId() { - return this.Id; - } + /** + * Gets the Id. + * + * @return the String + */ + public String getId() { + return this.Id; + } - /** - * Sets the Id. - * - * @param value the String - */ - public void setId(String value) { - this.Id = value; - } + /** + * Sets the Id. + * + * @param value the String + */ + public void setId(String value) { + this.Id = value; + } } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Event.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Event.java index 93efa8fa..3c323198 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Event.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Event.java @@ -10,350 +10,410 @@ */ public class Event extends Item { - public Event(){ - setODataType("#Microsoft.OutlookServices.Event"); - } - + public Event(){ + setODataType("#Microsoft.OutlookServices.Event"); + } + + + private java.util.List Attachments = new java.util.ArrayList(); + + /** + * Gets the Attachments. + * + * @return the Attachments + */ + public java.util.List getAttachments() { + return this.Attachments; + } + + private Calendar Calendar = null; + + /** + * Gets the Calendar. + * + * @return the Calendar + */ + public Calendar getCalendar() { + return this.Calendar; + } + + /** + * Sets the Calendar. + * + * @param value the Calendar + */ + public void setCalendar(Calendar value) { + this.Calendar = value; + } + + private java.util.List Instances = new java.util.ArrayList(); + + /** + * Gets the Instances. + * + * @return the Instances + */ + public java.util.List getInstances() { + return this.Instances; + } + private String Subject; - /** - * Gets the Subject. - * - * @return the String - */ - public String getSubject() { - return this.Subject; - } - - /** - * Sets the Subject. - * - * @param value the String - */ - public void setSubject(String value) { - this.Subject = value; - } + /** + * Gets the Subject. + * + * @return the String + */ + public String getSubject() { + return this.Subject; + } + + /** + * Sets the Subject. + * + * @param value the String + */ + public void setSubject(String value) { + this.Subject = value; + } + private ItemBody Body; - /** - * Gets the Body. - * - * @return the ItemBody - */ - public ItemBody getBody() { - return this.Body; - } - - /** - * Sets the Body. - * - * @param value the ItemBody - */ - public void setBody(ItemBody value) { - this.Body = value; - } + /** + * Gets the Body. + * + * @return the ItemBody + */ + public ItemBody getBody() { + return this.Body; + } + + /** + * Sets the Body. + * + * @param value the ItemBody + */ + public void setBody(ItemBody value) { + this.Body = value; + } + private String BodyPreview; - /** - * Gets the Body Preview. - * - * @return the String - */ - public String getBodyPreview() { - return this.BodyPreview; - } - - /** - * Sets the Body Preview. - * - * @param value the String - */ - public void setBodyPreview(String value) { - this.BodyPreview = value; - } + /** + * Gets the Body Preview. + * + * @return the String + */ + public String getBodyPreview() { + return this.BodyPreview; + } + + /** + * Sets the Body Preview. + * + * @param value the String + */ + public void setBodyPreview(String value) { + this.BodyPreview = value; + } + private Importance Importance; - /** - * Gets the Importance. - * - * @return the Importance - */ - public Importance getImportance() { - return this.Importance; - } - - /** - * Sets the Importance. - * - * @param value the Importance - */ - public void setImportance(Importance value) { - this.Importance = value; - } + /** + * Gets the Importance. + * + * @return the Importance + */ + public Importance getImportance() { + return this.Importance; + } + + /** + * Sets the Importance. + * + * @param value the Importance + */ + public void setImportance(Importance value) { + this.Importance = value; + } + private Boolean HasAttachments; - /** - * Gets the Has Attachments. - * - * @return the Boolean - */ - public Boolean getHasAttachments() { - return this.HasAttachments; - } - - /** - * Sets the Has Attachments. - * - * @param value the Boolean - */ - public void setHasAttachments(Boolean value) { - this.HasAttachments = value; - } + /** + * Gets the Has Attachments. + * + * @return the Boolean + */ + public Boolean getHasAttachments() { + return this.HasAttachments; + } + + /** + * Sets the Has Attachments. + * + * @param value the Boolean + */ + public void setHasAttachments(Boolean value) { + this.HasAttachments = value; + } + private java.util.Calendar Start; - /** - * Gets the Start. - * - * @return the java.util.Calendar - */ - public java.util.Calendar getStart() { - return this.Start; - } - - /** - * Sets the Start. - * - * @param value the java.util.Calendar - */ - public void setStart(java.util.Calendar value) { - this.Start = value; - } + /** + * Gets the Start. + * + * @return the java.util.Calendar + */ + public java.util.Calendar getStart() { + return this.Start; + } + + /** + * Sets the Start. + * + * @param value the java.util.Calendar + */ + public void setStart(java.util.Calendar value) { + this.Start = value; + } + private java.util.Calendar End; - /** - * Gets the End. - * - * @return the java.util.Calendar - */ - public java.util.Calendar getEnd() { - return this.End; - } - - /** - * Sets the End. - * - * @param value the java.util.Calendar - */ - public void setEnd(java.util.Calendar value) { - this.End = value; - } + /** + * Gets the End. + * + * @return the java.util.Calendar + */ + public java.util.Calendar getEnd() { + return this.End; + } + + /** + * Sets the End. + * + * @param value the java.util.Calendar + */ + public void setEnd(java.util.Calendar value) { + this.End = value; + } + private Location Location; - /** - * Gets the Location. - * - * @return the Location - */ - public Location getLocation() { - return this.Location; - } - - /** - * Sets the Location. - * - * @param value the Location - */ - public void setLocation(Location value) { - this.Location = value; - } + /** + * Gets the Location. + * + * @return the Location + */ + public Location getLocation() { + return this.Location; + } + + /** + * Sets the Location. + * + * @param value the Location + */ + public void setLocation(Location value) { + this.Location = value; + } + private FreeBusyStatus ShowAs; - /** - * Gets the Show As. - * - * @return the FreeBusyStatus - */ - public FreeBusyStatus getShowAs() { - return this.ShowAs; - } - - /** - * Sets the Show As. - * - * @param value the FreeBusyStatus - */ - public void setShowAs(FreeBusyStatus value) { - this.ShowAs = value; - } + /** + * Gets the Show As. + * + * @return the FreeBusyStatus + */ + public FreeBusyStatus getShowAs() { + return this.ShowAs; + } + + /** + * Sets the Show As. + * + * @param value the FreeBusyStatus + */ + public void setShowAs(FreeBusyStatus value) { + this.ShowAs = value; + } + private Boolean IsAllDay; - /** - * Gets the Is All Day. - * - * @return the Boolean - */ - public Boolean getIsAllDay() { - return this.IsAllDay; - } - - /** - * Sets the Is All Day. - * - * @param value the Boolean - */ - public void setIsAllDay(Boolean value) { - this.IsAllDay = value; - } + /** + * Gets the Is All Day. + * + * @return the Boolean + */ + public Boolean getIsAllDay() { + return this.IsAllDay; + } + + /** + * Sets the Is All Day. + * + * @param value the Boolean + */ + public void setIsAllDay(Boolean value) { + this.IsAllDay = value; + } + private Boolean IsCancelled; - /** - * Gets the Is Cancelled. - * - * @return the Boolean - */ - public Boolean getIsCancelled() { - return this.IsCancelled; - } - - /** - * Sets the Is Cancelled. - * - * @param value the Boolean - */ - public void setIsCancelled(Boolean value) { - this.IsCancelled = value; - } + /** + * Gets the Is Cancelled. + * + * @return the Boolean + */ + public Boolean getIsCancelled() { + return this.IsCancelled; + } + + /** + * Sets the Is Cancelled. + * + * @param value the Boolean + */ + public void setIsCancelled(Boolean value) { + this.IsCancelled = value; + } + private Boolean IsOrganizer; - /** - * Gets the Is Organizer. - * - * @return the Boolean - */ - public Boolean getIsOrganizer() { - return this.IsOrganizer; - } - - /** - * Sets the Is Organizer. - * - * @param value the Boolean - */ - public void setIsOrganizer(Boolean value) { - this.IsOrganizer = value; - } + /** + * Gets the Is Organizer. + * + * @return the Boolean + */ + public Boolean getIsOrganizer() { + return this.IsOrganizer; + } + + /** + * Sets the Is Organizer. + * + * @param value the Boolean + */ + public void setIsOrganizer(Boolean value) { + this.IsOrganizer = value; + } + private Boolean ResponseRequested; - /** - * Gets the Response Requested. - * - * @return the Boolean - */ - public Boolean getResponseRequested() { - return this.ResponseRequested; - } - - /** - * Sets the Response Requested. - * - * @param value the Boolean - */ - public void setResponseRequested(Boolean value) { - this.ResponseRequested = value; - } + /** + * Gets the Response Requested. + * + * @return the Boolean + */ + public Boolean getResponseRequested() { + return this.ResponseRequested; + } + + /** + * Sets the Response Requested. + * + * @param value the Boolean + */ + public void setResponseRequested(Boolean value) { + this.ResponseRequested = value; + } + private EventType Type; - /** - * Gets the Type. - * - * @return the EventType - */ - public EventType getType() { - return this.Type; - } - - /** - * Sets the Type. - * - * @param value the EventType - */ - public void setType(EventType value) { - this.Type = value; - } + /** + * Gets the Type. + * + * @return the EventType + */ + public EventType getType() { + return this.Type; + } + + /** + * Sets the Type. + * + * @param value the EventType + */ + public void setType(EventType value) { + this.Type = value; + } + private String SeriesMasterId; - /** - * Gets the Series Master Id. - * - * @return the String - */ - public String getSeriesMasterId() { - return this.SeriesMasterId; - } - - /** - * Sets the Series Master Id. - * - * @param value the String - */ - public void setSeriesMasterId(String value) { - this.SeriesMasterId = value; - } + /** + * Gets the Series Master Id. + * + * @return the String + */ + public String getSeriesMasterId() { + return this.SeriesMasterId; + } + + /** + * Sets the Series Master Id. + * + * @param value the String + */ + public void setSeriesMasterId(String value) { + this.SeriesMasterId = value; + } + private java.util.List Attendees; - /** - * Gets the Attendees. - * - * @return the java.util.List - */ - public java.util.List getAttendees() { - return this.Attendees; - } - - /** - * Sets the Attendees. - * - * @param value the java.util.List - */ - public void setAttendees(java.util.List value) { - this.Attendees = value; - } + /** + * Gets the Attendees. + * + * @return the java.util.List + */ + public java.util.List getAttendees() { + return this.Attendees; + } + + /** + * Sets the Attendees. + * + * @param value the java.util.List + */ + public void setAttendees(java.util.List value) { + this.Attendees = value; + } + private PatternedRecurrence Recurrence; - /** - * Gets the Recurrence. - * - * @return the PatternedRecurrence - */ - public PatternedRecurrence getRecurrence() { - return this.Recurrence; - } - - /** - * Sets the Recurrence. - * - * @param value the PatternedRecurrence - */ - public void setRecurrence(PatternedRecurrence value) { - this.Recurrence = value; - } + /** + * Gets the Recurrence. + * + * @return the PatternedRecurrence + */ + public PatternedRecurrence getRecurrence() { + return this.Recurrence; + } + + /** + * Sets the Recurrence. + * + * @param value the PatternedRecurrence + */ + public void setRecurrence(PatternedRecurrence value) { + this.Recurrence = value; + } + private Recipient Organizer; - /** - * Gets the Organizer. - * - * @return the Recipient - */ - public Recipient getOrganizer() { - return this.Organizer; - } - - /** - * Sets the Organizer. - * - * @param value the Recipient - */ - public void setOrganizer(Recipient value) { - this.Organizer = value; - } + /** + * Gets the Organizer. + * + * @return the Recipient + */ + public Recipient getOrganizer() { + return this.Organizer; + } + + /** + * Sets the Organizer. + * + * @param value the Recipient + */ + public void setOrganizer(Recipient value) { + this.Organizer = value; + } } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/FileAttachment.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/FileAttachment.java index bc9384b3..9ee45101 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/FileAttachment.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/FileAttachment.java @@ -10,84 +10,88 @@ */ public class FileAttachment extends Attachment { - public FileAttachment(){ - setODataType("#Microsoft.OutlookServices.FileAttachment"); - } + public FileAttachment(){ + setODataType("#Microsoft.OutlookServices.FileAttachment"); + } + private String ContentId; - /** - * Gets the Content Id. - * - * @return the String - */ - public String getContentId() { - return this.ContentId; - } + /** + * Gets the Content Id. + * + * @return the String + */ + public String getContentId() { + return this.ContentId; + } - /** - * Sets the Content Id. - * - * @param value the String - */ - public void setContentId(String value) { - this.ContentId = value; - } + /** + * Sets the Content Id. + * + * @param value the String + */ + public void setContentId(String value) { + this.ContentId = value; + } + private String ContentLocation; - /** - * Gets the Content Location. - * - * @return the String - */ - public String getContentLocation() { - return this.ContentLocation; - } + /** + * Gets the Content Location. + * + * @return the String + */ + public String getContentLocation() { + return this.ContentLocation; + } - /** - * Sets the Content Location. - * - * @param value the String - */ - public void setContentLocation(String value) { - this.ContentLocation = value; - } + /** + * Sets the Content Location. + * + * @param value the String + */ + public void setContentLocation(String value) { + this.ContentLocation = value; + } + private Boolean IsContactPhoto; - /** - * Gets the Is Contact Photo. - * - * @return the Boolean - */ - public Boolean getIsContactPhoto() { - return this.IsContactPhoto; - } + /** + * Gets the Is Contact Photo. + * + * @return the Boolean + */ + public Boolean getIsContactPhoto() { + return this.IsContactPhoto; + } - /** - * Sets the Is Contact Photo. - * - * @param value the Boolean - */ - public void setIsContactPhoto(Boolean value) { - this.IsContactPhoto = value; - } + /** + * Sets the Is Contact Photo. + * + * @param value the Boolean + */ + public void setIsContactPhoto(Boolean value) { + this.IsContactPhoto = value; + } + private byte[] ContentBytes; - /** - * Gets the Content Bytes. - * - * @return the byte[] - */ - public byte[] getContentBytes() { - return this.ContentBytes; - } + /** + * Gets the Content Bytes. + * + * @return the byte[] + */ + public byte[] getContentBytes() { + return this.ContentBytes; + } - /** - * Sets the Content Bytes. - * - * @param value the byte[] - */ - public void setContentBytes(byte[] value) { - this.ContentBytes = value; - } + /** + * Sets the Content Bytes. + * + * @param value the byte[] + */ + public void setContentBytes(byte[] value) { + this.ContentBytes = value; + } } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Folder.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Folder.java index 580f393d..3094572b 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Folder.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Folder.java @@ -10,65 +10,90 @@ */ public class Folder extends Entity { - public Folder(){ - setODataType("#Microsoft.OutlookServices.Folder"); - } + public Folder(){ + setODataType("#Microsoft.OutlookServices.Folder"); + } + + private java.util.List ChildFolders = new java.util.ArrayList(); + + /** + * Gets the Child Folders. + * + * @return the ChildFolders + */ + public java.util.List getChildFolders() { + return this.ChildFolders; + } + + private java.util.List Messages = new java.util.ArrayList(); + + /** + * Gets the Messages. + * + * @return the Messages + */ + public java.util.List getMessages() { + return this.Messages; + } + private String ParentFolderId; - /** - * Gets the Parent Folder Id. - * - * @return the String - */ - public String getParentFolderId() { - return this.ParentFolderId; - } + /** + * Gets the Parent Folder Id. + * + * @return the String + */ + public String getParentFolderId() { + return this.ParentFolderId; + } - /** - * Sets the Parent Folder Id. - * - * @param value the String - */ - public void setParentFolderId(String value) { - this.ParentFolderId = value; - } + /** + * Sets the Parent Folder Id. + * + * @param value the String + */ + public void setParentFolderId(String value) { + this.ParentFolderId = value; + } + private String DisplayName; - /** - * Gets the Display Name. - * - * @return the String - */ - public String getDisplayName() { - return this.DisplayName; - } + /** + * Gets the Display Name. + * + * @return the String + */ + public String getDisplayName() { + return this.DisplayName; + } - /** - * Sets the Display Name. - * - * @param value the String - */ - public void setDisplayName(String value) { - this.DisplayName = value; - } + /** + * Sets the Display Name. + * + * @param value the String + */ + public void setDisplayName(String value) { + this.DisplayName = value; + } + private Integer ChildFolderCount; - /** - * Gets the Child Folder Count. - * - * @return the Integer - */ - public Integer getChildFolderCount() { - return this.ChildFolderCount; - } + /** + * Gets the Child Folder Count. + * + * @return the Integer + */ + public Integer getChildFolderCount() { + return this.ChildFolderCount; + } - /** - * Sets the Child Folder Count. - * - * @param value the Integer - */ - public void setChildFolderCount(Integer value) { - this.ChildFolderCount = value; - } + /** + * Sets the Child Folder Count. + * + * @param value the Integer + */ + public void setChildFolderCount(Integer value) { + this.ChildFolderCount = value; + } } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Item.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Item.java index 77bdb9f8..359d3ed3 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Item.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Item.java @@ -10,84 +10,88 @@ */ public class Item extends Entity { - public Item(){ - setODataType("#Microsoft.OutlookServices.Item"); - } + public Item(){ + setODataType("#Microsoft.OutlookServices.Item"); + } + private String ChangeKey; - /** - * Gets the Change Key. - * - * @return the String - */ - public String getChangeKey() { - return this.ChangeKey; - } + /** + * Gets the Change Key. + * + * @return the String + */ + public String getChangeKey() { + return this.ChangeKey; + } - /** - * Sets the Change Key. - * - * @param value the String - */ - public void setChangeKey(String value) { - this.ChangeKey = value; - } + /** + * Sets the Change Key. + * + * @param value the String + */ + public void setChangeKey(String value) { + this.ChangeKey = value; + } + private java.util.List Categories; - /** - * Gets the Categories. - * - * @return the java.util.List - */ - public java.util.List getCategories() { - return this.Categories; - } + /** + * Gets the Categories. + * + * @return the java.util.List + */ + public java.util.List getCategories() { + return this.Categories; + } - /** - * Sets the Categories. - * - * @param value the java.util.List - */ - public void setCategories(java.util.List value) { - this.Categories = value; - } + /** + * Sets the Categories. + * + * @param value the java.util.List + */ + public void setCategories(java.util.List value) { + this.Categories = value; + } + private java.util.Calendar DateTimeCreated; - /** - * Gets the Date Time Created. - * - * @return the java.util.Calendar - */ - public java.util.Calendar getDateTimeCreated() { - return this.DateTimeCreated; - } + /** + * Gets the Date Time Created. + * + * @return the java.util.Calendar + */ + public java.util.Calendar getDateTimeCreated() { + return this.DateTimeCreated; + } - /** - * Sets the Date Time Created. - * - * @param value the java.util.Calendar - */ - public void setDateTimeCreated(java.util.Calendar value) { - this.DateTimeCreated = value; - } + /** + * Sets the Date Time Created. + * + * @param value the java.util.Calendar + */ + public void setDateTimeCreated(java.util.Calendar value) { + this.DateTimeCreated = value; + } + private java.util.Calendar DateTimeLastModified; - /** - * Gets the Date Time Last Modified. - * - * @return the java.util.Calendar - */ - public java.util.Calendar getDateTimeLastModified() { - return this.DateTimeLastModified; - } + /** + * Gets the Date Time Last Modified. + * + * @return the java.util.Calendar + */ + public java.util.Calendar getDateTimeLastModified() { + return this.DateTimeLastModified; + } - /** - * Sets the Date Time Last Modified. - * - * @param value the java.util.Calendar - */ - public void setDateTimeLastModified(java.util.Calendar value) { - this.DateTimeLastModified = value; - } + /** + * Sets the Date Time Last Modified. + * + * @param value the java.util.Calendar + */ + public void setDateTimeLastModified(java.util.Calendar value) { + this.DateTimeLastModified = value; + } } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/ItemAttachment.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/ItemAttachment.java index 32b9a50e..3ac7d2c5 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/ItemAttachment.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/ItemAttachment.java @@ -10,8 +10,28 @@ */ public class ItemAttachment extends Attachment { - public ItemAttachment(){ - setODataType("#Microsoft.OutlookServices.ItemAttachment"); - } + public ItemAttachment(){ + setODataType("#Microsoft.OutlookServices.ItemAttachment"); + } -} \ No newline at end of file + + private Item Item = null; + + /** + * Gets the Item. + * + * @return the Item + */ + public Item getItem() { + return this.Item; + } + + /** + * Sets the Item. + * + * @param value the Item + */ + public void setItem(Item value) { + this.Item = value; + } + } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Message.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Message.java index 5bfaaa47..87649d3a 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Message.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/Message.java @@ -10,388 +10,419 @@ */ public class Message extends Item { - public Message(){ - setODataType("#Microsoft.OutlookServices.Message"); - } - + public Message(){ + setODataType("#Microsoft.OutlookServices.Message"); + } + + + private java.util.List Attachments = new java.util.ArrayList(); + + /** + * Gets the Attachments. + * + * @return the Attachments + */ + public java.util.List getAttachments() { + return this.Attachments; + } + private String Subject; - /** - * Gets the Subject. - * - * @return the String - */ - public String getSubject() { - return this.Subject; - } - - /** - * Sets the Subject. - * - * @param value the String - */ - public void setSubject(String value) { - this.Subject = value; - } + /** + * Gets the Subject. + * + * @return the String + */ + public String getSubject() { + return this.Subject; + } + + /** + * Sets the Subject. + * + * @param value the String + */ + public void setSubject(String value) { + this.Subject = value; + } + private ItemBody Body; - /** - * Gets the Body. - * - * @return the ItemBody - */ - public ItemBody getBody() { - return this.Body; - } - - /** - * Sets the Body. - * - * @param value the ItemBody - */ - public void setBody(ItemBody value) { - this.Body = value; - } + /** + * Gets the Body. + * + * @return the ItemBody + */ + public ItemBody getBody() { + return this.Body; + } + + /** + * Sets the Body. + * + * @param value the ItemBody + */ + public void setBody(ItemBody value) { + this.Body = value; + } + private String BodyPreview; - /** - * Gets the Body Preview. - * - * @return the String - */ - public String getBodyPreview() { - return this.BodyPreview; - } - - /** - * Sets the Body Preview. - * - * @param value the String - */ - public void setBodyPreview(String value) { - this.BodyPreview = value; - } + /** + * Gets the Body Preview. + * + * @return the String + */ + public String getBodyPreview() { + return this.BodyPreview; + } + + /** + * Sets the Body Preview. + * + * @param value the String + */ + public void setBodyPreview(String value) { + this.BodyPreview = value; + } + private Importance Importance; - /** - * Gets the Importance. - * - * @return the Importance - */ - public Importance getImportance() { - return this.Importance; - } - - /** - * Sets the Importance. - * - * @param value the Importance - */ - public void setImportance(Importance value) { - this.Importance = value; - } + /** + * Gets the Importance. + * + * @return the Importance + */ + public Importance getImportance() { + return this.Importance; + } + + /** + * Sets the Importance. + * + * @param value the Importance + */ + public void setImportance(Importance value) { + this.Importance = value; + } + private Boolean HasAttachments; - /** - * Gets the Has Attachments. - * - * @return the Boolean - */ - public Boolean getHasAttachments() { - return this.HasAttachments; - } - - /** - * Sets the Has Attachments. - * - * @param value the Boolean - */ - public void setHasAttachments(Boolean value) { - this.HasAttachments = value; - } + /** + * Gets the Has Attachments. + * + * @return the Boolean + */ + public Boolean getHasAttachments() { + return this.HasAttachments; + } + + /** + * Sets the Has Attachments. + * + * @param value the Boolean + */ + public void setHasAttachments(Boolean value) { + this.HasAttachments = value; + } + private String ParentFolderId; - /** - * Gets the Parent Folder Id. - * - * @return the String - */ - public String getParentFolderId() { - return this.ParentFolderId; - } - - /** - * Sets the Parent Folder Id. - * - * @param value the String - */ - public void setParentFolderId(String value) { - this.ParentFolderId = value; - } + /** + * Gets the Parent Folder Id. + * + * @return the String + */ + public String getParentFolderId() { + return this.ParentFolderId; + } + + /** + * Sets the Parent Folder Id. + * + * @param value the String + */ + public void setParentFolderId(String value) { + this.ParentFolderId = value; + } + private Recipient From; - /** - * Gets the From. - * - * @return the Recipient - */ - public Recipient getFrom() { - return this.From; - } - - /** - * Sets the From. - * - * @param value the Recipient - */ - public void setFrom(Recipient value) { - this.From = value; - } + /** + * Gets the From. + * + * @return the Recipient + */ + public Recipient getFrom() { + return this.From; + } + + /** + * Sets the From. + * + * @param value the Recipient + */ + public void setFrom(Recipient value) { + this.From = value; + } + private Recipient Sender; - /** - * Gets the Sender. - * - * @return the Recipient - */ - public Recipient getSender() { - return this.Sender; - } - - /** - * Sets the Sender. - * - * @param value the Recipient - */ - public void setSender(Recipient value) { - this.Sender = value; - } + /** + * Gets the Sender. + * + * @return the Recipient + */ + public Recipient getSender() { + return this.Sender; + } + + /** + * Sets the Sender. + * + * @param value the Recipient + */ + public void setSender(Recipient value) { + this.Sender = value; + } + private java.util.List ToRecipients; - /** - * Gets the To Recipients. - * - * @return the java.util.List - */ - public java.util.List getToRecipients() { - return this.ToRecipients; - } - - /** - * Sets the To Recipients. - * - * @param value the java.util.List - */ - public void setToRecipients(java.util.List value) { - this.ToRecipients = value; - } + /** + * Gets the To Recipients. + * + * @return the java.util.List + */ + public java.util.List getToRecipients() { + return this.ToRecipients; + } + + /** + * Sets the To Recipients. + * + * @param value the java.util.List + */ + public void setToRecipients(java.util.List value) { + this.ToRecipients = value; + } + private java.util.List CcRecipients; - /** - * Gets the Cc Recipients. - * - * @return the java.util.List - */ - public java.util.List getCcRecipients() { - return this.CcRecipients; - } - - /** - * Sets the Cc Recipients. - * - * @param value the java.util.List - */ - public void setCcRecipients(java.util.List value) { - this.CcRecipients = value; - } + /** + * Gets the Cc Recipients. + * + * @return the java.util.List + */ + public java.util.List getCcRecipients() { + return this.CcRecipients; + } + + /** + * Sets the Cc Recipients. + * + * @param value the java.util.List + */ + public void setCcRecipients(java.util.List value) { + this.CcRecipients = value; + } + private java.util.List BccRecipients; - /** - * Gets the Bcc Recipients. - * - * @return the java.util.List - */ - public java.util.List getBccRecipients() { - return this.BccRecipients; - } - - /** - * Sets the Bcc Recipients. - * - * @param value the java.util.List - */ - public void setBccRecipients(java.util.List value) { - this.BccRecipients = value; - } + /** + * Gets the Bcc Recipients. + * + * @return the java.util.List + */ + public java.util.List getBccRecipients() { + return this.BccRecipients; + } + + /** + * Sets the Bcc Recipients. + * + * @param value the java.util.List + */ + public void setBccRecipients(java.util.List value) { + this.BccRecipients = value; + } + private java.util.List ReplyTo; - /** - * Gets the Reply To. - * - * @return the java.util.List - */ - public java.util.List getReplyTo() { - return this.ReplyTo; - } - - /** - * Sets the Reply To. - * - * @param value the java.util.List - */ - public void setReplyTo(java.util.List value) { - this.ReplyTo = value; - } + /** + * Gets the Reply To. + * + * @return the java.util.List + */ + public java.util.List getReplyTo() { + return this.ReplyTo; + } + + /** + * Sets the Reply To. + * + * @param value the java.util.List + */ + public void setReplyTo(java.util.List value) { + this.ReplyTo = value; + } + private String ConversationId; - /** - * Gets the Conversation Id. - * - * @return the String - */ - public String getConversationId() { - return this.ConversationId; - } - - /** - * Sets the Conversation Id. - * - * @param value the String - */ - public void setConversationId(String value) { - this.ConversationId = value; - } + /** + * Gets the Conversation Id. + * + * @return the String + */ + public String getConversationId() { + return this.ConversationId; + } + + /** + * Sets the Conversation Id. + * + * @param value the String + */ + public void setConversationId(String value) { + this.ConversationId = value; + } + private ItemBody UniqueBody; - /** - * Gets the Unique Body. - * - * @return the ItemBody - */ - public ItemBody getUniqueBody() { - return this.UniqueBody; - } - - /** - * Sets the Unique Body. - * - * @param value the ItemBody - */ - public void setUniqueBody(ItemBody value) { - this.UniqueBody = value; - } + /** + * Gets the Unique Body. + * + * @return the ItemBody + */ + public ItemBody getUniqueBody() { + return this.UniqueBody; + } + + /** + * Sets the Unique Body. + * + * @param value the ItemBody + */ + public void setUniqueBody(ItemBody value) { + this.UniqueBody = value; + } + private java.util.Calendar DateTimeReceived; - /** - * Gets the Date Time Received. - * - * @return the java.util.Calendar - */ - public java.util.Calendar getDateTimeReceived() { - return this.DateTimeReceived; - } - - /** - * Sets the Date Time Received. - * - * @param value the java.util.Calendar - */ - public void setDateTimeReceived(java.util.Calendar value) { - this.DateTimeReceived = value; - } + /** + * Gets the Date Time Received. + * + * @return the java.util.Calendar + */ + public java.util.Calendar getDateTimeReceived() { + return this.DateTimeReceived; + } + + /** + * Sets the Date Time Received. + * + * @param value the java.util.Calendar + */ + public void setDateTimeReceived(java.util.Calendar value) { + this.DateTimeReceived = value; + } + private java.util.Calendar DateTimeSent; - /** - * Gets the Date Time Sent. - * - * @return the java.util.Calendar - */ - public java.util.Calendar getDateTimeSent() { - return this.DateTimeSent; - } - - /** - * Sets the Date Time Sent. - * - * @param value the java.util.Calendar - */ - public void setDateTimeSent(java.util.Calendar value) { - this.DateTimeSent = value; - } + /** + * Gets the Date Time Sent. + * + * @return the java.util.Calendar + */ + public java.util.Calendar getDateTimeSent() { + return this.DateTimeSent; + } + + /** + * Sets the Date Time Sent. + * + * @param value the java.util.Calendar + */ + public void setDateTimeSent(java.util.Calendar value) { + this.DateTimeSent = value; + } + private Boolean IsDeliveryReceiptRequested; - /** - * Gets the Is Delivery Receipt Requested. - * - * @return the Boolean - */ - public Boolean getIsDeliveryReceiptRequested() { - return this.IsDeliveryReceiptRequested; - } - - /** - * Sets the Is Delivery Receipt Requested. - * - * @param value the Boolean - */ - public void setIsDeliveryReceiptRequested(Boolean value) { - this.IsDeliveryReceiptRequested = value; - } + /** + * Gets the Is Delivery Receipt Requested. + * + * @return the Boolean + */ + public Boolean getIsDeliveryReceiptRequested() { + return this.IsDeliveryReceiptRequested; + } + + /** + * Sets the Is Delivery Receipt Requested. + * + * @param value the Boolean + */ + public void setIsDeliveryReceiptRequested(Boolean value) { + this.IsDeliveryReceiptRequested = value; + } + private Boolean IsReadReceiptRequested; - /** - * Gets the Is Read Receipt Requested. - * - * @return the Boolean - */ - public Boolean getIsReadReceiptRequested() { - return this.IsReadReceiptRequested; - } - - /** - * Sets the Is Read Receipt Requested. - * - * @param value the Boolean - */ - public void setIsReadReceiptRequested(Boolean value) { - this.IsReadReceiptRequested = value; - } + /** + * Gets the Is Read Receipt Requested. + * + * @return the Boolean + */ + public Boolean getIsReadReceiptRequested() { + return this.IsReadReceiptRequested; + } + + /** + * Sets the Is Read Receipt Requested. + * + * @param value the Boolean + */ + public void setIsReadReceiptRequested(Boolean value) { + this.IsReadReceiptRequested = value; + } + private Boolean IsDraft; - /** - * Gets the Is Draft. - * - * @return the Boolean - */ - public Boolean getIsDraft() { - return this.IsDraft; - } - - /** - * Sets the Is Draft. - * - * @param value the Boolean - */ - public void setIsDraft(Boolean value) { - this.IsDraft = value; - } + /** + * Gets the Is Draft. + * + * @return the Boolean + */ + public Boolean getIsDraft() { + return this.IsDraft; + } + + /** + * Sets the Is Draft. + * + * @param value the Boolean + */ + public void setIsDraft(Boolean value) { + this.IsDraft = value; + } + private Boolean IsRead; - /** - * Gets the Is Read. - * - * @return the Boolean - */ - public Boolean getIsRead() { - return this.IsRead; - } - - /** - * Sets the Is Read. - * - * @param value the Boolean - */ - public void setIsRead(Boolean value) { - this.IsRead = value; - } + /** + * Gets the Is Read. + * + * @return the Boolean + */ + public Boolean getIsRead() { + return this.IsRead; + } + + /** + * Sets the Is Read. + * + * @param value the Boolean + */ + public void setIsRead(Boolean value) { + this.IsRead = value; + } } \ No newline at end of file diff --git a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/User.java b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/User.java index 4924cee0..bfd2143d 100755 --- a/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/User.java +++ b/sdk/outlook-services/src/main/java/com/microsoft/outlookservices/User.java @@ -10,65 +10,196 @@ */ public class User extends Entity { - public User(){ - setODataType("#Microsoft.OutlookServices.User"); - } + public User(){ + setODataType("#Microsoft.OutlookServices.User"); + } + + private java.util.List Folders = new java.util.ArrayList(); + + /** + * Gets the Folders. + * + * @return the Folders + */ + public java.util.List getFolders() { + return this.Folders; + } + + private java.util.List Messages = new java.util.ArrayList(); + + /** + * Gets the Messages. + * + * @return the Messages + */ + public java.util.List getMessages() { + return this.Messages; + } + + private Folder RootFolder = null; + + /** + * Gets the Root Folder. + * + * @return the RootFolder + */ + public Folder getRootFolder() { + return this.RootFolder; + } + + /** + * Sets the Root Folder. + * + * @param value the Folder + */ + public void setRootFolder(Folder value) { + this.RootFolder = value; + } + + private java.util.List Calendars = new java.util.ArrayList(); + + /** + * Gets the Calendars. + * + * @return the Calendars + */ + public java.util.List getCalendars() { + return this.Calendars; + } + + private Calendar Calendar = null; + + /** + * Gets the Calendar. + * + * @return the Calendar + */ + public Calendar getCalendar() { + return this.Calendar; + } + + /** + * Sets the Calendar. + * + * @param value the Calendar + */ + public void setCalendar(Calendar value) { + this.Calendar = value; + } + + private java.util.List CalendarGroups = new java.util.ArrayList(); + + /** + * Gets the Calendar Groups. + * + * @return the CalendarGroups + */ + public java.util.List getCalendarGroups() { + return this.CalendarGroups; + } + + private java.util.List Events = new java.util.ArrayList(); + + /** + * Gets the Events. + * + * @return the Events + */ + public java.util.List getEvents() { + return this.Events; + } + + private java.util.List CalendarView = new java.util.ArrayList(); + + /** + * Gets the Calendar View. + * + * @return the CalendarView + */ + public java.util.List getCalendarView() { + return this.CalendarView; + } + + private java.util.List Contacts = new java.util.ArrayList(); + + /** + * Gets the Contacts. + * + * @return the Contacts + */ + public java.util.List getContacts() { + return this.Contacts; + } + + private java.util.List ContactFolders = new java.util.ArrayList(); + + /** + * Gets the Contact Folders. + * + * @return the ContactFolders + */ + public java.util.List getContactFolders() { + return this.ContactFolders; + } + private String DisplayName; - /** - * Gets the Display Name. - * - * @return the String - */ - public String getDisplayName() { - return this.DisplayName; - } - - /** - * Sets the Display Name. - * - * @param value the String - */ - public void setDisplayName(String value) { - this.DisplayName = value; - } + /** + * Gets the Display Name. + * + * @return the String + */ + public String getDisplayName() { + return this.DisplayName; + } + + /** + * Sets the Display Name. + * + * @param value the String + */ + public void setDisplayName(String value) { + this.DisplayName = value; + } + private String Alias; - /** - * Gets the Alias. - * - * @return the String - */ - public String getAlias() { - return this.Alias; - } - - /** - * Sets the Alias. - * - * @param value the String - */ - public void setAlias(String value) { - this.Alias = value; - } + /** + * Gets the Alias. + * + * @return the String + */ + public String getAlias() { + return this.Alias; + } + + /** + * Sets the Alias. + * + * @param value the String + */ + public void setAlias(String value) { + this.Alias = value; + } + private java.util.UUID MailboxGuid; - /** - * Gets the Mailbox Guid. - * - * @return the java.util.UUID - */ - public java.util.UUID getMailboxGuid() { - return this.MailboxGuid; - } - - /** - * Sets the Mailbox Guid. - * - * @param value the java.util.UUID - */ - public void setMailboxGuid(java.util.UUID value) { - this.MailboxGuid = value; - } + /** + * Gets the Mailbox Guid. + * + * @return the java.util.UUID + */ + public java.util.UUID getMailboxGuid() { + return this.MailboxGuid; + } + + /** + * Sets the Mailbox Guid. + * + * @param value the java.util.UUID + */ + public void setMailboxGuid(java.util.UUID value) { + this.MailboxGuid = value; + } } \ No newline at end of file From fc2fc7509bdb09f01824e64c67426ccf3951fabb Mon Sep 17 00:00:00 2001 From: Pablo Zaidenvoren Date: Wed, 19 Nov 2014 10:31:40 -0300 Subject: [PATCH 4/9] projection and expansion support for single entities --- .../services/odata/ODataEntityFetcher.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataEntityFetcher.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataEntityFetcher.java index 2deb45bf..9bba8e63 100755 --- a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataEntityFetcher.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/ODataEntityFetcher.java @@ -25,6 +25,8 @@ public abstract class ODataEntityFetcher implements Readable { private TOperations operations; + private String select; + private String expand; /** * Instantiates a new ODataEntityFetcher. @@ -48,6 +50,15 @@ public ODataEntityFetcher(String urlComponent, ODataExecutable parent, Class oDataExecute(Request request) { ODataURL oDataURL = request.getUrl(); + + if (select != null) { + oDataURL.addQueryStringParameter("$select", select); + } + + if (expand != null) { + oDataURL.addQueryStringParameter("$expand", expand); + } + oDataURL.prependPathComponent(urlComponent); addCustomParametersToODataRequest(request, getParameters(), getHeaders()); @@ -106,6 +117,28 @@ public ListenableFuture read() { return result; } + /** + * Select ODataCollectionFetcher. + * + * @param select the select + * @return the o data collection fetcher + */ + public ODataEntityFetcher select(String select) { + this.select = select; + return this; + } + + /** + * Expand ODataCollectionFetcher. + * + * @param expand the expand + * @return the o data collection fetcher + */ + public ODataEntityFetcher expand(String expand) { + this.expand = expand; + return this; + } + /** * Gets operations. * From c25a4192beca51dfaacce3571f6a4cbcf2ceb1e9 Mon Sep 17 00:00:00 2001 From: Anahi Hojnadel Date: Wed, 19 Nov 2014 10:51:59 -0300 Subject: [PATCH 5/9] Added tests for expand in Exchange --- .../test/integration/tests/ExchangeTests.java | 119 +++++++++++++++++- 1 file changed, 117 insertions(+), 2 deletions(-) diff --git a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java index dc93f2d0..45810e7e 100644 --- a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java +++ b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java @@ -96,7 +96,8 @@ public ExchangeTests() { this.addTest(canFilterMessages("Can use filter in messages", true)); this.addTest(canSelectMessages("Can use select in messages", true)); this.addTest(canTopMessages("Can use top in messages", true)); - + this.addTest(canExpandMessages("Can use expand in messages list", true)); + this.addTest(canExpandMessages("Can use expand in message", true)); } @@ -1235,7 +1236,7 @@ FileAttachment getFileAttachment() { FileAttachment att = new FileAttachment(); att.setContentBytes("hello world".getBytes()); - att.setName("myFile.txt"); + att.setName(UUID.randomUUID().toString() + "-myFile.txt"); return att; } @@ -2348,4 +2349,118 @@ public TestResult executeTest() { test.setEnabled(enabled); return test; } + + private TestCase canExpandMessages(String name, boolean enabled) { + TestCase test = new TestCase() { + + @Override + public TestResult executeTest() { + try { + TestResult result = new TestResult(); + result.setStatus(TestStatus.Failed); + result.setTestCase(this); + + OutlookClient client = ApplicationContext.getMailCalendarContactClient(); + + String messageSubject = "Test message" + UUID.randomUUID().toString(); + Message message = getSampleMessage(messageSubject, ApplicationContext.getTestMail(), ""); + + FileAttachment fileAttachment = getFileAttachment(); + //Prepare + Message added = client.getMe().getMessages().add(message).get(); + client.getMe().getMessages() + .getById(added.getId()) + .getAttachments() + .add(fileAttachment).get(); + + //Act + List messagesWithExpand = client.getMe() + .getFolder("Drafts") + .getMessages() + .filter("Subject eq '" + added.getSubject() + "'") + .expand("Attachments").read().get(); + + List messagesWithoutExpand = client.getMe() + .getFolder("Drafts") + .getMessages() + .filter("Subject eq '" + added.getSubject() + "'") + .read().get(); + + //Assert + if(messagesWithExpand.size() == 1 + && messagesWithoutExpand.size() == 1 + && messagesWithExpand.get(0).getAttachments().size() == 1 + && messagesWithoutExpand.get(0).getAttachments().size() == 0 + && messagesWithExpand.get(0).getAttachments().get(0).getName().equals(fileAttachment.getName())){ + result.setStatus(TestStatus.Passed); + } + + //Cleanup + client.getMe().getMessage(added.getId()).delete().get(); + return result; + } catch (Exception e) { + return createResultFromException(e); + } + } + }; + + test.setName(name); + test.setEnabled(enabled); + return test; + } + + private TestCase canExpandMessage(String name, boolean enabled) { + TestCase test = new TestCase() { + + @Override + public TestResult executeTest() { + try { + TestResult result = new TestResult(); + result.setStatus(TestStatus.Failed); + result.setTestCase(this); + + OutlookClient client = ApplicationContext.getMailCalendarContactClient(); + + String messageSubject = "Test message" + UUID.randomUUID().toString(); + Message message = getSampleMessage(messageSubject, ApplicationContext.getTestMail(), ""); + + FileAttachment fileAttachment = getFileAttachment(); + //Prepare + Message added = client.getMe().getMessages().add(message).get(); + client.getMe().getMessages() + .getById(added.getId()) + .getAttachments() + .add(fileAttachment).get(); + + //Act + Message messageWithExpand = client.getMe() + .getMessage(added.getId()) + .expand("Attachments").read().get(); + + Message messageWithoutExpand = client.getMe() + .getMessage(added.getId()) + .read().get(); + + //Assert + if(messageWithExpand != null + && messageWithoutExpand != null + && messageWithExpand.getAttachments().size() == 1 + && messageWithoutExpand.getAttachments().size() == 0 + && messageWithExpand.getAttachments().get(0).getName().equals(fileAttachment.getName())){ + result.setStatus(TestStatus.Passed); + } + + //Cleanup + client.getMe().getMessage(added.getId()).delete().get(); + return result; + } catch (Exception e) { + return createResultFromException(e); + } + } + }; + + test.setName(name); + test.setEnabled(enabled); + return test; + } } From 2f477f31ccc545bca5358c357f13abc2f732ce98 Mon Sep 17 00:00:00 2001 From: Anahi Hojnadel Date: Wed, 19 Nov 2014 11:31:14 -0300 Subject: [PATCH 6/9] Added test for select in single entities --- .../test/integration/tests/ExchangeTests.java | 52 +++++++++++++++++-- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java index 45810e7e..552a2652 100644 --- a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java +++ b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java @@ -93,11 +93,12 @@ public ExchangeTests() { this.addTest(canUpdateContact("Can update contacts", true)); //Select, top, filter - this.addTest(canFilterMessages("Can use filter in messages", true)); - this.addTest(canSelectMessages("Can use select in messages", true)); - this.addTest(canTopMessages("Can use top in messages", true)); + this.addTest(canFilterMessages("Can use filter in messages list", true)); + this.addTest(canSelectMessages("Can use select in messages list", true)); + this.addTest(canTopMessages("Can use top in messages list", true)); this.addTest(canExpandMessages("Can use expand in messages list", true)); - this.addTest(canExpandMessages("Can use expand in message", true)); + this.addTest(canExpandMessage("Can use expand in message", true)); + this.addTest(canSelectMessage("Can use select in message", true)); } @@ -2463,4 +2464,47 @@ public TestResult executeTest() { test.setEnabled(enabled); return test; } + + private TestCase canSelectMessage(String name, boolean enabled) { + TestCase test = new TestCase() { + + @Override + public TestResult executeTest() { + try { + TestResult result = new TestResult(); + result.setStatus(TestStatus.Failed); + result.setTestCase(this); + + String subject = "Test Subject " + UUID.randomUUID().toString(); + Message message = getSampleMessage(subject, ApplicationContext.getTestMail(), ""); + + OutlookClient client = ApplicationContext.getMailCalendarContactClient(); + + //Prepare + Message addedMessage = client.getMe().getFolders().getById("Drafts").getMessages().add(message).get(); + + //Act + Message messageWithSelect = client.getMe() + .getMessage(addedMessage.getId()) + .select("Subject,DateTimeCreated") + .read().get(); + + //Assert + if (messageWithSelect != null && messageWithSelect.getSubject().equals(subject) && messageWithSelect.getDateTimeReceived() == null) + result.setStatus(TestStatus.Passed); + + //Cleanup + client.getMe().getMessages().getById(addedMessage.getId()).delete().get(); + + return result; + } catch (Exception e) { + return createResultFromException(e); + } + } + }; + + test.setName(name); + test.setEnabled(enabled); + return test; + } } From c559ffe11ba09c41b87f8008397a65c111d90f44 Mon Sep 17 00:00:00 2001 From: Marcos Torres Date: Wed, 19 Nov 2014 12:00:05 -0300 Subject: [PATCH 7/9] removing credentials factory impl --- sdk/odata-engine-android-impl/build.gradle | 3 + .../odata/impl/DefaultDependencyResolver.java | 39 ++++++---- .../services/odata/BaseODataContainer.java | 12 +-- .../impl/http/CredentialsFactoryImpl.java | 26 ------- .../odata/interfaces/CredentialsFactory.java | 5 -- .../odata/interfaces/DependencyResolver.java | 14 ++-- .../desktop/DesktopDependencyResolver.java | 76 ------------------- 7 files changed, 37 insertions(+), 138 deletions(-) delete mode 100644 sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/CredentialsFactoryImpl.java delete mode 100644 sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/CredentialsFactory.java delete mode 100644 sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/DesktopDependencyResolver.java diff --git a/sdk/odata-engine-android-impl/build.gradle b/sdk/odata-engine-android-impl/build.gradle index 637b0909..f5a9eb9a 100644 --- a/sdk/odata-engine-android-impl/build.gradle +++ b/sdk/odata-engine-android-impl/build.gradle @@ -27,6 +27,9 @@ dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.code.gson:gson:2.3' compile project(':odata-engine-core') + compile('com.microsoft.aad:adal:(,2.0)') { + exclude group: 'com.android.support' + } } apply from : '../android-libraries.gradle' \ No newline at end of file diff --git a/sdk/odata-engine-android-impl/src/main/java/com/microsoft/services/odata/impl/DefaultDependencyResolver.java b/sdk/odata-engine-android-impl/src/main/java/com/microsoft/services/odata/impl/DefaultDependencyResolver.java index bb273a9b..b8ff7ba6 100644 --- a/sdk/odata-engine-android-impl/src/main/java/com/microsoft/services/odata/impl/DefaultDependencyResolver.java +++ b/sdk/odata-engine-android-impl/src/main/java/com/microsoft/services/odata/impl/DefaultDependencyResolver.java @@ -2,23 +2,35 @@ import android.os.Build; +import com.microsoft.aad.adal.AuthenticationContext; import com.microsoft.services.odata.Constants; import com.microsoft.services.odata.impl.http.AndroidHttpTransport; import com.microsoft.services.odata.impl.http.RequestImpl; -import com.microsoft.services.odata.interfaces.*; +import com.microsoft.services.odata.interfaces.Credentials; +import com.microsoft.services.odata.interfaces.DependencyResolver; +import com.microsoft.services.odata.interfaces.HttpTransport; +import com.microsoft.services.odata.interfaces.JsonSerializer; +import com.microsoft.services.odata.interfaces.ODataURL; +import com.microsoft.services.odata.interfaces.Request; /** * The type Default dependency resolver. */ public class DefaultDependencyResolver implements DependencyResolver { - private CredentialsFactory credentialsFactory; private LoggerImpl logger; + private AuthenticationContext authenticationContext; + private String resourceId; + private String clientId; /** * Instantiates a new Default dependency resolver. */ - public DefaultDependencyResolver() { + public DefaultDependencyResolver(AuthenticationContext authenticationContext, + final String resourceId, final String clientId ) { + this.authenticationContext = authenticationContext; + this.resourceId = resourceId; + this.clientId = clientId; this.logger = new LoggerImpl(); } @@ -37,11 +49,6 @@ public JsonSerializer getJsonSerializer() { return new GsonSerializer(); } - @Override - public CredentialsFactory getCredentialsFactory() { - return credentialsFactory; - } - @Override public ODataURL createODataURL() { return new ODataURLImpl(); @@ -59,15 +66,15 @@ public String getPlatformUserAgent(String productName) { "%s/1.0 (lang=%s; os=%s; os_version=%s; arch=%s; version=%s)", productName, "Java", "Android", Build.VERSION.RELEASE, Build.CPU_ABI, Constants.SDK_VERSION); - } - /** - * Sets credentials factory. - * - * @param credentialsFactory the credentials factory - */ - public void setCredentialsFactory(CredentialsFactory credentialsFactory) { - this.credentialsFactory = credentialsFactory; + @Override + public Credentials getCredentials() { + return new Credentials() { + @Override + public void prepareRequest(Request request) { + DefaultDependencyResolver.this.authenticationContext.acquireTokenSilentSync(resourceId, clientId, null); + } + }; } } diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/BaseODataContainer.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/BaseODataContainer.java index ded72619..d606f2ef 100755 --- a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/BaseODataContainer.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/BaseODataContainer.java @@ -10,7 +10,6 @@ import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; import com.microsoft.services.odata.interfaces.Credentials; -import com.microsoft.services.odata.interfaces.CredentialsFactory; import com.microsoft.services.odata.interfaces.DependencyResolver; import com.microsoft.services.odata.interfaces.HttpTransport; import com.microsoft.services.odata.interfaces.LogLevel; @@ -69,13 +68,10 @@ protected ListenableFuture oDataExecute(Request request) { } boolean credentialsSet = false; - CredentialsFactory credFactory = resolver.getCredentialsFactory(); - if (credFactory != null) { - Credentials cred = credFactory.getCredentials(); - if (cred != null) { - cred.prepareRequest(request); - credentialsSet = true; - } + Credentials cred = resolver.getCredentials(); + if (cred != null) { + cred.prepareRequest(request); + credentialsSet = true; } if (!credentialsSet) { diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/CredentialsFactoryImpl.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/CredentialsFactoryImpl.java deleted file mode 100644 index 273c7da5..00000000 --- a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/impl/http/CredentialsFactoryImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.microsoft.services.odata.impl.http; - -import com.microsoft.services.odata.interfaces.Credentials; -import com.microsoft.services.odata.interfaces.CredentialsFactory; - -/** - * The type Credentials factory impl. - */ -public class CredentialsFactoryImpl implements CredentialsFactory { - - private Credentials mCredentials; - - @Override - public Credentials getCredentials() { - return mCredentials; - } - - /** - * Set credentials. - * - * @param credentials the credentials - */ - public void setCredentials(Credentials credentials){ - mCredentials = credentials; - } -} diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/CredentialsFactory.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/CredentialsFactory.java deleted file mode 100644 index 78270205..00000000 --- a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/CredentialsFactory.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.microsoft.services.odata.interfaces; - -public interface CredentialsFactory { - public Credentials getCredentials(); -} diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/DependencyResolver.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/DependencyResolver.java index 1eec5f17..90ca4c04 100644 --- a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/DependencyResolver.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/interfaces/DependencyResolver.java @@ -25,13 +25,6 @@ public interface DependencyResolver { */ JsonSerializer getJsonSerializer(); - /** - * Gets credentials factory. - * - * @return the credentials factory - */ - CredentialsFactory getCredentialsFactory(); - /** * Create o data uRL. * @@ -52,4 +45,11 @@ public interface DependencyResolver { * @return the user agent */ String getPlatformUserAgent(String productName); + + /** + * Gets credentials. + * + * @return the credentials + */ + Credentials getCredentials(); } diff --git a/sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/DesktopDependencyResolver.java b/sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/DesktopDependencyResolver.java deleted file mode 100644 index a928511b..00000000 --- a/sdk/odata-engine-jvm-impl/src/main/java/com/microsoft/services/odata/impl/desktop/DesktopDependencyResolver.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.microsoft.services.odata.impl.desktop; - -import com.microsoft.services.odata.Constants; -import com.microsoft.services.odata.impl.ODataURLImpl; -import com.microsoft.services.odata.impl.desktop.http.DesktopHttpTransport; -import com.microsoft.services.odata.impl.http.RequestImpl; -import com.microsoft.services.odata.interfaces.CredentialsFactory; -import com.microsoft.services.odata.interfaces.DependencyResolver; -import com.microsoft.services.odata.interfaces.HttpTransport; -import com.microsoft.services.odata.interfaces.JsonSerializer; -import com.microsoft.services.odata.interfaces.ODataURL; -import com.microsoft.services.odata.interfaces.Request; - -/** - * The type Default dependency resolver. - */ -public class DesktopDependencyResolver implements DependencyResolver { - - private CredentialsFactory credentialsFactory; - private LoggerImpl logger; - - /** - * Instantiates a new Default dependency resolver. - */ - public DesktopDependencyResolver() { - this.logger = new LoggerImpl(); - } - - @Override - public HttpTransport getHttpTransport() { - return new DesktopHttpTransport(); - } - - @Override - public LoggerImpl getLogger() { - return this.logger; - } - - @Override - public JsonSerializer getJsonSerializer() { - return new GsonSerializer(); - } - - @Override - public CredentialsFactory getCredentialsFactory() { - return credentialsFactory; - } - - @Override - public ODataURL createODataURL() { - return new ODataURLImpl(); - } - - @Override - public Request createRequest() { - return new RequestImpl(); - } - - @Override - public String getPlatformUserAgent(String productName) { - - String osName = System.getProperty("os.name"); - return String.format( - "%s/1.0 (lang=%s; os=%s; version=%s)", - productName, "Java", osName, Constants.SDK_VERSION); - } - - /** - * Sets credentials factory. - * - * @param credentialsFactory the credentials factory - */ - public void setCredentialsFactory(CredentialsFactory credentialsFactory) { - this.credentialsFactory = credentialsFactory; - } -} From aca1b55319754d35db742fce2555b9ae35d442ee Mon Sep 17 00:00:00 2001 From: Marcos Torres Date: Wed, 19 Nov 2014 14:00:01 -0300 Subject: [PATCH 8/9] updating test app. removed credentials factory interface and impl --- .../odata/impl/DefaultDependencyResolver.java | 14 ++++---------- .../android/AndroidTestPlatformContext.java | 11 +++-------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/sdk/odata-engine-android-impl/src/main/java/com/microsoft/services/odata/impl/DefaultDependencyResolver.java b/sdk/odata-engine-android-impl/src/main/java/com/microsoft/services/odata/impl/DefaultDependencyResolver.java index b8ff7ba6..342f5b06 100644 --- a/sdk/odata-engine-android-impl/src/main/java/com/microsoft/services/odata/impl/DefaultDependencyResolver.java +++ b/sdk/odata-engine-android-impl/src/main/java/com/microsoft/services/odata/impl/DefaultDependencyResolver.java @@ -2,7 +2,6 @@ import android.os.Build; -import com.microsoft.aad.adal.AuthenticationContext; import com.microsoft.services.odata.Constants; import com.microsoft.services.odata.impl.http.AndroidHttpTransport; import com.microsoft.services.odata.impl.http.RequestImpl; @@ -19,18 +18,13 @@ public class DefaultDependencyResolver implements DependencyResolver { private LoggerImpl logger; - private AuthenticationContext authenticationContext; - private String resourceId; - private String clientId; + private String token; /** * Instantiates a new Default dependency resolver. */ - public DefaultDependencyResolver(AuthenticationContext authenticationContext, - final String resourceId, final String clientId ) { - this.authenticationContext = authenticationContext; - this.resourceId = resourceId; - this.clientId = clientId; + public DefaultDependencyResolver(String token) { + this.token = token; this.logger = new LoggerImpl(); } @@ -73,7 +67,7 @@ public Credentials getCredentials() { return new Credentials() { @Override public void prepareRequest(Request request) { - DefaultDependencyResolver.this.authenticationContext.acquireTokenSilentSync(resourceId, clientId, null); + request.addHeader("Authorization", "Bearer " + token); } }; } diff --git a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/android/AndroidTestPlatformContext.java b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/android/AndroidTestPlatformContext.java index 4e7b8beb..4833418f 100644 --- a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/android/AndroidTestPlatformContext.java +++ b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/android/AndroidTestPlatformContext.java @@ -17,13 +17,11 @@ import com.microsoft.discoveryservices.odata.DiscoveryClient; import com.microsoft.listservices.SharepointListsClient; import com.microsoft.office365.test.integration.TestPlatformContext; -import com.microsoft.office365.test.integration.framework.OAuthCredentials; import com.microsoft.office365.test.integration.framework.TestCase; import com.microsoft.office365.test.integration.framework.TestExecutionCallback; import com.microsoft.office365.test.integration.framework.TestResult; import com.microsoft.outlookservices.odata.OutlookClient; import com.microsoft.services.odata.impl.DefaultDependencyResolver; -import com.microsoft.services.odata.impl.http.CredentialsFactoryImpl; import com.microsoft.services.odata.interfaces.DependencyResolver; import com.microsoft.services.odata.interfaces.LogLevel; import com.microsoft.sharepointservices.odata.SharePointClient; @@ -250,7 +248,8 @@ public void onError(Exception exc) { public void onSuccess(AuthenticationResult result) { TClient client = null; try { - client = clientClass.getDeclaredConstructor(String.class, DependencyResolver.class).newInstance(endpointUrl, getDependencyResolver(result.getAccessToken())); + client = clientClass.getDeclaredConstructor(String.class, DependencyResolver.class) + .newInstance(endpointUrl, getDependencyResolver(result.getAccessToken())); future.set(client); } catch (Throwable t) { onError(new Exception(t)); @@ -303,12 +302,8 @@ public void onSuccess(AuthenticationResult result) { } private DependencyResolver getDependencyResolver(final String token) { - OAuthCredentials credentials = new OAuthCredentials(token); - CredentialsFactoryImpl credFactory = new CredentialsFactoryImpl(); - credFactory.setCredentials(credentials); - DefaultDependencyResolver dependencyResolver = new DefaultDependencyResolver(); - dependencyResolver.setCredentialsFactory(credFactory); + DefaultDependencyResolver dependencyResolver = new DefaultDependencyResolver(token); dependencyResolver.getLogger().setEnabled(true); dependencyResolver.getLogger().setLogLevel(LogLevel.VERBOSE); From e7f700fc1b58518ac4b82139006bcf94c3e64963 Mon Sep 17 00:00:00 2001 From: Anahi Hojnadel Date: Wed, 19 Nov 2014 14:38:37 -0300 Subject: [PATCH 9/9] Added CalendarView test --- .../java/com/microsoft/services/odata/Helpers.java | 2 +- .../test/integration/tests/ExchangeTests.java | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/Helpers.java b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/Helpers.java index 3c7f1f9f..362d4ca0 100644 --- a/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/Helpers.java +++ b/sdk/odata-engine-core/src/main/java/com/microsoft/services/odata/Helpers.java @@ -132,7 +132,7 @@ private static String toODataURLValue(Object o) { } if (o instanceof Calendar) { - return "'" + CalendarSerializer.serialize((Calendar)o) + "'"; + return "" + CalendarSerializer.serialize((Calendar)o) + ""; } return o.toString(); diff --git a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java index 552a2652..4b9c273e 100644 --- a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java +++ b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java @@ -77,7 +77,7 @@ public ExchangeTests() { this.addTest(canGetCalendarById("Can get calendar by id", true)); this.addTest(canUpdateCalendar("Can update calendar", true)); this.addTest(canDeleteCalendar("Can delete calendar", true)); - this.addTest(canGetCalendarView("Can get Calendar View", false)); + this.addTest(canGetCalendarView("Can get Calendar View", true)); //Events this.addTest(canGetEvents("Can get events", true)); @@ -1742,14 +1742,10 @@ public TestResult executeTest() { dateStart.add(java.util.Calendar.HOUR, 2); // Act - List calendarView = new ArrayList(); - /* List calendarView = client.getMe().getCalendarView() - .getOperations() - .addParameter("startdatetime",CalendarSerializer.serialize(dateStart)) - .addParameter("enddatetime", CalendarSerializer.serialize(dateEnd)) + .addParameter("startdatetime",dateStart) + .addParameter("enddatetime", dateEnd) .read().get(); - */ //Assert if(calendarView.size() == 0)