Package org.beangle.model.entity.types

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


    return getEntityType(attr).getEntityClass();
  }

  protected EntityType getEntityType(String attr) {
    String alias = StringUtils.substringBefore(attr, ".");
    EntityType entityType = (EntityType) entityTypes.get(alias);
    if (null == entityType) {
      entityType = (EntityType) entityTypes.get(attr);
    }
    return entityType;
  }
View Full Code Here


    }
    return entityType;
  }

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

    if (null == entityType) { throw new RuntimeException("cannot find entity type for " + 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, "."));
        }
        rightAttrs.add(attrs[i]);
View Full Code Here

  public DefaultEntityImporter() {
    super();
  }

  public DefaultEntityImporter(Class<?> entityClass) {
    EntityType type = null;
    if (entityClass.isInterface()) {
      type = Model.getEntityType(entityClass.getName());
    } else {
      type = Model.getEntityType(entityClass);
    }
View Full Code Here

        clazz = Class.forName(field.getType());
      } catch (ClassNotFoundException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
      }
      EntityType myType=Model.getEntityType(clazz);
      OqlBuilder<T> builder=OqlBuilder.from(myType.getEntityName(), "restrictField");
     
      String[] ids=StringUtils.split(text,",");
      PropertyDescriptor pd=BeanUtils.getPropertyDescriptor(clazz, field.getKeyName());
      Class<?> propertyType=pd.getReadMethod().getReturnType();
      List<Object> realIds=CollectUtils.newArrayList(ids.length);
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

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.