empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1158232 - in /incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample: db/ db/records/ web/ web/actions/ web/actiontypes/
Date Tue, 16 Aug 2011 12:27:57 GMT
Author: doebele
Date: Tue Aug 16 12:27:56 2011
New Revision: 1158232

URL: http://svn.apache.org/viewvc?rev=1158232&view=rev
Log:
EMPIREDB-99
struts2-example

Added:
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleErrors.java
  (with props)
Modified:
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/db/SampleDB.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/db/SampleTable.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/db/records/EmployeeRecord.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleApplication.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleConfig.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleSession.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeDetailAction.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeListAction.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actions/LoginAction.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/BeanDetailAction.java

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/db/SampleDB.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/db/SampleDB.java?rev=1158232&r1=1158231&r2=1158232&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/db/SampleDB.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/db/SampleDB.java
Tue Aug 16 12:27:56 2011
@@ -19,8 +19,8 @@
 package org.apache.empire.struts2.websample.db;
 
 import org.apache.empire.commons.Options;
-import org.apache.empire.data.DataType;
 import org.apache.empire.data.DataMode;
+import org.apache.empire.data.DataType;
 import org.apache.empire.db.DBColumn;
 import org.apache.empire.db.DBDatabase;
 import org.apache.empire.db.DBTableColumn;
@@ -42,6 +42,8 @@ public class SampleDB extends DBDatabase
      */
     public static class Departments extends SampleTable
     {
+        private static final long serialVersionUID = 1L;
+        
         public final DBTableColumn C_DEPARTMENT_ID;
         public final DBTableColumn C_NAME;
         public final DBTableColumn C_HEAD;
@@ -73,6 +75,8 @@ public class SampleDB extends DBDatabase
      */
     public static class Employees extends SampleTable
     {
+        private static final long serialVersionUID = 1L;
+        
         public final DBTableColumn C_EMPLOYEE_ID;
         public final DBTableColumn C_SALUTATION;
         public final DBTableColumn C_FIRSTNAME;

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/db/SampleTable.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/db/SampleTable.java?rev=1158232&r1=1158231&r2=1158232&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/db/SampleTable.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/db/SampleTable.java
Tue Aug 16 12:27:56 2011
@@ -40,7 +40,7 @@ public class SampleTable extends DBTable
     }
 
     @Override
-    protected boolean addColumn(DBTableColumn column)
+    protected void addColumn(DBTableColumn column)
     {
         // Set Translation Title
         String col = column.getBeanPropertyName();  
@@ -53,6 +53,6 @@ public class SampleTable extends DBTable
         column.setControlType((type==DataType.BOOL) ? "checkbox" : "text");
 
         // Add Column
-        return super.addColumn(column);
+        super.addColumn(column);
     }
 }

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/db/records/EmployeeRecord.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/db/records/EmployeeRecord.java?rev=1158232&r1=1158231&r2=1158232&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/db/records/EmployeeRecord.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/db/records/EmployeeRecord.java
Tue Aug 16 12:27:56 2011
@@ -45,10 +45,7 @@ public class EmployeeRecord extends Samp
     {
         DepartmentRecord rec = new DepartmentRecord(context);
         SampleDB.Departments table = SampleDB.getInstance().T_DEPARTMENTS;
-        if (!rec.read(table, this.getInt(T.C_DEPARTMENT_ID), context.getConnection())) {
-            log.error("Unable to get department record. Message is " + rec.getErrorMessage());
-            return null;
-        }
+        rec.read(table, this.getInt(T.C_DEPARTMENT_ID), context.getConnection());
         return rec; 
     }
     

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleApplication.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleApplication.java?rev=1158232&r1=1158231&r2=1158232&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleApplication.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleApplication.java
Tue Aug 16 12:27:56 2011
@@ -31,6 +31,7 @@ import org.apache.empire.db.DBSQLScript;
 import org.apache.empire.db.hsql.DBDatabaseDriverHSql;
 import org.apache.empire.db.mysql.DBDatabaseDriverMySQL;
 import org.apache.empire.db.oracle.DBDatabaseDriverOracle;
+import org.apache.empire.db.postgresql.DBDatabaseDriverPostgreSQL;
 import org.apache.empire.db.sqlserver.DBDatabaseDriverMSSQL;
 import org.apache.empire.struts2.actionsupport.TextProviderActionSupport;
 import org.apache.empire.struts2.html.HtmlTagDictionary;
