use of me.kadarh.mecaworks.domain.others.Chantier in project mecaworks by KadarH.
the class BonFournisseurServiceImpl method bonList.
@Override
public Page<BonFournisseur> bonList(Pageable pageable, String search) {
log.info("Service- BonFournisseurServiceImpl Calling bonList with params :" + pageable + ", " + search);
try {
if (search.isEmpty()) {
log.debug("fetching bonEngins page");
return bonFournisseurRepo.findAll(pageable);
} else {
log.debug("Searching by :" + search);
// creating example
// Searching by code bon , nom chantier, nom fournisseur
BonFournisseur bonFournisseur = new BonFournisseur();
Chantier chantier = new Chantier();
chantier.setNom(search);
Fournisseur fournisseur = new Fournisseur();
fournisseur.setNom(search);
bonFournisseur.setChantier(chantier);
bonFournisseur.setFournisseur(fournisseur);
bonFournisseur.setCode(search);
// creating matcher
ExampleMatcher matcher = ExampleMatcher.matchingAny().withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING).withIgnoreCase().withIgnoreNullValues();
Example<BonFournisseur> example = Example.of(bonFournisseur, matcher);
Pageable pageable1 = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by(Sort.Direction.DESC, bonFournisseur.getDate().toString()));
log.debug("getting search results");
return bonFournisseurRepo.findAll(example, pageable1);
}
} catch (Exception e) {
log.debug("Failed retrieving list of employes");
throw new OperationFailedException("Operation échouée", e);
}
}
use of me.kadarh.mecaworks.domain.others.Chantier 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