Examples of PersonCollection


Examples of common.advanced.PersonCollection

        System.out.println("Using a simple JAX-RS proxy to get all the persons...");
        // getPersons(a, b): a is zero-based start index, b is number of records
        // to return (-1 for all)
        Response resp = proxy.getPersons(0, -1);
        if (resp.getStatus() == 200) {
            PersonCollection personColl = resp.readEntity(PersonCollection.class);
            List<Person> persons = personColl.getList();
            for (Iterator<Person> it = persons.iterator(); it.hasNext();) {
                Person person = it.next();
                System.out.println("ID " + person.getId() + " : " + person.getName() + ", age : "
                                   + person.getAge());
            }
View Full Code Here

Examples of common.advanced.PersonCollection

    public PersonCollection findPersonsWithTypedQuery(@Context SearchContext context) {
     
      List<Person> personList = storage.getTypedQueryPerson(context);
       
      // Execute JPA2 query and return the result
        return new PersonCollection(personList);
    }
View Full Code Here

Examples of common.advanced.PersonCollection

    }

    @Override
    public Response getPersons(Integer start, Integer size) {
        List<Person> collPer = getPersonsList(start, size);
        PersonCollection perColl = new PersonCollection();
        perColl.setList(collPer);
        ResponseBuilder rb;
        if (collPer.size() == 0) {
            rb = Response.noContent();
        } else {
            rb = Response.ok(perColl);
View Full Code Here

Examples of common.advanced.PersonCollection

        return rb.build();
    }

    @Override
    public PersonCollection findPersons(List<String> names) {
        PersonCollection collection = new PersonCollection();
        for (String name : names) {
            for (Person p : storage.getAll()) {
                if (p.getName().equalsIgnoreCase(name)) {
                    collection.addPerson(p);
                }
            }
        }
        return collection;
    }
View Full Code Here

Examples of common.advanced.PersonCollection

    }

    private void findPersons(WebClient wc, String searchExpression) {
      wc.resetQuery();
      wc.query("_s", searchExpression);
      PersonCollection persons = wc.get(PersonCollection.class);

      printPersonCollection(persons);
    }
View Full Code Here

Examples of common.advanced.PersonCollection

        // Can limit rows returned with 0-based start index and size (number of
        // records to return, -1 for all)
        // default (0, -1) returns everything
        // wc.query("start", "0");
        // wc.query("size", "2");
        PersonCollection collection = wc.get(PersonCollection.class);
        // Can call wc.getResponse() to see response codes
        List<Person> persons = collection.getList();
        System.out.println("Size: " + persons.size());
        for (Person person : persons) {
            System.out.println("ID " + person.getId() + " : " + person.getName() + ", age : "
                               + person.getAge());
        }
View Full Code Here

Examples of org.jugile.proto2.domain.PersonCollection

public class BoCollectionTest extends JugileTestCase {
 
  public void testPaging() {
    Domain d = Domain.getDomain();
    PersonCollection pc = new PersonCollection();
    for (int i = 0; i < 20; i++) {
      Person p = d.createPerson();
      p.setName("p"+i);
      pc.add(p);
    }
    for (Person p : pc) {
      print("p: " + p);
    }
   
    pc.reset();
    List<Person> res = null;
    res = pc.page(0, 5, "id");
    assertEquals(true,pc.hasNextPage());
    assertEquals(false,pc.hasPrevPage());
    res = pc.page(1, 5, "id");
    assertEquals(true,pc.hasNextPage());
    assertEquals(true,pc.hasPrevPage());
    res = pc.page(4, 5, "id");
    assertEquals(false,pc.hasNextPage());
    assertEquals(true,pc.hasPrevPage());

    res = pc.page(10, 5, "id");
    assertEquals(false,pc.hasNextPage());
    assertEquals(false,pc.hasPrevPage());
   
    res = pc.page(5, 5, "id");
    assertEquals(false,pc.hasNextPage());
    assertEquals(true,pc.hasPrevPage());
   
  }
View Full Code Here

Examples of org.jugile.proto2.domain.PersonCollection

public class CollectionPropsTest extends JugileTestCase {
 
  public void testProps() {
    Domain d = Domain.getDomain();
    PersonCollection pc = new PersonCollection();
    pc.add(d.createPerson().setName("p1"), "p1");
    pc.add(d.createPerson().setName("p2"), "p2");
    pc.add(d.createPerson().setName("p3"), "p3");
    for (Person p : pc) {
      print(p.getName() + "=" + pc.getProp(p.id()));
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.