Package org.beangle.model.entity.types

Examples of org.beangle.model.entity.types.EntityType


        + entityClass); }
    entityTypes.put(alias, entityType);
  }

  public void addEntity(String alias, String entityName) {
    EntityType entityType = Model.getEntityType(entityName);
    if (null == entityType) { throw new RuntimeException("cannot find entity type for "
        + entityName); }
    entityTypes.put(alias, entityType);
  }
View Full Code Here


  public Object getCurrent(String attr) {
    String alias = StringUtils.substringBefore(attr, ".");
    Object entity = current.get(alias);
    if (null == entity) {
      EntityType entityType = (EntityType) entityTypes.get(alias);
      if (null == entityType) {
        logger.error("Not register entity type for {}", alias);
        throw new RuntimeException("Not register entity type for " + alias);
      } else {
        entity = entityType.newInstance();
        current.put(alias, entity);
        return entity;
      }
    }
    return entity;
View Full Code Here

    for (int i = 0; i < attrs.length; i++) {
      if (StringUtils.isBlank(attrs[i])) {
        continue;
      }
      try {
        EntityType entityType = getEntityType(attrs[i]);
        Entity<?> example = (Entity<?>) entityType.newInstance();
        String entityName = entityType.getEntityName();
        String attr = processAttr(attrs[i]);
        if (attr.indexOf('.') > -1) {
          populator.initProperty(example, entityName, StringUtils.substringBeforeLast(
              attr, "."));
        }
View Full Code Here

    return query;
  }

  @SuppressWarnings("unchecked")
  public static <E> OqlBuilder<E> from(final String entityName, final String alias) {
    EntityType type = Model.getEntityType(entityName);
    OqlBuilder<E> query = new OqlBuilder<E>();
    query.entityClass = (Class<E>) type.getEntityClass();
    query.alias = alias;
    query.select = "select " + alias + " ";
    query.from = "from " + entityName + " " + alias;
    return query;
  }
View Full Code Here

    query.from = "from " + entityName + " " + alias;
    return query;
  }

  public static <E> OqlBuilder<E> from(final Class<E> entityClass) {
    EntityType type = Model.getEntityType(entityClass.getName());
    if (null == type) {
      type = Model.getEntityType(entityClass);
    }
    return from(entityClass, EntityUtils.getCommandName(type.getEntityName()));
  }
View Full Code Here

    return from(entityClass, EntityUtils.getCommandName(type.getEntityName()));
  }

  @SuppressWarnings("unchecked")
  public static <E> OqlBuilder<E> from(final Class<E> entityClass, final String alias) {
    EntityType type = Model.getEntityType(entityClass.getName());
    if (null == type) {
      type = Model.getEntityType(entityClass);
    }
    OqlBuilder<E> query = new OqlBuilder<E>();
    query.entityClass = (Class<E>) type.getEntityClass();
    query.alias = alias;
    query.select = "select " + alias + " ";
    query.from = "from " + type.getEntityName() + " " + alias;
    return query;
  }
View Full Code Here

   * @param name
   * @return
   */
  @SuppressWarnings("unchecked")
  public static <T> T populate(Class<T> clazz, String name) {
    EntityType type = null;
    if (clazz.isInterface()) {
      type = Model.getEntityType(clazz.getName());
    } else {
      type = Model.getEntityType(clazz);
    }
    return (T) populate(type.newInstance(), type.getEntityName(), name);
  }
View Full Code Here

    return (T) populate(type.newInstance(), type.getEntityName(), name);
  }

  @SuppressWarnings("unchecked")
  public static <T> T populate(Class<T> clazz) {
    EntityType type = null;
    if (clazz.isInterface()) {
      type = Model.getEntityType(clazz.getName());
    } else {
      type = Model.getEntityType(clazz);
    }
    String entityName = type.getEntityName();
    return (T) populate(type.newInstance(), entityName, EntityUtils.getCommandName(entityName));
  }
View Full Code Here

    String entityName = type.getEntityName();
    return (T) populate(type.newInstance(), entityName, EntityUtils.getCommandName(entityName));
  }

  public static Object populate(String entityName) {
    EntityType type = Model.getEntityType(entityName);
    return populate(type.newInstance(), type.getEntityName(), EntityUtils
        .getCommandName(entityName));
  }
View Full Code Here

    return populate(type.newInstance(), type.getEntityName(), EntityUtils
        .getCommandName(entityName));
  }

  public static Object populate(String entityName, String name) {
    EntityType type = Model.getEntityType(entityName);
    return populate(type.newInstance(), type.getEntityName(), name);
  }
View Full Code Here

TOP

Related Classes of org.beangle.model.entity.types.EntityType

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.