@org.comixedproject.auditlog.AuditableEndpoint

Here are the examples of the java api @org.comixedproject.auditlog.AuditableEndpoint taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

68 Examples 7

19 Source : OPDSController.java
with GNU General Public License v3.0
from comixed

@ResponseBody
@GetMapping(value = "/opds-comics", produces = MediaType.APPLICATION_XML_VALUE)
@CrossOrigin
@AuditableEndpoint
public OPDSFeed getNavigationFeed() throws ParseException {
    return new OPDSNavigationFeed();
}

19 Source : OPDSController.java
with GNU General Public License v3.0
from comixed

@ResponseBody
@GetMapping(value = "/opds-comics/all", produces = MediaType.APPLICATION_XML_VALUE)
@CrossOrigin
@AuditableEndpoint
public OPDSFeed getAllComics() throws ParseException {
    return new OPDSAcquisitionFeed("/opds/all", "Comics - ", this.comicRepository.findAll());
}

19 Source : LibraryController.java
with GNU General Public License v3.0
from comixed

@DeleteMapping(value = "/library/cache/images")
@AuditableEndpoint
public ClearImageCacheResponse clearImageCache() {
    log.info("Clearing the image cache");
    try {
        this.libraryService.clearImageCache();
    } catch (LibraryException error) {
        log.error("failed to clear image cache", error);
        return new ClearImageCacheResponse(false);
    }
    return new ClearImageCacheResponse(true);
}

19 Source : FileController.java
with GNU General Public License v3.0
from comixed

/**
 * Returns the content for the first image in the specified file.
 *
 * @param filename the file
 * @return the image content, or null
 */
@GetMapping(value = "/import/cover")
@AuditableEndpoint
public byte[] getImportFileCover(@RequestParam("filename") String filename) {
    // for some reason, during development, this value ALWAYS had a trailing
    // space...
    filename = filename.trim();
    log.info("Getting cover image for archive: filename={}", filename);
    byte[] result = null;
    try {
        result = this.fileService.getImportFileCover(filename);
    } catch (ComicFileHandlerException | ArchiveAdaptorException error) {
        log.error("Failed to load cover from import file", error);
    }
    if (result == null) {
        try {
            result = IOUtils.toByteArray(this.getClreplaced().getResourcereplacedtream("/images/missing.png"));
        } catch (IOException error) {
            log.error("Failed to load the missing page image", error);
        }
    }
    return result;
}

19 Source : PageController.java
with GNU General Public License v3.0
from comixed

@GetMapping(value = "/pages/types", produces = MediaType.APPLICATION_JSON_VALUE)
@AuditableEndpoint
public Iterable<PageType> getPageTypes() {
    log.info("Fetching page types");
    return this.pageService.getPageTypes();
}

19 Source : PageController.java
with GNU General Public License v3.0
from comixed

@GetMapping(value = "/pages/duplicates", produces = MediaType.APPLICATION_JSON_VALUE)
@JsonView(View.DuplicatePageList.clreplaced)
@AuditableEndpoint
public List<DuplicatePage> getDuplicatePages() {
    log.info("Getting duplicate pages");
    return this.pageService.getDuplicatePages();
}

19 Source : PageController.java
with GNU General Public License v3.0
from comixed

/**
 * Retrieves the content for a single comic page by comic id and page index.
 *
 * @param pageId the comic id
 * @return the page content
 * @throws ComicException if an error occurs
 */
@GetMapping(value = "/pages/{pageId}/content", produces = MediaType.APPLICATION_JSON_VALUE)
@AuditableEndpoint
public ResponseEnreplacedy<byte[]> getPageContent(@PathVariable("pageId") long pageId) throws ComicException {
    log.debug("Getting image content for page: pageId={}", pageId);
    return this.getResponseEnreplacedyForPage(this.pageService.getForId(pageId));
}

19 Source : PageController.java
with GNU General Public License v3.0
from comixed

@DeleteMapping(value = "/pages/hash/{hash}", produces = MediaType.APPLICATION_JSON_VALUE)
@AuditableEndpoint
public int deleteAllWithHash(@PathVariable("hash") String hash) {
    log.info("Marking all pages with hash as deleted: {}", hash);
    return this.pageService.deleteAllWithHash(hash);
}

19 Source : PageController.java
with GNU General Public License v3.0
from comixed

