Merge remote-tracking branch 'origin/master'
This commit is contained in:
Binary file not shown.
+2
-2
@@ -17,7 +17,7 @@ public class FlattenNestedListTest {
|
||||
List<List<String>> lol = asList(asList("one:one"), asList("two:one", "two:two", "two:three"), asList("three:one", "three:two", "three:three", "three:four"));
|
||||
|
||||
@Test
|
||||
public void givenNestedList_thenFlattenNestedListImperative() {
|
||||
public void givenNestedList_thenFlattenImperatively() {
|
||||
List<String> ls = flattenListOfListsImperatively(lol);
|
||||
|
||||
assertNotNull(ls);
|
||||
@@ -27,7 +27,7 @@ public class FlattenNestedListTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenNestedList_thenFlattenNestedListStream() {
|
||||
public void givenNestedList_thenFlattenFunctionally() {
|
||||
List<String> ls = flattenListOfListsStream(lol);
|
||||
|
||||
assertNotNull(ls);
|
||||
|
||||
@@ -40,6 +40,16 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>**/*IntegrationTest.java</exclude>
|
||||
<exclude>**/*LiveTest.java</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
+1
-3
@@ -1,10 +1,8 @@
|
||||
package com.mogronalol;
|
||||
package com.baeldung;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@SpringBootApplication
|
||||
public class DemoApplication {
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
package com.mogronalol;
|
||||
package com.baeldung;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
+2
-3
@@ -1,11 +1,10 @@
|
||||
package com.mogronalol;
|
||||
package com.baeldung;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.context.embedded.LocalServerPort;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@@ -13,7 +12,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = {DemoApplication.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class DemoApplicationTests {
|
||||
public class DemoApplicationIntegrationTest {
|
||||
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<module>deltaspike</module>
|
||||
<module>dozer</module>
|
||||
|
||||
<module>ejb</module>
|
||||
<!--<module>ejb</module>-->
|
||||
|
||||
<module>feign</module>
|
||||
<module>flyway</module>
|
||||
@@ -66,7 +66,7 @@
|
||||
<module>javax-servlets</module>
|
||||
<module>javaxval</module>
|
||||
<module>jaxb</module>
|
||||
<module>jee7</module>
|
||||
<!--<module>jee7</module>-->
|
||||
<!-- <module>jhipster</module> -->
|
||||
<module>jjwt</module>
|
||||
<module>jooq</module>
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.baeldung.filter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.ws.rs.container.ContainerRequestContext;
|
||||
import javax.ws.rs.container.ContainerResponseContext;
|
||||
import javax.ws.rs.container.ContainerResponseFilter;
|
||||
import javax.ws.rs.ext.Provider;
|
||||
|
||||
@Provider
|
||||
public class CorsFilter implements ContainerResponseFilter {
|
||||
|
||||
@Override
|
||||
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
|
||||
throws IOException {
|
||||
responseContext.getHeaders().add("Access-Control-Allow-Origin", "*");
|
||||
responseContext.getHeaders().add("Access-Control-Allow-Headers", "origin, content-type, accept, authorization");
|
||||
responseContext.getHeaders().add("Access-Control-Allow-Credentials", "true");
|
||||
responseContext.getHeaders().add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, HEAD");
|
||||
}
|
||||
|
||||
}
|
||||
+644
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* = RooApplication
|
||||
*
|
||||
* TODO Auto-generated class documentation
|
||||
*
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class RooApplication {
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(RooApplication.class, args);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.baeldung.config;
|
||||
import org.springframework.roo.addon.layers.repository.jpa.annotations.RooJpaRepositoryConfiguration;
|
||||
|
||||
/**
|
||||
* = SpringDataJpaDetachableRepositoryConfiguration
|
||||
TODO Auto-generated class documentation
|
||||
*
|
||||
*/
|
||||
@RooJpaRepositoryConfiguration
|
||||
public class SpringDataJpaDetachableRepositoryConfiguration {
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
|
||||
// You may push code into the target .java compilation unit if you wish to edit any member(s).
|
||||
|
||||
package com.baeldung.config;
|
||||
|
||||
import com.baeldung.RooApplication;
|
||||
import com.baeldung.config.SpringDataJpaDetachableRepositoryConfiguration;
|
||||
import io.springlets.data.jpa.repository.support.DetachableJpaRepositoryImpl;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
|
||||
privileged aspect SpringDataJpaDetachableRepositoryConfiguration_Roo_Jpa_Repository_Configuration {
|
||||
|
||||
declare @type: SpringDataJpaDetachableRepositoryConfiguration: @Configuration;
|
||||
|
||||
declare @type: SpringDataJpaDetachableRepositoryConfiguration: @EnableJpaRepositories(repositoryBaseClass = DetachableJpaRepositoryImpl.class, basePackageClasses = RooApplication.class);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.baeldung.config;
|
||||
import org.springframework.roo.addon.web.mvc.controller.annotations.config.RooWebMvcConfiguration;
|
||||
import org.springframework.roo.addon.web.mvc.thymeleaf.annotations.RooWebMvcThymeleafUIConfiguration;
|
||||
|
||||
/**
|
||||
* = WebMvcConfiguration
|
||||
TODO Auto-generated class documentation
|
||||
*
|
||||
*/
|
||||
@RooWebMvcConfiguration(defaultLanguage = "en")
|
||||
@RooWebMvcThymeleafUIConfiguration
|
||||
public class WebMvcConfiguration {
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
|
||||
// You may push code into the target .java compilation unit if you wish to edit any member(s).
|
||||
|
||||
package com.baeldung.config;
|
||||
|
||||
import com.baeldung.config.WebMvcConfiguration;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafProperties;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.thymeleaf.TemplateEngine;
|
||||
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver;
|
||||
import org.thymeleaf.spring4.view.ThymeleafViewResolver;
|
||||
import org.thymeleaf.templatemode.TemplateMode;
|
||||
|
||||
privileged aspect WebMvcConfiguration_Roo_ThymeleafUIConfiguration {
|
||||
|
||||
declare parents: WebMvcConfiguration implements ApplicationContextAware;
|
||||
|
||||
/**
|
||||
* TODO Auto-generated attribute documentation
|
||||
*
|
||||
*/
|
||||
@Autowired
|
||||
private ThymeleafProperties WebMvcConfiguration.thymeleafProperties;
|
||||
|
||||
/**
|
||||
* TODO Auto-generated attribute documentation
|
||||
*
|
||||
*/
|
||||
@Autowired
|
||||
private TemplateEngine WebMvcConfiguration.templateEngine;
|
||||
|
||||
/**
|
||||
* TODO Auto-generated attribute documentation
|
||||
*
|
||||
*/
|
||||
private ApplicationContext WebMvcConfiguration.applicationContext;
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @return ThymeleafProperties
|
||||
*/
|
||||
public ThymeleafProperties WebMvcConfiguration.getThymeleafProperties() {
|
||||
return thymeleafProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @return TemplateEngine
|
||||
*/
|
||||
public TemplateEngine WebMvcConfiguration.getTemplateEngine() {
|
||||
return templateEngine;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @return ApplicationContext
|
||||
*/
|
||||
public ApplicationContext WebMvcConfiguration.getApplicationContext() {
|
||||
return applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @param applicationContext
|
||||
*/
|
||||
public void WebMvcConfiguration.setApplicationContext(ApplicationContext applicationContext) {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @return ThymeleafViewResolver
|
||||
*/
|
||||
@Bean
|
||||
public ThymeleafViewResolver WebMvcConfiguration.javascriptThymeleafViewResolver() {
|
||||
ThymeleafViewResolver resolver = new ThymeleafViewResolver();
|
||||
resolver.setTemplateEngine(getTemplateEngine());
|
||||
resolver.setCharacterEncoding("UTF-8");
|
||||
resolver.setContentType("application/javascript");
|
||||
resolver.setViewNames(new String[] {"*.js"});
|
||||
resolver.setCache(getThymeleafProperties().isCache());
|
||||
return resolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @return SpringResourceTemplateResolver
|
||||
*/
|
||||
@Bean
|
||||
public SpringResourceTemplateResolver WebMvcConfiguration.javascriptTemplateResolver() {
|
||||
SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
|
||||
resolver.setApplicationContext(getApplicationContext());
|
||||
resolver.setPrefix("classpath:/templates/fragments/js/");
|
||||
resolver.setTemplateMode(TemplateMode.JAVASCRIPT);
|
||||
resolver.setCharacterEncoding("UTF-8");
|
||||
resolver.setCheckExistence(true);
|
||||
resolver.setCacheable(getThymeleafProperties().isCache());
|
||||
return resolver;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
|
||||
// You may push code into the target .java compilation unit if you wish to edit any member(s).
|
||||
|
||||
package com.baeldung.config;
|
||||
|
||||
import com.baeldung.config.WebMvcConfiguration;
|
||||
import io.tracee.binding.springmvc.TraceeInterceptor;
|
||||
import java.lang.Override;
|
||||
import java.util.Locale;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
|
||||
import org.springframework.web.servlet.LocaleResolver;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
|
||||
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
|
||||
|
||||
privileged aspect WebMvcConfiguration_Roo_WebMvcConfiguration {
|
||||
|
||||
declare parents: WebMvcConfiguration extends WebMvcConfigurerAdapter;
|
||||
|
||||
declare @type: WebMvcConfiguration: @Configuration;
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @return LocalValidatorFactoryBean
|
||||
*/
|
||||
@Primary
|
||||
@Bean
|
||||
public LocalValidatorFactoryBean WebMvcConfiguration.validator() {
|
||||
return new LocalValidatorFactoryBean();
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @return LocaleResolver
|
||||
*/
|
||||
@Bean
|
||||
public LocaleResolver WebMvcConfiguration.localeResolver() {
|
||||
SessionLocaleResolver localeResolver = new SessionLocaleResolver();
|
||||
localeResolver.setDefaultLocale(new Locale("en"));
|
||||
return localeResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @return LocaleChangeInterceptor
|
||||
*/
|
||||
@Bean
|
||||
public LocaleChangeInterceptor WebMvcConfiguration.localeChangeInterceptor() {
|
||||
LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
|
||||
localeChangeInterceptor.setParamName("lang");
|
||||
return localeChangeInterceptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @param registry
|
||||
*/
|
||||
@Override
|
||||
public void WebMvcConfiguration.addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(localeChangeInterceptor());
|
||||
registry.addInterceptor(new TraceeInterceptor());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.baeldung.config.jackson;
|
||||
import org.springframework.roo.addon.web.mvc.controller.annotations.config.RooDomainModelModule;
|
||||
|
||||
/**
|
||||
* = DomainModelModule
|
||||
TODO Auto-generated class documentation
|
||||
*
|
||||
*/
|
||||
@RooDomainModelModule
|
||||
public class DomainModelModule {
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
|
||||
// You may push code into the target .java compilation unit if you wish to edit any member(s).
|
||||
|
||||
package com.baeldung.config.jackson;
|
||||
|
||||
import com.baeldung.config.jackson.DomainModelModule;
|
||||
import com.baeldung.domain.Book;
|
||||
import com.baeldung.web.BookJsonMixin;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import org.springframework.boot.jackson.JsonComponent;
|
||||
|
||||
privileged aspect DomainModelModule_Roo_DomainModelModule {
|
||||
|
||||
declare parents: DomainModelModule extends SimpleModule;
|
||||
|
||||
declare @type: DomainModelModule: @JsonComponent;
|
||||
|
||||
/**
|
||||
* TODO Auto-generated constructor documentation
|
||||
*
|
||||
*/
|
||||
public DomainModelModule.new() {
|
||||
// Mixin registration
|
||||
|
||||
setMixInAnnotation(Book.class, BookJsonMixin.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.baeldung.domain;
|
||||
import org.springframework.roo.addon.javabean.annotations.RooEquals;
|
||||
import org.springframework.roo.addon.javabean.annotations.RooJavaBean;
|
||||
import org.springframework.roo.addon.javabean.annotations.RooToString;
|
||||
import org.springframework.roo.addon.jpa.annotations.entity.RooJpaEntity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Version;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* = Book
|
||||
TODO Auto-generated class documentation
|
||||
*
|
||||
*/
|
||||
@RooJavaBean
|
||||
@RooToString
|
||||
@RooJpaEntity
|
||||
@RooEquals(isJpaEntity = true)
|
||||
public class Book {
|
||||
|
||||
/**
|
||||
* TODO Auto-generated attribute documentation
|
||||
*
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* TODO Auto-generated attribute documentation
|
||||
*
|
||||
*/
|
||||
@Version
|
||||
private Integer version;
|
||||
|
||||
/**
|
||||
* TODO Auto-generated attribute documentation
|
||||
*
|
||||
*/
|
||||
@NotNull
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* TODO Auto-generated attribute documentation
|
||||
*
|
||||
*/
|
||||
@NotNull
|
||||
private String author;
|
||||
|
||||
/**
|
||||
* TODO Auto-generated attribute documentation
|
||||
*
|
||||
*/
|
||||
@NotNull
|
||||
private String isbn;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
|
||||
// You may push code into the target .java compilation unit if you wish to edit any member(s).
|
||||
|
||||
package com.baeldung.domain;
|
||||
|
||||
import com.baeldung.domain.Book;
|
||||
import java.util.Objects;
|
||||
|
||||
privileged aspect Book_Roo_Equals {
|
||||
|
||||
/**
|
||||
* This `equals` implementation is specific for JPA entities and uses
|
||||
* the entity identifier for it, following the article in
|
||||
* https://vladmihalcea.com/2016/06/06/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
|
||||
*
|
||||
* @param obj
|
||||
* @return Boolean
|
||||
*/
|
||||
public boolean Book.equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
// instanceof is false if the instance is null
|
||||
if (!(obj instanceof Book)) {
|
||||
return false;
|
||||
}
|
||||
return getId() != null && Objects.equals(getId(), ((Book) obj).getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* This `hashCode` implementation is specific for JPA entities and uses a fixed `int` value to be able
|
||||
* to identify the entity in collections after a new id is assigned to the entity, following the article in
|
||||
* https://vladmihalcea.com/2016/06/06/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
|
||||
*
|
||||
* @return Integer
|
||||
*/
|
||||
public int Book.hashCode() {
|
||||
return 31;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
|
||||
// You may push code into the target .java compilation unit if you wish to edit any member(s).
|
||||
|
||||
package com.baeldung.domain;
|
||||
|
||||
import com.baeldung.domain.Book;
|
||||
|
||||
privileged aspect Book_Roo_JavaBean {
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @return Long
|
||||
*/
|
||||
public Long Book.getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void Book.setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @return Integer
|
||||
*/
|
||||
public Integer Book.getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @param version
|
||||
*/
|
||||
public void Book.setVersion(Integer version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public String Book.getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @param title
|
||||
*/
|
||||
public void Book.setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public String Book.getAuthor() {
|
||||
return this.author;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @param author
|
||||
*/
|
||||
public void Book.setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public String Book.getIsbn() {
|
||||
return this.isbn;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @param isbn
|
||||
*/
|
||||
public void Book.setIsbn(String isbn) {
|
||||
this.isbn = isbn;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
|
||||
// You may push code into the target .java compilation unit if you wish to edit any member(s).
|
||||
|
||||
package com.baeldung.domain;
|
||||
|
||||
import com.baeldung.domain.Book;
|
||||
import io.springlets.format.EntityFormat;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
privileged aspect Book_Roo_Jpa_Entity {
|
||||
|
||||
declare @type: Book: @Entity;
|
||||
|
||||
declare @type: Book: @EntityFormat;
|
||||
|
||||
/**
|
||||
* TODO Auto-generated attribute documentation
|
||||
*
|
||||
*/
|
||||
public static final String Book.ITERABLE_TO_ADD_CANT_BE_NULL_MESSAGE = "The given Iterable of items to add can't be null!";
|
||||
|
||||
/**
|
||||
* TODO Auto-generated attribute documentation
|
||||
*
|
||||
*/
|
||||
public static final String Book.ITERABLE_TO_REMOVE_CANT_BE_NULL_MESSAGE = "The given Iterable of items to add can't be null!";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
|
||||
// You may push code into the target .java compilation unit if you wish to edit any member(s).
|
||||
|
||||
package com.baeldung.domain;
|
||||
|
||||
import com.baeldung.domain.Book;
|
||||
|
||||
privileged aspect Book_Roo_ToString {
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public String Book.toString() {
|
||||
return "Book {" +
|
||||
"id='" + id + '\'' +
|
||||
", version='" + version + '\'' +
|
||||
", title='" + title + '\'' +
|
||||
", author='" + author + '\'' +
|
||||
", isbn='" + isbn + '\'' +
|
||||
", ITERABLE_TO_ADD_CANT_BE_NULL_MESSAGE='" + ITERABLE_TO_ADD_CANT_BE_NULL_MESSAGE + '\'' +
|
||||
", ITERABLE_TO_REMOVE_CANT_BE_NULL_MESSAGE='" + ITERABLE_TO_REMOVE_CANT_BE_NULL_MESSAGE + '\'' + "}" + super.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.baeldung.repository;
|
||||
import com.baeldung.domain.Book;
|
||||
import org.springframework.roo.addon.layers.repository.jpa.annotations.RooJpaRepository;
|
||||
|
||||
/**
|
||||
* = BookRepository
|
||||
TODO Auto-generated class documentation
|
||||
*
|
||||
*/
|
||||
@RooJpaRepository(entity = Book.class)
|
||||
public interface BookRepository {
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.baeldung.repository;
|
||||
import com.baeldung.domain.Book;
|
||||
import org.springframework.roo.addon.layers.repository.jpa.annotations.RooJpaRepositoryCustom;
|
||||
|
||||
/**
|
||||
* = BookRepositoryCustom
|
||||
TODO Auto-generated class documentation
|
||||
*
|
||||
*/
|
||||
@RooJpaRepositoryCustom(entity = Book.class)
|
||||
public interface BookRepositoryCustom {
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
|
||||
// You may push code into the target .java compilation unit if you wish to edit any member(s).
|
||||
|
||||
package com.baeldung.repository;
|
||||
|
||||
import com.baeldung.domain.Book;
|
||||
import com.baeldung.repository.BookRepositoryCustom;
|
||||
import io.springlets.data.domain.GlobalSearch;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
privileged aspect BookRepositoryCustom_Roo_Jpa_Repository_Custom {
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @param globalSearch
|
||||
* @param pageable
|
||||
* @return Page
|
||||
*/
|
||||
public abstract Page<Book> BookRepositoryCustom.findAll(GlobalSearch globalSearch, Pageable pageable);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.baeldung.repository;
|
||||
|
||||
import io.springlets.data.jpa.repository.support.QueryDslRepositorySupportExt;
|
||||
import org.springframework.roo.addon.layers.repository.jpa.annotations.RooJpaRepositoryCustomImpl;
|
||||
import com.baeldung.domain.Book;
|
||||
|
||||
/**
|
||||
* = BookRepositoryImpl
|
||||
*
|
||||
* TODO Auto-generated class documentation
|
||||
*
|
||||
*/
|
||||
@RooJpaRepositoryCustomImpl(repository = BookRepositoryCustom.class)
|
||||
public class BookRepositoryImpl extends QueryDslRepositorySupportExt<Book> {
|
||||
|
||||
/**
|
||||
* TODO Auto-generated constructor documentation
|
||||
*/
|
||||
BookRepositoryImpl() {
|
||||
super(Book.class);
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
|
||||
// You may push code into the target .java compilation unit if you wish to edit any member(s).
|
||||
|
||||
package com.baeldung.repository;
|
||||
|
||||
import com.baeldung.domain.Book;
|
||||
import com.baeldung.domain.QBook;
|
||||
import com.baeldung.repository.BookRepositoryCustom;
|
||||
import com.baeldung.repository.BookRepositoryImpl;
|
||||
import com.querydsl.core.types.Path;
|
||||
import com.querydsl.jpa.JPQLQuery;
|
||||
import io.springlets.data.domain.GlobalSearch;
|
||||
import io.springlets.data.jpa.repository.support.QueryDslRepositorySupportExt.AttributeMappingBuilder;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
privileged aspect BookRepositoryImpl_Roo_Jpa_Repository_Impl {
|
||||
|
||||
declare parents: BookRepositoryImpl implements BookRepositoryCustom;
|
||||
|
||||
declare @type: BookRepositoryImpl: @Transactional(readOnly = true);
|
||||
|
||||
/**
|
||||
* TODO Auto-generated attribute documentation
|
||||
*
|
||||
*/
|
||||
public static final String BookRepositoryImpl.TITLE = "title";
|
||||
|
||||
/**
|
||||
* TODO Auto-generated attribute documentation
|
||||
*
|
||||
*/
|
||||
public static final String BookRepositoryImpl.AUTHOR = "author";
|
||||
|
||||
/**
|
||||
* TODO Auto-generated attribute documentation
|
||||
*
|
||||
*/
|
||||
public static final String BookRepositoryImpl.ISBN = "isbn";
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @param globalSearch
|
||||
* @param pageable
|
||||
* @return Page
|
||||
*/
|
||||
public Page<Book> BookRepositoryImpl.findAll(GlobalSearch globalSearch, Pageable pageable) {
|
||||
|
||||
QBook book = QBook.book;
|
||||
|
||||
JPQLQuery<Book> query = from(book);
|
||||
|
||||
Path<?>[] paths = new Path<?>[] {book.title,book.author,book.isbn};
|
||||
applyGlobalSearch(globalSearch, query, paths);
|
||||
|
||||
AttributeMappingBuilder mapping = buildMapper()
|
||||
.map(TITLE, book.title)
|
||||
.map(AUTHOR, book.author)
|
||||
.map(ISBN, book.isbn);
|
||||
|
||||
applyPagination(pageable, query, mapping);
|
||||
applyOrderById(query);
|
||||
|
||||
return loadPage(query, pageable, book);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
|
||||
// You may push code into the target .java compilation unit if you wish to edit any member(s).
|
||||
|
||||
package com.baeldung.repository;
|
||||
|
||||
import com.baeldung.domain.Book;
|
||||
import com.baeldung.repository.BookRepository;
|
||||
import com.baeldung.repository.BookRepositoryCustom;
|
||||
import io.springlets.data.jpa.repository.DetachableJpaRepository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
privileged aspect BookRepository_Roo_Jpa_Repository {
|
||||
|
||||
declare parents: BookRepository extends DetachableJpaRepository<Book, Long>;
|
||||
|
||||
declare parents: BookRepository extends BookRepositoryCustom;
|
||||
|
||||
declare @type: BookRepository: @Transactional(readOnly = true);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.baeldung.service.api;
|
||||
import com.baeldung.domain.Book;
|
||||
import org.springframework.roo.addon.layers.service.annotations.RooService;
|
||||
|
||||
/**
|
||||
* = BookService
|
||||
TODO Auto-generated class documentation
|
||||
*
|
||||
*/
|
||||
@RooService(entity = Book.class)
|
||||
public interface BookService {
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
|
||||
// You may push code into the target .java compilation unit if you wish to edit any member(s).
|
||||
|
||||
package com.baeldung.service.api;
|
||||
|
||||
import com.baeldung.domain.Book;
|
||||
import com.baeldung.service.api.BookService;
|
||||
import io.springlets.data.domain.GlobalSearch;
|
||||
import io.springlets.format.EntityResolver;
|
||||
import java.util.List;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
privileged aspect BookService_Roo_Service {
|
||||
|
||||
declare parents: BookService extends EntityResolver<Book, Long>;
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @param id
|
||||
* @return Book
|
||||
*/
|
||||
public abstract Book BookService.findOne(Long id);
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @param book
|
||||
*/
|
||||
public abstract void BookService.delete(Book book);
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @param entities
|
||||
* @return List
|
||||
*/
|
||||
public abstract List<Book> BookService.save(Iterable<Book> entities);
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
public abstract void BookService.delete(Iterable<Long> ids);
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @param entity
|
||||
* @return Book
|
||||
*/
|
||||
public abstract Book BookService.save(Book entity);
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @param id
|
||||
* @return Book
|
||||
*/
|
||||
public abstract Book BookService.findOneForUpdate(Long id);
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @param ids
|
||||
* @return List
|
||||
*/
|
||||
public abstract List<Book> BookService.findAll(Iterable<Long> ids);
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @return List
|
||||
*/
|
||||
public abstract List<Book> BookService.findAll();
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @return Long
|
||||
*/
|
||||
public abstract long BookService.count();
|
||||
|
||||
/**
|
||||
* TODO Auto-generated method documentation
|
||||
*
|
||||
* @param globalSearch
|
||||
* @param pageable
|
||||
* @return Page
|
||||
*/
|
||||
public abstract Page<Book> BookService.findAll(GlobalSearch globalSearch, Pageable pageable);
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user