org.springframework.data.domain.ExampleMatcher.StringMatcher Java Examples

The following examples show how to use org.springframework.data.domain.ExampleMatcher.StringMatcher. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OperationService.java    From heimdall with Apache License 2.0 5 votes vote down vote up
private Example<Operation> prepareExample(Long apiId, Long resourceId, OperationDTO operationDTO) {
    Resource resource = resourceRepository.findByApiIdAndId(apiId, resourceId);
    HeimdallException.checkThrow(resource == null, GLOBAL_RESOURCE_NOT_FOUND);

    Operation operation = GenericConverter.mapper(operationDTO, Operation.class);
    operation.setResource(resource);

    return Example.of(operation, ExampleMatcher.matching().withIgnorePaths("resource.api").withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));
}
 
Example #2
Source File: MiddlewareService.java    From heimdall with Apache License 2.0 5 votes vote down vote up
private Example<Middleware> createExample(Long apiId, MiddlewareDTO middlewareDTO) {
    Api api = apiRepository.findOne(apiId);
    HeimdallException.checkThrow(api == null, GLOBAL_RESOURCE_NOT_FOUND);

    Middleware middleware = GenericConverter.mapper(middlewareDTO, Middleware.class);
    Api apiFind = new Api();
    apiFind.setId(apiId);
    middleware.setApi(apiFind);

    return Example.of(middleware, ExampleMatcher.matching().withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));
}
 
Example #3
Source File: ProviderService.java    From heimdall with Apache License 2.0 5 votes vote down vote up
/**
 * Generates a list of {@link Provider} from a request
 *
 * @param providerDTO The {@link ProviderDTO}
 * @return The list of {@link Provider}
 */
public List<Provider> listWithFilter(ProviderDTO providerDTO) {

    Provider provider = GenericConverter.mapper(providerDTO, Provider.class);
    Example<Provider> example = Example.of(provider,
            ExampleMatcher.matching().withIgnorePaths("providerDefault").withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));

    return this.providerRepository.findAll(example);
}
 
Example #4
Source File: ArangoRepositoryTest.java    From spring-data with Apache License 2.0 5 votes vote down vote up
@Test
public void containingExampleTest() {
	final Customer entity = new Customer("name", "surname", 10);
	repository.save(entity);

	final Customer probe = new Customer();
	probe.setName("am");
	final Example<Customer> example = Example.of(probe,
		ExampleMatcher.matching().withStringMatcher(StringMatcher.CONTAINING).withIgnorePaths("arangoId", "id",
			"key", "rev", "surname", "age"));
	final Optional<Customer> retrieved = repository.findOne(example);
	assertThat(retrieved.isPresent(), is(true));
	assertThat(retrieved.get().getName(), is("name"));
}
 
Example #5
Source File: UserRepositoryIntegrationTests.java    From spring-data-examples with Apache License 2.0 5 votes vote down vote up
/**
 * @see #153
 */
@Test
public void substringMatching() {

	Example<User> example = Example.of(new User("er", null, null), matching(). //
			withStringMatcher(StringMatcher.ENDING));

	assertThat(repository.findAll(example)).containsExactly(skyler, walter);
}
 
Example #6
Source File: UserRepositoryIntegrationTests.java    From spring-data-examples with Apache License 2.0 5 votes vote down vote up
/**
 * @see #153
 */
@Test
public void substringMatching() {

	Example<Person> example = Example.of(new Person("er", null, null), matching(). //
			withStringMatcher(StringMatcher.ENDING));

	assertThat(repository.findAll(example)).containsExactlyInAnyOrder(skyler, walter);
}
 
Example #7
Source File: MongoOperationsIntegrationTests.java    From spring-data-examples with Apache License 2.0 5 votes vote down vote up
/**
 * @see #153
 */
@Test
public void substringMatching() {

	Example<Person> example = Example.of(new Person("er", null, null), matching().//
			withStringMatcher(StringMatcher.ENDING));

	assertThat(operations.find(query(byExample(example)), Person.class), hasItems(skyler, walter));
}
 
Example #8
Source File: ContactRepositoryIntegrationTests.java    From spring-data-examples with Apache License 2.0 5 votes vote down vote up
/**
 * @see #153
 */
