Package org.jitterbit.integration.structure.crom

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


    private static Node findShowNode(TreeComponent tree, Node node) {
        if (LdapUtils.isLdapAttributeCommand(tree, node)) {
            return null;
        }
        CROM sfdcNode=tree.sfdcNode;
        if(sfdcNode!=null){
            if(node.m_CROM!=sfdcNode && !sfdcNode.isAncestorOf(node.m_CROM)){
                return null;
            }
        }
        Node show_node = node, parent = node.m_parent;
        while (parent != null) {
View Full Code Here


*/
public final class JsonNodeVisibilityFilter implements NodeVisibilityFilter {

    @Override
    public boolean isHidden(Node node) {
        CROM crom = node.getCROM();
        return crom.isAttributeNode();
    }
View Full Code Here

    }

    private Set<CROM> getAllCromTypes(Collection<String> typeNames) {
        Set<CROM> nodes = new TreeSet<CROM>(new CromOrder());
        for (String name : typeNames) {
            CROM crom = lookupCromNode(tree, name);
            if (crom != null && !crom.isAbstract()) {
                nodes.add(crom);
            }
        }
        return nodes;
    }
View Full Code Here

    }

    private Set<String> collectCurrentChildNames() {
        Set<String> names = Sets.newHashSet();
        for (Node child : node.getChildren()) {
            CROM crom = child.getCROM();
            // HACK: isTypeDefinition for selecting derived types, isElementNode for selecting
            // substitution groups.
            if (crom != null && (crom.isTypeDefinition() || crom.isElementNode())) {
                String childName = getQualifiedName(crom);
                names.add(childName);
            }
        }
        return names;
View Full Code Here

        }

        @Override
        protected void setValue(Object value) {
            if (value instanceof CROM) {
                CROM node = (CROM) value;
                String text = getTextForNode(node);
                super.setValue(text);
            } else {
                super.setValue(value);
            }
View Full Code Here

        private void select(final Transformation tf) {
            EventQueue.invokeLater(new Runnable() {

                @Override
                public void run() {
                    CROM node = ChunkNodeSelectorDialog.selectNode(UiUtils.getActiveFrame(), tf, st, getCurrentValue());
                    if (node != null) {
                        setChunkNode(node);
                    }
                }
            });
View Full Code Here

* @since 1.3.0
*/
public class SimpleTextStructureMappingTreeConverter {

    public MappingTreeStructure convert(SimpleTextStructure text, CallbackResult callback) {
        CROM root=new CROM(null, true, "", -1, CromType.CROM_t_Text);
        root.addType(CROM.CROM_t_Root);
        Segment seg=text.getSegment();
        CROM flat_node=new CROM(root, true, seg.getName(), -1, CromType.CROM_t_Text);
        flat_node.addType(CROM.CROM_t_Collection);
        if(text.getDelimiter()!=null || text.getStringQualifier()!=null){
          CROM_ext ext=flat_node.getExtension();
          if(ext==null)ext=new CROM_Text();        
            if(text.getDelimiter()!=null)ext.setDelimiter(Utils.getDelimiterString(text));
            ext.setStrQual(text.getStringQualifier());
        }
        for(Field f:text.getSegment().fieldList){
          CROM field=new CROM(flat_node, false, f.fieldName, -1, CromType.CROM_t_Text);
          field.setValueType(f.dataType);
          field.addType(CROM.CROM_t_Attribute | CROM.CROM_t_Optional);
          field.setDefaultValue(f.defaultValue);
          field.getExtension().setFormat(f.format);
          field.getExtension().setFieldPos((short)f.getBeginPosition());
          field.getExtension().setFieldLength((short)f.getLength());
        }
        MappingTreeStructure structure = new CromBasedMappingTreeStructure(root, new CROMHeader("Text"));
        if (callback != null) {
            callback.succeeded(structure);
        }
View Full Code Here

*/
public final class ComplexTextStructureMappingTreeConverter {

    public MappingTreeStructure convert(ComplexTextStructure text, CallbackResult callback) {
        Map<Segment, CROM> map = Maps.newHashMap();
        CROM root=null;
        boolean isFixedField=text.isFixField();
        boolean bExtDefinedForRoot=false;
        for (Segment s : text.getSegmentList()) {
            Segment parent = s.findParent(text);
            CROM parent_crom=map.get(parent);
            CROM crom=new CROM(parent_crom, true, s.getName(), -1, CromType.CROM_t_Text);
            if(parent_crom==null){
              crom.addType(CROM.CROM_t_Root);
            }
            CROM_ext ext=crom.getExtension();
            String del=Utils.getDelimiterString(text);
            ext.setDelimiter(del);
            ext.setStrQual(text.getStringQualifier());
            Field identifier=s.findIdentField();
            if(identifier!=null && isFixedField){
              ext.setIdentPos(identifier.getBeginPosition());
              ext.setIdentLength(identifier.getLength());
            }
            if(root!=null && !bExtDefinedForRoot){
              ext=root.getExtension();
                ext.setDelimiter(del);
                ext.setStrQual(text.getStringQualifier());
                if(identifier!=null && isFixedField){
                  ext.setIdentPos(identifier.getBeginPosition());
                  ext.setIdentLength(identifier.getLength());
                }
                bExtDefinedForRoot=true;
            }
            map.put(s, crom);
            if(parent==null)root=crom;
            switch (s.getOccurenceID()) {
            case 1:
              crom.setOneToOneNode();
              break;
            case 2:
              crom.setAtLeastOneNode();
                break;
            case 3:
              crom.setOptionalNode();
                break;
            case 4:
              crom.setOuterJoin();
                break;
            }
            for (Field f : s.getFieldList()) {
                CROM field=new CROM(crom, false, f.fieldName, -1, CromType.CROM_t_Text);
              field.setValueType(f.dataType);
              if(f.equals(identifier)){
                  field.addType(CROM.CROM_t_Attribute);
              }
              else {
                field.addType(CROM.CROM_t_Attribute | CROM.CROM_t_Optional);
              }
              if(f.defaultValue!=null && f.defaultValue.length()>0){
                field.setDefaultValue(f.defaultValue);
                field.addType(CROM.CROM_t_HasDefault);
              }
              ext=field.getExtension();
              ext.setFormat(f.format);
              if(isFixedField){
                ext.setFieldPos((short)f.getBeginPosition());
                ext.setFieldLength((short)f.getLength());
              }
View Full Code Here

            else {
                if(shouldRowIdsBeRemovedFromInformixTables(dbStruct)) {
                    column_info.removeInformixRowIdColumn();
                }
              TreeItem<DbTranRelations.Relation> item = tree.getRoot();
              CROM root=new CROM(null, true, "", 0, CromType.CROM_t_DB), node=null;
              root.addType(CROM.CROM_t_Root);
              for (TreeItem<DbTranRelations.Relation> child : item.getChildren()) {
                node=createCromTreeForTable(root, node, child, isFlat, column_info, isManualSqlStatement);
              }
              structure = updateProperties(dbStruct, root);
              if (callback != null) {
View Full Code Here

            CROM prevSibling,
            TreeItem<DbTranRelations.Relation> item,
            boolean isFlat,
            DbColumnInfoCreator.ColumnInfo column_info,
            boolean isManualSqlStatement) {
      CROM node=null;
      String sTable_ = item.getName();
      boolean bIgnoredDbColumnDefaultValue = false;
      List<DbTranRelations.Relation> relations = item.getData();
      DbTranRelations.Relation relation = null;
      if (relations.size() > 0)
        relation = relations.get(0);

      if (sTable_ != null) {
        boolean bFolder=true;
        node=new CROM(parent, bFolder, sTable_, -1, CromType.CROM_t_DB);
        String sSchema=map_Schema.get(sTable_);
        if(sSchema!=null)node.setDBSchema(sSchema);
        String sTable = map_TableAlias.get(sTable_);
        if (sTable == null)sTable = sTable_;
        node.setSqlTableName(map_sqlTableName.get(sTable));
        String sTable2=(sSchema!=null && sSchema.length()>0)?sTable.substring(sSchema.length()+1):sTable; // Remove Schema from table name
          List<String> dbUpdateKeys=map_UpdateKeys.get(sTable2);
          boolean hasUserDefinedUpdateKeys=dbUpdateKeys!=null && dbUpdateKeys.size()>0;

          // for the time being we store the join type in the child table
          // it should be the property of the Foreign key column
        boolean isOneToOne = false, isOuterJoin = true;
        if (relation != null) {
          isOneToOne = relation.isOneToOne();
          isOuterJoin = relation.isOuterJoin();
        }
        if(isOneToOne){
          if(isOuterJoin)node.setOptionalNode();
        }
        else {
          if(isOuterJoin)node.setCollectionNode();
          else node.setAtLeastOneNode();
        }

        List<String> pk_list = new ArrayList<String>();
        for (TreeItem<DbTranRelations.Relation> child : item.getChildren()) {
        List<DbTranRelations.Relation> relation_list = child.getData();
        for (DbTranRelations.Relation r : relation_list) {
          pk_list.add(r.getParentField());
        }
        }

        List<DatabaseColumn> lstColumn = column_info.getTableColumnInfo(sTable, isManualSqlStatement);
        log("Table \""+sTable+"\" has "+(lstColumn==null? 0: lstColumn.size())+" columns.");
        if (lstColumn != null){
          for (DatabaseColumn column : lstColumn) {
            CROM attr;
          boolean isFolder=false;
            boolean bIsFK = false;
            String COLUMN_DEF = "";
            String PRIMARY_KEY=null;
            String COLUMN_NAME = column.getName();
            StringBuilder typeName = new StringBuilder(column.getDataTypeString());
            int DbColType=column.getSqlDataType();
            if (!bIgnoredDbColumnDefaultValue)
              COLUMN_DEF = column.getDefaultValueString();
            boolean bIsOptional = column.isNullable();
            boolean bIsPK = false;
            int DbColSize=column.getColumnSize();
            int DbDecimalDigits=column.getDecimalDigits();

            String display = COLUMN_NAME;
            for (String pk : pk_list) {
              if (COLUMN_NAME.equals(pk)) {
                bIsPK = true;
                break;
              }
            }

                    boolean bIsUpdateKey = checkIfUpdateKey(dbUpdateKeys, hasUserDefinedUpdateKeys, COLUMN_NAME, bIsPK);

            for (DbTranRelations.Relation r : relations) {
              String childField=r.getChildField(), parentField=r.getParentField();
              if ( beginQuote != null && endQuote != null && !beginQuote.isEmpty() && !endQuote.isEmpty() ) {
                if( (childField.startsWith(beginQuote) && childField.endsWith(endQuote) && childField.length()>2) ){
                  childField=childField.substring(1,childField.length()-1);
                }
                if( (parentField.startsWith(beginQuote) && parentField.endsWith(endQuote) && parentField.length()>2) ){
                  parentField=parentField.substring(1,parentField.length()-1);
                }
              }

              if (COLUMN_NAME.equals(childField)) {
                bIsFK = true;
                typeName.append(" [Join on ").append(parentField).append("]");
                PRIMARY_KEY=parentField;
              }
            }

            attr=new CROM(node, isFolder, display, -1, CromType.CROM_t_DB);

            if(bIsOptional)attr.setOptionalNode();
            if(bIsPK)attr.setPrimaryKey();
            if(bIsUpdateKey)attr.setUpdateKey();
            CROM_ext ext=attr.getExtension();
            if(bIsFK){
              attr.setLinkKey();
              attr.setLinkToPrimaryKey(PRIMARY_KEY);
            }
            ext.setValueType(typeName.toString());
            ext.setDbColType(DbColType);
            ext.setDbColSize(DbColSize);
            ext.setDbDecimalDigits(DbDecimalDigits);
            ext.setDefaultValue(COLUMN_DEF);

          }
        }
      }
      CROM child_node=null;
      for (TreeItem<DbTranRelations.Relation> child : item.getChildren()) {
        child_node = createCromTreeForTable(node, child_node, child, isFlat, column_info, isManualSqlStatement);
      }
      return node;
    }
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.