Class TrsService
java.lang.Object
com.sodius.oslc.server.trs.services.TrsService
Abstract TRS service implementation.
- Since:
- 1.10.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault number of days keeping change events.static final intDefault size of a page.static final StringDefault name for the pageSize parameter.static final StringDefault name for thestartIndexparameter.static final intMaximum size of ChangeLog before re-computing the base.static final intMaximum size of a page. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract TrsFeedControllerCreates theTrsFeedControllerassociated to this service.Returns the Base resource.getChangeLog(Long startingOrderId, Integer pageSize) Returns a Change Log response.protected intGives a change to override theDEFAULT_DAYS_KEEPING_CHANGE_EVENTSparameter.protected intGets the default page size.protected final DateGets the starting date from which older change events will be removed when trs:Base be recomputed.protected StringGets 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 aResourceSeed.protected StringGets the name for getting the startIndex parameter.getTrackedResourceSet(Integer pageSize) Returns a Tracked Resource Set response.protected booleanisBaseOutdated(TrsServiceControl control) Determines whether the Base needs to be recomputed because its data is considered outdated.
-
Field Details
-
MAX_CHANGELOG_SIZE
public static final int MAX_CHANGELOG_SIZEMaximum size of ChangeLog before re-computing the base.- See Also:
-
MAX_PAGE_SIZE
public static final int MAX_PAGE_SIZEMaximum size of a page.- See Also:
-
DEFAULT_PAGE_SIZE
public static final int DEFAULT_PAGE_SIZEDefault size of a page.- See Also:
-
DEFAULT_START_INDEX_PARAM_NAME
Default name for thestartIndexparameter.- See Also:
-
DEFAULT_PAGE_SIZE_PARAM_NAME
Default name for the pageSize parameter.- See Also:
-
DEFAULT_DAYS_KEEPING_CHANGE_EVENTS
public static final int DEFAULT_DAYS_KEEPING_CHANGE_EVENTSDefault number of days keeping change events. Those events older than these days will be removed.- See Also:
-
-
Constructor Details
-
TrsService
public TrsService()
-
-
Method Details
-
createTrsFeedController
Creates theTrsFeedControllerassociated to this service. This method is called only once for this class, the first time the store is being requested.- Returns:
- the
TrsFeedControllerassociated to this service. - Since:
- 3.3.0
-
getSeedsUriFactory
Returns a function that can associate a URI to the resource wrapped by aResourceSeed.- Parameters:
request- the current HTTP request.- Returns:
- a function to compute URIs.
-
getDefaultPageSize
protected int getDefaultPageSize()Gets the default page size. Subclasses may override this method to handle something different fromDEFAULT_PAGE_SIZE.- Returns:
- the
DEFAULT_PAGE_SIZE.
-
getStartIndexParamName
Gets the name for getting the startIndex parameter. Subclasses may override this method to handle something different fromDEFAULT_START_INDEX_PARAM_NAME.- Returns:
- the
DEFAULT_START_INDEX_PARAM_NAME.
-
getPageSizeParamName
Gets the name for getting the pageSize parameter. Subclasses may override this method to handle something different fromDEFAULT_PAGE_SIZE_PARAM_NAME.- Returns:
- the
DEFAULT_PAGE_SIZE_PARAM_NAME.
-
getDeletingChangeEventsDate
Gets the starting date from which older change events will be removed when trs:Base be recomputed.- Returns:
- starting date from which older change events will be removed.
-
getDaysKeepingChangeEvents
protected int getDaysKeepingChangeEvents()Gives a change to override theDEFAULT_DAYS_KEEPING_CHANGE_EVENTSparameter.- Returns:
- the number of days to keep change events.
-
getTrackedResourceSet
@GET @Produces({"text/xml","application/xml","application/rdf+xml","text/turtle"}) public Response getTrackedResourceSet(@QueryParam("oslc.pageSize") Integer pageSize) Returns a Tracked Resource Set response. This method refreshes the Base resource if it is outdated and recomputes the change log using the underlying TrackedResourceSetCollector.- Parameters:
pageSize- used for pagination, indicates the page size if present; otherwisedefault page sizeis used.- Returns:
- the response contained a Tracked Resource Set resource.
- Throws:
OslcWebApplicationException- (BAD_REQUEST) if page size is present and less than 1.
-
getChangeLog
@GET @Path("changeLog") @Produces({"text/xml","application/xml","application/rdf+xml","text/turtle"}) public Response getChangeLog(@QueryParam("startIndex") Long startingOrderId, @QueryParam("oslc.pageSize") Integer pageSize) Returns a Change Log response.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/trsimplieshttps://server/app/trs/changeLog).- Parameters:
startingOrderId- used for pagination, indicates the starting change order on the page.pageSize- used for pagination, indicates the page size if present; otherwisedefault page sizeis used.- Returns:
- the response contained a Change Log resource.
- Throws:
OslcWebApplicationException- (BAD_REQUEST) if page size is present and less than 1.- Since:
- 4.0.0
-
getBase
@GET @Path("base") @Produces({"text/xml","application/xml","application/rdf+xml","text/turtle"}) public Response getBase(@QueryParam("startIndex") Long startMemberId, @QueryParam("oslc.pageSize") Integer pageSize) Returns the Base resource. This method computes the Base resource if it has never been computed.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/trsimplieshttps://server/app/trs/base).- Parameters:
startMemberId- used for pagination, indicates the starting member on the page if present; otherwise means to retrieve the first page.pageSize- used for pagination, indicates the page size if present; otherwisedefault page sizeis used.- Returns:
- the Base resource.
- Throws:
OslcWebApplicationException- (BAD_REQUEST) if page size is present and less than 1.
-
downloadFeed
-
isBaseOutdated
Determines whether the Base needs to be recomputed because its data is considered outdated. If the Base is considered outdated, all events of the ChangeLog are transfered to the Base and the ChangeLog becomes empty. The default strategy is to recompute the Base on a daily basis.- Parameters:
control- the control variables.- Returns:
trueif the Base is outdated and needs to be recomputed;falseotherwise.
-