Examples of BeanState


Examples of com.avaje.ebean.BeanState

 
  @Test
  public void testListInitialisation() {
   
    Customer customer = new Customer();
    BeanState beanState = Ebean.getBeanState(customer);
    if (beanState != null) {
      List<Order> orders = customer.getOrders();
      Assert.assertNotNull(orders);
    }
   
View Full Code Here

Examples of com.avaje.ebean.BeanState

  public void test() {
   
    ResetBasicData.reset();
    Order order = Ebean.getReference(Order.class, 1);

    BeanState beanState = Ebean.getBeanState(order);
    Set<String> loadedProps = beanState.getLoadedProps();
   
    Assert.assertEquals(1, loadedProps.size());
    Assert.assertTrue(beanState.isReference());

    // read the status invokes lazy loading
    order.getStatus();
   
    Assert.assertFalse(beanState.isReference());

  }
View Full Code Here

Examples of com.avaje.ebean.BeanState

    Customer customer = (Customer)descriptor.jsonRead(parser, null);
   
    Assert.assertEquals(Integer.valueOf(123), customer.getId());
    Assert.assertEquals("Hello rob", customer.getName());
   
    BeanState beanState = Ebean.getBeanState(customer);
    Set<String> loadedProps = beanState.getLoadedProps();
   
    Assert.assertEquals(2, loadedProps.size());
    Assert.assertTrue(loadedProps.contains("id"));
    Assert.assertTrue(loadedProps.contains("name"));
   
View Full Code Here

Examples of com.avaje.ebean.BeanState

   
    JsonContext jsonContext = Ebean.json();

    Product product = Ebean.getReference(Product.class, 1);

    BeanState beanState0 = Ebean.getBeanState(product);
    if (!beanState0.isReference()) {
      // got a cached value from beanCache

    } else {

      String jsonString = jsonContext.toJson(product);
      System.out.println(jsonString);

      Product refProd = jsonContext.toBean(Product.class, jsonString);

      BeanDescriptor<Product> prodDesc = server.getBeanDescriptor(Product.class);
      EntityBean eb = (EntityBean)refProd;
      prodDesc.isReference(eb._ebean_getIntercept());
     
      BeanState beanState = Ebean.getBeanState(refProd);
      Assert.assertTrue(beanState.isNew());
     
      String name = refProd.getName();
      Assert.assertNull(name);

      // Set to be 'loaded' to invoke lazy loading
      beanState.setLoaded();
      String name2 = refProd.getName();
      Assert.assertNotNull(name2);

    }
View Full Code Here

Examples of org.conventionsframework.qualifier.BeanState

        if (h != null) {
            this.setStates(h);
            this.matchState(h.value());
            return;
        } else {//only a state annotation is present
            BeanState beanState = AnnotationUtils.findStateAnnotation(getClass());
            if (beanState != null) {
                if (beanState.beanState().equals(this.getBeanState().getStateName())) {
                    statePushEvent.fire(new StatePushEvent(new StateItem(beanState.outcome(), getEntity(), getBeanState(), beanState.value(), beanState.title(), this.getClass(), beanState.ajax(), beanState.callback(), beanState.update(),beanState.global(),beanState.resetValues(),beanState.immediate(),beanState.oncomplete(),beanState.addEntityIdParam())));
                }
            }
        }
    }
View Full Code Here

Examples of org.conventionsframework.qualifier.BeanState

                this.setStates(states);
                this.matchState(states.value());
                return;

            } else {//only a state annotation is present
                BeanState state = AnnotationUtils.findStateAnnotation(getClass());
                if (states != null) {
                    if (state.beanState().equals(this.getBeanState().getStateName())) {
                        statePushEvent.fire(new StatePushEvent(new StateItem(state.outcome(), getEntity(), getBeanState(), state.value(), state.title(), this.getClass(), state.ajax(), state.callback(), state.update(),state.global(),state.resetValues(),state.immediate(),state.oncomplete(),state.addEntityIdParam())));
                    }
                }
            }
        }
    }
View Full Code Here

Examples of org.jboss.as.pojo.BeanState

            module = new ModuleConfig();
        super.visit(visitor);
    }

    protected void addChildren(ConfigVisitor visitor, List<ConfigVisitorNode> nodes) {
        BeanState state = visitor.getState();
        if (state == BeanState.NOT_INSTALLED)
            nodes.add(module);
        if (constructor != null && state == BeanState.DESCRIBED)
            nodes.add(constructor);
        if (properties != null && state == BeanState.INSTANTIATED)
View Full Code Here

Examples of org.jboss.as.pojo.BeanState

                InstancesService.addInstance(registry, context.getChildTarget(), getLifecycleState(), getBean());
            }

            final AbstractPojoPhase nextPhase = createNextPhase(); // do we have a next phase
            if (nextPhase != null) {
                final BeanState state = getLifecycleState();
                final BeanState next = state.next();
                final BeanMetaDataConfig beanConfig = getBeanConfig();
                final ServiceName name = BeanMetaDataConfig.toBeanName(beanConfig.getName(), next);
                final ServiceTarget serviceTarget = context.getChildTarget();
                final ServiceBuilder serviceBuilder = serviceTarget.addService(name, nextPhase);
                registerAliases(serviceBuilder, next);
View Full Code Here

Examples of org.jboss.as.pojo.BeanState

    @Override
    protected void addChildren(ConfigVisitor visitor, List<ConfigVisitorNode> nodes) {
        nodes.add(bean); // always check bean meta data

        BeanState state = visitor.getState();
        if (state == BeanState.NOT_INSTALLED)
            nodes.add(getModule());
        if (state == BeanState.INSTANTIATED)
            nodes.addAll(getProperties());
    }
View Full Code Here

Examples of org.jboss.as.pojo.BeanState

                InstancesService.addInstance(registry, context.getChildTarget(), getLifecycleState(), getBean());
            }

            final AbstractPojoPhase nextPhase = createNextPhase(); // do we have a next phase
            if (nextPhase != null) {
                final BeanState state = getLifecycleState();
                final BeanState next = state.next();
                final BeanMetaDataConfig beanConfig = getBeanConfig();
                final ServiceName name = BeanMetaDataConfig.toBeanName(beanConfig.getName(), next);
                final ServiceTarget serviceTarget = context.getChildTarget();
                final ServiceBuilder serviceBuilder = serviceTarget.addService(name, nextPhase);
                registerAliases(serviceBuilder, next);
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.