Package org.ctan.site.services.upload
Class UploadService
java.lang.Object
org.ctan.site.services.upload.UploadService
The class
UploadService contains the service to access the
incoming directory.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe classIncomingTocontains the transport object for the paged list of incoming files. -
Constructor Summary
ConstructorsConstructorDescriptionUploadService(@NonNull CtanConfiguration.UploadConfig config, @NonNull UploadStore uploadStore) This is the constructor for the classUploadService. -
Method Summary
Modifier and TypeMethodDescriptionThe methodgetByIdprovides means to retrieve the entity by its id.The methodgetAddendumprovides means to retrieve the addendum file.getIncoming(String query, long page, long size, String orderBy, Boolean asc) The methodgetIncomingprovides means to retrieve the list of unprocessed packages.The methodgetStatisticsprovides means to retrieve the cached upload statistics.incomingData(@NonNull String dir) The methodincomingDataprovides means to parse.The methodlistprovides means to extract a page of items.listIncoming(String q, int page, int size, String orderBy, boolean asc) The methodlistIncomingprovides means to TODO gene.booleanThe methodremoveprovides means to remove an entity by its id.The methodsaveprovides means to store an entity.
-
Constructor Details
-
UploadService
public UploadService(@NonNull @NonNull CtanConfiguration.UploadConfig config, @NonNull @NonNull UploadStore uploadStore) This is the constructor for the classUploadService.- Parameters:
config- the CTAN configurationuploadStore- the underlying store
-
-
Method Details
-
get
The methodgetByIdprovides means to retrieve the entity by its id.- Parameters:
id- the id- Returns:
- the entity or
nullif none is present
-
getAddendum
The methodgetAddendumprovides 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 methodgetIncomingprovides 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 patternpage- the current pagesize- the page sizeorderBy- the attribute to order byasc- sort ascending- Returns:
- the list of current uploads
- Throws:
FileNotFoundException- in case that the incoming directory does not exist
-
getStatistics
The methodgetStatisticsprovides 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
The methodincomingDataprovides means to parse.- Parameters:
dir- the directory- Returns:
- a key-value map of the incoming data
- Throws:
IOException- in case of an error
-
list
The methodlistprovides means to extract a page of items.- Parameters:
term- the search termpage- the current pagepageSize- the page sizeorderBy- the orderasc- the indicator for ascending- Returns:
- the page
-
listIncoming
public GeneralPage listIncoming(String q, int page, int size, String orderBy, boolean asc) throws FileNotFoundException The methodlistIncomingprovides means to TODO gene.- Parameters:
q- the query stringpage- the current page, 1 basedsize- the page sizeorderBy- the order attribute ornullasc- 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
The methodremoveprovides means to remove an entity by its id.- Parameters:
id- the id- Returns:
trueiff something has been removed
-
save
The methodsaveprovides means to store an entity.- Parameters:
upload- the entity- Returns:
- the entity
-