Search in sources :

Example 1 with Address

use of io.vertigo.vega.webservice.data.domain.Address in project vertigo by KleeGroup.

the class ContactsWebServices method readContactView.

@GET("/contactView/{conId}")
public ContactView readContactView(@PathParam("conId") final long conId) {
    final Contact contact = contactDao.get(conId);
    if (contact == null) {
        // 404 ?
        throw new VUserException("Contact #" + conId + " unknown");
    }
    // we sheet and use 3 times the same address.
    final DtList<Address> addresses = DtList.of(contact.getAddressAccessor().get(), contact.getAddressAccessor().get(), contact.getAddressAccessor().get());
    final ContactView contactView = new ContactView();
    contactView.setName(contact.getName());
    contactView.setFirstName(contact.getFirstName());
    contactView.setHonorificCode(contact.getHonorificCode());
    contactView.setEmail(contact.getEmail());
    contactView.setBirthday(contact.getBirthday());
    contactView.setAddresses(addresses);
    // 200
    return contactView;
}
Also used : Address(io.vertigo.vega.webservice.data.domain.Address) Contact(io.vertigo.vega.webservice.data.domain.Contact) VUserException(io.vertigo.lang.VUserException) ContactView(io.vertigo.vega.webservice.data.domain.ContactView) GET(io.vertigo.vega.webservice.stereotype.GET)

Aggregations

VUserException (io.vertigo.lang.VUserException)1 Address (io.vertigo.vega.webservice.data.domain.Address)1 Contact (io.vertigo.vega.webservice.data.domain.Contact)1 ContactView (io.vertigo.vega.webservice.data.domain.ContactView)1 GET (io.vertigo.vega.webservice.stereotype.GET)1