diff --git a/persistence/src/main/java/org/devgateway/toolkit/persistence/service/BaseJpaService.java b/persistence/src/main/java/org/devgateway/toolkit/persistence/service/BaseJpaService.java index c58f88c1..6ee1a602 100644 --- a/persistence/src/main/java/org/devgateway/toolkit/persistence/service/BaseJpaService.java +++ b/persistence/src/main/java/org/devgateway/toolkit/persistence/service/BaseJpaService.java @@ -36,7 +36,13 @@ public interface BaseJpaService { S saveAndFlush(S entity); + List saveAllAndFlush(Iterable iterable); + void delete(T entity); + void deleteAllInBatch(Iterable iterable); + + void deleteAllByIdInBatch(Iterable iterable); + T newInstance(); } diff --git a/persistence/src/main/java/org/devgateway/toolkit/persistence/service/BaseJpaServiceImpl.java b/persistence/src/main/java/org/devgateway/toolkit/persistence/service/BaseJpaServiceImpl.java index 0d98ab1f..a39347e9 100644 --- a/persistence/src/main/java/org/devgateway/toolkit/persistence/service/BaseJpaServiceImpl.java +++ b/persistence/src/main/java/org/devgateway/toolkit/persistence/service/BaseJpaServiceImpl.java @@ -83,12 +83,30 @@ public S saveAndFlush(final S entity) { return repository().saveAndFlush(entity); } + @Override + @Transactional + public List saveAllAndFlush(final Iterable iterable) { + return repository().saveAllAndFlush(iterable); + } + @Override @Transactional public void delete(final T entity) { repository().delete(entity); } + @Override + @Transactional + public void deleteAllInBatch(final Iterable iterable) { + repository().deleteAllInBatch(iterable); + } + + @Override + @Transactional + public void deleteAllByIdInBatch(final Iterable iterable) { + repository().deleteAllByIdInBatch(iterable); + } + protected abstract BaseJpaRepository repository(); } diff --git a/persistence/src/test/java/org/devgateway/toolkit/persistence/excel/test/TestAddressRepository.java b/persistence/src/test/java/org/devgateway/toolkit/persistence/excel/test/TestAddressRepository.java index 247ace28..66d91279 100644 --- a/persistence/src/test/java/org/devgateway/toolkit/persistence/excel/test/TestAddressRepository.java +++ b/persistence/src/test/java/org/devgateway/toolkit/persistence/excel/test/TestAddressRepository.java @@ -68,6 +68,11 @@ public void delete(TestAddress entity) { } + @Override + public void deleteAllById(final Iterable iterable) { + + } + @Override public void deleteAll(Iterable entities) { @@ -84,6 +89,7 @@ public void flush() { } @Override + @Deprecated public void deleteInBatch(Iterable entities) { } @@ -94,10 +100,16 @@ public void deleteAllInBatch() { } @Override + @Deprecated public TestAddress getOne(Long aLong) { return null; } + @Override + public TestAddress getById(final Long aLong) { + return null; + } + @Override public List findAll(Example example, Sort sort) { return null; @@ -113,6 +125,21 @@ public S saveAndFlush(S entity) { return null; } + @Override + public List saveAllAndFlush(final Iterable iterable) { + return null; + } + + @Override + public void deleteAllInBatch(final Iterable iterable) { + + } + + @Override + public void deleteAllByIdInBatch(final Iterable iterable) { + + } + @Override public List saveAll(Iterable entities) { return null; diff --git a/pom.xml b/pom.xml index b9ccc52d..58b0a252 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ UTF-8 16 4.3.5 - 2.4.5 + 2.5.0 10.14.2.0 4.0.1 devgateway/toolkit diff --git a/web/src/main/java/org/devgateway/toolkit/web/rest/controller/HTTPErrorController.java b/web/src/main/java/org/devgateway/toolkit/web/rest/controller/HTTPErrorController.java index ee22a3bf..1af0a2f4 100644 --- a/web/src/main/java/org/devgateway/toolkit/web/rest/controller/HTTPErrorController.java +++ b/web/src/main/java/org/devgateway/toolkit/web/rest/controller/HTTPErrorController.java @@ -15,10 +15,6 @@ */ @RestController public class HTTPErrorController implements ErrorController { - @Override - public String getErrorPath() { - return null; - } @RequestMapping("/error") public void handleError(final HttpServletRequest request, final HttpServletResponse response) throws IOException { diff --git a/web/src/main/java/org/devgateway/toolkit/web/spring/CustomRestMvcConfiguration.java b/web/src/main/java/org/devgateway/toolkit/web/spring/CustomRestMvcConfiguration.java index 160ab216..dfa9a390 100644 --- a/web/src/main/java/org/devgateway/toolkit/web/spring/CustomRestMvcConfiguration.java +++ b/web/src/main/java/org/devgateway/toolkit/web/spring/CustomRestMvcConfiguration.java @@ -5,6 +5,7 @@ import org.springframework.data.rest.core.config.RepositoryRestConfiguration; import org.springframework.data.rest.core.mapping.RepositoryDetectionStrategy.RepositoryDetectionStrategies; import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurer; +import org.springframework.web.servlet.config.annotation.CorsRegistry; /** * We only allow to expose repositories that are annotated @@ -20,9 +21,10 @@ public RepositoryRestConfigurer repositoryRestConfigurer() { return new RepositoryRestConfigurer() { @Override - public void configureRepositoryRestConfiguration(final RepositoryRestConfiguration config) { + public void configureRepositoryRestConfiguration(final RepositoryRestConfiguration config, + CorsRegistry cors) { config.setRepositoryDetectionStrategy(RepositoryDetectionStrategies.ANNOTATED); } }; } -} \ No newline at end of file +}