Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
You can subscribe to this list here.
2002 |
Jan
|
Feb
(239) |
Mar
(153) |
Apr
(426) |
May
(146) |
Jun
(207) |
Jul
(217) |
Aug
(292) |
Sep
(261) |
Oct
(343) |
Nov
(372) |
Dec
(468) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(378) |
Feb
(136) |
Mar
(243) |
Apr
(110) |
May
(166) |
Jun
(80) |
Jul
(6) |
Aug
(168) |
Sep
(379) |
Oct
(98) |
Nov
(132) |
Dec
(34) |
2004 |
Jan
(115) |
Feb
(161) |
Mar
(283) |
Apr
(185) |
May
(67) |
Jun
(71) |
Jul
(46) |
Aug
(52) |
Sep
(65) |
Oct
(39) |
Nov
(45) |
Dec
(96) |
2005 |
Jan
(58) |
Feb
(71) |
Mar
(36) |
Apr
(37) |
May
(74) |
Jun
(16) |
Jul
(54) |
Aug
(99) |
Sep
(111) |
Oct
(81) |
Nov
(42) |
Dec
(27) |
2006 |
Jan
(162) |
Feb
(30) |
Mar
(156) |
Apr
(122) |
May
(132) |
Jun
(135) |
Jul
(172) |
Aug
(170) |
Sep
(307) |
Oct
(322) |
Nov
(181) |
Dec
(349) |
2007 |
Jan
(390) |
Feb
(436) |
Mar
(208) |
Apr
(214) |
May
(833) |
Jun
(320) |
Jul
(296) |
Aug
(377) |
Sep
(131) |
Oct
(179) |
Nov
(261) |
Dec
(94) |
2008 |
Jan
(337) |
Feb
(414) |
Mar
(275) |
Apr
(410) |
May
(548) |
Jun
(217) |
Jul
(290) |
Aug
(160) |
Sep
(115) |
Oct
(180) |
Nov
(231) |
Dec
(138) |
2009 |
Jan
(117) |
Feb
(135) |
Mar
(203) |
Apr
(244) |
May
(173) |
Jun
(177) |
Jul
(167) |
Aug
(154) |
Sep
(269) |
Oct
(208) |
Nov
(238) |
Dec
(153) |
2010 |
Jan
(171) |
Feb
(197) |
Mar
(84) |
Apr
(103) |
May
(92) |
Jun
(103) |
Jul
(117) |
Aug
(132) |
Sep
(334) |
Oct
(240) |
Nov
(139) |
Dec
(83) |
2011 |
Jan
(92) |
Feb
(78) |
Mar
(44) |
Apr
(4) |
May
(19) |
Jun
(4) |
Jul
(5) |
Aug
(1) |
Sep
(1) |
Oct
(6) |
Nov
(12) |
Dec
(1) |
2012 |
Jan
|
Feb
(15) |
Mar
(9) |
Apr
(1) |
May
(27) |
Jun
(3) |
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(9) |
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
1
(1) |
2
|
3
(4) |
4
(2) |
5
|
6
|
7
(1) |
8
(7) |
9
(2) |
10
|
11
|
12
(2) |
13
|
14
(2) |
15
(2) |
16
|
17
|
18
(5) |
19
|
20
(11) |
21
(16) |
22
(4) |
23
(3) |
24
|
25
(5) |
26
(2) |
27
(8) |
28
(1) |
|
|
|
|
|
From: <kelleherk@us...> - 2011-02-28 18:17:49
|
Revision: 12002 http://wonder.svn.sourceforge.net/wonder/?rev=12002&view=rev Author: kelleherk Date: 2011-02-28 18:17:43 +0000 (Mon, 28 Feb 2011) Log Message: ----------- javadoc Modified Paths: -------------- trunk/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXTimeDurationFormatter.java Modified: trunk/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXTimeDurationFormatter.java =================================================================== --- trunk/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXTimeDurationFormatter.java 2011-02-27 05:29:33 UTC (rev 12001) +++ trunk/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXTimeDurationFormatter.java 2011-02-28 18:17:43 UTC (rev 12002) @@ -10,6 +10,17 @@ /** * User-presentable time duration format as days, hours, minutes and seconds. * + * Usage example: + * <code> + * StopWatch w = new StopWatch(); + * w.start(); + * ... perform long task ... + * w.stop(); + * ERXTimeDurationFormatter f = new ERXTimeDurationFormatter(TimeUnit.MILLISECONDS); + * + * String message = "The task took " + f.format(w.getTime()); + * </code> + * * @author kieran * */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nullterminated@us...> - 2011-02-27 05:29:39
|
Revision: 12001 http://wonder.svn.sourceforge.net/wonder/?rev=12001&view=rev Author: nullterminated Date: 2011-02-27 05:29:33 +0000 (Sun, 27 Feb 2011) Log Message: ----------- WONDER-665: Joda DateTime prototype should be timestamp instead of timestamptz for postgres http://issues.objectstyle.org/jira/browse/WONDER-665 Reverted prototype to timestamp instead of timestamptz Modified Paths: -------------- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERPrototypes/Resources/erprototypes.eomodeld/EOJDBCPostgresqlPrototypes.plist Modified: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERPrototypes/Resources/erprototypes.eomodeld/EOJDBCPostgresqlPrototypes.plist =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERPrototypes/Resources/erprototypes.eomodeld/EOJDBCPostgresqlPrototypes.plist 2011-02-27 05:03:35 UTC (rev 12000) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERPrototypes/Resources/erprototypes.eomodeld/EOJDBCPostgresqlPrototypes.plist 2011-02-27 05:29:33 UTC (rev 12001) @@ -150,7 +150,7 @@ adaptorValueConversionClassName = "er.prototypes.ValueConversion"; adaptorValueConversionMethodName = jodaDateTime; columnName = ""; - externalType = timestamptz; + externalType = timestamp; factoryMethodArgumentType = EOFactoryMethodArgumentIsDate; name = jodaDateTime; valueClassName = "org.joda.time.DateTime"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nullterminated@us...> - 2011-02-27 05:03:42
|
Revision: 12000 http://wonder.svn.sourceforge.net/wonder/?rev=12000&view=rev Author: nullterminated Date: 2011-02-27 05:03:35 +0000 (Sun, 27 Feb 2011) Log Message: ----------- Update build.xml to build new ERAttributeExtension framework Modified Paths: -------------- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Build/build/build.xml Modified: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Build/build/build.xml =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Build/build/build.xml 2011-02-27 05:01:51 UTC (rev 11999) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Build/build/build.xml 2011-02-27 05:03:35 UTC (rev 12000) @@ -316,6 +316,15 @@ </antcall> </target> + <target name="ERAttributeExtension.all"> + <antcall target="global.framework.${build.action}" > + <param name="project.principal.class" value="er.attributeextension.ERAttributeExtension" /> + <param name="project.name" value="ERAttributeExtension" /> + <param name="project.dir" value="Frameworks/EOF/ERAttributeExtension" /> + <param name="wo.external.root.bundles" value="${frameworks.wonder.core}" /> + </antcall> + </target> + <target name="ERExcelLook.all"> <antcall target="global.framework.${build.action}" > <param name="project.principal.class" value="er.directtoweb.excel.ERExcelLook" /> @@ -995,7 +1004,7 @@ to add your own, add a target definition above and choose the correct group below --> - <target name="common.frameworks.all" depends="ERJars.all, JavaWOExtensions.all, ERExtensions.all, Ajax.all, ERDirectToWeb.all, ERNeutralLook.all, ERSelenium.all, WOOgnl.all, ERPrototypes.all, ERPlot.all, ERIndexing.all, ERChronic.all, ERCaching.all, ERCaptcha.all, ERProfiling.all, EROpenID.all, ERPDFGeneration.all, ERJGroupsSynchronizer.all, ERRest.all, ERDirectToRest.all, ERAttachment.all, ERTaggable.all, ERJavaMail.all, ERCoreBusinessLogic.all, ERChangeNotificationJMS.all, ERCalendar.all, ERExcelLook.all, ERWorkerChannel.all, BTBusinessLogic.all, JavaMemoryAdaptor.all, JavaRESTAdaptor.all, JavaFSAdaptor.all, JavaERJDBCAdaptor.all, WOLips.all, WOJRebel.all, ERMoviesLogic.all, SnapshotExplorer.all, ERDivaliteLook.all, ERJasperReports.all" /> + <target name="common.frameworks.all" depends="ERJars.all, JavaWOExtensions.all, ERExtensions.all, Ajax.all, ERDirectToWeb.all, ERNeutralLook.all, ERSelenium.all, WOOgnl.all, ERPrototypes.all, ERPlot.all, ERIndexing.all, ERChronic.all, ERCaching.all, ERCaptcha.all, ERProfiling.all, EROpenID.all, ERPDFGeneration.all, ERJGroupsSynchronizer.all, ERRest.all, ERDirectToRest.all, ERAttachment.all, ERTaggable.all, ERJavaMail.all, ERCoreBusinessLogic.all, ERChangeNotificationJMS.all, ERCalendar.all, ERExcelLook.all, ERWorkerChannel.all, BTBusinessLogic.all, JavaMemoryAdaptor.all, JavaRESTAdaptor.all, JavaFSAdaptor.all, JavaERJDBCAdaptor.all, WOLips.all, WOJRebel.all, ERMoviesLogic.all, SnapshotExplorer.all, ERDivaliteLook.all, ERJasperReports.all, ERAttributeExtension.all" /> <target name="common.applications.all" depends="BugTracker.all, ERMailer.all, Uber.all, SecretPal.all, ERXTest.all" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nullterminated@us...> - 2011-02-27 05:01:59
|
Revision: 11999 http://wonder.svn.sourceforge.net/wonder/?rev=11999&view=rev Author: nullterminated Date: 2011-02-27 05:01:51 +0000 (Sun, 27 Feb 2011) Log Message: ----------- New ERAttributeExtension framework to override WO 5.4's EOAttribute Added Paths: ----------- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/.classpath branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/.project branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/.settings/ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/.settings/org.eclipse.core.resources.prefs branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Components/ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Libraries/ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Resources/ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Resources/Properties branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/com/ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/com/webobjects/ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/com/webobjects/eoaccess/ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/com/webobjects/eoaccess/EOAttribute.java branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/com/webobjects/jdbcadaptor/ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/com/webobjects/jdbcadaptor/DateJDBCColumn.java branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/er/ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/er/attributeextension/ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/er/attributeextension/ERAttributeExtension.java branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/WebServerResources/ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/build.properties branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/build.xml branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/classes.exclude.patternset branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/classes.include.patternset branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/resources.exclude.patternset branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/resources.include.patternset branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/wsresources.exclude.patternset branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/wsresources.include.patternset Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/.classpath =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/.classpath (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/.classpath 2011-02-27 05:01:51 UTC (rev 11999) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="Sources"/> + <classpathentry combineaccessrules="false" kind="con" path="WOFramework/ERExtensions"/> + <classpathentry combineaccessrules="false" kind="con" path="WOFramework/ERJars"/> + <classpathentry combineaccessrules="false" kind="con" path="WOFramework/ERPrototypes"/> + <classpathentry combineaccessrules="false" kind="con" path="WOFramework/JavaWOExtensions"/> + <classpathentry combineaccessrules="false" kind="con" path="WOFramework/WOOgnl"/> + <classpathentry combineaccessrules="false" kind="con" path="WOFramework/JavaEOAccess"/> + <classpathentry combineaccessrules="false" kind="con" path="WOFramework/JavaEOControl"/> + <classpathentry combineaccessrules="false" kind="con" path="WOFramework/JavaFoundation"/> + <classpathentry combineaccessrules="false" kind="con" path="WOFramework/JavaJDBCAdaptor"/> + <classpathentry combineaccessrules="false" kind="con" path="WOFramework/JavaWebObjects"/> + <classpathentry combineaccessrules="false" kind="con" path="WOFramework/JavaXML"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/.project =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/.project (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/.project 2011-02-27 05:01:51 UTC (rev 11999) @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>ERAttributeExtension</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.objectstyle.wolips.incrementalbuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.objectstyle.wolips.incrementalframeworknature</nature> + </natures> +</projectDescription> Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/.settings/org.eclipse.core.resources.prefs =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/.settings/org.eclipse.core.resources.prefs (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/.settings/org.eclipse.core.resources.prefs 2011-02-27 05:01:51 UTC (rev 11999) @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding//Components=UTF-8 Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Resources/Properties =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Resources/Properties (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Resources/Properties 2011-02-27 05:01:51 UTC (rev 11999) @@ -0,0 +1,2 @@ +er.extensions.ERXJDBCAdaptor.className=er.extensions.jdbc.ERXJDBCAdaptor +er.extensions.ERXJDBCAdaptor.columnClassName=com.webobjects.jdbcadaptor.DateJDBCColumn Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/com/webobjects/eoaccess/EOAttribute.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/com/webobjects/eoaccess/EOAttribute.java (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/com/webobjects/eoaccess/EOAttribute.java 2011-02-27 05:01:51 UTC (rev 11999) @@ -0,0 +1,1850 @@ +package com.webobjects.eoaccess; + +import java.lang.reflect.InvocationTargetException; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Date; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.TimeZone; + +import com.webobjects.foundation.NSArray; +import com.webobjects.foundation.NSData; +import com.webobjects.foundation.NSDictionary; +import com.webobjects.foundation.NSForwardException; +import com.webobjects.foundation.NSKeyValueCoding; +import com.webobjects.foundation.NSLog; +import com.webobjects.foundation.NSMutableArray; +import com.webobjects.foundation.NSMutableDictionary; +import com.webobjects.foundation.NSRange; +import com.webobjects.foundation.NSSelector; +import com.webobjects.foundation.NSTimestamp; +import com.webobjects.foundation._NSStringUtilities; +import com.webobjects.foundation._NSUtilities; +import com.webobjects.jdbcadaptor.JDBCAdaptorException; + +public class EOAttribute extends EOProperty implements EOPropertyListEncoding, EOSQLExpression.SQLValue { + + enum Characteristic { + ExternalType("externalType"), ColumnName("columnName"), ReadOnly("readOnly"), ClassName("className"), ValueType("valueType"), Width("width"), Precision("precision"), Scale("scale"), WriteFormat("writeFormat"), ReadFormat("readFormat"), UserInfo("userInfo"), ServerTimeZone("serverTimeZone"), ValueFactoryClassName("valueFactoryClassName"), ValueFactoryMethodName("valueFactoryMethodName"), AdaptorValueConversionClassName("adaptorValueConversionClassName"), AdaptorValueConversionMethodName("adaptorValueConversionMethodName"), FactoryMethodArgumentType("factoryMethodArgumentType"), AllowsNull("allowsNull"), ParameterDirection("parameterDirection"), InternalInfo("_internalInfo"); + + private String _externalName; + + Characteristic(String externalName) { + this._externalName = externalName; + } + + public String externalName() { + return _externalName; + } + + public static Characteristic characteristicForName(String value) { + String lower = value.toLowerCase(); + for (Characteristic c : values()) { + if (c.externalName().equalsIgnoreCase(lower)) { + return c; + } + } + return null; + } + } + + public synchronized Map overwrittenCharacteristics() { + if (_overwrittenCharacteristics == null) { + Map list = new HashMap(); + for (Characteristic c : Characteristic.values()) { + list.put(c, Boolean.FALSE); + } + _overwrittenCharacteristics = list; + } + return _overwrittenCharacteristics; + } + + protected void _setOverrideForCharacteristic(Characteristic key) { + overwrittenCharacteristics().put(key, Boolean.TRUE); + } + + public boolean overridesPrototypeDefinitionForCharacteristic(Characteristic key) { + Boolean value = (Boolean) overwrittenCharacteristics().get(key); + return value == null ? false : value.booleanValue(); + } + + public void _updateFromPrototype() { + if (_prototype == null) + return; + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.ExternalType)) + _setExternalType(_prototype.externalType()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.ColumnName)) + _setColumnName(_prototype.columnName()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.ReadOnly)) + _setReadOnly(_prototype.isReadOnly()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.ClassName)) + _setClassName(_prototype.className()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.ValueType)) + _setValueType(_prototype.valueType()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.Width)) + _setWidth(_prototype.width()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.Precision)) + _setPrecision(_prototype.precision()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.Scale)) + _setScale(_prototype.scale()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.WriteFormat)) + _setWriteFormat(_prototype.writeFormat()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.ReadFormat)) + _setReadFormat(_prototype.readFormat()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.ServerTimeZone)) + _setServerTimeZone(_prototype.serverTimeZone()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.ValueFactoryClassName)) + _setValueFactoryClassName(_prototype.valueFactoryClassName()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.ValueFactoryMethodName)) + _setValueFactoryMethodName(_prototype.valueFactoryMethodName()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.AdaptorValueConversionClassName)) + _setAdaptorValueConversionClassName(_prototype.adaptorValueConversionClassName()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.AdaptorValueConversionMethodName)) + _setAdaptorValueConversionMethodName(_prototype.adaptorValueConversionMethodName()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.FactoryMethodArgumentType)) + _setFactoryMethodArgumentType(_prototype.factoryMethodArgumentType()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.AllowsNull)) + _setAllowsNull(_prototype.allowsNull()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.ParameterDirection)) + _setParameterDirection(_prototype.parameterDirection()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.UserInfo)) + if (_prototype.userInfo() != null) + _setUserInfo(_prototype.userInfo().immutableClone()); + else + _setUserInfo(NSDictionary.emptyDictionary()); + if (!overridesPrototypeDefinitionForCharacteristic(Characteristic.InternalInfo)) + if (_prototype._internalInfo() != null) + __setInternalInfo(_prototype._internalInfo().immutableClone()); + else + __setInternalInfo(NSDictionary.emptyDictionary()); + } + + public void _resetPrototype() { + if (_prototypeName != null) { + _prototype = null; + prototype(); + } + } + + protected boolean _hasAnyOverrides() { + boolean result = false; + for (Iterator i = overwrittenCharacteristics().values().iterator(); i.hasNext();) { + Boolean anEnum = (Boolean) i.next(); + result |= anEnum.booleanValue(); + } + + return result; + } + + public EOAttribute() { + _flags_isNonUpdateable = false; + _flags_isNonUpdateableInitialized = false; + _flags_allowsNull = true; + _adaptorValueType = -1; + _valueTypeClassName = ""; + } + + public String name() { + return _name; + } + + public String toString() { + return _toString(0); + } + + public String _toString(int indent) { + String indentString = ""; + for (int i = 0; i < indent; i++) + indentString = (new StringBuilder()).append(indentString).append("\t").toString(); + + StringBuilder aLog = new StringBuilder(); + aLog.append((new StringBuilder()).append(indentString).append("<EOAttribute ").append(name()).append("\n").toString()); + String aKey = ""; + try { + NSMutableDictionary aDictionary = new NSMutableDictionary(); + encodeIntoPropertyList(aDictionary); + for (Enumeration enumerator = aDictionary.keyEnumerator(); enumerator.hasMoreElements(); aLog.append((new StringBuilder()).append(indentString).append("\t").append(aKey).append(" : '").append(aDictionary.objectForKey(aKey)).append("'\n").toString())) + aKey = (String) enumerator.nextElement(); + + } + catch (Exception exception) { + aLog.append((new StringBuilder()).append(indentString).append("\t").append(getClass().getName()).append(".toString: characteristics ").append(aKey).append(" exception ").append(exception).append("\n").toString()); + } + aLog.append((new StringBuilder()).append(indentString).append(">").toString()); + return aLog.toString(); + } + + public EOEntity entity() { + return _parent; + } + + public EOStoredProcedure storedProcedure() { + return _parentStoredProcedure; + } + + public Object parent() { + if (_parent != null) + return _parent; + + return _parentStoredProcedure; + } + + private EOModel _parentModel() { + if (_parent != null) + return _parent.model(); + if (_parentStoredProcedure != null) + return _parentStoredProcedure.model(); + + return null; + } + + private void _parent_setIsEdited() { + if (_parent != null) + _parent._setIsEdited(); + else if (_parentStoredProcedure != null) + _parentStoredProcedure._setIsEdited(); + } + + private NSArray _parent_primaryKeyAttributes() { + if (_parent != null) + return _parent.primaryKeyAttributes(); + + return null; + } + + private EOAttribute _parent_attributeNamed(String name) { + if (_parent != null) + return _parent.attributeNamed(name); + + return null; + } + + private void _parent_removeAttribute(EOAttribute att) { + if (_parent != null) + _parent.removeAttribute(att); + } + + public String prototypeName() { + return _prototypeName; + } + + public EOAttribute prototype() { + if (_prototype == null && _prototypeName != null) + if (_parent != null) + _prototype = _parent.model().prototypeAttributeNamed(_prototypeName); + else if (_parentStoredProcedure != null) + _prototype = _parentStoredProcedure.model().prototypeAttributeNamed(_prototypeName); + return _prototype; + } + + public String externalType() { + return _externalType; + } + + public String columnName() { + return _columnName; + } + + public String definition() { + return _definitionArray == null ? null : _definitionArray.valueForSQLExpression(null); + } + + public boolean isFlattened() { + if (_definitionArray == null) + return false; + int count; + if ((count = _definitionArray.count()) < 2) + return false; + for (int index = 0; index < count - 1; index++) { + Object property = _definitionArray.objectAtIndex(index); + if (!(property instanceof EORelationship)) + return false; + } + + return _definitionArray.lastObject() instanceof EOAttribute; + } + + public boolean isDerived() { + return _definitionArray != null; + } + + public boolean isReadOnly() { + return _flags_isReadOnly || isDerived() && !isFlattened(); + } + + public boolean _isPrimaryKeyClassProperty() { + NSArray pkAtts = _parent_primaryKeyAttributes(); + if (pkAtts == null) + return false; + if (!pkAtts.containsObject(this)) + return false; + + return _parent.classProperties().containsObject(this); + } + + public boolean _isNonUpdateable() { + if (_flags_isNonUpdateableInitialized) { + return _flags_isNonUpdateable; + } + _flags_isNonUpdateable = isReadOnly() || _isPrimaryKeyClassProperty(); + _flags_isNonUpdateableInitialized = true; + return _flags_isNonUpdateable; + } + + /** + * @return valueClassName + * @deprecated Method valueClassName is deprecated + */ + + public String valueClassName() { + return _valueClassName; + } + + public String className() { + return _className; + } + + public String valueType() { + return _valueType; + } + + protected char _valueTypeChar() { + if (_valueType != null && _valueType.length() == 1) + return _valueType.charAt(0); + + return _VTUnknown; + } + + public int width() { + return _width; + } + + public int precision() { + return _precision; + } + + public int scale() { + return _scale; + } + + public boolean allowsNull() { + return _flags_allowsNull; + } + + public String readFormat() { + return _readFormat; + } + + public String writeFormat() { + return _writeFormat; + } + + public int parameterDirection() { + return _parameterDirection; + } + + public NSDictionary userInfo() { + return _userInfo; + } + + public NSDictionary _internalInfo() { + return _internalInfo; + } + + public EOAttribute(NSDictionary plist, Object owner) { + _flags_isNonUpdateable = false; + _flags_isNonUpdateableInitialized = false; + _name = (String) plist.objectForKey("name"); + _adaptorValueType = -1; + _valueTypeClassName = ""; + setParent(owner); + String string; + if ((string = (String) plist.objectForKey("prototypeName")) != null) + setPrototype(_parentModel().prototypeAttributeNamed(string)); + if ((string = (String) plist.objectForKey("externalType")) != null) + setExternalType(string); + if ((string = (String) plist.objectForKey("isReadOnly")) != null) + setReadOnly(string.equals("Y")); + if ((string = (String) plist.objectForKey("allowsNull")) != null || _prototypeName == null) + setAllowsNull(string != null && string.equals("Y")); + if ((string = (String) plist.objectForKey("valueType")) != null) + setValueType(string); + if ((string = (String) plist.objectForKey("valueClassName")) != null) + setValueClassName(string); + if ((string = (String) plist.objectForKey("className")) != null) + setClassName(string); + string = (String) plist.objectForKey("writeFormat"); + if (string == null) { + string = (String) plist.objectForKey("updateFormat"); + if (string == null) + string = (String) plist.objectForKey("insertFormat"); + } + if (string != null) + setWriteFormat(string); + string = (String) plist.objectForKey("readFormat"); + if (string == null) + string = (String) plist.objectForKey("selectFormat"); + if (string != null) + setReadFormat(string); + int num = _NSStringUtilities.integerFromPlist(plist, "maximumLength", -1); + if (num == -1) + num = _NSStringUtilities.integerFromPlist(plist, "width", -1); + if (num != -1) + setWidth(num); + if ((string = (String) plist.objectForKey("factoryMethodArgumentType")) != null) + _argumentType = _factoryMethodArgumentTypeFromString(string); + if ((string = (String) plist.objectForKey("adaptorValueConversionClassName")) != null) + setAdaptorValueConversionClassName(string); + if ((string = (String) plist.objectForKey("adaptorValueConversionMethodName")) != null) + setAdaptorValueConversionMethodName(string); + if ((string = (String) plist.objectForKey("valueFactoryClassName")) != null) + setValueFactoryClassName(string); + if ((string = (String) plist.objectForKey("valueFactoryMethodName")) != null) + setValueFactoryMethodName(string); + num = _NSStringUtilities.integerFromPlist(plist, "precision", -1); + if (num != -1) + setPrecision(num); + num = _NSStringUtilities.integerFromPlist(plist, "scale", -1); + if (num != -1) + setScale(num); + if (_width == 0 && _externalType != null) { + int leftParen = _externalType.indexOf("("); + if (leftParen != -1) { + int rightParen = _externalType.indexOf(")"); + if (rightParen != -1) { + String sizeString = _externalType.substring(leftParen + 1, rightParen); + int max; + try { + max = Integer.parseInt(sizeString); + } + catch (NumberFormatException e) { + NSLog._conditionallyLogPrivateException(e); + max = 0; + } + if (max != 0) { + setWidth(max); + setExternalType(_externalType.substring(0, leftParen)); + } + } + } + } + String tzName = (String) plist.objectForKey("serverTimeZone"); + if (tzName != null) { + TimeZone tz = TimeZone.getTimeZone(tzName); + setServerTimeZone(tz); + } + num = _NSStringUtilities.integerFromPlist(plist, "parameterDirection", -1); + if (num != -1) + setParameterDirection(num); + Object val = plist.objectForKey("userInfo"); + if (val == null) + val = plist.objectForKey("userDictionary"); + setUserInfo((NSDictionary) val); + if ((val = plist.objectForKey("internalInfo")) != null) + _setInternalInfo((NSDictionary) val); + } + + private boolean shouldEncodeIvarWithPrototypeCharacteristic(int ivar, Characteristic key) { + return ivar != 0 && (_prototype == null || overridesPrototypeDefinitionForCharacteristic(key)); + } + + private boolean shouldEncodeIvarWithPrototypeCharacteristic(Object ivar, Characteristic key) { + return ivar != null && (_prototype == null || overridesPrototypeDefinitionForCharacteristic(key)); + } + + private boolean shouldEncodeScalarIvarWithPrototypeCharacteristic(int scalarIvar, Characteristic key) { + return _prototype == null && scalarIvar != 0 || _prototype != null && overridesPrototypeDefinitionForCharacteristic(key); + } + + public void encodeIntoPropertyList(NSMutableDictionary result) { + if (_name != null) + result.setObjectForKey(_name, "name"); + Object plist = prototypeName(); + if (plist != null) + result.setObjectForKey(plist, "prototypeName"); + plist = columnName(); + if (plist != null) { + if (shouldEncodeIvarWithPrototypeCharacteristic(_columnName, Characteristic.ColumnName)) + result.setObjectForKey(plist, "columnName"); + } + else { + plist = definition(); + if (plist != null) + result.setObjectForKey(plist, "definition"); + } + if (shouldEncodeIvarWithPrototypeCharacteristic(_externalType, Characteristic.ExternalType)) + result.setObjectForKey(_externalType, "externalType"); + if (shouldEncodeIvarWithPrototypeCharacteristic(_valueType, Characteristic.ValueType)) + result.setObjectForKey(_valueType, "valueType"); + if (shouldEncodeIvarWithPrototypeCharacteristic(_className, Characteristic.ClassName)) + result.setObjectForKey(_className, "className"); + if (shouldEncodeIvarWithPrototypeCharacteristic(_writeFormat, Characteristic.WriteFormat)) + result.setObjectForKey(_writeFormat, "writeFormat"); + if (shouldEncodeIvarWithPrototypeCharacteristic(_readFormat, Characteristic.ReadFormat)) + result.setObjectForKey(_readFormat, "readFormat"); + if (shouldEncodeScalarIvarWithPrototypeCharacteristic(_width, Characteristic.Width)) + result.setObjectForKey(String.valueOf(_width), "width"); + if (shouldEncodeIvarWithPrototypeCharacteristic(_serverTimeZone, Characteristic.ServerTimeZone)) { + plist = _serverTimeZone.getID(); + if (plist != null) + result.setObjectForKey(plist, "serverTimeZone"); + } + if (shouldEncodeIvarWithPrototypeCharacteristic(_valueFactoryClassName, Characteristic.ValueFactoryClassName)) + result.setObjectForKey(_valueFactoryClassName, "valueFactoryClassName"); + if (shouldEncodeIvarWithPrototypeCharacteristic(_valueFactoryMethodName, Characteristic.ValueFactoryMethodName)) + result.setObjectForKey(_valueFactoryMethodName, "valueFactoryMethodName"); + if (shouldEncodeIvarWithPrototypeCharacteristic(_adaptorValueConversionClassName, Characteristic.AdaptorValueConversionClassName)) + result.setObjectForKey(_adaptorValueConversionClassName, "adaptorValueConversionClassName"); + if (shouldEncodeIvarWithPrototypeCharacteristic(_adaptorValueConversionMethodName, Characteristic.AdaptorValueConversionMethodName)) + result.setObjectForKey(_adaptorValueConversionMethodName, "adaptorValueConversionMethodName"); + if (shouldEncodeIvarWithPrototypeCharacteristic(_argumentType, Characteristic.FactoryMethodArgumentType)) + result.setObjectForKey(_stringForFactoryMethodArgumentType(_argumentType), "factoryMethodArgumentType"); + if (shouldEncodeScalarIvarWithPrototypeCharacteristic(_precision, Characteristic.Precision)) + result.setObjectForKey(String.valueOf(_precision), "precision"); + if (shouldEncodeScalarIvarWithPrototypeCharacteristic(_scale, Characteristic.Scale)) + result.setObjectForKey(String.valueOf(_scale), "scale"); + if (shouldEncodeScalarIvarWithPrototypeCharacteristic(_flags_isReadOnly ? 1 : 0, Characteristic.ReadOnly)) + result.setObjectForKey(isReadOnly() ? "Y" : "N", "isReadOnly"); + if (shouldEncodeScalarIvarWithPrototypeCharacteristic(_flags_allowsNull ? 1 : 0, Characteristic.AllowsNull)) + result.setObjectForKey(allowsNull() ? "Y" : "N", "allowsNull"); + if (shouldEncodeScalarIvarWithPrototypeCharacteristic(_parameterDirection, Characteristic.ParameterDirection)) + result.setObjectForKey(String.valueOf(_parameterDirection), "parameterDirection"); + if (shouldEncodeIvarWithPrototypeCharacteristic(_userInfo, Characteristic.UserInfo)) + result.setObjectForKey(_userInfo.clone(), "userInfo"); + if (shouldEncodeIvarWithPrototypeCharacteristic(_internalInfo, Characteristic.InternalInfo)) + result.setObjectForKey(_internalInfo.clone(), "internalInfo"); + } + + public void awakeWithPropertyList(NSDictionary plist) { + Object encoding; + String string; + if ((string = (String) plist.objectForKey("definition")) != null) { + _setDefinitionWithoutFlushingCaches(string); + _parent_setIsEdited(); + } + else if ((string = (String) plist.objectForKey("columnName")) != null) + setColumnName(string); + else if ((encoding = plist.objectForKey("externalName")) != null) + if (encoding instanceof String) + setColumnName((String) encoding); + else if (encoding instanceof NSDictionary) + _definitionArray = (_EOExpressionArray) _objectForPlist(encoding); + } + + public boolean overridesPrototypeDefinitionForKey(String key) { + Characteristic aCharacteristic = Characteristic.characteristicForName(key); + return aCharacteristic == null ? false : overridesPrototypeDefinitionForCharacteristic(aCharacteristic); + } + + public void setName(String name) { + if (name.equals(_name)) + return; + EOEntity entity = entity(); + EOModel model = null; + EOModelGroup group = null; + if (entity != null) + model = entity.model(); + if (model != null) + group = model.modelGroup(); + if (group != null) + group.loadAllModelObjects(); + _name = name; + _parent_setIsEdited(); + } + + public void setPrototype(EOAttribute prototype) { + if (_prototype == prototype) + return; + _overwrittenCharacteristics = null; + if (prototype == null) { + _prototype = null; + _prototypeName = null; + } + else if (_prototypeName == null || !_prototypeName.equals(prototype.name())) { + _prototypeName = prototype.name(); + if (_prototypeName != null) { + _prototype = _parentModel().prototypeAttributeNamed(_prototypeName); + if (_prototype == null) + _prototype = prototype; + _updateFromPrototype(); + } + else { + _prototype = null; + _prototypeName = null; + } + } + } + + public void setReadOnly(boolean yn) { + if (_flags_isReadOnly != yn) { + if (!yn && isDerived() && !isFlattened()) + throw new IllegalArgumentException("Unable to remove read only on a derived not flattened attribute"); + _setReadOnly(yn); + _setOverrideForCharacteristic(Characteristic.ReadOnly); + } + } + + private void _setReadOnly(boolean yn) { + if (_flags_isReadOnly != yn) { + if (!yn && isDerived() && !isFlattened()) + throw new IllegalArgumentException("Unable to remove read only on a derived not flattened attribute"); + _flags_isReadOnly = yn; + _parent_setIsEdited(); + if (_parent != null) + _parent._clearAttributesCaches(); + _flags_isNonUpdateableInitialized = false; + } + } + + public void setColumnName(String columnName) { + if (columnName == null && _columnName == null) { + return; + } + _setColumnName(columnName); + _setOverrideForCharacteristic(Characteristic.ColumnName); + return; + } + + private void _setColumnName(String columnName) { + if (columnName == null && _columnName == null) { + return; + } + _definitionArray = null; + _columnName = columnName; + _parent_setIsEdited(); + return; + } + + public void setDefinition(String definition) { + if (definition == null && _definitionArray == null) { + return; + } + _setDefinitionWithoutFlushingCaches(definition); + _setValuesFromTargetAttribute(); + _parent_setIsEdited(); + return; + } + + public void setExternalType(String string) { + if (_externalType == null || !_externalType.equals(string)) { + _setExternalType(string); + _setOverrideForCharacteristic(Characteristic.ExternalType); + } + } + + private void _setExternalType(String string) { + if (_externalType == null || !_externalType.equals(string)) { + _externalType = string == null || string.length() <= 0 ? null : string; + _parent_setIsEdited(); + } + } + + public void setValueType(String string) { + if (_valueType == null || !_valueType.equals(string)) { + _setValueType(string); + _setOverrideForCharacteristic(Characteristic.ValueType); + } + } + + private void _setValueType(String string) { + if (_valueType == null || !_valueType.equals(string)) + _valueType = string == null || string.length() <= 0 ? null : string; + } + + private String _javaNameForObjcName(String name) { + if (name == null) + return null; + if (name.startsWith(CN_NSPrefix)) { + if (name.equals(CN_NSString)) + return CN_JavaString; + if (name.equals(CN_NSNumber)) + return CN_JavaNumber; + if (name.equals(CN_NSDecimalNumber)) + return CN_JavaBigDecimal; + if (name.equals(CN_NSCalendarDate)) + return CN_JavaNSTimestamp; + if (name.equals(CN_NSGregorianDate)) + return CN_JavaNSTimestamp; + if (name.equals(CN_NSData)) + return CN_JavaNSData; + } + else if (name.equals("")) + return null; + return name; + } + + private String _objcNameForJavaName(String name) { + if (name == null) + return null; + if (name.equals(CN_JavaString)) + return CN_NSString; + if (name.equals(CN_JavaNumber)) + return CN_NSNumber; + if (name.equals(CN_JavaBigDecimal)) + return CN_NSDecimalNumber; + if (name.equals(CN_JavaNSTimestamp)) + return CN_NSCalendarDate; + if (name.equals(CN_JavaNSData)) + return CN_NSData; + if (name.equals("")) + return null; + + return _NSStringUtilities.lastComponentInString(name, '.'); + } + + /** + * @param name + * valueClassName + * @deprecated Method setValueClassName is deprecated + */ + + public void setValueClassName(String name) { + _valueClassName = name == null || name.length() <= 0 ? null : name; + _className = _javaNameForObjcName(_valueClassName); + _adaptorValueType = -1; + _valueTypeClassName = ""; + _setOverrideForCharacteristic(Characteristic.ClassName); + } + + public void setClassName(String name) { + _setClassName(name); + _setOverrideForCharacteristic(Characteristic.ClassName); + } + + private void _setClassName(String name) { + _className = name == null || name.length() <= 0 ? null : name; + _valueClassName = _objcNameForJavaName(_className); + _adaptorValueType = -1; + _valueTypeClassName = ""; + } + + public void setWidth(int length) { + _setWidth(length); + _setOverrideForCharacteristic(Characteristic.Width); + } + + private void _setWidth(int length) { + _width = length; + } + + public void setPrecision(int precision) { + _setPrecision(precision); + _setOverrideForCharacteristic(Characteristic.Precision); + } + + private void _setPrecision(int precision) { + _precision = precision; + } + + public void setScale(int scale) { + _setScale(scale); + _setOverrideForCharacteristic(Characteristic.Scale); + } + + private void _setScale(int scale) { + _scale = scale; + } + + public void setAllowsNull(boolean allowsNull) { + if (allowsNull == _flags_allowsNull) { + return; + } + _setAllowsNull(allowsNull); + _setOverrideForCharacteristic(Characteristic.AllowsNull); + return; + } + + private void _setAllowsNull(boolean allowsNull) { + if (allowsNull == _flags_allowsNull) { + return; + } + _flags_allowsNull = allowsNull; + return; + } + + public void setWriteFormat(String string) { + _setWriteFormat(string); + _setOverrideForCharacteristic(Characteristic.WriteFormat); + } + + private void _setWriteFormat(String string) { + _writeFormat = _setNewFormatStringOld(string, _writeFormat); + } + + public void setReadFormat(String string) { + _setReadFormat(string); + _setOverrideForCharacteristic(Characteristic.ReadFormat); + } + + private void _setReadFormat(String string) { + _readFormat = _setNewFormatStringOld(string, _readFormat); + } + + public void setParameterDirection(int parameterDirection) { + _setParameterDirection(parameterDirection); + _setOverrideForCharacteristic(Characteristic.ParameterDirection); + } + + private void _setParameterDirection(int parameterDirection) { + _parameterDirection = parameterDirection; + } + + public void setUserInfo(NSDictionary dictionary) { + _setUserInfo(dictionary); + _setOverrideForCharacteristic(Characteristic.UserInfo); + } + + private void _setUserInfo(NSDictionary dictionary) { + _userInfo = dictionary == null || dictionary.count() <= 0 ? null : (NSDictionary) dictionary.clone(); + _parent_setIsEdited(); + } + + protected void _setInternalInfo(NSDictionary dictionary) { + __setInternalInfo(dictionary); + _setOverrideForCharacteristic(Characteristic.InternalInfo); + } + + private void __setInternalInfo(NSDictionary dictionary) { + _internalInfo = dictionary == null || dictionary.count() <= 0 ? null : (NSDictionary) dictionary.clone(); + _parent_setIsEdited(); + } + + public void beautifyName() { + setName(_EOStringUtil.nameForExternalNameSeparatorStringInitialCaps(name(), "_", false)); + } + + public TimeZone serverTimeZone() { + if (_serverTimeZone == null) + return TimeZone.getDefault(); + + return _serverTimeZone; + } + + public void setServerTimeZone(TimeZone tz) { + _setServerTimeZone(tz); + _setOverrideForCharacteristic(Characteristic.ServerTimeZone); + } + + private void _setServerTimeZone(TimeZone tz) { + _serverTimeZone = (TimeZone) tz.clone(); + } + + public Object newValueForBytes(byte bytes[], int length) { + return newValueForImmutableBytes(bytes); + } + + public Object newValueForImmutableBytes(byte bytes[]) { + Class dataClass = NSData._CLASS; + Object value = null; + NSData data = null; + if (_valueClass == null) { + _valueClass = _NSUtilities.classWithName(className());//_valueClassName); + if (_valueClass == null) + _valueClass = dataClass; + } + if (_valueClass == dataClass || _argumentType == FactoryMethodArgumentIsData || _valueFactoryMethod == null) { + data = new NSData(bytes, new NSRange(0, bytes.length), true); + if (_valueClass == dataClass || _valueFactoryMethod == null) + return data; + } + switch (_argumentType) { + default: + break; + + case FactoryMethodArgumentIsData: + try { + value = _valueFactoryMethod.invoke(valueFactoryClass()==null?_valueClass:valueFactoryClass(), data); + } catch (IllegalAccessException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (IllegalArgumentException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (InvocationTargetException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (NoSuchMethodException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } + break; + + case FactoryMethodArgumentIsBytes: + try { + value = _valueFactoryMethod.invoke(valueFactoryClass()==null?_valueClass:valueFactoryClass(), bytes); + } catch (IllegalAccessException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (IllegalArgumentException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (InvocationTargetException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (NoSuchMethodException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } + break; + + case FactoryMethodArgumentIsString: + try { + value = _valueFactoryMethod.invoke(valueFactoryClass()==null?_valueClass:valueFactoryClass(), _NSStringUtilities.stringForBytes(bytes, "UTF-8")); + if (!NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelInformational, NSLog.DebugGroupDatabaseAccess)) + break; + if (NSLog.debugLoggingAllowedForLevel(NSLog.DebugLevelDetailed)) + NSLog.debug.appendln(new RuntimeException("Deprecated implicit bytes->String conversion. Assuming UTF-8 encoding.")); + else + NSLog.debug.appendln("Deprecated implicit bytes->String conversion. Assuming UTF-8 encoding. Set debug level to NSLog.DebugLevelDetailed for more information."); + } catch (IllegalAccessException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (IllegalArgumentException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (InvocationTargetException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (NoSuchMethodException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } + break; + } + return value; + } + + /** + * @param bytes + * @param length + * @return newValueForBytesString + * @deprecated Method newValueForBytesString is deprecated + */ + + public Object newValueForBytesString(byte bytes[], int length) { + Class stringClass = String.class; + Object value = null; + Object value1 = null; + if (_valueClass == null) { + _valueClass = _NSUtilities.classWithName(className());//_valueClassName); + if (_valueClass == null) + _valueClass = stringClass; + } + if (_valueClass == stringClass) { + String result = _NSStringUtilities.stringForBytes(bytes, 0, length, "UTF-8"); + if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelInformational, NSLog.DebugGroupDatabaseAccess)) + if (NSLog.debugLoggingAllowedForLevel(NSLog.DebugLevelDetailed)) + NSLog.debug.appendln(new RuntimeException("Deprecated implicit bytes->String conversion. Assuming UTF-8 encoding.")); + else + NSLog.debug.appendln("Deprecated implicit bytes->String conversion. Assuming UTF-8 encoding. Set debug level to NSLog.DebugLevelDetailed for more information."); + return result; + } + if (_valueClass == stringClass || _argumentType == 1 || _valueFactoryMethod == null) { + value = _NSStringUtilities.stringForBytes(bytes, 0, length, "UTF-8"); + if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelInformational, NSLog.DebugGroupDatabaseAccess)) + if (NSLog.debugLoggingAllowedForLevel(NSLog.DebugLevelDetailed)) + NSLog.debug.appendln(new RuntimeException("Deprecated implicit bytes->String conversion. Assuming UTF-8 encoding.")); + else + NSLog.debug.appendln("Deprecated implicit bytes->String conversion. Assuming UTF-8 encoding. Set debug level to NSLog.DebugLevelDetailed for more information."); + if (_valueClass == stringClass || _valueFactoryMethod == null) + return value; + } + switch (_argumentType) { + case FactoryMethodArgumentIsData: + default: + break; + + case FactoryMethodArgumentIsString: + try { + value1 = _valueFactoryMethod.invoke(valueFactoryClass()==null?_valueClass:valueFactoryClass(), value); + } catch (IllegalAccessException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (IllegalArgumentException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (InvocationTargetException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (NoSuchMethodException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } + value = value1; + break; + + case FactoryMethodArgumentIsBytes: + try { + value1 = _valueFactoryMethod.invoke(valueFactoryClass()==null?_valueClass:valueFactoryClass(), new Object[] { bytes, _NSUtilities.IntegerForInt(length) }); + } catch (IllegalAccessException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (IllegalArgumentException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (InvocationTargetException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (NoSuchMethodException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } + value = value1; + break; + } + return value; + } + + public Object newValueForDate(Object value) { + if(valueFactoryMethod() != null) { + if(!(value instanceof Date)) { + throw new JDBCAdaptorException((new StringBuilder()).append(value).append(" of type ").append(value.getClass().getName()).append(" is not a valid Date type. You must use java.sql.Timestamp, java.sql.Date, or java.sql.Time").toString(), null); + } + Date date = (Date)value; + //Call the custom factory method + try { + if(valueFactoryClass() != null) { + Class<?> factoryClass = valueFactoryClass(); + return valueFactoryMethod().invoke(factoryClass, date); + } + Class<?> c = _NSUtilities.classWithName(className()); + return valueFactoryMethod().invoke(c, date); + } catch(IllegalAccessException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch(IllegalArgumentException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch(NoSuchMethodException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch(InvocationTargetException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } + } else { + if(value instanceof Timestamp) { + return new NSTimestamp((Timestamp)value); + } + if(value instanceof Date) { + Date temp = (Date)value; + return new NSTimestamp(temp.getTime()); + } else { + throw new JDBCAdaptorException((new StringBuilder()).append(value).append(" of type ").append(value.getClass().getName()).append(" is not a valid Date type. You must use java.sql.Timestamp, java.sql.Date, or java.sql.Time").toString(), null); + } + } + } + + public Object newValueForString(String str) { + Class stringClass = String.class; + Object value = null; + if (_valueClass == null) { + _valueClass = _NSUtilities.classWithName(className());//_valueClassName); + if (_valueClass == null) + _valueClass = stringClass; + } + if (_valueClass == stringClass || _valueFactoryMethod == null) + return str; + switch (_argumentType) { + default: + break; + + case FactoryMethodArgumentIsString: + try { + value = _valueFactoryMethod.invoke(valueFactoryClass()==null?_valueClass:valueFactoryClass(), str); + } catch (IllegalAccessException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (IllegalArgumentException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (InvocationTargetException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (NoSuchMethodException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } + break; + + case FactoryMethodArgumentIsBytes: + try { + value = _valueFactoryMethod.invoke(valueFactoryClass()==null?_valueClass:valueFactoryClass(), _NSStringUtilities.bytesForString(str, "UTF-8")); + if (!NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelInformational, NSLog.DebugGroupDatabaseAccess)) + break; + if (NSLog.debugLoggingAllowedForLevel(NSLog.DebugLevelDetailed)) + NSLog.debug.appendln(new RuntimeException("Deprecated implicit String->bytes conversion. Assuming UTF-8 encoding.")); + else + NSLog.debug.appendln("Deprecated implicit String->bytes conversion. Assuming UTF-8 encoding. Set debug level to NSLog.DebugLevelDetailed for more information."); + } catch (IllegalAccessException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (IllegalArgumentException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (InvocationTargetException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (NoSuchMethodException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } + break; + + case FactoryMethodArgumentIsData: + try { + value = _valueFactoryMethod.invoke(valueFactoryClass()==null?_valueClass:valueFactoryClass(), new NSData(str, "UTF-8")); + if (!NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelInformational, NSLog.DebugGroupDatabaseAccess)) + break; + if (NSLog.debugLoggingAllowedForLevel(NSLog.DebugLevelDetailed)) + NSLog.debug.appendln(new RuntimeException("Deprecated implicit String->NSData conversion. Assuming UTF-8 encoding.")); + else + NSLog.debug.appendln("Deprecated implicit String->NSData conversion. Assuming UTF-8 encoding. Set debug level to NSLog.DebugLevelDetailed for more information."); + } catch (IllegalAccessException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (IllegalArgumentException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (InvocationTargetException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (NoSuchMethodException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } + break; + } + return value; + } + + public Class valueFactoryClass() { + return _valueFactoryClass; + } + + public String valueFactoryClassName() { + return _valueFactoryClassName; + } + + public String valueFactoryMethodName() { + return _valueFactoryMethodName; + } + + public NSSelector valueFactoryMethod() { + return _valueFactoryMethod; + } + + public Object adaptorValueByConvertingAttributeValue(Object value) { + Object convertedValue = value; + NSSelector conversionMethod = adaptorValueConversionMethod(); + Class conversionClass = adaptorValueConversionClass(); + if (conversionMethod != null) + try { + if (conversionClass != null) { + convertedValue = conversionMethod.invoke(conversionClass,new Object[]{value}); + } else { + convertedValue = conversionMethod.invoke(value); + } + } catch (NoSuchMethodException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (InvocationTargetException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (IllegalAccessException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (IllegalArgumentException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } + int valueType = adaptorValueType(); + if(!(AdaptorDateType == valueType && conversionMethod != null && Date.class.isInstance(convertedValue))) { + if (!valueClasses[valueType].isInstance(convertedValue) && (valueClasses[valueType] != Number.class || !(convertedValue instanceof Boolean))) { + EOEntity parentEntity = (EOEntity) parent(); + String entityName = parentEntity == null ? "<unspecified>" : parentEntity.name(); + throw new IllegalArgumentException((new StringBuilder()).append("Unable to convert value of class ").append(convertedValue.getClass().getName()).append(" for attribute '").append(name()).append("' in entity '").append(entityName).append("' to adaptor type EOAttribute.Adaptor").append(valueTypeNames[valueType]).append("Type. Check the signature of the conversion method ").append(className()).append(".").append(conversionMethod == null ? "NotFound" : conversionMethod.name()).append("().").toString()); + } + } + return convertedValue; + } + + public String adaptorValueConversionMethodName() { + return _adaptorValueConversionMethodName; + } + + public NSSelector adaptorValueConversionMethod() { + return _adaptorValueConversionMethod; + } + + public String adaptorValueConversionClassName() { + return _adaptorValueConversionClassName; + } + + public Class adaptorValueConversionClass() { + return _adaptorValueConversionClass; + } + + public int adaptorValueType() { + if (_adaptorValueType != -1) + return _adaptorValueType; + String className = className();//_valueClassName; + if (className == null) + className = CN_NSData; + Class valueClass = _NSUtilities.classWithName(className); + if (valueClass == null) + throw new IllegalStateException((new StringBuilder()).append("adaptorValueType: unable to load class named '").append(className).append("' for attribute ").append(name()).append(" on entity ").append(entity().name()).toString()); + if (valueFactoryMethodName() == null) { + if (valueClass == String.class) + _adaptorValueType = AdaptorCharactersType; + else if (_NSUtilities._isClassANumberOrABoolean(valueClass)) + _adaptorValueType = AdaptorNumberType; + else if (NSTimestamp.class.isAssignableFrom(valueClass)) + _adaptorValueType = AdaptorDateType; + else if (NSData.class.isAssignableFrom(valueClass)) + _adaptorValueType = AdaptorBytesType; + } + else if (_argumentType == FactoryMethodArgumentIsString) + _adaptorValueType = AdaptorCharactersType; + else if (_argumentType == FactoryMethodArgumentIsData) + _adaptorValueType = AdaptorBytesType; + else if (_argumentType == FactoryMethodArgumentIsDate) + _adaptorValueType = AdaptorDateType; + else if (_argumentType == FactoryMethodArgumentIsBytes) + _adaptorValueType = AdaptorBytesType; + if (_adaptorValueType == -1) + _adaptorValueType = AdaptorBytesType; + return _adaptorValueType; + } + + /** + * @return adaptorValueClass + * @deprecated Method _adaptorValueClass is deprecated + */ + protected Class _adaptorValueClass() { + return adaptorValueClass(); + } + + public Class adaptorValueClass() { + switch (adaptorValueType()) { + case AdaptorCharactersType: + return String.class; + + case AdaptorDateType: + return NSTimestamp.class; + + case AdaptorNumberType: + switch (_valueTypeChar()) { + case _VTBoolean: + return Boolean.class; + + case _VTShort: + return Short.class; + + case _VTInteger: + return Integer.class; + + case _VTLong: + return Long.class; + + case _VTFloat: + return Float.class; + + case _VTDouble: + return Double.class; + + case _VTBigDecimal: + return BigDecimal.class; + + case _VTByte: + return Byte.class; + } + if (NSLog.debugLoggingAllowedForLevel(NSLog.DebugLevelInformational)) + NSLog.debug.appendln((new StringBuilder()).append("value type '").append(_valueTypeChar()).append("' on attribute \"").append(name()).append("\" of entity \"").append(entity().name()).append("\" is invalid.\nYou should fix your EOModel.").toString()); + return Integer.class; + + case AdaptorBytesType: + if (adaptorValueConversionMethod() != null && factoryMethodArgumentType() == FactoryMethodArgumentIsString) + return String.class; + + return NSData.class; + } + return Object.class; + } + + public String valueTypeClassName() { + if (_valueTypeClassName == null) + _valueTypeClassName = ""; + if (_valueTypeClassName.length() == 0) { + String className = _valueClassName == null ? NSData.class.getName() : _valueClassName; + try { + if (valueFactoryMethodName() == null) { + Class valueClass = _NSUtilities.classWithName(className); + if (valueClass != null) { + if (_NSUtilities._isClassANumberOrABoolean(valueClass)) + switch (_valueTypeChar()) { + case _VTByte: + valueClass = Byte.class; + break; + + case _VTShort: + valueClass = Short.class; + break; + + case _VTInteger: + valueClass = Integer.class; + break; + + case _VTLong: + valueClass = Long.class; + break; + + case _VTFloat: + valueClass = Float.class; + break; + + case _VTDouble: + valueClass = Double.class; + break; + + case _VTBigDecimal: + valueClass = BigDecimal.class; + break; + + case _VTBoolean: + valueClass = Boolean.class; + break; + + default: + if (NSLog.debugLoggingAllowedForLevel(2)) + NSLog.debug.appendln((new StringBuilder()).append("value type '").append(_valueTypeChar()).append("' on attribute \"").append(name()).append("\" of entity \"").append(entity().name()).append("\" is invalid.\nYou should fix your EOModel.").toString()); + valueClass = Integer.class; + break; + } + className = valueClass.getName(); + } + } + } + catch (Throwable exception) { + } + _valueTypeClassName = className; + } + return _valueTypeClassName; + } + + public int factoryMethodArgumentType() { + return _argumentType; + } + + public void setFactoryMethodArgumentType(int argumentType) { + _setFactoryMethodArgumentType(argumentType); + _setOverrideForCharacteristic(Characteristic.FactoryMethodArgumentType); + } + + private void _setFactoryMethodArgumentType(int argumentType) { + _argumentType = argumentType; + if (_valueFactoryMethodName != null) + _valueFactoryMethod = new NSSelector(_valueFactoryMethodName, _classForArgumentType()); + } + + private Class[] _classForArgumentType() { + if (_argumentType == FactoryMethodArgumentIsString) + return _NSUtilities._StringClassArray; + if (_argumentType == FactoryMethodArgumentIsData) + return (new Class[] { NSData.class }); + if (_argumentType == FactoryMethodArgumentIsDate) + return (new Class[] { Date.class }); + if (_argumentType == FactoryMethodArgumentIsBytes) + return (new Class[] { byte[].class }); + + return null; + } + + public void setValueFactoryClassName(String factoryClassName) { + _setValueFactoryClassName(factoryClassName); + _setOverrideForCharacteristic(Characteristic.ValueFactoryClassName); + } + + private void _setValueFactoryClassName(String factoryClassName) { + if(factoryClassName != null && factoryClassName.length() != 0) { + _valueFactoryClassName = factoryClassName; + try { + _valueFactoryClass = Class.forName(factoryClassName); + } catch(ClassNotFoundException e) { + _valueFactoryClassName = null; + } + } else { + _valueFactoryClassName = null; + _valueFactoryClass = null; + } + } + + public void setValueFactoryMethodName(String factoryMethodName) { + _setValueFactoryMethodName(factoryMethodName); + _setOverrideForCharacteristic(Characteristic.ValueFactoryMethodName); + } + + private void _setValueFactoryMethodName(String factoryMethodName) { + if (factoryMethodName != null && factoryMethodName.length() != 0) { + if (factoryMethodName.endsWith(":")) { + _valueFactoryMethodName = factoryMethodName.substring(0, factoryMethodName.length() - 1); + } else { + _valueFactoryMethodName = factoryMethodName; + } + _valueFactoryMethod = new NSSelector(_valueFactoryMethodName, _classForArgumentType()); + } else { + _valueFactoryMethodName = null; + _valueFactoryMethod = null; + } + } + + public void setAdaptorValueConversionClassName(String conversionClassName) { + _setAdaptorValueConversionClassName(conversionClassName); + _setOverrideForCharacteristic(Characteristic.AdaptorValueConversionClassName); + } + + private void _setAdaptorValueConversionClassName(String conversionClassName) { + if (conversionClassName != null && conversionClassName.length() != 0) { + _adaptorValueConversionClassName = conversionClassName; + try { + _adaptorValueConversionClass = Class.forName(conversionClassName); + } catch (ClassNotFoundException e) { + _adaptorValueConversionClassName = null; + } + } else { + _adaptorValueConversionClassName = null; + _adaptorValueConversionClass = null; + } + } + + public void setAdaptorValueConversionMethodName(String conversionMethodName) { + _setAdaptorValueConversionMethodName(conversionMethodName); + _setOverrideForCharacteristic(Characteristic.AdaptorValueConversionMethodName); + } + + private void _setAdaptorValueConversionMethodName(String conversionMethodName) { + if (conversionMethodName != null && conversionMethodName.length() != 0) { + _adaptorValueConversionMethodName = conversionMethodName; + if(adaptorValueConversionClass()!=null) { + Class valueClass = _NSUtilities.classWithName(className()); + _adaptorValueConversionMethod = new NSSelector(_adaptorValueConversionMethodName, new Class[]{valueClass}); + } else { + _adaptorValueConversionMethod = new NSSelector(_adaptorValueConversionMethodName, null); + } + } else { + _adaptorValueConversionMethodName = null; + _adaptorValueConversionMethod = null; + } + } + + public Object validateValue(Object valueP) throws com.webobjects.foundation.NSValidation.ValidationException { + Object value = valueP; + if (value == null || value == NSKeyValueCoding.NullValue) { + if (allowsNull()) + return valueP; + if (entity().primaryKeyAttributes().indexOfIdenticalObject(this) != -1) + return valueP; + + throw new com.webobjects.foundation.NSValidation.ValidationException((new StringBuilder()).append("The ").append(name()).append(" property of ").append(entity().name()).append(" is not allowed to be null.").toString(), this, name()); + } + String className = className(); + if (className == null) + return valueP; + Class aClass = _NSUtilities.classWithName(className); + if (aClass == null) { + if (NSLog.debugLoggingAllowedForLevelAndGroups(2, 128L)) + NSLog.debug.appendln((new StringBuilder()).append("Unable to find the class ").append(className).append(" in the Java runtime. Unable to validate. Please check your CLASSPATH, or the type for attribute ").append(name()).toString()); + return valueP; + } + if (!aClass.isInstance(value)) { + value = _NSUtilities.tryToConvertIntoNumberOrBooleanValueClass(value, aClass); + if (!aClass.isInstance(value)) { + String valueString = value.toString(); + try { + if (aClass == BigDecimal.class) + value = new BigDecimal(valueString); + else if (Number.class.isAssignableFrom(aClass)) + value = _EOStringUtil.numberWithStringType(valueString, _valueTypeChar()); + } + catch (Exception e) { + throw new com.webobjects.foundation.NSValidation.ValidationException((new StringBuilder()).append("Error encountered converting value of class ").append(value.getClass().getName()).append(" to type specified in attribute '").append(name()).append("' of entity '").append(entity().name()).append("'").toString(), this, name()); + } + } + } + if (value == null) + throw new com.webobjects.foundation.NSValidation.ValidationException((new StringBuilder()).append("Error encountered converting null value to type specified in attribute '").append(name()).append("' of entity '").append(entity().name()).append("'").toString(), this, name()); + int maxLen = width(); + if (maxLen != 0) { + int currLength = 0; + Object primitiveValue; + try { + primitiveValue = adaptorValueByConvertingAttributeValue(value); + } + catch (Exception e) { + throw new com.webobjects.foundation.NSValidation.ValidationException((new StringBuilder()).append("Error encountered converting value of class ").append(value.getClass().getName()).append(" to type specified in attribute '").append(name()).append("' of entity '").append(entity().name()).append("'. Conversion exception is : ").append(e.getMessage()).toString(), this, name()); + } + if (primitiveValue instanceof String) + currLength = ((String) primitiveValue).length(); + else if (primitiveValue instanceof NSData) + currLength = ((NSData) primitiveValue).length(); + if (currLength > maxLen) + throw new com.webobjects.foundation.NSValidation.ValidationException((new StringBuilder()).append("The ").append(name()).append(" property of ").append(entity().name()).append(" exceeds maximum length of ").append(maxLen).append(" characters").toString(), this, name()); + } + return value; + } + + boolean referencesProperty(Object property) { + if (_definitionArray == null) + return false; + + return _definitionArray.referencesObject(property); + } + + void setParent(Object parent) { + if (parent == null) { + _parent = null; + _parentStoredProcedure = null; + } else if (parent instanceof EOEntity) { + _parent = (EOEntity) parent; + _parentStoredProcedure = null; + } else if (parent instanceof EOStoredProcedure) { + _parent = null; + _parentStoredProcedure = (EOStoredProcedure) parent; + } else { + throw new IllegalArgumentException((new StringBuilder()).append("Invalid object of type ").append(parent.getClass().getName()).append(" passed to setParent (expected EOEntity or EOStoredProcedure").toString()); + } + } + + void setEntity(EOEntity entity) { + if (_parent == entity) + return; + if (_parent != null && this == _parent_attributeNamed(name())) + _parent_removeAttribute(this); + setParent(entity); + } + + public void _setSourceToDestinationKeyMap(NSDictionary mapping) { + _sourceToDestinationKeyMap = mapping; + } + + public NSDictionary _sourceToDestinationKeyMap() { + if (_sourceToDestinationKeyMap == null) + _sourceToDestinationKeyMap = entity()._keyMapForRelationshipPath(relationshipPath()); + return _sourceToDestinationKeyMap; + } + + public String relationshipPath() { + if (!isFlattened()) + return null; + StringBuffer relPath = new StringBuffer(); + int iCount = _definitionArray.count() - 1; + for (int i = 0; i < iCount; i++) { + if (i > 0) + relPath.append('.'); + relPath.append(((EORelationship) _definitionArray.objectAtIndex(i)).name()); + } + + return new String(relPath); + } + + EOAttribute targetAttribute() { + if (!isFlattened()) + return null; + + return (EOAttribute) _definitionArray.lastObject(); + } + + public String _setNewFormatStringOld(String newString, String old) { + if (old == null || !old.equals(newString)) { + _parent_setIsEdited(); + return newString == null || newString.length() <= 0 ? null : newString; + } + + return old; + } + + public int _factoryMethodArgumentTypeFromString(String string) { + String aString = (string == null ? "" : string).toLowerCase(); + if (aString.equals(FactoryMethodArgumentIsBytesString.toLowerCase())) + return FactoryMethodArgumentIsBytes; + if (aString.equals(FactoryMethodArgumentIsStringString.toLowerCase())) + return FactoryMethodArgumentIsString; + if (aString.equals(FactoryMethodArgumentIsDateString.toLowerCase())) + return FactoryMethodArgumentIsDate; + return !aString.equals("EOFactoryMethodArgumentIsNSString".toLowerCase()) ? FactoryMethodArgumentIsData : FactoryMethodArgumentIsString; + } + + public String _stringForFactoryMethodArgumentType(int type) { + switch (type) { + case FactoryMethodArgumentIsBytes: + return FactoryMethodArgumentIsBytesString; + + case FactoryMethodArgumentIsString: + return FactoryMethodArgumentIsStringString; + + case FactoryMethodArgumentIsData: + return FactoryMethodArgumentIsDataString; + + case FactoryMethodArgumentIsDate: + return FactoryMethodArgumentIsDateString; + } + return FactoryMethodArgumentIsDataString; + } + + protected _EOExpressionArray _definitionArray() { + return _definitionArray; + } + + protected void _setDefinitionArray(_EOExpressionArray definitionArray) { + if (_definitionArray == definitionArray) { + return; + } + _definitionArray = definitionArray; + _setValuesFromTargetAttribute(); + _removeFromEntityArraySelector(entity().primaryKeyAttributes(), _setPrimaryKeyAttributesSelector); + _parent_setIsEdited(); + return; + } + + protected void _setDefinitionWithoutFlushingCaches(String definition) { + if (_parent != null) { + _columnName = null; + if (definition == null) { + _definitionArray = null; + return; + } + Object exprArray = _parent._parseDescriptionIsFormatArguments(definition, false, null); + if (exprArray != null) { + if (!(exprArray instanceof _EOExpressionArray)) + exprArray = new _EOExpressionArray(exprArray); + exprArray = _normalizeDefinitionPath(exprArray, null); + _definitionArray = (_EOExpressionArray) exprArray; + } + _removeFromEntityArraySelector(_parent_primaryKeyAttributes(), _setPrimaryKeyAttributesSelector); + } + } + + protected void _setValuesFromTargetAttribute() { + if (isFlattened()) { + EOAttribute property = (EOAttribute) _definitionArray.lastObject(); + setExternalType(property.externalType()); + setClassName(property.className()); + setValueType(property.valueType()); + setWidth(property.width()); + setAllowsNull(property.allowsNull()); + setReadFormat(property.readFormat()); + setWriteFormat(property.writeFormat()); + setReadOnly(property.isReadOnly()); + setParameterDirection(property.parameterDirection()); + setUserInfo(property.userInfo()); + _setInternalInfo(property._internalInfo()); + int adaptorDataType = property.adaptorValueType(); + if (adaptorDataType == AdaptorNumberType) { + setPrecision(property.precision()); + setScale(property.scale()); + } + else if (adaptorDataType == AdaptorDateType) + setServerTimeZone(property.serverTimeZone()); + else if (adaptorDataType == AdaptorBytesType) { + setValueFactoryClassName(property.valueFactoryClassName()); + setValueFactoryMethodName(property.valueFactoryMethodName()); + setAdaptorValueConversionClassName(property.adaptorValueConversionClassName()); + setAdaptorValueConversionMethodName(property.adaptorValueConversionMethodName()); + setFactoryMethodArgumentType(property.factoryMethodArgumentType()); + } + } + } + + protected Object _objectForPlist(Object plist) { + if (plist instanceof String) + return plist; + if (!(plist instanceof NSDictionary)) + return null; + NSDictionary pl = (NSDictionary) plist; + String string; + if ((string = (String) pl.objectForKey("name")) != null) + return entity()._parsePropertyName(string); + if ((string = (String) pl.objectForKey("path")) != null) + return entity()._parsePropertyName(string); + NSArray array; + if ((array = (NSArray) pl.objectForKey("array")) == null) + return null; + _EOExpressionArray result = new _EOExpressionArray(); + if ((string = (String) pl.objectForKey("prefix")) != null) + result.setPrefix(string); + if ((string = (String) pl.objectForKey("infix")) != null) + result.setInfix(string); + if ((string = (String) pl.objectForKey("suffix")) != null) + result.setSuffix(string); + int count = array.count(); + for (int i = 0; i < count; i++) { + Object object = array.objectAtIndex(i); + if ((object = _objectForPlist(object)) != null) + result.addObject(object); + } + + return result; + } + + protected void _removeFromEntityArraySelector(NSArray oldArray, NSSelector sel) { + if (oldArray.indexOfObject(this) != -1) { + NSMutableArray newArray = new NSMutableArray(oldArray); + newArray.removeIdenticalObject(this); + try { + sel.invoke(entity(), newArray); + } catch (IllegalAccessException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (IllegalArgumentException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (InvocationTargetException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } catch (NoSuchMethodException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } + } + } + + protected Object _normalizeDefinitionPath(Object definition, NSArray attributePath) { + NSArray path = null; + if (attributePath != null) + path = attributePath; + else + path = NSArray.emptyArray(); + if (definition instanceof String) + return definition; + Object nDefinition; + if (definition instanceof EOAttribute) { + EOAttribute attribute = (EOAttribute) definition; + if (attribute == this) + return null; + if (attribute.isDerived()) { + _EOExpressionArray attrDef = attribute._definitionArray(); + nDefinition = _normalizeDefinitionPath(attrDef, path); + if (nDefinition == null) + return null; + } else if (path.count() == 0) { + nDefinition = attribute; + } else { + _EOExpressionArray newPath = new _EOExpressionArray(); + newPath.setInfix("."); + newPath.addObjectsFromArray(path); + newPath.addObject(attribute); + nDefinition = newPath; + } + return nDefinition; + } + int cnt; + if (((_EOExpressionArray) definition)._isPropertyPath()) { + _EOExpressionArray newPath = new _EOExpressionArray(); + newPath.setInfix("."); + newPath.addObjectsFromArray(path); + cnt = ((_EOExpressionArray) definition).count() - 1; + for (int i = 0; i < cnt; i++) + newPath.addObject(((_EOExpressionArray) definition).objectAtIndex(i)); + + EOAttribute attribute = (EOAttribute) ((_EOExpressionArray) definition).lastObject(); + if (attribute.isDerived()) { + _EOExpressionArray attrDef = attribute._definitionArray(); + nDefinition = _normalizeDefinitionPath(attrDef, newPath); + if (nDefinition == null) + return null; + } else { + newPath.addObject(attribute); + nDefinition = newPath; + } + return nDefinition; + } + nDefinition = new _EOExpressionArray(); + cnt = ((_EOExpressionArray) definition).count(); + for (int i = 0; i < cnt; i++) { + Object elem = ((_EOExpressionArray) definition).objectAtIndex(i); + Object nElem = _normalizeDefinitionPath(elem, path); + if (nElem == null) + return null; + if ((nElem instanceof _EOExpressionArray) && !((_EOExpressionArray) nElem)._isPropertyPath()) { + int jcnt = ((_EOExpressionArray) nElem).count(); + for (int j = 0; j < jcnt; j++) + ((_EOExpressionArray) nDefinition).addObject(((_EOExpressionArray) nElem).objectAtIndex(j)); + + } else { + ((_EOExpressionArray) nDefinition).addObject(nElem); + } + } + + return nDefinition; + } + + public void _flushCache() { + } + + public String valueForSQLExpression(EOSQLExpression context) { + if (context != null) + return context.sqlStringForAttribute(this); + if (_definitionArray != null) + return _definitionArray.valueForSQLExpression(context); + + return name(); + } + + protected EOAttribute(EOEntity entity, String definition) { + this(); + _name = definition; + setParent(entity); + setDefinition(definition); + } + + public static final int FactoryMethodArgumentIsData = 0; + public static final int FactoryMethodArgumentIsString = 1; + public static final int FactoryMethodArgumentIsBytes = 2; + public static final int FactoryMethodArgumentIsDate = 3; + public static final int AdaptorNumberType = 0; + public static final int AdaptorCharactersType = 1; + public static final int AdaptorBytesType = 2; + public static final int AdaptorDateType = 3; + public static final int Void = 0; + public static final int InParameter = 1; + public static final int OutParameter = 2; + public static final int InOutParameter = 3; + private static final NSSelector _setPrimaryKeyAttributesSelector; + protected String _name; + protected EOEntity _parent; + protected EOStoredProcedure _parentStoredProcedure; + protected String _prototypeName; + protected EOAttribute _prototype; + protected String _columnName; + protected _EOExpressionArray _definitionArray; + protected String _externalType; + protected String _valueType; + protected String _valueClassName; + protected String _className; + protected int _adaptorValueType; + protected String _valueTypeClassName; + protected String _readFormat; + protected String _writeFormat; + protected TimeZone _serverTimeZone; + protected int _width; + protected int _precision; + protected int _scale; + protected Class _valueClass; + int _argumentType; + protected String _valueFactoryClassName; + protected String _valueFactoryMethodName; + protected Class _valueFactoryClass; + protected String _adaptorValueConversionMethodName; + protected String _adaptorValueConversionClassName; + protected Class _adaptorValueConversionClass; + protected NSSelector _valueFactoryMethod; + protected NSSelector _adaptorValueConversionMethod; + protected boolean _flags_allowsNull; + protected boolean _flags_isReadOnly; + protected boolean _flags_isNonUpdateable; + protected boolean _flags_isNonUpdateableInitialized; + protected NSDictionary _sourceToDestinationKeyMap; + protected int _parameterDirection; + protected NSDictionary _userInfo; + public NSDictionary _internalInfo; + private static final String CN_JavaString = "java.lang.String"; + private static final String CN_JavaNumber = "java.lang.Number"; + private static final String CN_JavaBigDecimal = "java.math.BigDecimal"; + private static final String CN_JavaNSTimestamp = "com.webobjects.foundation.NSTimestamp"; + private static final String CN_JavaNSData = "com.webobjects.foundation.NSData"; + private static final String CN_NSString = "NSString"; + private static final String CN_NSNumber = "NSNumber"; + private static final String CN_NSDecimalNumber = "NSDecimalNumber"; + private static final String CN_NSCalendarDate = "NSCalendarDate"; + private static final String CN_NSGregorianDate = "NSGregorianDate"; + private static final String CN_NSData = "NSData"; + private static final String CN_NSPrefix = "NS"; + public static final char _VTByte = 'b'; + public static final char _VTShort = 's'; + public static final char _VTInteger = 'i'; + public static final char _VTLong = 'l'; + public static final char _VTFloat = 'f'; + public static final char _VTDouble = 'd'; + public static final char _VTBigDecimal = 'B'; + public static final char _VTBoolean = 'c'; + public static final char _VTDate = 'D'; + public static final char _VTTime = 't'; + public static final char _VTTimestamp = 'T'; + public static final char _VTString = 'S'; + public static final char _VTCharStream = 'C'; + public static final char _VTEncodedBytes = 'E'; + public static final char _VTCharTrimString = 'c'; + public static final char _VTUnknown = ' '; + public static final char _VTCoerceDate = 'M'; + public static final String FactoryMethodArgumentIsBytesString = "EOFactoryMethodArgumentIsBytes"; + public static final String FactoryMethodArgumentIsStringString = "EOFactoryMethodArgumentIsString"; + public static final String FactoryMethodArgumentIsDataString = "EOFactoryMethodArgumentIsData"; + public static final String FactoryMethodArgumentIsDateString = "EOFactoryMethodArgumentIsDate"; + private Map _overwrittenCharacteristics; + private static Class valueClasses[]; + private static String valueTypeNames[] = { "Number", "Characters", "Bytes", "Date" }; + + static { + _setPrimaryKeyAttributesSelector = new NSSelector("setPrimaryKeyAttributes", _NSUtilities._ArrayClassArray); + valueClasses = (new Class[] { Number.class, String.class, NSData.class, NSTimestamp._CLASS }); + } +} Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/com/webobjects/jdbcadaptor/DateJDBCColumn.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/com/webobjects/jdbcadaptor/DateJDBCColumn.java (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/com/webobjects/jdbcadaptor/DateJDBCColumn.java 2011-02-27 05:01:51 UTC (rev 11999) @@ -0,0 +1,68 @@ +package com.webobjects.jdbcadaptor; + + + +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.apache.log4j.Logger; + +import com.webobjects.eoaccess.EOAttribute; +import com.webobjects.foundation.NSForwardException; +import com.webobjects.foundation.NSKeyValueCoding; + +import er.extensions.jdbc.ERXJDBCAdaptor.Channel; + +public class DateJDBCColumn extends ERXJDBCColumn { + private static final Logger log = Logger.getLogger(DateJDBCColumn.class); + + public DateJDBCColumn(EOAttribute attribute, JDBCChannel channel, int column, ResultSet rs) { + super(attribute, channel, column, rs); + } + + public DateJDBCColumn(Channel aChannel) { + super(aChannel); + } + + Object _fetchValue(boolean flag) { + if (_rs == null || _column < 1) { + throw new JDBCAdaptorException(" *** JDBCColumn : trying to fetchValue on a null ResultSet [" + _rs + "] or unknow col [" + _column + "]!!", null); + } + /* + * Add support for custom date types + */ + if(_adaptorValueType == EOAttribute.AdaptorDateType) { + Object obj = null; + try { + switch(_valueType) { + case EOAttribute._VTDate: + case EOAttribute._VTCoerceDate: + obj = _rs.getDate(_column); + break; + case EOAttribute._VTTime: + obj = _rs.getTime(_column); + break; + case EOAttribute._VTTimestamp: + obj = _rs.getTimestamp(_column); + break; + default: + obj = _rs.getObject(_column); + break; + } + if(_rs.wasNull() || obj == null) { + return NSKeyValueCoding.NullValue; + } + } catch(SQLException e) { + throw new JDBCAdaptorException(e); + } + + return _attribute.newValueForDate(obj); + } + try { + return super._fetchValue(flag); + } catch(NSForwardException ex) { + log.error("There's an error with this attribute: " + _attribute); + throw ex; + } + } +} Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/er/attributeextension/ERAttributeExtension.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/er/attributeextension/ERAttributeExtension.java (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/Sources/er/attributeextension/ERAttributeExtension.java 2011-02-27 05:01:51 UTC (rev 11999) @@ -0,0 +1,32 @@ +package er.attributeextension; + +import org.apache.log4j.Logger; + +import er.extensions.ERXExtensions; +import er.extensions.ERXFrameworkPrincipal; + +public class ERAttributeExtension extends ERXFrameworkPrincipal { + public static final Class<?>[] REQUIRES = new Class[] { ERXExtensions.class }; + + private static final Logger log = Logger.getLogger(ERAttributeExtension.class); + + protected static ERAttributeExtension sharedInstance; + + // Registers the class as the framework principal + static { + log.debug("Static Initializer for ERAttributeExtension"); + setUpFrameworkPrincipalClass(ERAttributeExtension.class); + } + + public static ERAttributeExtension sharedInstance() { + if (sharedInstance == null) { + sharedInstance = sharedInstance(ERAttributeExtension.class); + } + return sharedInstance; + } + + @Override + public void finishInitialization() { + } + +} Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/build.properties =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/build.properties (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/build.properties 2011-02-27 05:01:51 UTC (rev 11999) @@ -0,0 +1,15 @@ +#Sun Jan 30 10:38:32 EST 2011 +cfBundleID=org.mywoapp +cfBundleShortVersion= +cfBundleVersion= +classes.dir=bin +component.inlineBindingPrefix=$ +component.inlineBindingSuffix= +component.wellFormedTemplateRequired=false +customInfoPListContent= +eoAdaptorClassName= +javaVersion=1.5+ +principalClass=er.attributeextension.ERAttributeExtension +project.name=ERAttributeExtension +project.name.lowercase=erattributeextension +project.type=framework Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/build.xml =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/build.xml (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/build.xml 2011-02-27 05:01:51 UTC (rev 11999) @@ -0,0 +1,105 @@ +<project name="ERAttributeExtension" default="build" basedir="."> + <target name="build" depends="init.build,build.woframework,javaclient,package" /> + + <target name="install" depends="init.install,build.woframework,javaclient" /> + + <target name="clean" depends="init.properties"> + <delete dir="bin" /> + <delete dir="dist" /> + </target> + + <!-- property determination --> + <target name="init.properties"> + <property file="build.properties" /> + + <property name="wolips.properties" value="${user.home}${file.separator}Library${file.separator}Application Support${file.separator}WOLips${file.separator}wolips.properties" /> + <property file="${wolips.properties}" /> + <condition property="wo.properties.check.failed"> + <not> + <and> + <isset property="wo.system.frameworks" /> + <isset property="wo.local.frameworks" /> + </and> + </not> + </condition> + <fail message="The properties 'wo.system.frameworks' and 'wo.local.frameworks' must be set. Check that your ${wolips.properties} is correct." if="wo.properties.check.failed" /> + + <property name="wo.install.root" value="${wo.local.frameworks}" /> + </target> + + <!-- basic initializations --> + <target name="init.install" depends="init.properties"> + <tstamp /> + <property name="dest.dir" value="${wo.install.root}" /> + </target> + + <target name="init.build" depends="init.properties"> + <tstamp /> + <property name="dest.dir" value="dist" /> + </target> + + <target name="package"> + <tar destfile="${dest.dir}/${project.name}.tar.gz" + compression="gzip" + longfile="gnu"> + <tarfileset dir="${dest.dir}"> + <include name="${project.name}.framework/**"/> + </tarfileset> + </tar> + </target> + + <!-- woproject tasks --> + <target name="build.woframework" depends="compile"> + <taskdef name="woframework" classname="org.objectstyle.woproject.ant.WOFramework"/> + + <woframework name="${project.name}" destDir="${dest.dir}" customInfoPListContent="${customInfoPListContent}" principalClass="${principalClass}" eoAdaptorClassName="${eoAdaptorClassName}" javaVersion="${javaVersion}" cfbundleversion="${cfBundleVersion}" cfbundleshortversion="${cfBundleShortVersion}" cfbundleID="${cfBundleID}"> + <classes dir="${classes.dir}"> + <includesfile name="woproject/classes.include.patternset" /> + <excludesfile name="woproject/classes.exclude.patternset" /> + <exclude if="javaClient" name="**/client/**/*.*"/> + </classes> + + <wsresources dir="."> + <includesfile name="woproject/wsresources.include.patternset" /> + <excludesfile name="woproject/wsresources.exclude.patternset" /> + </wsresources> + + <resources dir="."> + <includesfile name="woproject/resources.include.patternset" /> + <excludesfile name="woproject/resources.exclude.patternset" /> + <exclude if="javaClient" name="**/client/**/*.*"/> + </resources> + + <lib dir="Libraries"> + <include name="*.jar" /> + </lib> + </woframework> + </target> + + <target name="javaclient" if="javaClient" depends="build.woframework"> + <mkdir dir="${dest.dir}/${project.name}.framework/WebServerResources/Java" /> + <jar basedir="${classes.dir}" excludes="**/server/**/*.*, **/server/**/" jarfile="${dest.dir}/${project.name}.framework/WebServerResources/Java/${project.name}.jar"/> + </target> + + <target name="compile" depends="init.build"> + <taskdef name="wocompile" classname="org.objectstyle.woproject.ant.WOCompile" /> + + <mkdir dir="bin" /> + <wocompile srcdir="Sources" destdir="bin"> + <frameworks root="ProjectLocal" embed="false" eclipse="true" /> + <frameworks root="External" embed="false" eclipse="true" /> + <frameworks root="Local" embed="false" eclipse="true" /> + <frameworks root="User" embed="false" eclipse="true" /> + <frameworks root="System" embed="false" eclipse="true" /> + <frameworks root="Network" embed="false" eclipse="true" /> + <classpath> + <fileset dir="Libraries"> + <include name="*.jar" /> + </fileset> + <fileset dir="${wo.extensions}"> + <include name="*.jar" /> + </fileset> + </classpath> + </wocompile> + </target> +</project> Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/classes.exclude.patternset =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/classes.exclude.patternset (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/classes.exclude.patternset 2011-02-27 05:01:51 UTC (rev 11999) @@ -0,0 +1 @@ +build.properties Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/classes.include.patternset =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/classes.include.patternset (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/classes.include.patternset 2011-02-27 05:01:51 UTC (rev 11999) @@ -0,0 +1,2 @@ +**/*.class +*.properties Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/resources.exclude.patternset =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/resources.exclude.patternset (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/resources.exclude.patternset 2011-02-27 05:01:51 UTC (rev 11999) @@ -0,0 +1,3 @@ +**/*.eomodeld~/ +**/*.woa/** +**/*.framework/** Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/resources.include.patternset =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/resources.include.patternset (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/resources.include.patternset 2011-02-27 05:01:51 UTC (rev 11999) @@ -0,0 +1,3 @@ +Components/**/*.wo/**/* +Components/**/*.api +Resources/**/* \ No newline at end of file Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/wsresources.exclude.patternset =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/wsresources.exclude.patternset (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/wsresources.exclude.patternset 2011-02-27 05:01:51 UTC (rev 11999) @@ -0,0 +1,3 @@ +**/*.woa/** +**/*.framework/** +**/*.eomodeld~/** Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/wsresources.include.patternset =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/wsresources.include.patternset (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/woproject/wsresources.include.patternset 2011-02-27 05:01:51 UTC (rev 11999) @@ -0,0 +1 @@ +WebServerResources/**/* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nullterminated@us...> - 2011-02-27 05:00:05
|
Revision: 11998 http://wonder.svn.sourceforge.net/wonder/?rev=11998&view=rev Author: nullterminated Date: 2011-02-27 04:59:59 +0000 (Sun, 27 Feb 2011) Log Message: ----------- New ERAttributeExtension framework to override WO 5.4's EOAttribute Added Paths: ----------- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERAttributeExtension/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nullterminated@us...> - 2011-02-27 04:57:15
|
Revision: 11997 http://wonder.svn.sourceforge.net/wonder/?rev=11997&view=rev Author: nullterminated Date: 2011-02-27 04:57:08 +0000 (Sun, 27 Feb 2011) Log Message: ----------- Updated ERXJDBCAdaptor to allow for custom ERXJDBCColumn subclass to be specified by class name in properties. Modified Paths: -------------- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/jdbc/ERXJDBCAdaptor.java Modified: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/jdbc/ERXJDBCAdaptor.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/jdbc/ERXJDBCAdaptor.java 2011-02-27 04:55:54 UTC (rev 11996) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/jdbc/ERXJDBCAdaptor.java 2011-02-27 04:57:08 UTC (rev 11997) @@ -1,7 +1,9 @@ package er.extensions.jdbc; +import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.sql.Connection; +import java.sql.ResultSet; import java.sql.SQLException; import java.util.Iterator; @@ -19,8 +21,10 @@ import com.webobjects.eocontrol.EOQualifier; import com.webobjects.foundation.NSArray; import com.webobjects.foundation.NSDictionary; +import com.webobjects.foundation.NSForwardException; import com.webobjects.foundation.NSMutableArray; import com.webobjects.foundation.NSMutableDictionary; +import com.webobjects.foundation._NSUtilities; import com.webobjects.jdbcadaptor.ERXJDBCColumn; import com.webobjects.jdbcadaptor.JDBCAdaptor; import com.webobjects.jdbcadaptor.JDBCAdaptorException; @@ -101,12 +105,54 @@ */ public static class Channel extends JDBCChannel { + public static final String COLUMN_CLASS_NAME_KEY = "er.extensions.ERXJDBCAdaptor.columnClassName"; + + private static Class columnClass; + + /** + * The class of the JDBCColumn. It must subclass ERXJDBCColumn and provide + * implementations for the same two constructors as ERXJDBCColumn. It is set + * using the property <code>er.extensions.ERXJDBCAdaptor.columnClassName</code> + * If no value is set, then the default class is ERXJDBCColumn. + * + * @return The ERXJDBCColumn subclass + */ + public static Class columnClass() { + if(columnClass == null) { + String className = ERXProperties.stringForKey(COLUMN_CLASS_NAME_KEY); + if(className != null && className.length() > 0) { + columnClass = _NSUtilities.classWithName(className); + } else { + columnClass = ERXJDBCColumn.class; + } + } + return columnClass; + } + + public static ERXJDBCColumn newERXJDBCColumn(Channel channel) { + try { + Constructor<? extends ERXJDBCColumn> cstr = columnClass().getDeclaredConstructor(Channel.class); + return cstr.newInstance(channel); + } catch(Exception e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } + } + + public static ERXJDBCColumn newERXJDBCColumn(EOAttribute attribute, JDBCChannel channel, int column, ResultSet rs) { + try { + Constructor<? extends ERXJDBCColumn> cstr = columnClass().getDeclaredConstructor(EOAttribute.class, JDBCChannel.class, Integer.TYPE, ResultSet.class); + return cstr.newInstance(attribute, channel, column, rs); + } catch(Exception e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } + } + public Channel(JDBCContext jdbccontext) { super(jdbccontext); try { Field field = JDBCChannel.class.getDeclaredField("_inputColumn"); field.setAccessible(true); - field.set(this, new ERXJDBCColumn(this)); + field.set(this, newERXJDBCColumn(this)); } catch (Exception e) { System.err.println(e); @@ -122,7 +168,7 @@ return; ERXJDBCColumn columns[] = new ERXJDBCColumn[j]; for (int i = 0; i < j; i++) - columns[i] = new ERXJDBCColumn((EOAttribute) _attributes.objectAtIndex(i), this, i + 1, _resultSet); + columns[i] = newERXJDBCColumn((EOAttribute) _attributes.objectAtIndex(i), this, i + 1, _resultSet); _selectedColumns = new NSArray(columns); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nullterminated@us...> - 2011-02-27 04:56:00
|
Revision: 11996 http://wonder.svn.sourceforge.net/wonder/?rev=11996&view=rev Author: nullterminated Date: 2011-02-27 04:55:54 +0000 (Sun, 27 Feb 2011) Log Message: ----------- Added time migration. Modified Paths: -------------- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/migration/ERXMigrationTable.java Modified: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/migration/ERXMigrationTable.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/migration/ERXMigrationTable.java 2011-02-27 04:55:22 UTC (rev 11995) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/migration/ERXMigrationTable.java 2011-02-27 04:55:54 UTC (rev 11996) @@ -803,6 +803,18 @@ } /** + * Returns a new time column. See newColumn(..) for the full docs. + * + * @param name the name of the column + * @param allowsNull if true, the column will allow null values + * @return the new ERXMigrationColumn + * @throws SQLException if the column cannot be created + */ + public ERXMigrationColumn newTimeColumn(String name, boolean allowsNull) throws SQLException { + return newColumn(name, Types.TIME, 0, 0, 0, allowsNull, ERXMigrationColumn.NULL_VALUE_TYPE); + } + + /** * Returns a new ipaddress column. See newColumn(..) for the full docs. * * @param name the name of the column This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nullterminated@us...> - 2011-02-27 04:55:29
|
Revision: 11995 http://wonder.svn.sourceforge.net/wonder/?rev=11995&view=rev Author: nullterminated Date: 2011-02-27 04:55:22 +0000 (Sun, 27 Feb 2011) Log Message: ----------- WONDER-666: externalTypeForJDBCType for Postgresql helper does not recognize Type.Date and Type.Time http://issues.objectstyle.org/jira/browse/WONDER-666 Modified Paths: -------------- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/jdbc/ERXSQLHelper.java Modified: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/jdbc/ERXSQLHelper.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/jdbc/ERXSQLHelper.java 2011-02-27 04:53:19 UTC (rev 11994) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/jdbc/ERXSQLHelper.java 2011-02-27 04:55:22 UTC (rev 11995) @@ -2267,6 +2267,12 @@ else if (jdbcType == CustomTypes.INET) { externalType = "inet"; } + else if (jdbcType == Types.DATE) { + externalType = "date"; + } + else if (jdbcType == Types.TIME) { + externalType = "time"; + } else if (jdbcType == Types.LONGVARCHAR || jdbcType == Types.CLOB) { externalType = "text"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nullterminated@us...> - 2011-02-27 04:53:26
|
Revision: 11994 http://wonder.svn.sourceforge.net/wonder/?rev=11994&view=rev Author: nullterminated Date: 2011-02-27 04:53:19 +0000 (Sun, 27 Feb 2011) Log Message: ----------- Add java.text.Format wrappers for Joda time formatters. Added Paths: ----------- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXJodaDateTimeFormatter.java branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXJodaLocalDateFormatter.java branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXJodaLocalDateTimeFormatter.java branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXJodaLocalTimeFormatter.java Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXJodaDateTimeFormatter.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXJodaDateTimeFormatter.java (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXJodaDateTimeFormatter.java 2011-02-27 04:53:19 UTC (rev 11994) @@ -0,0 +1,59 @@ +package er.extensions.formatters; + +import java.text.FieldPosition; +import java.text.Format; +import java.text.ParsePosition; +import java.util.Locale; +import java.util.TimeZone; + +import org.joda.time.Chronology; +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; + +public class ERXJodaDateTimeFormatter extends Format { + private final DateTimeFormatter formatter; + + public ERXJodaDateTimeFormatter(String pattern) { + this(pattern, null, null, null); + } + + public ERXJodaDateTimeFormatter(String pattern, DateTimeZone zone) { + this(pattern, null, null, zone); + } + + public ERXJodaDateTimeFormatter(String pattern, TimeZone zone) { + this(pattern, null, null, DateTimeZone.forTimeZone(zone)); + } + + public ERXJodaDateTimeFormatter(String pattern, Locale locale, TimeZone zone) { + this(pattern, null, locale, DateTimeZone.forTimeZone(zone)); + } + + public ERXJodaDateTimeFormatter(String pattern, Chronology chronology, Locale locale, DateTimeZone zone) { + DateTimeFormatter f = DateTimeFormat.forPattern(pattern); + if(chronology != null) { f = f.withChronology(chronology); } + if(locale != null) { f = f.withLocale(locale); } + if(zone != null) { f = f.withZone(zone); } + formatter = f; + } + + public ERXJodaDateTimeFormatter(Locale locale, String style) { + this(DateTimeFormat.patternForStyle(style, locale)); + } + + @Override + public StringBuffer format(Object obj, StringBuffer buffer, FieldPosition pos) { + formatter.printTo(buffer, (DateTime)obj); + return buffer; + } + + @Override + public DateTime parseObject(String str, ParsePosition pos) { + DateTime dt = formatter.parseDateTime(str); + pos.setIndex(str.length()); + return dt; + } + +} Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXJodaLocalDateFormatter.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXJodaLocalDateFormatter.java (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXJodaLocalDateFormatter.java 2011-02-27 04:53:19 UTC (rev 11994) @@ -0,0 +1,61 @@ +package er.extensions.formatters; + +import java.text.FieldPosition; +import java.text.Format; +import java.text.ParsePosition; +import java.util.Locale; +import java.util.TimeZone; + +import org.joda.time.Chronology; +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import org.joda.time.LocalDate; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; + +public class ERXJodaLocalDateFormatter extends Format { + private final DateTimeFormatter formatter; + + public ERXJodaLocalDateFormatter(String pattern) { + this(pattern, null, null, null); + } + + public ERXJodaLocalDateFormatter(String pattern, DateTimeZone zone) { + this(pattern, null, null, zone); + } + + public ERXJodaLocalDateFormatter(String pattern, TimeZone zone) { + this(pattern, null, null, DateTimeZone.forTimeZone(zone)); + } + + public ERXJodaLocalDateFormatter(String pattern, Locale locale, TimeZone zone) { + this(pattern, null, locale, DateTimeZone.forTimeZone(zone)); + } + + public ERXJodaLocalDateFormatter(String pattern, Chronology chronology, Locale locale, DateTimeZone zone) { + DateTimeFormatter f = DateTimeFormat.forPattern(pattern); + if(chronology != null) { f = f.withChronology(chronology); } + if(locale != null) { f = f.withLocale(locale); } + if(zone != null) { f = f.withZone(zone); } + formatter = f; + } + + public ERXJodaLocalDateFormatter(Locale locale, String style) { + this(DateTimeFormat.patternForStyle(style, locale)); + } + + @Override + public StringBuffer format(Object obj, StringBuffer buffer, FieldPosition pos) { + formatter.printTo(buffer, (LocalDate)obj); + return buffer; + } + + @Override + public LocalDate parseObject(String str, ParsePosition pos) { + DateTime dt = formatter.parseDateTime(str); + pos.setIndex(str.length()); + LocalDate ld = new LocalDate(dt); + return ld; + } + +} Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXJodaLocalDateTimeFormatter.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXJodaLocalDateTimeFormatter.java (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXJodaLocalDateTimeFormatter.java 2011-02-27 04:53:19 UTC (rev 11994) @@ -0,0 +1,61 @@ +package er.extensions.formatters; + +import java.text.FieldPosition; +import java.text.Format; +import java.text.ParsePosition; +import java.util.Locale; +import java.util.TimeZone; + +import org.joda.time.Chronology; +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import org.joda.time.LocalDateTime; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; + +public class ERXJodaLocalDateTimeFormatter extends Format { + private final DateTimeFormatter formatter; + + public ERXJodaLocalDateTimeFormatter(String pattern) { + this(pattern, null, null, null); + } + + public ERXJodaLocalDateTimeFormatter(String pattern, DateTimeZone zone) { + this(pattern, null, null, zone); + } + + public ERXJodaLocalDateTimeFormatter(String pattern, TimeZone zone) { + this(pattern, null, null, DateTimeZone.forTimeZone(zone)); + } + + public ERXJodaLocalDateTimeFormatter(String pattern, Locale locale, TimeZone zone) { + this(pattern, null, locale, DateTimeZone.forTimeZone(zone)); + } + + public ERXJodaLocalDateTimeFormatter(String pattern, Chronology chronology, Locale locale, DateTimeZone zone) { + DateTimeFormatter f = DateTimeFormat.forPattern(pattern); + if(chronology != null) { f = f.withChronology(chronology); } + if(locale != null) { f = f.withLocale(locale); } + if(zone != null) { f = f.withZone(zone); } + formatter = f; + } + + public ERXJodaLocalDateTimeFormatter(Locale locale, String style) { + this(DateTimeFormat.patternForStyle(style, locale)); + } + + @Override + public StringBuffer format(Object obj, StringBuffer buffer, FieldPosition pos) { + formatter.printTo(buffer, (LocalDateTime)obj); + return buffer; + } + + @Override + public LocalDateTime parseObject(String str, ParsePosition pos) { + DateTime dt = formatter.parseDateTime(str); + pos.setIndex(str.length()); + LocalDateTime ldt = new LocalDateTime(dt); + return ldt; + } + +} Added: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXJodaLocalTimeFormatter.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXJodaLocalTimeFormatter.java (rev 0) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/formatters/ERXJodaLocalTimeFormatter.java 2011-02-27 04:53:19 UTC (rev 11994) @@ -0,0 +1,61 @@ +package er.extensions.formatters; + +import java.text.FieldPosition; +import java.text.Format; +import java.text.ParsePosition; +import java.util.Locale; +import java.util.TimeZone; + +import org.joda.time.Chronology; +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import org.joda.time.LocalTime; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; + +public class ERXJodaLocalTimeFormatter extends Format { + private final DateTimeFormatter formatter; + + public ERXJodaLocalTimeFormatter(String pattern) { + this(pattern, null, null, null); + } + + public ERXJodaLocalTimeFormatter(String pattern, DateTimeZone zone) { + this(pattern, null, null, zone); + } + + public ERXJodaLocalTimeFormatter(String pattern, TimeZone zone) { + this(pattern, null, null, DateTimeZone.forTimeZone(zone)); + } + + public ERXJodaLocalTimeFormatter(String pattern, Locale locale, TimeZone zone) { + this(pattern, null, locale, DateTimeZone.forTimeZone(zone)); + } + + public ERXJodaLocalTimeFormatter(String pattern, Chronology chronology, Locale locale, DateTimeZone zone) { + DateTimeFormatter f = DateTimeFormat.forPattern(pattern); + if(chronology != null) { f = f.withChronology(chronology); } + if(locale != null) { f = f.withLocale(locale); } + if(zone != null) { f = f.withZone(zone); } + formatter = f; + } + + public ERXJodaLocalTimeFormatter(Locale locale, String style) { + this(DateTimeFormat.patternForStyle(style, locale)); + } + + @Override + public StringBuffer format(Object obj, StringBuffer buffer, FieldPosition pos) { + formatter.printTo(buffer, (LocalTime)obj); + return buffer; + } + + @Override + public LocalTime parseObject(String str, ParsePosition pos) { + DateTime dt = formatter.parseDateTime(str); + pos.setIndex(str.length()); + LocalTime lt = new LocalTime(dt); + return lt; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nullterminated@us...> - 2011-02-26 19:28:16
|
Revision: 11993 http://wonder.svn.sourceforge.net/wonder/?rev=11993&view=rev Author: nullterminated Date: 2011-02-26 19:28:09 +0000 (Sat, 26 Feb 2011) Log Message: ----------- WONDER-668: [PATCH] ERXWOTextField should create more meaningful validation exceptions http://issues.objectstyle.org/jira/browse/WONDER-668 Modified Paths: -------------- trunk/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/components/_private/ERXWOTextField.java Modified: trunk/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/components/_private/ERXWOTextField.java =================================================================== --- trunk/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/components/_private/ERXWOTextField.java 2011-02-26 03:27:15 UTC (rev 11992) +++ trunk/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/components/_private/ERXWOTextField.java 2011-02-26 19:28:09 UTC (rev 11993) @@ -136,7 +136,8 @@ result = format.parseObject(reformatedObject); } catch(ParseException parseexception) { String keyPath = _value.keyPath(); - ERXValidationException validationexception = new ERXValidationException(parseexception.getMessage(), stringValue, keyPath); component.validationFailedWithException(validationexception, stringValue, keyPath); + ERXValidationException validationexception = new ERXValidationException(ERXValidationException.InvalidValueException, parseexception, keyPath, stringValue); + component.validationFailedWithException(validationexception, stringValue, keyPath); return; } finally { tsFormat.setDefaultFormatTimeZone(formatZone); @@ -150,7 +151,8 @@ result = format.parseObject(reformatedObject); } catch(ParseException parseexception) { String keyPath = _value.keyPath(); - ERXValidationException validationexception = new ERXValidationException(parseexception.getMessage(), stringValue, keyPath); component.validationFailedWithException(validationexception, stringValue, keyPath); + ERXValidationException validationexception = new ERXValidationException(ERXValidationException.InvalidValueException, parseexception, keyPath, stringValue); + component.validationFailedWithException(validationexception, stringValue, keyPath); return; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chillatgvc@us...> - 2011-02-26 03:27:22
|
Revision: 11992 http://wonder.svn.sourceforge.net/wonder/?rev=11992&view=rev Author: chillatgvc Date: 2011-02-26 03:27:15 +0000 (Sat, 26 Feb 2011) Log Message: ----------- Handle line breaks, I think. I hate regex and Java escape sequences. Modified Paths: -------------- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Ajax/Ajax/Sources/er/ajax/AjaxValue.java Modified: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Ajax/Ajax/Sources/er/ajax/AjaxValue.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Ajax/Ajax/Sources/er/ajax/AjaxValue.java 2011-02-25 21:18:56 UTC (rev 11991) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Ajax/Ajax/Sources/er/ajax/AjaxValue.java 2011-02-26 03:27:15 UTC (rev 11992) @@ -24,6 +24,11 @@ String escapedValue = String.valueOf(obj); escapedValue = escapedValue.replaceAll("\\\\", "\\\\\\\\"); escapedValue = escapedValue.replaceAll("'", "\\\\'"); + + // Handle line breaks + escapedValue = escapedValue.replaceAll("\\r\\n", "\\\\n"); + escapedValue = escapedValue.replaceAll("\\n", "\\\\n"); + escapedValue = "'" + escapedValue + "'"; return escapedValue; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 11991 http://wonder.svn.sourceforge.net/wonder/?rev=11991&view=rev Author: anjo Date: 2011-02-25 21:18:56 +0000 (Fri, 25 Feb 2011) Log Message: ----------- svn merge -c 11990 https://wonder.svn.sourceforge.net/svnroot/wonder/branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder . Modified Paths: -------------- branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorContext.java Modified: branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorContext.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorContext.java 2011-02-25 16:01:08 UTC (rev 11990) +++ branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorContext.java 2011-02-25 21:18:56 UTC (rev 11991) @@ -45,14 +45,18 @@ String className = pkAttribute.className(); String valueType = pkAttribute.valueType(); if ("com.webobjects.foundation.NSData".equals(className)) { - ByteArrayBuffer buf = new ByteArrayBuffer(); - try { - buf.write(entity.externalName().getBytes()); - buf.write('.'); - buf.write(new EOTemporaryGlobalID()._rawBytes()); - pkValue = new NSData(buf.getRawData()); - } catch (IOException e) { - throw NSForwardException._runtimeExceptionForThrowable(e); + if(true==false) { + ByteArrayBuffer buf = new ByteArrayBuffer(); + try { + buf.write(entity.externalName().getBytes()); + buf.write('.'); + buf.write(new EOTemporaryGlobalID()._rawBytes()); + pkValue = new NSData(buf.getRawData()); + } catch (IOException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } + } else { + pkValue = new NSData(new EOTemporaryGlobalID()._rawBytes()); } } else { throw new IllegalArgumentException("Unknown value type '" + valueType + "' for '" + object + "' of entity '" + entity.name() + "'."); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 11990 http://wonder.svn.sourceforge.net/wonder/?rev=11990&view=rev Author: anjo Date: 2011-02-25 16:01:08 +0000 (Fri, 25 Feb 2011) Log Message: ----------- lucene adaptor second cut. should mostly work. need tests and better example. Modified Paths: -------------- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorContext.java Modified: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorContext.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorContext.java 2011-02-25 15:56:00 UTC (rev 11989) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorContext.java 2011-02-25 16:01:08 UTC (rev 11990) @@ -45,14 +45,18 @@ String className = pkAttribute.className(); String valueType = pkAttribute.valueType(); if ("com.webobjects.foundation.NSData".equals(className)) { - ByteArrayBuffer buf = new ByteArrayBuffer(); - try { - buf.write(entity.externalName().getBytes()); - buf.write('.'); - buf.write(new EOTemporaryGlobalID()._rawBytes()); - pkValue = new NSData(buf.getRawData()); - } catch (IOException e) { - throw NSForwardException._runtimeExceptionForThrowable(e); + if(true==false) { + ByteArrayBuffer buf = new ByteArrayBuffer(); + try { + buf.write(entity.externalName().getBytes()); + buf.write('.'); + buf.write(new EOTemporaryGlobalID()._rawBytes()); + pkValue = new NSData(buf.getRawData()); + } catch (IOException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } + } else { + pkValue = new NSData(new EOTemporaryGlobalID()._rawBytes()); } } else { throw new IllegalArgumentException("Unknown value type '" + valueType + "' for '" + object + "' of entity '" + entity.name() + "'."); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <anjo@us...> - 2011-02-25 15:56:08
|
Revision: 11989 http://wonder.svn.sourceforge.net/wonder/?rev=11989&view=rev Author: anjo Date: 2011-02-25 15:56:00 +0000 (Fri, 25 Feb 2011) Log Message: ----------- svn merge -c 11988 https://wonder.svn.sourceforge.net/svnroot/wonder/branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder . Modified Paths: -------------- branches/Wonder_5_0_0_WebObjects_5_3_Branch/Examples/Misc/LuceneExample/Resources/LuceneModel.eomodeld/LuceneAsset.plist branches/Wonder_5_0_0_WebObjects_5_3_Branch/Examples/Misc/LuceneExample/Sources/er/lucenceadaptor/example/DirectAction.java branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/.classpath branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/.settings/org.eclipse.jdt.core.prefs branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/.settings/org.eclipse.jdt.ui.prefs branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptor.java branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorChannel.java branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorContext.java Modified: branches/Wonder_5_0_0_WebObjects_5_3_Branch/Examples/Misc/LuceneExample/Resources/LuceneModel.eomodeld/LuceneAsset.plist =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_3_Branch/Examples/Misc/LuceneExample/Resources/LuceneModel.eomodeld/LuceneAsset.plist 2011-02-25 15:45:57 UTC (rev 11988) +++ branches/Wonder_5_0_0_WebObjects_5_3_Branch/Examples/Misc/LuceneExample/Resources/LuceneModel.eomodeld/LuceneAsset.plist 2011-02-25 15:56:00 UTC (rev 11989) @@ -21,10 +21,10 @@ prototypeName = longNumber; } ); - attributesUsedForLocking = (contents, creationDate, id, price, userCount); + attributesUsedForLocking = (creationDate, id, userCount); className = EOGenericRecord; classProperties = (contents, creationDate, price, userCount); - externalName = LuceneAsset; + externalName = LA; fetchSpecificationDictionary = {}; name = LuceneAsset; primaryKeyAttributes = (id); Modified: branches/Wonder_5_0_0_WebObjects_5_3_Branch/Examples/Misc/LuceneExample/Sources/er/lucenceadaptor/example/DirectAction.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_3_Branch/Examples/Misc/LuceneExample/Sources/er/lucenceadaptor/example/DirectAction.java 2011-02-25 15:45:57 UTC (rev 11988) +++ branches/Wonder_5_0_0_WebObjects_5_3_Branch/Examples/Misc/LuceneExample/Sources/er/lucenceadaptor/example/DirectAction.java 2011-02-25 15:56:00 UTC (rev 11989) @@ -6,15 +6,17 @@ import org.apache.log4j.Logger; import org.apache.lucene.document.Document; -import org.apache.lucene.document.NumberTools; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.Term; +import org.apache.lucene.search.BooleanClause; +import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.Collector; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.NumericRangeQuery; import org.apache.lucene.search.Query; import org.apache.lucene.search.Scorer; import org.apache.lucene.search.TermQuery; +import org.apache.lucene.search.TermRangeQuery; import org.apache.lucene.search.TopDocs; import org.apache.lucene.store.Directory; import org.apache.lucene.store.FSDirectory; @@ -23,16 +25,28 @@ import com.webobjects.appserver.WOActionResults; import com.webobjects.appserver.WORequest; import com.webobjects.directtoweb.D2W; +import com.webobjects.eoaccess.EOEntity; +import com.webobjects.eoaccess.EOModelGroup; import com.webobjects.eoaccess.EOUtilities; +import com.webobjects.eocontrol.EOAndQualifier; import com.webobjects.eocontrol.EOEditingContext; import com.webobjects.eocontrol.EOEnterpriseObject; +import com.webobjects.eocontrol.EOFetchSpecification; +import com.webobjects.eocontrol.EOKeyValueQualifier; +import com.webobjects.eocontrol.EOQualifier; +import com.webobjects.eocontrol.EOSortOrdering; +import com.webobjects.foundation.NSArray; +import com.webobjects.foundation.NSDictionary; import com.webobjects.foundation.NSLog; import com.webobjects.foundation.NSTimestamp; import er.directtoweb.ERD2WDirectAction; import er.extensions.components.ERXLoremIpsumGenerator; import er.extensions.eof.ERXEC; +import er.extensions.eof.qualifiers.ERXBetweenQualifier; import er.lucenceadaptor.example.components.Main; +import er.luceneadaptor.ERLuceneAdaptor; +import er.luceneadaptor.ERLuceneAdaptorChannel; public class DirectAction extends ERD2WDirectAction { @@ -107,42 +121,79 @@ return D2W.factory().defaultPage(session()); } + private static IndexReader reader; + public WOActionResults directQueryAction() throws IOException { - Directory d = FSDirectory.open(new File("/tmp/test")); - IndexReader reader = IndexReader.open(d); + if(reader == null) { + Directory directory = FSDirectory.open(new File("/tmp/test")); + reader = IndexReader.open(directory); + } IndexSearcher searcher = new IndexSearcher(reader); + for(int i = 0; i < searcher.maxDoc() && i < 10; i++) { + Document doc = searcher.doc(i); + // log.info(doc); + } Query query = null; - String key = "Morbi".toLowerCase(); - if(true) { + String key = "ipse".toLowerCase(); + if(false) { NumericRangeQuery q = NumericRangeQuery.newIntRange("userCount", Integer.valueOf(30), Integer.valueOf(10000), true, true); - q = NumericRangeQuery.newLongRange("userCount", Long.valueOf(30), Long.valueOf(10000), true, true); + //q = NumericRangeQuery.newLongRange("userCount", Long.valueOf(30), Long.valueOf(10000), true, true); query = q; } else { - TermQuery q = new TermQuery(new Term("contents", key)); + TermQuery q1 = new TermQuery(new Term("contents", key)); + TermRangeQuery q2 = new TermRangeQuery("userCount", NumericUtils.longToPrefixCoded(30), NumericUtils.longToPrefixCoded(300), false, false); + BooleanQuery q = new BooleanQuery(); + //q.add(q1, BooleanClause.Occur.MUST); + q.add(q2, BooleanClause.Occur.MUST); query = q; } log.info(query); if (true) { TopDocs docs = searcher.search(query, Integer.MAX_VALUE); int hits = docs.totalHits; - for (int i = 0; i < hits; i++) { + for (int i = 0; i < hits && i < 50; i++) { int docId = docs.scoreDocs[i].doc; Document document = searcher.doc(docId); String fieldValue = document.get("userCount"); String content = document.get("contents"); Number userCount = NumericUtils.prefixCodedToLong(fieldValue); boolean contains = content.indexOf(key) >= 0; - log.info(i +"/" + docId + "->" + userCount + "-" + content); + log.info(i +"/" + docId + "->" + userCount + "-" + document); } } else { - Collector streamingHitCollector = new SimpleCollector(searcher); searcher.search(query, streamingHitCollector); } return D2W.factory().defaultPage(session()); } + public WOActionResults eofQueryAction() throws IOException { + EOEditingContext ec = ERXEC.newEditingContext(); + ec.lock(); + try { + EOQualifier q1 = new EOKeyValueQualifier("contents", EOQualifier.QualifierOperatorLike, "suspend*"); + EOQualifier q2 = new ERXBetweenQualifier("userCount", Long.valueOf(30), Long.valueOf(800)); + // EOQualifier q3 = new EOKeyValueQualifier("userCount", EOQualifier.QualifierOperatorEqual, Long.valueOf(82)); + //EOQualifier q3 = new EOKeyValueQualifier("userCount", EOQualifier.QualifierOperatorLessThan, Long.valueOf(82)); + EOQualifier q3 = new EOKeyValueQualifier("userCount", EOQualifier.QualifierOperatorLessThanOrEqualTo, Long.valueOf(802)); + EOQualifier qualifier = new EOAndQualifier(new NSArray<EOQualifier>(new EOQualifier[]{q1, q2, q3})); + EOFetchSpecification fs = new EOFetchSpecification("LuceneAsset", qualifier, null); + fs.setFetchLimit(5); + fs.setSortOrderings(new NSArray(new EOSortOrdering("userCount", EOSortOrdering.CompareAscending))); + Query query = ERLuceneAdaptorChannel.queryForQualifier(new EOKeyValueQualifier("userCount", EOQualifier.QualifierOperatorLessThanOrEqualTo, 802), EOUtilities.entityNamed(ec, "LuceneAsset")); + fs.setHints(new NSDictionary(query, ERLuceneAdaptor.QUERY_HINTS)); + NSArray<EOEnterpriseObject> result = ec.objectsWithFetchSpecification(fs); + log.info(result.count() + ": " + result.valueForKey("userCount")); + for (EOEnterpriseObject eo : result) { + log.info(result.count() + ": " + eo); + } + } finally { + ec.unlock(); + } + return D2W.factory().defaultPage(session()); + } + public WOActionResults createAction() { EOEditingContext ec = ERXEC.newEditingContext(); ec.lock(); @@ -151,7 +202,7 @@ for (int i = 0; i < 100; i++) { EOEnterpriseObject eo = EOUtilities.createAndInsertInstance(ec, "LuceneAsset"); eo.takeValueForKey(new NSTimestamp().timestampByAddingGregorianUnits(0, 0, -random.nextInt(2500), 0, 0, 0, null), "creationDate"); - eo.takeValueForKey(ERXLoremIpsumGenerator.firstParagraph(), "contents"); + eo.takeValueForKey(ERXLoremIpsumGenerator.randomSentence(), "contents"); eo.takeValueForKey(random.nextDouble(), "price"); eo.takeValueForKey(Long.valueOf(random.nextInt(2500)), "userCount"); } Modified: branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/.classpath =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/.classpath 2011-02-25 15:45:57 UTC (rev 11988) +++ branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/.classpath 2011-02-25 15:56:00 UTC (rev 11989) @@ -11,8 +11,8 @@ <classpathentry exported="true" kind="con" path="WOFramework/JavaWebObjects"/> <classpathentry exported="true" kind="con" path="WOFramework/JavaXML"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry exported="true" kind="lib" path="Libraries/lucene-analyzers-3.0.3.jar"/> - <classpathentry exported="true" kind="lib" path="Libraries/lucene-core-3.0.3.jar"/> + <classpathentry exported="true" kind="lib" path="Libraries/lucene-analyzers-3.0.3.jar" sourcepath="Libraries/lucene-3.0.3-src.jar"/> + <classpathentry exported="true" kind="lib" path="Libraries/lucene-core-3.0.3.jar" sourcepath="Libraries/lucene-3.0.3-src.jar"/> <classpathentry exported="true" kind="lib" path="Libraries/lucene-snowball-3.0.3.jar"/> <classpathentry exported="true" kind="lib" path="Libraries/lucene-spellchecker-3.0.3.jar"/> <classpathentry kind="lib" path="Libraries/lucene-memory-3.0.3.jar"/> Modified: branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/.settings/org.eclipse.jdt.core.prefs =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/.settings/org.eclipse.jdt.core.prefs 2011-02-25 15:45:57 UTC (rev 11988) +++ branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/.settings/org.eclipse.jdt.core.prefs 2011-02-25 15:56:00 UTC (rev 11989) @@ -1,4 +1,4 @@ -#Tue Feb 17 20:18:11 PST 2009 +#Fri Feb 25 12:40:48 CET 2011 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.autoboxing=error @@ -58,3 +58,271 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=280 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=280 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true Modified: branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/.settings/org.eclipse.jdt.ui.prefs =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/.settings/org.eclipse.jdt.ui.prefs 2011-02-25 15:45:57 UTC (rev 11988) +++ branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/.settings/org.eclipse.jdt.ui.prefs 2011-02-25 15:56:00 UTC (rev 11989) @@ -1,3 +1,5 @@ -#Wed Nov 28 09:01:06 EST 2007 +#Fri Feb 25 12:40:32 CET 2011 eclipse.preferences.version=1 +formatter_profile=_Wonder +formatter_settings_version=11 internal.default.compliance=default Modified: branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptor.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptor.java 2011-02-25 15:45:57 UTC (rev 11988) +++ branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptor.java 2011-02-25 15:56:00 UTC (rev 11989) @@ -16,7 +16,6 @@ import org.apache.lucene.store.LockObtainFailedException; import org.apache.lucene.util.Version; -import com.sun.tools.javac.util.Log; import com.webobjects.eoaccess.EOAdaptor; import com.webobjects.eoaccess.EOAdaptorContext; import com.webobjects.eoaccess.EOModel; @@ -33,6 +32,9 @@ */ public class ERLuceneAdaptor extends EOAdaptor { + public static final Object QUERY_HINTS = "query"; + public static final Object SORT_HINTS = "sort"; + private Object _syncFactory; public Directory _directory; public Analyzer _analyzer; Modified: branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorChannel.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorChannel.java 2011-02-25 15:45:57 UTC (rev 11988) +++ branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorChannel.java 2011-02-25 15:56:00 UTC (rev 11989) @@ -1,7 +1,7 @@ package er.luceneadaptor; import java.io.IOException; -import java.math.BigDecimal; +import java.math.BigInteger; import java.text.Format; import java.text.ParseException; import java.util.Date; @@ -19,16 +19,24 @@ import org.apache.lucene.index.CorruptIndexException; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.Term; +import org.apache.lucene.search.BooleanClause; +import org.apache.lucene.search.BooleanQuery; +import org.apache.lucene.search.DisjunctionMaxQuery; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.MatchAllDocsQuery; -import org.apache.lucene.search.NumericRangeQuery; +import org.apache.lucene.search.MultiPhraseQuery; +import org.apache.lucene.search.PrefixQuery; import org.apache.lucene.search.Query; -import org.apache.lucene.search.QueryWrapperFilter; import org.apache.lucene.search.Sort; import org.apache.lucene.search.SortField; +import org.apache.lucene.search.TermQuery; +import org.apache.lucene.search.TermRangeQuery; +import org.apache.lucene.search.TopDocs; +import org.apache.lucene.search.WildcardQuery; import org.apache.lucene.util.NumericUtils; import org.apache.lucene.util.Version; +import com.ibm.icu.math.BigDecimal; import com.webobjects.eoaccess.EOAdaptorChannel; import com.webobjects.eoaccess.EOAttribute; import com.webobjects.eoaccess.EOEntity; @@ -61,6 +69,7 @@ import com.webobjects.foundation.NSTimestampFormatter; import com.webobjects.foundation._NSUtilities; +import er.extensions.eof.qualifiers.ERXBetweenQualifier; import er.extensions.foundation.ERXKeyValueCodingUtilities; import er.extensions.foundation.ERXPatcher; import er.extensions.qualifiers.ERXQualifierTraversal; @@ -72,56 +81,104 @@ */ public class ERLuceneAdaptorChannel extends EOAdaptorChannel { + private static final String EXTERNAL_NAME_KEY = "_e"; + static Logger log = Logger.getLogger(ERLuceneAdaptorChannel.class); private static class LuceneQualifierTraversal extends ERXQualifierTraversal { - NSMutableArray _qualifiers = new NSMutableArray(); + NSMutableArray _queries; + EOEntity _entity; - public LuceneQualifierTraversal() { + public LuceneQualifierTraversal(EOEntity entity) { + _entity = entity; } - protected NSArray<EOQualifier> qualifiersForLast(NSArray original) { - NSRange range = new NSRange(_qualifiers.count() - original.count(), original.count()); - NSArray<EOQualifier> result = _qualifiers.subarrayWithRange(range); - _qualifiers.removeObjectsInRange(range); + protected NSArray<Query> queriesForCurrent(int count) { + NSRange range = new NSRange(_queries.count() - count, count); + NSArray<Query> result = _queries.subarrayWithRange(range); + _queries.removeObjectsInRange(range); return result; } @Override protected boolean traverseAndQualifier(EOAndQualifier q) { - NSArray quals = qualifiersForLast(q.qualifiers()); - _qualifiers.addObject(quals); + NSArray<Query> queries = queriesForCurrent(q.qualifiers().count()); + BooleanQuery query = new BooleanQuery(); + for (Query current : queries) { + query.add(current, BooleanClause.Occur.MUST); + } + _queries.addObject(query); return true; } @Override - protected void visit(EOQualifierEvaluation q) { - _qualifiers = new NSMutableArray<EOQualifier>(); - super.visit(q); + protected boolean traverseNotQualifier(EONotQualifier q) { + NSArray<Query> queries = queriesForCurrent(1); + BooleanQuery query = new BooleanQuery(); + query.add(queries.lastObject(), BooleanClause.Occur.MUST_NOT); + _queries.addObject(query); + return true; } @Override - protected boolean traverseUnknownQualifier(EOQualifierEvaluation q) { - throw new IllegalArgumentException("Unknown qualifier: " + q); + protected boolean traverseOrQualifier(EOOrQualifier q) { + NSArray<Query> queries = queriesForCurrent(q.qualifiers().count()); + DisjunctionMaxQuery query = new DisjunctionMaxQuery(queries, 0); + _queries.addObject(query); + return true; } @Override - protected boolean traverseNotQualifier(EONotQualifier q) { - _qualifiers.addObject(q); - return super.traverseNotQualifier(q); + protected boolean traverseUnknownQualifier(EOQualifierEvaluation q) { + throw new IllegalArgumentException("Unknown qualifier: " + q); } @Override - protected boolean traverseOrQualifier(EOOrQualifier q) { - NSArray quals = qualifiersForLast(q.qualifiers()); - _qualifiers.addObject(quals); - return true; - } - - @Override protected boolean traverseKeyValueQualifier(EOKeyValueQualifier q) { - _qualifiers.addObject(q); + Query query = null; + String key = _entity.attributeNamed(q.key()).columnName(); + IndexAttribute attr = new IndexAttribute(_entity.attributeNamed(key)); + if (q instanceof ERXBetweenQualifier) { + ERXBetweenQualifier between = (ERXBetweenQualifier) q; + Object min = between.minimumValue(); + Object max = between.maximumValue(); + query = new TermRangeQuery(key, attr.asLuceneValue(min), attr.asLuceneValue(max), false, false); + } else if(q.selector().equals(EOQualifier.QualifierOperatorGreaterThan)) { + query = new TermRangeQuery(key, attr.asLuceneValue(q.value()), null, false, false); + } else if(q.selector().equals(EOQualifier.QualifierOperatorGreaterThanOrEqualTo)) { + query = new TermRangeQuery(key, attr.asLuceneValue(q.value()), null, true, false); + } else if(q.selector().equals(EOQualifier.QualifierOperatorLessThan)) { + query = new TermRangeQuery(key, null, attr.asLuceneValue(q.value()), false, false); + } else if(q.selector().equals(EOQualifier.QualifierOperatorLessThanOrEqualTo)) { + query = new TermRangeQuery(key, null, attr.asLuceneValue(q.value()), false, true); + } else if(q.selector().equals(EOQualifier.QualifierOperatorCaseInsensitiveLike) || q.selector().equals(EOQualifier.QualifierOperatorLike)) { + String value = q.value().toString(); + if(q.selector().equals(EOQualifier.QualifierOperatorLike)) { + value = value.toLowerCase(); + } + int star = value.indexOf('*'); + if(star >= 0) { + if(star < value.length() - 1) { + query = new WildcardQuery(new Term(key, value)); + } else { + query = new PrefixQuery(new Term(key, value.substring(0, star))); + } + } else if(value.contains(" ")) { + MultiPhraseQuery multi = new MultiPhraseQuery(); + query = multi; + String parts[] = value.split(" +"); + for (int i = 0; i < parts.length; i++) { + String part = parts[i]; + multi.add(new Term(key, part)); + } + } else { + query = new TermQuery(new Term(key, value)); + } + } else { + query = new TermQuery(new Term(key, attr.asLuceneValue(q.value()))); + } + _queries.addObjects(query); return true; } @@ -130,11 +187,17 @@ throw new IllegalArgumentException("Unknown qualifier: " + q); } + @Override + public void traverse(EOQualifierEvaluation q, boolean postOrder) { + _queries = new NSMutableArray<Query>(); + super.traverse(q, true); + } + public Query query() { - //TermQuery query = new TermQuery(new Term("", "vessn*")); - NumericRangeQuery query = NumericRangeQuery.newIntRange("userCount", Integer.valueOf(300), Integer.valueOf(2000), true, true); - //query.add(); - return query; + BooleanQuery q = new BooleanQuery(); + q.add(new TermQuery(new Term(EXTERNAL_NAME_KEY, _entity.externalName())), BooleanClause.Occur.MUST); + q.add((Query) _queries.lastObject(), BooleanClause.Occur.MUST); + return q; } } @@ -149,33 +212,34 @@ private static String[] CODES = new String[] { "ar", "br", "cjk", "cn", "cz", "de", "el", "fa", "fr", "nl", "ru", "th" }; private static NSDictionary<String, String> LOCALES = new NSDictionary<String, String>(NAMES, CODES); - String _name; + private String _columnName; - TermVector _termVector; + private TermVector _termVector; - Store _store; + private Store _store; - Index _index; + private Index _index; - Analyzer _analyzer; + private Analyzer _analyzer; - Format _format; + private Format _format; - EOAttribute _attribute; + private EOAttribute _attribute; + @SuppressWarnings("deprecation") public IndexAttribute(EOAttribute attribute) { _attribute = attribute; NSDictionary dict = attribute.userInfo() != null ? attribute.userInfo() : NSDictionary.emptyDictionary(); - _name = attribute.columnName(); + _columnName = attribute.columnName(); boolean isClassProperty = _attribute.entity().classPropertyNames().contains(_attribute.name()); - boolean isDataProperty = _attribute.className().contains("NSData"); - boolean isStringProperty = _attribute.className().contains("String"); - _termVector = (TermVector) classValue(dict, "termVector", TermVector.class, isClassProperty && !isDataProperty && isStringProperty? "YES" : "NO"); + boolean isDataProperty = _attribute.className().endsWith("NSData"); + boolean isStringProperty = _attribute.className().endsWith("String"); + _termVector = (TermVector) classValue(dict, "termVector", TermVector.class, isClassProperty && !isDataProperty && isStringProperty ? "YES" : "NO"); _store = (Store) classValue(dict, "store", Store.class, "YES"); _index = (Index) classValue(dict, "index", Index.class, isClassProperty && !isDataProperty && isStringProperty ? "ANALYZED" : "NOT_ANALYZED"); String analyzerClass = (String) dict.objectForKey("analyzer"); - if (analyzerClass == null && _name.matches("\\w+_(\\w+)")) { - String locale = _name.substring(_name.lastIndexOf('_') + 1).toLowerCase(); + if (analyzerClass == null && _columnName.matches("\\w+_(\\w+)")) { + String locale = _columnName.substring(_columnName.lastIndexOf('_') + 1).toLowerCase(); analyzerClass = LOCALES.objectForKey(locale); if (analyzerClass != null) { analyzerClass = ERXPatcher.classForName("org.apache.lucene.analysis." + locale + "." + analyzerClass).getName(); @@ -234,8 +298,8 @@ return _store; } - public String name() { - return _name; + public String columnName() { + return _columnName; } public Analyzer analyzer() { @@ -246,23 +310,32 @@ if (_format != null) { return _format.format(value); } - if (value instanceof Number) { - if (value instanceof Double) { - return NumericUtils.doubleToPrefixCoded(((Number) value).doubleValue()); - } else if (value instanceof Long) { + if(value == null) { + return null; + } + if (attribute().valueType() != null) { + char valueType = attribute().valueType().charAt(0); + switch (valueType) { + case 'i': + return NumericUtils.intToPrefixCoded(((Number) value).intValue()); + case 'b': return NumericUtils.longToPrefixCoded(((Number) value).longValue()); - } else if (value instanceof BigDecimal) { + case 'l': + return NumericUtils.longToPrefixCoded(((Number) value).longValue()); + case 'd': return NumericUtils.doubleToPrefixCoded(((Number) value).doubleValue()); + case 'B': + return NumericUtils.doubleToPrefixCoded(((Number) value).doubleValue()); } - return NumericUtils.intToPrefixCoded(((Number) value).intValue()); - } else if (value instanceof Date) { + } + if (value instanceof Date) { return DateTools.dateToString((Date) value, Resolution.MILLISECOND); } else if (value instanceof NSData) { return NSPropertyListSerialization.stringFromPropertyList(value); } else if (value instanceof NSArray) { return ((NSArray) value).componentsJoinedByString(" "); } - return (value != null ? value.toString() : null); + return value.toString(); } public Object asEOFValue(String value) { @@ -270,40 +343,45 @@ if (_format != null) { return _format.parseObject(value); } - - if (attribute().className().contains("NSTimestamp")) { - return new NSTimestamp(DateTools.stringToDate(value)); - } else if (attribute().className().contains("NSData")) { - return new NSData((NSData)NSPropertyListSerialization.propertyListFromString(value)); - } else if (attribute().className().contains("NSArray")) { - return NSArray.componentsSeparatedByString(value, " "); - } else { - String valueType = attribute().valueType(); - if ("b".equals(valueType)) { + if(value == null) { + return null; + } + if (attribute().valueType() != null) { + char valueType = attribute().valueType().charAt(0); + switch (valueType) { + case 'i': return Integer.valueOf(NumericUtils.prefixCodedToInt(value)); - } else if ("i".equals(valueType)) { - return Integer.valueOf(NumericUtils.prefixCodedToInt(value)); - } else if ("l".equals(valueType)) { + case 'b': + return BigInteger.valueOf(NumericUtils.prefixCodedToLong(value)); + case 'l': return Long.valueOf(NumericUtils.prefixCodedToLong(value)); - } else if ("d".equals(valueType)) { + case 'd': return Double.valueOf(NumericUtils.prefixCodedToDouble(value)); - } else if ("B".equals(valueType)) { + case 'B': return BigDecimal.valueOf(NumericUtils.prefixCodedToDouble(value)); } } - return (value != null ? value.toString() : null); + if (attribute().className().contains("NSTimestamp")) { + return new NSTimestamp(DateTools.stringToDate(value)); + } else if (attribute().className().contains("NSData")) { + return new NSData((NSData) NSPropertyListSerialization.propertyListFromString(value)); + } else if (attribute().className().contains("NSArray")) { + return NSArray.componentsSeparatedByString(value, " "); + } + return value.toString(); } catch (ParseException ex) { throw NSForwardException._runtimeExceptionForThrowable(ex); } } - public Field valueToField(Object value) { + public Field valueToField(Document doc,Object value) { String stringValue = asLuceneValue(value); - if (stringValue != null) { - Field field = new Field(name(), stringValue, store(), index(), termVector()); - return field; + Field field = doc.getField(columnName()); + if(field == null) { + field = new Field(columnName(), stringValue, store(), index(), termVector()); } - return null; + field.setValue(stringValue); + return field; } public EOAttribute attribute() { @@ -315,10 +393,10 @@ private NSArray<IndexAttribute> _indexAttributes; private EOEntity _entity; private int _fetchIndex; - private int _fetchCount; private boolean _open; private IndexSearcher _searcher; private boolean _fetchInProgress = false; + private TopDocs _fetchedDocs; public ERLuceneAdaptorChannel(ERLuceneAdaptorContext context) { super(context); @@ -342,7 +420,9 @@ } public IndexSearcher searcher() throws CorruptIndexException, IOException { - if (_searcher == null/* || !adaptorContext().adaptor().indexReader().isCurrent()*/) { + if (_searcher == null/* + * || !adaptorContext().adaptor().indexReader().isCurrent () + */) { _searcher = new IndexSearcher(adaptorContext().adaptor().indexReader()); } return _searcher; @@ -370,7 +450,7 @@ private void reset() { _fetchInProgress = false; - _fetchCount = -1; + _fetchedDocs = null; _fetchIndex = -1; _entity = null; _searcher = null; @@ -416,7 +496,8 @@ NSMutableDictionary row = null; if (hasMoreRowsToReturn()) { try { - Document doc = searcher().doc(_fetchIndex++); + int docId = _fetchedDocs.scoreDocs[_fetchIndex++].doc; + Document doc = searcher().doc(docId); EOClassDescription cd = EOClassDescription.classDescriptionForEntityName(_entity.name()); NSMutableDictionary dict = cd._newDictionaryForProperties(); for (IndexAttribute attr : _indexAttributes) { @@ -448,7 +529,7 @@ } private boolean hasMoreRowsToReturn() { - return _fetchIndex < _fetchCount; + return _fetchIndex < _fetchedDocs.totalHits; } @Override @@ -474,7 +555,7 @@ } @Override - public void selectAttributes(NSArray attributesToFetch, EOFetchSpecification fetchSpecification, boolean shouldLock, EOEntity entity) { + public void selectAttributes(NSArray attributesToFetch, EOFetchSpecification fs, boolean shouldLock, EOEntity entity) { if (entity == null) { throw new IllegalArgumentException("null entity."); } @@ -489,38 +570,31 @@ try { _fetchIndex = 0; IndexSearcher searcher = searcher(); - Query query = queryForQualifier(fetchSpecification.qualifier()); - int fetchLimit = fetchSpecification.fetchLimit() > 0 ? fetchSpecification.fetchLimit() : Integer.MAX_VALUE; - fetchLimit = 5; + Query query = null; Sort sort = null; - if (fetchSpecification.sortOrderings().count() > 0) { - NSMutableArray<SortField> fields = new NSMutableArray<SortField>(fetchSpecification.sortOrderings().count()); - for (EOSortOrdering s : (NSArray<EOSortOrdering>) fetchSpecification.sortOrderings()) { - String name = s.key(); - NSSelector sel = s.selector(); - boolean reverse = sel.equals(EOSortOrdering.CompareDescending) || sel.equals(EOSortOrdering.CompareCaseInsensitiveDescending); - SortField sf = new SortField(name, 0, reverse); - fields.addObject(sf); - } - if(fields.count() > 0) { - sort = new Sort(); - sort.setSort(fields.toArray(new SortField[]{})); - } - } else { - searcher.search(query, new QueryWrapperFilter(query), fetchLimit); + + if(fs.hints() != null) { + query = (Query) fs.hints().objectForKey(ERLuceneAdaptor.QUERY_HINTS); + sort = (Sort) fs.hints().objectForKey(ERLuceneAdaptor.SORT_HINTS); } - if(sort != null) { - searcher.search(query, new QueryWrapperFilter(query), fetchLimit, sort); + if(query == null) { + query = queryForQualifier(fs.qualifier(), entity); + } + if(sort == null) { + sort = sortForSortOrderings(fs.sortOrderings()); + } + int fetchLimit = fs.fetchLimit() > 0 ? fs.fetchLimit() : Integer.MAX_VALUE; + if (sort != null) { + _fetchedDocs = searcher.search(query, null, fetchLimit, sort); } else { - searcher.search(query, new QueryWrapperFilter(query), fetchLimit); + _fetchedDocs = searcher.search(query, fetchLimit); } - _fetchCount = searcher.maxDoc(); } catch (EOGeneralAdaptorException e) { cancelFetch(); throw e; } catch (Throwable e) { cancelFetch(); - throw new ERLuceneAdaptorException("Failed to fetch '" + entity.name() + "' with fetch specification '" + fetchSpecification + "': " + e.getMessage(), e); + throw new ERLuceneAdaptorException("Failed to fetch '" + entity.name() + "' with fetch specification '" + fs + "': " + e.getMessage(), e); } } @@ -536,7 +610,7 @@ private Term termForDocument(Document doc, EOEntity entity) { for (IndexAttribute info : attributesForAttributes(entity.primaryKeyAttributes())) { - String name = info.name(); + String name = info.columnName(); String value = doc.get(name); Term term = new Term(name); term = term.createTerm(value); @@ -545,30 +619,17 @@ return null; } - private Query queryForQualifier(EOQualifier qualifier) { - if (qualifier == null && false) { - return new MatchAllDocsQuery(); - } - /* - * if(true) { FilteredQuery query = new FilteredQuery(null, new - * Filter()); query.add(new Term("content", "vessn*")); return query; - * - * } - */ - - LuceneQualifierTraversal traverser = new LuceneQualifierTraversal(); - traverser.traverse(qualifier); - Query query = traverser.query(); - return query; - } - private void fillWithDictionary(Document doc, NSDictionary row, EOEntity entity) { for (IndexAttribute info : attributesForEntity(entity)) { - Object value = row.objectForKey(info.attribute().name()); - - Field field = info.valueToField(value); - if (field != null) { - doc.add(field); + Object value = row.objectForKey(info.attribute().columnName()); + if (value != null) { + if(value == NSKeyValueCoding.NullValue) { + value = null; + } + Field field = info.valueToField(doc, value); + if (field != null) { + doc.add(field); + } } } } @@ -577,11 +638,12 @@ public int updateValuesInRowsDescribedByQualifier(NSDictionary updatedRow, EOQualifier qualifier, EOEntity entity) { try { IndexSearcher searcher = searcher(); - Query query = queryForQualifier(qualifier); - searcher.search(query, Integer.MAX_VALUE); - int count = searcher.maxDoc(); + Query query = queryForQualifier(qualifier, entity); + TopDocs fetchedDocs = searcher.search(query, Integer.MAX_VALUE); + int count = fetchedDocs.totalHits; for (int i = 0; i < count; i++) { - Document doc = searcher.doc(i); + int docId = fetchedDocs.scoreDocs[i].doc; + Document doc = searcher.doc(docId); fillWithDictionary(doc, updatedRow, entity); Term term = termForDocument(doc, entity); writer().updateDocument(term, doc); @@ -599,6 +661,7 @@ try { Document doc = new Document(); fillWithDictionary(doc, row, entity); + doc.add(new Field(EXTERNAL_NAME_KEY, entity.externalName(), Store.NO, Index.NOT_ANALYZED)); writer().addDocument(doc); } catch (EOGeneralAdaptorException e) { throw e; @@ -611,11 +674,12 @@ public int deleteRowsDescribedByQualifier(EOQualifier qualifier, EOEntity entity) { try { IndexSearcher searcher = searcher(); - Query query = queryForQualifier(qualifier); - searcher.search(query, null, Integer.MAX_VALUE); - int count = searcher.maxDoc(); + Query query = queryForQualifier(qualifier, entity); + TopDocs fetchedDocs = searcher.search(query, Integer.MAX_VALUE); + int count = fetchedDocs.totalHits; for (int i = 0; i < count; i++) { - Document doc = searcher.doc(i); + int docId = fetchedDocs.scoreDocs[i].doc; + Document doc = searcher.doc(docId); Term term = termForDocument(doc, entity); writer().deleteDocuments(term); } @@ -626,4 +690,45 @@ throw new ERLuceneAdaptorException("Failed to delete '" + entity.name() + "' with qualifier " + qualifier + ": " + e.getMessage(), e); } } + + /** + * Convenience method to create a Lucene query from an EOF qualifier. + * @param qualifier + * @param entity + * @return + */ + public static Query queryForQualifier(EOQualifier qualifier, EOEntity entity) { + if(qualifier == null) { + return new TermQuery(new Term(EXTERNAL_NAME_KEY, entity.externalName())); + } + LuceneQualifierTraversal traverser = new LuceneQualifierTraversal(entity); + traverser.traverse(qualifier, true); + Query query = traverser.query(); + return query; + } + + + /** + * Convenience method to create a Lucene sort from an EOF sort ordering array. + * @param sortOrderings + * @return + */ + public static Sort sortForSortOrderings(NSArray<EOSortOrdering> sortOrderings) { + Sort sort = null; + if (sortOrderings != null && sortOrderings.count() > 0) { + NSMutableArray<SortField> fields = new NSMutableArray<SortField>(sortOrderings.count()); + for (EOSortOrdering s : sortOrderings) { + String name = s.key(); + NSSelector sel = s.selector(); + boolean reverse = sel.equals(EOSortOrdering.CompareDescending) || sel.equals(EOSortOrdering.CompareCaseInsensitiveDescending); + SortField sf = new SortField(name, SortField.DOC, reverse); + fields.addObject(sf); + } + if (fields.count() > 0) { + sort = new Sort(); + sort.setSort(fields.toArray(new SortField[] {})); + } + } + return sort; + } } Modified: branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorContext.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorContext.java 2011-02-25 15:45:57 UTC (rev 11988) +++ branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorContext.java 2011-02-25 15:56:00 UTC (rev 11989) @@ -8,17 +8,18 @@ import org.apache.lucene.index.CorruptIndexException; import org.apache.lucene.index.IndexWriter; +import com.sun.xml.internal.ws.util.ByteArrayBuffer; import com.webobjects.eoaccess.EOAdaptor; import com.webobjects.eoaccess.EOAdaptorChannel; import com.webobjects.eoaccess.EOAdaptorContext; import com.webobjects.eoaccess.EOAttribute; import com.webobjects.eoaccess.EOEntity; -import com.webobjects.eoaccess.EOGeneralAdaptorException; import com.webobjects.eocontrol.EOEnterpriseObject; import com.webobjects.eocontrol.EOTemporaryGlobalID; import com.webobjects.foundation.NSArray; import com.webobjects.foundation.NSData; import com.webobjects.foundation.NSDictionary; +import com.webobjects.foundation.NSForwardException; /** * ERLuceneAdaptorContext provides the transaction support for the adaptor. @@ -27,7 +28,7 @@ */ public class ERLuceneAdaptorContext extends EOAdaptorContext { - IndexWriter _writer; + private IndexWriter _writer; public ERLuceneAdaptorContext(EOAdaptor adaptor) { super(adaptor); @@ -40,11 +41,19 @@ throw new ERLuceneAdaptorException("Failed to generate primary key because " + entity.name() + " has a composite primary key."); } EOAttribute pkAttribute = (EOAttribute) pkAttributes.objectAtIndex(0); - Object pkValue; + Object pkValue = null; String className = pkAttribute.className(); String valueType = pkAttribute.valueType(); if ("com.webobjects.foundation.NSData".equals(className)) { - pkValue = new NSData(new EOTemporaryGlobalID()._rawBytes()); + ByteArrayBuffer buf = new ByteArrayBuffer(); + try { + buf.write(entity.externalName().getBytes()); + buf.write('.'); + buf.write(new EOTemporaryGlobalID()._rawBytes()); + pkValue = new NSData(buf.getRawData()); + } catch (IOException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } } else { throw new IllegalArgumentException("Unknown value type '" + valueType + "' for '" + object + "' of entity '" + entity.name() + "'."); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <anjo@us...> - 2011-02-25 15:46:05
|
Revision: 11988 http://wonder.svn.sourceforge.net/wonder/?rev=11988&view=rev Author: anjo Date: 2011-02-25 15:45:57 +0000 (Fri, 25 Feb 2011) Log Message: ----------- lucene adaptor second cut. should mostly work. need tests and better example. Modified Paths: -------------- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Examples/Misc/LuceneExample/Resources/LuceneModel.eomodeld/LuceneAsset.plist branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Examples/Misc/LuceneExample/Sources/er/lucenceadaptor/example/DirectAction.java branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/.classpath branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/.settings/org.eclipse.jdt.core.prefs branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/.settings/org.eclipse.jdt.ui.prefs branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptor.java branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorChannel.java branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorContext.java Modified: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Examples/Misc/LuceneExample/Resources/LuceneModel.eomodeld/LuceneAsset.plist =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Examples/Misc/LuceneExample/Resources/LuceneModel.eomodeld/LuceneAsset.plist 2011-02-25 10:08:31 UTC (rev 11987) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Examples/Misc/LuceneExample/Resources/LuceneModel.eomodeld/LuceneAsset.plist 2011-02-25 15:45:57 UTC (rev 11988) @@ -21,10 +21,10 @@ prototypeName = longNumber; } ); - attributesUsedForLocking = (contents, creationDate, id, price, userCount); + attributesUsedForLocking = (creationDate, id, userCount); className = EOGenericRecord; classProperties = (contents, creationDate, price, userCount); - externalName = LuceneAsset; + externalName = LA; fetchSpecificationDictionary = {}; name = LuceneAsset; primaryKeyAttributes = (id); Modified: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Examples/Misc/LuceneExample/Sources/er/lucenceadaptor/example/DirectAction.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Examples/Misc/LuceneExample/Sources/er/lucenceadaptor/example/DirectAction.java 2011-02-25 10:08:31 UTC (rev 11987) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Examples/Misc/LuceneExample/Sources/er/lucenceadaptor/example/DirectAction.java 2011-02-25 15:45:57 UTC (rev 11988) @@ -6,15 +6,17 @@ import org.apache.log4j.Logger; import org.apache.lucene.document.Document; -import org.apache.lucene.document.NumberTools; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.Term; +import org.apache.lucene.search.BooleanClause; +import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.Collector; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.NumericRangeQuery; import org.apache.lucene.search.Query; import org.apache.lucene.search.Scorer; import org.apache.lucene.search.TermQuery; +import org.apache.lucene.search.TermRangeQuery; import org.apache.lucene.search.TopDocs; import org.apache.lucene.store.Directory; import org.apache.lucene.store.FSDirectory; @@ -23,16 +25,28 @@ import com.webobjects.appserver.WOActionResults; import com.webobjects.appserver.WORequest; import com.webobjects.directtoweb.D2W; +import com.webobjects.eoaccess.EOEntity; +import com.webobjects.eoaccess.EOModelGroup; import com.webobjects.eoaccess.EOUtilities; +import com.webobjects.eocontrol.EOAndQualifier; import com.webobjects.eocontrol.EOEditingContext; import com.webobjects.eocontrol.EOEnterpriseObject; +import com.webobjects.eocontrol.EOFetchSpecification; +import com.webobjects.eocontrol.EOKeyValueQualifier; +import com.webobjects.eocontrol.EOQualifier; +import com.webobjects.eocontrol.EOSortOrdering; +import com.webobjects.foundation.NSArray; +import com.webobjects.foundation.NSDictionary; import com.webobjects.foundation.NSLog; import com.webobjects.foundation.NSTimestamp; import er.directtoweb.ERD2WDirectAction; import er.extensions.components.ERXLoremIpsumGenerator; import er.extensions.eof.ERXEC; +import er.extensions.eof.qualifiers.ERXBetweenQualifier; import er.lucenceadaptor.example.components.Main; +import er.luceneadaptor.ERLuceneAdaptor; +import er.luceneadaptor.ERLuceneAdaptorChannel; public class DirectAction extends ERD2WDirectAction { @@ -107,42 +121,79 @@ return D2W.factory().defaultPage(session()); } + private static IndexReader reader; + public WOActionResults directQueryAction() throws IOException { - Directory d = FSDirectory.open(new File("/tmp/test")); - IndexReader reader = IndexReader.open(d); + if(reader == null) { + Directory directory = FSDirectory.open(new File("/tmp/test")); + reader = IndexReader.open(directory); + } IndexSearcher searcher = new IndexSearcher(reader); + for(int i = 0; i < searcher.maxDoc() && i < 10; i++) { + Document doc = searcher.doc(i); + // log.info(doc); + } Query query = null; - String key = "Morbi".toLowerCase(); - if(true) { + String key = "ipse".toLowerCase(); + if(false) { NumericRangeQuery q = NumericRangeQuery.newIntRange("userCount", Integer.valueOf(30), Integer.valueOf(10000), true, true); - q = NumericRangeQuery.newLongRange("userCount", Long.valueOf(30), Long.valueOf(10000), true, true); + //q = NumericRangeQuery.newLongRange("userCount", Long.valueOf(30), Long.valueOf(10000), true, true); query = q; } else { - TermQuery q = new TermQuery(new Term("contents", key)); + TermQuery q1 = new TermQuery(new Term("contents", key)); + TermRangeQuery q2 = new TermRangeQuery("userCount", NumericUtils.longToPrefixCoded(30), NumericUtils.longToPrefixCoded(300), false, false); + BooleanQuery q = new BooleanQuery(); + //q.add(q1, BooleanClause.Occur.MUST); + q.add(q2, BooleanClause.Occur.MUST); query = q; } log.info(query); if (true) { TopDocs docs = searcher.search(query, Integer.MAX_VALUE); int hits = docs.totalHits; - for (int i = 0; i < hits; i++) { + for (int i = 0; i < hits && i < 50; i++) { int docId = docs.scoreDocs[i].doc; Document document = searcher.doc(docId); String fieldValue = document.get("userCount"); String content = document.get("contents"); Number userCount = NumericUtils.prefixCodedToLong(fieldValue); boolean contains = content.indexOf(key) >= 0; - log.info(i +"/" + docId + "->" + userCount + "-" + content); + log.info(i +"/" + docId + "->" + userCount + "-" + document); } } else { - Collector streamingHitCollector = new SimpleCollector(searcher); searcher.search(query, streamingHitCollector); } return D2W.factory().defaultPage(session()); } + public WOActionResults eofQueryAction() throws IOException { + EOEditingContext ec = ERXEC.newEditingContext(); + ec.lock(); + try { + EOQualifier q1 = new EOKeyValueQualifier("contents", EOQualifier.QualifierOperatorLike, "suspend*"); + EOQualifier q2 = new ERXBetweenQualifier("userCount", Long.valueOf(30), Long.valueOf(800)); + // EOQualifier q3 = new EOKeyValueQualifier("userCount", EOQualifier.QualifierOperatorEqual, Long.valueOf(82)); + //EOQualifier q3 = new EOKeyValueQualifier("userCount", EOQualifier.QualifierOperatorLessThan, Long.valueOf(82)); + EOQualifier q3 = new EOKeyValueQualifier("userCount", EOQualifier.QualifierOperatorLessThanOrEqualTo, Long.valueOf(802)); + EOQualifier qualifier = new EOAndQualifier(new NSArray<EOQualifier>(new EOQualifier[]{q1, q2, q3})); + EOFetchSpecification fs = new EOFetchSpecification("LuceneAsset", qualifier, null); + fs.setFetchLimit(5); + fs.setSortOrderings(new NSArray(new EOSortOrdering("userCount", EOSortOrdering.CompareAscending))); + Query query = ERLuceneAdaptorChannel.queryForQualifier(new EOKeyValueQualifier("userCount", EOQualifier.QualifierOperatorLessThanOrEqualTo, 802), EOUtilities.entityNamed(ec, "LuceneAsset")); + fs.setHints(new NSDictionary(query, ERLuceneAdaptor.QUERY_HINTS)); + NSArray<EOEnterpriseObject> result = ec.objectsWithFetchSpecification(fs); + log.info(result.count() + ": " + result.valueForKey("userCount")); + for (EOEnterpriseObject eo : result) { + log.info(result.count() + ": " + eo); + } + } finally { + ec.unlock(); + } + return D2W.factory().defaultPage(session()); + } + public WOActionResults createAction() { EOEditingContext ec = ERXEC.newEditingContext(); ec.lock(); @@ -151,7 +202,7 @@ for (int i = 0; i < 100; i++) { EOEnterpriseObject eo = EOUtilities.createAndInsertInstance(ec, "LuceneAsset"); eo.takeValueForKey(new NSTimestamp().timestampByAddingGregorianUnits(0, 0, -random.nextInt(2500), 0, 0, 0, null), "creationDate"); - eo.takeValueForKey(ERXLoremIpsumGenerator.firstParagraph(), "contents"); + eo.takeValueForKey(ERXLoremIpsumGenerator.randomSentence(), "contents"); eo.takeValueForKey(random.nextDouble(), "price"); eo.takeValueForKey(Long.valueOf(random.nextInt(2500)), "userCount"); } Modified: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/.classpath =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/.classpath 2011-02-25 10:08:31 UTC (rev 11987) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/.classpath 2011-02-25 15:45:57 UTC (rev 11988) @@ -11,8 +11,8 @@ <classpathentry exported="true" kind="con" path="WOFramework/JavaWebObjects"/> <classpathentry exported="true" kind="con" path="WOFramework/JavaXML"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry exported="true" kind="lib" path="Libraries/lucene-analyzers-3.0.3.jar"/> - <classpathentry exported="true" kind="lib" path="Libraries/lucene-core-3.0.3.jar"/> + <classpathentry exported="true" kind="lib" path="Libraries/lucene-analyzers-3.0.3.jar" sourcepath="Libraries/lucene-3.0.3-src.jar"/> + <classpathentry exported="true" kind="lib" path="Libraries/lucene-core-3.0.3.jar" sourcepath="Libraries/lucene-3.0.3-src.jar"/> <classpathentry exported="true" kind="lib" path="Libraries/lucene-snowball-3.0.3.jar"/> <classpathentry exported="true" kind="lib" path="Libraries/lucene-spellchecker-3.0.3.jar"/> <classpathentry kind="lib" path="Libraries/lucene-memory-3.0.3.jar"/> Modified: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/.settings/org.eclipse.jdt.core.prefs =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/.settings/org.eclipse.jdt.core.prefs 2011-02-25 10:08:31 UTC (rev 11987) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/.settings/org.eclipse.jdt.core.prefs 2011-02-25 15:45:57 UTC (rev 11988) @@ -1,4 +1,4 @@ -#Tue Feb 17 20:18:11 PST 2009 +#Fri Feb 25 12:40:48 CET 2011 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.autoboxing=error @@ -58,3 +58,271 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=280 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=280 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true Modified: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/.settings/org.eclipse.jdt.ui.prefs =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/.settings/org.eclipse.jdt.ui.prefs 2011-02-25 10:08:31 UTC (rev 11987) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/.settings/org.eclipse.jdt.ui.prefs 2011-02-25 15:45:57 UTC (rev 11988) @@ -1,3 +1,5 @@ -#Wed Nov 28 09:01:06 EST 2007 +#Fri Feb 25 12:40:32 CET 2011 eclipse.preferences.version=1 +formatter_profile=_Wonder +formatter_settings_version=11 internal.default.compliance=default Modified: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptor.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptor.java 2011-02-25 10:08:31 UTC (rev 11987) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptor.java 2011-02-25 15:45:57 UTC (rev 11988) @@ -16,7 +16,6 @@ import org.apache.lucene.store.LockObtainFailedException; import org.apache.lucene.util.Version; -import com.sun.tools.javac.util.Log; import com.webobjects.eoaccess.EOAdaptor; import com.webobjects.eoaccess.EOAdaptorContext; import com.webobjects.eoaccess.EOModel; @@ -33,6 +32,9 @@ */ public class ERLuceneAdaptor extends EOAdaptor { + public static final Object QUERY_HINTS = "query"; + public static final Object SORT_HINTS = "sort"; + private Object _syncFactory; public Directory _directory; public Analyzer _analyzer; Modified: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorChannel.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorChannel.java 2011-02-25 10:08:31 UTC (rev 11987) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorChannel.java 2011-02-25 15:45:57 UTC (rev 11988) @@ -1,7 +1,7 @@ package er.luceneadaptor; import java.io.IOException; -import java.math.BigDecimal; +import java.math.BigInteger; import java.text.Format; import java.text.ParseException; import java.util.Date; @@ -19,16 +19,24 @@ import org.apache.lucene.index.CorruptIndexException; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.Term; +import org.apache.lucene.search.BooleanClause; +import org.apache.lucene.search.BooleanQuery; +import org.apache.lucene.search.DisjunctionMaxQuery; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.MatchAllDocsQuery; -import org.apache.lucene.search.NumericRangeQuery; +import org.apache.lucene.search.MultiPhraseQuery; +import org.apache.lucene.search.PrefixQuery; import org.apache.lucene.search.Query; -import org.apache.lucene.search.QueryWrapperFilter; import org.apache.lucene.search.Sort; import org.apache.lucene.search.SortField; +import org.apache.lucene.search.TermQuery; +import org.apache.lucene.search.TermRangeQuery; +import org.apache.lucene.search.TopDocs; +import org.apache.lucene.search.WildcardQuery; import org.apache.lucene.util.NumericUtils; import org.apache.lucene.util.Version; +import com.ibm.icu.math.BigDecimal; import com.webobjects.eoaccess.EOAdaptorChannel; import com.webobjects.eoaccess.EOAttribute; import com.webobjects.eoaccess.EOEntity; @@ -61,6 +69,7 @@ import com.webobjects.foundation.NSTimestampFormatter; import com.webobjects.foundation._NSUtilities; +import er.extensions.eof.qualifiers.ERXBetweenQualifier; import er.extensions.foundation.ERXKeyValueCodingUtilities; import er.extensions.foundation.ERXPatcher; import er.extensions.qualifiers.ERXQualifierTraversal; @@ -72,56 +81,104 @@ */ public class ERLuceneAdaptorChannel extends EOAdaptorChannel { + private static final String EXTERNAL_NAME_KEY = "_e"; + static Logger log = Logger.getLogger(ERLuceneAdaptorChannel.class); private static class LuceneQualifierTraversal extends ERXQualifierTraversal { - NSMutableArray _qualifiers = new NSMutableArray(); + NSMutableArray _queries; + EOEntity _entity; - public LuceneQualifierTraversal() { + public LuceneQualifierTraversal(EOEntity entity) { + _entity = entity; } - protected NSArray<EOQualifier> qualifiersForLast(NSArray original) { - NSRange range = new NSRange(_qualifiers.count() - original.count(), original.count()); - NSArray<EOQualifier> result = _qualifiers.subarrayWithRange(range); - _qualifiers.removeObjectsInRange(range); + protected NSArray<Query> queriesForCurrent(int count) { + NSRange range = new NSRange(_queries.count() - count, count); + NSArray<Query> result = _queries.subarrayWithRange(range); + _queries.removeObjectsInRange(range); return result; } @Override protected boolean traverseAndQualifier(EOAndQualifier q) { - NSArray quals = qualifiersForLast(q.qualifiers()); - _qualifiers.addObject(quals); + NSArray<Query> queries = queriesForCurrent(q.qualifiers().count()); + BooleanQuery query = new BooleanQuery(); + for (Query current : queries) { + query.add(current, BooleanClause.Occur.MUST); + } + _queries.addObject(query); return true; } @Override - protected void visit(EOQualifierEvaluation q) { - _qualifiers = new NSMutableArray<EOQualifier>(); - super.visit(q); + protected boolean traverseNotQualifier(EONotQualifier q) { + NSArray<Query> queries = queriesForCurrent(1); + BooleanQuery query = new BooleanQuery(); + query.add(queries.lastObject(), BooleanClause.Occur.MUST_NOT); + _queries.addObject(query); + return true; } @Override - protected boolean traverseUnknownQualifier(EOQualifierEvaluation q) { - throw new IllegalArgumentException("Unknown qualifier: " + q); + protected boolean traverseOrQualifier(EOOrQualifier q) { + NSArray<Query> queries = queriesForCurrent(q.qualifiers().count()); + DisjunctionMaxQuery query = new DisjunctionMaxQuery(queries, 0); + _queries.addObject(query); + return true; } @Override - protected boolean traverseNotQualifier(EONotQualifier q) { - _qualifiers.addObject(q); - return super.traverseNotQualifier(q); + protected boolean traverseUnknownQualifier(EOQualifierEvaluation q) { + throw new IllegalArgumentException("Unknown qualifier: " + q); } @Override - protected boolean traverseOrQualifier(EOOrQualifier q) { - NSArray quals = qualifiersForLast(q.qualifiers()); - _qualifiers.addObject(quals); - return true; - } - - @Override protected boolean traverseKeyValueQualifier(EOKeyValueQualifier q) { - _qualifiers.addObject(q); + Query query = null; + String key = _entity.attributeNamed(q.key()).columnName(); + IndexAttribute attr = new IndexAttribute(_entity.attributeNamed(key)); + if (q instanceof ERXBetweenQualifier) { + ERXBetweenQualifier between = (ERXBetweenQualifier) q; + Object min = between.minimumValue(); + Object max = between.maximumValue(); + query = new TermRangeQuery(key, attr.asLuceneValue(min), attr.asLuceneValue(max), false, false); + } else if(q.selector().equals(EOQualifier.QualifierOperatorGreaterThan)) { + query = new TermRangeQuery(key, attr.asLuceneValue(q.value()), null, false, false); + } else if(q.selector().equals(EOQualifier.QualifierOperatorGreaterThanOrEqualTo)) { + query = new TermRangeQuery(key, attr.asLuceneValue(q.value()), null, true, false); + } else if(q.selector().equals(EOQualifier.QualifierOperatorLessThan)) { + query = new TermRangeQuery(key, null, attr.asLuceneValue(q.value()), false, false); + } else if(q.selector().equals(EOQualifier.QualifierOperatorLessThanOrEqualTo)) { + query = new TermRangeQuery(key, null, attr.asLuceneValue(q.value()), false, true); + } else if(q.selector().equals(EOQualifier.QualifierOperatorCaseInsensitiveLike) || q.selector().equals(EOQualifier.QualifierOperatorLike)) { + String value = q.value().toString(); + if(q.selector().equals(EOQualifier.QualifierOperatorLike)) { + value = value.toLowerCase(); + } + int star = value.indexOf('*'); + if(star >= 0) { + if(star < value.length() - 1) { + query = new WildcardQuery(new Term(key, value)); + } else { + query = new PrefixQuery(new Term(key, value.substring(0, star))); + } + } else if(value.contains(" ")) { + MultiPhraseQuery multi = new MultiPhraseQuery(); + query = multi; + String parts[] = value.split(" +"); + for (int i = 0; i < parts.length; i++) { + String part = parts[i]; + multi.add(new Term(key, part)); + } + } else { + query = new TermQuery(new Term(key, value)); + } + } else { + query = new TermQuery(new Term(key, attr.asLuceneValue(q.value()))); + } + _queries.addObjects(query); return true; } @@ -130,11 +187,17 @@ throw new IllegalArgumentException("Unknown qualifier: " + q); } + @Override + public void traverse(EOQualifierEvaluation q, boolean postOrder) { + _queries = new NSMutableArray<Query>(); + super.traverse(q, true); + } + public Query query() { - //TermQuery query = new TermQuery(new Term("", "vessn*")); - NumericRangeQuery query = NumericRangeQuery.newIntRange("userCount", Integer.valueOf(300), Integer.valueOf(2000), true, true); - //query.add(); - return query; + BooleanQuery q = new BooleanQuery(); + q.add(new TermQuery(new Term(EXTERNAL_NAME_KEY, _entity.externalName())), BooleanClause.Occur.MUST); + q.add((Query) _queries.lastObject(), BooleanClause.Occur.MUST); + return q; } } @@ -149,33 +212,34 @@ private static String[] CODES = new String[] { "ar", "br", "cjk", "cn", "cz", "de", "el", "fa", "fr", "nl", "ru", "th" }; private static NSDictionary<String, String> LOCALES = new NSDictionary<String, String>(NAMES, CODES); - String _name; + private String _columnName; - TermVector _termVector; + private TermVector _termVector; - Store _store; + private Store _store; - Index _index; + private Index _index; - Analyzer _analyzer; + private Analyzer _analyzer; - Format _format; + private Format _format; - EOAttribute _attribute; + private EOAttribute _attribute; + @SuppressWarnings("deprecation") public IndexAttribute(EOAttribute attribute) { _attribute = attribute; NSDictionary dict = attribute.userInfo() != null ? attribute.userInfo() : NSDictionary.emptyDictionary(); - _name = attribute.columnName(); + _columnName = attribute.columnName(); boolean isClassProperty = _attribute.entity().classPropertyNames().contains(_attribute.name()); - boolean isDataProperty = _attribute.className().contains("NSData"); - boolean isStringProperty = _attribute.className().contains("String"); - _termVector = (TermVector) classValue(dict, "termVector", TermVector.class, isClassProperty && !isDataProperty && isStringProperty? "YES" : "NO"); + boolean isDataProperty = _attribute.className().endsWith("NSData"); + boolean isStringProperty = _attribute.className().endsWith("String"); + _termVector = (TermVector) classValue(dict, "termVector", TermVector.class, isClassProperty && !isDataProperty && isStringProperty ? "YES" : "NO"); _store = (Store) classValue(dict, "store", Store.class, "YES"); _index = (Index) classValue(dict, "index", Index.class, isClassProperty && !isDataProperty && isStringProperty ? "ANALYZED" : "NOT_ANALYZED"); String analyzerClass = (String) dict.objectForKey("analyzer"); - if (analyzerClass == null && _name.matches("\\w+_(\\w+)")) { - String locale = _name.substring(_name.lastIndexOf('_') + 1).toLowerCase(); + if (analyzerClass == null && _columnName.matches("\\w+_(\\w+)")) { + String locale = _columnName.substring(_columnName.lastIndexOf('_') + 1).toLowerCase(); analyzerClass = LOCALES.objectForKey(locale); if (analyzerClass != null) { analyzerClass = ERXPatcher.classForName("org.apache.lucene.analysis." + locale + "." + analyzerClass).getName(); @@ -234,8 +298,8 @@ return _store; } - public String name() { - return _name; + public String columnName() { + return _columnName; } public Analyzer analyzer() { @@ -246,23 +310,32 @@ if (_format != null) { return _format.format(value); } - if (value instanceof Number) { - if (value instanceof Double) { - return NumericUtils.doubleToPrefixCoded(((Number) value).doubleValue()); - } else if (value instanceof Long) { + if(value == null) { + return null; + } + if (attribute().valueType() != null) { + char valueType = attribute().valueType().charAt(0); + switch (valueType) { + case 'i': + return NumericUtils.intToPrefixCoded(((Number) value).intValue()); + case 'b': return NumericUtils.longToPrefixCoded(((Number) value).longValue()); - } else if (value instanceof BigDecimal) { + case 'l': + return NumericUtils.longToPrefixCoded(((Number) value).longValue()); + case 'd': return NumericUtils.doubleToPrefixCoded(((Number) value).doubleValue()); + case 'B': + return NumericUtils.doubleToPrefixCoded(((Number) value).doubleValue()); } - return NumericUtils.intToPrefixCoded(((Number) value).intValue()); - } else if (value instanceof Date) { + } + if (value instanceof Date) { return DateTools.dateToString((Date) value, Resolution.MILLISECOND); } else if (value instanceof NSData) { return NSPropertyListSerialization.stringFromPropertyList(value); } else if (value instanceof NSArray) { return ((NSArray) value).componentsJoinedByString(" "); } - return (value != null ? value.toString() : null); + return value.toString(); } public Object asEOFValue(String value) { @@ -270,40 +343,45 @@ if (_format != null) { return _format.parseObject(value); } - - if (attribute().className().contains("NSTimestamp")) { - return new NSTimestamp(DateTools.stringToDate(value)); - } else if (attribute().className().contains("NSData")) { - return new NSData((NSData)NSPropertyListSerialization.propertyListFromString(value)); - } else if (attribute().className().contains("NSArray")) { - return NSArray.componentsSeparatedByString(value, " "); - } else { - String valueType = attribute().valueType(); - if ("b".equals(valueType)) { + if(value == null) { + return null; + } + if (attribute().valueType() != null) { + char valueType = attribute().valueType().charAt(0); + switch (valueType) { + case 'i': return Integer.valueOf(NumericUtils.prefixCodedToInt(value)); - } else if ("i".equals(valueType)) { - return Integer.valueOf(NumericUtils.prefixCodedToInt(value)); - } else if ("l".equals(valueType)) { + case 'b': + return BigInteger.valueOf(NumericUtils.prefixCodedToLong(value)); + case 'l': return Long.valueOf(NumericUtils.prefixCodedToLong(value)); - } else if ("d".equals(valueType)) { + case 'd': return Double.valueOf(NumericUtils.prefixCodedToDouble(value)); - } else if ("B".equals(valueType)) { + case 'B': return BigDecimal.valueOf(NumericUtils.prefixCodedToDouble(value)); } } - return (value != null ? value.toString() : null); + if (attribute().className().contains("NSTimestamp")) { + return new NSTimestamp(DateTools.stringToDate(value)); + } else if (attribute().className().contains("NSData")) { + return new NSData((NSData) NSPropertyListSerialization.propertyListFromString(value)); + } else if (attribute().className().contains("NSArray")) { + return NSArray.componentsSeparatedByString(value, " "); + } + return value.toString(); } catch (ParseException ex) { throw NSForwardException._runtimeExceptionForThrowable(ex); } } - public Field valueToField(Object value) { + public Field valueToField(Document doc,Object value) { String stringValue = asLuceneValue(value); - if (stringValue != null) { - Field field = new Field(name(), stringValue, store(), index(), termVector()); - return field; + Field field = doc.getField(columnName()); + if(field == null) { + field = new Field(columnName(), stringValue, store(), index(), termVector()); } - return null; + field.setValue(stringValue); + return field; } public EOAttribute attribute() { @@ -315,10 +393,10 @@ private NSArray<IndexAttribute> _indexAttributes; private EOEntity _entity; private int _fetchIndex; - private int _fetchCount; private boolean _open; private IndexSearcher _searcher; private boolean _fetchInProgress = false; + private TopDocs _fetchedDocs; public ERLuceneAdaptorChannel(ERLuceneAdaptorContext context) { super(context); @@ -342,7 +420,9 @@ } public IndexSearcher searcher() throws CorruptIndexException, IOException { - if (_searcher == null/* || !adaptorContext().adaptor().indexReader().isCurrent()*/) { + if (_searcher == null/* + * || !adaptorContext().adaptor().indexReader().isCurrent () + */) { _searcher = new IndexSearcher(adaptorContext().adaptor().indexReader()); } return _searcher; @@ -370,7 +450,7 @@ private void reset() { _fetchInProgress = false; - _fetchCount = -1; + _fetchedDocs = null; _fetchIndex = -1; _entity = null; _searcher = null; @@ -416,7 +496,8 @@ NSMutableDictionary row = null; if (hasMoreRowsToReturn()) { try { - Document doc = searcher().doc(_fetchIndex++); + int docId = _fetchedDocs.scoreDocs[_fetchIndex++].doc; + Document doc = searcher().doc(docId); EOClassDescription cd = EOClassDescription.classDescriptionForEntityName(_entity.name()); NSMutableDictionary dict = cd._newDictionaryForProperties(); for (IndexAttribute attr : _indexAttributes) { @@ -448,7 +529,7 @@ } private boolean hasMoreRowsToReturn() { - return _fetchIndex < _fetchCount; + return _fetchIndex < _fetchedDocs.totalHits; } @Override @@ -474,7 +555,7 @@ } @Override - public void selectAttributes(NSArray attributesToFetch, EOFetchSpecification fetchSpecification, boolean shouldLock, EOEntity entity) { + public void selectAttributes(NSArray attributesToFetch, EOFetchSpecification fs, boolean shouldLock, EOEntity entity) { if (entity == null) { throw new IllegalArgumentException("null entity."); } @@ -489,38 +570,31 @@ try { _fetchIndex = 0; IndexSearcher searcher = searcher(); - Query query = queryForQualifier(fetchSpecification.qualifier()); - int fetchLimit = fetchSpecification.fetchLimit() > 0 ? fetchSpecification.fetchLimit() : Integer.MAX_VALUE; - fetchLimit = 5; + Query query = null; Sort sort = null; - if (fetchSpecification.sortOrderings().count() > 0) { - NSMutableArray<SortField> fields = new NSMutableArray<SortField>(fetchSpecification.sortOrderings().count()); - for (EOSortOrdering s : (NSArray<EOSortOrdering>) fetchSpecification.sortOrderings()) { - String name = s.key(); - NSSelector sel = s.selector(); - boolean reverse = sel.equals(EOSortOrdering.CompareDescending) || sel.equals(EOSortOrdering.CompareCaseInsensitiveDescending); - SortField sf = new SortField(name, 0, reverse); - fields.addObject(sf); - } - if(fields.count() > 0) { - sort = new Sort(); - sort.setSort(fields.toArray(new SortField[]{})); - } - } else { - searcher.search(query, new QueryWrapperFilter(query), fetchLimit); + + if(fs.hints() != null) { + query = (Query) fs.hints().objectForKey(ERLuceneAdaptor.QUERY_HINTS); + sort = (Sort) fs.hints().objectForKey(ERLuceneAdaptor.SORT_HINTS); } - if(sort != null) { - searcher.search(query, new QueryWrapperFilter(query), fetchLimit, sort); + if(query == null) { + query = queryForQualifier(fs.qualifier(), entity); + } + if(sort == null) { + sort = sortForSortOrderings(fs.sortOrderings()); + } + int fetchLimit = fs.fetchLimit() > 0 ? fs.fetchLimit() : Integer.MAX_VALUE; + if (sort != null) { + _fetchedDocs = searcher.search(query, null, fetchLimit, sort); } else { - searcher.search(query, new QueryWrapperFilter(query), fetchLimit); + _fetchedDocs = searcher.search(query, fetchLimit); } - _fetchCount = searcher.maxDoc(); } catch (EOGeneralAdaptorException e) { cancelFetch(); throw e; } catch (Throwable e) { cancelFetch(); - throw new ERLuceneAdaptorException("Failed to fetch '" + entity.name() + "' with fetch specification '" + fetchSpecification + "': " + e.getMessage(), e); + throw new ERLuceneAdaptorException("Failed to fetch '" + entity.name() + "' with fetch specification '" + fs + "': " + e.getMessage(), e); } } @@ -536,7 +610,7 @@ private Term termForDocument(Document doc, EOEntity entity) { for (IndexAttribute info : attributesForAttributes(entity.primaryKeyAttributes())) { - String name = info.name(); + String name = info.columnName(); String value = doc.get(name); Term term = new Term(name); term = term.createTerm(value); @@ -545,30 +619,17 @@ return null; } - private Query queryForQualifier(EOQualifier qualifier) { - if (qualifier == null && false) { - return new MatchAllDocsQuery(); - } - /* - * if(true) { FilteredQuery query = new FilteredQuery(null, new - * Filter()); query.add(new Term("content", "vessn*")); return query; - * - * } - */ - - LuceneQualifierTraversal traverser = new LuceneQualifierTraversal(); - traverser.traverse(qualifier); - Query query = traverser.query(); - return query; - } - private void fillWithDictionary(Document doc, NSDictionary row, EOEntity entity) { for (IndexAttribute info : attributesForEntity(entity)) { - Object value = row.objectForKey(info.attribute().name()); - - Field field = info.valueToField(value); - if (field != null) { - doc.add(field); + Object value = row.objectForKey(info.attribute().columnName()); + if (value != null) { + if(value == NSKeyValueCoding.NullValue) { + value = null; + } + Field field = info.valueToField(doc, value); + if (field != null) { + doc.add(field); + } } } } @@ -577,11 +638,12 @@ public int updateValuesInRowsDescribedByQualifier(NSDictionary updatedRow, EOQualifier qualifier, EOEntity entity) { try { IndexSearcher searcher = searcher(); - Query query = queryForQualifier(qualifier); - searcher.search(query, Integer.MAX_VALUE); - int count = searcher.maxDoc(); + Query query = queryForQualifier(qualifier, entity); + TopDocs fetchedDocs = searcher.search(query, Integer.MAX_VALUE); + int count = fetchedDocs.totalHits; for (int i = 0; i < count; i++) { - Document doc = searcher.doc(i); + int docId = fetchedDocs.scoreDocs[i].doc; + Document doc = searcher.doc(docId); fillWithDictionary(doc, updatedRow, entity); Term term = termForDocument(doc, entity); writer().updateDocument(term, doc); @@ -599,6 +661,7 @@ try { Document doc = new Document(); fillWithDictionary(doc, row, entity); + doc.add(new Field(EXTERNAL_NAME_KEY, entity.externalName(), Store.NO, Index.NOT_ANALYZED)); writer().addDocument(doc); } catch (EOGeneralAdaptorException e) { throw e; @@ -611,11 +674,12 @@ public int deleteRowsDescribedByQualifier(EOQualifier qualifier, EOEntity entity) { try { IndexSearcher searcher = searcher(); - Query query = queryForQualifier(qualifier); - searcher.search(query, null, Integer.MAX_VALUE); - int count = searcher.maxDoc(); + Query query = queryForQualifier(qualifier, entity); + TopDocs fetchedDocs = searcher.search(query, Integer.MAX_VALUE); + int count = fetchedDocs.totalHits; for (int i = 0; i < count; i++) { - Document doc = searcher.doc(i); + int docId = fetchedDocs.scoreDocs[i].doc; + Document doc = searcher.doc(docId); Term term = termForDocument(doc, entity); writer().deleteDocuments(term); } @@ -626,4 +690,45 @@ throw new ERLuceneAdaptorException("Failed to delete '" + entity.name() + "' with qualifier " + qualifier + ": " + e.getMessage(), e); } } + + /** + * Convenience method to create a Lucene query from an EOF qualifier. + * @param qualifier + * @param entity + * @return + */ + public static Query queryForQualifier(EOQualifier qualifier, EOEntity entity) { + if(qualifier == null) { + return new TermQuery(new Term(EXTERNAL_NAME_KEY, entity.externalName())); + } + LuceneQualifierTraversal traverser = new LuceneQualifierTraversal(entity); + traverser.traverse(qualifier, true); + Query query = traverser.query(); + return query; + } + + + /** + * Convenience method to create a Lucene sort from an EOF sort ordering array. + * @param sortOrderings + * @return + */ + public static Sort sortForSortOrderings(NSArray<EOSortOrdering> sortOrderings) { + Sort sort = null; + if (sortOrderings != null && sortOrderings.count() > 0) { + NSMutableArray<SortField> fields = new NSMutableArray<SortField>(sortOrderings.count()); + for (EOSortOrdering s : sortOrderings) { + String name = s.key(); + NSSelector sel = s.selector(); + boolean reverse = sel.equals(EOSortOrdering.CompareDescending) || sel.equals(EOSortOrdering.CompareCaseInsensitiveDescending); + SortField sf = new SortField(name, SortField.DOC, reverse); + fields.addObject(sf); + } + if (fields.count() > 0) { + sort = new Sort(); + sort.setSort(fields.toArray(new SortField[] {})); + } + } + return sort; + } } Modified: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorContext.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorContext.java 2011-02-25 10:08:31 UTC (rev 11987) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOAdaptors/JavaLuceneAdaptor/Sources/er/luceneadaptor/ERLuceneAdaptorContext.java 2011-02-25 15:45:57 UTC (rev 11988) @@ -8,17 +8,18 @@ import org.apache.lucene.index.CorruptIndexException; import org.apache.lucene.index.IndexWriter; +import com.sun.xml.internal.ws.util.ByteArrayBuffer; import com.webobjects.eoaccess.EOAdaptor; import com.webobjects.eoaccess.EOAdaptorChannel; import com.webobjects.eoaccess.EOAdaptorContext; import com.webobjects.eoaccess.EOAttribute; import com.webobjects.eoaccess.EOEntity; -import com.webobjects.eoaccess.EOGeneralAdaptorException; import com.webobjects.eocontrol.EOEnterpriseObject; import com.webobjects.eocontrol.EOTemporaryGlobalID; import com.webobjects.foundation.NSArray; import com.webobjects.foundation.NSData; import com.webobjects.foundation.NSDictionary; +import com.webobjects.foundation.NSForwardException; /** * ERLuceneAdaptorContext provides the transaction support for the adaptor. @@ -27,7 +28,7 @@ */ public class ERLuceneAdaptorContext extends EOAdaptorContext { - IndexWriter _writer; + private IndexWriter _writer; public ERLuceneAdaptorContext(EOAdaptor adaptor) { super(adaptor); @@ -40,11 +41,19 @@ throw new ERLuceneAdaptorException("Failed to generate primary key because " + entity.name() + " has a composite primary key."); } EOAttribute pkAttribute = (EOAttribute) pkAttributes.objectAtIndex(0); - Object pkValue; + Object pkValue = null; String className = pkAttribute.className(); String valueType = pkAttribute.valueType(); if ("com.webobjects.foundation.NSData".equals(className)) { - pkValue = new NSData(new EOTemporaryGlobalID()._rawBytes()); + ByteArrayBuffer buf = new ByteArrayBuffer(); + try { + buf.write(entity.externalName().getBytes()); + buf.write('.'); + buf.write(new EOTemporaryGlobalID()._rawBytes()); + pkValue = new NSData(buf.getRawData()); + } catch (IOException e) { + throw NSForwardException._runtimeExceptionForThrowable(e); + } } else { throw new IllegalArgumentException("Unknown value type '" + valueType + "' for '" + object + "' of entity '" + entity.name() + "'."); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <elvisrobert@us...> - 2011-02-25 10:08:37
|
Revision: 11987 http://wonder.svn.sourceforge.net/wonder/?rev=11987&view=rev Author: elvisrobert Date: 2011-02-25 10:08:31 +0000 (Fri, 25 Feb 2011) Log Message: ----------- http://issues.objectstyle.org/jira/browse/WONDER-685 Added fetchBLOB method Patched provided by Marius Soutier Modified Paths: -------------- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/PlugIns/H2PlugIn/Sources/er/h2/jdbcadaptor/ERH2PlugIn.java Modified: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/PlugIns/H2PlugIn/Sources/er/h2/jdbcadaptor/ERH2PlugIn.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/PlugIns/H2PlugIn/Sources/er/h2/jdbcadaptor/ERH2PlugIn.java 2011-02-23 20:15:05 UTC (rev 11986) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/PlugIns/H2PlugIn/Sources/er/h2/jdbcadaptor/ERH2PlugIn.java 2011-02-25 10:08:31 UTC (rev 11987) @@ -1,10 +1,13 @@ package er.h2.jdbcadaptor; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; +import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Timestamp; import java.text.Format; import java.text.SimpleDateFormat; @@ -13,7 +16,6 @@ import com.webobjects.eoaccess.EOAttribute; import com.webobjects.eoaccess.EOEntity; import com.webobjects.eoaccess.EORelationship; -import com.webobjects.eoaccess.EOSQLExpression; import com.webobjects.eoaccess.EOSynchronizationFactory; import com.webobjects.foundation.NSArray; import com.webobjects.foundation.NSBundle; @@ -29,9 +31,9 @@ import com.webobjects.jdbcadaptor.JDBCPlugIn; public class ERH2PlugIn extends JDBCPlugIn { - + static final boolean USE_NAMED_CONSTRAINTS = true; - + protected static String quoteTableName(String name) { String result = null; if (name != null) { @@ -40,7 +42,7 @@ result = new StringBuilder('"').append(name).append('"').toString(); } else { result = - new StringBuilder(name.substring(0, i)) + new StringBuilder(name.substring(0, i)) .append("\".\"") .append(name.substring(i + 1, name.length())) .append('"') @@ -49,11 +51,11 @@ } return result; } - + static String singleQuotedString(Object value) { return value == null ? null : singleQuotedString(value.toString()); } - + static String singleQuotedString(String string) { if (string == null) { return null; @@ -61,8 +63,31 @@ return new StringBuilder("'").append(string).append("'").toString(); } + @Override + public Object fetchBLOB(ResultSet rs, int column, EOAttribute attribute, boolean materialize) throws SQLException { + final InputStream is = rs.getBinaryStream(column); + if (is == null) + return null; + + final ByteArrayOutputStream byteArrayOS = new ByteArrayOutputStream(); + int nextInput = 0; + try { + while ((nextInput = is.read()) != -1) { + byteArrayOS.write(nextInput); + } + } + catch (IOException e) { + e.printStackTrace(); + } + + if (NSData.class.getName().equals(attribute.className())) + return new NSData(byteArrayOS.toByteArray()); + + return byteArrayOS.toString(); + } + public static class H2Expression extends JDBCExpression { - + public H2Expression(final EOEntity entity) { super(entity); } @@ -73,7 +98,7 @@ sql.append(attribute.columnName()); sql.append(' '); sql.append(columnTypeStringForAttribute(attribute)); - + NSDictionary userInfo = attribute.userInfo(); if (userInfo != null) { Object defaultValue = userInfo.valueForKey("er.extensions.eoattribute.default"); @@ -82,7 +107,7 @@ sql.append(formatValueForAttribute(defaultValue, attribute)); } } - + sql.append(' '); sql.append(allowsNullClauseForConstraint(attribute.allowsNull())); @@ -172,10 +197,10 @@ try { Object adaptorValue = eoattribute.adaptorValueByConvertingAttributeValue(value); if (adaptorValue instanceof NSData - || adaptorValue instanceof NSTimestamp - || adaptorValue instanceof String - || adaptorValue instanceof Number - || adaptorValue instanceof Boolean) + || adaptorValue instanceof NSTimestamp + || adaptorValue instanceof String + || adaptorValue instanceof Number + || adaptorValue instanceof Boolean) { result = formatValueForAttribute(adaptorValue, eoattribute); } @@ -189,9 +214,9 @@ .append(adaptorValue) .append(':') .append(adaptorValue.getClass().getName()); - + NSLog.err.appendln(buff.toString()); - + result = value.toString(); } } @@ -199,10 +224,10 @@ StringBuilder buff = new StringBuilder(getClass().getName()) .append(": Exception while converting ") .append(value.getClass().getName()); - + NSLog.err.appendln(buff.toString()); NSLog.err.appendln(ex); - + result = value.toString(); } } @@ -231,7 +256,7 @@ } public static class H2SynchronizationFactory extends EOSynchronizationFactory { - + public H2SynchronizationFactory(final EOAdaptor adaptor) { super(adaptor); } @@ -240,7 +265,7 @@ public NSArray _statementsToDropPrimaryKeyConstraintsOnTableNamed(final String tableName) { return new NSArray(_expressionForString("ALTER TABLE " + formatTableName(tableName) + " DROP PRIMARY KEY")); } - + public String columnTypeStringForAttribute(EOAttribute attribute) { if (attribute.precision() != 0) { String precision = String.valueOf(attribute.precision()); @@ -265,17 +290,19 @@ String tableName = ((EOEntity) entityGroup.objectAtIndex(0)).externalName(); return new NSArray(_expressionForString("DROP TABLE " + formatTableName(tableName))); } - + //@Override WO5.4 + @Override public String formatColumnName(String columnName) { return columnName; } - + //@Override WO5.4 + @Override public String formatTableName(String tableName) { return tableName; } - + public String formatUpperString(String string) { return string.toUpperCase(); } @@ -296,8 +323,8 @@ @Override public NSArray foreignKeyConstraintStatementsForRelationship(EORelationship relationship) { if (relationship != null - && !relationship.isToMany() - && isPrimaryKeyAttributes(relationship.destinationEntity(), relationship.destinationAttributes())) + && !relationship.isToMany() + && isPrimaryKeyAttributes(relationship.destinationEntity(), relationship.destinationAttributes())) { StringBuffer sql = new StringBuffer(); String tableName = formatTableName(relationship.entity().externalName()); @@ -342,7 +369,7 @@ fkSql.append(referencedColumnName); constraint.append(formatUpperString(referencedColumnName)); } - + // MS: did i write this code? sorry about that everything. this is crazy. constraint.append('"'); @@ -367,7 +394,8 @@ String pkField = formatColumnName("pk") + " INT"; return new NSArray(_expressionForString("CREATE TABLE " + formatTableName(pkTable) + " (" + charField + ", " + pkField + ")")); } - + + @Override public NSArray statementsToConvertColumnType(String columnName, String tableName, ColumnTypes oldType, ColumnTypes newType, NSDictionary options) { EOAttribute attr = new EOAttribute(); attr.setName(columnName); @@ -376,16 +404,17 @@ attr.setScale(newType.scale()); attr.setPrecision(newType.precision()); attr.setWidth(newType.width()); - + String columnTypeString = columnTypeStringForAttribute(attr); - + NSArray statements = new NSArray(_expressionForString("ALTER TABLE " + formatTableName(tableName) + " ALTER COLUMN " + formatColumnName(columnName) + " " + columnTypeString)); return statements; } - + + @Override public NSArray statementsToDeleteColumnNamed(String columnName, String tableName, NSDictionary options) { - return new NSArray(_expressionForString("ALTER TABLE " + formatTableName(tableName) + " DROP COLUMN " + formatTableName(columnName))); - } + return new NSArray(_expressionForString("ALTER TABLE " + formatTableName(tableName) + " DROP COLUMN " + formatTableName(columnName))); + } @Override public NSArray statementsToInsertColumnForAttribute(final EOAttribute attribute, final NSDictionary options) { @@ -399,28 +428,30 @@ return result; } - + /** * @see com.webobjects.eoaccess.EOSynchronizationFactory#statementsToModifyColumnNullRule(java.lang.String, java.lang.String, boolean, com.webobjects.foundation.NSDictionary) */ @Override public NSArray statementsToModifyColumnNullRule(String columnName, String tableName, boolean allowsNull, NSDictionary options) { NSArray statements; - if (allowsNull) { - statements = new NSArray(_expressionForString("ALTER TABLE " + formatTableName(tableName) + " ALTER COLUMN " + formatColumnName(columnName) + " SET NULL")); - } else { - statements = new NSArray(_expressionForString("ALTER TABLE " + formatTableName(tableName) + " ALTER COLUM " + formatColumnName(columnName) + " SET NOT NULL")); - } - return statements; + if (allowsNull) { + statements = new NSArray(_expressionForString("ALTER TABLE " + formatTableName(tableName) + " ALTER COLUMN " + formatColumnName(columnName) + " SET NULL")); + } else { + statements = new NSArray(_expressionForString("ALTER TABLE " + formatTableName(tableName) + " ALTER COLUM " + formatColumnName(columnName) + " SET NOT NULL")); + } + return statements; } - + + @Override public NSArray statementsToRenameColumnNamed(String columnName, String tableName, String newName, NSDictionary nsdictionary) { return new NSArray(_expressionForString("ALTER TABLE " + formatTableName(tableName) + " ALTER COLUMN " + formatColumnName(columnName) + " RENAME TO " + formatColumnName(newName))); } - + + @Override public NSArray statementsToRenameTableNamed(String tableName, String newName, NSDictionary options) { - return new NSArray(_expressionForString("ALTER TABLE " + formatTableName(tableName) + " RENAME TO " + formatTableName(newName))); - } + return new NSArray(_expressionForString("ALTER TABLE " + formatTableName(tableName) + " RENAME TO " + formatTableName(newName))); + } @Override public boolean supportsSchemaSynchronization() { @@ -445,7 +476,7 @@ private static Format timestampFormatter() { return new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS"); } - + /** * flag for whether jdbcInfo should be written out has been tested. */ @@ -499,9 +530,9 @@ String jdbcInfoContent = NSPropertyListSerialization.stringFromPropertyList(super.jdbcInfo()); File tmpDir = new File(System.getProperty("java.io.tmpdir")); File jdbcInfoFile = new File(tmpDir, "H2JDBCInfo.plist"); - + NSLog.out.appendln("Writing H2JDBCInfo.plist to " + tmpDir.getAbsolutePath()); - + FileOutputStream fos = new FileOutputStream(jdbcInfoFile); fos.write(jdbcInfoContent.getBytes()); fos.close(); @@ -539,6 +570,7 @@ return jdbcInfo; } + @Override public String name() { return DRIVER_NAME; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bob_schwarzmann@us...> - 2011-02-23 20:15:11
|
Revision: 11986 http://wonder.svn.sourceforge.net/wonder/?rev=11986&view=rev Author: bob_schwarzmann Date: 2011-02-23 20:15:05 +0000 (Wed, 23 Feb 2011) Log Message: ----------- Recorded merge of revisions 11982 via svnmerge from https://wonder.svn.sourceforge.net/svnroot/wonder/branches/Wonder_2_0_0_Branch/Wonder ........ r11982 | marroz | 2011-02-22 03:40:07 -0800 (Tue, 22 Feb 2011) | 1 line Removed ERXSQLQuery implementation from Wonder 5.2. ........ Property Changed: ---------------- branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/ Property changes on: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder ___________________________________________________________________ Modified: svnmerge-integrated - /branches/Wonder_2_0_0_Branch/Wonder:1-11979 + /branches/Wonder_2_0_0_Branch/Wonder:1-11979,11982 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <anjo@us...> - 2011-02-23 14:52:35
|
Revision: 11985 http://wonder.svn.sourceforge.net/wonder/?rev=11985&view=rev Author: anjo Date: 2011-02-23 14:52:29 +0000 (Wed, 23 Feb 2011) Log Message: ----------- NPE prevention when calling new NSArray(new ArrayList(), true) Modified Paths: -------------- branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/Core/ERExtensions/Sources/com/webobjects/foundation/NSArray.java Modified: branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/Core/ERExtensions/Sources/com/webobjects/foundation/NSArray.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/Core/ERExtensions/Sources/com/webobjects/foundation/NSArray.java 2011-02-23 13:11:50 UTC (rev 11984) +++ branches/Wonder_5_0_0_WebObjects_5_3_Branch/Frameworks/Core/ERExtensions/Sources/com/webobjects/foundation/NSArray.java 2011-02-23 14:52:29 UTC (rev 11985) @@ -284,7 +284,9 @@ _setCount(validCount + offset); } else { _initializeWithCapacity(rangeLength + offset); - System.arraycopy(list.toArray(), rangeLocation, _objects(), offset, rangeLength); + if(rangeLength > 0) { + System.arraycopy(list.toArray(), rangeLocation, _objects(), offset, rangeLength); + } _setCount(rangeLength + offset); } } @@ -346,6 +348,9 @@ } protected void _setCount(int count) { + if(count != 0 && _objects() != null && count != _objects().length) { + throw new IllegalStateException(); + } // if(count != count() && count != 0) { // throw new IllegalStateException(); // } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 11984 http://wonder.svn.sourceforge.net/wonder/?rev=11984&view=rev Author: marroz Date: 2011-02-23 13:11:50 +0000 (Wed, 23 Feb 2011) Log Message: ----------- Removed @deprecated annotation from ERXProperties. Modified Paths: -------------- branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/foundation/ERXProperties.java Modified: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/foundation/ERXProperties.java =================================================================== --- branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/foundation/ERXProperties.java 2011-02-22 14:40:40 UTC (rev 11983) +++ branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/foundation/ERXProperties.java 2011-02-23 13:11:50 UTC (rev 11984) @@ -221,7 +221,6 @@ * @return array de-serialized from the string in * the system properties */ - @Deprecated public static NSArray arrayForKey(String s) { return NSProperties.arrayForKey(s); } @@ -234,7 +233,6 @@ * @return array de-serialized from the string in * the system properties or default value */ - @Deprecated public static NSArray arrayForKeyWithDefault(final String s, final NSArray defaultValue) { return NSProperties.arrayForKeyWithDefault(s, defaultValue); } @@ -248,7 +246,6 @@ * @return boolean value of the string in the * system properties. */ - @Deprecated public static boolean booleanForKey(String s) { return NSProperties.booleanForKey(s); } @@ -263,7 +260,6 @@ * @return boolean value of the string in the * system properties. */ - @Deprecated public static boolean booleanForKeyWithDefault(final String s, final boolean defaultValue) { return NSProperties.booleanForKeyWithDefault(s, defaultValue); } @@ -275,7 +271,6 @@ * @return dictionary de-serialized from the string in * the system properties */ - @Deprecated public static NSDictionary dictionaryForKey(String s) { return NSProperties.dictionaryForKey(s); } @@ -288,7 +283,6 @@ * @return dictionary de-serialized from the string in * the system properties */ - @Deprecated public static NSDictionary dictionaryForKeyWithDefault(final String s, final NSDictionary defaultValue) { return NSProperties.dictionaryForKeyWithDefault(s, defaultValue); } @@ -299,7 +293,6 @@ * @param s system property * @return int value of the system property or 0 */ - @Deprecated public static int intForKey(String s) { return NSProperties.intForKey(s); } @@ -310,7 +303,6 @@ * @param s system property * @return long value of the system property or 0 */ - @Deprecated public static long longForKey(String s) { return NSProperties.longForKey(s); } @@ -324,7 +316,6 @@ * @return bigDecimal value of the string in the * system properties. Scale is controlled by the string, ie "4.400" will have a scale of 3. */ - @Deprecated public static BigDecimal bigDecimalForKey(String s) { return NSProperties.bigDecimalForKey(s); } @@ -339,7 +330,6 @@ * @return BigDecimal value of the string in the * system properties. Scale is controlled by the string, ie "4.400" will have a scale of 3. */ - @Deprecated public static BigDecimal bigDecimalForKeyWithDefault(String s, BigDecimal defaultValue) { return NSProperties.bigDecimalForKeyWithDefault(s, defaultValue); } @@ -351,7 +341,6 @@ * @param defaultValue default value * @return int value of the system property or the default value */ - @Deprecated public static int intForKeyWithDefault(final String s, final int defaultValue) { return NSProperties.intForKeyWithDefault(s, defaultValue); } @@ -363,7 +352,6 @@ * @param defaultValue default value * @return long value of the system property or the default value */ - @Deprecated public static long longForKeyWithDefault(final String s, final long defaultValue) { return NSProperties.longForKeyWithDefault(s, defaultValue); } @@ -375,7 +363,6 @@ * @param s system property * @return string value of the system propery or null */ - @Deprecated public static String stringForKey(String s) { return NSProperties.stringForKey(s); } @@ -387,7 +374,6 @@ * @param s system property * @return string value of the system propery or null */ - @Deprecated public static String stringForKeyWithDefault(final String s, final String defaultValue) { return NSProperties.stringForKeyWithDefault(s, defaultValue); } @@ -405,7 +391,6 @@ * @deprecated Encrypted properties should now have a key like "foo.bar.@..." * @see ERXEncryptedProcessor */ - @Deprecated public static String decryptedStringForKey(String propertyName) { return NSProperties.stringForKey(propertyName); } @@ -424,7 +409,6 @@ * @deprecated Encrypted properties should now have a key like "foo.bar.@..." * @see ERXEncryptedProcessor */ - @Deprecated public static String decryptedStringForKeyWithDefault(String propertyName, String defaultValue) { return NSProperties.stringForKeyWithDefault(propertyName, defaultValue); } @@ -441,7 +425,6 @@ * @deprecated Encrypted properties should now have a key like "foo.bar.@..." * @see ERXEncryptedProcessor */ - @Deprecated public static String decryptedStringForKeyWithEncryptedDefault(String propertyName, String defaultValue) { String decryptedDefault = ERXCrypto.defaultCrypter().decrypt(defaultValue); return NSProperties.stringForKeyWithDefault(propertyName, decryptedDefault); @@ -486,7 +469,6 @@ * @param array to be set in the System properties * @param key to be used to get the value */ - @Deprecated public static void setArrayForKey(NSArray array, String key) { NSProperties.setArrayForKey(array, key); } @@ -497,17 +479,14 @@ * @param dictionary to be set in the System properties * @param key to be used to get the value */ - @Deprecated public static void setDictionaryForKey(NSDictionary dictionary, String key) { NSProperties.setDictionaryForKey(dictionary, key); } - @Deprecated public static NSSet setForKeyWithDefault(String key, NSSet defaultValue) { return NSProperties.setForKeyWithDefault(key, defaultValue); } - @Deprecated public static NSSet setForKey(String aKey) { return NSProperties.setForKey(aKey); } @@ -519,7 +498,6 @@ * @param key to be used to get the value */ // DELETEME: Really not needed anymore - @Deprecated public static void setStringForKey(String string, String key) { NSProperties.setStringForKey(string, key); } @@ -537,7 +515,6 @@ * * @deprecated USe {@link NSPropertyFileSource#propertiesFromFile(File, boolean)} */ - @Deprecated public static Properties propertiesFromPath(String path, boolean requireSymlink) { if (path == null || path.length() == 0) { log.warn("Attempting to read property file for null file path"); @@ -563,7 +540,6 @@ * @param anObject * @param aKey */ - @Deprecated public void takeValueForKey(Object anObject, String aKey) { NSPropertiesCoordinator.sharedInstance().takeValueForKey(anObject, aKey); } @@ -573,7 +549,6 @@ * * @param aKey */ - @Deprecated public Object valueForKey(String aKey) { return NSPropertiesCoordinator.sharedInstance().valueForKey(aKey); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: David Holt <programmingosx@ma...> - 2011-02-22 18:54:40
|
Thanks for this! d On 2011-02-20, at 3:17 PM, nullterminated@... wrote: > Revision: 11966 > http://wonder.svn.sourceforge.net/wonder/?rev=11966&view=rev > Author: nullterminated > Date: 2011-02-20 23:17:03 +0000 (Sun, 20 Feb 2011) > > Log Message: > ----------- > http://issues.objectstyle.org/jira/browse/WONDER-676 > > Sorry about the .txt file David. I'm not trying to poop in your living room :) This is the closest I could get out of either rule modeler. > > Modified Paths: > -------------- > trunk/Wonder/Frameworks/D2W/ERModernLook/Components/Nonlocalized.lproj/ERMODEditRelationshipPage.wo/ERMODEditRelationshipPage.html > trunk/Wonder/Frameworks/D2W/ERModernLook/Components/Nonlocalized.lproj/ERMODEditRelationshipPage.wo/ERMODEditRelationshipPage.wod > trunk/Wonder/Frameworks/D2W/ERModernLook/Resources/d2w.d2wmodel > trunk/Wonder/Frameworks/D2W/ERModernLook/Resources/d2w.d2wmodel.txt > > Modified: trunk/Wonder/Frameworks/D2W/ERModernLook/Components/Nonlocalized.lproj/ERMODEditRelationshipPage.wo/ERMODEditRelationshipPage.html > =================================================================== > --- trunk/Wonder/Frameworks/D2W/ERModernLook/Components/Nonlocalized.lproj/ERMODEditRelationshipPage.wo/ERMODEditRelationshipPage.html 2011-02-20 22:54:44 UTC (rev 11965) > +++ trunk/Wonder/Frameworks/D2W/ERModernLook/Components/Nonlocalized.lproj/ERMODEditRelationshipPage.wo/ERMODEditRelationshipPage.html 2011-02-20 23:17:03 UTC (rev 11966) > @@ -35,7 +35,9 @@ > <webobject name = "ShowCancel"> > <li><webobject name = "ReturnButton" /></li> > </webobject> > - <li><webobject name = "QueryButton" /></li> > + <webobject name = "ShowFind"> > + <li><webobject name = "QueryButton" /></li> > + </webobject> > <webobject name = "IsEntityWritable"> > <li><webobject name = "NewButton" /></li> > </webobject> > > Modified: trunk/Wonder/Frameworks/D2W/ERModernLook/Components/Nonlocalized.lproj/ERMODEditRelationshipPage.wo/ERMODEditRelationshipPage.wod > =================================================================== > --- trunk/Wonder/Frameworks/D2W/ERModernLook/Components/Nonlocalized.lproj/ERMODEditRelationshipPage.wo/ERMODEditRelationshipPage.wod 2011-02-20 22:54:44 UTC (rev 11965) > +++ trunk/Wonder/Frameworks/D2W/ERModernLook/Components/Nonlocalized.lproj/ERMODEditRelationshipPage.wo/ERMODEditRelationshipPage.wod 2011-02-20 23:17:03 UTC (rev 11966) > @@ -217,3 +217,7 @@ > condition = isListEmpty; > negate = true; > } > + > +ShowFind: WOConditional { > + condition = d2wContext.shouldShowQueryRelatedButton; > +} > > Modified: trunk/Wonder/Frameworks/D2W/ERModernLook/Resources/d2w.d2wmodel > =================================================================== > --- trunk/Wonder/Frameworks/D2W/ERModernLook/Resources/d2w.d2wmodel 2011-02-20 22:54:44 UTC (rev 11965) > +++ trunk/Wonder/Frameworks/D2W/ERModernLook/Resources/d2w.d2wmodel 2011-02-20 23:17:03 UTC (rev 11966) > @@ -1106,6 +1106,15 @@ > ); > }; > }; > + }, > + { > + "author" = "100"; > + "class" = "com.webobjects.directtoweb.Rule"; > + "rhs" = { > + "class" = "com.webobjects.directtoweb.BooleanAssignment"; > + "keyPath" = "shouldShowQueryRelatedButton"; > + "value" = "true"; > + }; > } > ); > } > \ No newline at end of file > > Modified: trunk/Wonder/Frameworks/D2W/ERModernLook/Resources/d2w.d2wmodel.txt > =================================================================== > --- trunk/Wonder/Frameworks/D2W/ERModernLook/Resources/d2w.d2wmodel.txt 2011-02-20 22:54:44 UTC (rev 11965) > +++ trunk/Wonder/Frameworks/D2W/ERModernLook/Resources/d2w.d2wmodel.txt 2011-02-20 23:17:03 UTC (rev 11966) > @@ -1,114 +1,111 @@ > ( > - 9 : *true* => baseClassForLine = Line [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForBanner = Banner [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForHeader = Header [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForSection = Section [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForWrapper = Wrapper [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForObjectRow = ObjRow [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForBatchNav = BatchNav [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForBatchSize = BatchSize [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForConfirmBlock = Banner [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForErrorBlock = ErrBlock [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForObjectTable = ObjTable [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForTopActions = TopActions [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForAttributeValue = AttrVal [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForLabelSpan = LabelWrapper [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForTopBatchNav = TopBatchNav [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForBottomActions = BtmActions [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForEmptyLabelSpan = EmptyLabel [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForInnerWrapper = InnerWrapper [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForTopBatchSize = TopBatchSize [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForAttributeColumn = AttrColumn [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForAttributeRepetition = AttrRep [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForEmbeddedEditBlock = EditBlock [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForEmbeddedListBlock = ListBlock [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForObjectTableHeader = ObjTableHd [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForBottomBatchNav = BottomBatchNav [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForEmbeddedQueryBlock = QueryBlock [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForBottomBatchSize = BottomBatchSize [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForEmbeddedCreateBlock = CreateBlock [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForEmbeddedInspectBlock = InspectBlock [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForAttributeRepetitionWrapper = Attributes [com.webobjects.directtoweb.Assignment], > - 9 : *true* => baseClassForAttributeRepetitionWrapper = Attributes [com.webobjects.directtoweb.Assignment], > - 10 : *true* => showTopBatchCount = true [com.webobjects.directtoweb.BooleanAssignment], > - 10 : *true* => showTopActionBlock = true [com.webobjects.directtoweb.BooleanAssignment], > - 10 : *true* => showTopBatchNavBar = true [com.webobjects.directtoweb.BooleanAssignment], > - 10 : *true* => showBottomBatchCount = true [com.webobjects.directtoweb.BooleanAssignment], > - 10 : *true* => showBottomActionBlock = true [com.webobjects.directtoweb.BooleanAssignment], > - 10 : *true* => showBottomBatchNavBar = true [com.webobjects.directtoweb.BooleanAssignment], > - 10 : *true* => pageType = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForBanner = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForHeader = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForSection = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForWrapper = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForLabelSpan = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForTopNavBar = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForErrorBlock = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => idForMainContainer = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForObjectTable = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForBottomNavBar = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForConfirmBlock = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForInnerWrapper = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForTopBatchSize = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => idForPageTabContainer = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForAttributeValue = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForEmptyLabelSpan = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForTopActionBlock = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => idForMainBusyIndicator = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => idForPageConfiguration = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => idForPropertyContainer = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForAttributeColumn = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForBottomBatchSize = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => idForParentMainContainer = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => idForRepetitionContainer = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForBottomActionBlock = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForEmbeddedEditBlock = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForEmbeddedListBlock = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForObjectTableHeader = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForEmbeddedQueryBlock = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForAttributeRepetition = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForEmbeddedCreateBlock = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForEmbeddedInspectBlock = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => idForParentPageConfiguration = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 10 : *true* => classForAttributeRepetitionWrapper = <ERMDDefaultCSSAssignment> [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > - 20 : *true* => sectionElementName = h2 [com.webobjects.directtoweb.Assignment], > - 20 : *true* => sortOrderComponentName = ERMSortOrder [com.webobjects.directtoweb.Assignment], > - 20 : *true* => sectionComponentName = ERMDSectionText [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForListPage = ERMODListPage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => headerComponentName = ERMD2WSimpleHeader [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForQueryPage = ERMODQueryPage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForCSVListPage = ERMODCSVListPage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForConfirmPage = ERMODConfirmPage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForInspectPage = ERMODInspectPage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForListXMLPage = ERMODListXMLPage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForMessagePage = ERMODMessagePage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForCalendarPage = ERMODCalendarPage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForPickListPage = ERMODPickListPage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForPickTypePage = ERMODPickTypePage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForProgressPage = ERMODProgressPage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForTabInspectPage = ERMODTabInspectPage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForQueryAllPage = ERMODQueryEntitiesPage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => wizardBannerComponentName = ERMDWizardDetailedBanner [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForCompactListPage = ERMODCompactListPage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForListComparePage = ERMODListComparePage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForGroupingListPage = ERMODGroupingListPage [com.webobjects.directtoweb.Assignment], > - 20 : task = 'queryAll' => displayNameForPageConfiguration = Search All [com.webobjects.directtoweb.Assignment], > - 20 : *true* => batchNavigationBarComponentName = ERMD2WBatchNavigationBar [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForCompactInspectPage = ERMODCompactInspectPage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForWizardCreationPage = ERMODWizardCreationPage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForCSVGroupingListPage = ERMODCSVGroupingListPage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForGroupingListXMLPage = ERMODGroupingListXMLPage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForPrinterFriendlyInspectPage = ERMODPrinterFriendlyInspectPage [com.webobjects.directtoweb.Assignment], > - 20 : (task = 'edit' and smartRelationship != null) => componentName = ERMDEditRelationship [com.webobjects.directtoweb.Assignment], > - 20 : task = 'editRelationship' => templateNameForEditRelationshipPage = ERMODEditRelationshipPage [com.webobjects.directtoweb.Assignment], > - 20 : *true* => templateNameForGroupingPrinterFriendlyListPage = ERMODGroupingPrinterFriendlyListPage [com.webobjects.directtoweb.Assignment], > - 20 : pageConfiguration like 'EditRelationship*' => headerComponentName = ERMD2WEditRelationshipHeader [com.webobjects.directtoweb.Assignment], > - 20 : *true* => stylesheets = (defaultMainScreenStylesheet,defaultMainPrintStylesheet,datepickerStylesheet > -) [com.webobjects.directtoweb.Assignment], > - 30 : (task = 'list' and parentPageConfiguration != null) => actions = { > -} [com.webobjects.directtoweb.Assignment], > - 40 : (task = 'list' and subTask = 'pick' and parentPageConfiguration != null) => actions = {"left" = ("selectionAction"); > -} [com.webobjects.directtoweb.Assignment], > - 40 : ((task = 'list' and (parentPageConfiguration like '*Edit*' or parentPageConfiguration like '*Create*')) or pageConfiguration like 'EditRelationship*') => actions = {"right" = ("inspectAction", "editAction", "removeRelatedAction"); > -} [com.webobjects.directtoweb.Assignment] > + 9 : *true* => baseClassForLine = "Line" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForBanner = "Banner" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForHeader = "Header" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForSection = "Section" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForWrapper = "Wrapper" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForObjectRow = "ObjRow" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForBatchNav = "BatchNav" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForBatchSize = "BatchSize" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForConfirmBlock = "Banner" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForErrorBlock = "ErrBlock" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForObjectTable = "ObjTable" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForTopActions = "TopActions" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForAttributeValue = "AttrVal" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForLabelSpan = "LabelWrapper" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForTopBatchNav = "TopBatchNav" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForBottomActions = "BtmActions" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForEmptyLabelSpan = "EmptyLabel" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForInnerWrapper = "InnerWrapper" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForTopBatchSize = "TopBatchSize" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForAttributeColumn = "AttrColumn" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForAttributeRepetition = "AttrRep" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForEmbeddedEditBlock = "EditBlock" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForEmbeddedListBlock = "ListBlock" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForObjectTableHeader = "ObjTableHd" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForBottomBatchNav = "BottomBatchNav" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForEmbeddedQueryBlock = "QueryBlock" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForBottomBatchSize = "BottomBatchSize" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForEmbeddedCreateBlock = "CreateBlock" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForEmbeddedInspectBlock = "InspectBlock" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForAttributeRepetitionWrapper = "Attributes" [com.webobjects.directtoweb.Assignment], > + 9 : *true* => baseClassForAttributeRepetitionWrapper = "Attributes" [com.webobjects.directtoweb.Assignment], > + 10 : *true* => showTopBatchCount = "true" [com.webobjects.directtoweb.BooleanAssignment], > + 10 : *true* => showTopActionBlock = "true" [com.webobjects.directtoweb.BooleanAssignment], > + 10 : *true* => showTopBatchNavBar = "true" [com.webobjects.directtoweb.BooleanAssignment], > + 10 : *true* => showBottomBatchCount = "true" [com.webobjects.directtoweb.BooleanAssignment], > + 10 : *true* => showBottomActionBlock = "true" [com.webobjects.directtoweb.BooleanAssignment], > + 10 : *true* => showBottomBatchNavBar = "true" [com.webobjects.directtoweb.BooleanAssignment], > + 10 : *true* => pageType = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForBanner = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForHeader = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForSection = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForWrapper = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForLabelSpan = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForTopNavBar = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForErrorBlock = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => idForMainContainer = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForObjectTable = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForBottomNavBar = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForConfirmBlock = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForInnerWrapper = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForTopBatchSize = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => idForPageTabContainer = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForAttributeValue = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForEmptyLabelSpan = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForTopActionBlock = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => idForMainBusyIndicator = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => idForPageConfiguration = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => idForPropertyContainer = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForAttributeColumn = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForBottomBatchSize = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => idForParentMainContainer = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => idForRepetitionContainer = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForBottomActionBlock = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForEmbeddedEditBlock = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForEmbeddedListBlock = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForObjectTableHeader = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForEmbeddedQueryBlock = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForAttributeRepetition = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForEmbeddedCreateBlock = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForEmbeddedInspectBlock = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => idForParentPageConfiguration = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 10 : *true* => classForAttributeRepetitionWrapper = "<ERMDDefaultCSSAssignment>" [er.modern.directtoweb.assignments.defaults.ERMDDefaultCSSAssignment], > + 20 : *true* => sectionElementName = "h2" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => sortOrderComponentName = "ERMSortOrder" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => sectionComponentName = "ERMDSectionText" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForListPage = "ERMODListPage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => headerComponentName = "ERMD2WSimpleHeader" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForQueryPage = "ERMODQueryPage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForCSVListPage = "ERMODCSVListPage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForConfirmPage = "ERMODConfirmPage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForInspectPage = "ERMODInspectPage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForListXMLPage = "ERMODListXMLPage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForMessagePage = "ERMODMessagePage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForCalendarPage = "ERMODCalendarPage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForPickListPage = "ERMODPickListPage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForPickTypePage = "ERMODPickTypePage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForProgressPage = "ERMODProgressPage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForTabInspectPage = "ERMODTabInspectPage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForQueryAllPage = "ERMODQueryEntitiesPage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => wizardBannerComponentName = "ERMDWizardDetailedBanner" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForCompactListPage = "ERMODCompactListPage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForListComparePage = "ERMODListComparePage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForGroupingListPage = "ERMODGroupingListPage" [com.webobjects.directtoweb.Assignment], > + 20 : task = 'queryAll' => displayNameForPageConfiguration = "Search All" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => batchNavigationBarComponentName = "ERMD2WBatchNavigationBar" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForCompactInspectPage = "ERMODCompactInspectPage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForWizardCreationPage = "ERMODWizardCreationPage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForCSVGroupingListPage = "ERMODCSVGroupingListPage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForGroupingListXMLPage = "ERMODGroupingListXMLPage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForPrinterFriendlyInspectPage = "ERMODPrinterFriendlyInspectPage" [com.webobjects.directtoweb.Assignment], > + 20 : (task = 'edit' and smartRelationship != null) => componentName = "ERMDEditRelationship" [com.webobjects.directtoweb.Assignment], > + 20 : task = 'editRelationship' => templateNameForEditRelationshipPage = "ERMODEditRelationshipPage" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => templateNameForGroupingPrinterFriendlyListPage = "ERMODGroupingPrinterFriendlyListPage" [com.webobjects.directtoweb.Assignment], > + 20 : pageConfiguration like 'EditRelationship*' => headerComponentName = "ERMD2WEditRelationshipHeader" [com.webobjects.directtoweb.Assignment], > + 20 : *true* => stylesheets = ("defaultMainScreenStylesheet", "defaultMainPrintStylesheet", "datepickerStylesheet") [com.webobjects.directtoweb.Assignment], > + 30 : (task = 'list' and parentPageConfiguration != null) => actions = {} [com.webobjects.directtoweb.Assignment], > + 40 : (task = 'list' and subTask = 'pick' and parentPageConfiguration != null) => actions = {"left" = ("selectionAction"); } [com.webobjects.directtoweb.Assignment], > + 40 : ((task = 'list' and (parentPageConfiguration like '*Edit*' or parentPageConfiguration like '*Create*')) or pageConfiguration like 'EditRelationship*') => actions = {"right" = ("inspectAction", "editAction", "removeRelatedAction"); } [com.webobjects.directtoweb.Assignment], > + 100 : *true* => shouldShowQueryRelatedButton = "true" [com.webobjects.directtoweb.BooleanAssignment] > ) > \ No newline at end of file > > > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. > > ------------------------------------------------------------------------------ > The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: > Pinpoint memory and threading errors before they happen. > Find and fix more than 250 security defects in the development cycle. > Locate bottlenecks in serial and parallel code that limit performance. > http://p.sf.net/sfu/intel-dev2devfeb > _______________________________________________ > Wonder-cvs mailing list > Wonder-cvs@... > https://lists.sourceforge.net/lists/listinfo/wonder-cvs |
From: <mschrag@us...> - 2011-02-22 14:40:46
|
Revision: 11983 http://wonder.svn.sourceforge.net/wonder/?rev=11983&view=rev Author: mschrag Date: 2011-02-22 14:40:40 +0000 (Tue, 22 Feb 2011) Log Message: ----------- synchronize access to insertion of queued notifications Modified Paths: -------------- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXEC.java Modified: branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXEC.java =================================================================== --- branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXEC.java 2011-02-22 11:40:07 UTC (rev 11982) +++ branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXEC.java 2011-02-22 14:40:40 UTC (rev 11983) @@ -1374,7 +1374,9 @@ public void _objectsChangedInStore(NSNotification nsnotification) { ERXEnterpriseObject.FlushCachesProcessor.perform(this, (NSArray) nsnotification.userInfo().objectForKey("objects")); if (savingChanges) { - queuedNotifications.addObject(nsnotification); + synchronized (queuedNotifications) { + queuedNotifications.addObject(nsnotification); + } } else { super._objectsChangedInStore(nsnotification); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <marroz@us...> - 2011-02-22 11:40:13
|
Revision: 11982 http://wonder.svn.sourceforge.net/wonder/?rev=11982&view=rev Author: marroz Date: 2011-02-22 11:40:07 +0000 (Tue, 22 Feb 2011) Log Message: ----------- Removed ERXSQLQuery implementation from Wonder 5.2. Removed Paths: ------------- branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXKeyValueBinding.java branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXObjectBinding.java branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLBinding.java branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLQuery.java branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLQueryWithBindingsUtilities.java Deleted: branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXKeyValueBinding.java =================================================================== --- branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXKeyValueBinding.java 2011-02-22 11:38:18 UTC (rev 11981) +++ branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXKeyValueBinding.java 2011-02-22 11:40:07 UTC (rev 11982) @@ -1,126 +0,0 @@ -package er.extensions.eof; - -import com.webobjects.eoaccess.EOAttribute; -import com.webobjects.eoaccess.EOEntity; -import com.webobjects.eoaccess.EOSQLExpression; -import com.webobjects.eoaccess.EOUtilities; -import com.webobjects.eocontrol.EOEditingContext; - -/** - * This class models an SQL binding based on a model keypath/value pair. - * <p> - * When the {@link #ERXKeyValueBinding(String, Object)} constructor is used, <code>keypath</code> - * refers to the base entity of the SQL expression. As an example, if the base entity is - * Person, than a binding for person's first name would have a keypath of "firstName". - * The name of the person's department would be "department.name". This constructor should - * be used when the base entity is known. This happens on {@link ERXSQLQuery} - * methods that receive an entity name. - * </p> - * <p> - * When using the {@link #ERXKeyValueBinding(String, String, Object)} constructor, <code>keypath</code> - * works the same way, but refers to the entity whose name is passed in as the constructor first - * argument. This constructor should be used when the base entity is not specified, like in - * {@link ERXSQLQuery#runQuery(EOEditingContext, String, String, ERXSQLBinding...)}. - * </p> - * <p> - * The optional entity name and keypath are used to inspect the model and obtain the correct - * {@link EOAttribute} used to handle SQL generation (value type, conversion, etc). - * </p> - */ -public class ERXKeyValueBinding implements ERXSQLBinding { - - /** - * The EOF key of the wrapped binding - */ - private String _keyPath; - - /** - * The value of the binded variable - */ - private Object _value; - - /** - * Optional entity name. - */ - private String _entityName; - - /** - * Obtains new binding wrapper for passed in EOF key and value - * - * @param keyPath - * The EOF key - * @param value - * The value to bind - */ - public ERXKeyValueBinding( String keyPath, Object value ) { - _keyPath = keyPath; - _value = value; - } - - /** - * Obtains new binding wrapper for passed in EOF key and value - * - * @param keyPath - * The EOF key - * @param value - * The value to bind - */ - public ERXKeyValueBinding( String entityName, String keyPath, Object value ) { - _entityName = entityName; - _keyPath = keyPath; - _value = value; - } - - /** - * The EOF key of the wrapped binding - * - * @return The EOF key of the wrapped binding - */ - public String keyPath() { - return _keyPath; - } - - /** - * The value of the binded variable - * - * @return The value of the binded variable - */ - public Object value() { - return _value; - } - - /** - * The optional entity name. - * <p> - * If the entity name is defined, keyPath applies to that entity and not the base SQL - * expression this binding will be applied to. - * </p> - * - * @return The entity name, if defined. Null otherwise. - */ - public String entityName() { - return _entityName; - } - - public String sqlStringForBindingOnExpression(EOSQLExpression expression, EOEditingContext ec) { - if (entityName() == null) { - if (expression.entity() == null) { - throw new RuntimeException("When using methods without an explicit entity name, the ERXKeyValueBinding(String entityName, String keyPath, Object value) constructor must be used."); - } - return expression.sqlStringForValue( value(), keyPath() ); - } else { - // marroz: This is a very nasty trick. The rational behind this is that we want to use expression.sqlStringForValue - // as much as possible, to obtain the database-specific variable placeholder. We could do something simpler like - // ERXObjectBinding does, but we would not obtain that db-specific placeholder. - EOEntity oldEntity = expression.entity(); - expression._setEntity(EOUtilities.entityNamed(ec, entityName())); - String result = expression.sqlStringForValue( value(), keyPath() ); - expression._setEntity(oldEntity); - return result; - } - } - - public boolean isModelAttribute() { - return true; - } -} Deleted: branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXObjectBinding.java =================================================================== --- branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXObjectBinding.java 2011-02-22 11:38:18 UTC (rev 11981) +++ branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXObjectBinding.java 2011-02-22 11:40:07 UTC (rev 11982) @@ -1,100 +0,0 @@ -package er.extensions.eof; - -import java.math.BigDecimal; - -import com.webobjects.eoaccess.EOAttribute; -import com.webobjects.eoaccess.EOSQLExpression; -import com.webobjects.eocontrol.EOEditingContext; -import com.webobjects.foundation.NSData; -import com.webobjects.foundation.NSDictionary; -import com.webobjects.foundation.NSTimestamp; - -/** - * This class models an SQL binding based on a Java object. - * <p> - * When using this class to model a binding, the EOF SQL generation layer will not - * be able to inspect the model and obtain the correct value types and conversions. - * A best guess will be made based on the class of the wrapped object. This class - * supports the five basic types EOF supports (String, BigDecimal, Number, NSData and - * NSTimestamp). Also, boolean values true and false are converted to "true" and "false" - * strings. If boolean representation is different on the database you are using (like - * integers) you have to handle it yourself by wrapping an object of the appropriate - * class. - * </p> - * <p> - * A note about SQL generation: due to the internal architecture of database plugins, - * this class will not be able to ask the plugin for an appropriate placeholder string - * for the binding values. This won't matter for databases where the placeholder string - * is "?". However, some databases, like PostgreSQL 7.4 and older, require the placeholder - * string to contain the value type, like "?::varchar(1000)". Using this class may cause - * problems and unexpected results on such databases. If that's the case, consider using - * {@link ERXKeyValueBinding}. - * </p> - */ -public class ERXObjectBinding implements ERXSQLBinding { - - /** - * Wrapped object. - */ - private Object _value; - - /** - * Helper EOAttributed used for SQL generation. - */ - private EOAttribute _attribute; - - /** - * Creates a new object binding wrapper for the given object. - * <p> - * value must be an instance of the following classes (or any subsclass of these): String, - * BigDecimal, Number, NSData, NSTimestamp. - * </p> - * @param value - * Object to be wrapped - */ - public ERXObjectBinding( Object value ) { - super(); - initForValue( value ); - } - - /** - * Initializes instance based on the wrapped object class. - * - * @param originalValue - * Object to be wrapped - */ - private void initForValue(Object originalValue) { - Object value = originalValue; - if( originalValue instanceof Boolean ) { - value = originalValue.toString(); - } - EOAttribute attribute = new EOAttribute(); - attribute.setName(""); // Must have a name, or EOSQLExpression will scream - if( value instanceof String ) { - attribute.setClassName( String.class.getName() ); - } else if( value instanceof BigDecimal ) { - attribute.setClassName( BigDecimal.class.getName() ); - } else if( value instanceof Number ) { - attribute.setClassName( Number.class.getName() ); - } else if( value instanceof NSData ) { - attribute.setClassName( NSData.class.getName() ); - } else if( value instanceof NSTimestamp ) { - attribute.setClassName( NSTimestamp.class.getName() ); - } else { - throw new RuntimeException("Unsupported object class: " + value.getClass().getName() ); - } - _value = value; - _attribute = attribute; - } - - public String sqlStringForBindingOnExpression(EOSQLExpression expression, EOEditingContext ec) { - NSDictionary binding = expression.bindVariableDictionaryForAttribute( _attribute, _value ); - expression.addBindVariableDictionary(binding); - return (String) binding.objectForKey(EOSQLExpression.BindVariablePlaceHolderKey); - } - - public boolean isModelAttribute() { - return false; - } - -} Deleted: branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLBinding.java =================================================================== --- branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLBinding.java 2011-02-22 11:38:18 UTC (rev 11981) +++ branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLBinding.java 2011-02-22 11:40:07 UTC (rev 11982) @@ -1,34 +0,0 @@ -package er.extensions.eof; - -import com.webobjects.eoaccess.EOSQLExpression; -import com.webobjects.eocontrol.EOEditingContext; - -/** - * Interface for binding wrapper objects. - */ -public interface ERXSQLBinding { - - /** - * Registers the binding on a given SQL expression, and obtains the - * binding placeholder string for the binding value. - * - * @param expression - * EOSQLExpression being built - * @return the SQL placeholder string for the used DB, usually "?" - */ - public String sqlStringForBindingOnExpression( EOSQLExpression expression, EOEditingContext ec ); - - /** - * True if the binded attribute is an existing EOModel attribute, false otherwise. - * <p> - * A binding should return true if the binding contains enough information to know what - * model attribute the value will be binded to. Bindings that return true will benefit - * from proper type conversion, as defined in the model (for instance, converting a - * boolean to a string or integer). - * </p> - * - * @return True if the binded attribute is an existing EOModel attribute, false otherwise. - */ - public boolean isModelAttribute(); - -} Deleted: branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLQuery.java =================================================================== --- branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLQuery.java 2011-02-22 11:38:18 UTC (rev 11981) +++ branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLQuery.java 2011-02-22 11:40:07 UTC (rev 11982) @@ -1,561 +0,0 @@ -package er.extensions.eof; - - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.util.Enumeration; - -import com.webobjects.eoaccess.EOAdaptorChannel; -import com.webobjects.eoaccess.EOAttribute; -import com.webobjects.eoaccess.EODatabaseChannel; -import com.webobjects.eoaccess.EODatabaseContext; -import com.webobjects.eoaccess.EOEntity; -import com.webobjects.eoaccess.EOModel; -import com.webobjects.eoaccess.EOModelGroup; -import com.webobjects.eoaccess.EOSQLExpression; -import com.webobjects.eoaccess.EOUtilities; -import com.webobjects.eocontrol.EOEditingContext; -import com.webobjects.eocontrol.EOFetchSpecification; -import com.webobjects.eocontrol.EOObjectStore; -import com.webobjects.eocontrol._EOMutableKnownKeyDictionary; -import com.webobjects.foundation.NSArray; -import com.webobjects.foundation.NSDictionary; -import com.webobjects.foundation.NSKeyValueCoding; -import com.webobjects.foundation.NSMutableArray; -import com.webobjects.jdbcadaptor.JDBCChannel; -import com.webobjects.jdbcadaptor.JDBCContext; - -/** - * This class allows SQL queries with binded variables to be run against the database. It's possible - * to obtain EOs, raw rows or a batch iterator, depending on the used method. - * <p> - * Binded values are passed in using {@link ERXSQLBinding} implementations. Currently, there are two available - * implementations: {@link ERXKeyValueBinding} and {@link ERXObjectBinding}. The first one should be used if - * the binding matches a column modeled in an EOModel. This way, any data type conversions that would happen - * on normal EOF usage are also applied when generating the SQL query. An example of this can be converting a - * boolean value to a string or an integer. {@link ERXObjectBinding} can be used for non-modeled columns. - * Please read the {@link ERXObjectBinding} class documentation for important notes regarding some databases - * that expect SQL queries with binding typification. - * </p> - * <p> - * This class is used by calling the most appropriate static method for the intended usage. Specific requirements - * for the SQL query resulting columns are detailed on each of the method's documentation. Generally, you need - * to provide a query returning the appropriate columns and using the '?' character for each binded value. - * Depending on the database plug-in being used, the '?' character will be automatically replaced by a different - * expression if the {@link ERXKeyValueBinding} class is used to wrap the binded value. In PostgreSQL, for instance, - * the '?' character could be replaced by '?::varchar(1000)'. - * </p> - * <p> - * Here are some sample uses of this class: - * </p> - * <pre> - * // Obtains EOs that match the query - * ERXSQLQuery.objectsForQuery(editingContext(), Song.ENTITY_NAME, - * "SELECT * FROM SONG WHERE FAVORITE = ? AND DURATION > ? ORDER BY NUMBER ASC", true, - * new ERXKeyValueBinding("favorite", true), new ERXKeyValueBinding("duration", 120)); - * - * // Obtains raw rows for query - * ERXSQLQuery.rowsForQueryOnEntity(editingContext(), Song.ENTITY_NAME, - * "SELECT t0.NAME, t0.DURATION FROM SONG t0 WHERE COMPOSER = ?", new ERXKeyValueBinding("composer", "Mozart")); - * - * // Runs a query that returns no objects, using EOModelSQLParser-style tokens - * ERXSQLQuery.runQuery(editingContext(), "SongsModel", - * "DELETE FROM SONG WHERE FAVORITE = ?", new ERXKeyValueBinding("Song", "favorite", false)); - * - * // Obtains ERXFetchSpecificationBatchIterator - * // Note the query must obtain the primary key! - * ERXSQLQuery.batchIteratorForQuery(editingContext(), Employee.ENTITY_NAME, - * "SELECT ID FROM EMPLOYEE WHERE HEIGHT < ? AND FIRST_NAME = ? ORDER BY NUMBER DESC", false, 100, - * new NSArray<EOSortOrdering>(new EOSortOrdering[] {new EOSortOrdering("number", EOSortOrdering.CompareDescending)}), - * new ERXObjectBinding(190), new ERXKeyValueBinding("firstName", "John")); - * </pre> - */ -public class ERXSQLQuery { - - /** - * Runs a select query against the database, obtaining the resulting EOs. - * <p> - * Please read the {@link #objectsForQuery(EOEditingContext, String, String, boolean, Integer, ERXSQLBinding...)} - * documentation for the necessary details on how to use both methods. - * </p> - * @param ec - * The editing context where the objects will be placed - * @param entityName - * The name of the entity whose objects are returned by the query - * @param query - * The SQL query - * @param bindings - * The variable bindings, wrapped in {@link ERXSQLBinding} objects - * - * @see #objectsForQuery(EOEditingContext, String, String, boolean, Integer, ERXSQLBinding...) - * @return array of objects obtained by the query - */ - public static NSArray objectsForQuery( EOEditingContext ec, String entityName, String query, ERXSQLBinding... bindings ) { - return objectsForQuery(ec, entityName, query, false, null, bindings); - } - - /** - * Runs a select query against the database, obtaining the resulting EOs. - * <p> - * Please read the {@link #objectsForQuery(EOEditingContext, String, String, boolean, Integer, ERXSQLBinding...)} - * documentation for the necessary details on how to use both methods. - * </p> - * @param ec - * The editing context where the objects will be placed - * @param entityName - * The name of the entity whose objects are returned by the query - * @param query - * The SQL query - * @param refreshesCache - * If true, the cached snapshots will be refreshed. See {@link EOFetchSpecification#setRefreshesRefetchedObjects(boolean)}. - * @param bindings - * The variable bindings, wrapped in {@link ERXSQLBinding} objects - * - * @see #objectsForQuery(EOEditingContext, String, String, boolean, Integer, ERXSQLBinding...) - * @return array of objects obtained by the query - */ - public static NSArray objectsForQuery( EOEditingContext ec, String entityName, String query, boolean refreshesCache, ERXSQLBinding... bindings ) { - return objectsForQuery(ec, entityName, query, refreshesCache, null, bindings); - } - - /** - * Runs a select query against the database, obtaining the resulting EOs. - * <p> - * This method allows a SELECT SQL query to be run, using binded variables. The method will - * process the query result and return EOs of the requested entity. - * </p> - * <p> - * There are some important requirements regarding the passed in query: - * </p> - * <ul> - * <li>The query must return all the columns of the affected table that are mapped in the modeled - * Entity. 'SELECT * FROM Table ...' is the easiest way to achieve this. Alias are supported, like - * 'SELECT t0.* FROM Table t0 ...'.</li> - * <li>The placeholder for binded variables must be the '?' character. This method will process the - * query before executing it, replacing the generic placeholder character by the one appropriate to - * the used database. Ex: when using PostgreSQL, '... WHERE FIRST_NAME = ?' may be replaced by - * '... WHERE FIRST_NAME = ?::varchar(1000)'.</li> - * <li>The '?' character does not need to be quoted if it appears on the query inside a string literal. - * This situation is automatically detected and the substitution is not performed.</li> - * <li>The number of binding wrappers passed in as last arguments of this method must match the number of - * binding placeholders in the query.</li> - * </ul> - * @param ec - * The editing context where the objects will be placed - * @param entityName - * The name of the entity whose objects are returned by the query - * @param query - * The SQL query - * @param refreshesCache - * If true, the cached snapshots will be refreshed. See {@link EOFetchSpecification#setRefreshesRefetchedObjects(boolean)}. - * @param fetchLimit - * Fetch limit, or null for no limit - * @param bindings - * The variable bindings, wrapped in {@link ERXSQLBinding} objects - * - * @return array of objects obtained by the query - */ - public static NSArray objectsForQuery( EOEditingContext ec, String entityName, String query, boolean refreshesCache, Integer fetchLimit, ERXSQLBinding... bindings ) { - EODatabaseContext context = databaseContextForEntityName(ec,entityName); - EOEntity entity = EOUtilities.entityNamed(ec, entityName); - - EOSQLExpression expression = context.adaptorContext().adaptor().expressionFactory().expressionForEntity( entity ); - - String proceccedQuery = processedQueryString(query, expression, ec, bindings); - expression.setStatement(proceccedQuery); - - EOFetchSpecification spec = new EOFetchSpecification( entityName, null, null ); - spec.setRefreshesRefetchedObjects(refreshesCache); - if( fetchLimit != null ) { - spec.setFetchLimit( fetchLimit ); - } - spec.setHints( new NSDictionary( expression, EODatabaseContext.CustomQueryExpressionHintKey ) ); - - return ec.objectsWithFetchSpecification(spec); - } - - /** - * Obtains a batch iterator for the objects resulting from the passed in SQL query with binded variables. - * <p> - * The requirements for the passed in SQL query are the same as {@link #objectsForQuery(EOEditingContext, String, String, boolean, ERXSQLBinding...)}, - * except for an important difference: the query must return only one column with the entity primary keys. - * Instead of doing a query like 'SELECT * FROM Person ...', assuming ID as the name of the primary key column, - * the query would be 'SELECT ID FROM Person ...'. Despite this, the batch iterator will provide you the - * full initialized EOs. - * </p> - * <p> - * <strong>SORTING</strong> - If you want to obtain sorted results, you'll have to add the sorting information to - * the query (using ORDER BY clauses) <em>and</em> pass an array of EOSortOrderings to this method. The sorting - * information in the query will be used to sort the primary key array. The EOSortOrderings are used to sort objects - * inside each batch. To obtain sorted results as expected, both sorting criteria should be similar. - * </p> - * @param ec - * The editing context where the objects will be placed - * @param entityName - * The name of the entity whose objects are returned by the query - * @param query - * The SQL query - * @param refreshesCache - * If true, the cached snapshots will be refreshed. See {@link EOFetchSpecification#setRefreshesRefetchedObjects(boolean)}. - * @param batchSize - * The size of each batch - * @param sortOrderings - * EOSortOrderings for batches (see description above) - * @param bindings - * The variable bindings, wrapped in {@link ERXSQLBinding} objects - * - * @return batch iterator for the passed in query - */ - public static ERXFetchSpecificationBatchIterator batchIteratorForQuery( EOEditingContext ec, String entityName, String query, boolean refreshesCache, int batchSize, NSArray sortOrderings, ERXSQLBinding... bindings ) { - EODatabaseContext databaseContext = databaseContextForEntityName(ec,entityName); - EOEntity entity = EOUtilities.entityNamed(ec, entityName); - - if( entity.primaryKeyAttributes().count() > 1 ) { - throw new RuntimeException("Multiple primary keys not supported."); - } - - EOSQLExpression expression = databaseContext.adaptorContext().adaptor().expressionFactory().expressionForEntity( entity ); - expression.setStatement(processedQueryString(query, expression, ec, bindings)); - - EOFetchSpecification pkSpec = new EOFetchSpecification( entityName, null, null ); - pkSpec.setRefreshesRefetchedObjects(refreshesCache); - pkSpec.setFetchesRawRows(true); - pkSpec.setRawRowKeyPaths(entity.primaryKeyAttributeNames()); - pkSpec.setHints( new NSDictionary( expression, EODatabaseContext.CustomQueryExpressionHintKey ) ); - - NSArray pkDicts = ec.objectsWithFetchSpecification(pkSpec); - NSMutableArray pks = new NSMutableArray(); - String pkAtttributeName = ((EOAttribute) entity.primaryKeyAttributes().lastObject()).name(); - - for ( Enumeration rowEnumerator = pkDicts.objectEnumerator(); rowEnumerator.hasMoreElements(); ) { - NSDictionary row = (NSDictionary) rowEnumerator.nextElement(); - pks.addObject( row.objectForKey( pkAtttributeName )); - } - - EOFetchSpecification spec = new EOFetchSpecification(entityName, null, sortOrderings); - spec.setRefreshesRefetchedObjects( refreshesCache ); - return new ERXFetchSpecificationBatchIterator( spec, pks, ec, batchSize); - } - - - /** - * Runs an SQL query against the database with binded variables. - * <p> - * The requirements for this method are similar to {@link #objectsForQuery(EOEditingContext, String, String, boolean, ERXSQLBinding...)}, - * with the following differences: - * </p> - * <ul> - * <li>The query should not return any object. This method is intended to be used with non-SELECT - * queries, like UPDATE, INSERT or DELETE.</li> - * <li>If {@link ERXKeyValueBinding} bindings are used, the entity name must be specified in the binding constructor.</li> - * </ul> - * - * @param ec - * The current editing context (used to obtain the correct OSC) - * @param modelName - * The name of the model (used to apply the query on the correct DB) - * @param query - * The SQL query - * @param bindings - * The variable bindings, wrapped in {@link ERXSQLBinding} objects - */ - public static void runQuery( EOEditingContext ec, String modelName, String query, ERXSQLBinding... bindings ) { - EOObjectStore osc = ec.rootObjectStore(); - EODatabaseChannel databaseChannel = databaseContextForModelName(ec,modelName).availableChannel(); - osc.lock(); - - try { - EOAdaptorChannel adaptorChannel = databaseChannel.adaptorChannel(); - - if (!adaptorChannel.isOpen()) { - adaptorChannel.openChannel(); - } - - // marroz: We create the expression with the original query and then set the processed query because - // it's the only way to create an expression without an entity. - EOSQLExpression expression = adaptorChannel.adaptorContext().adaptor().expressionFactory().expressionForString( query ); - - String proceccedQuery = processedQueryString(query, expression, ec, bindings); - expression.setStatement(proceccedQuery); - - try { - adaptorChannel.evaluateExpression( expression ); - } finally { - databaseChannel.cancelFetch(); - } - } finally { - osc.unlock(); - } - } - - /** - * Runs a select query against the database, obtaining the resulting raw rows. - * <p> - * This method allows a SELECT SQL query to be run, using binded variables. The - * method will return the resulting rows without any additional processing. - * </p> - * <p> - * The requirements for the passed in SQL query are the same as {@link #objectsForQuery(EOEditingContext, String, String, boolean, ERXSQLBinding...)}. - * </p> - * @param ec - * The current editing context (used to obtain the correct OSC) - * @param entityName - * Entity name for fetched objects. - * @param query - * The SQL query - * @param bindings - * The variable bindings, wrapped in {@link ERXSQLBinding} objects - * @return The requested raw rows - */ - public static NSArray rawRowsForQueryOnEntity( EOEditingContext ec, String entityName, String query, ERXSQLBinding... bindings ) { - EODatabaseChannel databaseChannel = databaseContextForEntityName(ec,entityName).availableChannel(); - EOAdaptorChannel adaptorChannel = databaseChannel.adaptorChannel(); - EOEntity entity = EOUtilities.entityNamed(ec, entityName); - - EOSQLExpression expression = adaptorChannel.adaptorContext().adaptor().expressionFactory().expressionForEntity( entity ); - expression.setStatement( processedQueryString( query, expression, ec, bindings ) ); - - EOFetchSpecification spec = new EOFetchSpecification( entityName, null, null ); - spec.setFetchesRawRows(true); - spec.setHints( new NSDictionary( expression, EODatabaseContext.CustomQueryExpressionHintKey ) ); - - return ec.objectsWithFetchSpecification(spec); - } - - /** - * Runs a select query against the database, obtaining the resulting raw rows. - * <p> - * This method allows a SELECT SQL query to be run, using binded variables. The - * method will return the resulting rows without any additional processing. This is - * a variant from {@link #rowsForQueryOnEntity(EOEditingContext, String, String, ERXSQLBinding...)} - * that doesn't need the result rows to belong to a given entity. - * </p> - * <p> - * The requirements for the passed in SQL query are similar to {@link #objectsForQuery(EOEditingContext, String, String, boolean, ERXSQLBinding...)} - * with the following differences: - * </p> - * <ul> - * <li>The query can return any arbitrary column.</li> - * <li>If {@link ERXKeyValueBinding} bindings are used, the entity name must be specified in the binding constructor.</li> - * </ul> - * <p> - * <strong>NOTE:</strong> On the 5.2 version, this method will not respect model-based type conversions when using - * {@link ERXKeyValueBinding}. That feature is only available on 5.4. - * </p> - * - * @param ec - * The current editing context (used to obtain the correct OSC) - * @param modelName - * The name of the model (used to apply the query on the correct DB) - * @param query - * The SQL query - * @param bindings - * The variable bindings, wrapped in {@link ERXSQLBinding} objects - * @return The requested raw rows - */ - public static NSArray rawRowsForQuery( EOEditingContext ec, String modelName, String query, ERXSQLBinding... bindings ) { - EODatabaseContext dbContext = databaseContextForModelName(ec, modelName); - dbContext.lock(); - - try{ - EODatabaseChannel databaseChannel = dbContext.availableChannel(); - EOAdaptorChannel adaptorChannel = databaseChannel.adaptorChannel(); - adaptorChannel.openChannel(); - - JDBCContext jdbcContext = (JDBCContext) adaptorChannel.adaptorContext(); - Connection connection = jdbcContext.connection(); - - // marroz: We create the expression with the original query and then set the processed query because - // it's the only way to create an expression without an entity. - EOSQLExpression expression = adaptorChannel.adaptorContext().adaptor().expressionFactory().expressionForString(query); - expression.setStatement(processedQueryString(query, expression, ec, bindings)); - - PreparedStatement statement = null; - ResultSet resultSet = null; - NSMutableArray resultList = new NSMutableArray(100); - - try { - statement = connection.prepareStatement(expression.statement()); - - int index = 1; - for (Enumeration bindingEnumerator = expression.bindVariableDictionaries().objectEnumerator(); bindingEnumerator.hasMoreElements(); ) { - NSDictionary binding = (NSDictionary) bindingEnumerator.nextElement(); - statement.setObject(index, binding.objectForKey(EOSQLExpression.BindVariableValueKey)); - ++index; - } - - resultSet = statement.executeQuery(); - - ResultSetMetaData metaData = resultSet.getMetaData(); - int numColumns = metaData.getColumnCount(); - NSMutableArray columnNames = new NSMutableArray(numColumns); - - for (int i = 0; i < numColumns; i++) { - columnNames.addObject(metaData.getColumnName(i + 1)); - } - - _EOMutableKnownKeyDictionary.Initializer dictInitializer = new _EOMutableKnownKeyDictionary.Initializer(columnNames); - - while (resultSet.next()) { - _EOMutableKnownKeyDictionary result = new _EOMutableKnownKeyDictionary(dictInitializer); - for (int i = 0; i < numColumns; i++) { - final Object value = resultSet.getObject(i + 1); - if (value != null) { - result.setObjectForKey(value, columnNames.objectAtIndex(i)); - } - else { - result.setObjectForKey(NSKeyValueCoding.NullValue, columnNames.objectAtIndex(i)); - } - } - resultList.addObject(result); - } - return resultList; - } catch (SQLException e) { - throw new RuntimeException(e); - } finally { - try { - if (statement != null) { - statement.close(); - } - } catch (Exception e) { - throw new RuntimeException(e); - } finally { - try { - if (resultSet != null) { - resultSet.close(); - } - } catch (Exception e) { - throw new RuntimeException(e); - } - } - } - } finally { - dbContext.unlock(); - } - } - - // ================================================== - // Support methods - // -------------------------------------------------- - - /** - * Replaces the binding placeholder characters by the appropriate token for the used database. - * <p> - * This method will also register each of the bindings in the given expression. - * </p> - * - * @param query - * The original SQL query - * @param expression - * EOSQLExpression to be modified - * @param bindings - * The variable bindings, wrapped in {@link ERXSQLBinding} objects - * @return The processed query - */ - protected static String processedQueryString(String query, EOSQLExpression expression, EOEditingContext ec, ERXSQLBinding... bindings) { - int currentOffset = 0; - int bindingCount = 0; - StringBuffer processedQueryBuffer = new StringBuffer(); - NSArray positions = varPositionsForQuery( query ); - - if( positions.count() != bindings.length ) { - throw new RuntimeException("Binding placeholders count (" + positions.count() + ") does not match binding wrappers count (" + bindings.length + ")."); - } - - for ( Enumeration positionEnumerator = positions.objectEnumerator(); positionEnumerator.hasMoreElements(); ) { - Integer position = (Integer) positionEnumerator.nextElement(); - if( position > currentOffset ) { - processedQueryBuffer.append( query.substring( currentOffset, position ) ); - } - ERXSQLBinding binding = bindings[bindingCount]; - // The call to sqlStringForValue adds a binding to the expression binding list... - processedQueryBuffer.append( binding.sqlStringForBindingOnExpression(expression, ec) ); - currentOffset = position+1; - bindingCount++; - } - - if( currentOffset < query.length() ) { - processedQueryBuffer.append( query.substring( currentOffset, query.length() ) ); - } - - String proceccedQuery = processedQueryBuffer.toString(); - return proceccedQuery; - } - - /** - * Obtains the index positions of the binding placeholders in the query. - * - * @param query - * The SQL query - * @return array of placeholder index positions - */ - private static NSArray varPositionsForQuery(String query) { - int position = 0; - boolean inQuote = false; - char quoteChar = 0; - NSMutableArray positions = new NSMutableArray(); - - while( position < query.length() ) { - char c = query.charAt( position ); - if( c == '\\' ) { - position += 2; - continue; - } - if( inQuote == false && ( c == '\'' || c == '\"' ) ) { - quoteChar = c; - inQuote = true; - } else if( inQuote && c == quoteChar ) { - inQuote = false; - } else if( inQuote == false && c == '?' ) { - positions.addObject(position); - } - - position++; - } - - return positions; - } - - /** - * Obtains the database context for the given editing context and entity name. - * - * @param ec - * Editing context - * @param entityName - * The entity name - * @return The database context for the given editing context and entity name - */ - private static EODatabaseContext databaseContextForEntityName( EOEditingContext ec, String entityName ) { - EOModelGroup group = EOUtilities.modelGroup( ec ); - EOModel model = group.entityNamed(entityName).model(); - if( model != null ) { - return EODatabaseContext.registeredDatabaseContextForModel(model, ec); - } else { - throw new RuntimeException("Entity named " + entityName + " not found in the model group."); - } - } - - /** - * Obtains the database context for the given editing context and model name - * - * @param ec - * Editing context - * @param modelName - * The model name - * @return The database context for the given editing context and model name - */ - private static EODatabaseContext databaseContextForModelName(EOEditingContext ec, String modelName) { - EOModelGroup group = EOUtilities.modelGroup( ec ); - EOModel model = group.modelNamed(modelName); - if( model != null ) { - return EODatabaseContext.registeredDatabaseContextForModel(model, ec); - } else { - throw new RuntimeException("Model " + modelName + " not found in the model group."); - } - } - - -} Deleted: branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLQueryWithBindingsUtilities.java =================================================================== --- branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLQueryWithBindingsUtilities.java 2011-02-22 11:38:18 UTC (rev 11981) +++ branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLQueryWithBindingsUtilities.java 2011-02-22 11:40:07 UTC (rev 11982) @@ -1,42 +0,0 @@ -package er.extensions.eof; - -import com.webobjects.eocontrol.EOEditingContext; -import com.webobjects.foundation.NSArray; - -/** - * This class has been renamed to {@link ERXSQLQuery}, and methods got shorter names too. - * Use {@link ERXSQLQuery} instead of this class for new code. - */ -@... -public class ERXSQLQueryWithBindingsUtilities extends ERXSQLQuery { - - @Deprecated - public static NSArray selectObjectsOfEntityForSqlWithBindings( EOEditingContext ec, String entityName, String query, ERXSQLBinding... bindings ) { - return objectsForQuery(ec, entityName, query, bindings); - } - - @Deprecated - public static NSArray selectObjectsOfEntityForSqlWithBindings( EOEditingContext ec, String entityName, String query, boolean refreshesCache, ERXSQLBinding... bindings ) { - return objectsForQuery(ec, entityName, query, refreshesCache, bindings); - } - - @Deprecated - public static NSArray selectObjectsOfEntityForSqlWithBindings( EOEditingContext ec, String entityName, String query, boolean refreshesCache, Integer fetchLimit, ERXSQLBinding... bindings ) { - return objectsForQuery(ec, entityName, query, refreshesCache, fetchLimit, bindings); - } - - @Deprecated - public static ERXFetchSpecificationBatchIterator batchIteratorForObjectsWithSqlWithBindings( EOEditingContext ec, String entityName, String query, boolean refreshesCache, int batchSize, NSArray sortOrderings, ERXSQLBinding... bindings ) { - return batchIteratorForQuery(ec, entityName, query, refreshesCache, batchSize, sortOrderings, bindings); - } - - @Deprecated - public static void runSqlQueryWithBindings( EOEditingContext ec, String modelName, String query, ERXSQLBinding... bindings ) { - runQuery(ec, modelName, query, bindings); - } - - @Deprecated - public static NSArray rawRowsForSqlWithBindings( EOEditingContext ec, String entityName, String query, ERXSQLBinding... bindings ) { - return rawRowsForQueryOnEntity(ec, entityName, query, bindings); - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <marroz@us...> - 2011-02-22 11:38:25
|
Revision: 11981 http://wonder.svn.sourceforge.net/wonder/?rev=11981&view=rev Author: marroz Date: 2011-02-22 11:38:18 +0000 (Tue, 22 Feb 2011) Log Message: ----------- Reorganized ERXSQLQuery implementation. Modified Paths: -------------- branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXKeyValueBinding.java branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXObjectBinding.java branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLBinding.java branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLQuery.java Modified: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXKeyValueBinding.java =================================================================== --- branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXKeyValueBinding.java 2011-02-21 22:01:41 UTC (rev 11980) +++ branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXKeyValueBinding.java 2011-02-22 11:38:18 UTC (rev 11981) @@ -1,50 +1,16 @@ package er.extensions.eof; -import com.webobjects.eoaccess.EOAttribute; -import com.webobjects.eoaccess.EOEntity; -import com.webobjects.eoaccess.EOSQLExpression; -import com.webobjects.eoaccess.EOUtilities; -import com.webobjects.eocontrol.EOEditingContext; +import com.webobjects.jdbcadaptor.EOKeyValueBinding; /** * This class models an SQL binding based on a model keypath/value pair. - * <p> - * When the {@link #ERXKeyValueBinding(String, Object)} constructor is used, <code>keypath</code> - * refers to the base entity of the SQL expression. As an example, if the base entity is - * Person, than a binding for person's first name would have a keypath of "firstName". - * The name of the person's department would be "department.name". This constructor should - * be used when the base entity is known. This happens on {@link ERXSQLQuery} - * methods that receive an entity name. - * </p> - * <p> - * When using the {@link #ERXKeyValueBinding(String, String, Object)} constructor, <code>keypath</code> - * works the same way, but refers to the entity whose name is passed in as the constructor first - * argument. This constructor should be used when the base entity is not specified, like in - * {@link ERXSQLQuery#runQuery(EOEditingContext, String, String, ERXSQLBinding...)}. - * </p> - * <p> - * The optional entity name and keypath are used to inspect the model and obtain the correct - * {@link EOAttribute} used to handle SQL generation (value type, conversion, etc). - * </p> + * + * @deprecated Use EOKeyValueBinding */ -public class ERXKeyValueBinding implements ERXSQLBinding { +@Deprecated +public class ERXKeyValueBinding extends EOKeyValueBinding implements ERXSQLBinding { /** - * The EOF key of the wrapped binding - */ - private String _keyPath; - - /** - * The value of the binded variable - */ - private Object _value; - - /** - * Optional entity name. - */ - private String _entityName; - - /** * Obtains new binding wrapper for passed in EOF key and value * * @param keyPath @@ -52,9 +18,8 @@ * @param value * The value to bind */ - public ERXKeyValueBinding( String keyPath, Object value ) { - _keyPath = keyPath; - _value = value; + public ERXKeyValueBinding(String keyPath, Object value) { + super(keyPath, value); } /** @@ -65,62 +30,8 @@ * @param value * The value to bind */ - public ERXKeyValueBinding( String entityName, String keyPath, Object value ) { - _entityName = entityName; - _keyPath = keyPath; - _value = value; + public ERXKeyValueBinding(String entityName, String keyPath, Object value) { + super(entityName, keyPath, value); } - - /** - * The EOF key of the wrapped binding - * - * @return The EOF key of the wrapped binding - */ - public String keyPath() { - return _keyPath; - } - - /** - * The value of the binded variable - * - * @return The value of the binded variable - */ - public Object value() { - return _value; - } - /** - * The optional entity name. - * <p> - * If the entity name is defined, keyPath applies to that entity and not the base SQL - * expression this binding will be applied to. - * </p> - * - * @return The entity name, if defined. Null otherwise. - */ - public String entityName() { - return _entityName; - } - - public String sqlStringForBindingOnExpression(EOSQLExpression expression, EOEditingContext ec) { - if (entityName() == null) { - if (expression.entity() == null) { - throw new RuntimeException("When using methods without an explicit entity name, the ERXKeyValueBinding(String entityName, String keyPath, Object value) constructor must be used."); - } - return expression.sqlStringForValue( value(), keyPath() ); - } else { - // marroz: This is a very nasty trick. The rational behind this is that we want to use expression.sqlStringForValue - // as much as possible, to obtain the database-specific variable placeholder. We could do something simpler like - // ERXObjectBinding does, but we would not obtain that db-specific placeholder. - EOEntity oldEntity = expression.entity(); - expression._setEntity(EOUtilities.entityNamed(ec, entityName())); - String result = expression.sqlStringForValue( value(), keyPath() ); - expression._setEntity(oldEntity); - return result; - } - } - - public boolean isModelAttribute() { - return true; - } } Modified: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXObjectBinding.java =================================================================== --- branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXObjectBinding.java 2011-02-21 22:01:41 UTC (rev 11980) +++ branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXObjectBinding.java 2011-02-22 11:38:18 UTC (rev 11981) @@ -1,49 +1,16 @@ package er.extensions.eof; -import java.math.BigDecimal; +import com.webobjects.jdbcadaptor.EOObjectBinding; -import com.webobjects.eoaccess.EOAttribute; -import com.webobjects.eoaccess.EOSQLExpression; -import com.webobjects.eocontrol.EOEditingContext; -import com.webobjects.foundation.NSData; -import com.webobjects.foundation.NSDictionary; -import com.webobjects.foundation.NSTimestamp; - /** * This class models an SQL binding based on a Java object. - * <p> - * When using this class to model a binding, the EOF SQL generation layer will not - * be able to inspect the model and obtain the correct value types and conversions. - * A best guess will be made based on the class of the wrapped object. This class - * supports the five basic types EOF supports (String, BigDecimal, Number, NSData and - * NSTimestamp). Also, boolean values true and false are converted to "true" and "false" - * strings. If boolean representation is different on the database you are using (like - * integers) you have to handle it yourself by wrapping an object of the appropriate - * class. - * </p> - * <p> - * A note about SQL generation: due to the internal architecture of database plugins, - * this class will not be able to ask the plugin for an appropriate placeholder string - * for the binding values. This won't matter for databases where the placeholder string - * is "?". However, some databases, like PostgreSQL 7.4 and older, require the placeholder - * string to contain the value type, like "?::varchar(1000)". Using this class may cause - * problems and unexpected results on such databases. If that's the case, consider using - * {@link ERXKeyValueBinding}. - * </p> + * + * @deprecated Use EOObjectBinding */ -public class ERXObjectBinding implements ERXSQLBinding { +@Deprecated +public class ERXObjectBinding extends EOObjectBinding implements ERXSQLBinding { /** - * Wrapped object. - */ - private Object _value; - - /** - * Helper EOAttributed used for SQL generation. - */ - private EOAttribute _attribute; - - /** * Creates a new object binding wrapper for the given object. * <p> * value must be an instance of the following classes (or any subsclass of these): String, @@ -52,49 +19,8 @@ * @param value * Object to be wrapped */ - public ERXObjectBinding( Object value ) { - super(); - initForValue( value ); + public ERXObjectBinding(Object value) { + super(value); } - /** - * Initializes instance based on the wrapped object class. - * - * @param originalValue - * Object to be wrapped - */ - private void initForValue(Object originalValue) { - Object value = originalValue; - if( originalValue instanceof Boolean ) { - value = originalValue.toString(); - } - EOAttribute attribute = new EOAttribute(); - attribute.setName(""); // Must have a name, or EOSQLExpression will scream - if( value instanceof String ) { - attribute.setClassName( String.class.getName() ); - } else if( value instanceof BigDecimal ) { - attribute.setClassName( BigDecimal.class.getName() ); - } else if( value instanceof Number ) { - attribute.setClassName( Number.class.getName() ); - } else if( value instanceof NSData ) { - attribute.setClassName( NSData.class.getName() ); - } else if( value instanceof NSTimestamp ) { - attribute.setClassName( NSTimestamp.class.getName() ); - } else { - throw new RuntimeException("Unsupported object class: " + value.getClass().getName() ); - } - _value = value; - _attribute = attribute; - } - - public String sqlStringForBindingOnExpression(EOSQLExpression expression, EOEditingContext ec) { - NSDictionary binding = expression.bindVariableDictionaryForAttribute( _attribute, _value ); - expression.addBindVariableDictionary(binding); - return (String) binding.objectForKey(EOSQLExpression.BindVariablePlaceHolderKey); - } - - public boolean isModelAttribute() { - return false; - } - } Modified: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLBinding.java =================================================================== --- branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLBinding.java 2011-02-21 22:01:41 UTC (rev 11980) +++ branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLBinding.java 2011-02-22 11:38:18 UTC (rev 11981) @@ -1,34 +1,13 @@ package er.extensions.eof; -import com.webobjects.eoaccess.EOSQLExpression; -import com.webobjects.eocontrol.EOEditingContext; +import com.webobjects.jdbcadaptor.EOSQLBinding; /** * Interface for binding wrapper objects. + * + * @deprecated Use EOSQLBinding */ -public interface ERXSQLBinding { - - /** - * Registers the binding on a given SQL expression, and obtains the - * binding placeholder string for the binding value. - * - * @param expression - * EOSQLExpression being built - * @return the SQL placeholder string for the used DB, usually "?" - */ - public String sqlStringForBindingOnExpression( EOSQLExpression expression, EOEditingContext ec ); - - /** - * True if the binded attribute is an existing EOModel attribute, false otherwise. - * <p> - * A binding should return true if the binding contains enough information to know what - * model attribute the value will be binded to. Bindings that return true will benefit - * from proper type conversion, as defined in the model (for instance, converting a - * boolean to a string or integer). - * </p> - * - * @return True if the binded attribute is an existing EOModel attribute, false otherwise. - */ - public boolean isModelAttribute(); - +@Deprecated +public interface ERXSQLBinding extends EOSQLBinding { + } Modified: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLQuery.java =================================================================== --- branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLQuery.java 2011-02-21 22:01:41 UTC (rev 11980) +++ branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSQLQuery.java 2011-02-22 11:38:18 UTC (rev 11981) @@ -8,189 +8,47 @@ import java.sql.SQLException; import java.util.Enumeration; -import org.apache.log4j.Logger; - import com.webobjects.eoaccess.EOAdaptorChannel; -import com.webobjects.eoaccess.EOAdaptorContext; import com.webobjects.eoaccess.EOAttribute; import com.webobjects.eoaccess.EODatabaseChannel; import com.webobjects.eoaccess.EODatabaseContext; import com.webobjects.eoaccess.EOEntity; -import com.webobjects.eoaccess.EOModel; -import com.webobjects.eoaccess.EOModelGroup; -import com.webobjects.eoaccess.EOModelSQLParser; import com.webobjects.eoaccess.EOSQLExpression; import com.webobjects.eoaccess.EOUtilities; import com.webobjects.eocontrol.EOEditingContext; import com.webobjects.eocontrol.EOFetchSpecification; -import com.webobjects.eocontrol.EOObjectStore; import com.webobjects.eocontrol._EOMutableKnownKeyDictionary; import com.webobjects.foundation.NSArray; import com.webobjects.foundation.NSDictionary; import com.webobjects.foundation.NSKeyValueCoding; import com.webobjects.foundation.NSMutableArray; -import com.webobjects.foundation._NSDelegate; +import com.webobjects.jdbcadaptor.EOKeyValueBinding; +import com.webobjects.jdbcadaptor.EOSQLBinding; +import com.webobjects.jdbcadaptor.EOSQLQuery; import com.webobjects.jdbcadaptor.JDBCChannel; import com.webobjects.jdbcadaptor.JDBCColumn; import com.webobjects.jdbcadaptor.JDBCContext; /** - * This class allows SQL queries with binded variables to be run against the database. It's possible - * to obtain EOs, raw rows or a batch iterator, depending on the used method. + * This class extends {@link EOSQLQuery} and adds functionality. * <p> - * Binded values are passed in using {@link ERXSQLBinding} implementations. Currently, there are two available - * implementations: {@link ERXKeyValueBinding} and {@link ERXObjectBinding}. The first one should be used if - * the binding matches a column modeled in an EOModel. This way, any data type conversions that would happen - * on normal EOF usage are also applied when generating the SQL query. An example of this can be converting a - * boolean value to a string or an integer. {@link ERXObjectBinding} can be used for non-modeled columns. - * Please read the {@link ERXObjectBinding} class documentation for important notes regarding some databases - * that expect SQL queries with binding typification. + * Here are some sample uses of the added functionality: * </p> - * <p> - * This class is used by calling the most appropriate static method for the intended usage. Specific requirements - * for the SQL query resulting columns are detailed on each of the method's documentation. Generally, you need - * to provide a query returning the appropriate columns and using the '?' character for each binded value. - * Depending on the database plug-in being used, the '?' character will be automatically replaced by a different - * expression if the {@link ERXKeyValueBinding} class is used to wrap the binded value. In PostgreSQL, for instance, - * the '?' character could be replaced by '?::varchar(1000)'. - * </p> - * <p> - * Queries may be written using tokens described in {@link EOModelSQLParser}. This simplifies writing SQL queries, - * as entity, attribute and relationship names can be used instead of table and column names. - * </p> - * <p> - * Here are some sample uses of this class: - * </p> * <pre> - * // Obtains EOs that match the query - * ERXSQLQuery.objectsForQuery(editingContext(), Song.ENTITY_NAME, - * "SELECT * FROM SONG WHERE FAVORITE = ? AND DURATION > ? ORDER BY NUMBER ASC", true, - * new ERXKeyValueBinding("favorite", true), new ERXKeyValueBinding("duration", 120)); - * - * // Obtains raw rows for query - * ERXSQLQuery.rowsForQueryOnEntity(editingContext(), Song.ENTITY_NAME, - * "SELECT t0.NAME, t0.DURATION FROM SONG t0 WHERE COMPOSER = ?", new ERXKeyValueBinding("composer", "Mozart")); - * - * // Runs a query that returns no objects, using EOModelSQLParser-style tokens - * ERXSQLQuery.runQuery(editingContext(), "SongsModel", - * "DELETE FROM {Song} WHERE {favorite} = ?", new ERXKeyValueBinding("Song", "favorite", false)); - * * // Obtains ERXFetchSpecificationBatchIterator * // Note the query must obtain the primary key! * ERXSQLQuery.batchIteratorForQuery(editingContext(), Employee.ENTITY_NAME, * "SELECT ID FROM EMPLOYEE WHERE HEIGHT < ? AND FIRST_NAME = ? ORDER BY NUMBER DESC", false, 100, * new NSArray<EOSortOrdering>(new EOSortOrdering[] {new EOSortOrdering("number", EOSortOrdering.CompareDescending)}), - * new ERXObjectBinding(190), new ERXKeyValueBinding("firstName", "John")); + * new EOObjectBinding(190), new EOKeyValueBinding("firstName", "John")); * </pre> */ -public class ERXSQLQuery { +public class ERXSQLQuery extends EOSQLQuery { /** - * Runs a select query against the database, obtaining the resulting EOs. - * <p> - * Please read the {@link #objectsForQuery(EOEditingContext, String, String, boolean, Integer, ERXSQLBinding...)} - * documentation for the necessary details on how to use both methods. - * </p> - * @param ec - * The editing context where the objects will be placed - * @param entityName - * The name of the entity whose objects are returned by the query - * @param query - * The SQL query - * @param bindings - * The variable bindings, wrapped in {@link ERXSQLBinding} objects - * - * @see #objectsForQuery(EOEditingContext, String, String, boolean, Integer, ERXSQLBinding...) - * @return array of objects obtained by the query - */ - public static NSArray objectsForQuery( EOEditingContext ec, String entityName, String query, ERXSQLBinding... bindings ) { - return objectsForQuery(ec, entityName, query, false, null, bindings); - } - - /** - * Runs a select query against the database, obtaining the resulting EOs. - * <p> - * Please read the {@link #objectsForQuery(EOEditingContext, String, String, boolean, Integer, ERXSQLBinding...)} - * documentation for the necessary details on how to use both methods. - * </p> - * @param ec - * The editing context where the objects will be placed - * @param entityName - * The name of the entity whose objects are returned by the query - * @param query - * The SQL query - * @param refreshesCache - * If true, the cached snapshots will be refreshed. See {@link EOFetchSpecification#setRefreshesRefetchedObjects(boolean)}. - * @param bindings - * The variable bindings, wrapped in {@link ERXSQLBinding} objects - * - * @see #objectsForQuery(EOEditingContext, String, String, boolean, Integer, ERXSQLBinding...) - * @return array of objects obtained by the query - */ - public static NSArray objectsForQuery( EOEditingContext ec, String entityName, String query, boolean refreshesCache, ERXSQLBinding... bindings ) { - return objectsForQuery(ec, entityName, query, refreshesCache, null, bindings); - } - - /** - * Runs a select query against the database, obtaining the resulting EOs. - * <p> - * This method allows a SELECT SQL query to be run, using binded variables. The method will - * process the query result and return EOs of the requested entity. - * </p> - * <p> - * There are some important requirements regarding the passed in query: - * </p> - * <ul> - * <li>The query must return all the columns of the affected table that are mapped in the modeled - * Entity. 'SELECT * FROM Table ...' is the easiest way to achieve this. Alias are supported, like - * 'SELECT t0.* FROM Table t0 ...'.</li> - * <li>The placeholder for binded variables must be the '?' character. This method will process the - * query before executing it, replacing the generic placeholder character by the one appropriate to - * the used database. Ex: when using PostgreSQL, '... WHERE FIRST_NAME = ?' may be replaced by - * '... WHERE FIRST_NAME = ?::varchar(1000)'.</li> - * <li>The '?' character does not need to be quoted if it appears on the query inside a string literal. - * This situation is automatically detected and the substitution is not performed.</li> - * <li>The number of binding wrappers passed in as last arguments of this method must match the number of - * binding placeholders in the query.</li> - * </ul> - * @param ec - * The editing context where the objects will be placed - * @param entityName - * The name of the entity whose objects are returned by the query - * @param query - * The SQL query - * @param refreshesCache - * If true, the cached snapshots will be refreshed. See {@link EOFetchSpecification#setRefreshesRefetchedObjects(boolean)}. - * @param fetchLimit - * Fetch limit, or null for no limit - * @param bindings - * The variable bindings, wrapped in {@link ERXSQLBinding} objects - * - * @return array of objects obtained by the query - */ - public static NSArray objectsForQuery( EOEditingContext ec, String entityName, String query, boolean refreshesCache, Integer fetchLimit, ERXSQLBinding... bindings ) { - EODatabaseContext context = databaseContextForEntityName(ec,entityName); - EOEntity entity = EOUtilities.entityNamed(ec, entityName); - - EOSQLExpression expression = context.adaptorContext().adaptor().expressionFactory().expressionForEntity( entity ); - - String proceccedQuery = processedQueryString(query, expression, ec, bindings); - expression.setStatement(proceccedQuery); - - EOFetchSpecification spec = new EOFetchSpecification( entityName, null, null ); - spec.setRefreshesRefetchedObjects(refreshesCache); - if( fetchLimit != null ) { - spec.setFetchLimit( fetchLimit ); - } - spec.setHints( new NSDictionary( expression, EODatabaseContext.CustomQueryExpressionHintKey ) ); - - return ec.objectsWithFetchSpecification(spec); - } - - /** * Obtains a batch iterator for the objects resulting from the passed in SQL query with binded variables. * <p> - * The requirements for the passed in SQL query are the same as {@link #objectsForQuery(EOEditingContext, String, String, boolean, ERXSQLBinding...)}, + * The requirements for the passed in SQL query are the same as {@link #objectsForQuery(EOEditingContext, String, String, boolean, EOSQLBinding...)}, * except for an important difference: the query must return only one column with the entity primary keys. * Instead of doing a query like 'SELECT * FROM Person ...', assuming ID as the name of the primary key column, * the query would be 'SELECT ID FROM Person ...'. Despite this, the batch iterator will provide you the @@ -215,11 +73,11 @@ * @param sortOrderings * EOSortOrderings for batches (see description above) * @param bindings - * The variable bindings, wrapped in {@link ERXSQLBinding} objects + * The variable bindings, wrapped in {@link EOSQLBinding} objects * * @return batch iterator for the passed in query */ - public static ERXFetchSpecificationBatchIterator batchIteratorForQuery( EOEditingContext ec, String entityName, String query, boolean refreshesCache, int batchSize, NSArray sortOrderings, ERXSQLBinding... bindings ) { + public static ERXFetchSpecificationBatchIterator batchIteratorForQuery( EOEditingContext ec, String entityName, String query, boolean refreshesCache, int batchSize, NSArray sortOrderings, EOSQLBinding... bindings ) { EODatabaseContext databaseContext = databaseContextForEntityName(ec,entityName); EOEntity entity = EOUtilities.entityNamed(ec, entityName); @@ -249,326 +107,4 @@ spec.setRefreshesRefetchedObjects( refreshesCache ); return new ERXFetchSpecificationBatchIterator( spec, pks, ec, batchSize); } - - - /** - * Runs an SQL query against the database with binded variables. - * <p> - * The requirements for this method are similar to {@link #objectsForQuery(EOEditingContext, String, String, boolean, ERXSQLBinding...)}, - * with the following differences: - * </p> - * <ul> - * <li>The query should not return any object. This method is intended to be used with non-SELECT - * queries, like UPDATE, INSERT or DELETE.</li> - * <li>If {@link ERXKeyValueBinding} bindings are used, the entity name must be specified in the binding constructor.</li> - * </ul> - * - * @param ec - * The current editing context (used to obtain the correct OSC) - * @param modelName - * The name of the model (used to apply the query on the correct DB) - * @param query - * The SQL query - * @param bindings - * The variable bindings, wrapped in {@link ERXSQLBinding} objects - */ - public static void runQuery( EOEditingContext ec, String modelName, String query, ERXSQLBinding... bindings ) { - EOObjectStore osc = ec.rootObjectStore(); - EODatabaseChannel databaseChannel = databaseContextForModelName(ec,modelName).availableChannel(); - osc.lock(); - - try { - EOAdaptorChannel adaptorChannel = databaseChannel.adaptorChannel(); - - if (!adaptorChannel.isOpen()) { - adaptorChannel.openChannel(); - } - - // marroz: We create the expression with the original query and then set the processed query because - // it's the only way to create an expression without an entity. - EOSQLExpression expression = adaptorChannel.adaptorContext().adaptor().expressionFactory().expressionForString( query ); - - String proceccedQuery = processedQueryString(query, expression, ec, bindings); - expression.setStatement(proceccedQuery); - - try { - adaptorChannel.evaluateExpression( expression ); - } finally { - databaseChannel.cancelFetch(); - } - } finally { - osc.unlock(); - } - } - - /** - * Runs a select query against the database, obtaining the resulting raw rows. - * <p> - * This method allows a SELECT SQL query to be run, using binded variables. The - * method will return the resulting rows without any additional processing. - * </p> - * <p> - * The requirements for the passed in SQL query are the same as {@link #objectsForQuery(EOEditingContext, String, String, boolean, ERXSQLBinding...)}. - * </p> - * @param ec - * The current editing context (used to obtain the correct OSC) - * @param entityName - * Entity name for fetched objects. - * @param query - * The SQL query - * @param bindings - * The variable bindings, wrapped in {@link ERXSQLBinding} objects - * @return The requested raw rows - */ - public static NSArray rawRowsForQueryOnEntity( EOEditingContext ec, String entityName, String query, ERXSQLBinding... bindings ) { - EODatabaseChannel databaseChannel = databaseContextForEntityName(ec,entityName).availableChannel(); - EOAdaptorChannel adaptorChannel = databaseChannel.adaptorChannel(); - EOEntity entity = EOUtilities.entityNamed(ec, entityName); - - EOSQLExpression expression = adaptorChannel.adaptorContext().adaptor().expressionFactory().expressionForEntity( entity ); - expression.setStatement( processedQueryString( query, expression, ec, bindings ) ); - - EOFetchSpecification spec = new EOFetchSpecification( entityName, null, null ); - spec.setFetchesRawRows(true); - spec.setHints( new NSDictionary( expression, EODatabaseContext.CustomQueryExpressionHintKey ) ); - - return ec.objectsWithFetchSpecification(spec); - } - - /** - * Runs a select query against the database, obtaining the resulting raw rows. - * <p> - * This method allows a SELECT SQL query to be run, using binded variables. The - * method will return the resulting rows without any additional processing. This is - * a variant from {@link #rowsForQueryOnEntity(EOEditingContext, String, String, ERXSQLBinding...)} - * that doesn't need the result rows to belong to a given entity. - * </p> - * <p> - * The requirements for the passed in SQL query are similar to {@link #objectsForQuery(EOEditingContext, String, String, boolean, ERXSQLBinding...)} - * with the following differences: - * </p> - * <ul> - * <li>The query can return any arbitrary column.</li> - * <li>If {@link ERXKeyValueBinding} bindings are used, the entity name must be specified in the binding constructor.</li> - * </ul> - * - * @param ec - * The current editing context (used to obtain the correct OSC) - * @param modelName - * The name of the model (used to apply the query on the correct DB) - * @param query - * The SQL query - * @param bindings - * The variable bindings, wrapped in {@link ERXSQLBinding} objects - * @return The requested raw rows - */ - public static NSArray rawRowsForQuery( EOEditingContext ec, String modelName, String query, ERXSQLBinding... bindings ) { - EODatabaseContext dbContext = databaseContextForModelName(ec, modelName); - dbContext.lock(); - - try{ - EODatabaseChannel databaseChannel = dbContext.availableChannel(); - EOAdaptorChannel adaptorChannel = databaseChannel.adaptorChannel(); - adaptorChannel.openChannel(); - - JDBCContext jdbcContext = (JDBCContext) adaptorChannel.adaptorContext(); - Connection connection = jdbcContext.connection(); - - // marroz: We create the expression with the original query and then set the processed query because - // it's the only way to create an expression without an entity. - EOSQLExpression expression = adaptorChannel.adaptorContext().adaptor().expressionFactory().expressionForString(query); - expression.setStatement(processedQueryString(query, expression, ec, bindings)); - - PreparedStatement statement = null; - ResultSet resultSet = null; - NSMutableArray<NSDictionary> resultList = new NSMutableArray<NSDictionary>(100); - - try { - statement = connection.prepareStatement(expression.statement()); - - int index = 1; - for (NSDictionary<String, ? extends Object> binding : expression.bindVariableDictionaries()) { - if (bindings[index - 1].isModelAttribute()) { - EOAttribute attribute = (EOAttribute) binding.objectForKey(EOSQLExpression.BindVariableAttributeKey); - JDBCColumn column = new JDBCColumn(attribute, (JDBCChannel)adaptorChannel); - column.setStatement(statement); - column.takeInputValue(binding.objectForKey(EOSQLExpression.BindVariableValueKey), index, false); - } else { - statement.setObject(index, binding.objectForKey(EOSQLExpression.BindVariableValueKey)); - } - ++index; - } - - resultSet = statement.executeQuery(); - - ResultSetMetaData metaData = resultSet.getMetaData(); - int numColumns = metaData.getColumnCount(); - NSMutableArray<String> columnNames = new NSMutableArray<String>(numColumns); - - for (int i = 0; i < numColumns; i++) { - columnNames.addObject(metaData.getColumnName(i + 1)); - } - - _EOMutableKnownKeyDictionary.Initializer dictInitializer = new _EOMutableKnownKeyDictionary.Initializer(columnNames); - - while (resultSet.next()) { - _EOMutableKnownKeyDictionary result = new _EOMutableKnownKeyDictionary(dictInitializer); - for (int i = 0; i < numColumns; i++) { - final Object value = resultSet.getObject(i + 1); - if (value != null) { - result.setObjectForKey(value, columnNames.objectAtIndex(i)); - } - else { - result.setObjectForKey(NSKeyValueCoding.NullValue, columnNames.objectAtIndex(i)); - } - } - resultList.add(result); - } - return resultList; - } catch (SQLException e) { - throw new RuntimeException(e); - } finally { - try { - if (statement != null) { - statement.close(); - } - } catch (Exception e) { - throw new RuntimeException(e); - } finally { - try { - if (resultSet != null) { - resultSet.close(); - } - } catch (Exception e) { - throw new RuntimeException(e); - } - } - } - } finally { - dbContext.unlock(); - } - } - - // ================================================== - // Support methods - // -------------------------------------------------- - - /** - * Replaces the binding placeholder characters by the appropriate token for the used database. - * <p> - * This method will also register each of the bindings in the given expression. - * </p> - * - * @param query - * The original SQL query - * @param expression - * EOSQLExpression to be modified - * @param bindings - * The variable bindings, wrapped in {@link ERXSQLBinding} objects - * @return The processed query - */ - protected static String processedQueryString(String query, EOSQLExpression expression, EOEditingContext ec, ERXSQLBinding... bindings) { - int currentOffset = 0; - int bindingCount = 0; - StringBuffer processedQueryBuffer = new StringBuffer(); - String parsedQuery = EOModelSQLParser.sqlQueryForQuery(ec, query); - NSArray positions = varPositionsForQuery( parsedQuery ); - - if( positions.count() != bindings.length ) { - throw new RuntimeException("Binding placeholders count (" + positions.count() + ") does not match binding wrappers count (" + bindings.length + ")."); - } - - for ( Enumeration positionEnumerator = positions.objectEnumerator(); positionEnumerator.hasMoreElements(); ) { - Integer position = (Integer) positionEnumerator.nextElement(); - if( position > currentOffset ) { - processedQueryBuffer.append( parsedQuery.substring( currentOffset, position ) ); - } - ERXSQLBinding binding = bindings[bindingCount]; - // The call to sqlStringForValue adds a binding to the expression binding list... - processedQueryBuffer.append( binding.sqlStringForBindingOnExpression(expression, ec) ); - currentOffset = position+1; - bindingCount++; - } - - if( currentOffset < parsedQuery.length() ) { - processedQueryBuffer.append( parsedQuery.substring( currentOffset, parsedQuery.length() ) ); - } - - String proceccedQuery = processedQueryBuffer.toString(); - return proceccedQuery; - } - - /** - * Obtains the index positions of the binding placeholders in the query. - * - * @param query - * The SQL query - * @return array of placeholder index positions - */ - private static NSArray varPositionsForQuery(String query) { - int position = 0; - boolean inQuote = false; - char quoteChar = 0; - NSMutableArray positions = new NSMutableArray(); - - while( position < query.length() ) { - char c = query.charAt( position ); - if( c == '\\' ) { - position += 2; - continue; - } - if( inQuote == false && ( c == '\'' || c == '\"' ) ) { - quoteChar = c; - inQuote = true; - } else if( inQuote && c == quoteChar ) { - inQuote = false; - } else if( inQuote == false && c == '?' ) { - positions.addObject(position); - } - - position++; - } - - return positions; - } - - /** - * Obtains the database context for the given editing context and entity name. - * - * @param ec - * Editing context - * @param entityName - * The entity name - * @return The database context for the given editing context and entity name - */ - private static EODatabaseContext databaseContextForEntityName( EOEditingContext ec, String entityName ) { - EOModelGroup group = EOUtilities.modelGroup( ec ); - EOModel model = group.entityNamed(entityName).model(); - if( model != null ) { - return EODatabaseContext.registeredDatabaseContextForModel(model, ec); - } else { - throw new RuntimeException("Entity named " + entityName + " not found in the model group."); - } - } - - /** - * Obtains the database context for the given editing context and model name - * - * @param ec - * Editing context - * @param modelName - * The model name - * @return The database context for the given editing context and model name - */ - private static EODatabaseContext databaseContextForModelName(EOEditingContext ec, String modelName) { - EOModelGroup group = EOUtilities.modelGroup( ec ); - EOModel model = group.modelNamed(modelName); - if( model != null ) { - return EODatabaseContext.registeredDatabaseContextForModel(model, ec); - } else { - throw new RuntimeException("Model " + modelName + " not found in the model group."); - } - } - - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bob_schwarzmann@us...> - 2011-02-21 22:01:49
|
Revision: 11980 http://wonder.svn.sourceforge.net/wonder/?rev=11980&view=rev Author: bob_schwarzmann Date: 2011-02-21 22:01:41 +0000 (Mon, 21 Feb 2011) Log Message: ----------- Merged revisions 11979 via svnmerge from https://wonder.svn.sourceforge.net/svnroot/wonder/branches/Wonder_2_0_0_Branch/Wonder ........ r11979 | mschrag | 2011-02-21 13:27:49 -0800 (Mon, 21 Feb 2011) | 6 lines * better handling of NSKVC.NullValue's (turns into a 'null' except in plist -- maybe a plist bug) * NSKVC.Null is now considered a primitive * format parser delegates can be null now * api to provide a custom format parser delegate per controller ........ Modified Paths: -------------- branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/ERXRestRequestNode.java branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/ERXRestUtils.java branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXJSONRestParser.java branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXJSONRestWriter.java branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXPListRestParser.java branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXPListRestWriter.java branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXXmlRestWriter.java branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/routes/ERXRouteController.java Property Changed: ---------------- branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/ branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Ajax/ERCoolComponents/ branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Components/Nonlocalized.lproj/ERXLog4JConfiguration.wo/ERXLog4JConfiguration.wod branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/logging/ERXLog4JConfiguration.java branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/D2W/ERModernDefaultSkin/ branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/D2W/ERModernDirectToWeb/ branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/D2W/ERModernLook/ Property changes on: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder ___________________________________________________________________ Modified: svnmerge-integrated - /branches/Wonder_2_0_0_Branch/Wonder:1-11977 + /branches/Wonder_2_0_0_Branch/Wonder:1-11979 Modified: svn:mergeinfo - /branches/Wonder_2_0_0_Branch/Wonder:9653,9672-9702,9707,9730-9802,9876-9930,9937-9939,9959-10054,10060-10075,10112-10220,10307-10490,10495,10505,10514-10526,10546,10560-10562,10569,10578-10693,10702-10703,10709-10710,10734-10741,10743-10771,10780,10782-10785,10788-10808,10813-10817,10820,10824,10830-10837,10844-10869,10871,10881-10897,10901,10903-10912,10921-10946,10948,10954-10968,10986-10987,10993-10998,11004,11008-11088,11091-11158,11245-11266,11276-11538,11546-11715,11723-11780,11786-11787,11789-11794,11802,11812,11820-11822,11826,11856,11859-11860,11863,11870-11871,11917,11935,11940,11945,11949,11953-11957 + /branches/Wonder_2_0_0_Branch/Wonder:9653,9672-9702,9707,9730-9802,9876-9930,9937-9939,9959-10054,10060-10075,10112-10220,10307-10490,10495,10505,10514-10526,10546,10560-10562,10569,10578-10693,10702-10703,10709-10710,10734-10741,10743-10771,10780,10782-10785,10788-10808,10813-10817,10820,10824,10830-10837,10844-10869,10871,10881-10897,10901,10903-10912,10921-10946,10948,10954-10968,10986-10987,10993-10998,11004,11008-11088,11091-11158,11245-11266,11276-11538,11546-11715,11723-11780,11786-11787,11789-11794,11802,11812,11820-11822,11826,11856,11859-11860,11863,11870-11871,11917,11935,11940,11945,11949,11953-11957,11979 Property changes on: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Ajax/ERCoolComponents ___________________________________________________________________ Modified: svn:mergeinfo - /branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Ajax/ERCoolComponents:9653,9672-9702,9707,9730-9802,9876-9930,9937-9939,9959-10054,10060-10075,10112-10220,10307-10490,10495,10505,10514-10526,10546,10560-10562,10569,10578-10693,10702-10703,10709-10710,10734-10741,10743-10771,10780,10782-10785,10788-10808,10813-10817,10820,10824,10830-10837,10844-10869,10871,10881-10897,10901,10903-10912,10921-10946,10948,10954-10968,10986-10987,10993-10998,11004,11008-11088,11091-11158,11245-11266,11276-11538,11546-11715,11723-11780,11786-11787,11789-11794,11802,11812,11820-11822,11826,11856,11859-11860,11863,11870-11871,11917,11935,11940,11945,11949,11953-11957 /branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Ajax/ERCoolComponents:11280-11857 /trunk/Wonder/Frameworks/Ajax/ERCoolComponents:11216-11279 + /branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Ajax/ERCoolComponents:9653,9672-9702,9707,9730-9802,9876-9930,9937-9939,9959-10054,10060-10075,10112-10220,10307-10490,10495,10505,10514-10526,10546,10560-10562,10569,10578-10693,10702-10703,10709-10710,10734-10741,10743-10771,10780,10782-10785,10788-10808,10813-10817,10820,10824,10830-10837,10844-10869,10871,10881-10897,10901,10903-10912,10921-10946,10948,10954-10968,10986-10987,10993-10998,11004,11008-11088,11091-11158,11245-11266,11276-11538,11546-11715,11723-11780,11786-11787,11789-11794,11802,11812,11820-11822,11826,11856,11859-11860,11863,11870-11871,11917,11935,11940,11945,11949,11953-11957,11979 /branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Ajax/ERCoolComponents:11280-11857 /trunk/Wonder/Frameworks/Ajax/ERCoolComponents:11216-11279 Property changes on: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Components/Nonlocalized.lproj/ERXLog4JConfiguration.wo/ERXLog4JConfiguration.wod ___________________________________________________________________ Modified: svn:mergeinfo - /branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Components/Nonlocalized.lproj/ERXLog4JConfiguration.wo/ERXLog4JConfiguration.wod:2736-2738 /branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Components/Nonlocalized.lproj/ERXLog4JConfiguration.wo/ERXLog4JConfiguration.wod:11812,11820-11822,11826,11856,11859-11860,11863,11870-11871,11917,11935,11940,11945,11949,11953-11957 /branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Components/Nonlocalized.lproj/ERXLog4JConfiguration.wo/ERXLog4JConfiguration.wod:11284,11342,11344,11348,11353-11354 /trunk/Wonder/Common/Frameworks/ERExtensions/Components/Nonlocalized.lproj/ERXLog4JConfiguration.wo/ERXLog4JConfiguration.wod:2736-7709 /trunk/Wonder/Frameworks/Core/ERExtensions/Components/Nonlocalized.lproj/ERXLog4JConfiguration.wo/ERXLog4JConfiguration.wod:7710-11503 + /branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Components/Nonlocalized.lproj/ERXLog4JConfiguration.wo/ERXLog4JConfiguration.wod:2736-2738 /branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Components/Nonlocalized.lproj/ERXLog4JConfiguration.wo/ERXLog4JConfiguration.wod:11812,11820-11822,11826,11856,11859-11860,11863,11870-11871,11917,11935,11940,11945,11949,11953-11957,11979 /branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Components/Nonlocalized.lproj/ERXLog4JConfiguration.wo/ERXLog4JConfiguration.wod:11284,11342,11344,11348,11353-11354 /trunk/Wonder/Common/Frameworks/ERExtensions/Components/Nonlocalized.lproj/ERXLog4JConfiguration.wo/ERXLog4JConfiguration.wod:2736-7709 /trunk/Wonder/Frameworks/Core/ERExtensions/Components/Nonlocalized.lproj/ERXLog4JConfiguration.wo/ERXLog4JConfiguration.wod:7710-11503 Property changes on: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/logging/ERXLog4JConfiguration.java ___________________________________________________________________ Modified: svn:mergeinfo - /branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXLog4JConfiguration.java:2736-2738 /branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/logging/ERXLog4JConfiguration.java:10717-10770 /branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/logging/ERXLog4JConfiguration.java:11812,11820-11822,11826,11856,11859-11860,11863,11870-11871,11917,11935,11940,11945,11949,11953-11957 /branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/logging/ERXLog4JConfiguration.java:11284,11342,11344,11348,11353-11354 /trunk/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXLog4JConfiguration.java:2736-7655 /trunk/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/logging/ERXLog4JConfiguration.java:7656-7709 /trunk/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/logging/ERXLog4JConfiguration.java:7710-11485 + /branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXLog4JConfiguration.java:2736-2738 /branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/logging/ERXLog4JConfiguration.java:10717-10770 /branches/Wonder_2_0_0_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/logging/ERXLog4JConfiguration.java:11812,11820-11822,11826,11856,11859-11860,11863,11870-11871,11917,11935,11940,11945,11949,11953-11957,11979 /branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/logging/ERXLog4JConfiguration.java:11284,11342,11344,11348,11353-11354 /trunk/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXLog4JConfiguration.java:2736-7655 /trunk/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/logging/ERXLog4JConfiguration.java:7656-7709 /trunk/Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/logging/ERXLog4JConfiguration.java:7710-11485 Property changes on: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/D2W/ERModernDefaultSkin ___________________________________________________________________ Modified: svn:mergeinfo - /branches/Wonder_2_0_0_Branch/Wonder/Frameworks/D2W/ERModernDefaultSkin:9653,9672-9702,9707,9730-9802,9876-9930,9937-9939,9959-10054,10060-10075,10112-10220,10307-10490,10495,10505,10514-10526,10546,10560-10562,10569,10578-10693,10702-10703,10709-10710,10734-10741,10743-10771,10780,10782-10785,10788-10808,10813-10817,10820,10824,10830-10837,10844-10869,10871,10881-10897,10901,10903-10912,10921-10946,10948,10954-10968,10986-10987,10993-10998,11004,11008-11088,11091-11158,11245-11266,11276-11538,11546-11715,11723-11780,11786-11787,11789-11794,11802,11812,11820-11822,11826,11856,11859-11860,11863,11870-11871,11917,11935,11940,11945,11949,11953-11957 /branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/D2W/ERModernDefaultSkin:11280-11858 /trunk/Wonder/Frameworks/D2W/ERModernDefaultSkin:10824-11279 + /branches/Wonder_2_0_0_Branch/Wonder/Frameworks/D2W/ERModernDefaultSkin:9653,9672-9702,9707,9730-9802,9876-9930,9937-9939,9959-10054,10060-10075,10112-10220,10307-10490,10495,10505,10514-10526,10546,10560-10562,10569,10578-10693,10702-10703,10709-10710,10734-10741,10743-10771,10780,10782-10785,10788-10808,10813-10817,10820,10824,10830-10837,10844-10869,10871,10881-10897,10901,10903-10912,10921-10946,10948,10954-10968,10986-10987,10993-10998,11004,11008-11088,11091-11158,11245-11266,11276-11538,11546-11715,11723-11780,11786-11787,11789-11794,11802,11812,11820-11822,11826,11856,11859-11860,11863,11870-11871,11917,11935,11940,11945,11949,11953-11957,11979 /branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/D2W/ERModernDefaultSkin:11280-11858 /trunk/Wonder/Frameworks/D2W/ERModernDefaultSkin:10824-11279 Property changes on: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/D2W/ERModernDirectToWeb ___________________________________________________________________ Modified: svn:mergeinfo - /branches/Wonder_2_0_0_Branch/Wonder/Frameworks/D2W/ERModernDirectToWeb:9653,9672-9702,9707,9730-9802,9876-9930,9937-9939,9959-10054,10060-10075,10112-10220,10307-10490,10495,10505,10514-10526,10546,10560-10562,10569,10578-10693,10702-10703,10709-10710,10734-10741,10743-10771,10780,10782-10785,10788-10808,10813-10817,10820,10824,10830-10837,10844-10869,10871,10881-10897,10901,10903-10912,10921-10946,10948,10954-10968,10986-10987,10993-10998,11004,11008-11088,11091-11158,11245-11266,11276-11538,11546-11715,11723-11780,11786-11787,11789-11794,11802,11812,11820-11822,11826,11856,11859-11860,11863,11870-11871,11917,11935,11940,11945,11949,11953-11957 /branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/D2W/ERModernDirectToWeb:11280-11858 /trunk/Wonder/Frameworks/D2W/ERModernDirectToWeb:10824-11279 + /branches/Wonder_2_0_0_Branch/Wonder/Frameworks/D2W/ERModernDirectToWeb:9653,9672-9702,9707,9730-9802,9876-9930,9937-9939,9959-10054,10060-10075,10112-10220,10307-10490,10495,10505,10514-10526,10546,10560-10562,10569,10578-10693,10702-10703,10709-10710,10734-10741,10743-10771,10780,10782-10785,10788-10808,10813-10817,10820,10824,10830-10837,10844-10869,10871,10881-10897,10901,10903-10912,10921-10946,10948,10954-10968,10986-10987,10993-10998,11004,11008-11088,11091-11158,11245-11266,11276-11538,11546-11715,11723-11780,11786-11787,11789-11794,11802,11812,11820-11822,11826,11856,11859-11860,11863,11870-11871,11917,11935,11940,11945,11949,11953-11957,11979 /branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/D2W/ERModernDirectToWeb:11280-11858 /trunk/Wonder/Frameworks/D2W/ERModernDirectToWeb:10824-11279 Property changes on: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/D2W/ERModernLook ___________________________________________________________________ Modified: svn:mergeinfo - /branches/Wonder_2_0_0_Branch/Wonder/Frameworks/D2W/ERModernLook:9653,9672-9702,9707,9730-9802,9876-9930,9937-9939,9959-10054,10060-10075,10112-10220,10307-10490,10495,10505,10514-10526,10546,10560-10562,10569,10578-10693,10702-10703,10709-10710,10734-10741,10743-10771,10780,10782-10785,10788-10808,10813-10817,10820,10824,10830-10837,10844-10869,10871,10881-10897,10901,10903-10912,10921-10946,10948,10954-10968,10986-10987,10993-10998,11004,11008-11088,11091-11158,11245-11266,11276-11538,11546-11715,11723-11780,11786-11787,11789-11794,11802,11812,11820-11822,11826,11856,11859-11860,11863,11870-11871,11917,11935,11940,11945,11949,11953-11957 /branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/D2W/ERModernLook:11280-11858 /trunk/Wonder/Frameworks/D2W/ERModernLook:10824-11279 + /branches/Wonder_2_0_0_Branch/Wonder/Frameworks/D2W/ERModernLook:9653,9672-9702,9707,9730-9802,9876-9930,9937-9939,9959-10054,10060-10075,10112-10220,10307-10490,10495,10505,10514-10526,10546,10560-10562,10569,10578-10693,10702-10703,10709-10710,10734-10741,10743-10771,10780,10782-10785,10788-10808,10813-10817,10820,10824,10830-10837,10844-10869,10871,10881-10897,10901,10903-10912,10921-10946,10948,10954-10968,10986-10987,10993-10998,11004,11008-11088,11091-11158,11245-11266,11276-11538,11546-11715,11723-11780,11786-11787,11789-11794,11802,11812,11820-11822,11826,11856,11859-11860,11863,11870-11871,11917,11935,11940,11945,11949,11953-11957,11979 /branches/Wonder_5_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/D2W/ERModernLook:11280-11858 /trunk/Wonder/Frameworks/D2W/ERModernLook:10824-11279 Modified: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/ERXRestRequestNode.java =================================================================== --- branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/ERXRestRequestNode.java 2011-02-21 21:27:49 UTC (rev 11979) +++ branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/ERXRestRequestNode.java 2011-02-21 22:01:41 UTC (rev 11980) @@ -584,7 +584,12 @@ * the value for this node */ public void setValue(Object value) { - _value = value; + if (value instanceof NSKeyValueCoding.Null) { + _value = null; + } + else { + _value = value; + } guessNull(); } @@ -941,8 +946,14 @@ } } else if (ERXRestUtils.isPrimitive(obj)) { - setValue(obj); - setAssociatedObject(obj); + if (obj instanceof NSKeyValueCoding.Null) { + setValue(null); + setAssociatedObject(null); + } + else { + setValue(obj); + setAssociatedObject(obj); + } } else { // in case we have a superclass class description passed in @@ -1251,6 +1262,22 @@ } } + // MS: Totally debatable .... I may take this back out, but it makes things look prettier. + public void _removeRedundantTypes() { + String type = type(); + if ("NSDictionary".equals(type) || "NSMutableDictionary".equals(type)) { + setType(null); + } + NSArray children = children(); + if (children != null) { + /*for (ERXRestRequestNode child : children) {*/ + for (Enumeration childEnum = children.objectEnumerator(); childEnum.hasMoreElements(); ) { + ERXRestRequestNode child = (ERXRestRequestNode)childEnum.nextElement(); + child._removeRedundantTypes(); + } + } + } + /** * Creates a hierarchy of ERXRestRequestNodes based off of the given array of objects. * Modified: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/ERXRestUtils.java =================================================================== --- branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/ERXRestUtils.java 2011-02-21 21:27:49 UTC (rev 11979) +++ branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/ERXRestUtils.java 2011-02-21 22:01:41 UTC (rev 11980) @@ -80,6 +80,9 @@ else if (Enum.class.isAssignableFrom(valueType)) { primitive = true; } + else if (NSKeyValueCoding.Null.class.isAssignableFrom(valueType)) { + primitive = true; + } return primitive; } Modified: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXJSONRestParser.java =================================================================== --- branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXJSONRestParser.java 2011-02-21 21:27:49 UTC (rev 11979) +++ branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXJSONRestParser.java 2011-02-21 22:01:41 UTC (rev 11980) @@ -31,7 +31,9 @@ if (ERXRestUtils.isPrimitive(obj)) { ERXRestRequestNode primitiveChild = new ERXRestRequestNode(null, obj, false); requestNode.addChild(primitiveChild); - delegate.nodeDidParse(primitiveChild); + if (delegate != null) { + delegate.nodeDidParse(primitiveChild); + } } else { requestNode.addChild(ERXJSONRestParser.createRequestNodeForJSON(null, (JSON) obj, true, delegate)); @@ -46,7 +48,9 @@ if (ERXRestUtils.isPrimitive(value)) { ERXRestRequestNode primitiveChild = new ERXRestRequestNode(strKey, value, false); requestNode.addChild(primitiveChild); - delegate.nodeDidParse(primitiveChild); + if (delegate != null) { + delegate.nodeDidParse(primitiveChild); + } } else { requestNode.addChild(ERXJSONRestParser.createRequestNodeForJSON(strKey, (JSON) value, false, delegate)); @@ -57,7 +61,9 @@ throw new IllegalArgumentException("Unknown JSON value '" + json + "'."); } - delegate.nodeDidParse(requestNode); + if (delegate != null) { + delegate.nodeDidParse(requestNode); + } return requestNode; } Modified: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXJSONRestWriter.java =================================================================== --- branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXJSONRestWriter.java 2011-02-21 21:27:49 UTC (rev 11979) +++ branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXJSONRestWriter.java 2011-02-21 22:01:41 UTC (rev 11980) @@ -1,6 +1,5 @@ package er.rest.format; -import java.util.Enumeration; import java.util.Set; import net.sf.json.JSONSerializer; @@ -8,7 +7,6 @@ import net.sf.json.processors.JsonValueProcessor; import net.sf.json.processors.JsonValueProcessorMatcher; -import com.webobjects.foundation.NSArray; import com.webobjects.foundation.NSTimestamp; import er.rest.ERXRestRequestNode; @@ -44,22 +42,6 @@ } } - // MS: Totally debatable .... I may take this back out, but it makes things look prettier. - protected void removeDictionaryTypes(ERXRestRequestNode node) { - String type = node.type(); - if ("NSDictionary".equals(type) || "NSMutableDictionary".equals(type)) { - node.setType(null); - } - NSArray children = node.children(); - if (children != null) { - /*for (ERXRestRequestNode child : children) {*/ - for (Enumeration childEnum = children.objectEnumerator(); childEnum.hasMoreElements(); ) { - ERXRestRequestNode child = (ERXRestRequestNode)childEnum.nextElement(); - removeDictionaryTypes(child); - } - } - } - protected ERXRestRequestNode processNode(ERXRestRequestNode node) { return node; } @@ -70,7 +52,9 @@ public void appendToResponse(ERXRestRequestNode node, IERXRestResponse response, ERXRestFormat.Delegate delegate) { node = processNode(node); - removeDictionaryTypes(node); + if (node != null) { + node._removeRedundantTypes(); + } appendHeadersToResponse(node, response); Object object = node.toJavaCollection(delegate); Modified: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXPListRestParser.java =================================================================== --- branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXPListRestParser.java 2011-02-21 21:27:49 UTC (rev 11979) +++ branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXPListRestParser.java 2011-02-21 22:01:41 UTC (rev 11980) @@ -32,7 +32,9 @@ if (ERXRestUtils.isPrimitive(obj)) { ERXRestRequestNode primitiveChild = new ERXRestRequestNode(null, object, false); requestNode.addChild(primitiveChild); - delegate.nodeDidParse(primitiveChild); + if (delegate != null) { + delegate.nodeDidParse(primitiveChild); + } } else { requestNode.addChild(createRequestNodeForObject(null, obj, true, delegate)); @@ -48,7 +50,9 @@ if (ERXRestUtils.isPrimitive(obj)) { ERXRestRequestNode primitiveChild = new ERXRestRequestNode(null, object, false); requestNode.addChild(primitiveChild); - delegate.nodeDidParse(primitiveChild); + if (delegate != null) { + delegate.nodeDidParse(primitiveChild); + } } else { requestNode.addChild(createRequestNodeForObject(null, obj, true, delegate)); @@ -63,7 +67,9 @@ if (ERXRestUtils.isPrimitive(value)) { ERXRestRequestNode primitiveChild = new ERXRestRequestNode(strKey, value, false); requestNode.addChild(primitiveChild); - delegate.nodeDidParse(primitiveChild); + if (delegate != null) { + delegate.nodeDidParse(primitiveChild); + } } else { requestNode.addChild(createRequestNodeForObject(strKey, value, false, delegate)); @@ -80,7 +86,9 @@ if (ERXRestUtils.isPrimitive(value)) { ERXRestRequestNode primitiveChild = new ERXRestRequestNode(strKey, value, false); requestNode.addChild(primitiveChild); - delegate.nodeDidParse(primitiveChild); + if (delegate != null) { + delegate.nodeDidParse(primitiveChild); + } } else { requestNode.addChild(createRequestNodeForObject(strKey, value, false, delegate)); @@ -91,7 +99,9 @@ throw new IllegalArgumentException("Unknown PLIST value '" + object + "'."); } - delegate.nodeDidParse(requestNode); + if (delegate != null) { + delegate.nodeDidParse(requestNode); + } return requestNode; } Modified: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXPListRestWriter.java =================================================================== --- branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXPListRestWriter.java 2011-02-21 21:27:49 UTC (rev 11979) +++ branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXPListRestWriter.java 2011-02-21 22:01:41 UTC (rev 11980) @@ -10,6 +10,9 @@ } public void appendToResponse(ERXRestRequestNode node, IERXRestResponse response, ERXRestFormat.Delegate delegate) { + if (node != null) { + node._removeRedundantTypes(); + } appendHeadersToResponse(node, response); Object object = node.toNSCollection(delegate); response.appendContentString(NSPropertyListSerialization.stringFromPropertyList(object)); Modified: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXXmlRestWriter.java =================================================================== --- branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXXmlRestWriter.java 2011-02-21 21:27:49 UTC (rev 11979) +++ branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXXmlRestWriter.java 2011-02-21 22:01:41 UTC (rev 11980) @@ -4,7 +4,6 @@ import java.util.Enumeration; import java.util.Map; -import com.webobjects.foundation.NSDictionary; import com.webobjects.foundation.NSTimestamp; import er.extensions.foundation.ERXProperties; @@ -28,7 +27,9 @@ } protected void appendNodeToResponse(ERXRestRequestNode node, IERXRestResponse response, int indent, ERXRestFormat.Delegate delegate) { - delegate.nodeWillWrite(node); + if (delegate != null) { + delegate.nodeWillWrite(node); + } if (node.value() != null || node.isNull()) { appendValueToResponse(node, response, indent); } Modified: branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/routes/ERXRouteController.java =================================================================== --- branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/routes/ERXRouteController.java 2011-02-21 21:27:49 UTC (rev 11979) +++ branches/Wonder_2_0_0_WebObjects_5_4_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/routes/ERXRouteController.java 2011-02-21 22:01:41 UTC (rev 11980) @@ -465,6 +465,16 @@ } /** + * Returns the default format delegate to use for the given format (defaults to format.delegate()). + * + * @param format the format to lookup + * @return the delegate to use for this format + */ + protected ERXRestFormat.Delegate formatDelegateForFormat(ERXRestFormat format) { + return format.delegate(); + } + + /** * Returns the request data in the form of an ERXRestRequestNode (which is a format-independent wrapper around * hierarchical data). * @@ -478,7 +488,7 @@ if (parser == null) { throw new IllegalStateException("There is no parser for the format '" + format.name() + "'."); } - _requestNode = parser.parseRestRequest(new ERXWORestRequest(request()), format().delegate()); + _requestNode = parser.parseRestRequest(new ERXWORestRequest(request()), formatDelegateForFormat(format)); } catch (Throwable t) { throw new RuntimeException("Failed to parse a " + format() + " request.", t); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mschrag@us...> - 2011-02-21 21:27:55
|
Revision: 11979 http://wonder.svn.sourceforge.net/wonder/?rev=11979&view=rev Author: mschrag Date: 2011-02-21 21:27:49 +0000 (Mon, 21 Feb 2011) Log Message: ----------- * better handling of NSKVC.NullValue's (turns into a 'null' except in plist -- maybe a plist bug) * NSKVC.Null is now considered a primitive * format parser delegates can be null now * api to provide a custom format parser delegate per controller Modified Paths: -------------- branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/ERXRestRequestNode.java branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/ERXRestUtils.java branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXJSONRestParser.java branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXJSONRestWriter.java branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXPListRestParser.java branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXPListRestWriter.java branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXXmlRestWriter.java branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/routes/ERXRouteController.java Modified: branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/ERXRestRequestNode.java =================================================================== --- branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/ERXRestRequestNode.java 2011-02-21 21:08:19 UTC (rev 11978) +++ branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/ERXRestRequestNode.java 2011-02-21 21:27:49 UTC (rev 11979) @@ -558,7 +558,12 @@ * the value for this node */ public void setValue(Object value) { - _value = value; + if (value instanceof NSKeyValueCoding.Null) { + _value = null; + } + else { + _value = value; + } guessNull(); } @@ -913,8 +918,14 @@ } } else if (ERXRestUtils.isPrimitive(obj)) { - setValue(obj); - setAssociatedObject(obj); + if (obj instanceof NSKeyValueCoding.Null) { + setValue(null); + setAssociatedObject(null); + } + else { + setValue(obj); + setAssociatedObject(obj); + } } else { // in case we have a superclass class description passed in @@ -1223,6 +1234,22 @@ } } + // MS: Totally debatable .... I may take this back out, but it makes things look prettier. + public void _removeRedundantTypes() { + String type = type(); + if ("NSDictionary".equals(type) || "NSMutableDictionary".equals(type)) { + setType(null); + } + NSArray children = children(); + if (children != null) { + /*for (ERXRestRequestNode child : children) {*/ + for (Enumeration childEnum = children.objectEnumerator(); childEnum.hasMoreElements(); ) { + ERXRestRequestNode child = (ERXRestRequestNode)childEnum.nextElement(); + child._removeRedundantTypes(); + } + } + } + /** * Creates a hierarchy of ERXRestRequestNodes based off of the given array of objects. * Modified: branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/ERXRestUtils.java =================================================================== --- branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/ERXRestUtils.java 2011-02-21 21:08:19 UTC (rev 11978) +++ branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/ERXRestUtils.java 2011-02-21 21:27:49 UTC (rev 11979) @@ -80,6 +80,9 @@ else if (Enum.class.isAssignableFrom(valueType)) { primitive = true; } + else if (NSKeyValueCoding.Null.class.isAssignableFrom(valueType)) { + primitive = true; + } return primitive; } Modified: branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXJSONRestParser.java =================================================================== --- branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXJSONRestParser.java 2011-02-21 21:08:19 UTC (rev 11978) +++ branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXJSONRestParser.java 2011-02-21 21:27:49 UTC (rev 11979) @@ -31,7 +31,9 @@ if (ERXRestUtils.isPrimitive(obj)) { ERXRestRequestNode primitiveChild = new ERXRestRequestNode(null, obj, false); requestNode.addChild(primitiveChild); - delegate.nodeDidParse(primitiveChild); + if (delegate != null) { + delegate.nodeDidParse(primitiveChild); + } } else { requestNode.addChild(ERXJSONRestParser.createRequestNodeForJSON(null, (JSON) obj, true, delegate)); @@ -46,7 +48,9 @@ if (ERXRestUtils.isPrimitive(value)) { ERXRestRequestNode primitiveChild = new ERXRestRequestNode(strKey, value, false); requestNode.addChild(primitiveChild); - delegate.nodeDidParse(primitiveChild); + if (delegate != null) { + delegate.nodeDidParse(primitiveChild); + } } else { requestNode.addChild(ERXJSONRestParser.createRequestNodeForJSON(strKey, (JSON) value, false, delegate)); @@ -57,7 +61,9 @@ throw new IllegalArgumentException("Unknown JSON value '" + json + "'."); } - delegate.nodeDidParse(requestNode); + if (delegate != null) { + delegate.nodeDidParse(requestNode); + } return requestNode; } Modified: branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXJSONRestWriter.java =================================================================== --- branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXJSONRestWriter.java 2011-02-21 21:08:19 UTC (rev 11978) +++ branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXJSONRestWriter.java 2011-02-21 21:27:49 UTC (rev 11979) @@ -1,6 +1,5 @@ package er.rest.format; -import java.util.Enumeration; import java.util.Set; import net.sf.json.JSONSerializer; @@ -8,7 +7,6 @@ import net.sf.json.processors.JsonValueProcessor; import net.sf.json.processors.JsonValueProcessorMatcher; -import com.webobjects.foundation.NSArray; import com.webobjects.foundation.NSTimestamp; import er.rest.ERXRestRequestNode; @@ -44,22 +42,6 @@ } } - // MS: Totally debatable .... I may take this back out, but it makes things look prettier. - protected void removeDictionaryTypes(ERXRestRequestNode node) { - String type = node.type(); - if ("NSDictionary".equals(type) || "NSMutableDictionary".equals(type)) { - node.setType(null); - } - NSArray children = node.children(); - if (children != null) { - /*for (ERXRestRequestNode child : children) {*/ - for (Enumeration childEnum = children.objectEnumerator(); childEnum.hasMoreElements(); ) { - ERXRestRequestNode child = (ERXRestRequestNode)childEnum.nextElement(); - removeDictionaryTypes(child); - } - } - } - protected ERXRestRequestNode processNode(ERXRestRequestNode node) { return node; } @@ -70,7 +52,9 @@ public void appendToResponse(ERXRestRequestNode node, IERXRestResponse response, ERXRestFormat.Delegate delegate) { node = processNode(node); - removeDictionaryTypes(node); + if (node != null) { + node._removeRedundantTypes(); + } appendHeadersToResponse(node, response); Object object = node.toJavaCollection(delegate); Modified: branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXPListRestParser.java =================================================================== --- branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXPListRestParser.java 2011-02-21 21:08:19 UTC (rev 11978) +++ branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXPListRestParser.java 2011-02-21 21:27:49 UTC (rev 11979) @@ -32,7 +32,9 @@ if (ERXRestUtils.isPrimitive(obj)) { ERXRestRequestNode primitiveChild = new ERXRestRequestNode(null, object, false); requestNode.addChild(primitiveChild); - delegate.nodeDidParse(primitiveChild); + if (delegate != null) { + delegate.nodeDidParse(primitiveChild); + } } else { requestNode.addChild(createRequestNodeForObject(null, obj, true, delegate)); @@ -48,7 +50,9 @@ if (ERXRestUtils.isPrimitive(obj)) { ERXRestRequestNode primitiveChild = new ERXRestRequestNode(null, object, false); requestNode.addChild(primitiveChild); - delegate.nodeDidParse(primitiveChild); + if (delegate != null) { + delegate.nodeDidParse(primitiveChild); + } } else { requestNode.addChild(createRequestNodeForObject(null, obj, true, delegate)); @@ -63,7 +67,9 @@ if (ERXRestUtils.isPrimitive(value)) { ERXRestRequestNode primitiveChild = new ERXRestRequestNode(strKey, value, false); requestNode.addChild(primitiveChild); - delegate.nodeDidParse(primitiveChild); + if (delegate != null) { + delegate.nodeDidParse(primitiveChild); + } } else { requestNode.addChild(createRequestNodeForObject(strKey, value, false, delegate)); @@ -80,7 +86,9 @@ if (ERXRestUtils.isPrimitive(value)) { ERXRestRequestNode primitiveChild = new ERXRestRequestNode(strKey, value, false); requestNode.addChild(primitiveChild); - delegate.nodeDidParse(primitiveChild); + if (delegate != null) { + delegate.nodeDidParse(primitiveChild); + } } else { requestNode.addChild(createRequestNodeForObject(strKey, value, false, delegate)); @@ -91,7 +99,9 @@ throw new IllegalArgumentException("Unknown PLIST value '" + object + "'."); } - delegate.nodeDidParse(requestNode); + if (delegate != null) { + delegate.nodeDidParse(requestNode); + } return requestNode; } Modified: branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXPListRestWriter.java =================================================================== --- branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXPListRestWriter.java 2011-02-21 21:08:19 UTC (rev 11978) +++ branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXPListRestWriter.java 2011-02-21 21:27:49 UTC (rev 11979) @@ -10,6 +10,9 @@ } public void appendToResponse(ERXRestRequestNode node, IERXRestResponse response, ERXRestFormat.Delegate delegate) { + if (node != null) { + node._removeRedundantTypes(); + } appendHeadersToResponse(node, response); Object object = node.toNSCollection(delegate); response.appendContentString(NSPropertyListSerialization.stringFromPropertyList(object)); Modified: branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXXmlRestWriter.java =================================================================== --- branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXXmlRestWriter.java 2011-02-21 21:08:19 UTC (rev 11978) +++ branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/format/ERXXmlRestWriter.java 2011-02-21 21:27:49 UTC (rev 11979) @@ -4,7 +4,6 @@ import java.util.Enumeration; import java.util.Map; -import com.webobjects.foundation.NSDictionary; import com.webobjects.foundation.NSTimestamp; import er.extensions.foundation.ERXProperties; @@ -28,7 +27,9 @@ } protected void appendNodeToResponse(ERXRestRequestNode node, IERXRestResponse response, int indent, ERXRestFormat.Delegate delegate) { - delegate.nodeWillWrite(node); + if (delegate != null) { + delegate.nodeWillWrite(node); + } if (node.value() != null || node.isNull()) { appendValueToResponse(node, response, indent); } Modified: branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/routes/ERXRouteController.java =================================================================== --- branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/routes/ERXRouteController.java 2011-02-21 21:08:19 UTC (rev 11978) +++ branches/Wonder_2_0_0_Branch/Wonder/Frameworks/EOF/ERRest/Sources/er/rest/routes/ERXRouteController.java 2011-02-21 21:27:49 UTC (rev 11979) @@ -465,6 +465,16 @@ } /** + * Returns the default format delegate to use for the given format (defaults to format.delegate()). + * + * @param format the format to lookup + * @return the delegate to use for this format + */ + protected ERXRestFormat.Delegate formatDelegateForFormat(ERXRestFormat format) { + return format.delegate(); + } + + /** * Returns the request data in the form of an ERXRestRequestNode (which is a format-independent wrapper around * hierarchical data). * @@ -478,7 +488,7 @@ if (parser == null) { throw new IllegalStateException("There is no parser for the format '" + format.name() + "'."); } - _requestNode = parser.parseRestRequest(new ERXWORestRequest(request()), format().delegate()); + _requestNode = parser.parseRestRequest(new ERXWORestRequest(request()), formatDelegateForFormat(format)); } catch (Throwable t) { throw new RuntimeException("Failed to parse a " + format() + " request.", t); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |