public final class AsynchronousUploadPrimitivesTask extends UploadPrimitivesTask
UploadPrimitivesTask
. This class is a wrapper over that to make the background upload process safe. There
can only be one instance of this class, hence background uploads are limited to one at a time. This class also
changes the editLayer of MainLayerManager
to null during upload so that
any changes to the uploading layer are prohibited.Modifier and Type | Field and Description |
---|---|
private static AsynchronousUploadPrimitivesTask |
asynchronousUploadPrimitivesTask
Static instance
|
private ProgressTaskId |
taskId
Member fields
|
private OsmDataLayer |
uploadDataLayer |
progressMonitor
Modifier | Constructor and Description |
---|---|
private |
AsynchronousUploadPrimitivesTask(UploadStrategySpecification uploadStrategySpecification,
OsmDataLayer osmDataLayer,
APIDataSet apiDataSet,
Changeset changeset)
Private constructor to restrict creating more Asynchronous upload tasks
|
Modifier and Type | Method and Description |
---|---|
protected void |
cancel()
User pressed cancel button.
|
ProgressTaskId |
canRunInBackground()
Task can run in background if returned value != null.
|
static java.util.Optional<AsynchronousUploadPrimitivesTask> |
createAsynchronousUploadTask(UploadStrategySpecification uploadStrategySpecification,
OsmDataLayer dataLayer,
APIDataSet apiDataSet,
Changeset changeset)
Creates an instance of AsynchronousUploadPrimitiveTask
|
protected void |
finish()
Finish up the data work.
|
static java.util.Optional<AsynchronousUploadPrimitivesTask> |
getCurrentAsynchronousUploadTask()
Get the current upload task
|
protected void |
realRun()
Called in the worker thread to do the actual work.
|
askMaxChangesetSizeExceedsPolicy, cleanupAfterUpload, openNewChangeset, recoverFromChangesetFullException, recoverFromGoneOnServer
handleFailedUpload, handleGone, handlePreconditionFailed, handleUploadConflict, handleUploadConflictForClosedChangeset, handleUploadConflictForKnownConflict, handleUploadConflictForUnknownConflict, handleUploadPreconditionFailedConflict, synchronizeDataSet, synchronizePrimitive
afterFinish, getProgressMonitor, operationCanceled, run
private static AsynchronousUploadPrimitivesTask asynchronousUploadPrimitivesTask
private final ProgressTaskId taskId
private final OsmDataLayer uploadDataLayer
private AsynchronousUploadPrimitivesTask(UploadStrategySpecification uploadStrategySpecification, OsmDataLayer osmDataLayer, APIDataSet apiDataSet, Changeset changeset)
uploadStrategySpecification
- UploadStrategySpecification for the DataLayerosmDataLayer
- Datalayer to be uploadedapiDataSet
- ApiDataSet that contains the primitives to be uploadedchangeset
- Changeset for the datalayerjava.lang.IllegalArgumentException
- if layer is nulljava.lang.IllegalArgumentException
- if toUpload is nulljava.lang.IllegalArgumentException
- if strategy is nulljava.lang.IllegalArgumentException
- if changeset is nullpublic static java.util.Optional<AsynchronousUploadPrimitivesTask> createAsynchronousUploadTask(UploadStrategySpecification uploadStrategySpecification, OsmDataLayer dataLayer, APIDataSet apiDataSet, Changeset changeset)
uploadStrategySpecification
- UploadStrategySpecification for the DataLayerdataLayer
- Datalayer to be uploadedapiDataSet
- ApiDataSet that contains the primitives to be uploadedchangeset
- Changeset for the datalayerjava.lang.IllegalArgumentException
- if layer is nulljava.lang.IllegalArgumentException
- if toUpload is nulljava.lang.IllegalArgumentException
- if strategy is nulljava.lang.IllegalArgumentException
- if changeset is nullpublic static java.util.Optional<AsynchronousUploadPrimitivesTask> getCurrentAsynchronousUploadTask()
public ProgressTaskId canRunInBackground()
PleaseWaitRunnable
canRunInBackground
in class PleaseWaitRunnable
protected void realRun()
PleaseWaitRunnable
realRun
in class UploadPrimitivesTask
protected void cancel()
PleaseWaitRunnable
cancel
in class UploadPrimitivesTask
protected void finish()
PleaseWaitRunnable
finish
in class UploadPrimitivesTask