Class DefaultInboundRequestService.InboundRequestPartsCoordinator
- java.lang.Object
-
- de.hybris.platform.odata2services.odata.monitoring.impl.DefaultInboundRequestService.InboundRequestPartsCoordinator
-
- Enclosing class:
- DefaultInboundRequestService
protected static class DefaultInboundRequestService.InboundRequestPartsCoordinator extends java.lang.ObjectReceives collections of the parts, from which anInboundRequestis created, and coordinates access to the collections in a way that after each iteration the state contains parts (batch entry, change set entry and media) related to exactly sameInboundRequest.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedInboundRequestPartsCoordinator(java.util.Collection<RequestBatchEntity> requests, java.util.Collection<ResponseChangeSetEntity> responses, java.util.Collection<InboundRequestMediaModel> medias)Instantiates this coordinator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected RequestBatchEntitygetBatch()protected ResponseChangeSetEntitygetChangeSet()protected InboundRequestMediaModelgetMedia()protected booleanhasNext()Determines whether there are more batches not yet iterated.protected voidnext()Advances to the next record by iterating across all collections.protected ResponseChangeSetEntityrollToLastChangeSetInBatch()The number of the change sets returned from the parser is not consistent.
-
-
-
Constructor Detail
-
InboundRequestPartsCoordinator
protected InboundRequestPartsCoordinator(java.util.Collection<RequestBatchEntity> requests, java.util.Collection<ResponseChangeSetEntity> responses, java.util.Collection<InboundRequestMediaModel> medias)
Instantiates this coordinator.- Parameters:
requests- allRequestBatchEntitys, for whichInboundRequests need to be created. They represent batches received in the original request.responses- allResponseChangeSetEntitys related to the batch entities. There is no one-to-one relation between batch extracted from the request and change sets extracted from the response. In case of success there will be a change set for every change set received in the request, e.g. if the original request contain a single batch with two change sets, thenrequestswill contain only oneRequestBatchEntityfor the batch butresponseswill contain twoResponseChangeSetEntityfor the change sets. In case of an error, there will be only oneResponseChangeSetEntityfor the corresponding batch regardless of how many changes were in the batch received in the request. And finally, for a global error, e.g. limit of batches per request is exceeded, there will be only oneResponseChangeSetEntityin theresponsesregardless of how many batches were present in the request.medias- bodies of the batches present in the request persisted as medias. Normally it's expected to have number ofmediasequal to number ofrequests.
-
-
Method Detail
-
hasNext
protected boolean hasNext()
Determines whether there are more batches not yet iterated.- Returns:
true, if there is at least one more not iterated batch;false, otherwise.- See Also:
next()
-
next
protected void next()
Advances to the next record by iterating across all collections. SinceInboundRequests correspond toRequestBatchEntity, this method uses the collection ofRequestBatchEntityas the leader. It iterates that collection and then advances to theResponseChangeSetEntityandInboundRequestMediaModelcorresponding to the batch entity in other collections.
-
rollToLastChangeSetInBatch
protected ResponseChangeSetEntity rollToLastChangeSetInBatch()
The number of the change sets returned from the parser is not consistent. In case of success, there is aResponseChangeSetEntitycreated for every change set received with the request. In case of the error, however, it's always only oneResponseChangeSetEntityregardless of how many change sets were submitted in the batch in the request body. That is because if one change set fails, the whole batch is rolled back and therefore a status for the whole batch is returned rather then for each of its change sets.- Returns:
- last change set for the current
RequestBatchEntity. Note: this method relies on theRequestBatchEntityiterated first before this method is called, so that the current batch record would be correctly set. Implementations ensure this order in thenext()method or, if the order has changed, this method also needs to be overridden to account for it. - See Also:
next()
-
getBatch
protected RequestBatchEntity getBatch()
-
getChangeSet
protected ResponseChangeSetEntity getChangeSet()
-
getMedia
protected InboundRequestMediaModel getMedia()
-
-