Class Topic3Resource
java.lang.Object
org.ctan.site.resources.catalogue.Topic3Resource
@Path("/3.0")
@Produces({"application/json","application/xml"})
public class Topic3Resource
extends Object
The class
Topic3Resource
contains the controller for the topic
resource.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
The classTopicInfoTo
contains the transport object for topic infos.protected static class
The classTopicPkgTo
contains the transport object for packages.protected static class
The classTopicSummaryTo
contains the transport object for the topic resource in the summary list.protected static class
The classTopicTo
contains the transport object for the topic resource. -
Constructor Summary
ConstructorsConstructorDescriptionTopic3Resource
(@NonNull CtanConfiguration.CtanConfig config, @NonNull TopicStore store, @NonNull ContentService contentService, @NonNull VoteStore voteStore) This is the constructor for the classTopic3Resource
. -
Method Summary
Modifier and TypeMethodDescriptiongetRandomTopics
(int count, String lang) The methodgetRandomTopics
provides means to retrieve a random list of topics.getTopicByKey
(@NonNull String id, String lang) The methodgetTopic
provides means to retrieve a topic by its id.The methodgetTopics
provides means to retrieve a list of authors starting with a given pattern.getTopics0
(String lang) The methodgetTopics0
provides means to retrieve a list of topics starting with a given pattern.getTopicsList
(String lang) The methodgetTopicsList
provides means to retrieve a list of topics starting with a given pattern.
-
Constructor Details
-
Topic3Resource
public Topic3Resource(@NonNull @NonNull CtanConfiguration.CtanConfig config, @NonNull @NonNull TopicStore store, @NonNull @NonNull ContentService contentService, @NonNull @NonNull VoteStore voteStore) This is the constructor for the classTopic3Resource
.- Parameters:
config
- the configurationstore
- the underlying storecontentService
- the content service
-
-
Method Details
-
getRandomTopics
@GET @Path("/rnd/topics") @PermitAll @UnitOfWork("siteDb") public List<Topic3Resource.TopicInfoTo> getRandomTopics(@QueryParam("size") @DefaultValue("3") int count, @QueryParam("lang") @DefaultValue("en") String lang) The methodgetRandomTopics
provides means to retrieve a random list of topics.- Returns:
- the configuration
-
getTopicByKey
@GET @Path("/topic/{id}") @PermitAll @UnitOfWork("siteDb") public Topic3Resource.TopicTo getTopicByKey(@NonNull @PathParam("id") @NonNull String id, @QueryParam("lang") String lang) The methodgetTopic
provides means to retrieve a topic by its id.- Parameters:
id
- the idlang
- the language- Returns:
- the topic or
null
-
getTopics
@GET @Path("/topics/{pattern}") @PermitAll @UnitOfWork("siteDb") public List<Topic3Resource.TopicSummaryTo> getTopics(@PathParam("pattern") String pattern, @QueryParam("lang") String lang, @DefaultValue("0") @QueryParam("page") long page, @DefaultValue("16") @QueryParam("size") long size) The methodgetTopics
provides means to retrieve a list of authors starting with a given pattern.- Parameters:
pattern
- the initial string of the namelang
- the language codepage
- the pagesize
- the page size- Returns:
- a list of matching author summaries
-
getTopics0
@GET @Path("/topics") @PermitAll @UnitOfWork("siteDb") public List<Topic3Resource.TopicSummaryTo> getTopics0(@QueryParam("lang") String lang) The methodgetTopics0
provides means to retrieve a list of topics starting with a given pattern.- Parameters:
lang
- the language code- Returns:
- a list of matching topics
-
getTopicsList
@GET @Path("/topic/list") @PermitAll @UnitOfWork("siteDb") public List<Topic3Resource.TopicSummaryTo> getTopicsList(@QueryParam("lang") String lang) The methodgetTopicsList
provides means to retrieve a list of topics starting with a given pattern.- Parameters:
lang
- the language code- Returns:
- a list of matching topics
-