Package common.advanced

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


    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

    }

    @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

        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

    }

    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

        // 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

TOP

Related Classes of common.advanced.PersonCollection

Copyright © 2018 www.massapicom. 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.