click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadr...@apache.org
Subject svn commit: r956049 - /click/trunk/click/extras/src/org/apache/click/extras/cayenne/CayenneForm.java
Date Fri, 18 Jun 2010 17:00:15 GMT
Author: aadrian
Date: Fri Jun 18 17:00:15 2010
New Revision: 956049

URL: http://svn.apache.org/viewvc?rev=956049&view=rev
Log:
use non-deprecated Cayenne API, to be able to easily update to Cayenne 3.1 too.

Modified:
    click/trunk/click/extras/src/org/apache/click/extras/cayenne/CayenneForm.java

Modified: click/trunk/click/extras/src/org/apache/click/extras/cayenne/CayenneForm.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/cayenne/CayenneForm.java?rev=956049&r1=956048&r2=956049&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/cayenne/CayenneForm.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/cayenne/CayenneForm.java Fri Jun
18 17:00:15 2010
@@ -19,9 +19,9 @@
 package org.apache.click.extras.cayenne;
 
 import java.math.BigDecimal;
-import java.util.Iterator;
 import java.util.List;
 
+import org.apache.cayenne.BaseContext;
 import org.apache.click.control.Checkbox;
 import org.apache.click.control.Field;
 import org.apache.click.control.Form;
@@ -276,7 +276,7 @@ public class CayenneForm extends Form {
      * @return the thread local <tt>DataContext</tt>
      */
     public DataContext getDataContext() {
-        return DataContext.getThreadDataContext();
+        return (DataContext) BaseContext.getThreadObjectContext();
     }
 
     /**
@@ -303,22 +303,22 @@ public class CayenneForm extends Form {
 
         if (StringUtils.isNotBlank(classField.getValue())) {
             try {
-                Class dataClass = getDataObjectClass();
+                Class<? extends DataObject> dataClass = getDataObjectClass();
 
                 String id = oidField.getValue();
                 if (StringUtils.isNotBlank(id)) {
 
-                    dataObject = (DataObject)
+                    dataObject = 
                         CayenneUtils.getObjectForPK(getDataContext(),
                                                     dataClass,
                                                     id);
 
                 } else {
                     if (copyTo) {
-                        dataObject = getDataContext().createAndRegisterNewObject(dataClass);
+                        dataObject = getDataContext().newObject(dataClass);
 
                     } else {
-                        dataObject = (DataObject) dataClass.newInstance();
+                        dataObject = dataClass.newInstance();
                     }
                 }
 
@@ -398,7 +398,7 @@ public class CayenneForm extends Form {
      *
      * @return the Class of the form <tt>DataObject</tt>.
      */
-    public Class getDataObjectClass() {
+    public Class<? extends DataObject> getDataObjectClass() {
         String className = null;
         if (classField.getValueObject() != null) {
             className = classField.getValue();



Mime
View raw message