Package org.jitterbit.integration.data.structure.database

Examples of org.jitterbit.integration.data.structure.database.TableRelationship


            DatabaseObject child = translatedObjects.get(join.getChildName());
            if (parent != null && child != null) {
                DatabaseColumn parentField = parent.findColumn(join.getParentField());
                DatabaseColumn childField = child.findColumn(join.getChildField());
                if (parentField != null && childField != null) {
                    TableRelationship tr = new TableRelationship(parent, child);
                    tr.setRelationshipNature(join.getCardinality());
                    FieldRelationship fr = new FieldRelationship(parentField, childField);
                    copiedJoins.add(new Relation(tr, fr));
                }
            }
        }
View Full Code Here


    @Override
    public String apply(DatabaseObject o) {
        DatabaseObject parent = relations.getParent(o);
        if (parent != null) {
            TableRelationship r = relations.getRelation(parent, o);
            switch (r.getRelationshipNature()) {
            case ONE_TO_N:
                return " [1 to N]";
            case ONE_TO_ONE:
                return " [1]";
            case ZERO_TO_N:
                return " [0 to N]";
            case ZERO_OR_ONE:
                return " [0 or 1]";
            default:
                throw new RuntimeException("Unexepected join type: " + r.getRelationshipNature());
            }
        }
        return "";
    }
View Full Code Here

            putValue(SHORT_DESCRIPTION, getString("Db.Relations.Join.ToolTip"));
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            TableRelationship r = parentChildSelector.getSelectedRelationship();
            if (r != null) {
                TableRelationship existing = relations.getRelation(r.getParentObject(), r.getChildObject());
                if (existing != null) {
                    r = existing;
                }
                defineJoinProperties(r);
            }
View Full Code Here

            }
            return false;
        }

        private void defineLinkKeys(DatabaseObject parent, DatabaseObject child) {
            TableRelationship r = relations.getRelation(parent, child);
            TableRelationshipDefinitionPageUi.this.defineProperties(r);
        }
View Full Code Here

            // so that the current drag and drop process can finish first.
            EventQueue.invokeLater(new Runnable() {

                @Override
                public void run() {
                    TableRelationship r = new TableRelationship(target, dragged);
                    if (defineProperties(r)) {
                        relations.add(r);
                        relationsChanged();
                    }
                }
View Full Code Here

    public TableRelationship getSelectedRelationship() {
        DatabaseObject parent = getSelectedParent();
        DatabaseObject child = getSelectedChild();
        if (isValidRelation(parent, child)) {
            return new TableRelationship(parent, child);
        }
        return null;
    }
View Full Code Here

    }
   
    @Test
    public void testGetAllRelationships() {
        List<TableRelationship> copy = Lists.newArrayList();
        TableRelationship r = orderToOrderDetails();
        rels.add(r);
        copy.add(r);
        r = orderDetailsToProducts();
        rels.add(r);
        copy.add(r);
View Full Code Here

        rels.add(orderToOrderDetails());
        rels.add(orderDetailsToProducts());
        rels.add(orderToOrderLog());
        rels.removeTable(orderDetailsTab);
        assertEquals(1, rels.getAllRelationships().size());
        TableRelationship r = rels.getAllRelationships().get(0);
        assertSame(ordersTab, r.getParentObject());
        assertSame(orderLogTab, r.getChildObject());
        rels = new Relations();
        rels.add(orderToOrderDetails());
        rels.add(orderDetailsToProducts());
        rels.add(orderToOrderLog());
        rels.removeTable(ordersTab);
View Full Code Here

    }
   
    @Test
    public void testGetRelation() {
        rels.add(orderToOrderDetails());
        TableRelationship r = rels.getRelation(ordersTab, orderDetailsTab);
        assertSame(ordersTab, r.getParentObject());
        assertSame(orderDetailsTab, r.getChildObject());
        assertNull(rels.getRelation(ordersTab, productsTab));
    }
View Full Code Here

        assertSame(orderDetailsTab, r.getChildObject());
        assertNull(rels.getRelation(ordersTab, productsTab));
    }
   
    private TableRelationship orderToOrderDetails() {
        TableRelationship r = new TableRelationship(ordersTab, orderDetailsTab);
        r.addFieldRelationship(ordersTab.getColumn("OrderId"), orderDetailsTab.getColumn("OrderId"));
        return r;
    }
View Full Code Here

TOP

Related Classes of org.jitterbit.integration.data.structure.database.TableRelationship

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.