@@ -86,14 +87,33 @@ public class SampleApplication implement
 			log.info("*** create DBDatabaseDriverOracle() ***");
 			DBDatabaseDriver driver = getDatabaseDriver(config.getDatabaseProvider());
 
-			// Open Database (and create if not existing)
-			log.info("*** open database ***");
-			if (!db.open(driver, conn) || !databaseExists(conn)) {
-				// STEP 4: Create Database
-				log.info("*** create Database ***");
-				createSampleDatabase(driver, conn);
-			}
-
+            // Open Database (and create if not existing)
+            log.info("*** open database ***");
+            try {
+                // Open the database
+                db.open(driver, conn);
+                // Check whether database exists
+                databaseExists(conn);
+                System.out.println("*** Database already exists. Skipping Step4 ***");
+                
+            } catch(Exception e) {
+                // STEP 4: Create Database
+                log.info("*** create Database ***");
+                // postgre does not support DDL in transaction
+                if(db.getDriver() instanceof DBDatabaseDriverPostgreSQL)
+                {
+                    conn.setAutoCommit(true);
+                }
+                createSampleDatabase(driver, conn);
+                if(db.getDriver() instanceof DBDatabaseDriverPostgreSQL)
+                {
+                    conn.setAutoCommit(false);
+                }
+                // Open again
+                if (db.isOpen()==false)
+                    db.open(driver, conn);
+            }
+			
 			/*
 			// Check Database Definition against Real Database(log differences)
 			log.info("*** driver.checkDatabase() ***");
@@ -191,11 +211,11 @@ public class SampleApplication implement
         }
     }
 
-	private boolean databaseExists(Connection conn) {
+	private void databaseExists(Connection conn) {
 		// Check wether DB exists
 		DBCommand cmd = db.createCommand();
 		cmd.select(db.T_DEPARTMENTS.count());
-		return (db.querySingleInt(cmd.getSelect(), -1, conn) >= 0);
+		db.querySingleInt(cmd.getSelect(), -1, conn);
 	}
 	
 	/*
@@ -215,10 +235,8 @@ public class SampleApplication implement
         script.run(driver, conn, false);
         db.commit(conn);
         // Open again
-        if (!db.isOpen() && !db.open(driver, conn))
-        {
-            throw new RuntimeException(driver.getErrorMessage());
-        }
+        if (db.isOpen()==false)
+            db.open(driver, conn);
 		// Insert Sample Departments
 		int idDevDep = insertDepartmentSampleRecord(conn, "Development", "ITTK");
 		int idSalDep = insertDepartmentSampleRecord(conn, "Sales", "ITTK");
@@ -239,10 +257,7 @@ public class SampleApplication implement
 			rec.create(db.T_DEPARTMENTS);
 			rec.setValue(db.T_DEPARTMENTS.C_NAME, department_name);
 			rec.setValue(db.T_DEPARTMENTS.C_BUSINESS_UNIT, businessUnit);
-			if (!rec.update(conn)) {
-				log.error(rec.getErrorMessage());
-				return 0;
-			}
+			rec.update(conn);
 			// Return Department ID
 			return rec.getInt(db.T_DEPARTMENTS.C_DEPARTMENT_ID);
 		}
@@ -259,10 +274,7 @@ public class SampleApplication implement
 		rec.setValue(db.T_EMPLOYEES.C_LASTNAME, lastName);
 		rec.setValue(db.T_EMPLOYEES.C_GENDER, gender);
 		rec.setValue(db.T_EMPLOYEES.C_DEPARTMENT_ID, depID);
-		if (!rec.update(conn)) {
-			log.error(rec.getErrorMessage());
-			return 0; 
-		}
+		rec.update(conn);
 		// Return Employee ID
 		return rec.getInt(db.T_EMPLOYEES.C_EMPLOYEE_ID);
 	}

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleConfig.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleConfig.java?rev=1158232&r1=1158231&r2=1158232&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleConfig.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleConfig.java
Tue Aug 16 12:27:56 2011
@@ -41,15 +41,13 @@ public class SampleConfig extends XMLCon
 	 * 
 	 * @return true on success 
 	 */
