Search in sources :

Example 1 with Contact

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

the class SearchTestWebServices method testFacetedQueryResult.

@POST("/facetedResult")
public FacetedQueryResult<Contact, DtList<Contact>> testFacetedQueryResult(final SelectedFacetValues selectedFacetValues) {
    final DtList<Contact> allContacts = asDtList(contactDao.getList(), Contact.class);
    final FacetedQueryDefinition facetedQueryDefinition = Home.getApp().getDefinitionSpace().resolve("QRY_CONTACT_FACET", FacetedQueryDefinition.class);
    final FacetedQuery facetedQuery = new FacetedQuery(facetedQueryDefinition, selectedFacetValues);
    return collectionsManager.facetList(allContacts, facetedQuery);
}
Also used : FacetedQueryDefinition(io.vertigo.dynamo.collections.metamodel.FacetedQueryDefinition) FacetedQuery(io.vertigo.dynamo.collections.model.FacetedQuery) Contact(io.vertigo.vega.webservice.data.domain.Contact) POST(io.vertigo.vega.webservice.stereotype.POST)

Example 2 with Contact

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

the class AdvancedTestWebServices method testGetExtended.

@GET("/contactExtended/{conId}")
public ExtendedObject<Contact> testGetExtended(@PathParam("conId") final long conId) {
    final Contact contact = contactDao.get(conId);
    final ExtendedObject<Contact> result = new ExtendedObject<>(contact);
    result.put("vanillaUnsupportedMultipleIds", new int[] { 1, 2, 3 });
    // 200
    return result;
}
Also used : ExtendedObject(io.vertigo.vega.webservice.model.ExtendedObject) Contact(io.vertigo.vega.webservice.data.domain.Contact) GET(io.vertigo.vega.webservice.stereotype.GET)

Example 3 with Contact

use of io.vertigo.vega.webservice.data.domain.Contact 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)

Example 4 with Contact

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

the class SimplerTestWebServices method loadListMeta.

@GET("/dtListMeta")
public DtList<Contact> loadListMeta() {
    final DtList<Contact> result = new DtList<>(Contact.class);
    for (final Contact contact : contactDao.getList()) {
        result.add(contact);
    }
    result.setMetaData("testLong", 12);
    result.setMetaData("testString", "the String test");
    result.setMetaData("testDate", DateUtil.newDate());
    result.setMetaData("testEscapedString", "the EscapedString \",} test");
    return result;
}
Also used : DtList(io.vertigo.dynamo.domain.model.DtList) Contact(io.vertigo.vega.webservice.data.domain.Contact) GET(io.vertigo.vega.webservice.stereotype.GET)

Aggregations

Contact (io.vertigo.vega.webservice.data.domain.Contact)4 GET (io.vertigo.vega.webservice.stereotype.GET)3 FacetedQueryDefinition (io.vertigo.dynamo.collections.metamodel.FacetedQueryDefinition)1 FacetedQuery (io.vertigo.dynamo.collections.model.FacetedQuery)1 DtList (io.vertigo.dynamo.domain.model.DtList)1 VUserException (io.vertigo.lang.VUserException)1 Address (io.vertigo.vega.webservice.data.domain.Address)1 ContactView (io.vertigo.vega.webservice.data.domain.ContactView)1 ExtendedObject (io.vertigo.vega.webservice.model.ExtendedObject)1 POST (io.vertigo.vega.webservice.stereotype.POST)1