Class IncWorklistHandler<WJ extends WorklistItem,WI extends WorklistItem,I extends InitialIncWorklistData<WI>,N extends IncWorklistData<WI>>
- java.lang.Object
- 
- de.aristaflow.ilm.model.common.AbstractIteratorHandler<IncrementalWorklist<? extends WJ>,I,N>
- 
- de.aristaflow.ilm.model.worklistmodel.IncWorklistHandler<WJ,WI,I,N>
 
 
- 
- Type Parameters:
- WJ- The type of- WorklistItems of the Java model provided by the handled worklists.
- WI- The type of- WorklistItems of the ILM provided by the handled worklists.
- I- The type of the initial data provided when requesting the incremental worklist.
- N- The type of the incremental worklist data when iterating.
 
 public class IncWorklistHandler<WJ extends WorklistItem,WI extends WorklistItem,I extends InitialIncWorklistData<WI>,N extends IncWorklistData<WI>> extends AbstractIteratorHandler<IncrementalWorklist<? extends WJ>,I,N> This class handles incremental worklists by assigning IDs to them and mapping these IDs to the respective incremental worklist. This allows to use aUUIDinstead of a incremental worklist instance and thus simplifying interfaces not supporting Java objects, for instance web services.
 All methods of this class (exceptinit(IncrementalWorklist, Integer)require a UUID identifying the corresponding incremental worklist. If the ID does not refer to an incremental worklist, anIllegalArgumentExceptionwill be thrown.This handler tries to minimise closing effort for incremental worklists. It will close them implicitly if - all items are transferred initially,
- all items are requested at once (countisnull), or
- the incremental worklist contains no items at all.
 nullwill be returned instead ofIncWorklistDataif there are no items (for the current iteration). If the incremental worklist is closed on-the-fly, anIncWorklistDatawill be returned even if there is no content.This class is thread-safe. 
- 
- 
Field SummaryFields Modifier and Type Field Description protected Function<WJ,WI>transformationThe function transforming from the Java-model to ILM.- 
Fields inherited from class de.aristaflow.ilm.model.common.AbstractIteratorHandlerdataCreator, initDataCreator, iterators, iteratorTypeName, logger, removerService
 
- 
 - 
Constructor SummaryConstructors Constructor Description IncWorklistHandler(Function<WJ,WI> transformation, Supplier<I> initDataCreator, Supplier<N> dataCreator, LogService logService)Creates a new handler for incremental worklists.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose(@NotNull UUID iteratorId)CallsServerSideProxy.close()on the designated iterator and removes it from this handler.NgetNext(@NotNull UUID incWorklistId, @Positive Integer count, @PositiveOrZero Integer start)CallsIncrementalWorklist.getNext(int)on the designated incremental worklist.protected NgetNext(UUID incWorklistId, IncrementalWorklist<? extends WJ> iw, Integer count, Integer start)CallsIncrementalWorklist.getNext(int)on the designated incremental worklist.NgetPrevious(@NotNull UUID incWorklistId, @NotNull @Positive Integer count)CallsIncrementalWorklist.getPrevious(int)on the designated incremental worklist.Iinit(IncrementalWorklist<? extends WJ> incWorklist, @Positive Integer count)Adds the designated incremental worklist to this handler, creates an ID for it and callsgetNext(UUID, Integer, Integer)with the designated parameters andstart=null.- 
Methods inherited from class de.aristaflow.ilm.model.common.AbstractIteratorHandlercloseOrDefer, closeOrDefer, getIterator, shutdown
 
- 
 
- 
- 
- 
Field Detail- 
transformationprotected final Function<WJ extends WorklistItem,WI extends WorklistItem> transformation The function transforming from the Java-model to ILM.
 
- 
 - 
Constructor Detail- 
IncWorklistHandlerpublic IncWorklistHandler(Function<WJ,WI> transformation, Supplier<I> initDataCreator, Supplier<N> dataCreator, LogService logService) Creates a new handler for incremental worklists.- Parameters:
- transformation- The function transforming from the Java-model to ILM.
- initDataCreator- The creator for the data provided initially when requesting the incremental worklist.
- dataCreator- The creator for the data provided when iterating.
- logService- The log service to retrieve the logger for log messages from.
 
 
- 
 - 
Method Detail- 
init@NotNull @Valid public I init(IncrementalWorklist<? extends WJ> incWorklist, @Positive @Positive Integer count) Adds the designated incremental worklist to this handler, creates an ID for it and callsgetNext(UUID, Integer, Integer)with the designated parameters andstart=null. The added incremental worklist will be removed from this handler when it is closed. If all data of the incremental worklist is transferred now, the incremental worklist will be closed immediately.- Parameters:
- incWorklist- The incremental worklist to add to this handler.
- count- The amount of worklist items to retrieve in forward direction. This has to be- > 0or- null. If this is- null, all worklist items of the designated incremental worklist will be returned.
- Returns:
- The initial meta data of the incremental worklist and the next n worklist items of the
         designated incremental worklist, where n is the specified count. In case of an
         insufficient amount of next worklist items remaining only the available worklist items
         will be returned. If there are no worklist items, nullwill be returned. If nocountorInteger.MAX_VALUEis specified, all worklist items of the designated incremental worklist will be returned at once and the incremental worklist will be closed.
- Throws:
- IllegalArgumentException- If- countis non-positive (- <= 0), an- IllegalArgumentExceptionwill be thrown.
- IllegalStateException- If the designated incremental worklist has been closed implicitly, an- IllegalStateExceptionwill be thrown on server side.
- de.aristaflow.adept2.model.communication.ServiceConnectionException- If the designated incremental worklist has been closed implicitly, a- ServiceConnectionExceptionwill be thrown on client side.
 
 - 
getNext@NotNull @Valid public N getNext(@NotNull @NotNull UUID incWorklistId, @Positive @Positive Integer count, @PositiveOrZero @PositiveOrZero Integer start) CallsIncrementalWorklist.getNext(int)on the designated incremental worklist. The alive time of the incremental worklist will be extended in case of implicit extension.- Parameters:
- incWorklistId- The ID of the incremental worklist to forward the call to.
- count- The amount of worklist items to retrieve in forward direction. This has to be- > 0or- null. If this is- null, all worklist items of the designated incremental worklist will be returned (- Integer.MAX_VALUE) and the incremental worklist will be closed.
- start- The index of the worklist item from which to retrieve the next count worklist items when requesting a limited amount of worklist items (- count > 0). 0 is the index of the first worklist item. This has to be- >= 0and it must not be bigger than the amounts of worklist items in the designated incremental worklist. If this is- null, the next- countworklist items will be returned.
- Returns:
- Some meta data of the incremental worklist and the next n worklist items of the
         designated incremental worklist, where n is the specified count. In case of an
         insufficient amount of next worklist items remaining only the available worklist items
         (or no worklist items) will be returned. If no countorInteger.MAX_VALUEis specified, all remaining worklist items of the designated incremental worklist will be returned at once.
- Throws:
- IllegalArgumentException- If the designated ID does not refer to an- IncrementalWorklistknown by this handler, an- IllegalArgumentExceptionwill be thrown.
- IllegalArgumentException- If- countis non-positive (- <= 0) or- startis negative (- < 0) or- startrefers to an index that is bigger than the amount of worklist items of the designated incremental worklist, an- IllegalArgumentExceptionwill be thrown.
- IllegalStateException- If the designated incremental worklist has been closed implicitly, an- IllegalStateExceptionwill be thrown on server side.
- de.aristaflow.adept2.model.communication.ServiceConnectionException- If the designated incremental worklist has been closed implicitly, a- ServiceConnectionExceptionwill be thrown on client side.
 
 - 
getNextprotected N getNext(UUID incWorklistId, IncrementalWorklist<? extends WJ> iw, Integer count, Integer start) CallsIncrementalWorklist.getNext(int)on the designated incremental worklist. The alive time of the incremental worklist will be extended in case of implicit extension. If all items of the worklist are requested (countisnull), it will be set to closed at once. The caller of this method has to close the incremental worklist otherwise!- Parameters:
- incWorklistId- The ID of the incremental worklist to forward the call to.
- iw- The incremental worklist to forward the call to.
- count- The amount of worklist items to retrieve in forward direction. This has to be- > 0or- null. If this is- null, all worklist items of the designated incremental worklist will be returned (- Integer.MAX_VALUE) and the incremental worklist will be closed.
- start- The index of the worklist item from which to retrieve the next count worklist items when requesting a limited amount of worklist items (- count > 0). 0 is the index of the first worklist item. This has to be- >= 0and it must not be bigger than the amounts of worklist items in the designated incremental worklist. If this is- null, the next- countworklist items will be returned.
- Returns:
- Some meta data of the incremental worklist and the next n worklist items of the designated incremental worklist, where n is the specified count. In case of an insufficient amount of next worklist items remaining only the available worklist items (or no worklist items) will be returned.
- Throws:
- IllegalArgumentException- If the designated ID does not refer to an- IncrementalWorklistknown by this handler, an- IllegalArgumentExceptionwill be thrown.
- IllegalArgumentException- If- countis non-positive (- <= 0) or- startis negative (- < 0) or- startrefers to an index that is bigger than the amount of worklist items of the designated incremental worklist, an- IllegalArgumentExceptionwill be thrown.
- IllegalStateException- If the designated incremental worklist has been closed implicitly, an- IllegalStateExceptionwill be thrown on server side.
- de.aristaflow.adept2.model.communication.ServiceConnectionException- If the designated incremental worklist has been closed implicitly, a- ServiceConnectionExceptionwill be thrown on client side.
 
 - 
getPrevious@NotNull @Valid public N getPrevious(@NotNull @NotNull UUID incWorklistId, @NotNull @Positive @NotNull @Positive Integer count) CallsIncrementalWorklist.getPrevious(int)on the designated incremental worklist.- Parameters:
- incWorklistId- The ID of the incremental worklist to forward the call to.
- count- The amount of worklist items to retrieve in backward direction. This has to be > 0.
- Returns:
- The ID of the incremental worklist and the previous n worklist items, where n is the
         specified count. The order corresponds to the one in the underlying data structure,
         that is previous worklist items in the returned list are also previous worklist items
         in the data structure. In case of an insufficient amount of previous worklist items
         remaining only the available worklist items will be returned. If there are no more
         previous worklist items, nullwill be returned as flat items.
- Throws:
- IllegalArgumentException- If the designated ID does not refer to an- IncrementalWorklistknown by this handler, an- IllegalArgumentExceptionwill be thrown.
- IllegalArgumentException- If the designated incremental worklist does not have any previous worklist items or count is non-positive (<= 0), an- IllegalArgumentExceptionwill be thrown.
- IllegalStateException- If the designated incremental worklist has been closed implicitly, an- IllegalStateExceptionwill be thrown on server side.
- de.aristaflow.adept2.model.communication.ServiceConnectionException- If the designated incremental worklist has been closed implicitly, a- ServiceConnectionExceptionwill be thrown on client side.
 
 - 
closepublic void close(@NotNull @NotNull UUID iteratorId)CallsServerSideProxy.close()on the designated iterator and removes it from this handler. This implementation callsIncrementalWorklist.close()which does not throw anIOExceptionand handles legacy callingIncrementalWorklist.drop()on proxies from old servers.- Overrides:
- closein class- AbstractIteratorHandler<IncrementalWorklist<? extends WJ extends WorklistItem>,I extends InitialIncWorklistData<WI>,N extends IncWorklistData<WI>>
- Parameters:
- iteratorId- The ID of the iterator to close.
 
 
- 
 
-