Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @NoArgsConstructor
- @AllArgsConstructor
- @Getter
- @Setter
- public class VoteResultDto {
- private Long id;
- private UserDto user;
- private ElectionDto election;
- private List<CandidateDto> candidates;
- private LocalDateTime voteTime;
- }
- @NoArgsConstructor
- @AllArgsConstructor
- @Getter
- @Setter
- public class ElectionListDto {
- private Long id;
- private String name;
- private String description;
- private ElectionDto election;
- private ConstituencyDto constituency;
- private List<CandidateDto> candidates;
- }
- @NoArgsConstructor
- @AllArgsConstructor
- @Getter
- @Setter
- public class ElectoralPartyDto {
- private Long id;
- private String name;
- private String description;
- private List<CandidateDto> candidates;
- private ElectoralProgrammeDto electoralProgramme;
- }
- Request:
- RestTemplate restTemplate = new RestTemplate();
- restTemplate.setMessageConverters(getMessageConverters());
- URI url = UriComponentsBuilder.fromHttpUrl(URL + "/createCandidate")
- .queryParam("id", candidate.getId())
- .queryParam("name", candidate.getName())
- .queryParam("lastname", candidate.getLastname())
- .queryParam("education", candidate.getEducation())
- .queryParam("placeOfResidence", candidate.getPlaceOfResidence())
- .queryParam("voteResults", Arrays.asList(new VoteResult()))
- .queryParam("electionList", candidate.getElectionList())
- .queryParam("electoralParty", candidate.getElectoralParty()).build().encode().toUri();
- restTemplate.postForObject(url, null, Candidate.class);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement