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 classThe author summary.protected static classThe document summary.protected static classThe license summary.protected static classThe classPkgCtanTocontains the package CTAN path transport object.protected static classThe classPkgInfoTocontains the package info transport object.protected static classThe classPkgSummaryTocontains the transport object for the package resource in the summary list.protected static classThe classPkgTocontains the transport object for the package resource.protected static classThe postings summary.protected static classThe 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 methodgetPkgByKeyprovides means to retrieve a package by its id.The methodgetPkgsprovides means to retrieve a list of all packages.The methodgetPkgsprovides means to retrieve a list of packages starting with a given pattern.getRandomPackages(int count, String lang, boolean obsolete, boolean orphaned) The methodgetRandomPackagesprovides 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 methodgetPkgByKeyprovides 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 methodgetPkgsprovides 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 methodgetPkgsprovides 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, @QueryParam("orphaned") @DefaultValue("true") boolean orphaned) The methodgetRandomPackagesprovides means to retrieve a random list of packages.- Parameters:
count- the number of packageslang- the localeobsolete- the indicator whether to include obsolete packagesorphaned- the indicator whether to include orphaned packages- Returns:
- the configuration
-