SHARE
TWEET

Untitled

a guest Jan 18th, 2020 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @NoArgsConstructor
  2. @AllArgsConstructor
  3. @Getter
  4. @Setter
  5. public class VoteResultDto {
  6.     private Long id;
  7.  
  8.     private UserDto user;
  9.  
  10.     private ElectionDto election;
  11.  
  12.     private List<CandidateDto> candidates;
  13.  
  14.     private LocalDateTime voteTime;
  15. }
  16.  
  17.  
  18.  
  19.  
  20. @NoArgsConstructor
  21. @AllArgsConstructor
  22. @Getter
  23. @Setter
  24. public class ElectionListDto {
  25.     private Long id;
  26.  
  27.     private String name;
  28.  
  29.     private String description;
  30.  
  31.     private ElectionDto election;
  32.  
  33.     private ConstituencyDto constituency;
  34.  
  35.     private List<CandidateDto> candidates;
  36. }
  37.  
  38.  
  39.  
  40.  
  41. @NoArgsConstructor
  42. @AllArgsConstructor
  43. @Getter
  44. @Setter
  45. public class ElectoralPartyDto {
  46.     private Long id;
  47.  
  48.     private String name;
  49.  
  50.     private String description;
  51.  
  52.     private List<CandidateDto> candidates;
  53.  
  54.     private ElectoralProgrammeDto electoralProgramme;
  55. }
  56.  
  57.  
  58. Request:
  59. RestTemplate restTemplate = new RestTemplate();
  60.         restTemplate.setMessageConverters(getMessageConverters());
  61.         URI url = UriComponentsBuilder.fromHttpUrl(URL + "/createCandidate")
  62.                 .queryParam("id", candidate.getId())
  63.                 .queryParam("name", candidate.getName())
  64.                 .queryParam("lastname", candidate.getLastname())
  65.                 .queryParam("education", candidate.getEducation())
  66.                 .queryParam("placeOfResidence", candidate.getPlaceOfResidence())
  67.                 .queryParam("voteResults", Arrays.asList(new VoteResult()))
  68.                 .queryParam("electionList", candidate.getElectionList())
  69.                 .queryParam("electoralParty", candidate.getElectoralParty()).build().encode().toUri();
  70.         restTemplate.postForObject(url, null, Candidate.class);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top