@Test
public void findAllPersonsBySimpleExample() {

	Example<Person> example = Example.of(new Person(".*", null, null), //
			matching().withStringMatcher(StringMatcher.REGEX));

	assertThat(userRepository.findAll(example), containsInAnyOrder(skyler, walter, flynn));
	assertThat(userRepository.findAll(example), not(containsInAnyOrder(hank, marie)));
}
 
Example #9
Source File: ContactRepositoryIntegrationTests.java    From spring-data-examples with Apache License 2.0 5 votes vote down vote up
/**
 * @see #153
 */
@Test
public void findAllRelativesBySimpleExample() {

	Example<Relative> example = Example.of(new Relative(".*", null, null), //
			matching().withStringMatcher(StringMatcher.REGEX));

	assertThat(contactRepository.findAll(example), containsInAnyOrder(hank, marie));
	assertThat(contactRepository.findAll(example), not(containsInAnyOrder(skyler, walter, flynn)));
}
 
Example #10
Source File: RepositoryIT.java    From sdn-rx with Apache License 2.0 4 votes vote down vote up
@Test
void findAllByExampleWithDifferentMatchers(@Autowired PersonRepository repository) {

	PersonWithAllConstructor person;
	Example<PersonWithAllConstructor> example;
	List<PersonWithAllConstructor> persons;

	person = new PersonWithAllConstructor(null, TEST_PERSON1_NAME, TEST_PERSON2_FIRST_NAME, null, null, null,
		null,
		null, null, null, null);
	example = Example.of(person, ExampleMatcher.matchingAny());

	persons = repository.findAll(example);
	assertThat(persons).containsExactlyInAnyOrder(person1, person2);

	person = new PersonWithAllConstructor(null, TEST_PERSON1_NAME.toUpperCase(), TEST_PERSON2_FIRST_NAME, null,
		null, null, null, null, null, null, null);
	example = Example.of(person, ExampleMatcher.matchingAny().withIgnoreCase("name"));

	persons = repository.findAll(example);
	assertThat(persons).containsExactlyInAnyOrder(person1, person2);

	person = new PersonWithAllConstructor(null,
		TEST_PERSON2_NAME.substring(TEST_PERSON2_NAME.length() - 2).toUpperCase(),
		TEST_PERSON2_FIRST_NAME.substring(0, 2), TEST_PERSON_SAMEVALUE.substring(3, 5), null, null, null, null,
		null, null, null);
	example = Example.of(person, ExampleMatcher
		.matchingAll()
		.withMatcher("name", ExampleMatcher.GenericPropertyMatcher.of(StringMatcher.ENDING, true))
		.withMatcher("firstName", ExampleMatcher.GenericPropertyMatcher.of(StringMatcher.STARTING))
		.withMatcher("sameValue", ExampleMatcher.GenericPropertyMatcher.of(StringMatcher.CONTAINING))
	);

	persons = repository.findAll(example);
	assertThat(persons).containsExactlyInAnyOrder(person2);

	person = new PersonWithAllConstructor(null, null, "(?i)ern.*", null, null, null, null, null, null, null,
		null);
	example = Example.of(person, ExampleMatcher.matchingAll().withStringMatcher(StringMatcher.REGEX));

	persons = repository.findAll(example);
	assertThat(persons).containsExactlyInAnyOrder(person1);

	example = Example
		.of(person,
			ExampleMatcher.matchingAll().withStringMatcher(StringMatcher.REGEX).withIncludeNullValues());

	persons = repository.findAll(example);
	assertThat(persons).isEmpty();
}
 
Example #11
Source File: ResourceService.java    From heimdall with Apache License 2.0 4 votes vote down vote up
/**
 * Generates a paged list of {@link Resource} from a request.
 * 
 * @param 	apiId						The {@link Api} Id
 * @param 	resourceDTO					The {@link ResourceDTO}
 * @param 	pageableDTO					The {@link PageableDTO}
 * @return								The paged {@link Resource} list as a {@link ResourcePage} object
 */
public ResourcePage list(Long apiId, ResourceDTO resourceDTO, PageableDTO pageableDTO) {

     Api api = apiRepository.findOne(apiId);
     HeimdallException.checkThrow(api == null, GLOBAL_RESOURCE_NOT_FOUND);
     
     Resource resource = GenericConverter.mapper(resourceDTO, Resource.class);
     resource.setApi(api);
     
     Example<Resource> example = Example.of(resource, ExampleMatcher.matching().withIgnorePaths("api.creationDate").withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));
     
     Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit());
     Page<Resource> page = resourceRepository.findAll(example, pageable);
     
     ResourcePage resourcePage = new ResourcePage(PageDTO.build(page));
     
     return resourcePage;
}
 
