Example #1
0
        /// <summary>
        /// Prepare HATEOAS links for a identifier based collection resource
        /// </summary>
        /// <param name="wrapper">The linked dto wrapper that will host each link</param>
        /// <param name="workFlowGuid">The unique identifier of the work flow that we are generating analysis for</param>
        /// <param name="analyserTermSetResourceParameters">Standard parameters for representing resource</param>
        /// <param name="hasNext">Are there additional pages</param>
        /// <param name="hasPrevious">Are there previous pages</param>
        /// <returns></returns>
        private LinkedResourceBaseDto CreateLinksForAnalyserTermSets(
            LinkedResourceBaseDto wrapper,
            Guid workFlowGuid,
            AnalyserTermSetResourceParameters analyserTermSetResourceParameters,
            bool hasNext, bool hasPrevious)
        {
            wrapper.Links.Add(
                new LinkDto(
                    _linkGeneratorService.CreateAnalyserTermSetsResourceUri(workFlowGuid, ResourceUriType.Current, analyserTermSetResourceParameters),
                    "self", "GET"));

            if (hasNext)
            {
                wrapper.Links.Add(
                    new LinkDto(
                        _linkGeneratorService.CreateAnalyserTermSetsResourceUri(workFlowGuid, ResourceUriType.NextPage, analyserTermSetResourceParameters),
                        "nextPage", "GET"));
            }

            if (hasPrevious)
            {
                wrapper.Links.Add(
                    new LinkDto(
                        _linkGeneratorService.CreateAnalyserTermSetsResourceUri(workFlowGuid, ResourceUriType.PreviousPage, analyserTermSetResourceParameters),
                        "previousPage", "GET"));
            }

            return(wrapper);
        }