@RequestMapping("/contacts") public DataPageDto find(ContactFilterDto filterDto) { ContactFilter filter = convert(filterDto); DataPageDto<ContactDto> page = new DataPageDto<>(); List<ContactDto> contactDtos = contactService.findContacts(filter); page.setData(contactDtos); page.setTotalCount(contactService.countContacts(filter)); return page; }
@RequestMapping(value = "/contacts/email/{email}", method = GET) public String getContactByEmail(@PathVariable String email) throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); mapper.getFactory().configure(JsonGenerator.Feature.ESCAPE_NON_ASCII, true); ContactDto contact = contactService.getByEmail(email); return mapper.writeValueAsString(contact); }
@RequestMapping( value = "/contacts/{contactId}/social_networks/{socialNetworkId}", method = DELETE) @PreAuthorize("hasPermission(#contactId, 'sample.Contact', 'DELETE')") public void deleteSocialNetworkAccount( @PathVariable Long contactId, @PathVariable Long socialNetworkId) { contactService.deleteSocialNetworkAccount(socialNetworkId); }
@RequestMapping(value = "/contacts/{contactId}/educations/{educationId}", method = DELETE) @PreAuthorize("hasPermission(#contactId, 'sample.Contact', 'DELETE')") public void deleteEducationInfo(@PathVariable Long contactId, @PathVariable Long educationId) { logger.debug( "deleting info about universities education for contact {}, education id {}", contactId, educationId); contactService.deleteUniversityEducation(educationId); }
@RequestMapping(value = "/contacts/{contactId}", method = DELETE) @PreAuthorize("hasPermission(#contactId, 'sample.Contact', 'DELETE')") public void delete(@PathVariable Long contactId) { super.deleteAcl(contactId); contactService.deleteById(contactId); }
@RequestMapping(value = "/contacts", method = POST) public Long create(@RequestBody ContactDto dto) { Long contactId = contactService.saveContact(dto); super.createAcl(contactId); return contactId; }
@PreAuthorize("hasPermission(#dto.getId(), 'sample.Contact', 'WRITE')") @RequestMapping(value = "/contacts", method = PUT) public void update(@RequestBody ContactDto dto) { contactService.updateContact(dto); }
@RequestMapping(value = "/contacts/nationalities", method = GET) public List<NationalityDto> getNationalities() { logger.debug("GETTING NATIONALITIES"); return contactService.getNationalities(); }
@RequestMapping(value = "/contacts/{contactId}", method = GET) public ContactDto get(@PathVariable Long contactId) { return contactService.get(contactId); }
@RequestMapping(value = "/contacts/{contactId}/skills/{skillId}", method = DELETE) @PreAuthorize("hasPermission(#contactId, 'sample.Contact', 'DELETE')") public void deleteSkill(@PathVariable Long contactId, @PathVariable Long skillId) { contactService.deleteSkill(skillId); }
@RequestMapping(value = "/contacts/{contactId}/attachments/{attachmentId}", method = DELETE) public void deleteAttachment(@PathVariable Long contactId, @PathVariable Long attachmentId) { logger.debug("deleting attachment for contact {}, attachment id {}", contactId, attachmentId); contactService.deleteAttachment(attachmentId); }
@RequestMapping(value = "/contacts/{contactId}/workplaces/{workplaceId}", method = DELETE) @PreAuthorize("hasPermission(#contactId, 'sample.Contact', 'DELETE')") public void deleteWorkplace(@PathVariable Long contactId, @PathVariable Long workplaceId) { contactService.deleteWorkplace(workplaceId); }
@RequestMapping(value = "/contacts/{contactId}/telephones/{telephoneId}", method = DELETE) @PreAuthorize("hasPermission(#contactId, 'sample.Contact', 'DELETE')") public void deleteTelephone(@PathVariable Long contactId, @PathVariable Long telephoneId) { contactService.deleteTelephone(telephoneId); }
@RequestMapping(value = "/contacts/{contactId}/messengers/{messengerId}", method = DELETE) @PreAuthorize("hasPermission(#contactId, 'sample.Contact', 'DELETE')") public void deleteMessengerAccount(@PathVariable Long contactId, @PathVariable Long messengerId) { contactService.deleteMessengerAccount(messengerId); }
@RequestMapping(value = "/contacts/{contactId}/addresses/{addressId}", method = DELETE) @PreAuthorize("hasPermission(#contactId, 'sample.Contact', 'DELETE')") public void deleteAddress(@PathVariable Long contactId, @PathVariable Long addressId) { contactService.deleteAddress(addressId); }