Example #12
Source File: ResourceService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Generates a list of {@link Resource} from a request.
 * 
 * @param 	apiId						The {@link Api} Id
 * @param 	resourceDTO					The {@link ResourceDTO}
 * @return								The List of {@link Resource}
 */
public List<Resource> list(Long apiId, ResourceDTO resourceDTO) {
     
     Api api = apiRepository.findOne(apiId);
     HeimdallException.checkThrow(api == null, GLOBAL_RESOURCE_NOT_FOUND);
     
     Resource resource = GenericConverter.mapper(resourceDTO, Resource.class);
     resource.setApi(api);
     
     Example<Resource> example = Example.of(resource, ExampleMatcher.matching().withIgnorePaths("api.creationDate").withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));
     
     List<Resource> resources = resourceRepository.findAll(example);
     
     return resources;
}
 
Example #13
Source File: PlanService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Generates a paged list of {@link Plan} from a request.
 * 
 * @param  planDTO						The {@link PlanDTO}
 * @param  pageableDTO					The {@link PageableDTO}
 * @return								The paged {@link Plan} list as a {@link PlanPage} object
 */
@Transactional(readOnly = true)
public PlanPage list(PlanDTO planDTO, PageableDTO pageableDTO) {

     Plan plan = GenericConverter.mapper(planDTO, Plan.class);
     
     Example<Plan> example = Example.of(plan, ExampleMatcher.matching().withIgnorePaths("defaultPlan", "api.cors").withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));
     
     Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit());
     Page<Plan> page = planRepository.findAll(example, pageable);
     
     PlanPage planPage = new PlanPage(PageDTO.build(page));
     
     return planPage;
}
 
Example #14
Source File: PlanService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Generates a list of {@link Plan} from a request.
 * 
 * @param  planDTO						The {@link PlanDTO}
 * @return								The List of {@link Plan}
 */
@Transactional(readOnly = true)
public List<Plan> list(PlanDTO planDTO) {
     
     Plan plan = GenericConverter.mapper(planDTO, Plan.class);
     
     Example<Plan> example = Example.of(plan, ExampleMatcher.matching().withIgnorePaths("defaultPlan", "api.cors").withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));
     
     List<Plan> plans = planRepository.findAll(example);
     
     return plans;
}
 
Example #15
Source File: DeveloperService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Generates a paged list of {@link Developer}s from a request.
 * 
 * @param  developerDTO 			The {@link DeveloperDTO}
 * @param  pageableDTO 			The {@link PageableDTO}
 * @return							The paged {@link Developer} list as a {@link DeveloperPage} object
 */
public DeveloperPage list(DeveloperDTO developerDTO, PageableDTO pageableDTO) {

     Developer developer = GenericConverter.mapper(developerDTO, Developer.class);
     
     Example<Developer> example = Example.of(developer, ExampleMatcher.matching().withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));
     
     Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit());
     Page<Developer> page = developerRepository.findAll(example, pageable);
     
     DeveloperPage developerPage = new DeveloperPage(PageDTO.build(page));
     
     return developerPage;
}
 
Example #16
Source File: DeveloperService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Generates a list of {@link Developer} from a request.
 * 
 * @param  developerDTO 			The {@link DeveloperDTO}
 * @return							The list of {@link Developer}
 */
public List<Developer> list(DeveloperDTO developerDTO) {
     
     Developer developer = GenericConverter.mapper(developerDTO, Developer.class);
     
     Example<Developer> example = Example.of(developer, ExampleMatcher.matching().withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));
     
     List<Developer> developers = developerRepository.findAll(example);
     
     return developers;
}
 
Example #17
Source File: EnvironmentService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Generates a paged list of {@link Environment} from a request.
 *
 * @param environmentDTO The {@link EnvironmentDTO}
 * @param pageableDTO    The {@link PageableDTO}
 * @return The paged {@link Environment} list as a {@link EnvironmentPage} object
 */
public EnvironmentPage list(EnvironmentDTO environmentDTO, PageableDTO pageableDTO) {

    Environment environment = GenericConverter.mapper(environmentDTO, Environment.class);

    Example<Environment> example = Example.of(environment, ExampleMatcher.matching().withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));

    Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit());
    Page<Environment> page = environmentRepository.findAll(example, pageable);

     return new EnvironmentPage(PageDTO.build(page));
}
 