/**
 * Retrieves the content for a page by comic id and page index.
 *
 * @param comicId the comic id
 * @param index the page index
 * @return the page content
 * @throws ComicException if the comic is invalid or the page wasn't found
 */
@GetMapping(value = "/comics/{comic_id}/pages/{index}", produces = MediaType.APPLICATION_JSON_VALUE)
@AuditableEndpoint
public Page getPageInComicByIndex(@PathVariable("comic_id") long comicId, @PathVariable("index") int index) throws ComicException {
    log.info("Getting page in comic: comic id={} page index={}", comicId, index);
    return this.pageService.getPageInComicByIndex(comicId, index);
}

19 Source : PageController.java
with GNU General Public License v3.0
from comixed

@PutMapping(value = "/pages/hash/{hash}", produces = MediaType.APPLICATION_JSON_VALUE)
@AuditableEndpoint
public int undeleteAllWithHash(@PathVariable("hash") String hash) {
    log.info("Marking all pages with hash as undeleted: {}", hash);
    return this.pageService.undeleteAllWithHash(hash);
}

19 Source : PageController.java
with GNU General Public License v3.0
from comixed

@GetMapping(value = "/pages/blocked", produces = MediaType.APPLICATION_JSON_VALUE)
@AuditableEndpoint
public List<String> getAllBlockedPageHashes() {
    log.debug("Getting all blocked page hashes");
    return this.blockedPageHashService.getAllHashes();
}

19 Source : ComicController.java
with GNU General Public License v3.0
from comixed

/**
 * Retrieves a single comic for a user. The comic is populated with user-specific meta-data.
 *
 * @param principal the user principal
 * @param id the comic id
 * @return the comic
 * @throws ComicException if an error occurs
 */
@GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
@JsonView(ComicDetailsView.clreplaced)
@AuditableEndpoint
public Comic getComic(Principal principal, @PathVariable("id") long id) throws ComicException {
    String email = principal.getName();
    log.info("Getting comic for user: id={} user={}", id, email);
    return this.comicService.getComic(id, email);
}

19 Source : ComicController.java
with GNU General Public License v3.0
from comixed

