Package org.chinasb.framework.core.base.search

Examples of org.chinasb.framework.core.base.search.Metadata


  public Metadata get(Class<?> klass) {
    return JPAAnnotationMetadata.getMetadata(klass);
  }

  public Metadata get(Class<?> rootEntityClass, String propertyPath) {
    Metadata md = get(rootEntityClass);
    if (propertyPath == null || propertyPath.equals("")) {
      return md;
    } else {
      for (String prop : propertyPath.split("\\.")) {
        if ("id".equals(prop)) {
          md = md.getIdType();
        } else {
          md = md.getPropertyType(prop);
        }
        if (md == null)
          throw new IllegalArgumentException("Property path '" + propertyPath + "' invalid for type " + rootEntityClass.getName());
      }
      return md;
View Full Code Here


      return md;
    }
  }

  public Serializable getId(Object object) {
    Metadata md = get(object.getClass());
    return md.getIdValue(object);
  }
View Full Code Here

    // see if the property is the identifier property of the entity it
    // belongs to.
    int pos = propertyPath.lastIndexOf(".");
    if (pos != -1) {
      Metadata parentType = get(rootClass, propertyPath.substring(0, pos));
      if (!parentType.isEntity())
        return false;
      return propertyPath.substring(pos + 1).equals(parentType.getIdProperty());
    } else {
      return propertyPath.equals(get(rootClass).getIdProperty());
    }
  }
View Full Code Here

    // see if the property is the identifier property of the entity it
    // belongs to.
    int pos = propertyPath.lastIndexOf(".");
    if (pos != -1) {
      Metadata parentType = get(rootClass, propertyPath.substring(0, pos));
      if (!parentType.isEntity())
        return false;
      return propertyPath.substring(pos + 1).equals(parentType.getIdProperty());
    } else {
      return propertyPath.equals(sessionFactory.getClassMetadata(rootClass).getIdentifierPropertyName());
    }
  }
View Full Code Here

    }
  }

  public Metadata get(Class<?> rootEntityClass, String propertyPath) {
    try {
      Metadata md = get(rootEntityClass);
      if (propertyPath == null || "".equals(propertyPath))
        return md;

      String[] chain = propertyPath.split("\\.");

      for (int i = 0; i < chain.length; i++) {
        md = md.getPropertyType(chain[i]);
      }

      return md;

    } catch (HibernateException ex) {
View Full Code Here

TOP

Related Classes of org.chinasb.framework.core.base.search.Metadata

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.