public interface ShiftService<S extends Shift<T>,V,P,T extends Token<T>> extends TokenContainerService<T,S>
Shift
sModifier and Type | Method and Description |
---|---|
S |
create(V venue,
P place,
Date startDateTime,
User shiftOwner,
String shiftDisplayName,
ShiftStatus overrideDefaultStatus)
Create a shift/scheduled but dont start it
|
S |
determineRoute(T token)
|
void |
end(S shift) |
List<S> |
findInActiveShifts(Object o,
Predicate<S> filter,
boolean activeTokensOnly)
For an object like user/consumer find the shifts they are in, across all Shifts of type
<S> |
List<T> |
findTokensInActiveShifts(Object o,
Predicate<S> filter,
boolean activeTokensOnly)
For an object like user/consumer find the tokens across all Shifts of type
<S> |
S |
getActiveShift(String name)
Get an Active
Shift by its name |
S |
getActiveShift(V venue,
P place,
String shiftDisplayName)
Get current/
ShiftStatus.ACTIVE Shift s for the Venue and PlaceRef This method may throw an exception (impl dependent), if the system maintains more than one active Shift for any location. |
List<S> |
getActiveShifts()
Get all current
ShiftStatus.ACTIVE Shift s in System |
List<S> |
getActiveShifts(V venue)
Get all current
ShiftStatus.ACTIVE Shift s for the Venue |
List<S> |
getActiveShifts(V venue,
P place)
|
default S |
getAssignedContainer(T token)
For a
Token get the container |
S |
getAssignedShift(T token)
|
<DAO> DAO |
getDao()
Get any DAO backing this service
|
T |
getFirstToken(S shift,
Collection states)
Get the first token for a group of status
|
List<T> |
getInProcess(S tokenContainer)
Tokens that out of the Q but being processed
|
T |
getLastToken(S shift,
Collection states)
In Some situations a token may need to be put end of Q in a particular State(s).
|
List<T> |
getNextReadyToProcessTokens(T token,
int n)
Get the next N tokens for tokens in the Same Shift that are Ready to be processed.
|
List<T> |
getPreProcess(S tokenContainer)
Tokens that are not yet eligible to be in Q but are being considered.
|
List<T> |
getProcessed(S tokenContainer)
Tokens that out of the Q and processed
|
List<T> |
getReadyToBeProcessed(S tokenContainer,
T lastToken)
Get tokens ready to be processed; from lastToken (excluding it)
|
S |
getScheduledShift(V venue,
P place,
String shiftDisplayName)
Get next scheduled
Shift |
List<S> |
getScheduledShifts(V venue,
P place)
|
S |
getShift(Object id)
Get
Shift from Id. |
List<T> |
getTokens(S shift)
Get all
Token |
List<T> |
getTokens(S shift,
T afterToken,
Collection states)
Get all tokens since a last token (including it)
|
List<T> |
getTokens(S shift,
T afterToken,
Collection states,
PageInfo pageInfo)
Get all tokens since a last token (including it)
|
List<T> |
getTokens(S shift,
T afterToken,
T beforeToken,
Collection states,
PageInfo pageInfo)
Get all tokens since a last token (including it)
|
List<T> |
getTokensFrom(S shift,
T token,
Collection states)
Get all
Tokens s in sequence till (excluding) the token |
List<T> |
getTokensTill(S shift,
T token,
Collection states)
Get all
Tokens s in sequence till (excluding) the token |
boolean |
isActive(S shift)
Check if a
Shift is active or not |
S |
rename(S shift,
String newDisplayName)
Rename as Shift
|
S |
reset(S shift)
Reset/ReStart a new Shift based on data from an existing one.
|
S |
start(S shift,
String metaJSON)
Start a created shift @ a Venue NOW.
|
default S |
start(V venue,
P place,
AuthenticationToken authToken,
String shiftDisplayName) |
S |
start(V venue,
P place,
AuthenticationToken authToken,
String shiftDisplayName,
String metaJSON)
Start a Shift @ a Venue NOW
|
add, getMaxResultSize, getPositions, getQStatesStrategy, getSequence, getType, hasNext, init, linkTokens, lookup, lookupById, lookupBySequence, lookupBySequence, move, poll, poll, poll, poll, remove, save, size, update, updateStatus, updateStatus
S start(V venue, P place, AuthenticationToken authToken, String shiftDisplayName, String metaJSON) throws Exception
venue
- as Venueplace
- as PlaceRef
within VenueauthToken
- as AuthenticationToken
shiftDisplayName
- as String (optional)metaJSON
- as String as JSON for optional Shift meta data. Like Client Clock Date/Time etc.Exception
- if Shift could not be created or starteddefault S start(V venue, P place, AuthenticationToken authToken, String shiftDisplayName) throws Exception
Exception
S start(S shift, String metaJSON) throws Exception
metaJSON
- as String as JSON for optional Shift meta data. Like Client Clock Date/Time etc.shift
- Exception
- if Shift was not created earlier or could not be startedS create(V venue, P place, Date startDateTime, User shiftOwner, String shiftDisplayName, ShiftStatus overrideDefaultStatus) throws Exception
venue
- as Venueplace
- as PlaceRef
within VenuestartDateTime
- as Date
as when the shift will startshiftOwner
- a User
who owns/manages the shift (optional)shiftDisplayName
- as String (optional)overrideDefaultStatus
- as ShiftStatus
. By default its ShiftStatus.SCHEDULED
however on creation itself
if we wish to override this; then explicitly pass the status or use start(Shift, String)
Exception
- if the Shift could not be createdvoid end(S shift)
shift
- Exception
- if shift already ended or was never started even (optional)S getShift(Object id)
Shift
from Id.
One can use name or some other unique identifier also, however by default Id (Long) is the only one.id
- as Long
S getActiveShift(String name)
Shift
by its namename
- as StringShift
type <S>
boolean isActive(S shift)
Shift
is active or notshift
- as Shift
List<S> getActiveShifts()
ShiftStatus.ACTIVE
Shift
s in SystemList<S> getActiveShifts(V venue)
ShiftStatus.ACTIVE
Shift
s for the VenueS getActiveShift(V venue, P place, String shiftDisplayName)
ShiftStatus.ACTIVE
Shift
s for the Venue and PlaceRef
Shift
for any location.venue
- place
- shiftDisplayName
- as String (nullable)<S>
List<S> getScheduledShifts(V venue, P place)
venue
- as Venueplace
- as PlaceRef
S getScheduledShift(V venue, P place, String shiftDisplayName)
Shift
venue
- place
- shiftDisplayName
- as String (nullable)<S>
S determineRoute(T token) throws TokenProcessingException
token
- TokenProcessingException
List<T> getTokens(S shift, T afterToken, T beforeToken, Collection states, PageInfo pageInfo)
List<T> getTokens(S shift, T afterToken, Collection states, PageInfo pageInfo)
shift
- as Shift
afterToken
- as Token
type states
- as Collection
of status type objects (Optional. If not specified will search across all Status)pageInfo
- as PageInfo. nullable true.List
of Token
sList<T> getTokens(S shift, T afterToken, Collection states)
shift
- as Shift
afterToken
- as Token
type states
- as Collection
of status type objects (Optional. If not specified will search across all Status)List
of Token
sT getLastToken(S shift, Collection states)
shift
- as Shift
states
- as Collection
of status type objects (Optional. If not specified will search across all Status)Token
T getFirstToken(S shift, Collection states)
shift
- as Shift
states
- as Collection
of status type objects (Optional. If not specified will search across all Status)Token
List<T> getNextReadyToProcessTokens(T token, int n)
List<T> getTokensTill(S shift, T token, Collection states)
Tokens
s in sequence till (excluding) the tokenshift
- as Shift
token
- as Token
tillstates
- as Collection
of status type objects (Optional. If not specified will search across all Status)List
of Token
sList<T> getTokensFrom(S shift, T token, Collection states)
Tokens
s in sequence till (excluding) the tokenshift
- as Shift
token
- as Token
from (excluding)states
- as Collection
of status type objects (Optional. If not specified will search across all Status)List
of Token
sList<T> getReadyToBeProcessed(S tokenContainer, T lastToken)
tokenContainer
- as container type lastToken
- as Token
type List
of Token
sQStatesStrategy
List<T> getPreProcess(S tokenContainer)
tokenContainer
- as container type List
of Token
sQStatesStrategy
List<T> getInProcess(S tokenContainer)
tokenContainer
- as container type List
of Token
sQStatesStrategy
,
#getProcessed(TokenContainer)
List<T> getProcessed(S tokenContainer)
tokenContainer
- as container type List
of Token
sQStatesStrategy
,
#getInProcess(TokenContainer)
S reset(S shift)
shift
- as Shift
type <S>
S getAssignedShift(T token)
Token
determine its assigned Shift
.
tokens
- default S getAssignedContainer(T token)
TokenContainerService
Token
get the containergetAssignedContainer
in interface TokenContainerService<T extends Token<T>,S extends Shift<T>>
token
- as Token
List<S> findInActiveShifts(Object o, Predicate<S> filter, boolean activeTokensOnly)
<S>
object
- as object we re findingfilter
- as Predicate
. If Predicate#test(Shift)
is true then only will it include the shift for its search. @nullable trueactiveTokensOnly
- as boolean. If true will scan only active tokens or else will scan all tokens in the history.<S>
. null if not in any Active ShiftList<T> findTokensInActiveShifts(Object o, Predicate<S> filter, boolean activeTokensOnly)
<S>
object
- as object we re findingfilter
- as Predicate
. If Predicate#test(Shift)
is true then only will it include the shift for its search. @nullable trueactiveTokensOnly
- as boolean. If true will scan only active tokens or else will scan all tokens in the history.<S>
. null if not in any Active Shift<DAO> DAO getDao()
Copyright © 2018. All rights reserved.