Package com.google.web.bindery.requestfactory.shared

Examples of com.google.web.bindery.requestfactory.shared.SimpleFooRequest.edit()


    simpleFooRequest().findSimpleFooById(999L).fire(new Receiver<SimpleFooProxy>() {
      @Override
      public void onSuccess(SimpleFooProxy response) {
        assertEquals(SimpleEnum.FOO, response.getEnumField());
        SimpleFooRequest ctx = simpleFooRequest();
        response = ctx.edit(response);
        response.setEnumField(SimpleEnum.BAR);
        ctx.persistAndReturnSelf().using(response).fire(new Receiver<SimpleFooProxy>() {
          @Override
          public void onSuccess(SimpleFooProxy response) {
            assertEquals(SimpleEnum.BAR, response.getEnumField());
View Full Code Here


        ctx.persistAndReturnSelf().using(response).fire(new Receiver<SimpleFooProxy>() {
          @Override
          public void onSuccess(SimpleFooProxy response) {
            assertEquals(SimpleEnum.BAR, response.getEnumField());
            SimpleFooRequest ctx = simpleFooRequest();
            response = ctx.edit(response);
            response.setEnumField(null);
            ctx.persistAndReturnSelf().using(response).fire(new Receiver<SimpleFooProxy>() {
              @Override
              public void onSuccess(SimpleFooProxy response) {
                assertNull(response.getEnumField());
View Full Code Here

            // no events are fired second time.
            assertEquals(1, handler.updateEventCount);
            assertEquals(1, handler.totalEventCount);
            SimpleFooRequest context = req.simpleFooRequest();
            final Request<Void> mutateRequest = context.persist().using(newFoo);
            newFoo = context.edit(newFoo);
            newFoo.setUserName("Ray");
            mutateRequest.fire(new Receiver<Void>() {
              @Override
              public void onSuccess(Void response) {
                // events fired on updates.
View Full Code Here

        // Persist foo with bar as a child.
        SimpleFooRequest context = req.simpleFooRequest();
        SimpleFooProxy foo = context.create(SimpleFooProxy.class);
        final Request<SimpleFooProxy> persistRequest =
            context.persistAndReturnSelf().using(foo).with("barField");
        foo = context.edit(foo);
        foo.setUserName("John");
        foo.setBarField(bar);
        persistRequest.fire(new Receiver<SimpleFooProxy>() {
          @Override
          public void onSuccess(SimpleFooProxy persistentFoo) {
View Full Code Here

        assertEquals(1, handler.updateEventCount);
        assertEquals(1, handler.totalEventCount);
        SimpleFooRequest context = simpleFooRequest();
        final Request<Long> mutateRequest =
            context.countSimpleFooWithUserNameSideEffect().using(newFoo);
        newFoo = context.edit(newFoo);
        newFoo.setUserName("Ray");
        mutateRequest.fire(new Receiver<Long>() {
          @Override
          public void onSuccess(Long response) {
            assertCannotFire(mutateRequest);
View Full Code Here

        simpleFooRequest().findSimpleFooById(999L).fire(new Receiver<SimpleFooProxy>() {
          @Override
          public void onSuccess(SimpleFooProxy fooProxy) {
            fooProxy = checkSerialization(fooProxy);
            SimpleFooRequest context = simpleFooRequest();
            fooProxy = context.edit(fooProxy);
            // Make the Foo point to the Bar
            fooProxy.setBarField(barProxy);
            fooProxy.setUserName("Hello");
            fooProxy.setByteField((byte) 55);
            context.persistAndReturnSelf().using(fooProxy).with("barField").fire(
View Full Code Here

                    assertEquals("Hello", received.getUserName());
                    assertTrue(55 == received.getByteField());

                    // Unset the association
                    SimpleFooRequest context = simpleFooRequest();
                    received = context.edit(received);
                    received.setBarField(null);
                    received.setUserName(null);
                    received.setByteField(null);
                    context.persistAndReturnSelf().using(received).fire(
                        new Receiver<SimpleFooProxy>() {
View Full Code Here

            response = checkSerialization(response);

            // Found the foo, edit it
            SimpleFooRequest context = simpleFooRequest();
            Request<Void> fooReq = context.persist().using(response);
            response = context.edit(response);
            response.setBarField(persistedBar);
            fooReq.fire(new Receiver<Void>() {
              @Override
              public void onSuccess(Void response) {
View Full Code Here

    SimpleFooRequest context = simpleFooRequest();
    SimpleFooProxy newFoo = context.create(SimpleFooProxy.class);
    final SimpleBarProxy newBar = context.create(SimpleBarProxy.class);

    Request<SimpleFooProxy> fooReq = context.persistAndReturnSelf().using(newFoo).with("barField");
    newFoo = context.edit(newFoo);
    newFoo.setBarField(newBar);

    fooReq.fire(new Receiver<SimpleFooProxy>() {
      @Override
      public void onSuccess(SimpleFooProxy response) {
View Full Code Here

   */
  public void testPersistNewEntityExistingRelation() {
    delayTestFinish(DELAY_TEST_FINISH);

    SimpleFooRequest context = simpleFooRequest();
    SimpleFooProxy newFoo = context.edit(context.create(SimpleFooProxy.class));
    final Request<Void> fooReq = context.persist().using(newFoo);

    newFoo.setUserName("Ray");

    final SimpleFooProxy finalFoo = newFoo;
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.