Class Pkg3Resource
java.lang.Object
org.ctan.site.resources.catalogue.Pkg3Resource
@Path("/3.0")
@Produces({"application/json","application/xml"})
public class Pkg3Resource
extends Object
The class
Pkg3Resource
contains the controller for the package
resource.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
The author summary.protected static class
The document summary.protected static class
The license summary.protected static class
The classPkgCtanTo
contains the package CTAN path transport object.protected static class
The classPkgInfoTo
contains the package info transport object.protected static class
The classPkgSummaryTo
contains the transport object for the package resource in the summary list.protected static class
The classPkgTo
contains the transport object for the author resource.protected static class
The postings summary.protected static class
The topic summary. -
Constructor Summary
ConstructorsConstructorDescriptionPkg3Resource
(@NonNull CtanConfiguration.CtanConfig config, @NonNull PkgStore store, @NonNull ContentService contentService, @NonNull BibtexService bibtexService, @NonNull PostingsService postingService, @NonNull PkgAliasStore aliasStore) This is the constructor forPkg3Resource
. -
Method Summary
Modifier and TypeMethodDescriptiongetPkgByKey
(@NonNull String key, String language) The methodgetPkgByKey
provides means to retrieve a package by its id.The methodgetPkgs
provides means to retrieve a list of all packages.The methodgetPkgs
provides means to retrieve a list of packages starting with a given pattern.getRandomPackages
(int count, String lang, boolean obsolete) The methodgetRandomPackages
provides means to retrieve a random list of packages.
-
Constructor Details
-
Pkg3Resource
public Pkg3Resource(@NonNull @NonNull CtanConfiguration.CtanConfig config, @NonNull @NonNull PkgStore store, @NonNull @NonNull ContentService contentService, @NonNull @NonNull BibtexService bibtexService, @NonNull @NonNull PostingsService postingService, @NonNull @NonNull PkgAliasStore aliasStore) This is the constructor forPkg3Resource
.- Parameters:
config
- the configurationstore
- the underlying storecontentService
- the content servicebibtexService
- the BibTeX servicepostingService
- the posting cachealiasStore
- the store for package aliases
-
-
Method Details
-
getPkgByKey
@GET @Path("/pkg/{id}") @PermitAll @UnitOfWork("siteDb") public Pkg3Resource.PkgTo getPkgByKey(@NonNull @PathParam("id") @NonNull String key, @QueryParam("lang") String language) The methodgetPkgByKey
provides means to retrieve a package by its id.- Parameters:
key
- the idlanguage
- the locale code- Returns:
- the package or
null
-
getPkgs
@GET @Path("/pkgs") @PermitAll @UnitOfWork("siteDb") public List<Pkg3Resource.PkgSummaryTo> getPkgs(@QueryParam("lang") String lang) The methodgetPkgs
provides means to retrieve a list of all packages.- Parameters:
lang
- the language code- Returns:
- a list of matching package summaries
-
getPkgs
@GET @Path("/pkgs/{pattern}") @PermitAll @UnitOfWork("siteDb") public List<Pkg3Resource.PkgSummaryTo> getPkgs(@PathParam("pattern") String pattern, @QueryParam("lang") String lang) The methodgetPkgs
provides means to retrieve a list of packages starting with a given pattern.- Parameters:
pattern
- the initial string of the keylang
- the language code- Returns:
- a list of matching package summaries
-
getRandomPackages
@GET @Path("/rnd/pkgs") @PermitAll @UnitOfWork("siteDb") public List<Pkg3Resource.PkgInfoTo> getRandomPackages(@QueryParam("size") @DefaultValue("3") int count, @QueryParam("lang") @DefaultValue("en") String lang, @QueryParam("obsolete") @DefaultValue("false") boolean obsolete) The methodgetRandomPackages
provides means to retrieve a random list of packages.- Parameters:
count
- the number of packageslang
- the localeobsolete
- the indicator whether to include obsolete packages- Returns:
- the configuration
-