Package org.jitterbit.integration.structure.crom

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


        public AttributeNodeFactory(Mode mode) {
            this.mode = mode;
        }
       
        public CROM createCrom(LdapStructureAttribute attr) {
            CROM node = new CROM(null, true, attr.getName(), 0, CromType.CROM_t_Ldap);
            setNodeType(attr, node);
            insertValueNode(attr, node);
            mode.addToAttributeNode(node);
            if(node.isLoopNode() && mode==Mode.TARGET){
              insertOldValueNode(attr, node);
            }
            return node;
        }
View Full Code Here


            }
           
        }

        private void insertValueNode(LdapStructureAttribute attr, CROM parent) {
            CROM value = new CROM(parent, false, "", 0, CromType.CROM_t_Ldap);
            value.addType(CROM.CROM_t_Value|CROM.CROM_t_Optional);
            if (attr.isReadOnly()) {
                value.addType(CROM.CROM_t_ReadOnly);
            }
            AttributeDataType dataType = attr.getSyntaxInfo().getDataType();
            value.setValueType(dataType.toString());
        }
View Full Code Here

            AttributeDataType dataType = attr.getSyntaxInfo().getDataType();
            value.setValueType(dataType.toString());
        }
       
        private void insertOldValueNode(LdapStructureAttribute attr, CROM parent) {
            CROM old_value = new CROM(parent, false, LdapStringConstants.old_value_string, 1, CromType.CROM_t_Ldap);
            old_value.addType(CROM.CROM_t_Attribute|CROM.CROM_t_Optional);
            AttributeDataType dataType = attr.getSyntaxInfo().getDataType();
            old_value.setValueType(dataType.toString());
        }
View Full Code Here

 
 
  private boolean validate(CROM left, CROM right, int pos) throws Exception {
    if(isAllGroup(parent0)||parent0.isSubstitutionGroupHead())return true;
    if(right==left && left.isLoopNode())return true;
    CROM leftParent=left.getParent();
    if(leftParent.isOneOfNode()){
      if(leftParent.isLoopNode()){
        if(right.getParent()==leftParent)return true;
      }
    }
     
    int left_pos=cromToIndex_map.get(left), right_pos=cromToIndex_map.get(right);
    boolean forward=left_pos < right_pos;
    if(forward){
      for(int i=left_pos+1; i<right_pos; ++i){
        CROM next=cromChildSequence[i];
        if(next.isOptionalNode())continue;
        if(next.isOptionalValueElement())continue;
        if(next.isCollectionNode())continue;
        CROM optionalParent=getOptionalParent(left, next, right);
        if(optionalParent==null)return false;
        i=skipToLastSiblingPosition(optionalParent, next);
      }
      return true;
    }
View Full Code Here

  }

  public Map<String,String> getAttributeMap(JbNode jbNode) throws IOException {
    Map<String,String> attr_map=new HashMap<String,String>();
    if(jbNode==null)return attr_map;
    CROM dtd=jbNode.getCrom();
    if(dtd==null)return attr_map;
    if(dtd.isAnyElement()){
      String value=parser.getStr(jbNode.m_pos, jbNode.m_length);
      attr_map.put("", value);
      return attr_map;
    }

    List<String> list=parser.splitValues(jbNode, false);

    Iterator<CROM> it=dtd.getChildren().iterator();
    CROM vaCrom=CROM.getNextValueAttribute(it);
    if(list!=null){
      for(String value:list){
        if(vaCrom==null)break;
        attr_map.put(vaCrom.getName(), value);
        vaCrom=CROM.getNextValueAttribute(it);
      }
    }
    for(;vaCrom!=null;vaCrom=CROM.getNextValueAttribute(it)){
      vaCrom.setValue(null);
    }


    return attr_map;
  }
View Full Code Here

      String jtr="C:\\Program Files\\Jitterbit Integration Server\\DataInterchange\\jtr\\";
      String jtrFN=jtr+"tran"+Integer.toString(tran_id)+(isTarget?"t":"s")+".jtr";
      File file=new File(jtrFN);
      CROM_Tree tree=new CROM_Tree();
      tree.parse(MappingTreeStructureFactory.fromFile(file, Charset.defaultCharset()));
            CROM dtdRoot=tree.getRoot();
//            dtdRoot.print(System.out);
            File localFile=new File(inputFN);

            if(dtdRoot.isXml()){
                 reader=new XmlReader(localFile, dtdRoot);
            }
            else {
              reader=new TextDocReader(localFile, false, dtdRoot);
            }
View Full Code Here

    else return fc.getStr(pos, len);
  }

    @Override
  public List<String> splitValues(JbNode element, boolean bIncludeName) throws IOException {
    CROM crom=element.getCrom();
    if(element.getLength()==0)return null;
    List<String> values=new ArrayList<String>();
    long pos=element.getPos();
    if(crom==null){
      while(!isEndOfRecord(pos)){
        pos=readValue(pos);
        String value=isNull()?"NULL":(getValue(pos1,(int)(pos2-pos1)));
        values.add(value);
      }
    }
    else {
      Iterator<CROM> it=crom.getChildren().iterator();
      CROM child;
      if(!isFlat && (crom.isDatabase()||crom.isLdap())){
        pos=readValue(pos);
      }
      for(child=CROM.getNextValueAttribute(it); !isEndOfRecord(pos); child=CROM.getNextValueAttribute(it)){
        pos=readValue(pos);
View Full Code Here

  private void createDataNode(JbNode jbnode) {
    String id=jbnode.getName();
    dtd=dtd.findSegment(id);
    dtd.expandNode(null);
    CROM parent_dtd=dtd.getParent();
    if(parent_dtd==null)return;
    JbNode parent_dnode=lastJbNodes.get(parent_dtd);
    if(dtd.isLoopNode()){
      JbNode dtdDNode=parent_dnode.getChild(dtd);
      if(dtdDNode==null){
View Full Code Here

  }


  @Override
  public List<String> splitValues(JbNode element, boolean bIncludeName) throws IOException {
    CROM crom=element.getCrom();
    long pos=element.getPos();
    int len=element.getLength();
    if(crom==null || len==0)return null;

    List<String> values=new ArrayList<String>();
    Iterator<CROM> it=crom.getChildren().iterator();
    long pos0=pos, pos3=pos+len;
    for(CROM child=CROM.getNextValueAttribute(it);child!=null; child=CROM.getNextValueAttribute(it)){
      long pos1=pos0+child.getFieldPos()-1;
      String value="NULL";
      if(pos1<pos3){
View Full Code Here

        }
      }
    }
    for(CROM child:parent.getChildren()){
      if(child.isSubstitutionGroupHead() && child.hasChildren()){
        CROM substitutionGroup=child.getChild(0);
        assert substitutionGroup.isSubstitutionGroup();
        addToSubstitutionMap(substitutionGroup.getName(), child);
      }
    }
  }
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.