Package org.beangle.model.entity.types

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


  public static List<Condition> extractConditions(Class<?> clazz, String prefix,
      String exclusiveAttrNames) {
    Object entity = null;
    try {
      if (clazz.isInterface()) {
        EntityType entityType = Model.getEntityType(clazz.getName());
        clazz = entityType.getEntityClass();
      }
      entity = clazz.newInstance();
    } catch (Exception e) {
      throw new RuntimeException("[RequestUtil.extractConditions]: error in in initialize "
          + clazz);
View Full Code Here


    return entity;
  }

  @SuppressWarnings("unchecked")
  protected <T> T populateEntity(Class<T> entityClass, String shortName) {
    EntityType type = null;
    if (entityClass.isInterface()) {
      type = Model.getEntityType(entityClass.getName());
    } else {
      type = Model.getEntityType(entityClass);
    }
    return (T) populateEntity(type.getEntityName(), shortName);
  }
View Full Code Here

  protected Entity<?> getEntity(String entityName, String name) {
    Long entityId = getEntityId(name);
    Entity<?> entity = null;
    try {
      EntityType type = Model.getEntityType(entityName);
      if (null == entityId) {
        entity = (Entity<?>) populate(type.newInstance(), type.getEntityName(), name);
      } else {
        entity = getModel(entityName, entityId);
      }
    } catch (Exception e) {
      throw new RuntimeException(e.getMessage());
View Full Code Here

    return entity;
  }

  @SuppressWarnings("unchecked")
  protected <T> T getEntity(Class<T> entityClass, String shortName) {
    EntityType type = null;
    if (entityClass.isInterface()) {
      type = Model.getEntityType(entityClass.getName());
    } else {
      type = Model.getEntityType(entityClass);
    }
    return (T) getEntity(type.getEntityName(), shortName);
  }
View Full Code Here

    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

      return populate(type.newInstance(), type.getName(), params);
    }
  }

  public Object populate(Class<?> entityClass, Map<String, Object> params) {
    EntityType entityType = Model.getEntityType(entityClass);
    return populate(entityType.newInstance(), entityType.getEntityName(), params);
  }
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.