Esempio n. 1
0
 @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;
 }
Esempio n. 2
0
 @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);
 }
Esempio n. 3
0
 @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);
 }
Esempio n. 4
0
 @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);
 }
Esempio n. 5
0
 @RequestMapping(value = "/contacts/{contactId}", method = DELETE)
 @PreAuthorize("hasPermission(#contactId, 'sample.Contact', 'DELETE')")
 public void delete(@PathVariable Long contactId) {
   super.deleteAcl(contactId);
   contactService.deleteById(contactId);
 }
Esempio n. 6
0
 @RequestMapping(value = "/contacts", method = POST)
 public Long create(@RequestBody ContactDto dto) {
   Long contactId = contactService.saveContact(dto);
   super.createAcl(contactId);
   return contactId;
 }
Esempio n. 7
0
 @PreAuthorize("hasPermission(#dto.getId(), 'sample.Contact', 'WRITE')")
 @RequestMapping(value = "/contacts", method = PUT)
 public void update(@RequestBody ContactDto dto) {
   contactService.updateContact(dto);
 }
Esempio n. 8
0
 @RequestMapping(value = "/contacts/nationalities", method = GET)
 public List<NationalityDto> getNationalities() {
   logger.debug("GETTING NATIONALITIES");
   return contactService.getNationalities();
 }
Esempio n. 9
0
 @RequestMapping(value = "/contacts/{contactId}", method = GET)
 public ContactDto get(@PathVariable Long contactId) {
   return contactService.get(contactId);
 }
Esempio n. 10
0
 @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);
 }
Esempio n. 11
0
 @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);
 }
Esempio n. 12
0
 @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);
 }
Esempio n. 13
0
 @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);
 }
Esempio n. 14
0
 @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);
 }
Esempio n. 15
0
 @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);
 }