Package com.dtrules.automapping.access

Examples of com.dtrules.automapping.access.IDataSource


    }
   
    @SuppressWarnings("unchecked")
    private void loadObjects(IMapNode parent,  Group groupObj, String label, Object object){
       
        IDataSource dataSrc   = groupObj.getDataSource();
       
        String spec = dataSrc.getSpec(object);
       
        boolean pruned = groupObj.isPruned(spec);
        if(pruned) return;
       
        if(object instanceof List){
            for(Object child : ((List<Object>)object)){
                loadObjects(parent,groupObj,dataSrc.getName(child),child);
            }
            return;
        }
       
        // Look up that label.
        Label labelObj = groupObj.findLabel(
                label,
                groupObj.getType(),
                spec);
       
        // If we haven't got a label for this sort of object yet, create one.
        if (labelObj == null  || !labelObj.isCached()){
       
            labelObj = dataSrc.createLabel(
                this,
                groupObj,
                dataSrc.getName(object),           // Get our default label name
                dataSrc.getKey(object),            // See if we can find a key for this obj                 
                false,
                object);
        }
       
        // If we still don't have a LabelObj, then just process its children.
        if(labelObj == null){
            for(Object child : dataSrc.getChildren(object) ){
                loadObjects(parent, groupObj, dataSrc.getName(child), child);
            }
            return;
        }
        loadObjects(parent, groupObj, labelObj, object);
    }
View Full Code Here


    }
   
    @SuppressWarnings("unchecked")
  private void loadObjects(IMapNode parent,  Group groupObj, Label labelObj, Object object){
       
      IDataSource dataSrc   = groupObj.getDataSource();
       
      MapNodeObject node = new MapNodeObject(groupObj, labelObj, parent);
        node.setSource(object);
       
        node.setKey(dataSrc.getKeyValue(node,object));
       
        if(parent==null){
            getDataMap().add(node);
        }
       
        // If we have written this object already, then we don't need to repeat its
        // attributes.  But we do need the key from the previous write!
        if(written.get(object)!=null){
            node.setKey(written.get(object).getKey());
        }else{
            written.put(object,node);
            for(IAttribute a : labelObj.getAttributes()){
                Object r = a.get(object);
                if(a.getType().isPrimitive()){
                    MapNodeAttribute mna = new MapNodeAttribute(a, node);
                    mna.setData(r);
                    if(a.isKey()){
                        node.setKey(r);
                    }
                }else{
                    if(a.getType() == MapType.LIST
                            && a.getSubType().isPrimitive()){
                        MapNodeList mnl = new MapNodeList(a, node);
                        mnl.setSubType(a.getSubTypeText());
                        mnl.setList((List<Object>)r);
                    }else if(a.getType()== MapType.LIST){
                        MapNodeList mnl = new MapNodeList(a,node);
                        mnl.setSubType(a.getSubTypeText());
                        mnl.setList((List<Object>)r);
                        if( r!=null ) for(Object obj2 : ((List)r)){
                            loadObjects(mnl, groupObj,(String) null, obj2);
                        }
                    }else if (a.getType() == MapType.MAP){
                        MapNodeMap mnm = new MapNodeMap(a,node);
                        mnm.setMap((Map<Object,Object>)r);
                    }else if (a.getType() == MapType.OBJECT){
                        if(r!=null) if(groupObj.isPruned(dataSrc.getSpec(r))) continue;
                        MapNodeRef mnr = new MapNodeRef (a, node);
                        if(r!=null) loadObjects(mnr, groupObj, (String) null, r);
                    }
                }
            }
View Full Code Here

    }
   
    @SuppressWarnings("unchecked")
    private void loadObjects(IMapNode parent,  Group groupObj, String label, Object object){
       
        IDataSource dataSrc   = groupObj.getDataSource();
       
        String spec = dataSrc.getSpec(object);
       
        boolean pruned = groupObj.isPruned(spec);
        if(pruned) return;
       
        if(object instanceof List){
            for(Object child : ((List<Object>)object)){
                loadObjects(parent,groupObj,dataSrc.getName(child),child);
            }
            return;
        }
       
        // Look up that label.
        Label labelObj = groupObj.findLabel(
                label,
                groupObj.getType(),
                spec);
       
        // If we haven't got a label for this sort of object yet, create one.
        if (labelObj == null  || !labelObj.isCached()){
       
            labelObj = dataSrc.createLabel(
                this,
                groupObj,
                dataSrc.getName(object),           // Get our default label name
                dataSrc.getKey(object),            // See if we can find a key for this obj                 
                false,
                object);
        }
       
        // If we still don't have a LabelObj, then just process its children.
        if(labelObj == null){
            for(Object child : dataSrc.getChildren(object) ){
                loadObjects(parent, groupObj, dataSrc.getName(child), child);
            }
            return;
        }
        loadObjects(parent, groupObj, labelObj, object);
    }
View Full Code Here

    }
   
    @SuppressWarnings("unchecked")
  private void loadObjects(IMapNode parent,  Group groupObj, Label labelObj, Object object){
       
      IDataSource dataSrc   = groupObj.getDataSource();
       
      MapNodeObject node = new MapNodeObject(groupObj, labelObj, parent);
        node.setSource(object);
       
        node.setKey(dataSrc.getKeyValue(node,object));
       
        if(parent==null){
            getDataMap().add(node);
        }
       
        // If we have written this object already, then we don't need to repeat its
        // attributes.  But we do need the key from the previous write!
        if(written.get(object)!=null){
            node.setKey(written.get(object).getKey());
        }else{
            written.put(object,node);
            for(IAttribute a : labelObj.getAttributes()){
                Object r = a.get(object);
                if(a.getType().isPrimitive()){
                    MapNodeAttribute mna = new MapNodeAttribute(a, node);
                    mna.setData(r);
                    if(a.isKey()){
                        node.setKey(r);
                    }
                }else{
                    if(a.getType() == MapType.LIST
                            && a.getSubType().isPrimitive()){
                        MapNodeList mnl = new MapNodeList(a, node);
                        mnl.setSubType(a.getSubTypeText());
                        mnl.setList((List<Object>)r);
                    }else if(a.getType()== MapType.LIST){
                        MapNodeList mnl = new MapNodeList(a,node);
                        mnl.setSubType(a.getSubTypeText());
                        mnl.setList((List<Object>)r);
                        if( r!=null ) for(Object obj2 : (List<Object>)r){
                            loadObjects(mnl, groupObj,(String) null, obj2);
                        }
                    }else if (a.getType() == MapType.MAP){
                        MapNodeMap mnm = new MapNodeMap(a,node);
                        mnm.setMap((Map<Object,Object>)r);
                    }else if (a.getType() == MapType.OBJECT){
                        if(r!=null) if(groupObj.isPruned(dataSrc.getSpec(r))) continue;
                        MapNodeRef mnr = new MapNodeRef (a, node);
                        if(r!=null) loadObjects(mnr, groupObj, (String) null, r);
                    }
                }
            }
View Full Code Here

TOP

Related Classes of com.dtrules.automapping.access.IDataSource

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.