diff --git a/api/archive-mgr/src/main/java/de/dlr/proseo/archivemgr/rest/ProductArchiveControllerImpl.java b/api/archive-mgr/src/main/java/de/dlr/proseo/archivemgr/rest/ProductArchiveControllerImpl.java index f5c1f19fb..dd2ba4c28 100644 --- a/api/archive-mgr/src/main/java/de/dlr/proseo/archivemgr/rest/ProductArchiveControllerImpl.java +++ b/api/archive-mgr/src/main/java/de/dlr/proseo/archivemgr/rest/ProductArchiveControllerImpl.java @@ -62,18 +62,21 @@ public ResponseEntity createArchive(RestProductArchive archi /** * List of all product archives with no search criteria * - * @param code the unique product archive name + * @param name the product archive name + * @param archiveType the product archive type + * @param recordFrom first record of filtered and ordered result to return + * @param recordTo last record of filtered and ordered result to return * @return a response entity with either a list of product archives and HTTP status OK or an error message and an HTTP status * indicating failure */ @Override - public ResponseEntity> getArchives(String code) { + public ResponseEntity> getArchives(String name, String archiveType, Integer recordFrom, Integer recordTo) { if (logger.isTraceEnabled()) - logger.trace(">>> getArchives( {})", code); + logger.trace(">>> getArchives( {}, {}, {}, {})", name, archiveType, recordFrom, recordTo); try { - return new ResponseEntity<>(productArchiveManager.getArchivesByCode(code), HttpStatus.OK); + return new ResponseEntity<>(productArchiveManager.getArchives(name, archiveType, recordFrom, recordTo), HttpStatus.OK); } catch (NoResultException e) { return new ResponseEntity<>(http.errorHeaders(e.getMessage()), HttpStatus.NOT_FOUND); @@ -166,4 +169,23 @@ public ResponseEntity modifyArchive(Long id, RestProductArch } } + /** + * Count the product archives matching the specified name, archive type. + * + * @param name the product archive name + * @param archiveType the product archive type + * @return the number of matching archives as a String (may be zero) or HTTP status "FORBIDDEN" and an error message */ + @Override + public ResponseEntity countArchives(String name, String archiveType) { + + if (logger.isTraceEnabled()) + logger.trace(">>> countArchives({}, {})", name, archiveType); + + try { + return new ResponseEntity<>(productArchiveManager.countArchives(name, archiveType), HttpStatus.OK); + } catch (SecurityException e) { + return new ResponseEntity<>(http.errorHeaders(e.getMessage()), HttpStatus.FORBIDDEN); + } + } + } \ No newline at end of file