Package org.jitterbit.integration.structure.reader

Examples of org.jitterbit.integration.structure.reader.JbNode


      CROM childCrom=child.m_CROM;
      assert childCrom!=null;
      CROM crom=childCrom.getParent();
    String value=null;
      if(crom.isAnyElement()){
        JbNode jbNode=m_jbNode.getChild(crom.getName());
      value=reader.parser.getStr(jbNode.getPos(), jbNode.getLength());
      }
      else {
        JbNode jbChild=null;
        JbNode jbParent=child.m_parent.m_jbNode;
        if(jbParent!=null)jbChild=jbParent.getChild(childCrom.getParent().getName());
        JbNode valueNode=null;
        if(jbChild!=null){
          if(childCrom.isLdap()){
            List<String> list=reader.parser.splitValues(jbChild, false);
            if(list!=null && list.size()>0){
              value=list.get(0);
            }
          }
          else {
            valueNode=jbChild.getValueNode();
          if(valueNode!=null){
            value=reader.parser.getStr(valueNode.getPos(), valueNode.getLength());
          }
          }
        }
      }
    if(value!=null){
View Full Code Here


    }
    }

    public void setDataInstance_recursive(int i) {
      if(m_CROM.isLoopNode()){
           JbNode jbParent=m_parent.m_jbNode;
           if(jbParent==null){
             m_jbNode=null;
           }
           else {
         JbNode instanceHolder=jbParent.getChild(m_CROM.getName());
          if(instanceHolder==null)
            m_jbNode=null;
          else {
              List<JbNode> instanceList=instanceHolder.getChildren();
              int n=instanceList.size();
              if(n>0){
                i%=n;
                m_idatanode=i;
                m_jbNode=instanceList.get(i);
              }
              else {
                m_idatanode=0;
                m_jbNode=null;
              }
          }
           }
      }
      else {
        assert i==0;
        // skip if m_parent==0, the root node was loaded when data tree initialized
        // it should not be changed unless data tree initialize again
        if(m_parent!=null){
          JbNode jbParent=m_parent.m_jbNode;
          if(jbParent==null)
            m_jbNode=null;
          else {
            m_jbNode=jbParent.getChild(m_CROM);
          }
        }
      }
      if(m_jbNode!=null && m_jbNode.m_source!=null && getTreeMapper()!=null){
        TreeComponent sourceTC=getTreeMapper().m_sourceTreeComponent;
View Full Code Here

    }

    public void initDataInstance_recursive(){
//      expandNode();
      if(m_CROM.isLoopNode()){
           JbNode jbParent=m_parent.m_jbNode;
           if(jbParent==null){
             m_jbNode=null;
           }
           else {
         JbNode instanceHolder=jbParent.getChild(m_CROM.getName());
          if(instanceHolder==null)
            m_jbNode=null;
          else {
            if(instanceHolder.getChildren().size()>0){
              m_jbNode=instanceHolder.getChildren().get(0);
              m_idatanode=0;
              expandNode();
            }
            else {
                m_jbNode=null;
            }
          }
           }
      }
      else {
        if(m_parent!=null){
          JbNode jbParent=m_parent.m_jbNode;
          if(jbParent==null)
            m_jbNode=null;
          else {
            m_jbNode=jbParent.getChild(m_CROM.getName());
            expandNode();
          }
        }
      }
      if(getTreeComponent().m_bTarget && m_jbNode!=null && m_jbNode.m_source!=null && isLoopNode() && getTreeMapper()!=null){
View Full Code Here

    }

    public Node findCommonJbParent(JbNode sourceJbNode){
      if(m_parent==null)return this;
      if(sourceJbNode==null)return null;
      JbNode jbParent_old=m_parent.m_jbNode;
      JbNode jbParent_new=sourceJbNode.getParent();
      if(sourceJbNode.isInstance())jbParent_new=jbParent_new.getParent();
      if(jbParent_new!=jbParent_old){
        m_parent.m_jbNode=jbParent_new;
        m_parent.setJbNode_resursive(jbParent_new, this);
        return m_parent.findCommonJbParent(jbParent_new);
      }
View Full Code Here

      String attr="";//m_TreeComponent.m_DocReader.getAttribute(jbNode, name);
      list.add(attr);
      return;
      }
    Node child=findChildFolder(name);
    JbNode jbChild=jbNode.getChild(child.m_CROM);
    if(jbChild==null)return;
    if(child.isLoopNode()){
      List<JbNode>list_list=Lists.newArrayList();
        if(m_children!=null){
          list_list=jbChild.getChildren();
        if(instanceNumber!=null){
          int i;
          if(instanceNumber.length()>1 && instanceNumber.charAt(0)=='_'){
            i=Integer.parseInt(instanceNumber.substring(1));
            i=list_list.size()-i;
View Full Code Here

    private void moveInstances(Node fromNode, String path, String instanceTag, Node toNode, int n1) throws Exception {
      if(fromNode==null||toNode==null)return;
      TreeComponent tc=fromNode.getTreeComponent();

      JbNode jbParent;
      if(tc.m_flat){
        jbParent=tc.m_jbRoot;
      }
      else {
          String parentPath=getParentPath(path);
        jbParent= tc.findJbNode(parentPath, instanceTag);
      }
      if(jbParent!=null){
        JbNode fromJbNode=jbParent.getChild(fromNode.getName());
        if(fromJbNode==null){
          throw new Exception("cannot find target data node, probably due to incomplete loading of the data tree.\nnode \""+
                fromNode.getName()+"\"");
        }
        JbNode toJbNode=new JbNode(jbParent, toNode.getCROM(), 0L, 0L);
        DocReader reader=m_sourceTreeComponent.m_DocReader;
        reader.moveChildren(fromJbNode, toJbNode, n1);
      }

    }
View Full Code Here

  private void processLinkFile(File localFile){
    TextDocReader reader=null;
    boolean bIsFlatTarget=m_targetTreeComponent.m_flat;
    try {
      reader=new TextDocReader(localFile, null);
      JbNode root=reader.parse_all();
      List<JbNode> list=root.getChildren();
      Map<String, Integer> lastIntanceNumber_map=new HashMap<String, Integer>();
      boolean targetReassigned=false;
      for(JbNode line: list){
        List<String> lineItems=reader.parser.splitValues(line, true);
        if(lineItems!=null && lineItems.size()>=4){
          String sourcePath=lineItems.get(0);
          if(sourcePath==null||sourcePath=="NULL")sourcePath="";
          String sourceTag=lineItems.get(1);
          String targetPath=lineItems.get(2);
          if(targetPath==null||targetPath=="NULL")targetPath="";
          String targetTag=lineItems.get(3);
          if(targetTag==null || targetTag.equals("skip"))continue;
          Node target=m_targetTreeComponent.findNode("["+targetPath+"]");
          if(target==null && bIsFlatTarget){
            target=m_targetTreeComponent.m_root.getFirstChild();
          }
          if(target!=null && target.isMultipleMap()){ // this is the case of multiple mapping folder
            if(getLastIntanceNumber(lastIntanceNumber_map, target, targetTag)==null){
              Node last_folder=find_last_folder(target);
              Integer lastInstanceNumber=getLastIntanceNumber(lastIntanceNumber_map, last_folder, targetTag);
              if(lastInstanceNumber==null)lastInstanceNumber=0;
              moveInstances(last_folder, targetPath, targetTag, target, lastInstanceNumber);
              targetReassigned=true;
            }
          }
          if(target!=null)updateLastIntanceNumber_map(lastIntanceNumber_map, target, targetTag);
          if(target!=null && target.isLoopNode()){
            JbNode sourceJbNode=m_sourceTreeComponent.findJbNode(sourcePath, sourceTag);
            JbNode targetJbNode=m_targetTreeComponent.findJbNode(targetPath, targetTag);
            if(targetJbNode!=null){
              targetJbNode.m_source=sourceJbNode;
            }
          }
        }
View Full Code Here

                    myPopupMenu.addAction(edit);
                }
            }
            if (node.isLoopNode()) {
                if (isDataLoaded()) {
                    JbNode jbNode = node.m_jbNode;
                    if((jbNode!=null && jbNode.isInstance())){
                      int n=jbNode.getParent().getChildren().size();
                      if (n > 1) {
                          if (n > 5) {
                              myPopupMenu.addMenuItem(cmd_find_instance_);
                          } else {
                              myPopupMenu.addMenu(cmd_select_instance);
View Full Code Here

    public JbNode findJbNode(String path0, String instanceList) throws Exception {
      if(m_jbRoot==null)return null;
      StringTokenizer ptk=new StringTokenizer(path0, "$.", true);
      StringTokenizer itk=new StringTokenizer(instanceList, ";", false);
      String path="";
      JbNode jbNode=m_jbRoot;
      if(m_flat){
        List<JbNode> children=m_jbRoot.getChildren();
        if(children==null)return null;
        if(itk.hasMoreTokens()==false)return null;
        JbNode holder=null;
        for(JbNode child: m_jbRoot.getChildren()){
          CROM childCrom=child.getCrom();
          if(childCrom.getName().equals(path0)){
            holder=child;
            break;
          }
        }
        int i=Integer.parseInt(itk.nextToken());
        if(holder!=null){
          children=holder.getChildren();
          if(children!=null && i>0 && i<=children.size())return children.get(i-1);
        }
        return null;
      }
View Full Code Here

      if(m_jbRoot==null){
        m_localFile=null;
        return;
      }
      Node root=m_root;
      JbNode jbNode;
      if(m_flat){
        jbNode=null;
        root=m_root.getFirstChild();
        if(m_jbRoot.getChildren().size()>0){
          jbNode=m_jbRoot.getChildren().get(0);
          if(jbNode.isInstance()==false && jbNode.getChildren().size()>0){
            jbNode=jbNode.getChildren().get(0);
          }
          else {
            jbNode=null;
          }
        }
View Full Code Here

TOP

Related Classes of org.jitterbit.integration.structure.reader.JbNode

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.