Package org.objectweb.speedo.metadata

Examples of org.objectweb.speedo.metadata.SpeedoFetchGroup


            );
        }
        if (mo instanceof SpeedoClass) {
            ((SpeedoClass) mo).add(f, true, logger);
        } else if (mo instanceof SpeedoFetchGroup) {
            SpeedoFetchGroup sfg = (SpeedoFetchGroup) mo;
            if (logger.isLoggable(BasicLevel.DEBUG)) {
                logger.log(BasicLevel.DEBUG, "add field '" + f.name
                    + "' into the fetchgroup '" + sfg.name +"'");
            }
            sfg.addField(f);
        }
        return f;
    }
View Full Code Here


        spq.resultClass = getStringAttributeValue(node, "class", null);
        spq.resultUnique = getBooleanAttributeValue(node, "unique", false);
        return spq;
    }
    private Object treatFetchGroup(Node node, Object mo) throws SpeedoException {
        SpeedoFetchGroup fg = new SpeedoFetchGroup();
        //attribute name
        Node n = node.getAttributes().getNamedItem("name");
        fg.name = n.getNodeValue();
       
        //attribute post-load
        n = node.getAttributes().getNamedItem("post-load");
        if (n != null){
            fg.postLoad = Boolean.valueOf(n.getNodeValue()).booleanValue();
        } else {
            if (fg.name.equals("default")) {
                fg.postLoad = true;
            } else {
                fg.postLoad = false;
            }
        }
        if (mo instanceof SpeedoClass) {
            SpeedoClass sc = (SpeedoClass) mo;
            if (logger.isLoggable(BasicLevel.DEBUG)) {
                logger.log(BasicLevel.DEBUG, "add fetchgroup '" +  fg.name +
                    "' into the class '"  + sc.getFQName() +"'");
            }
            sc.addFetchGroup(fg);
        } else if (mo instanceof SpeedoFetchGroup) {
            SpeedoFetchGroup pfg = (SpeedoFetchGroup) mo;
            if (logger.isLoggable(BasicLevel.DEBUG)) {
                logger.log(BasicLevel.DEBUG, "add fetchgroup '" +  fg.name +
                    "' into the fetchgroup '" + pfg.name +"'");
            }
            pfg.addFetchGroup(fg);
        }
        return fg;
    }
View Full Code Here

    List fetchGroups = new ArrayList(moClass.fetchGroups.size());
    boolean defaultRedefined = false;
    boolean valuesRedefined = false;
    ctx.put("fetchGroups", fetchGroups);
    for (Iterator it = moClass.fetchGroups.values().iterator(); it.hasNext();) {
      SpeedoFetchGroup sfg = (SpeedoFetchGroup) it.next();
      if(sfg.name.equals(FetchPlanItf.DEFAULT))
        defaultRedefined = true;
      else if(sfg.name.equals(FetchPlanItf.VALUES))
        valuesRedefined = true;
      FetchGroup fg = new FetchGroup();
View Full Code Here

        Map queryChildren = groupChildrenByName(queryNode);
        treatExtensions((List) queryChildren.get("extension"), spq);
        return spq;
    }
    private SpeedoFetchGroup getFetchGroup(Node fgNode, SpeedoClass fieldOwner) throws SpeedoException {
        SpeedoFetchGroup fg = new SpeedoFetchGroup();
        //<!ATTLIST fetch-group name CDATA #REQUIRED>
        Node n = fgNode.getAttributes().getNamedItem("name");
        fg.name = n.getNodeValue();
       
        //<!ATTLIST fetch-group post-load (true|false) #IMPLIED>
        n = fgNode.getAttributes().getNamedItem("post-load");
        if (n != null){
            fg.postLoad = Boolean.valueOf(n.getNodeValue()).booleanValue();
        } else {
            if (fg.name.equals("default")) {
                fg.postLoad = true;
            } else {
                fg.postLoad = false;
            }
        }
        Map fgChildren = groupChildrenByName(fgNode);
        //<!ELEMENT fetch-group (fetch-group|field)*>
        List l = (List) fgChildren.get("field");
        if (l != null) {
            for (int j = 0; j < l.size(); j++) {
                Node fieldNode = (Node) l.get(j);
                String fieldName = getStringAttributeValue(fieldNode, "name", null);
                if (fieldName != null) {
                    SpeedoField field = fieldOwner.getField(fieldName);
                    if (field != null) {
                        fg.addField(field);
                    } else {
                        logger.log(BasicLevel.WARN, "Bad field name '"
                                + fieldName + "'in the fetch group '"
                                + fg.name + "' in the class "
                                + fieldOwner.getSourceDesc() + ".");
                    }
                }
            }           
        }
        l = (List) fgChildren.get("fetch-group");
        if (l != null) {
            for (int j = 0; j < l.size(); j++) {
                SpeedoFetchGroup subfg = getFetchGroup((Node) l.get(j), fieldOwner);
                if (logger.isLoggable(BasicLevel.DEBUG)) {
                    logger.log(BasicLevel.DEBUG, "add fetchgroup '"
                            +  subfg.name + "' into the fetchgroup '"
                            + fg.name +"'");
                }
View Full Code Here

            // when we will have more information about the field type.
        }
       
    }
    private void treatFetchGroupNode(Node fetchNode, SpeedoClass moClass) throws SpeedoException {
        SpeedoFetchGroup fg = treatFetchGroupTree(fetchNode, moClass);
        moClass.fetchGroups.put(fg.name, fg);
    }
View Full Code Here

        moClass.fetchGroups.put(fg.name, fg);
    }
    private SpeedoFetchGroup treatFetchGroupTree(Node fetchNode,
            SpeedoClass fieldOwner) throws SpeedoException {
        //<!ELEMENT fetch-group (fetch-group|field)*>
        SpeedoFetchGroup fg = new SpeedoFetchGroup();
        //<!ATTLIST fetch-group name CDATA #REQUIRED>
        fg.name = getStringAttributeValue(fetchNode, "name", null);
        //<!ATTLIST fetch-group post-load (true|false) #IMPLIED>
        fg.postLoad = getBooleanAttributeValue(fetchNode, "post-load", false);
        Map fgChildren = groupChildrenByName(fetchNode);
        List fgs = (List) fgChildren.get("fetch-group");
        if (fgs != null) {
          for (Iterator fgIt = fgs.iterator(); fgIt.hasNext();) {
              Node fgNode = (Node) fgIt.next();
              fg.addFetchGroup(treatFetchGroupTree(fgNode, fieldOwner));
          }
        }
       
        List fields = (List) fgChildren.get("field");
        if (fields != null) {
          for (Iterator fieldIt = fields.iterator(); fieldIt.hasNext();) {
              Node fieldNode = (Node) fieldIt.next();
              SpeedoField sf = new SpeedoField();
              sf.name = getStringAttributeValue(fieldNode, "name", null);
                fg.addField(sf);
                //depth for a field
                String depth = getStringAttributeValue(fieldNode, "fetch-depth", null);
                if (depth == null) {
                  depth = getStringAttributeValue(fieldNode, "depth", null);
                  logger.log(BasicLevel.WARN, "attribute 'depth' is deprecated, use 'fetch-depth'.");
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.metadata.SpeedoFetchGroup

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.