public abstract class TrsService extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_DAYS_KEEPING_CHANGE_EVENTS
Default number of days keeping change events.
|
static int |
DEFAULT_PAGE_SIZE
Default size of a page.
|
static String |
DEFAULT_PAGE_SIZE_PARAM_NAME
Default name for the pageSize parameter.
|
static String |
DEFAULT_START_INDEX_PARAM_NAME
Default name for the
startIndex parameter. |
static int |
MAX_CHANGELOG_SIZE
Maximum size of ChangeLog before re-computing the base.
|
static int |
MAX_PAGE_SIZE
Maximum size of a page.
|
Constructor and Description |
---|
TrsService() |
Modifier and Type | Method and Description |
---|---|
protected abstract TrackedResourceCollector |
createTrackedResourceCollector()
Creates the
TrackedResourceCollector that determines the resources created, modified and deleted in the system. |
protected abstract TrsStoreSynchronizer |
createTrsStoreSynchronizer()
Creates the TRS store synchronizer where to serialize the base and change log.
|
protected Response |
getBase(Optional<Long> startingMemberId,
Optional<Integer> size)
Returns the Base resource.
|
protected Response |
getChangeLog(int startingOrderId,
Optional<Integer> size)
Returns a Change Log response.
|
protected int |
getDaysKeepingChangeEvents()
Gives a change to override the
DEFAULT_DAYS_KEEPING_CHANGE_EVENTS parameter. |
protected int |
getDefaultPageSize()
Gets the default page size.
|
protected Date |
getDeletingChangeEventsDate()
Gets the starting date from which older change events will be removed when trs:Base be recomputed.
|
protected String |
getPageSizeParamName()
Gets the name for getting the pageSize parameter.
|
protected abstract Function<ResourceSeed,URI> |
getSeedsUriFactory(HttpServletRequest request)
Returns a function that can associate a URI to the resource wrapped by a
ResourceSeed . |
protected String |
getStartIndexParamName()
Gets the name for getting the startIndex parameter.
|
protected Response |
getTrackedResourceSet(Optional<Integer> size)
Returns a Tracked Resource Set response.
|
protected TrsStoreSynchronizer |
getTrsStoreSynchronizer()
Returns the TRS store synchronizer associated to this service, where to serialize the base and change log.
|
protected boolean |
isBaseOutdated(TrsServiceControl control)
Determines whether the Base needs to be recomputed because its data is considered outdated.
|
public static final int MAX_CHANGELOG_SIZE
public static final int MAX_PAGE_SIZE
public static final int DEFAULT_PAGE_SIZE
public static final String DEFAULT_START_INDEX_PARAM_NAME
startIndex
parameter.public static final String DEFAULT_PAGE_SIZE_PARAM_NAME
public static final int DEFAULT_DAYS_KEEPING_CHANGE_EVENTS
protected final TrsStoreSynchronizer getTrsStoreSynchronizer()
createTrsStoreSynchronizer()
method.createTrsStoreSynchronizer()
protected abstract TrsStoreSynchronizer createTrsStoreSynchronizer()
protected abstract TrackedResourceCollector createTrackedResourceCollector()
TrackedResourceCollector
that determines the resources created, modified and deleted in the system.
This method is called only once for this class, the first time the Tracked Resource Set is being requested.protected abstract Function<ResourceSeed,URI> getSeedsUriFactory(HttpServletRequest request)
ResourceSeed
.request
- the current HTTP request.protected int getDefaultPageSize()
DEFAULT_PAGE_SIZE
.DEFAULT_PAGE_SIZE
.protected String getStartIndexParamName()
DEFAULT_START_INDEX_PARAM_NAME
.DEFAULT_START_INDEX_PARAM_NAME
.protected String getPageSizeParamName()
DEFAULT_PAGE_SIZE_PARAM_NAME
.DEFAULT_PAGE_SIZE_PARAM_NAME
.protected final Date getDeletingChangeEventsDate()
protected int getDaysKeepingChangeEvents()
DEFAULT_DAYS_KEEPING_CHANGE_EVENTS
parameter.protected Response getTrackedResourceSet(Optional<Integer> size)
size
- used for pagination, indicates the page size if present; otherwise default page size
is used.OslcWebApplicationException
- (BAD_REQUEST) if page size is present and less than 1.protected Response getChangeLog(int startingOrderId, Optional<Integer> size)
It is required the end-point path for the Change Log is the end point path of the Tracked Resource Set
concatenated with "/changeLog"
(e.g. https://server/app/trs
implies https://server/app/trs/changeLog
).
startingOrderId
- used for pagination, indicates the starting change order on the page.size
- used for pagination, indicates the page size if present; otherwise default page size
is used.OslcWebApplicationException
- (BAD_REQUEST) if page size is present and less than 1.protected Response getBase(Optional<Long> startingMemberId, Optional<Integer> size)
It is required the end-point path for the Base is the end point path of the Tracked Resource Set concatenated with "/base"
(e.g. https://server/app/trs
implies https://server/app/trs/base
).
startingMemberId
- used for pagination, indicates the starting member on the page if present; otherwise means to retrieve the first page.size
- used for pagination, indicates the page size if present; otherwise default page size
is used.OslcWebApplicationException
- (BAD_REQUEST) if page size is present and less than 1.protected boolean isBaseOutdated(TrsServiceControl control)
control
- the control variables.true
if the Base is outdated and needs to be recomputed; false
otherwise.