From b034ba0539b447109c23b17b95d08cd660ff14e7 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Mon, 22 Jan 2024 14:47:08 +0200 Subject: [PATCH] fix getmember object name --- .../member/web/rest/MemberResource.java | 89 +++++++++++-------- 1 file changed, 50 insertions(+), 39 deletions(-) diff --git a/member-service/src/main/java/org/orcid/memberportal/service/member/web/rest/MemberResource.java b/member-service/src/main/java/org/orcid/memberportal/service/member/web/rest/MemberResource.java index de2d459a4..d42093334 100644 --- a/member-service/src/main/java/org/orcid/memberportal/service/member/web/rest/MemberResource.java +++ b/member-service/src/main/java/org/orcid/memberportal/service/member/web/rest/MemberResource.java @@ -89,14 +89,15 @@ public class MemberResource { * * @param member the member to create. * @return the {@link ResponseEntity} with status {@code 201 (Created)} and - * with body the new member, or with status - * {@code 400 (Bad Request)} if the member has already an ID. + * with body the new member, or with status + * {@code 400 (Bad Request)} if the member has already an ID. * @throws URISyntaxException if the Location URI syntax is incorrect. * @throws JSONException */ @PostMapping("/members") @PreAuthorize("hasRole(\"ROLE_ADMIN\")") - public ResponseEntity createMember(@Valid @RequestBody Member member) throws URISyntaxException, JSONException { + public ResponseEntity createMember(@Valid @RequestBody Member member) + throws URISyntaxException, JSONException { LOG.debug("REST request to save Member : {}", member); Member created = memberService.createMember(member); return ResponseEntity.created(new URI("/api/member/" + created.getId())).body(created); @@ -107,13 +108,14 @@ public ResponseEntity createMember(@Valid @RequestBody Member member) th * * @param member the member to validate. * @return the {@link ResponseEntity} with status {@code 200 (Ok)} and with - * a MemberValidation object in the body. + * a MemberValidation object in the body. * @throws URISyntaxException if the Location URI syntax is incorrect. * @throws JSONException */ @PostMapping("/members/validate") @PreAuthorize("hasRole(\"ROLE_ADMIN\")") - public ResponseEntity validateMember(@Valid @RequestBody Member member) throws URISyntaxException, JSONException { + public ResponseEntity validateMember(@Valid @RequestBody Member member) + throws URISyntaxException, JSONException { MemberValidation validation = memberService.validateMember(member); return ResponseEntity.ok(validation); } @@ -123,8 +125,8 @@ public ResponseEntity validateMember(@Valid @RequestBody Membe * * @param file: file containing the member to create. * @return the {@link ResponseEntity} with status {@code 201 (Created)} and - * with a map indicating if each user was created or not, or with - * status {@code 400 (Bad Request)} if the file cannot be parsed. + * with a map indicating if each user was created or not, or with + * status {@code 400 (Bad Request)} if the file cannot be parsed. * @throws Throwable */ @PostMapping("/members/upload") @@ -140,16 +142,17 @@ public ResponseEntity uploadMember(@RequestParam("file") MultipartFile f * * @param member the member to update. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with - * body the updated member, or with status {@code 400 (Bad Request)} - * if the member is not valid, or with status - * {@code 500 (Internal Server Error)} if the member couldn't be - * updated. + * body the updated member, or with status {@code 400 (Bad Request)} + * if the member is not valid, or with status + * {@code 500 (Internal Server Error)} if the member couldn't be + * updated. * @throws URISyntaxException if the Location URI syntax is incorrect. * @throws JSONException */ @PutMapping("/members") @PreAuthorize("hasRole(\"ROLE_ADMIN\")") - public ResponseEntity updateMember(@Valid @RequestBody Member member) throws URISyntaxException, JSONException { + public ResponseEntity updateMember(@Valid @RequestBody Member member) + throws URISyntaxException, JSONException { LOG.debug("REST request to update Member : {}", member); Optional existentMember = memberService.getMember(member.getId()); if (!existentMember.isPresent()) { @@ -159,20 +162,21 @@ public ResponseEntity updateMember(@Valid @RequestBody Member member) th return ResponseEntity.ok().body(member); } - /** - * {@code POST /members/:id/language/:language } : Updates an existing member's default language. + * {@code POST /members/:id/language/:language } : Updates an existing member's + * default language. * * @param salesforceId - the salesforceId of the member to update * @param language - the language of the member to update * @return the {@link ResponseEntity} with status {@code 200 (OK)}, - * or with status {@code 400 (Bad Request)} - * if the member is not valid, or with status - * {@code 500 (Internal Server Error)} if the member couldn't be - * updated. + * or with status {@code 400 (Bad Request)} + * if the member is not valid, or with status + * {@code 500 (Internal Server Error)} if the member couldn't be + * updated. */ @PostMapping("/members/{salesforceId}/language/{language}") - public ResponseEntity updateMemberDefaultLanguage(@PathVariable String salesforceId, @PathVariable String language) { + public ResponseEntity updateMemberDefaultLanguage(@PathVariable String salesforceId, + @PathVariable String language) { LOG.info("REST request to update default language for member : {}", salesforceId); try { memberService.updateMemberDefaultLanguage(salesforceId, language); @@ -182,14 +186,15 @@ public ResponseEntity updateMemberDefaultLanguage(@PathVariable String sal return ResponseEntity.ok().build(); } - /** - * {@code PUT /members/{salesforceId}/member-details} : update details of member specified by salesforceID + * {@code PUT /members/{salesforceId}/member-details} : update details of member + * specified by salesforceID * * @return the {@link MemberUpdateData} */ @PutMapping("/members/{salesforceId}/member-details") - public ResponseEntity updatePublicMemberDetails(@RequestBody MemberUpdateData memberUpdateData, @PathVariable String salesforceId) { + public ResponseEntity updatePublicMemberDetails(@RequestBody MemberUpdateData memberUpdateData, + @PathVariable String salesforceId) { LOG.info("REST request to update member public details for salesforce id {}", salesforceId); if (StringUtils.isBlank(memberUpdateData.getPublicName())) { LOG.info("Null name in request to update public details"); @@ -204,7 +209,8 @@ public ResponseEntity updatePublicMemberDetails(@RequestBody MemberUpda } /** - * {@code GET /members/{salesforceId}/member-details} : get details of member specified by salesforceId param + * {@code GET /members/{salesforceId}/member-details} : get details of member + * specified by salesforceId param * * @return the {@link MemberDetails} */ @@ -226,9 +232,9 @@ public ResponseEntity> getSalesforceCountries() { return ResponseEntity.ok(countries); } - /** - * {@code GET /members/{salesforceId}/member-contacts} : get contacts of member specified by salesforceId param + * {@code GET /members/{salesforceId}/member-contacts} : get contacts of member + * specified by salesforceId param * * @return the {@link MemberDetails} */ @@ -244,7 +250,8 @@ public ResponseEntity getMemberContacts(@PathVariable String sal } /** - * {@code GET /members/{salesforceId}/member-org-ids} : get org ids of member specified by salesforceId param + * {@code GET /members/{salesforceId}/member-org-ids} : get org ids of member + * specified by salesforceId param * * @return the {@link MemberDetails} */ @@ -264,11 +271,12 @@ public ResponseEntity getMemberOrgIds(@PathVariable String salesfo * * @param pageable the pagination information. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the - * list of member in body. + * list of member in body. */ @GetMapping("/members") @PreAuthorize("hasRole(\"ROLE_ADMIN\")") - public ResponseEntity> getAllMembers(@RequestParam(required = false, name = "filter") String filter, Pageable pageable) { + public ResponseEntity> getAllMembers(@RequestParam(required = false, name = "filter") String filter, + Pageable pageable) { LOG.debug("REST request to get a page of Member"); Page page = null; if (StringUtils.isBlank(filter)) { @@ -283,7 +291,8 @@ public ResponseEntity> getAllMembers(@RequestParam(required = false } page = memberService.getMembers(pageable, decodedFilter); } - HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page); + HttpHeaders headers = PaginationUtil + .generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page); return ResponseEntity.ok().headers(headers).body(page.getContent()); } @@ -291,7 +300,7 @@ public ResponseEntity> getAllMembers(@RequestParam(required = false * {@code GET /member} : get all the member. * * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the - * list of member in body. + * list of member in body. */ @GetMapping("/members/list/all") @PreAuthorize("hasRole(\"ROLE_ADMIN\")") @@ -306,13 +315,12 @@ public ResponseEntity> getMembersList() { * * @param id - the id or salesforce id of the member to retrieve. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with - * body the member, or with status {@code 404 (Not Found)}. + * body the member, or with status {@code 404 (Not Found)}. */ @GetMapping("/members/{id}") public ResponseEntity getMember(@PathVariable String id) { LOG.debug("REST request to get Member : {}", id); - Optional membermember-service/src/main/java/org/orcid/memberportal/service/member/web/rest/MemberResource.java - = memberService.getMember(id); + Optional member = memberService.getMember(id); if (!member.isPresent()) { LOG.warn("Can't find member with id {}", id); } @@ -323,11 +331,12 @@ public ResponseEntity getMember(@PathVariable String id) { * {@code GET /members/authorized/:encryptedEmail} : get the authorized * member details for the specified encrypted email. * - * @param encryptedEmail - the encrypted email of the user that has authorized the + * @param encryptedEmail - the encrypted email of the user that has authorized + * the * member * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with - * the member details in the body, or status - * {@code 404 (Not Found)}. + * the member details in the body, or status + * {@code 404 (Not Found)}. */ @GetMapping("/members/authorized/{encryptedEmail}") public ResponseEntity getAuthorizedMember(@PathVariable String encryptedEmail) { @@ -351,8 +360,9 @@ public ResponseEntity deleteMember(@PathVariable String id) { } @PostMapping("/members/{salesforceId}/contact-update") - public ResponseEntity processMemberContactUpdate(@RequestBody MemberContactUpdate memberContactUpdate, - @PathVariable String salesforceId) { + public ResponseEntity processMemberContactUpdate( + @RequestBody MemberContactUpdate memberContactUpdate, + @PathVariable String salesforceId) { LOG.debug("REST request to create new member contact update for member {}", salesforceId); try { memberService.processMemberContact(memberContactUpdate, salesforceId); @@ -372,7 +382,8 @@ public ResponseEntity requestNewConsortiumMember(@RequestBody AddConsortiu @PreAuthorize("hasRole(\"ROLE_CONSORTIUM_LEAD\")") @PostMapping("/members/remove-consortium-member") - public ResponseEntity requestRemoveConsortiumMember(@RequestBody RemoveConsortiumMember removeConsortiumMember) { + public ResponseEntity requestRemoveConsortiumMember( + @RequestBody RemoveConsortiumMember removeConsortiumMember) { LOG.debug("REST request to request remove consortium member"); memberService.requestRemoveConsortiumMember(removeConsortiumMember); return ResponseEntity.ok().build();