Author: mdryakhlenkov
Date: 2007-07-10 10:46:27 -0400 (Tue, 10 Jul 2007)
New Revision: 2367
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialOrmShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java
Log:
EXIN-366: Adding elements on the diagram by double-click on fields of classes which have
additional information in mapping files
Fixing of bugs with adding elements (bag, set, inner classes).
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-10
12:11:33 UTC (rev 2366)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-10
14:46:27 UTC (rev 2367)
@@ -149,12 +149,9 @@
Table table = (Table)ormElement;
elements.put(table.getSchema() + "." + table.getName(), ormShape);
} else if (ormElement instanceof Property) {
-// ormShape = new OrmShape(ormElement);
SpecialRootClass specialRootClass = new SpecialRootClass((Property)ormElement);
ormShape = new SpecialOrmShape(specialRootClass);
getChildren().add(ormShape);
-// Property property = (Property)ormElement;
-// elements.put(property.getPersistentClass().getEntityName() + "." +
property.getName(), ormShape);
elements.put(specialRootClass.getClassName(), ormShape);
} else if (ormElement instanceof SingleTableSubclass) {
ormShape = new OrmShape(ormElement);
@@ -347,8 +344,10 @@
Shape keyColumnShape = keyTableShape.getChild(col);
if (keyColumnShape != null &&
!isConnectionExist((Shape)(componentShape.getChildren().get(0)), keyColumnShape)) new
Connection((Shape)(componentShape.getChildren().get(0)), keyColumnShape);
}
- } else if (collection.isMap() || collection.isSet()) {
- OrmShape childShape = getOrCreateDatabaseTable(collection.getCollectionTable());
+ } else /*if (collection.isMap() || collection.isSet())*/ {
+ Table table = collection.getCollectionTable();
+ OrmShape childShape = getOrCreateDatabaseTable(table);
+// childShape.getChild(((Shape)componentShape.getChildren().get(0)).getOrmElement());
Shape keyShape =
childShape.getChild((Column)((DependantValue)((Shape)componentShape.getChildren().get(0)).getOrmElement()).getColumnIterator().next());
if(!isConnectionExist((Shape)componentShape.getChildren().get(0), keyShape))
new Connection((Shape)componentShape.getChildren().get(0), keyShape);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java 2007-07-10
12:11:33 UTC (rev 2366)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java 2007-07-10
14:46:27 UTC (rev 2367)
@@ -61,7 +61,9 @@
while (iterator.hasNext()) {
Property field = (Property)iterator.next();
if (!field.isComposite()) {
- if (field.getValue().getType().isEntityType()) {
+ if (field.getValue().isSimpleValue() &&
!((SimpleValue)field.getValue()).isTypeSpecified()) {
+ bodyOrmShape = new Shape(field);
+ } else if (field.getValue().getType().isEntityType()) {
bodyOrmShape = new ExpandeableShape(field);
} else if (field.getValue().getType().isCollectionType()) {
bodyOrmShape = new ComponentShape(field);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialOrmShape.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialOrmShape.java 2007-07-10
12:11:33 UTC (rev 2366)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialOrmShape.java 2007-07-10
14:46:27 UTC (rev 2367)
@@ -35,7 +35,7 @@
parentShape = bodyOrmShape;
}
- Iterator iterator = (rootClass).getPropertyIterator();
+ Iterator iterator = rootClass.getPropertyIterator();
while (iterator.hasNext()) {
Property field = (Property)iterator.next();
if (field.getValue().getType().isEntityType()) {
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java 2007-07-10
12:11:33 UTC (rev 2366)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java 2007-07-10
14:46:27 UTC (rev 2367)
@@ -43,7 +43,10 @@
setClassName(component.getComponentClassName());
PersistentClass ownerClass = component.getOwner();
if (component.getParentProperty() != null) {
- Property property = ownerClass.getProperty(component.getParentProperty());
+ Property property = null;
+ try {
+ property = ownerClass.getProperty(component.getParentProperty());
+ } catch (Exception e) {}
if (property == null &&
ownerClass.getIdentifierProperty().getName().equals(component.getParentProperty())) {
property = ownerClass.getIdentifierProperty();
}
Show replies by date