private void generateContacts() {

    Contact contact1 = new Contact();
    contact1.setFirstName("Al");
    contact1.setLastName("Bundy");
    contact1.setAddress(new Address(9764, "Jeopardy Ln", "Chicago", "IL", 60290));
    addressService.saveAddress(contact1.getAddress());
    contactService.saveContact(contact1);

    Contact contact2 = new Contact();
    contact2.setFirstName("Ned");
    contact2.setLastName("Flanders");
    contact2.setAddress(new Address(740, "Evergreen Terrace", "Springfield", "OR", 97477));
    addressService.saveAddress(contact2.getAddress());
    contactService.saveContact(contact2);

    Contact contact3 = new Contact();
    contact3.setFirstName("Peter");
    contact3.setLastName("Griffin");
    contact3.setAddress(new Address(31, "Spooner St", "Quahog", "RI", 12908));
    addressService.saveAddress(contact3.getAddress());
    contactService.saveContact(contact3);
  }
Beispiel #2
0
 @RequestMapping(value = "/contacts", method = POST)
 public Long create(@RequestBody ContactDto dto) {
   Long contactId = contactService.saveContact(dto);
   super.createAcl(contactId);
   return contactId;
 }