Class WorkManagerReplicationKt

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static ReplicatorStatus toReplicatorStatus(Data $self, String replId) Convert a Data object found in WorkflowInfo, to a ReplicatorStatusOnce a ReplicatorWorker has been scheduled, its progress can be tracked using the LiveData object provide by the WorkManager, like this:
      WorkManager.getInstance(context).getWorkInfosByTagLiveData(InventoryReplicatorFactory().tag)
      That bit of code will produces a LiveData<List<WorkflowInfo>>.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • toReplicatorStatus

         final static ReplicatorStatus toReplicatorStatus(Data $self, String replId)

        Convert a Data object found in WorkflowInfo, to a ReplicatorStatus

        Once a ReplicatorWorker has been scheduled, its progress can be tracked using the LiveData object provide by the WorkManager, like this:

        WorkManager.getInstance(context).getWorkInfosByTagLiveData(InventoryReplicatorFactory().tag)

        That bit of code will produces a LiveData<List<WorkflowInfo>>. Again, presuming that client code uses the tag from the WorkManagerReplicatorFactory, for this and no other WorkManager jobs, this code can be used to recover the ReplicatorStatus from the Data object in the WorkflowInfo:

             .map {
                if (it.isEmpty()) {
                    null
                } else {
                    it[0].progress.toReplicatorStatus()
                }
            }