@PutMapping(value = "/{id}/restore", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@JsonView(ComicDetailsView.clreplaced)
@AuditableEndpoint
public Comic restoreComic(@PathVariable("id") final long id) throws ComicException {
    log.info("Restoring comic: id={}", id);
    return this.comicService.restoreComic(id);
}

19 Source : ComicController.java
with GNU General Public License v3.0
from comixed

/**
 * Starts the process of rescanning all comics in the library.
 *
 * @return the number of rescan tasks
 */
@PostMapping(value = "/rescan")
@AuditableEndpoint
public int rescanComics() {
    log.info("Beginning rescan of library");
    final RescanComicsWorkerTask task = this.rescanComicsWorkerTaskObjectFactory.getObject();
    this.taskManager.runTask(task);
    return this.comicService.getRescanCount();
}

19 Source : ComicController.java
with GNU General Public License v3.0
from comixed

@PutMapping(value = "/{id}/format")
@AuditableEndpoint
public void setFormat(@PathVariable("id") long comicId, @RequestParam("format_id") long formatId) throws ComicException {
    log.debug("Setting format: comicId={} formatId={}", comicId, formatId);
    Comic comic = this.comicService.getComic(comicId);
    Optional<ComicFormat> formatRecord = this.comicFormatRepository.findById(formatId);
    if (comic != null && formatRecord.isPresent()) {
        comic.setFormat(formatRecord.get());
        log.debug("Saving updated format");
        this.comicService.save(comic);
    } else {
        log.debug("No such comic found");
    }
}

19 Source : ComicController.java
with GNU General Public License v3.0
from comixed

@DeleteMapping(value = "/{id}/metadata", produces = MediaType.APPLICATION_JSON_VALUE)
@JsonView(ComicDetailsView.clreplaced)
@AuditableEndpoint
public Comic deleteMetadata(@PathVariable("id") long id) throws ComicException {
    log.debug("Updating comic: id={}", id);
    Comic comic = this.comicService.getComic(id);
    if (comic != null) {
        log.debug("Clearing metadata for comic");
        this.comicDataAdaptor.clear(comic);
        log.debug("Saving updates to comic");
        this.comicService.save(comic);
        ComicController.stopWaitingForStatus();
    } else {
        log.debug("No such comic found");
    }
    return comic;
}

19 Source : ComicController.java
with GNU General Public License v3.0
from comixed

@PostMapping(value = "/multiple/delete")
@AuditableEndpoint
public boolean deleteMultipleComics(@RequestParam("comic_ids") List<Long> comicIds) {
    log.debug("Deleting multiple comics: ids={}", comicIds.toArray());
    DeleteComicsWorkerTask task = this.deleteComicsWorkerTaskFactory.getObject();
    log.debug("Setting comic ids");
    task.setComicIds(comicIds);
    log.debug("Queueing the delete task");
    this.taskManager.runTask(task);
    return true;
}

19 Source : ComicController.java
with GNU General Public License v3.0
from comixed

@PutMapping(value = "/{id}/scan_type")
@AuditableEndpoint
public void setScanType(@PathVariable("id") long comicId, @RequestParam("scan_type_id") long scanTypeId) throws ComicException {
    log.debug("Setting scan type: comicId={} scanTypeId={}", comicId, scanTypeId);
    Comic comic = this.comicService.getComic(comicId);
    Optional<ScanType> scanTypeRecord = this.scanTypeRepository.findById(scanTypeId);
    if (comic != null && scanTypeRecord.isPresent()) {
        comic.setScanType(scanTypeRecord.get());
        log.debug("Saving updated scan type");
        this.comicService.save(comic);
    } else {
        log.debug("No such comic found");
    }
}

19 Source : ComicController.java
with GNU General Public License v3.0
from comixed

@PostMapping(value = "/multiple/undelete", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@AuditableEndpoint
public UndeleteMultipleComicsResponse undeleteMultipleComics(@RequestBody() final UndeleteMultipleComicsRequest request) {
    final List<Long> ids = request.getIds();
    log.debug("Undeleting {} comic{}", ids.size(), ids.size() == 1 ? "" : "s");
    final UndeleteComicsWorkerTask task = this.undeleteComicsWorkerTaskObjectFactory.getObject();
    task.setIds(ids);
    this.taskManager.runTask(task);
    return new UndeleteMultipleComicsResponse(true);
}

19 Source : ComicController.java
with GNU General Public License v3.0
from comixed

@PutMapping(value = "/{id}/sort_name")
@AuditableEndpoint
public void setSortName(@PathVariable("id") long comicId, @RequestParam("sort_name") String sortName) throws ComicException {
    log.debug("Setting sort name: comicId={} sortName={}", comicId, sortName);
    Comic comic = this.comicService.getComic(comicId);
    if (comic != null) {
        comic.setSortName(sortName);
        log.debug("Saving updated sorted name");
        this.comicService.save(comic);
    } else {
        log.debug("No such comic found");
    }
}

19 Source : ComicController.java
with GNU General Public License v3.0
from comixed

@PutMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@JsonView(ComicDetailsView.clreplaced)
@AuditableEndpoint
public Comic updateComic(@PathVariable("id") long id, @RequestBody() Comic comic) {
    log.info("Updating comic: id={}", id, comic);
    final Comic result = this.comicService.updateComic(id, comic);
    if (result == null) {
        log.error("No such comic");
    }
    return result;
}

19 Source : ComicController.java
with GNU General Public License v3.0
from comixed

@DeleteMapping(value = "/{id}/read", produces = MediaType.APPLICATION_JSON_VALUE)
@AuditableEndpoint
public boolean markAsUnread(Principal principal, @PathVariable("id") Long id) throws ComicException, ComiXedUserException {
    String email = principal.getName();
    if (email == null)
        throw new ComicException("not authenticated");
    log.info("Marking comic as unread for {}: id={}", email, id);
    return this.comicService.markAsUnread(email, id);
}

18 Source : OPDSController.java
with GNU General Public License v3.0
from comixed

@ResponseBody
@GetMapping(value = "/opds/all", params = { "groupByFolder" }, produces = MediaType.APPLICATION_XML_VALUE)
@CrossOrigin
@AuditableEndpoint
public OPDSFeed getAllLists(Principal principal) {
    return new OPDSNavigationFeed("/opds/all?groupByFolder=true", "Comics - ", this.readingListService.getReadingListsForUser(principal.getName(), new Date(0L)));
}

18 Source : OPDSController.java
with GNU General Public License v3.0
from comixed

@ResponseBody
@GetMapping(value = "/opds/{id}", produces = MediaType.APPLICATION_XML_VALUE)
@CrossOrigin
@AuditableEndpoint
public OPDSFeed getList(Principal principal, @PathVariable("id") long id) throws ParseException, NoSuchReadingListException {
    return new OPDSNavigationFeed("/opds/" + id, "Comics - ", this.readingListService.getReadingListForUser(principal.getName(), id));
}

18 Source : LibraryController.java
with GNU General Public License v3.0
from comixed

@PostMapping(value = "/library/consolidate", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@JsonView(View.DeletedComicList.clreplaced)
@AuditableEndpoint
public List<Comic> consolidateLibrary(@RequestBody() ConsolidateLibraryRequest request) {
    log.info("Consolidating library: delete physic files={}", request.getDeletePhysicalFiles());
    return this.libraryService.consolidateLibrary(request.getDeletePhysicalFiles());
}

18 Source : LibraryController.java
with GNU General Public License v3.0
from comixed

/**
 * Sets the read state for a set of comics.
 *
 * @param principal the user principal
 * @param request the request body
 * @throws LibraryException if an error occurs
 */
@PostMapping(value = "/library/read", consumes = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasRole('ADMIN')")
@AuditableEndpoint
public void setReadState(final Principal principal, @RequestBody() SetReadStateRequest request) throws LibraryException {
    final String email = principal.getName();
    final List<Long> ids = request.getIds();
    final boolean read = request.getRead();
    log.info("Marking comics as {} for {}", read ? "read" : "unread", email);
    this.libraryService.setReadState(email, ids, read);
}

18 Source : ScanTypeController.java
with GNU General Public License v3.0
from comixed

/**
 * Retrieves the list of all scan types.
 *
 * @return the scan type list
 */
@GetMapping(value = "/api/comics/scantypes", produces = MediaType.APPLICATION_JSON_VALUE)
@AuditableEndpoint
public List<ScanType> getScanTypes() {
    log.info("Getting all scan types");
    return this.scanTypeService.getAll();
}

18 Source : PublisherController.java
with GNU General Public License v3.0
from comixed

@GetMapping(value = "/api/publishers/{name}", produces = MediaType.APPLICATION_JSON_VALUE)
@AuditableEndpoint
public Publisher getByName(@PathVariable("name") String name) {
    log.info("Getting publisher: name={}", name);
    return this.publisherService.getByName(name);
}

18 Source : PublisherController.java
with GNU General Public License v3.0
from comixed

@GetMapping(value = "/api/publishers/{name}/thumbnail", produces = MediaType.APPLICATION_JSON_VALUE)
@AuditableEndpoint
public ResponseEnreplacedy<byte[]> getThumbnail(@PathVariable("name") String name) throws IOException {
    log.debug("Getting thumbnail image for publisher: {}", name);
    Publisher publisher = this.publisherService.getByName(name);
    byte[] content = null;
    if (publisher != null) {
        content = publisher.getThumbnail();
    } else {
        content = IOUtils.toByteArray(this.getClreplaced().getResourcereplacedtream("/images/missing-publisher.png"));
    }
    return new ResponseEnreplacedy<>(content, HttpStatus.OK);
}

18 Source : PageController.java
with GNU General Public License v3.0
from comixed

/**
 * Removes the blocked state for a page hash.
 *
 * @param hash the page hash
 */
@DeleteMapping(value = "/pages/blocked/{hash}")
@PreAuthorize("hasRole('ADMIN')")
@AuditableEndpoint
public void deleteBlockedPageHash(@PathVariable("hash") String hash) {
    log.info("Unblocking page hash: {}", hash);
    this.blockedPageHashService.deleteHash(hash);
}

18 Source : PageController.java
with GNU General Public License v3.0
from comixed

/**
 * Marks a page for deletion.
 *
 * @param id the page id
 * @return the parent comic
 */
@DeleteMapping(value = "/pages/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasRole('ADMIN')")
@JsonView(View.ComicDetailsView.clreplaced)
@AuditableEndpoint
public Comic deletePage(@PathVariable("id") long id) {
    log.info("Deleting page: id={}", id);
    return this.pageService.deletePage(id);
}

18 Source : PageController.java
with GNU General Public License v3.0
from comixed

@GetMapping(value = "/comics/{id}/pages", produces = MediaType.APPLICATION_JSON_VALUE)
@JsonView(PageList.clreplaced)
@AuditableEndpoint
public List<Page> getAllPagesForComic(@PathVariable("id") long id) {
    log.info("Getting all pages for comic: id={}", id);
    return this.pageService.getAllPagesForComic(id);
}

18 Source : PageController.java
with GNU General Public License v3.0
from comixed

/**
 * Adds a page has to the list of blocked pages.
 *
 * @param request the request body
 */
@PostMapping(value = "/pages/blocked", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@JsonView(View.ComicDetailsView.clreplaced)
@AuditableEndpoint
public void addBlockedPageHash(@RequestBody() final AddBlockedPageHashRequest request) {
    final String hash = request.getHash();
    log.info("Blocking page hash: {}", hash);
    this.blockedPageHashService.addHash(hash);
}

18 Source : PageController.java
with GNU General Public License v3.0
from comixed

/**
 * Unmarks the page for deletion.
 *
 * @param id the page id
 * @return the parent comic
 */
@PostMapping(value = "/pages/{id}/undelete", produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasRole('ADMIN')")
@JsonView(View.ComicDetailsView.clreplaced)
@AuditableEndpoint
public Comic undeletePage(@PathVariable("id") long id) {
    log.info("Undeleting page: id={}", id);
    return this.pageService.undeletePage(id);
}

18 Source : ComicFormatController.java
with GNU General Public License v3.0
from comixed

/**
 * Returns the list of all defined comic formats.
 *
 * @return the list
 */
@GetMapping(value = "/api/comics/formats", produces = MediaType.APPLICATION_JSON_VALUE)
@AuditableEndpoint
public List<ComicFormat> getAll() {
    log.info("Retrieving the list of comic formats");
    return this.comicFormatService.getAll();
}

18 Source : ComicController.java
with GNU General Public License v3.0
from comixed

@DeleteMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
@JsonView({ ComicDetailsView.clreplaced })
@AuditableEndpoint
public Comic deleteComic(@PathVariable("id") long id) throws ComicException {
    log.info("Marking comic for deletion: id={}", id);
    return this.comicService.deleteComic(id);
}

18 Source : ComicController.java
with GNU General Public License v3.0
from comixed

@PutMapping(value = "/{id}/read", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@JsonView(View.UserDetailsView.clreplaced)
@AuditableEndpoint
public LastReadDate markAsRead(Principal principal, @PathVariable("id") Long id) throws ComicException, ComiXedUserException {
    String email = principal.getName();
    if (email == null)
        throw new ComicException("not authenticated");
    log.info("Marking comic as read for {}: id={}", email, id);
    return this.comicService.markAsRead(email, id);
}

18 Source : AuditLogController.java
with GNU General Public License v3.0
from comixed

/**
 * Endpoint for clearing the task log.
 */
@DeleteMapping(value = "/api/tasks/entries", produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasRole('ADMIN')")
@AuditableEndpoint
public void clearTaskAuditLog() {
    log.debug("Clearing task audit log");
    this.taskService.clearTaskAuditLog();
}

17 Source : ReadingListController.java
with GNU General Public License v3.0
from comixed

@GetMapping(value = "/lists/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
@JsonView(View.ReadingList.clreplaced)
@AuditableEndpoint
public ReadingList getReadingList(final Principal principal, @PathVariable("id") final long id) throws NoSuchReadingListException {
    final String email = principal.getName();
    log.info("Getting reading list for user: email={} id={}", email, id);
    return this.readingListService.getReadingListForUser(email, id);
}

17 Source : ReadingListController.java
with GNU General Public License v3.0
from comixed

@RequestMapping(value = "/lists", method = RequestMethod.POST)
@JsonView(View.ReadingList.clreplaced)
@AuditableEndpoint
public ReadingList createReadingList(Principal principal, @RequestBody() CreateReadingListRequest request) throws NoSuchReadingListException, ReadingListNameException, ComicException {
    final String email = principal.getName();
    final String name = request.getName();
    final String summary = request.getSummary();
    log.info("Creating reading list for user: email={} name={}", email, name);
    return this.readingListService.createReadingList(email, name, summary);
}

17 Source : ReadingListController.java
with GNU General Public License v3.0
from comixed

@PutMapping(value = "/lists/{id}", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@JsonView(View.ReadingList.clreplaced)
@AuditableEndpoint
public ReadingList updateReadingList(Principal principal, @PathVariable("id") long id, @RequestBody() UpdateReadingListRequest request) throws NoSuchReadingListException, ComicException {
    final String email = principal.getName();
    final String name = request.getName();
    final String summary = request.getSummary();
    log.info("Updating reading list for user: email={} id={} name={} summary={}", email, id, name, summary);
    return this.readingListService.updateReadingList(email, id, name, summary);
}

17 Source : LibraryController.java
with GNU General Public License v3.0
from comixed

@PostMapping(value = "/library/convert", consumes = MediaType.APPLICATION_JSON_VALUE)
@AuditableEndpoint
public void convertComics(@RequestBody() ConvertComicsRequest request) {
    List<Long> idList = request.getComicIdList();
    ArchiveType archiveType = request.getArchiveType();
    boolean renamePages = request.isRenamePages();
    boolean deletePages = request.isDeletePages();
    boolean deleteOriginal = request.isDeleteOriginal();
    log.info("Converting {} comic{} to {}{}{}{}", idList.size(), idList.size() == 1 ? "" : "s", archiveType, renamePages ? " (rename pages)" : "", deletePages ? " (delete pages)" : "", deleteOriginal ? " (delete original comic)" : "");
    final ConvertComicsWorkerTask task = this.convertComicsWorkerTaskObjectFactory.getObject();
    task.setIdList(idList);
    task.setTargetArchiveType(archiveType);
    task.setRenamePages(renamePages);
    task.setDeletePages(deletePages);
    task.setDeleteOriginal(deleteOriginal);
    this.taskManager.runTask(task);
}

17 Source : LibraryController.java
with GNU General Public License v3.0
from comixed

@PostMapping(value = "/library/updates", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@JsonView(View.LibraryUpdate.clreplaced)
@AuditableEndpoint
public GetUpdatedComicsResponse getUpdatedComics(Principal principal, @RequestBody() GetUpdatedComicsRequest request) throws ComiXedUserException {
    Date latestUpdateDate = new Date(request.getLastUpdatedDate());
    String email = principal.getName();
    log.info("Getting comics updated since {} for {} (max: {}, last id: {}, timeout: {}s)", latestUpdateDate, email, request.getMaximumComics(), request.getLastComicId(), request.getTimeout());
    long expire = System.currentTimeMillis() + (request.getTimeout() * 1000L);
    boolean done = false;
    List<Comic> comics = null;
    Long lastComicId = null;
    Date mostRecentUpdate = null;
    boolean moreUpdates = false;
    long processingCount = 0L;
    while (!done) {
        comics = this.libraryService.getComicsUpdatedSince(email, latestUpdateDate, request.getMaximumComics() + 1, request.getLastComicId());
        if (comics.size() > request.getMaximumComics()) {
            log.debug("More updates are waiting");
            moreUpdates = true;
            log.debug("Removing last comic from result set");
            comics.remove(comics.size() - 1);
        }
        log.debug("Getting processing count");
        processingCount = this.libraryService.getProcessingCount();
        if (!comics.isEmpty()) {
            log.debug("{} update{} loaded", comics.size(), comics.size() == 1 ? "" : "s");
            lastComicId = comics.get(comics.size() - 1).getId();
            mostRecentUpdate = comics.get(comics.size() - 1).getDateLastUpdated();
            done = true;
        } else if (System.currentTimeMillis() > expire) {
            log.debug("Timeout reached");
            done = true;
        } else {
            log.debug("Sleeping 1000ms");
            try {
                Thread.sleep(1000L);
            } catch (InterruptedException error) {
                log.error("error while waiting for updates", error);
                Thread.currentThread().interrupt();
            }
        }
    }
    log.debug("Loading updated last read dates");
    List<LastReadDate> lastReadDates = this.libraryService.getLastReadDatesSince(email, latestUpdateDate);
    log.debug("Getting updated reading lists");
    List<ReadingList> readingLists = this.readingListService.getReadingListsForUser(email, latestUpdateDate);
    log.debug("Returning result");
    return new GetUpdatedComicsResponse(comics, lastComicId, mostRecentUpdate, lastReadDates, readingLists, moreUpdates, processingCount);
}

17 Source : PluginsController.java
with GNU General Public License v3.0
from comixed

/**
 * Returns the list of previously loaded plugins.
 *
 * @return the list of plugins
 */
@GetMapping(value = "/plugins", produces = MediaType.APPLICATION_JSON_VALUE)
@JsonView(View.PluginList.clreplaced)
@AuditableEndpoint
public List<PluginDescriptor> getList() {
    log.info("Fetching the list of plugins");
    return this.pluginManager.getPluginList();
}

17 Source : PluginsController.java
with GNU General Public License v3.0
from comixed

/**
 * Endpoint for reloading plugins from disk.
 *
 * @return the list of plugins
 * @throws PluginException if an error occurs
 */
@PostMapping(value = "/plugins/reload", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@JsonView(View.PluginList.clreplaced)
@PreAuthorize("hasRole('ADMIN')")
@AuditableEndpoint
public List<PluginDescriptor> reloadPlugins() throws PluginException {
    log.info("Reloading the list of plugins");
    this.pluginManager.loadPlugins();
    return this.pluginManager.getPluginList();
}

17 Source : PublisherController.java
with GNU General Public License v3.0
from comixed

@GetMapping(value = "/api/publishers/{name}/logo", produces = MediaType.APPLICATION_JSON_VALUE)
@AuditableEndpoint
public ResponseEnreplacedy<byte[]> getLogo(@PathVariable("name") String name) throws PublisherException, IOException {
    log.debug("Getting logo image for publisher: {}", name);
    Publisher publisher = this.publisherService.getByName(name);
    byte[] content = null;
    if (publisher != null) {
        content = publisher.getLogo();
    } else {
        content = IOUtils.toByteArray(this.getClreplaced().getResourcereplacedtream("/images/missing.png"));
    }
    return new ResponseEnreplacedy<>(content, HttpStatus.OK);
}

17 Source : PageController.java
with GNU General Public License v3.0
from comixed

@PostMapping(value = "/pages/hashes/deleted", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@JsonView(View.DuplicatePageList.clreplaced)
@AuditableEndpoint
public List<DuplicatePage> setDeletedState(@RequestBody() final SetDeletedStateRequest request) {
    final List<String> hashes = request.getHashes();
    log.info("{}arking {} page hash{} for deletion", request.getDeleted().booleanValue() ? "M" : "Unm", hashes.size(), hashes.size() == 1 ? "" : "es");
    this.pageService.setDeletedState(hashes, request.getDeleted());
    return this.pageService.getDuplicatePages();
}

17 Source : ComicController.java
with GNU General Public License v3.0
from comixed

@GetMapping(value = "/{id}/download")
@AuditableEndpoint
public ResponseEnreplacedy<InputStreamResource> downloadComic(@PathVariable("id") long id) throws IOException, ComicException {
    log.info("Preparing to download comic: id={}", id);
    final Comic comic = this.comicService.getComic(id);
    if (comic == null) {
        log.error("No such comic");
        return null;
    }
    final byte[] content = this.comicService.getComicContent(comic);
    if (content == null) {
        log.error("No comic content found");
        return null;
    }
    return ResponseEnreplacedy.ok().contentLength(content.length).header("Content-Disposition", "attachment; filename=\"" + comic.getFilename() + "\"").contentType(MediaType.parseMediaType(comic.getArchiveType().getMimeType())).body(new InputStreamResource(new ByteArrayInputStream(content)));
}

17 Source : BuildDetailsController.java
with GNU General Public License v3.0
from comixed

/**
 * Retrieves the build details.
 *
 * @return the build details
 * @throws ParseException if an error occurs
 */
@GetMapping(value = "/api/build-details", produces = MediaType.APPLICATION_JSON_VALUE)
@AuditableEndpoint
@JsonView(View.BuildDetails.clreplaced)
public BuildDetails getBuildDetails() throws ParseException {
    log.info("Getting application build details");
    return this.detailsService.getBuildDetails();
}

16 Source : ReadingListController.java
with GNU General Public License v3.0
from comixed

@PostMapping(value = "/lists/{id}/comics/remove", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@AuditableEndpoint
public RemoveComicsFromReadingListResponse removeComicsFromList(Principal principal, @PathVariable("id") long id, @RequestBody() RemoveComicsFromReadingListRequest request) throws ReadingListException {
    String email = principal.getName();
    List<Long> comicIds = request.getIds();
    log.info("Removing {} comic{} from the reading list for {}: id={}", comicIds.size(), comicIds.size() == 1 ? "" : "s", email, id);
    int count = this.readingListService.removeComicsFromList(email, id, comicIds);
    return new RemoveComicsFromReadingListResponse(count);
}

See More Examples