private void addFetchedPaths(Path path, ObjectType type) {
   Root root = type.getRoot();
   if (root == null) {
     return;
   }
   ObjectMap om = root.getObjectMap(type);
   makePathLoadable(path, om.getFetchedPaths());
 }
 private static final Column getColumn(Property p) {
   Root root = SessionManager.getSession().getMetadataRoot().getRoot();
   ObjectMap om = root.getObjectMap(root.getObjectType(p.getContainer().getQualifiedName()));
   Mapping m = om.getMapping(Path.get(p.getName()));
   if (m instanceof Value) {
     return ((Value) m).getColumn();
   } else {
     return null;
   }
 }
  private void addDefaultProperties(Path path) {
    ObjectType type = getType(path);
    addFetchedPaths(path, type);

    if (!isSource(path)) {
      Root root = type.getRoot();
      Property prop = getProperty(path);
      // assume that path.getParent() is keyed
      ObjectMap container = root.getObjectMap(prop.getContainer());
      if (container != null) {
        makePathLoadable(path.getParent(), container.getDeclaredFetchedPaths());
      }
    }
  }
  /**
   * Returns a collection of ObjectTypes that this Model contains
   *
   * @return a collection of ObjectTypes that this Model contains
   */
  public Collection getObjectTypes() {
    ArrayList result = new ArrayList();

    for (Iterator it = m_root.getObjectTypes().iterator(); it.hasNext(); ) {
      com.redhat.persistence.metadata.ObjectType ot =
          (com.redhat.persistence.metadata.ObjectType) it.next();
      if (ot.getModel().equals(m_model)) {
        result.add(ot);
      }
    }

    return ObjectType.wrap(result);
  }
Exemple #5
0
 public static final com.redhat.persistence.metadata.ObjectType type(Root root, String qname) {
   return root.getObjectType(qname);
 }
 /**
  * Returns the DataType with the given name.
  *
  * @param name The name of the datatype to get.
  * @return The DataType with the given name.
  */
 public DataType getDataType(String name) {
   return ObjectType.wrap(m_root.getObjectType(m_model.getName() + "." + name));
 }