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