empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From franci...@apache.org
Subject svn commit: r1158260 - in /incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web: ./ actions/ actiontypes/
Date Tue, 16 Aug 2011 13:16:59 GMT
Author: francisdb
Date: Tue Aug 16 13:16:58 2011
New Revision: 1158260

URL: http://svn.apache.org/viewvc?rev=1158260&view=rev
Log:
EMPIREDB-99 Refactor struts2 cxf example for new error handling

Added:
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleErrors.java
Modified:
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleConfig.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2-cxf/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-cxf/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-cxf/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-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleConfig.java?rev=1158260&r1=1158259&r2=1158260&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2-cxf/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-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleConfig.java
Tue Aug 16 13:16:58 2011
@@ -34,15 +34,13 @@ public class SampleConfig extends XMLCon
 	/**
 	 * Initialize the configuration
 	 */
-	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-cxf/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-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleErrors.java?rev=1158260&view=auto
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2-cxf/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-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleErrors.java
Tue Aug 16 13:16:58 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.");
+}

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2-cxf/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-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/LoginAction.java?rev=1158260&r1=1158259&r2=1158260&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2-cxf/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-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/LoginAction.java
Tue Aug 16 13:16:58 2011
@@ -21,9 +21,9 @@ package org.apache.empire.struts2.websam
 import java.util.Locale;
 import java.util.Map;
 
-import org.apache.empire.commons.Errors;
 import org.apache.empire.commons.OptionEntry;
 import org.apache.empire.commons.Options;
+import org.apache.empire.struts2.websample.web.SampleErrors;
 import org.apache.empire.struts2.websample.web.SampleUser;
 import org.apache.empire.struts2.websample.web.actiontypes.SampleAction;
 
@@ -114,7 +114,7 @@ public class LoginAction extends SampleA
 
         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-cxf/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-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/BeanDetailAction.java?rev=1158260&r1=1158259&r2=1158260&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-struts2-cxf/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-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/BeanDetailAction.java
Tue Aug 16 13:16:58 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.ObjectNotValidException;
 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;
 
@@ -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 ObjectNotValidException(beanSupport.getRecordPropertyName()));
             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