Package br.net.woodstock.rockframework.domain

Examples of br.net.woodstock.rockframework.domain.Entity


        BeanDescriptor beanDescriptor = new BeanDescriptorBuilder(src.getClass()).getBeanDescriptor();
        for (PropertyDescriptor propertyDescriptor : beanDescriptor.getProperties()) {
          Class propertyType = propertyDescriptor.getType();
          Object propertyValue = propertyDescriptor.getValue(src);
          if (Entity.class.isAssignableFrom(propertyType)) {
            Entity entity = (Entity) propertyValue;
            if (EntityUtils.isNotEmptyId(entity)) {
              if (!eventSource.contains(entity)) {
                entity = (Entity) eventSource.get(entity.getClass(), (Serializable) entity.getId());
                eventSource.refresh(entity);
              } else {
                eventSource.refresh(entity);
              }
              propertyDescriptor.setValue(src, entity);
View Full Code Here


  @SuppressWarnings("rawtypes")
  public void delete(final Entity<?> e) {
    try {
      this.entityManager.remove(e);
    } catch (IllegalArgumentException ex) {
      Entity tmp = this.entityManager.find(e.getClass(), e.getId());
      this.entityManager.remove(tmp);
    }
  }
View Full Code Here

        BeanDescriptor beanDescriptor = new BeanDescriptorBuilder(src.getClass()).getBeanDescriptor();
        for (PropertyDescriptor propertyDescriptor : beanDescriptor.getProperties()) {
          Class propertyType = propertyDescriptor.getType();
          Object propertyValue = propertyDescriptor.getValue(src);
          if (Entity.class.isAssignableFrom(propertyType)) {
            Entity entity = (Entity) propertyValue;
            if (EntityUtils.isNotEmptyId(entity)) {
              if (!this.isCascade(propertyDescriptor)) {
                Entity newEntity = (Entity) propertyType.newInstance();
                newEntity.setId(entity.getId());
                propertyDescriptor.setValue(src, newEntity);
                eventSource.evict(entity);
              }
            } else {
              propertyDescriptor.setValue(src, null);
View Full Code Here

  @Override
  @SuppressWarnings("rawtypes")
  public void delete(final Entity<?> e) {
    if (!this.getJpaTemplate().contains(e)) {
      Entity tmp = this.getJpaTemplate().find(e.getClass(), e.getId());
      this.getJpaTemplate().remove(tmp);
    } else {
      this.getJpaTemplate().remove(e);
    }
  }
View Full Code Here

  public boolean isValid(final Object o) {
    if (o == null) {
      return true;
    }
    if (o instanceof Entity) {
      Entity e = (Entity) o;
      Object id = e.getId();
      if (id != null) {
        return true;
      }
      return false;
    }
View Full Code Here

        BeanDescriptor beanDescriptor = new BeanDescriptorBuilder(src.getClass()).getBeanDescriptor();
        for (PropertyDescriptor propertyDescriptor : beanDescriptor.getProperties()) {
          Class propertyType = propertyDescriptor.getType();
          Object propertyValue = propertyDescriptor.getValue(src);
          if (Entity.class.isAssignableFrom(propertyType)) {
            Entity entity = (Entity) propertyValue;
            if (EntityUtils.isNotEmptyId(entity)) {
              if (!this.isCascade(propertyDescriptor)) {
                Entity newEntity = (Entity) propertyType.newInstance();
                newEntity.setId(entity.getId());
                propertyDescriptor.setValue(src, newEntity);
                eventSource.evict(entity);
              }
            } else {
              propertyDescriptor.setValue(src, null);
View Full Code Here

        BeanDescriptor beanDescriptor = new BeanDescriptorBuilder(src.getClass()).getBeanDescriptor();
        for (PropertyDescriptor propertyDescriptor : beanDescriptor.getProperties()) {
          Class propertyType = propertyDescriptor.getType();
          Object propertyValue = propertyDescriptor.getValue(src);
          if (Entity.class.isAssignableFrom(propertyType)) {
            Entity entity = (Entity) propertyValue;
            if (EntityUtils.isNotEmptyId(entity)) {
              if (!eventSource.contains(entity)) {
                entity = (Entity) eventSource.get(entity.getClass(), (Serializable) entity.getId());
                eventSource.refresh(entity);
              } else {
                eventSource.refresh(entity);
              }
              propertyDescriptor.setValue(src, entity);
View Full Code Here

  @Override
  @SuppressWarnings("rawtypes")
  public void delete(final Entity<?> e) {
    if (!this.getJpaTemplate().contains(e)) {
      Entity tmp = this.getJpaTemplate().find(e.getClass(), e.getId());
      this.getJpaTemplate().remove(tmp);
    } else {
      this.getJpaTemplate().remove(e);
    }
  }
View Full Code Here

  @SuppressWarnings("rawtypes")
  public void delete(final Entity<?> e) {
    try {
      this.entityManager.remove(e);
    } catch (IllegalArgumentException ex) {
      Entity tmp = this.entityManager.find(e.getClass(), e.getId());
      this.entityManager.remove(tmp);
    }
  }
View Full Code Here

        BeanDescriptor beanDescriptor = new BeanDescriptorBuilder(src.getClass()).getBeanDescriptor();
        for (PropertyDescriptor propertyDescriptor : beanDescriptor.getProperties()) {
          Class propertyType = propertyDescriptor.getType();
          Object propertyValue = propertyDescriptor.getValue(src);
          if (Entity.class.isAssignableFrom(propertyType)) {
            Entity entity = (Entity) propertyValue;
            if (EntityUtils.isNotEmptyId(entity)) {
              if (!this.isCascade(propertyDescriptor)) {
                Entity newEntity = (Entity) propertyType.newInstance();
                newEntity.setId(entity.getId());
                propertyDescriptor.setValue(src, newEntity);
                eventSource.evict(entity);
              }
            } else {
              propertyDescriptor.setValue(src, null);
View Full Code Here

TOP

Related Classes of br.net.woodstock.rockframework.domain.Entity

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.