-	public boolean init(String filename) {
+	public void init(String filename) {
 		// Read the properties file
-		if (super.init(filename, false) == false)
-			return false;
+		super.init(filename, false);
 		// Done
-		if (readProperties(this, "properties")==false)
-			return false;
+		readProperties(this, "properties");
 		// Reader Provider Properties
-		return readProperties(this, "properties-" + databaseProvider);
+		readProperties(this, "properties-" + databaseProvider);
 	}
 
 	public String getDatabaseProvider() {

Added: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleErrors.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleErrors.java?rev=1158232&view=auto
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleErrors.java
(added)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleErrors.java
Tue Aug 16 12:27:56 2011
@@ -0,0 +1,11 @@
+/*
+ * ESTEAM Software GmbH, 16.08.2011
+ */
+package org.apache.empire.struts2.websample.web;
+
+import org.apache.empire.commons.ErrorType;
+
+public class SampleErrors
+{
+    public static final ErrorType InvalidPassword = new ErrorType("error.invalidpassword",
"Invalid Password.");
+}

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleErrors.java
------------------------------------------------------------------------------
    eol-style = native

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleErrors.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleSession.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleSession.java?rev=1158232&r1=1158231&r2=1158232&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleSession.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/SampleSession.java
Tue Aug 16 12:27:56 2011
@@ -67,7 +67,7 @@ public class SampleSession implements We
         return objectMap.get(name);
     }
     
-    public final Object getObject(Class objclass)
+    public final Object getObject(Class<?> objclass)
     {
         return getObject(objclass.getName());
     }
@@ -77,7 +77,7 @@ public class SampleSession implements We
         return objectMap.put(name, obj);
     }
     
-    public final Object setObject(Class objclass, Object obj)
+    public final Object setObject(Class<?> objclass, Object obj)
     {
         return setObject(objclass.getName(), obj);
     }

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeDetailAction.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeDetailAction.java?rev=1158232&r1=1158231&r2=1158232&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeDetailAction.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeDetailAction.java
Tue Aug 16 12:27:56 2011
@@ -32,7 +32,7 @@ import org.apache.struts2.interceptor.No
  * This class provides form processing functions for an Employee record.<br>
  * The class uses a RecordActionSupport object which does most of the work.<br>
  * For multi-record forms it is possible to have several RecordActionSupport members.<br>
- * In this case each must be given a differnt property name however (see RecordActionSupport
overloads).
+ * In this case each must be given a different property name however (see RecordActionSupport
overloads).
  * </p>
  */
 public class EmployeeDetailAction extends DetailAction
