Author: doogie
Date: Fri Nov 13 09:20:15 2009
New Revision: 835786

URL: http://svn.apache.org/viewvc?rev=835786&view=rev
Log:
Add relation support.  Not fully correct, as one-nofk is not yet
supported, because of the '-' in the name.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/Parser.jj

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/Parser.jj
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/Parser.jj?rev=835786&r1=835785&r2=835786&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/Parser.jj (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/Parser.jj Fri Nov 13 
09:20:15 2009
@@ -83,6 +83,9 @@
 |      <SELECT: "SELECT">
 |      <DELETE: "DELETE">
 |      <UPDATE: "UPDATE">
+|      <RELATION: "RELATION">
+|      <TYPE: "TYPE">
+|      <TITLE: "TITLE">
 |      <SET: "SET">
 |      <FROM: "FROM">
 |      <SEMI: ";">
@@ -156,6 +159,7 @@
 {
        <SELECT> FieldDefs(dve)
        <FROM> Table(dve)
+       ( <RELATION> RelationDef(dve) )*
        ( <WHERE> condition=ConditionExpression() { 
sqlSelect.setWhereCondition(condition); } )?
        ( <HAVING> condition=ConditionExpression() { 
sqlSelect.setHavingCondition(condition); } )?
        ( <GROUP> <BY> fieldList=FieldList() { dve.setGroupBy(fieldList); } )?
@@ -165,6 +169,21 @@
        <SEMI>
        { return sqlSelect; }
 }
+
+private void RelationDef(DynamicViewEntity dve):
+{
+       String type = null, title = null, entityName;
+       List<ModelKeyMap> keyMaps;
+}
+{
+       ( LOOKAHEAD(2) <TYPE> type=NamePart() )?
+       ( LOOKAHEAD(2) <TITLE> title=NamePart() )?
+       entityName=NamePart()
+       <ON> keyMaps=KeyMaps("cur", "other") {
+               System.err.println("addRelation(" + type + ", " + title + ", " 
+ entityName + ", " + keyMaps + ")");
+               dve.addRelation(type, title, entityName, keyMaps);
+       }
+}
 /*
 CSSUpdate Update():
 {}


Reply via email to