Package common.advanced

Examples of common.advanced.Person


    public void init() {

      try {
        em.getTransaction().begin();
       
        Person mother = new Person("Lorraine", 50);
          addPerson(mother);
         
          em.persist(mother);
         
          Person father = new Person("John", 55);
          addPerson(father);
 
          em.persist(father);
         
          Person partner = new Person("Catherine", 28);
          addPerson(partner);
 
          em.persist(partner);
         
          Person p = new Person("Fred", 30, mother, father, partner);
          addPerson(p);
          em.persist(p);
         
          father.addChild(p);
          mother.addChild(p);
View Full Code Here


        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

    }

   
    @Override
    public Response addChild(Long parentId, Person child) {
        Person parent = storage.getPerson(parentId);
        if (parent == null) {
            return Response.status(Response.Status.NOT_FOUND).build();
        }

        parent.addChild(child);

        Long childId = storage.addPerson(child);

        UriBuilder locationBuilder = uriInfo.getBaseUriBuilder();
        locationBuilder.path(PersonService.class);
View Full Code Here

        System.out.println("Getting info about Fred's children");
        wc.back(false).path("children");
        getPersons(wc);

        System.out.println("Fred and Catherine now have a child, adding a child info to PersonService");
        Person child = new Person("Harry", 1);
        Response response = wc.reset().path("4").path("children").post(child);

        // 201 status and the Location header pointing to
        // a newly created (child) Person resource is expected
        if (response.getStatus() != 201) {
View Full Code Here

        new PersonServiceProxyClient(proxy).useService();
    }
   
   
    private Person getPerson(WebClient wc) {
        Person person = wc.get(Person.class);
        System.out.println("ID " + person.getId() + " : " + person.getName() + ", age : " + person.getAge());
        return person;
    }
View Full Code Here

TOP

Related Classes of common.advanced.Person

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.