Class ScoTransactionImpl<T extends org.somda.sdc.biceps.model.message.AbstractSetResponse>

java.lang.Object
org.somda.sdc.glue.consumer.sco.ScoTransactionImpl<T>
Type Parameters:
T - the response type.
All Implemented Interfaces:
ScoTransaction<T>

public class ScoTransactionImpl<T extends org.somda.sdc.biceps.model.message.AbstractSetResponse> extends Object implements ScoTransaction<T>
Default implementation of ScoTransaction

The implementation supports an internal function to trigger reception of incoming reports, see receiveIncomingReport(OperationInvokedReport.ReportPart).

  • Constructor Details

    • ScoTransactionImpl

      public ScoTransactionImpl(T response, @Nullable Consumer<org.somda.sdc.biceps.model.message.OperationInvokedReport.ReportPart> reportListener, ScoUtil scoUtil)
  • Method Details

    • getTransactionId

      public long getTransactionId()
      Description copied from interface: ScoTransaction
      Gets the transaction id.

      Shortcut of accessing getTransactionId() of ScoTransaction.getResponse().

      Specified by:
      getTransactionId in interface ScoTransaction<T extends org.somda.sdc.biceps.model.message.AbstractSetResponse>
      Returns:
      the transaction id of this ScoTransactionImpl.
    • getReports

      public List<org.somda.sdc.biceps.model.message.OperationInvokedReport.ReportPart> getReports()
      Description copied from interface: ScoTransaction
      Gets all reports received so far.
      Specified by:
      getReports in interface ScoTransaction<T extends org.somda.sdc.biceps.model.message.AbstractSetResponse>
      Returns:
      Snapshot of received reports as a copy.
    • getResponse

      public T getResponse()
      Description copied from interface: ScoTransaction
      Gets set response message.
      Specified by:
      getResponse in interface ScoTransaction<T extends org.somda.sdc.biceps.model.message.AbstractSetResponse>
      Returns:
      a copy of the set response message of this ScoTransactionImpl.
    • waitForFinalReport

      public List<org.somda.sdc.biceps.model.message.OperationInvokedReport.ReportPart> waitForFinalReport(Duration waitTime)
      Description copied from interface: ScoTransaction
      Starts waiting for a final report.

      A report is final if ScoUtil.isFinalReport(OperationInvokedReport.ReportPart) holds true.

      Specified by:
      waitForFinalReport in interface ScoTransaction<T extends org.somda.sdc.biceps.model.message.AbstractSetResponse>
      Parameters:
      waitTime - maximum wait time until this function returns.
      Returns:
      a list that holds all reports including the final one or an empty list if no final report has been received.
    • receiveIncomingReport

      public void receiveIncomingReport(org.somda.sdc.biceps.model.message.OperationInvokedReport.ReportPart report)
      Internal function to trigger reception of an incoming report.

      Notifies waiting threads.

      Parameters:
      report - the report to receive.