Exemplo 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;
 }
Exemplo 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);
 }
Exemplo 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);
 }
Exemplo 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);
 }
Exemplo 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);
 }
Exemplo n.º 6
0
 @RequestMapping(value = "/contacts", method = POST)
 public Long create(@RequestBody ContactDto dto) {
   Long contactId = contactService.saveContact(dto);
   super.createAcl(contactId);
   return contactId;
 }
Exemplo n.º 7
0
 @PreAuthorize("hasPermission(#dto.getId(), 'sample.Contact', 'WRITE')")
 @RequestMapping(value = "/contacts", method = PUT)
 public void update(@RequestBody ContactDto dto) {
   contactService.updateContact(dto);
 }
Exemplo n.º 8
0
 @RequestMapping(value = "/contacts/nationalities", method = GET)
 public List<NationalityDto> getNationalities() {
   logger.debug("GETTING NATIONALITIES");
   return contactService.getNationalities();
 }
Exemplo n.º 9
0
 @RequestMapping(value = "/contacts/{contactId}", method = GET)
 public ContactDto get(@PathVariable Long contactId) {
   return contactService.get(contactId);
 }
Exemplo 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);
 }
Exemplo 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);
 }
Exemplo 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);
 }
Exemplo 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);
 }
Exemplo 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);
 }
Exemplo 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);
 }