@@ -67,7 +67,6 @@ public class EmployeeDetailAction extend
     public String doCreate() {
         // Create Record
         if (!recordSupport.createRecord()) {
-            setActionError(recordSupport);
             return RETURN;
         }
         // Done
@@ -78,7 +77,6 @@ public class EmployeeDetailAction extend
     public String doLoad() {
         // Load Record
         if (!recordSupport.loadRecord()) {
-            setActionError(recordSupport);
             return RETURN;
         }
         // Set Edit Mode
@@ -89,13 +87,10 @@ public class EmployeeDetailAction extend
     public String doSave() {
         // Load Form Data into record
         if (!recordSupport.loadFormData()) {
-            if (recordSupport.hasError())
-                setActionError(recordSupport);
             return INPUT;
         }
         // Now save the record
         if (!recordSupport.saveChanges()) {
-            setActionError(recordSupport);
             return INPUT;
         }
         // Erfolg
@@ -106,7 +101,6 @@ public class EmployeeDetailAction extend
     public String doDelete() {
         // Delete Record
         if (!recordSupport.deleteRecord()) {
-            setActionError(recordSupport);
             return INPUT;
         }
         // Erfolg

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeListAction.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeListAction.java?rev=1158232&r1=1158231&r2=1158232&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeListAction.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeListAction.java
Tue Aug 16 12:27:56 2011
@@ -238,10 +238,10 @@ public class EmployeeListAction extends 
         SearchInfo si = getSearchInfo();
         if (si.getDepartmentId()!=null)
             cmd.where(EMP.C_DEPARTMENT_ID.is(si.getDepartmentId()));
-        if (StringUtils.isValid( si.getFirstName()) )
+        if (StringUtils.isNotEmpty( si.getFirstName()) )
             cmd.where(EMP.C_FIRSTNAME.likeUpper( si.getFirstName()+"%" )
                   .or(EMP.C_FIRSTNAME.is(null)));
-        if (StringUtils.isValid( si.getLastName()) )
+        if (StringUtils.isNotEmpty( si.getLastName()) )
             cmd.where(EMP.C_LASTNAME.likeUpper( si.getLastName()+"%" ));
         
         cmd.orderBy(EMP.C_LASTNAME);
@@ -249,8 +249,7 @@ public class EmployeeListAction extends 
         
         // Init BeanList
         if (!employeeBeanList.initBeanList(cmd))
-        {
-            setActionError(employeeBeanList);
+        {   // Error
             return LIST;
         }
         

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actions/LoginAction.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actions/LoginAction.java?rev=1158232&r1=1158231&r2=1158232&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actions/LoginAction.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actions/LoginAction.java
Tue Aug 16 12:27:56 2011
@@ -20,7 +20,7 @@ package org.apache.empire.struts2.websam
 
 import java.util.Map;
 
-import org.apache.empire.commons.Errors;
+import org.apache.empire.struts2.websample.web.SampleErrors;
 import org.apache.empire.struts2.websample.web.SampleUser;
 import org.apache.empire.struts2.websample.web.actiontypes.Action;
 
@@ -92,7 +92,7 @@ public class LoginAction extends Action
         
         if (userID==null || userID.length()==0)
         {
-            setActionError(Errors.InvalidPassword);
+            setActionError(SampleErrors.InvalidPassword);
             return INPUT;
         }
         

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/BeanDetailAction.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/BeanDetailAction.java?rev=1158232&r1=1158231&r2=1158232&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/BeanDetailAction.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/BeanDetailAction.java
Tue Aug 16 12:27:56 2011
@@ -18,13 +18,14 @@
  */
 package org.apache.empire.struts2.websample.web.actiontypes;
 
-import org.apache.empire.commons.Errors;
 import org.apache.empire.data.Record;
 import org.apache.empire.data.bean.BeanClass;
 import org.apache.empire.data.bean.BeanRecordProxy;
+import org.apache.empire.exceptions.ItemNotFoundException;
+import org.apache.empire.exceptions.NotSupportedException;
 import org.apache.empire.struts2.actionsupport.BeanActionSupport;
 import org.apache.empire.struts2.actionsupport.SessionPersistence;
-import org.apache.empire.struts2.web.WebErrors;
+import org.apache.empire.struts2.exceptions.InvalidFormDataException;
 
 import com.opensymphony.xwork2.interceptor.NoParameters;
 
@@ -64,7 +65,7 @@ public abstract class BeanDetailAction<T
     
     /**
      * Returns the Record interface implmentation for the bean.
-     * @return the Record interface implmentation for the bean. 
+     * @return the Record interface implementation for the bean. 
      */
     public Record getRecord() 
     {
@@ -78,7 +79,7 @@ public abstract class BeanDetailAction<T
         if (bean==null)
         {   // Must have an action error set!
             if (!hasActionError())
-                setActionError(Errors.ObjectNotValid, beanSupport.getRecordPropertyName());
+                setActionError(new NotSupportedException(beanSupport, "createBean"));
             return doCancel();
         }
         beanSupport.setData(bean);
@@ -96,7 +97,7 @@ public abstract class BeanDetailAction<T
             if (bean==null)
             {   // Must have an action error set!
                 if (!hasActionError())
-                    setActionError(Errors.ItemNotFound, beanSupport.getRecordKeyString());
+                    setActionError(new ItemNotFoundException(beanSupport.getRecordKeyString()));
                 return doCancel();
             }
             beanSupport.setData(bean);
@@ -104,7 +105,7 @@ public abstract class BeanDetailAction<T
         // Check if record is valid
         if (beanSupport.isValid()==false)
         {
-            setActionError(WebErrors.InvalidFormData);
+            setActionError(new InvalidFormDataException());
             return doCancel();
         }
         // Test
@@ -153,7 +154,7 @@ public abstract class BeanDetailAction<T
             if (bean==null)
             {   // Must have an action error set!
                 if (!hasActionError())
-                    setActionError(Errors.ItemNotFound, beanSupport.getRecordKeyString());
+                    setActionError(new ItemNotFoundException(beanSupport.getRecordKeyString()));
                 return doCancel();
             }
             beanSupport.setData(bean);
@@ -162,7 +163,7 @@ public abstract class BeanDetailAction<T
         {   // Check whether we have the right key
             if (!beanSupport.checkKey())
             {   // Record's don't match
-                setActionError(WebErrors.InvalidFormData);
+                setActionError(new InvalidFormDataException());
                 return doCancel();
             }
         }



Mime
View raw message