Example #18
Source File: EnvironmentService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Generates a list of {@link Environment} from a request.
 *
 * @param environmentDTO The {@link EnvironmentDTO}
 * @return The List<{@link Environment}>
 */
public List<Environment> list(EnvironmentDTO environmentDTO) {

    Environment environment = GenericConverter.mapper(environmentDTO, Environment.class);

    Example<Environment> example = Example.of(environment, ExampleMatcher.matching().withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));

     return environmentRepository.findAll(example);
}
 
Example #19
Source File: ApiService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Generates a paged list of the {@link Api}'s
 *
 * @param apiDTO      {@link ApiDTO}
 * @param pageableDTO {@link PageableDTO}
 * @return The paged {@link Api} list as a {@link ApiPage} object
 */
public ApiPage list(ApiDTO apiDTO, PageableDTO pageableDTO) {

    Api api = GenericConverter.mapper(apiDTO, Api.class);

    Example<Api> example = Example.of(api, ExampleMatcher.matching().withIgnorePaths("cors").withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));

    Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit());
    Page<Api> page = apiRepository.findAll(example, pageable);

    ApiPage apiPage = new ApiPage(PageDTO.build(page));

    return apiPage;
}
 
Example #20
Source File: ApiService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Generates a list of the {@link Api}'s
 *
 * @param apiDTO {@link ApiDTO}
 * @return The list of {@link Api}'s
 */
public List<Api> list(ApiDTO apiDTO) {

    Api api = GenericConverter.mapper(apiDTO, Api.class);

    Example<Api> example = Example.of(api, ExampleMatcher.matching().withIgnorePaths("cors").withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));

    List<Api> apis = apiRepository.findAll(example);

    apis.sort(Comparator.comparing(Api::getId));

    return apis;
 }
 
Example #21
Source File: AppService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Generates a paged list of App.
 *
 * @param 	appDTO					The {@link AppDTO}
 * @param 	pageableDTO				The {@link PageableDTO}
 * @return							The paged {@link App} list as a {@link AppPage} object
 */
@Transactional(readOnly = true)
public AppPage list(AppRequestDTO appDTO, PageableDTO pageableDTO) {

     App app = GenericConverter.mapper(appDTO, App.class);

     Example<App> example = Example.of(app, ExampleMatcher.matching().withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));

     Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit());
     Page<App> page = appRepository.findAll(example, pageable);

     AppPage appPage = new AppPage(PageDTO.build(page));

     return appPage;
}
 
Example #22
Source File: AppService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Generates a list of {@link App}.
 *
 * @param 	appDTO					The {@link AppDTO}
 * @return							The list of {@link App}'s
 */
@Transactional(readOnly = true)
public List<App> list(AppRequestDTO appDTO) {

     App app = GenericConverter.mapper(appDTO, App.class);

     Example<App> example = Example.of(app, ExampleMatcher.matching().withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));

     List<App> apps = appRepository.findAll(example);

     return apps;
}
 
Example #23
Source File: ProviderService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Generates a paged list of {@link Provider} from a request
 *
 * @param providerDTO The {@link ProviderDTO}
 * @param pageableDTO The {@link PageableDTO}
 * @return The paged {@link Provider} list as a {@link ProviderPage} object
 */
public ProviderPage listWithPageableAndFilter(ProviderDTO providerDTO, PageableDTO pageableDTO) {

    Provider provider = GenericConverter.mapper(providerDTO, Provider.class);
    Example<Provider> example = Example.of(provider,
            ExampleMatcher.matching().withIgnorePaths("providerDefault").withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));

    Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit());

    Page<Provider> page = this.providerRepository.findAll(example, pageable);

    return new ProviderPage(PageDTO.build(page));
}
 
Example #24
Source File: AccessTokenService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Returns a paged list of all {@link AccessToken} from a request.
 *
 * @param 	accessTokenRequest 		{@link AccessTokenRequest} The request for {@link AccessToken}
 * @param 	pageableDTO 			{@link PageableDTO} The pageable DTO
 * @return 						The paged {@link AccessToken} list as a {@link AccessTokenPage} object
 */
