use of me.kadarh.mecaworks.domain.others.Marque in project mecaworks by KadarH.
the class EnginServiceImpl method enginList.
@Override
public Page<Engin> enginList(Pageable pageable, String search) {
log.info("Service- EnginServiceImpl Calling enginList with params :" + pageable + ", " + search);
try {
if (search.isEmpty()) {
log.debug("fetching engin page");
return enginRepo.findAll(pageable);
} else {
log.debug("Searching by :" + search);
// creating example
Engin engin = new Engin();
engin.setNumeroSerie(search);
engin.setCode(search);
// sousfamille
SousFamille sousFamille = new SousFamille();
sousFamille.setNom(search);
// groupe
Groupe groupe = new Groupe();
groupe.setNom(search);
// marque
Marque marque = new Marque();
marque.setNom(search);
// setting groupe , marque , soufamille to engin
engin.setGroupe(groupe);
engin.setSousFamille(sousFamille);
// creating matcher
ExampleMatcher matcher = ExampleMatcher.matchingAny().withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING).withIgnoreCase().withIgnoreNullValues();
Example<Engin> example = Example.of(engin, matcher);
log.debug("getting search results");
return enginRepo.findAll(example, pageable);
}
} catch (Exception e) {
log.debug("Failed retrieving list of engins");
throw new OperationFailedException("Operation échouée, problème de saisi", e);
}
}
use of me.kadarh.mecaworks.domain.others.Marque in project mecaworks by KadarH.
the class MarqueServiceImpl method marqueList.
/**
* search with nom
*
* @param pageable page description
* @param search keyword
* @return Page
*/
@Override
public Page<Marque> marqueList(Pageable pageable, String search) {
log.info("Service- MarqueServiceImpl Calling MarqueList with params :" + pageable + ", " + search);
try {
if (search.isEmpty()) {
log.debug("fetching Marque page");
return marqueRepo.findAll(pageable);
} else {
log.debug("Searching by :" + search);
// creating example
Marque marque = new Marque();
marque.setNom(search);
// creating matcher
ExampleMatcher matcher = ExampleMatcher.matchingAny().withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING).withIgnoreCase().withIgnoreNullValues();
Example<Marque> example = Example.of(marque, matcher);
log.debug("getting search results");
return marqueRepo.findAll(example, pageable);
}
} catch (Exception e) {
log.debug("Failed retrieving list of marques");
throw new OperationFailedException("Operation échouée", e);
}
}
use of me.kadarh.mecaworks.domain.others.Marque in project mecaworks by KadarH.
the class MarqueController method add.
@GetMapping("/add")
public String add(Model model, Pageable pageable, @RequestParam(defaultValue = "") String search) {
model.addAttribute("marque", new Marque());
model.addAttribute("page", marqueService.marqueList(pageable, search));
model.addAttribute("search", search);
return "admin/marques/add";
}
Aggregations