/** * fetches all the audited entity types * * @return */ @RequestMapping( value = "/audits/entity/all", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed @Secured(AuthoritiesConstants.ADMIN) public List<String> getAuditedEntities() { return entityAuditEventRepository.findAllEntityTypes(); }
/** * fetches a previous version for for an entity class and id * * @return */ @RequestMapping( value = "/audits/entity/changes/version/previous", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed @Secured(AuthoritiesConstants.ADMIN) public ResponseEntity<EntityAuditEvent> getPrevVersion( @RequestParam(value = "qualifiedName") String qualifiedName, @RequestParam(value = "entityId") Long entityId, @RequestParam(value = "commitVersion") Integer commitVersion) throws URISyntaxException { EntityAuditEvent prev = entityAuditEventRepository.findOneByEntityTypeAndEntityIdAndCommitVersion( qualifiedName, entityId, commitVersion); return new ResponseEntity<>(prev, HttpStatus.OK); }
/** * fetches the last 100 change list for an entity class, if limit is passed fetches that many * changes * * @return */ @RequestMapping( value = "/audits/entity/changes", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed @Secured(AuthoritiesConstants.ADMIN) public ResponseEntity<List<EntityAuditEvent>> getChanges( @RequestParam(value = "entityType") String entityType, @RequestParam(value = "limit") int limit) throws URISyntaxException { log.debug("REST request to get a page of EntityAuditEvents"); Pageable pageRequest = createPageRequest(limit); Page<EntityAuditEvent> page = entityAuditEventRepository.findAllByEntityType(entityType, pageRequest); HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/audits/entity/changes"); return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK); }