Author: mo.jeff
Date: Fri Jun 26 09:10:09 2009
New Revision: 3103

Modified:
   trunk/src/ca/sqlpower/architect/olap/MondrianModel.java
   trunk/src/ca/sqlpower/architect/swingui/olap/CubeEditPanel.java

Log:
Added the ability to save and reload Cubes with their fact table set as Join. To facilitate this, Cube's fact field can support RelationOrJoin so that it can save Joins in it.

Modified: trunk/src/ca/sqlpower/architect/olap/MondrianModel.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/olap/MondrianModel.java     (original)
+++ trunk/src/ca/sqlpower/architect/olap/MondrianModel.java Fri Jun 26 09:10:09 2009
@@ -1035,14 +1035,14 @@
                 this is a Table and the schema name is not
                 present, table name is left unqualified.
              */
-    private Relation /* */ fact;
+    private RelationOrJoin /* */ fact;

-    public Relation /* */ getFact() {
+    public RelationOrJoin /* */ getFact() {
         return fact;
     }

-    public void setFact(Relation /* */ newval) {
-        Relation /* */ oldval = fact;
+    public void setFact(RelationOrJoin /* */ newval) {
+        RelationOrJoin /* */ oldval = fact;
         if (oldval == newval) {
                return;
         }
@@ -1356,9 +1356,8 @@
         } else if (child instanceof NamedSet) {
             addNamedSet((NamedSet) child);

-        } else if (child instanceof Relation) {
-            setFact((Relation) child);
-
+        } else if (child instanceof RelationOrJoin) {
+            setFact((RelationOrJoin) child);
         } else {
             super.addChild(child);
         }

Modified: trunk/src/ca/sqlpower/architect/swingui/olap/CubeEditPanel.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/olap/CubeEditPanel.java (original) +++ trunk/src/ca/sqlpower/architect/swingui/olap/CubeEditPanel.java Fri Jun 26 09:10:09 2009
@@ -216,6 +216,11 @@
if (selectStatements.getText().trim().length() == 0 && !selects.isEmpty()) {
                 selectStatements.append(selects.get(0).getText());
             }
+        } else if (cube.getFact() instanceof Join) {
+            joinRadioButton.doClick();
+            tableRadioButton.setEnabled(false);
+            tableChooser.setEnabled(false);
+            setJoinFact((Join)cube.getFact());
         } else if (tables.isEmpty()) {
             tableChooser.addItem("Database has no tables");
             viewRadioButton.doClick();
@@ -261,6 +266,8 @@
                 sql.setText(selectStatements.getText());
                 view.addSelect(sql);
                 cube.setFact(view);
+            } else if (joinRadioButton.isSelected()) {
+                cube.setFact(joinFact);
             }

             cube.setName(nameField.getText());

Reply via email to