upload
open fun upload(@Nullable successHandler: Action0, @Nullable failureHandler: Action1<OfflineODataException>)
Uploads local data to update the OData back end.
Example Usage:
// Upload data asynchronously
offlineODataProvider.upload(() -> logger.info("Upload completed successfully."),
(error) -> logger.error("Exception encountered in OfflineOData upload: ", error));
Content copied to clipboard
Parameters
success Handler
a success callback function.
failure Handler
a failure callback function.
See also
Action0
Action1
open fun upload(@Nullable categories: Array<OfflineODataRequestOptions.UploadCategory>, @Nullable successHandler: Action0, @Nullable failureHandler: Action1<OfflineODataException>)
Partial upload allows Offline OData applications to upload a subset of the requests in the request queue. Requests from multiple upload categories can be uploaded together by performing a partial upload, which is accomplished by calling the upload function with a list of upload categories to upload. All requests that the selected requests depend on are included in the upload, even if those requests are not in the specified upload categories.
Example Usage:
// Upload data asynchronously
// Upload with a pre-defined upload category of type string literal
UploadCategory[] sampleUploadCategory1 = { new UploadCategory( "uploadCategory1" );
offlineODataProvider.upload( sampleUploadCategory1,
() -> logger.info("Upload completed successfully."),
(error) -> logger.error("Exception encountered in OfflineOData upload: ", error));
// Upload customer1 with its entity ID as an upload category of type string literal, even if it wasn't originally set as an upload category
UploadCategory[] sampleUploadCategory2 = { new UploadCategory( customer1.getEditLink() ) };
offlineODataProvider.upload( sampleUploadCategory2,
() -> logger.info("Upload completed successfully."),
(error) -> logger.error("Exception encountered in OfflineOData upload: ", error));
// Upload customer2 with its entity value as an upload category of type entity value
UploadCategory[] sampleUploadCategory3 = { new UploadCategory( customer2 ) };
offlineODataProvider.upload( sampleUploadCategory3,
() -> logger.info("Upload completed successfully."),
(error) -> logger.error("Exception encountered in OfflineOData upload: ", error));
}
</pre>
categories Upload categories. The supported upload category types are: StringLiteral, EntityValue. GeneratedID is an unsupported upload category type.
successHandler A success callback function.
failureHandler A failure callback function.
OfflineODataRequestOptions.UploadCategoryType
#cancelUpload()
#download(Action0, Action1)
#download(List, Action0, Action1)
#hasPendingUpload()
OfflineODataDelegate
com.sap.cloud.mobile.odata.core.Action0
com.sap.cloud.mobile.odata.core.Action1Content copied to clipboard