Package org.somda.sdc.glue.consumer.sco
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 ScoTransactionThe implementation supports an internal function to trigger reception of incoming reports, see
receiveIncomingReport(OperationInvokedReport.ReportPart).
-
-
Constructor Summary
Constructors Constructor Description ScoTransactionImpl(T response, Consumer<org.somda.sdc.biceps.model.message.OperationInvokedReport.ReportPart> reportListener, org.somda.sdc.common.util.ObjectUtil objectUtil, ScoUtil scoUtil)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<org.somda.sdc.biceps.model.message.OperationInvokedReport.ReportPart>getReports()Gets all reports received so far.TgetResponse()Gets set response message.longgetTransactionId()Gets the transaction id.voidreceiveIncomingReport(org.somda.sdc.biceps.model.message.OperationInvokedReport.ReportPart report)Internal function to trigger reception of an incoming report.List<org.somda.sdc.biceps.model.message.OperationInvokedReport.ReportPart>waitForFinalReport(Duration waitTime)Starts waiting for a final report.
-
-
-
Method Detail
-
getTransactionId
public long getTransactionId()
Description copied from interface:ScoTransactionGets the transaction id.Shortcut of accessing
getTransactionId()ofScoTransaction.getResponse().- Specified by:
getTransactionIdin interfaceScoTransaction<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:ScoTransactionGets all reports received so far.- Specified by:
getReportsin interfaceScoTransaction<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:ScoTransactionGets set response message.- Specified by:
getResponsein interfaceScoTransaction<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:ScoTransactionStarts waiting for a final report.A report is final if
ScoUtil.isFinalReport(OperationInvokedReport.ReportPart)holds true.- Specified by:
waitForFinalReportin interfaceScoTransaction<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.
-
-