Revision: 3377
Author: [email protected]
Date: Fri Mar 12 15:01:53 2010
Log: The OLAP objects are now properly annotated and can be persisted to
the server. The OlapRootObject is now a child of the
ArchitectProject to be persisted and properly access other objects in the
tree. One of the tests for the OLAP objects
becoming SPObjects is in place but a more complex test is required for the
MondrianModel to prevent writing all of the
tests by hand.
http://code.google.com/p/power-architect/source/detail?r=3377
Added:
/trunk/regress/ca/sqlpower/architect/olap/OLAPRootObjectTest.java
Modified:
/trunk/regress/ca/sqlpower/architect/util/ArchitectNewValueMaker.java
/trunk/src/ca/sqlpower/architect/ArchitectProject.java
/trunk/src/ca/sqlpower/architect/enterprise/ArchitectSessionPersister.java
/trunk/src/ca/sqlpower/architect/olap/MondrianModel.java
/trunk/src/ca/sqlpower/architect/olap/OLAPObject.java
/trunk/src/ca/sqlpower/architect/olap/OLAPRootObject.java
/trunk/src/ca/sqlpower/architect/olap/OLAPSession.java
/trunk/src/ca/sqlpower/architect/olap/xml-to-java-classes.xsl
/trunk/src/ca/sqlpower/architect/swingui/ArchitectSwingSessionImpl.java
=======================================
--- /dev/null
+++ /trunk/regress/ca/sqlpower/architect/olap/OLAPRootObjectTest.java Fri
Mar 12 15:01:53 2010
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2010, SQL Power Group Inc.
+ *
+ * This file is part of Power*Architect.
+ *
+ * Power*Architect is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Power*Architect is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package ca.sqlpower.architect.olap;
+
+import ca.sqlpower.architect.util.ArchitectNewValueMaker;
+import ca.sqlpower.object.PersistedSPObjectTest;
+import ca.sqlpower.object.SPObject;
+import ca.sqlpower.sql.DataSourceCollection;
+import ca.sqlpower.sql.SPDataSource;
+import ca.sqlpower.testutil.NewValueMaker;
+
+public class OLAPRootObjectTest extends PersistedSPObjectTest {
+
+ private OLAPRootObject rootObject;
+
+ public OLAPRootObjectTest(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ rootObject = new OLAPRootObject();
+ getRootObject().addChild(rootObject, 0);
+ }
+
+ @Override
+ public NewValueMaker createNewValueMaker(SPObject root,
DataSourceCollection<SPDataSource> dsCollection) {
+ return new ArchitectNewValueMaker(root, dsCollection);
+ }
+
+ @Override
+ protected Class<? extends SPObject> getChildClassType() {
+ return OLAPSession.class;
+ }
+
+ @Override
+ public SPObject getSPObjectUnderTest() {
+ return rootObject;
+ }
+
+}
=======================================
--- /trunk/regress/ca/sqlpower/architect/util/ArchitectNewValueMaker.java
Wed Mar 10 08:21:50 2010
+++ /trunk/regress/ca/sqlpower/architect/util/ArchitectNewValueMaker.java
Fri Mar 12 15:01:53 2010
@@ -20,6 +20,9 @@
package ca.sqlpower.architect.util;
import ca.sqlpower.architect.ArchitectProject;
+import ca.sqlpower.architect.olap.OLAPRootObject;
+import ca.sqlpower.architect.olap.OLAPSession;
+import ca.sqlpower.architect.olap.MondrianModel.Schema;
import ca.sqlpower.architect.profile.ColumnProfileResult;
import ca.sqlpower.architect.profile.ColumnValueCount;
import ca.sqlpower.architect.profile.ProfileSettings;
@@ -74,6 +77,12 @@
}
getRootObject().addChild(project, 0);
return project;
+ } else if (valueType == OLAPSession.class) {
+ OLAPSession session = new OLAPSession(new Schema());
+ OLAPRootObject root = new OLAPRootObject();
+ root.addChild(session);
+ getRootObject().addChild(root, 0);
+ return session;
} else {
return super.makeNewValue(valueType, oldVal, propName);
}
=======================================
--- /trunk/src/ca/sqlpower/architect/ArchitectProject.java Wed Mar 10
08:21:50 2010
+++ /trunk/src/ca/sqlpower/architect/ArchitectProject.java Fri Mar 12
15:01:53 2010
@@ -24,6 +24,7 @@
import java.util.Collections;
import java.util.List;
+import ca.sqlpower.architect.olap.OLAPRootObject;
import ca.sqlpower.architect.profile.ProfileManager;
import ca.sqlpower.object.AbstractSPObject;
import ca.sqlpower.object.ObjectDependentException;
@@ -60,7 +61,7 @@
@SuppressWarnings("unchecked")
public static List<Class<? extends SPObject>> allowedChildTypes =
Collections.unmodifiableList(new ArrayList<Class<? extends
SPObject>>(
- Arrays.asList(SQLObjectRoot.class, ProfileManager.class)));
+ Arrays.asList(SQLObjectRoot.class, ProfileManager.class,
OLAPRootObject.class)));
/**
* There is a 1:1 ratio between the session and the project.
@@ -69,6 +70,11 @@
private final SQLObjectRoot rootObject;
private ProfileManager profileManager;
+ /**
+ * This OLAP object contains the OLAP session.
+ */
+ private final OLAPRootObject olapRootObject;
+
/**
* The current integrity watcher on the project.
*/
@@ -80,7 +86,7 @@
* @throws SQLObjectException
*/
public ArchitectProject() throws SQLObjectException {
- this(new SQLObjectRoot());
+ this(new SQLObjectRoot(), new OLAPRootObject());
SQLDatabase targetDatabase = new SQLDatabase();
targetDatabase.setPlayPenDatabase(true);
@@ -96,10 +102,14 @@
* current project.
*/
@Constructor
- public
ArchitectProject(@ConstructorParameter(isProperty=ParameterType.CHILD,
propertyName="rootObject") SQLObjectRoot rootObject)
+ public ArchitectProject(
+ @ConstructorParameter(isProperty=ParameterType.CHILD,
propertyName="rootObject") SQLObjectRoot rootObject,
+ @ConstructorParameter(isProperty=ParameterType.CHILD,
propertyName="olapRootObject") OLAPRootObject olapRootObject)
throws SQLObjectException {
this.rootObject = rootObject;
rootObject.setParent(this);
+ this.olapRootObject = olapRootObject;
+ olapRootObject.setParent(this);
setName("Architect Project");
}
@@ -220,6 +230,8 @@
return 0;
} else if (ProfileManager.class.isAssignableFrom(childType)) {
return 1;
+ } else if (OLAPRootObject.class.isAssignableFrom(childType)) {
+ return 2;
} else {
throw new IllegalArgumentException();
}
@@ -237,6 +249,7 @@
if (profileManager != null) {
allChildren.add(profileManager);
}
+ allChildren.add(olapRootObject);
return allChildren;
}
@@ -248,6 +261,7 @@
public void removeDependency(SPObject dependency) {
rootObject.removeDependency(dependency);
profileManager.removeDependency(dependency);
+ olapRootObject.removeDependency(dependency);
}
protected void addChildImpl(SPObject child, int index) {
@@ -258,4 +272,9 @@
child.getClass() + " to the project once it has been
created.");
}
}
-}
+
+ @Accessor
+ public OLAPRootObject getOlapRootObject() {
+ return olapRootObject;
+ }
+}
=======================================
---
/trunk/src/ca/sqlpower/architect/enterprise/ArchitectSessionPersister.java
Wed Feb 17 08:55:16 2010
+++
/trunk/src/ca/sqlpower/architect/enterprise/ArchitectSessionPersister.java
Fri Mar 12 15:01:53 2010
@@ -23,6 +23,7 @@
import java.util.List;
import ca.sqlpower.architect.ArchitectProject;
+import ca.sqlpower.architect.olap.OLAPRootObject;
import ca.sqlpower.dao.PersistedSPOProperty;
import ca.sqlpower.dao.PersistedSPObject;
import ca.sqlpower.dao.SPSessionPersister;
@@ -53,6 +54,14 @@
architectProject.getRootObject().setUUID(rootObjectUUID);
persistedRootObject.setLoaded(true);
+ String olapRootObjectUUID = (String)
AbstractSPPersisterHelper.findPropertyAndRemove(
+ pso.getUUID(), "olapRootObject", persistedProperties);
+
+ PersistedSPObject persistedOlapRootObject =
AbstractSPPersisterHelper.findPersistedSPObject(
+ pso.getUUID(), OLAPRootObject.class.getName(),
olapRootObjectUUID, persistedObjects);
+ architectProject.getOlapRootObject().setUUID(olapRootObjectUUID);
+ persistedOlapRootObject.setLoaded(true);
+
List<PersistedSPObject> databases = new
ArrayList<PersistedSPObject>();
for (PersistedSPObject o : persistedObjects) {
if
(o.getParentUUID().equals(architectProject.getRootObject().getUUID()) &&
=======================================
--- /trunk/src/ca/sqlpower/architect/olap/MondrianModel.java Fri Mar 12
08:02:18 2010
+++ /trunk/src/ca/sqlpower/architect/olap/MondrianModel.java Fri Mar 12
15:01:53 2010
@@ -7,6 +7,10 @@
import java.util.Collections;
import ca.sqlpower.object.SPObject;
+import ca.sqlpower.object.annotation.Accessor;
+import ca.sqlpower.object.annotation.Mutator;
+import ca.sqlpower.object.annotation.NonProperty;
+import ca.sqlpower.object.annotation.Transient;
/**
@@ -25,6 +29,7 @@
* set to their defaults.
*/
public Schema() {
+ setName("New Schema");
}
/**
@@ -66,10 +71,12 @@
/** Name of this schema */
private String /* */ name;
+ @Accessor
public String /* */ getName() {
return name;
}
+ @Mutator
public void setName(String /* */ newval) {
String /* */ oldval = name;
name = newval;
@@ -82,10 +89,12 @@
*/
private String /* */ measuresCaption;
+ @Accessor
public String /* */ getMeasuresCaption() {
return measuresCaption;
}
+ @Mutator
public void setMeasuresCaption(String /* */ newval) {
String /* */ oldval = measuresCaption;
measuresCaption = newval;
@@ -95,10 +104,12 @@
/** The name of the default role for connections to this schema */
private String /* */ defaultRole;
+ @Accessor
public String /* */ getDefaultRole() {
return defaultRole;
}
+ @Mutator
public void setDefaultRole(String /* */ newval) {
String /* */ oldval = defaultRole;
defaultRole = newval;
@@ -160,6 +171,7 @@
return removedItem;
}
+ @NonProperty
public List<Parameter> getParameters() {
return Collections.unmodifiableList(parameters);
}
@@ -220,6 +232,7 @@
return removedItem;
}
+ @NonProperty
public List<Dimension> getDimensions() {
return Collections.unmodifiableList(dimensions);
}
@@ -280,6 +293,7 @@
return removedItem;
}
+ @NonProperty
public List<Cube> getCubes() {
return Collections.unmodifiableList(cubes);
}
@@ -340,6 +354,7 @@
return removedItem;
}
+ @NonProperty
public List<VirtualCube> getVirtualCubes() {
return Collections.unmodifiableList(virtualCubes);
}
@@ -400,6 +415,7 @@
return removedItem;
}
+ @NonProperty
public List<NamedSet> getNamedSets() {
return Collections.unmodifiableList(namedSets);
}
@@ -460,6 +476,7 @@
return removedItem;
}
+ @NonProperty
public List<Role> getRoles() {
return Collections.unmodifiableList(roles);
}
@@ -520,12 +537,14 @@
return removedItem;
}
+ @NonProperty
public List<UserDefinedFunction> getUserDefinedFunctions() {
return Collections.unmodifiableList(userDefinedFunctions);
}
+ @Transient @Accessor
public List<Class<? extends SPObject>> getAllowedChildTypes() {
return allowedChildTypes;
}
@@ -534,6 +553,8 @@
throw new IllegalStateException("Dependency management has not
been setup for " +
"OLAP objects because they reference each other by name.");
}
+
+ @Transient @Accessor
public List<? extends SPObject> getDependencies() {
throw new IllegalStateException("Dependency management has not
been setup for " +
"OLAP objects because they reference each other by name.");
@@ -555,6 +576,7 @@
}
+ @NonProperty
public List<SPObject> getChildren() {
/* This might be noticeably more efficient if we use a data
structure (ConcatenatedList?) that holds
* each list and implements optimized get() and iterator() methods
instead of just making a new
@@ -624,80 +646,80 @@
} else if (child instanceof Parameter) {
int offset = childPositionOffset(Parameter.class);
- if ((index - offset) < 0 || (index - offset) >
parameters.size()) {
+ if (index < 0 || index > parameters.size()) {
throw new IllegalArgumentException(
"Index out of bounds for this child type. " +
"You gave: " + index +
- ". min= " + offset +
+ ". min= " + 0 +
"; max=" + parameters.size());
}
- addParameter(index - offset, (Parameter) child);
+ addParameter(index, (Parameter) child);
} else if (child instanceof Dimension) {
int offset = childPositionOffset(Dimension.class);
- if ((index - offset) < 0 || (index - offset) >
dimensions.size()) {
+ if (index < 0 || index > dimensions.size()) {
throw new IllegalArgumentException(
"Index out of bounds for this child type. " +
"You gave: " + index +
- ". min= " + offset +
+ ". min= " + 0 +
"; max=" + dimensions.size());
}
- addDimension(index - offset, (Dimension) child);
+ addDimension(index, (Dimension) child);
} else if (child instanceof Cube) {
int offset = childPositionOffset(Cube.class);
- if ((index - offset) < 0 || (index - offset) > cubes.size()) {
+ if (index < 0 || index > cubes.size()) {
throw new IllegalArgumentException(
"Index out of bounds for this child type. " +
"You gave: " + index +
- ". min= " + offset +
+ ". min= " + 0 +
"; max=" + cubes.size());
}
- addCube(index - offset, (Cube) child);
+ addCube(index, (Cube) child);
} else if (child instanceof VirtualCube) {
int offset = childPositionOffset(VirtualCube.class);
- if ((index - offset) < 0 || (index - offset) >
virtualCubes.size()) {
+ if (index < 0 || index > virtualCubes.size()) {
throw new IllegalArgumentException(
"Index out of bounds for this child type. " +
"You gave: " + index +
- ". min= " + offset +
+ ". min= " + 0 +
"; max=" + virtualCubes.size());
}
- addVirtualCube(index - offset, (VirtualCube) child);
+ addVirtualCube(index, (VirtualCube) child);
} else if (child instanceof NamedSet) {
int offset = childPositionOffset(NamedSet.class);
- if ((index - offset) < 0 || (index - offset) >
namedSets.size()) {
+ if (index < 0 || index > namedSets.size()) {
throw new IllegalArgumentException(
"Index out of bounds for this child type. " +
"You gave: " + index +
- ". min= " + offset +
+ ". min= " + 0 +
"; max=" + namedSets.size());
}
- addNamedSet(index - offset, (NamedSet) child);
+ addNamedSet(index, (NamedSet) child);
} else if (child instanceof Role) {
int offset = childPositionOffset(Role.class);
- if ((index - offset) < 0 || (index - offset) > roles.size()) {
+ if (index < 0 || index > roles.size()) {
throw new IllegalArgumentException(
"Index out of bounds for this child type. " +
"You gave: " + index +
- ". min= " + offset +
+ ". min= " + 0 +
"; max=" + roles.size());
}
- addRole(index - offset, (Role) child);
+ addRole(index, (Role) child);
} else if (child instanceof UserDefinedFunction) {
int offset = childPositionOffset(UserDefinedFunction.class);
- if ((index - offset) < 0 || (index - offset) >
userDefinedFunctions.size()) {
+ if (index < 0 || index > userDefinedFunctions.size()) {
throw new IllegalArgumentException(
"Index out of bounds for this child type. " +
"You gave: " + index +
- ". min= " + offset +
+ ". min= " + 0 +
"; max=" + userDefinedFunctions.size());
}
- addUserDefinedFunction(index - offset, (UserDefinedFunction)
child);
+ addUserDefinedFunction(index, (UserDefinedFunction) child);
} else {
super.addChildImpl(child, index);
@@ -750,6 +772,7 @@
* set to their defaults.
*/
public CubeDimension() {
+ setName("New CubeDimension");
}
/**
@@ -771,10 +794,12 @@
/** */
private String /* */ name;
+ @Accessor
public String /* */ getName() {
return name;
}
+ @Mutator
public void setName(String /* */ newval) {
String /* */ oldval = name;
name = newval;
@@ -787,10 +812,12 @@
*/
private String /* */ caption;
+ @Accessor
public String /* */ getCaption() {
return caption;
}
+ @Mutator
public void setCaption(String /* */ newval) {
String /* */ oldval = caption;
caption = newval;
@@ -805,10 +832,12 @@
*/
private String /* */ foreignKey;
+ @Accessor
public String /* */ getForeignKey() {
return foreignKey;
}
+ @Mutator
public void setForeignKey(String /* */ newval) {
String /* */ oldval = foreignKey;
foreignKey = newval;
@@ -839,6 +868,7 @@
}
+ @Transient @Accessor
public List<Class<? extends SPObject>> getAllowedChildTypes() {
return allowedChildTypes;
}
@@ -847,6 +877,8 @@
throw new IllegalStateException("Dependency management has not
been setup for " +
"OLAP objects because they reference each other by name.");
}
+
+ @Transient @Accessor
public List<? extends SPObject> getDependencies() {
throw new IllegalStateException("Dependency management has not
been setup for " +
"OLAP objects because they reference each other by name.");
@@ -859,7 +891,7 @@
public static final List<Class<? extends SPObject>> allowedChildTypes =
Collections.emptyList();
-
+ @NonProperty
public List<SPObject> getChildren() {
return Collections.emptyList();
}
@@ -914,6 +946,7 @@
* set to their defaults.
*/
public Cube() {
+ setName("New Cube");
}
/**
@@ -975,10 +1008,12 @@
*/
private String /* */ name;
+ @Accessor
public String /* */ getName() {
return name;
}
+ @Mutator
public void setName(String /* */ newval) {
String /* */ oldval = name;
name = newval;
@@ -991,10 +1026,12 @@
*/
private String /* */ caption;
+ @Accessor
public String /* */ getCaption() {
return caption;
}
+ @Mutator
public void setCaption(String /* */ newval) {
String /* */ oldval = caption;
caption = newval;
@@ -1007,10 +1044,12 @@
*/
private String /* */ defaultMeasure;
+ @Accessor
public String /* */ getDefaultMeasure() {
return defaultMeasure;
}
+ @Mutator
public void setDefaultMeasure(String /* */ newval) {
String /* */ oldval = defaultMeasure;
defaultMeasure = newval;
@@ -1024,10 +1063,12 @@
*/
private Boolean /* */ cache;
+ @Accessor
public Boolean /* */ getCache() {
return cache;
}
+ @Mutator
public void setCache(Boolean /* */ newval) {
Boolean /* */ oldval = cache;
cache = newval;
@@ -1040,10 +1081,12 @@
*/
private Boolean /* */ enabled;
+ @Accessor
public Boolean /* */ getEnabled() {
return enabled;
}
+ @Mutator
public void setEnabled(Boolean /* */ newval) {
Boolean /* */ oldval = enabled;
enabled = newval;
@@ -1057,10 +1100,12 @@
*/
private Relation /* */ fact;
+ @NonProperty
public Relation /* */ getFact() {
return fact;
}
+ @NonProperty
public void setFact(Relation /* */ newval) {
Relation /* */ oldval = fact;
if (oldval == newval) {
@@ -1124,6 +1169,7 @@
return removedItem;
}
+ @NonProperty
public List<CubeDimension> getDimensions() {
return Collections.unmodifiableList(dimensions);
}
@@ -1178,6 +1224,7 @@
return removedItem;
}
+ @NonProperty
public List<Measure> getMeasures() {
return Collections.unmodifiableList(measures);
}
@@ -1238,6 +1285,7 @@
return removedItem;
}
+ @NonProperty
public List<CalculatedMember> getCalculatedMembers() {
return Collections.unmodifiableList(calculatedMembers);
}
@@ -1298,12 +1346,14 @@
return removedItem;
}
+ @NonProperty
public List<NamedSet> getNamedSets() {
return Collections.unmodifiableList(namedSets);
}
+ @Transient @Accessor
public List<Class<? extends SPObject>> getAllowedChildTypes() {
return allowedChildTypes;
}
@@ -1312,6 +1362,8 @@
throw new IllegalStateException("Dependency management has not
been setup for " +
"OLAP objects because they reference each other by name.");
}
+
+ @Transient @Accessor
public List<? extends SPObject> getDependencies() {
throw new IllegalStateException("Dependency management has not
been setup for " +
"OLAP objects because they reference each other by name.");
@@ -1333,6 +1385,7 @@
}
+ @NonProperty
public List<SPObject> getChildren() {
/* This might be noticeably more efficient if we use a data
structure (ConcatenatedList?) that holds
* each list and implements optimized get() and iterator() methods
instead of just making a new
@@ -1394,47 +1447,47 @@
} else if (child instanceof CubeDimension) {
int offset = childPositionOffset(CubeDimension.class);
- if ((index - offset) < 0 || (index - offset) >
dimensions.size()) {
+ if (index < 0 || index > dimensions.size()) {
throw new IllegalArgumentException(
"Index out of bounds for this child type. " +
"You gave: " + index +
- ". min= " + offset +
+ ". min= " + 0 +
"; max=" + dimensions.size());
}
- addDimension(index - offset, (CubeDimension) child);
+ addDimension(index, (CubeDimension) child);
} else if (child instanceof Measure) {
int offset = childPositionOffset(Measure.class);
- if ((index - offset) < 0 || (index - offset) >
measures.size()) {
+ if (index < 0 || index > measures.size()) {
throw new IllegalArgumentException(
"Index out of bounds for this child type. " +
"You gave: " + index +
- ". min= " + offset +
+ ". min= " + 0 +
"; max=" + measures.size());
}
- addMeasure(index - offset, (Measure) child);
+ addMeasure(index, (Measure) child);
} else if (child instanceof CalculatedMember) {
int offset = childPositionOffset(CalculatedMember.class);
- if ((index - offset) < 0 || (index - offset) >
calculatedMembers.size()) {
+ if (index < 0 || index > calculatedMembers.size()) {
throw new IllegalArgumentException(
"Index out of bounds for this child type. " +
"You gave: " + index +
- ". min= " + offset +
+ ". min= " + 0 +
"; max=" + calculatedMembers.size());
}
- addCalculatedMember(index - offset, (CalculatedMember) child);
+ addCalculatedMember(index, (CalculatedMember) child);
} else if (child instanceof NamedSet) {
int offset = childPositionOffset(NamedSet.class);
- if ((index - offset) < 0 || (index - offset) >
namedSets.size()) {
+ if (index < 0 || index > namedSets.size()) {
throw new IllegalArgumentException(
"Index out of bounds for this child type. " +
"You gave: " + index +
- ". min= " + offset +
+ ". min= " + 0 +
"; max=" + namedSets.size());
}
- addNamedSet(index - offset, (NamedSet) child);
+ addNamedSet(index, (NamedSet) child);
} else if (child instanceof Relation) {
setFact((Relation) child);
@@ -1485,6 +1538,7 @@
* set to their defaults.
*/
public VirtualCube() {
+ setName("New VirtualCube");
}
/**
@@ -1541,10 +1595,12 @@
*/
private Boolean /* */ enabled;
+ @Accessor
public Boolean /* */ getEnabled() {
return enabled;
}
+ @Mutator
public void setEnabled(Boolean /* */ newval) {
Boolean /* */ oldval = enabled;
enabled = newval;
@@ -1554,10 +1610,12 @@
/** */
private String /* */ name;
+ @Accessor
public String /* */ getName() {
return name;
}
+ @Mutator
public void setName(String /* */ newval) {
String /* */ oldval = name;
name = newval;
@@ -1569,10 +1627,12 @@
*/
private String /* */ defaultMeasure;
+ @Accessor
public String /* */ getDefaultMeasure() {
return defaultMeasure;
}
+ @Mutator
public void setDefaultMeasure(String /* */ newval) {
String /* */ oldval = defaultMeasure;
defaultMeasure = newval;
@@ -1585,10 +1645,12 @@
*/
private String /* */ caption;
+ @Accessor
public String /* */ getCaption() {
return caption;
}
+ @Mutator
public void setCaption(String /* */ newval) {
String /* */ oldval = caption;
caption = newval;
@@ -1598,10 +1660,12 @@
/** */
private CubeUsages /* */ cubeUsage;
+ @NonProperty
public CubeUsages /* */ getCubeUsage() {
return cubeUsage;
}
+ @NonProperty
public void setCubeUsage(CubeUsages /* */ newval) {
CubeUsages /* */ oldval = cubeUsage;
if (oldval == newval) {
@@ -1665,6 +1729,7 @@
return removedItem;
}
+ @NonProperty
public List<VirtualCubeDimension> getDimensions() {
return Collections.unmodifiableList(dimensions);
}
@@ -1719,6 +1784,7 @@
return removedItem;
}
+ @NonProperty
public List<VirtualCubeMeasure> getMeasures() {
return Collections.unmodifiableList(measures);
}
@@ -1785,6 +1851,7 @@
return removedItem;
}
+ @NonProperty
public List<CalculatedMember> getCalculatedMembers() {
return Collections.unmodifiableList(calculatedMembers);
}
@@ -1845,12 +1912,14 @@
return removedItem;
}
+ @NonProperty
public List<NamedSet> getNamedSets() {
return Collections.unmodifiableList(namedSets);
}
+ @Transient @Accessor
public List<Class<? extends SPObject>> getAllowedChildTypes() {
return allowedChildTypes;
}
@@ -1859,6 +1928,8 @@
throw new IllegalStateException("Dependency management has not
been setup for " +
"OLAP objects because they reference each other by name.");
}
+
+ @Transient @Accessor
public List<? extends SPObject> getDependencies() {
throw new IllegalStateException("Dependency management has not
been setup for " +
"OLAP objects because they reference each other by name.");
@@ -1880,6 +1951,7 @@
}
+ @NonProperty
public List<SPObject> getChildren() {
/* This might be noticeably more efficient if we use a data
structure (ConcatenatedList?) that holds
* each list and implements optimized get() and iterator() methods
instead of just making a new
@@ -1941,47 +2013,47 @@
} else if (child instanceof VirtualCubeDimension) {
int offset = childPositionOffset(VirtualCubeDimension.class);
- if ((index - offset) < 0 || (index - offset) >
dimensions.size()) {
+ if (index < 0 || index > dimensions.size()) {
throw new IllegalArgumentException(
"Index out of bounds for this child type. " +
"You gave: " + index +
- ". min= " + offset +
+ ". min= " + 0 +
"; max=" + dimensions.size());
}
- addDimension(index - offset, (VirtualCubeDimension) child);
+ addDimension(index, (VirtualCubeDimension) child);
} else if (child instanceof VirtualCubeMeasure) {
int offset = childPositionOffset(VirtualCubeMeasure.class);
- if ((index - offset) < 0 || (index - offset) >
measures.size()) {
+ if (index < 0 || index > measures.size()) {
throw new IllegalArgumentException(
"Index out of bounds for this child type. " +
"You gave: " + index +
- ". min= " + offset +
+ ". min= " + 0 +
"; max=" + measures.size());
}
- addMeasure(index - offset, (VirtualCubeMeasure) child);
+ addMeasure(index, (VirtualCubeMeasure) child);
} else if (child instanceof CalculatedMember) {
int offset = childPositionOffset(CalculatedMember.class);
- if ((index - offset) < 0 || (index - offset) >
calculatedMembers.size()) {
+ if (index < 0 || index > calculatedMembers.size()) {
throw new IllegalArgumentException(
"Index out of bounds for this child type. " +
"You gave: " + index +
- ". min= " + offset +
+ ". min= " + 0 +
"; max=" + calculatedMembers.size());
}
- addCalculatedMember(index - offset, (CalculatedMember) child);
+ addCalculatedMember(index, (CalculatedMember) child);
} else if (child instanceof NamedSet) {
int offset = childPositionOffset(NamedSet.class);
- if ((index - offset) < 0 || (index - offset) >
namedSets.size()) {
+ if (index < 0 || index > namedSets.size()) {
throw new IllegalArgumentException(
"Index out of bounds for this child type. " +
"You gave: " + index +
- ". min= " + offset +
+ ". min= " + 0 +
"; max=" + namedSets.size());
}
- addNamedSet(index - offset, (NamedSet) child);
+ addNamedSet(index, (NamedSet) child);
} else if (child instanceof CubeUsages) {
setCubeUsage((CubeUsages) child);
@@ -2031,6 +2103,7 @@
* set to their defaults.
*/
public CubeUsages() {
+ setName("New CubeUsages");
}
/**
@@ -2100,12 +2173,14 @@
return removedItem;
}
+ @NonProperty
public List<CubeUsage> getCubeUsages() {
return Collections.unmodifiableList(cubeUsages);
}
+ @Transient @Accessor
public List<Class<? extends SPObject>> getAllowedChildTypes() {
return allowedChildTypes;
}
@@ -2114,6 +2189,8 @@
throw new IllegalStateException("Dependency management has not
been setup for " +
"OLAP objects because they reference each other by name.");
}
+
+ @Transient @Accessor
public List<? extends SPObject> getDependencies() {
throw new IllegalStateException("Dependency management has not
been setup for " +
"OLAP objects because they reference each other by name.");
@@ -2135,6 +2212,7 @@
}
+ @NonProperty
public List<SPObject> getChildren() {
/* This might be noticeably more efficient if we use a data
structure (ConcatenatedList?) that holds
* each list and implements optimized get() and iterator() methods
instead of just making a new
@@ -2174,14 +2252,14 @@
} else if (child instanceof CubeUsage) {
int offset = childPositionOffset(CubeUsage.class);
- if ((index - offset) < 0 || (index - offset) >
cubeUsages.size()) {
+ if (index < 0 || index > cubeUsages.size()) {
throw new IllegalArgumentException(
"Index out of bounds for this child type. " +
"You gave: " + index +
- ". min= " + offset +
+ ". min= " + 0 +
"; max=" + cubeUsages.size());
}
- addCubeUsage(index - offset, (CubeUsage) child);
+ addCubeUsage(index, (CubeUsage) child);
} else {
super.addChildImpl(child, index);
@@ -2213,6 +2291,7 @@
* set to their defaults.
*/
public CubeUsage() {
+ setName("New CubeUsage");
}
/**
@@ -2250,10 +2329,12 @@
*/
private String /* */ cubeName;
+ @Accessor
public String /* */ getCubeName() {
return cubeName;
}
+ @Mutator
public void setCubeName(String /* */ newval) {
String /* */ oldval = cubeName;
cubeName = newval;
@@ -2266,10 +2347,12 @@
*/
private Boolean /* */ ignoreUnrelatedDimensions;
+ @Accessor
public Boolean /* */ getIgnoreUnrelatedDimensions() {
return ignoreUnrelatedDimensions;
}
+ @Mutator
public void setIgnoreUnrelatedDimensions(Boolean /* */ newval) {
Boolean /* */ oldval = ignoreUnrelatedDimensions;
ignoreUnrelatedDimensions = newval;
@@ -2277,6 +2360,7 @@
}
+ @Transient @Accessor
public List<Class<? extends SPObject>> getAllowedChildTypes() {
return allowedChildTypes;
}
@@ -2285,6 +2369,8 @@
throw new IllegalStateException("Dependency management has not
been setup for " +
"OLAP objects because they reference each other by name.");
}
+
+ @Transient @Accessor
public List<? extends SPObject> getDependencies() {
throw new IllegalStateException("Dependency management has not
been setup for " +
"OLAP objects because they reference each other by name.");
@@ -2297,7 +2383,7 @@
public static final List<Class<? extends SPObject>> allowedChildTypes =
Collections.emptyList();
-
+ @NonProperty
public List<SPObject> getChildren() {
return Collections.emptyList();
}
@@ -2352,6 +2438,7 @@
* set to their defaults.
*/
public VirtualCubeDimension() {
+ setName("New VirtualCubeDimension");
}
/**
@@ -2394,10 +2481,12 @@
*/
private String /* */ cubeName;
+ @Accessor
public String /* */ getCubeName() {
return cubeName;
}
+ @Mutator
public void setCubeName(String /* */ newval) {
String /* */ oldval = cubeName;
cubeName = newval;
@@ -2409,10 +2498,12 @@
*/
private String /* */ name;
+ @Accessor
public String /* */ getName() {
return name;
}
+ @Mutator
public void setName(String /* */ newval) {
String /* */ oldval = name;
name = newval;
@@ -2420,6 +2511,7 @@
}
+ @Transient @Accessor
public List<Class<? extends SPObject>> getAllowedChildTypes() {
return allowedChildTypes;
}
@@ -2428,6 +2520,8 @@
throw new IllegalStateException("Dependency management has not
been setup for " +
"OLAP objects because they reference each other by name.");
}
+
+ @Transient @Accessor
public List<? extends SPObject> getDependencies() {
throw new IllegalStateException("Dependency management has not
been setup for " +
"OLAP objects because they reference each other by name.");
@@ -2440,7 +2534,7 @@
public static final List<Class<? extends SPObject>> allowedChildTypes =
CubeDimension.allowedChildTypes;
-
+ @NonProperty
public List<SPObject> getChildren() {
return Collections.emptyList();
}
@@ -2495,6 +2589,7 @@
* set to their defaults.
*/
public VirtualCubeMeasure() {
+ setName("New VirtualCubeMeasure");
}
/**
@@ -2538,10 +2633,12 @@
*/
private String /* */ cubeName;
+ @Accessor
public String /* */ getCubeName() {
return cubeName;
}
+ @Mutator
public void setCubeName(String /* */ newval) {
String /* */ oldval = cubeName;
cubeName = newval;
@@ -2553,10 +2650,12 @@
*/
private String /* */ name;
+ @Accessor
public String /* */ getName() {
return name;
}
+ @Mutator
public void setName(String /* */ newval) {
String /* */ oldval = name;
name = newval;
@@ -2569,10 +2668,12 @@
*/
private Boolean /* */ visible;
+ @Accessor
public Boolean /* */ getVisible() {
return visible;
}
+ @Mutator
public void setVisible(Boolean /* */ newval) {
Boolean /* */ oldval = visible;
visible = newval;
@@ -2580,6 +2681,7 @@
}
+ @Transient @Accessor
public List<Class<? extends SPObject>> getAllowedChildTypes() {
return allowedChildTypes;
}
@@ -2588,6 +2690,8 @@
throw new IllegalStateException("Dependency management has not
been setup for " +
"OLAP objects because they reference each other by name.");
}
+
+ @Transient @Accessor
public List<? extends SPObject> getDependencies() {
throw new IllegalStateException("Dependency management has not
been setup for " +
"OLAP objects because they reference each other by name.");
@@ -2600,7 +2704,7 @@
public static final List<Class<? extends SPObject>> allowedChildTypes =
Collections.emptyList();
-
+ @NonProperty
public List<SPObject> getChildren() {
return Collections.emptyList();
}
@@ -2656,6 +2760,7 @@
* set to their defaults.
*/
public DimensionUsage() {
+ setName("New DimensionUsage");
}
/**
@@ -2702,10 +2807,12 @@
this schema. Case-sensitive. */
private String /* */ source;
+ @Accessor
public String /* */ getSource() {
return source;
}
+ @Mutator
public void setSource(String /* */ newval) {
String /* */ oldval = source;
source = newval;
@@ -2718,10 +2825,12 @@
*/
private String /* */ level;
+ @Accessor
public String /* */ getLevel() {
return level;
}
+ @Mutator
public void setLevel(String /* */ newval) {
String /* */ oldval = level;
level = newval;
@@ -2737,10 +2846,12 @@
*/
private String /* */ usagePrefix;
+ @Accessor
public String /* */ getUsagePrefix() {
return usagePrefix;
}
+ @Mutator
***The diff for this file has been truncated for email.***
=======================================
--- /trunk/src/ca/sqlpower/architect/olap/OLAPObject.java Fri Mar 12
08:02:18 2010
+++ /trunk/src/ca/sqlpower/architect/olap/OLAPObject.java Fri Mar 12
15:01:53 2010
@@ -47,8 +47,7 @@
}
public void addChild(SPObject child) {
- addChild(child, childPositionOffset(child.getClass()) +
- getChildren(child.getClass()).size());
+ addChild(child, getChildren(child.getClass()).size());
}
protected OLAPObject(OLAPObject original) {
=======================================
--- /trunk/src/ca/sqlpower/architect/olap/OLAPRootObject.java Fri Mar 12
08:43:04 2010
+++ /trunk/src/ca/sqlpower/architect/olap/OLAPRootObject.java Fri Mar 12
15:01:53 2010
@@ -25,6 +25,9 @@
import java.util.List;
import ca.sqlpower.object.SPObject;
+import ca.sqlpower.object.annotation.Accessor;
+import ca.sqlpower.object.annotation.NonProperty;
+import ca.sqlpower.object.annotation.Transient;
/**
* The top of the OLAP business model. This root object contains
OLAPSessions, each
@@ -44,6 +47,7 @@
private final List<OLAPSession> olapSessions = new
ArrayList<OLAPSession>();
public OLAPRootObject() {
+ setName("OLAP Root Object");
}
@Override
@@ -97,6 +101,7 @@
return true;
}
+ @NonProperty
public List<OLAPSession> getChildren() {
return Collections.unmodifiableList(olapSessions);
}
@@ -110,10 +115,12 @@
}
}
+ @Transient @Accessor
public List<Class<? extends SPObject>> getAllowedChildTypes() {
return allowedChildTypes;
}
+ @Transient @Accessor
public List<? extends SPObject> getDependencies() {
return Collections.emptyList();
}
=======================================
--- /trunk/src/ca/sqlpower/architect/olap/OLAPSession.java Fri Mar 12
08:43:04 2010
+++ /trunk/src/ca/sqlpower/architect/olap/OLAPSession.java Fri Mar 12
15:01:53 2010
@@ -75,6 +75,7 @@
@Constructor
public OLAPSession(
@ConstructorParameter(isProperty=ParameterType.CHILD,
propertyName="schema") Schema schema) {
+ setName("New Session");
if (schema.getParent() != null) {
throw new IllegalStateException(
"The given schema already belongs to an OLAP Session");
@@ -113,7 +114,9 @@
*/
@Mutator
public void setDatabase(SQLDatabase database) {
+ SQLDatabase oldDB = this.database;
this.database = database;
+ firePropertyChange("database", oldDB, database);
}
/**
=======================================
--- /trunk/src/ca/sqlpower/architect/olap/xml-to-java-classes.xsl Fri Mar
12 08:02:18 2010
+++ /trunk/src/ca/sqlpower/architect/olap/xml-to-java-classes.xsl Fri Mar
12 15:01:53 2010
@@ -26,6 +26,10 @@
import java.util.Collections;
import ca.sqlpower.object.SPObject;
+import ca.sqlpower.object.annotation.Accessor;
+import ca.sqlpower.object.annotation.Mutator;
+import ca.sqlpower.object.annotation.NonProperty;
+import ca.sqlpower.object.annotation.Transient;
/**
@@ -51,6 +55,7 @@
* set to their defaults.
*/
public <xsl:value-of select="@type"/>() {
+ setName("New <xsl:value-of select="@type"/>");
}
/**
@@ -113,6 +118,7 @@
* set to their defaults.
*/
public <xsl:value-of select="@class"/>() {
+ setName("New <xsl:value-of select="@class"/>");
}
/**
@@ -169,10 +175,12 @@
/** <xsl:copy-of select="Doc"/> */
private <xsl:call-template name="attribute-type"/> /* */ <xsl:value-of
select="@name"/>;
+ @Accessor
public <xsl:call-template name="attribute-type"/> /* */
get<xsl:call-template name="name-initcap"/>() {
return <xsl:value-of select="@name"/>;
}
+ @Mutator
public void set<xsl:call-template
name="name-initcap"/>(<xsl:call-template name="attribute-type"/> /* */
newval) {
<xsl:call-template name="attribute-type"/> /* */ oldval =
<xsl:value-of select="@name"/>;
<xsl:value-of select="@name"/> = newval;
@@ -189,10 +197,12 @@
/** <xsl:copy-of select="Doc"/> */
private <xsl:call-template name="attribute-type"/> /* */ <xsl:value-of
select="@name"/>;
+ @NonProperty
public <xsl:call-template name="attribute-type"/> /* */
get<xsl:call-template name="name-initcap"/>() {
return <xsl:value-of select="@name"/>;
}
+ @NonProperty
public void set<xsl:call-template
name="name-initcap"/>(<xsl:call-template name="attribute-type"/> /* */
newval) {
<xsl:call-template name="attribute-type"/> /* */ oldval =
<xsl:value-of select="@name"/>;
if (oldval == newval) {
@@ -213,10 +223,12 @@
<xsl:template match="CData">
private String text;
+ @Accessor
public String getText() {
return text;
}
+ @Mutator
public void setText(String newval) {
String oldval = text;
text = newval;
@@ -283,6 +295,7 @@
return removedItem;
}
+ @NonProperty
public List<<xsl:value-of select="@type"/>>
get<xsl:call-template name="name-initcap"/>() {
return Collections.unmodifiableList(<xsl:value-of
select="@name"/>);
}
@@ -291,6 +304,7 @@
<xsl:template name="children-methods">
+ @Transient @Accessor
public List<Class<? extends SPObject>>
getAllowedChildTypes() {
return allowedChildTypes;
}
@@ -299,6 +313,8 @@
throw new IllegalStateException("Dependency management has not
been setup for " +
"OLAP objects because they reference each other by name.");
}
+
+ @Transient @Accessor
public List<? extends SPObject> getDependencies() {
throw new IllegalStateException("Dependency management has not
been setup for " +
"OLAP objects because they reference each other by name.");
@@ -332,6 +348,7 @@
}
+ @NonProperty
public List<SPObject> getChildren() {
/* This might be noticeably more efficient if we use a data
structure (ConcatenatedList?) that holds
* each list and implements optimized get() and iterator() methods
instead of just making a new
@@ -384,7 +401,7 @@
<xsl:otherwise>Collections.emptyList();</xsl:otherwise>
</xsl:choose>
-
+ @NonProperty
public List<SPObject> getChildren() {
return Collections.emptyList();
}
@@ -427,14 +444,14 @@
<xsl:for-each select="Array">
} else if (child instanceof <xsl:value-of select="@type"/>) {
int offset = childPositionOffset(<xsl:value-of
select="@type"/>.class);
- if ((index - offset) < 0 || (index - offset) >
<xsl:value-of select="@name"/>.size()) {
+ if (index < 0 || index > <xsl:value-of
select="@name"/>.size()) {
throw new IllegalArgumentException(
"Index out of bounds for this child type. " +
"You gave: " + index +
- ". min= " + offset +
+ ". min= " + 0 +
"; max=" + <xsl:value-of select="@name"/>.size());
}
- add<xsl:call-template name="name-initcap-nonplural"/>(index -
offset, (<xsl:value-of select="@type"/>) child);
+ add<xsl:call-template name="name-initcap-nonplural"/>(index,
(<xsl:value-of select="@type"/>) child);
</xsl:for-each>
<xsl:for-each select="Object">
} else if (child instanceof <xsl:value-of select="@type"/>) {
=======================================
--- /trunk/src/ca/sqlpower/architect/swingui/ArchitectSwingSessionImpl.java
Fri Mar 12 08:43:04 2010
+++ /trunk/src/ca/sqlpower/architect/swingui/ArchitectSwingSessionImpl.java
Fri Mar 12 15:01:53 2010
@@ -107,11 +107,6 @@
*/
private final ArchitectSession delegateSession;
- /**
- * This OLAP object contains the OLAP session.
- */
- private OLAPRootObject olapRootObject;
-
/**
* The Frame where the main part of the GUI for this session appears.
*/
@@ -262,7 +257,6 @@
this.context = context;
this.delegateSession = delegateSession;
delegateSession.getWorkspace().setSession(this);
- this.olapRootObject = new OLAPRootObject();
ProfileManagerImpl profileManager = new ProfileManagerImpl();
((ArchitectSessionImpl)delegateSession).setProfileManager(profileManager);
((ArchitectSessionImpl)delegateSession).setUserPrompterFactory(this);
@@ -918,7 +912,7 @@
}
public OLAPRootObject getOLAPRootObject() {
- return olapRootObject;
+ return getWorkspace().getOlapRootObject();
}
/**