Skip to content

Commit

Permalink
Revert: add zh_cn upgrade 6.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
loverto committed May 27, 2019
1 parent 9b9f6ac commit d222d15
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Expand Up @@ -2,16 +2,13 @@

import <%=packageName%>.domain.EntityAuditEvent;
import <%=packageName%>.repository.EntityAuditEventRepository;
import <%=packageName%>.web.rest.util.PaginationUtil;
import <%=packageName%>.security.AuthoritiesConstants;

import io.github.jhipster.web.util.PaginationUtil;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.util.MultiValueMap;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
Expand All @@ -20,8 +17,8 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.security.access.annotation.Secured;
import com.codahale.metrics.annotation.Timed;

import java.net.URISyntaxException;
import java.util.List;
Expand Down Expand Up @@ -51,6 +48,7 @@ public EntityAuditResource(EntityAuditEventRepository entityAuditEventRepository
@RequestMapping(value = "/audits/entity/all",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
@Secured(AuthoritiesConstants.ADMIN)
public List<String> getAuditedEntities() {
return entityAuditEventRepository.findAllEntityTypes();
Expand All @@ -64,14 +62,15 @@ public List<String> getAuditedEntities() {
@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,@RequestParam MultiValueMap<String, String> queryParams, UriComponentsBuilder uriBuilder)
@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(uriBuilder.queryParams(queryParams), page);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/audits/entity/changes");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);

}
Expand All @@ -84,6 +83,7 @@ public ResponseEntity<List<EntityAuditEvent>> getChanges(@RequestParam(value = "
@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,
Expand All @@ -100,7 +100,7 @@ public ResponseEntity<EntityAuditEvent> getPrevVersion(@RequestParam(value = "qu
* @return
*/
private Pageable createPageRequest(int size) {
return PageRequest.of(0, size);
return new PageRequest(0, size);
}

}
4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "generator-jhipster-entity-audit",
"version": "4.0.0",
"version": "3.1.1",
"description": "JHipster module to enable entity audit and audit log page",
"homepage": "https://github.com/hipster-labs/generator-jhipster-entity-audit",
"author": {
Expand Down Expand Up @@ -28,7 +28,7 @@
"chalk": "2.3.0",
"glob": "7.1.2",
"semver": "5.4.1",
"generator-jhipster": ">=6.0.0"
"generator-jhipster": ">=5.0.0"
},
"devDependencies": {
"eslint": "4.10.0",
Expand Down

0 comments on commit d222d15

Please sign in to comment.