tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fra...@apache.org
Subject svn commit: r545271 - /incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java
Date Thu, 07 Jun 2007 19:12:13 GMT
Author: frankb
Date: Thu Jun  7 12:12:13 2007
New Revision: 545271

URL: http://svn.apache.org/viewvc?view=rev&rev=545271
Log:
Minor cleanup - replace some calls to deprecated methos

Modified:
    incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java

Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java?view=diff&rev=545271&r1=545270&r2=545271
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java
(original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java
Thu Jun  7 12:12:13 2007
@@ -30,7 +30,7 @@
 import org.apache.tuscany.sdo.model.internal.InternalFactory;
 import org.apache.tuscany.sdo.model.java.JavaFactory;
 import org.apache.tuscany.sdo.model.xml.XMLFactory;
-import org.apache.tuscany.sdo.util.SDOUtil;
+import org.apache.tuscany.sdo.api.SDOUtil;
 import org.eclipse.emf.ecore.EClass;
 import org.eclipse.emf.ecore.EClassifier;
 import org.eclipse.emf.ecore.EPackage;
@@ -156,7 +156,7 @@
     Type definedType = SDOUtil.createType(this, modeledType.getUri(), modeledType.getName(),
isDataType);  
     if (definedType == null)
     {
-      // If type already defined, return the existing Type.
+      // If type already defined, return existing Type.
       return getType(modeledType.getUri(), modeledType.getName());
     }
     
@@ -198,15 +198,35 @@
         {
           propertyName = propertyName.substring(0, 1).toLowerCase() + propertyName.substring(1);
         }
-        Property globalProperty = SDOUtil.createGlobalProperty(this, definedType.getURI(),
propertyName, definedType);
+        Property globalProperty = SDOUtil.createOpenContentProperty(this, definedType.getURI(),
propertyName, definedType);
         SDOUtil.setContainment(globalProperty, true);
       }
     } // if (!isDataType)
     
-    SDOUtil.addTypeInstanceProperties(definedType, (DataObject)modeledType);
+    addTypeInstanceProperties(definedType, (DataObject)modeledType);
 
     return definedType;
   }
+  
+  protected void addTypeInstanceProperties(Type definedType, DataObject modeledType)
+  {
+    List instanceProperties = SDOUtil.getOpenContentProperties(modeledType);
+    for (Iterator iter = instanceProperties.iterator(); iter.hasNext(); )
+    {
+      Property property = (Property)iter.next();
+      SDOUtil.addTypeInstanceProperty(definedType, property, modeledType.get(property));
+    }
+  }
+  
+  protected void addPropertyInstanceProperties(Property definedProperty, DataObject modeledProperty)
+  {
+    List instanceProperties = SDOUtil.getOpenContentProperties(modeledProperty);
+    for (Iterator iter = instanceProperties.iterator(); iter.hasNext(); )
+    {
+      Property property = (Property)iter.next();
+      SDOUtil.addPropertyInstanceProperty(definedProperty, property, modeledProperty.get(property));
+    }
+  }
 
   public List /* Type */define(List /* DataObject */types)
   {
@@ -274,7 +294,7 @@
         SDOUtil.setOpposite(newProperty, getDefinedProperty(modeledProperty.getOpposite_()));
       }
     }
-    SDOUtil.addPropertyInstanceProperties(newProperty, (DataObject)modeledProperty);
+    addPropertyInstanceProperties(newProperty, (DataObject)modeledProperty);
   }
   
   public static final String TUSCANY_NO_URI="http://tuscany-no-uri";
@@ -289,7 +309,7 @@
 
     if (uri == null) uri = TUSCANY_NO_URI;
 
-    Property newProperty = SDOUtil.createGlobalProperty(this, uri, modeledProperty.getName(),
propertyType);
+    Property newProperty = SDOUtil.createOpenContentProperty(this, uri, modeledProperty.getName(),
propertyType);
    
     // Propagate the modeled property's attributes
     initializeProperty(newProperty, modeledProperty);



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message