com.github.qlefevre.crudadmin.model.CrudAdminRepository Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of crud-admin-spring-boot-starter Show documentation
Show all versions of crud-admin-spring-boot-starter Show documentation
CRUD Administration for Spring Boot
The newest version!
/*
* Copyright 2017 Quentin Lefèvre
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.qlefevre.crudadmin.model;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.core.support.DefaultRepositoryMetadata;
import org.springframework.web.bind.ServletRequestParameterPropertyValues;
import org.springframework.web.bind.WebDataBinder;
import com.github.qlefevre.crudadmin.util.CrudAdminUtils;
/**
* Object containing all useful information of the current
* PagingAndSortingRepository
*
* @author Quentin Lefèvre
*/
public class CrudAdminRepository {
private Field idField;
private PagingAndSortingRepository, ?> repository;
private DefaultRepositoryMetadata defaultRepositoryMetadata;
private WebDataBinder binder;
public CrudAdminRepository(PagingAndSortingRepository, ?> repository,
DefaultRepositoryMetadata defaultRepositoryMetadata) {
this.repository = repository;
this.defaultRepositoryMetadata = defaultRepositoryMetadata;
}
public PagingAndSortingRepository, ?> getRepository() {
return repository;
}
@SuppressWarnings("unchecked")
public PagingAndSortingRepository