db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r538376 - /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/ObjectReferenceDescriptor.java
Date Tue, 15 May 2007 23:15:52 GMT
Author: arminw
Date: Tue May 15 16:15:51 2007
New Revision: 538376

URL: http://svn.apache.org/viewvc?view=rev&rev=538376
Log:
add support for new cascade type, optimize source

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/ObjectReferenceDescriptor.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/ObjectReferenceDescriptor.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/ObjectReferenceDescriptor.java?view=diff&rev=538376&r1=538375&r2=538376
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/ObjectReferenceDescriptor.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/ObjectReferenceDescriptor.java
Tue May 15 16:15:51 2007
@@ -44,6 +44,7 @@
     public static final int CASCADE_NONE = 17;
     public static final int CASCADE_LINK = 19;
     public static final int CASCADE_OBJECT = 23;
+    public static final int CASCADE_CREATE = 27;
 
     private Class m_ClassOfItems = null;
     private ClassDescriptor m_ClassDescriptorOfItems;
@@ -109,8 +110,7 @@
         if (fkFieldDescriptors == null)
         {
             List fkFields = getForeignKeyFields();
-            FieldDescriptor pkFields[] = targetCld.getPkFields();
-            
+
             // get FieldDescriptor for each index from Class-descriptor
             // In a many-to-many relationship Fk-Fields vector will be null.
             if (fkFields != null)
@@ -120,6 +120,7 @@
                     //exchange interface class descriptor with first concrete class
                     targetCld = targetCld.getRepository().findFirstConcreteClass(targetCld);
                 }
+                FieldDescriptor pkFields[] = targetCld.getPkFields();
                 List ret = new ArrayList();
 
                 for (int i = 0; i < fkFields.size(); i++)
@@ -533,6 +534,10 @@
         {
             return CASCADE_OBJECT;
         }
+        else if(cascade.equalsIgnoreCase(RepositoryTags.CASCADE_CREATE_STR))
+        {
+            return CASCADE_CREATE;
+        }
         else if(cascade.equalsIgnoreCase("true"))
         {
             return CASCADE_OBJECT;
@@ -600,9 +605,22 @@
             case CASCADE_OBJECT:
                 result = RepositoryTags.CASCADE_OBJECT_STR;
                 break;
+            case CASCADE_CREATE:
+                result = RepositoryTags.CASCADE_CREATE_STR;
+                break;
         }
         return result;
     }
+
+    public boolean isCascadingStoreNone(){return getCascadingStore() == CASCADE_NONE;}
+    public boolean isCascadingStoreLink(){return getCascadingStore() == CASCADE_LINK;}
+    public boolean isCascadingStoreCreate(){return getCascadingStore() == CASCADE_CREATE;}
+    public boolean isCascadingStoreObject(){return getCascadingStore() == CASCADE_OBJECT;}
+
+    public boolean isCascadingDeleteNone(){return getCascadingDelete() == CASCADE_NONE;}
+    public boolean isCascadingDeleteLink(){return getCascadingDelete() == CASCADE_LINK;}
+    public boolean isCascadingDeleteObject(){return getCascadingDelete() == CASCADE_OBJECT;}
+
 
     public int getProxyPrefetchingLimit()
     {



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message