Ejemplo n.º 1
0
 @PUT("touched")
 public List<Grandchild> touchCollection(IdRef<Child> childId) {
   List<Grandchild> grandchilds = yawp(Grandchild.class).from(childId).list();
   for (Grandchild grandchild : grandchilds) {
     grandchild.setName("touched " + grandchild.getName());
   }
   return grandchilds;
 }
Ejemplo n.º 2
0
  @Test
  public void testSaveGrandchild() {
    Parent parent = new Parent();
    yawp.save(parent);

    Child child = new Child();
    child.setParentId(parent.getId());
    yawp.save(child);

    Grandchild grandchild = new Grandchild("xpto");
    grandchild.setChildId(child.getId());
    yawp.save(grandchild);

    Child retrievedChild = child.getId().fetch();
    Grandchild retrievedGrandchild = grandchild.getId().fetch();

    assertEquals(retrievedGrandchild.getChildId(), retrievedChild.getId());
    assertEquals("xpto", retrievedGrandchild.getName());
  }
Ejemplo n.º 3
0
 @PUT("touched")
 public Grandchild touchObject(IdRef<Grandchild> id) {
   Grandchild grandchild = id.fetch();
   grandchild.setName("touched " + grandchild.getName());
   return grandchild;
 }