/**
  * SEARCH /_search/polCandidates/:query -> search for the polCandidate corresponding to the query.
  */
 @RequestMapping(
     value = "/_search/polCandidates/{query}",
     method = RequestMethod.GET,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public List<PolCandidate> searchPolCandidates(@PathVariable String query) {
   log.debug("REST request to search PolCandidates for query {}", query);
   return StreamSupport.stream(
           polCandidateSearchRepository.search(queryStringQuery(query)).spliterator(), false)
       .collect(Collectors.toList());
 }
 /** DELETE /polCandidates/:id -> delete the "id" polCandidate. */
 @RequestMapping(
     value = "/polCandidates/{id}",
     method = RequestMethod.DELETE,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Void> deletePolCandidate(@PathVariable Long id) {
   log.debug("REST request to delete PolCandidate : {}", id);
   polCandidateRepository.delete(id);
   polCandidateSearchRepository.delete(id);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityDeletionAlert("polCandidate", id.toString()))
       .build();
 }
 /** PUT /polCandidates -> Updates an existing polCandidate. */
 @RequestMapping(
     value = "/polCandidates",
     method = RequestMethod.PUT,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<PolCandidate> updatePolCandidate(
     @Valid @RequestBody PolCandidate polCandidate) throws URISyntaxException {
   log.debug("REST request to update PolCandidate : {}", polCandidate);
   if (polCandidate.getId() == null) {
     return createPolCandidate(polCandidate);
   }
   PolCandidate result = polCandidateRepository.save(polCandidate);
   polCandidateSearchRepository.save(result);
   return ResponseEntity.ok()
       .headers(
           HeaderUtil.createEntityUpdateAlert("polCandidate", polCandidate.getId().toString()))
       .body(result);
 }
 /** POST /polCandidates -> Create a new polCandidate. */
 @RequestMapping(
     value = "/polCandidates",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<PolCandidate> createPolCandidate(
     @Valid @RequestBody PolCandidate polCandidate) throws URISyntaxException {
   log.debug("REST request to save PolCandidate : {}", polCandidate);
   if (polCandidate.getId() != null) {
     return ResponseEntity.badRequest()
         .headers(
             HeaderUtil.createFailureAlert(
                 "polCandidate", "idexists", "A new polCandidate cannot already have an ID"))
         .body(null);
   }
   PolCandidate result = polCandidateRepository.save(polCandidate);
   polCandidateSearchRepository.save(result);
   return ResponseEntity.created(new URI("/api/polCandidates/" + result.getId()))
       .headers(HeaderUtil.createEntityCreationAlert("polCandidate", result.getId().toString()))
       .body(result);
 }