package org.develop.officialjournal.controllers; import org.develop.officialjournal.services.Database; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import dao.entity.Lawyer; import dao.lucene.tables.DAOLawyer; @RestController public class LawyerController { private DAOLawyer daoLawyer; public LawyerController() { daoLawyer = Database.get().getDaoLawyer(); } /**returns lawyer by id*/ @RequestMapping("/lawyer/{id}") public Lawyer getById(@PathVariable Integer id ) { Lawyer lawyer = this.daoLawyer.get(id); return lawyer; } @RequestMapping("/lawyer/") public Lawyer getByName(@RequestParam (required = true) String name ) { Lawyer lawyer = new Lawyer(name); return daoLawyer.get(lawyer); } }