Package org.jitterbit.integration.structure.crom

Examples of org.jitterbit.integration.structure.crom.CROM


    }
    if(isArray){
      cromArray=new CROM[jbChildList0.size()];
      jbChildArray=new JbNode[jbChildList0.size()];
      int i=0;
      CROM item=parent0.getChild(0);
      for(JbNode jbChild: jbChildList0){
        jbChildArray[i]=jbChild;
        cromArray[i++]=item;
      }
      return cromArray;
    }
    List<String> nameList=new ArrayList<String>();
    List<JbNode> jbChildList=new ArrayList<JbNode>();
    boolean hasUndefinedSubElement=false;
    CROM head;
    for(JbNode jbChild: jbChildList0){
      String name=jbChild.getName();
      List<CROM> list=nameToCromList_map.get(name);
      int size=list!=null?list.size():0;
      if(size>0){
        nameList.add(name);
        jbChildList.add(jbChild);
      }
      else if(cromXsiAny!=null){
        nameList.add(name);
        jbChildList.add(jbChild);       
      }
      else if((head=getSubstitutionGroupHead(name))!=null){
        name=head.getName();
        int index=name.indexOf('#');
        if(index>=0){
          name=name.substring(0,index);
        }
        nameList.add(name);
View Full Code Here


      }
      if(!valid)throw new Exception("Cannot find a valid subelement sequence for the parent \""+parent0.getDisplayName()+
          "\", the subelement names are "+Arrays.toString(nameArray));
    }
    for(int i=0; i<nSubElements; ++i){
      CROM dtd=cromArray[i];
      if(dtd.isSubstitutionGroupHead()){
        String name=jbChildArray[i].getName();
        dtd=getSubstitutionGroupHead(name);
        CROM child=dtd.findSubNode(name);
        if(child==null){
          CROM substitutionGroup=CROM.getSubstitutionGroupType(crom_tree, name);
          Stack<String> exploded=new Stack<String>();
              child=new CROM(dtd, substitutionGroup, false, crom_tree.getElementTypeMap(), exploded, "");
        }
        cromArray[i]=child;
      }
    }
  }
View Full Code Here

      }
    }
  }
 
  private void printCrom(int i){
    CROM dtd=cromArray[i];
    String key=nameArray[i];
    List<CROM> list=nameToCromList_map.get(key);
    System.out.print(" "+i+dtd+list.indexOf(dtd));
  }
View Full Code Here

  {
        Writer writer = null;
    try {
        DatabaseSource dbSource = new DatabaseSource(params);
            try {
                CROM root=DbUtils.createCromTree(params.jtrFile);
                dbSource.defineBeginAndEndQuote(root);
                writeStructureFileToDisk(params.structureFile, root);
                writer=BackendEncoding.openFileForWriting(new File(params.dataFile));
                dbSource.writeLog("Writing database image to " + params.dataFile);
                dbSource.dumpSourceDataTree(root, params.adHocFilter, writer);
View Full Code Here

        }
    }

  private void dumpSourceDataTree(CROM root, String adHocFilter, Writer writer) throws ExternalDatabaseException, SQLException, IOException
  {
    CROM rootTable=root.getChild(0);
    if(rootTable==null){
      String err="No root table in the source.";
      if(debug_log!=null)writeLog(err);
      throw new ExternalDatabaseException(err);
    }
View Full Code Here

      // find the group or element immediately under one-of-node and is the parent or node itself
      for(CROM child: parent.getChildren()){
        if(child==node)return i0;
        else if(child.isAncestorOf(node)){
          for(int i=i0+1; i<nChildren; i0=i, ++i){
            CROM next=cromChildSequence[i];
            if(!child.isAncestorOf(next))break;
          }
          return i0;
        }
      }
    }
    for(int i=i0+1; i<nChildren; i0=i, ++i){
      CROM next=cromChildSequence[i];
      if(!parent.isAncestorOf(next))break;
    }
    return i0;
  }
View Full Code Here

                        try {
                            StringBuilder list=new StringBuilder();
                            for(int i = 0; i < n; ++i){
                                Pair<Integer, CROM> link = linkKeyIndices.get(i);
                int k=link.first;
                                CROM foreignKey = link.second;
                String value = parent.columnValues.get(k);
                                if(debug_log!=null)writeLog(MessageFormat.format("Binding parameter {0}, col={1}, type={2}, value={3}", i + 1, foreignKey.getName(), foreignKey.getSqlDataType(), value));
                DbUtils.bindParameter(stmt, i + 1, foreignKey, value);
                                if(debug_log!=null){
                                    if(i>0)list.append(",");
                                    list.append(String.format(" #%d %s=%s", i+1, alist.get(k).getName(),value));
                                }
View Full Code Here

  private boolean validateStarting(CROM first) throws Exception {
    if(first==null && nChildren==0)return true;
    if(isAllGroup(parent0)||parent0.isSubstitutionGroupHead())return true;
    for(int i=0; i<nChildren; ++i){
      CROM next=cromChildSequence[i];
      if(next==first)return true;
      if(next.isOptionalNode() || next.isCollectionNode())continue;
      CROM optionalParent=getOptionalParent(null, next, first);
      if(optionalParent==null)return false;
      i=skipToLastSiblingPosition(optionalParent, next);
    }
    return first==null;
  }
View Full Code Here

  }

  private static List<Pair<Integer, CROM>> collectLinkKeyIndices(CROM table) throws ExternalDatabaseException
  {
    List<Pair<Integer, CROM>> keyIndices = Lists.newArrayList();
    CROM parent = table.getParent();
    if(parent == null)return keyIndices;
    for(CROM column : table.getChildren()){
      if(column.isElementNode())break;
      if(column.isForeignKey()){
        String pkName = column.getLinkToPrimaryKey();
        int i=0;
        boolean found=false;
        for(CROM parentColumn: parent.getChildren()){
          if(parentColumn.isElementNode())break;
          if(parentColumn.isAttributeNode()){
            if(parentColumn.getName().equals(pkName)){
              assert(parentColumn.isPrimaryKey());
              keyIndices.add(Pair.newPair(i, column));
View Full Code Here

 
  private boolean validateEnding(CROM last) throws Exception {
    if(isAllGroup(parent0)||parent0.isSubstitutionGroupHead())return true;
    //String commited_folder=parent.getPath();
    for(int i=cromToIndex_map.get(last)+1; i<nChildren; ++i){
      CROM next=cromChildSequence[i];
      if(next.isOptionalNode() || next.isOptionalValueElement() || next.isMultipleMapping())continue;
      if(next.isCollectionNode())continue;
      // it is okay if the "request" sub element is missing,
      if(nSubElements==1 && next.getName().equals("request"))return true;
      CROM optionalParent=getOptionalParent(last, next, null);
      if(optionalParent==null)return false;
      i=skipToLastSiblingPosition(optionalParent, next);
    }
    return true;
  }
View Full Code Here

TOP

Related Classes of org.jitterbit.integration.structure.crom.CROM

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.