@Transactional(readOnly = true)
public AccessTokenPage list(AccessTokenRequest accessTokenRequest, PageableDTO pageableDTO) {

     AccessToken accessToken = GenericConverter.mapper(accessTokenRequest, AccessToken.class);

     Example<AccessToken> example = Example.of(accessToken, ExampleMatcher.matching().withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));

     Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit());
     Page<AccessToken> page = accessTokenRepository.findAll(example, pageable);

     AccessTokenPage accessTokenPage = new AccessTokenPage(PageDTO.build(page));

     return accessTokenPage;
}
 
Example #25
Source File: AccessTokenService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Returns a list of all {@link AccessToken} from a request
 *
 * @param 	accessTokenRequest 		{@link AccessTokenRequest} The request for {@link AccessToken}
 * @return 						The list of {@link AccessToken}
 */
@Transactional(readOnly = true)
public List<AccessToken> list(AccessTokenRequest accessTokenRequest) {

     AccessToken accessToken = GenericConverter.mapper(accessTokenRequest, AccessToken.class);

     Example<AccessToken> example = Example.of(accessToken, ExampleMatcher.matching().withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));

     List<AccessToken> accessTokens = accessTokenRepository.findAll(example);

     return accessTokens;
}
 
Example #26
Source File: InterceptorService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Generates a paged list of {@link Interceptor} from a request.
 *
 * @param interceptorDTO The {@link InterceptorDTO}
 * @param pageableDTO    The {@link PageableDTO}
 * @return The paged {@link Interceptor} list as a {@link InterceptorPage} object
 */
@Transactional(readOnly = true)
public InterceptorPage list(InterceptorDTO interceptorDTO, PageableDTO pageableDTO) {

    Interceptor interceptor = GenericConverter.mapper(interceptorDTO, Interceptor.class);

    Example<Interceptor> example = Example.of(interceptor, ExampleMatcher.matching().withIgnorePaths("api.cors").withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));

    Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit());
    Page<Interceptor> page = interceptorRepository.findAll(example, pageable);

    return new InterceptorPage(PageDTO.build(page));
}
 
Example #27
Source File: InterceptorService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Generates a list of {@link Interceptor} from a request.
 *
 * @param interceptorDTO The {@link InterceptorDTO}
 * @return The List<{@link Interceptor}> list
 */
@Transactional(readOnly = true)
public List<Interceptor> list(InterceptorDTO interceptorDTO) {

    Interceptor interceptor = GenericConverter.mapper(interceptorDTO, Interceptor.class);

    Example<Interceptor> example = Example.of(interceptor, ExampleMatcher.matching().withIgnorePaths("api.cors").withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));

    return interceptorRepository.findAll(example);
}
 
Example #28
Source File: RoleService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a paged list of {@link Role} from a request.
 * 
 * @param roleDTO		{@link RoleDTO}
 * @param pageableDTO	{@link PageableDTO}
 * @return				{@link RolePage}
 */
@Transactional(readOnly = false)
public RolePage list(RoleDTO roleDTO, PageableDTO pageableDTO) {

     Role role = GenericConverter.mapper(roleDTO, Role.class);

     Example<Role> example = Example.of(role, ExampleMatcher.matching().withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));

     Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit());
     Page<Role> page = roleRepository.findAll(example, pageable);

     RolePage rolePage = new RolePage(PageDTO.build(page));

     return rolePage;
}
 
Example #29
Source File: RoleService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a list of {@link Role} from a request.
 * 
 * @param roleDTO		{@link RoleDTO}
 * @return				{@link List} of {@link Role}
 */
@Transactional(readOnly = false)
public List<Role> list(RoleDTO roleDTO) {

     Role role = GenericConverter.mapper(roleDTO, Role.class);

     Example<Role> example = Example.of(role, ExampleMatcher.matching().withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));

     List<Role> roles = roleRepository.findAll(example);

     return roles;
}
 
Example #30
Source File: UserService.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a paged list of {@link User} from a request.
 * 
 * @param userDTO		{@link UserDTO}
 * @param pageableDTO	{@link PageableDTO}
 * @return				{@link UserPage}
 */
@Transactional(readOnly = false)
public UserPage list(UserDTO userDTO, PageableDTO pageableDTO) {

     User user = GenericConverter.mapper(userDTO, User.class);

     Example<User> example = Example.of(user, ExampleMatcher.matching().withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING));

     Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit());
     Page<User> page = userRepository.findAll(example, pageable);

     UserPage userPage = new UserPage(PageDTO.build(page));

     return userPage;
}