use of org.springframework.data.domain.ExampleMatcher in project mecaworks by KadarH.
the class EmployeServiceImpl method employesList.
/**
* search with nom
*
* @param pageable page description
* @param search keyword
* @return Page
*/
@Override
public Page<Employe> employesList(Pageable pageable, String search) {
log.info("Service- employeServiceImpl Calling employeList with params :" + pageable + ", " + search);
try {
if (search.isEmpty()) {
log.debug("fetching employe page");
return employeRepo.findAll(pageable);
} else {
log.debug("Searching by :" + search);
// creating example
Employe employe = new Employe();
employe.setNom(search);
employe.setMetier(search);
// creating matcher
ExampleMatcher matcher = ExampleMatcher.matchingAny().withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING).withIgnoreCase().withIgnoreNullValues();
Example<Employe> example = Example.of(employe, matcher);
log.debug("getting search results");
return employeRepo.findAll(example, pageable);
}
} catch (Exception e) {
log.debug("Failed retrieving list of employes");
throw new OperationFailedException("Operation échouée", e);
}
}
use of org.springframework.data.domain.ExampleMatcher in project mecaworks by KadarH.
the class FamilleServiceImpl method familleList.
/**
* search with nom
*
* @param pageable page description
* @param search keyword
* @return Page
*/
@Override
public Page<Famille> familleList(Pageable pageable, String search) {
log.info("Service- FamilleServiceImpl Calling familleList with params :" + pageable + ", " + search);
try {
if (search.isEmpty()) {
log.debug("fetching famille page");
return familleRepo.findAll(pageable);
} else {
log.debug("Searching by :" + search);
// creating example
Famille famille = new Famille();
famille.setNom(search);
if (classeService.findByNom(search).isPresent()) {
famille.setClasse(classeService.findByNom(search).get());
}
Classe classe = new Classe();
classe.setNom(search);
famille.setClasse(classe);
// creating matcher
ExampleMatcher matcher = ExampleMatcher.matchingAny().withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING).withIgnoreCase().withIgnoreNullValues();
Example<Famille> example = Example.of(famille, matcher);
log.debug("getting search results");
return familleRepo.findAll(example, pageable);
}
} catch (Exception e) {
log.debug("Failed retrieving list of familles");
throw new OperationFailedException("Operation échouée", e);
}
}
use of org.springframework.data.domain.ExampleMatcher in project mecaworks by KadarH.
the class FournisseurServiceImpl method fournisseurList.
/**
* search with nom
*
* @param pageable page description
* @param search keyword
* @return Page
*/
@Override
public Page<Fournisseur> fournisseurList(Pageable pageable, String search) {
log.info("Service- FournisseurServiceImpl Calling FournisseurList with params :" + pageable + ", " + search);
try {
if (search.isEmpty()) {
log.debug("fetching Fournisseur page");
return fournisseurRepo.findAll(pageable);
} else {
log.debug("Searching by :" + search);
// creating example
Fournisseur fournisseur = new Fournisseur();
fournisseur.setNom(search);
// creating matcher
ExampleMatcher matcher = ExampleMatcher.matchingAny().withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING).withIgnoreCase().withIgnoreNullValues();
Example<Fournisseur> example = Example.of(fournisseur, matcher);
log.debug("getting search results");
return fournisseurRepo.findAll(example, pageable);
}
} catch (Exception e) {
log.debug("Failed retrieving list of Fournisseurs");
throw new OperationFailedException("Operation échouée", e);
}
}
use of org.springframework.data.domain.ExampleMatcher in project mecaworks by KadarH.
the class GroupeServiceImpl method groupesList.
/**
* search with nom
*
* @param pageable page description
* @param search keyword
* @return Page
*/
@Override
public Page<Groupe> groupesList(Pageable pageable, String search) {
log.info("Service- GroupeServiceImpl Calling GroupeList with params :" + pageable + ", " + search);
try {
if (search.isEmpty()) {
log.debug("fetching Groupe page");
return groupeRepo.findAll(pageable);
} else {
log.debug("Searching by :" + search);
// creating example
Groupe groupe = new Groupe();
groupe.setNom(search);
// creating matcher
ExampleMatcher matcher = ExampleMatcher.matchingAny().withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING).withIgnoreCase().withIgnoreNullValues();
Example<Groupe> example = Example.of(groupe, matcher);
log.debug("getting search results");
return groupeRepo.findAll(example, pageable);
}
} catch (Exception e) {
log.debug("Failed retrieving list of groupes");
throw new OperationFailedException("Operation échouée", e);
}
}
use of org.springframework.data.domain.ExampleMatcher in project mecaworks by KadarH.
the class ChantierServiceImpl method chantierList.
/**
* search with nom and adresse
*
* @param pageable page description
* @param search keyword
* @return Page
*/
@Override
public Page<Chantier> chantierList(Pageable pageable, String search) {
log.info("Service- ChantierServiceImpl Calling chantierList with params :" + pageable + ", " + search);
try {
if (search.isEmpty()) {
log.debug("fetching chantier page");
return chantierRepo.findAll(pageable);
} else {
log.debug("Searching by :" + search);
// creating example
Chantier chantier = new Chantier();
chantier.setNom(search);
chantier.setAdresse(search);
// creating matcher
ExampleMatcher matcher = ExampleMatcher.matchingAny().withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING).withIgnoreCase().withIgnoreNullValues();
Example<Chantier> example = Example.of(chantier, matcher);
log.debug("getting search results");
return chantierRepo.findAll(example, pageable);
}
} catch (Exception e) {
log.debug("Failed retrieving list of chantiers");
throw new OperationFailedException("Operation échouée", e);
}
}
Aggregations