Class UploadService

java.lang.Object
org.ctan.site.services.upload.UploadService

public class UploadService extends Object
The class UploadService contains the service to access the incoming directory.
  • Constructor Details

    • UploadService

      public UploadService(@NonNull @NonNull CtanConfiguration.UploadConfig config, @NonNull @NonNull UploadStore uploadStore)
      This is the constructor for the class UploadService.
      Parameters:
      config - the CTAN configuration
      uploadStore - the underlying store
  • Method Details

    • get

      public Upload get(@NonNull @NonNull Long id)
      The method getById provides means to retrieve the entity by its id.
      Parameters:
      id - the id
      Returns:
      the entity or null if none is present
    • getAddendum

      public Map<String,String> getAddendum() throws IOException
      The method getAddendum provides means to retrieve the addendum file.
      Returns:
      the addendum
      Throws:
      IOException - in case of an I/O error
    • getIncoming

      public UploadService.IncomingTo getIncoming(String query, long page, long size, String orderBy, Boolean asc) throws FileNotFoundException
      The method getIncoming provides means to retrieve the list of unprocessed packages. The packages are taken from the incoming directory in the configuration.

      The list is paged. Thus several segments can be requested.

      Directories starting with a dot are silently ignored.

      Parameters:
      query - the query pattern
      page - the current page
      size - the page size
      orderBy - the attribute to order by
      asc - sort ascending
      Returns:
      the list of current uploads
      Throws:
      FileNotFoundException - in case that the incoming directory does not exist
    • getStatistics

      public Map<String,Integer> getStatistics()
      The method getStatistics provides means to retrieve the cached upload statistics. The upload statistics contains the number of uploads per month.

      The statistics are cached and updated every 30 minutes.

      Returns:
      the statistics
    • incomingData

      public Map<String,String> incomingData(@NonNull @NonNull String dir) throws IOException
      The method incomingData provides means to parse.
      Parameters:
      dir - the directory
      Returns:
      a key-value map of the incoming data
      Throws:
      IOException - in case of an error
    • list

      public GeneralPage list(String term, int page, int pageSize, String orderBy, boolean asc)
      The method list provides means to extract a page of items.
      Parameters:
      term - the search term
      page - the current page
      pageSize - the page size
      orderBy - the order
      asc - the indicator for ascending
      Returns:
      the page
    • listIncoming

      public GeneralPage listIncoming(String q, int page, int size, String orderBy, boolean asc) throws FileNotFoundException
      The method listIncoming provides means to TODO gene.
      Parameters:
      q - the query string
      page - the current page, 1 based
      size - the page size
      orderBy - the order attribute or null
      asc - the indicator for ascending or descending order
      Returns:
      a page with results
      Throws:
      FileNotFoundException - in case the incoming directory does not name a directory
    • remove

      public boolean remove(@NonNull @NonNull Long id)
      The method remove provides means to remove an entity by its id.
      Parameters:
      id - the id
      Returns:
      true iff something has been removed
    • save

      public Upload save(Upload upload)
      The method save provides means to store an entity.
      Parameters:
      upload - the entity
      Returns:
      the entity