empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1339516 - /empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/app/DBELResolver.java
Date Thu, 17 May 2012 08:38:19 GMT
Author: doebele
Date: Thu May 17 08:38:18 2012
New Revision: 1339516

URL: http://svn.apache.org/viewvc?rev=1339516&view=rev
Log:
EMPIREDB-140
add el-resolver for RecordData

Modified:
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/app/DBELResolver.java

Modified: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/app/DBELResolver.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/app/DBELResolver.java?rev=1339516&r1=1339515&r2=1339516&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/app/DBELResolver.java
(original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/app/DBELResolver.java
Thu May 17 08:38:18 2012
@@ -27,6 +27,8 @@ import javax.el.ELResolver;
 import javax.faces.context.FacesContext;
 
 import org.apache.empire.commons.StringUtils;
+import org.apache.empire.data.Record;
+import org.apache.empire.data.RecordData;
 import org.apache.empire.db.DBColumnExpr;
 import org.apache.empire.db.DBDatabase;
 import org.apache.empire.db.DBRowSet;
@@ -91,6 +93,21 @@ public class DBELResolver extends ELReso
             // done
             return rset;
         }
+        else if (base instanceof RecordData)
+        {   // Lookup RowSet           
+            String field= StringUtils.toString(property);
+            int index = ((Record)base).getFieldIndex(field);
+            if (index<0)
+            {   // not a field, it may be a property
+                if (log.isDebugEnabled())
+                    log.debug("ELResolver warning: field '{}' not found in record .", field);
+                // not resolved, continue search
+                return null; 
+            }
+            // Found! Return field value.
+            context.setPropertyResolved(true);
+            return ((Record)base).getValue(index);
+        }
         else if (base==null)
         {   // LookupDatabase
             String name = StringUtils.toString(property);



Mime
View raw message