cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r419093 [1/8] - in /incubator/cayenne/examples/trunk/cayenne-petstore: ./ devlib/ dist/ lib/ src/ src/org/ src/org/objectstyle/ src/org/objectstyle/petstore/ src/org/objectstyle/petstore/dao/ src/org/objectstyle/petstore/dao/impl/ src/org/o...
Date Tue, 04 Jul 2006 20:47:15 GMT
Author: aadamchik
Date: Tue Jul  4 13:47:09 2006
New Revision: 419093

URL: http://svn.apache.org/viewvc?rev=419093&view=rev
Log:
checking in some examples already shown on Wiki, that are not intended for official release.

Added:
    incubator/cayenne/examples/trunk/cayenne-petstore/.classpath
    incubator/cayenne/examples/trunk/cayenne-petstore/.cvsignore
    incubator/cayenne/examples/trunk/cayenne-petstore/.project
    incubator/cayenne/examples/trunk/cayenne-petstore/README.txt   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/build.xml
    incubator/cayenne/examples/trunk/cayenne-petstore/devlib/
    incubator/cayenne/examples/trunk/cayenne-petstore/devlib/servlet.jar   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/dist/
    incubator/cayenne/examples/trunk/cayenne-petstore/dist/cayenne-petstore.war   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/lib/
    incubator/cayenne/examples/trunk/cayenne-petstore/lib/antlr.jar   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/lib/beanaction.jar   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/lib/cayenne-1.2RC2.jar   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-beanutils.jar   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-digester.jar   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-fileupload.jar   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-logging.jar   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-validator.jar   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/lib/derby-10.2.1.0.jar   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/lib/ibatis-common-2.jar   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/lib/jakarta-oro.jar   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/lib/struts.jar   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/src/
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/ConfigFilter.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/DBSetupHelper.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/AccountDao.java   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/DaoManager.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/ItemDao.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/OrderDao.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/PersistenceManager.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/ProductDao.java   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/AccountCayenneDao.java   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/CayenneDao.java   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/CayennePersistenceManager.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/ItemCayenneDao.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/OrderCayenneDao.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/ProductCayenneDao.java   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Account.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/BannerData.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Cart.java   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/CartItem.java   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Category.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Inventory.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Item.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/LineItem.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Order.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/OrderStatus.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Product.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Profile.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Supplier.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/User.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Account.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_BannerData.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Category.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Inventory.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Item.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_LineItem.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Order.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_OrderStatus.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Product.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Profile.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Supplier.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_User.java
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/presentation/
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/presentation/AbstractBean.java   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/presentation/AccountBean.java   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/presentation/CartBean.java   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/presentation/CatalogBean.java   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/presentation/OrderBean.java   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/service/
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/service/AccountService.java   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/service/CatalogService.java   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/service/OrderService.java   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/src/properties/
    incubator/cayenne/examples/trunk/cayenne-petstore/src/properties/derby.properties
    incubator/cayenne/examples/trunk/cayenne-petstore/src/properties/messages.properties   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/
    incubator/cayenne/examples/trunk/cayenne-petstore/web/WEB-INF/
    incubator/cayenne/examples/trunk/cayenne-petstore/web/WEB-INF/cayenne.xml
    incubator/cayenne/examples/trunk/cayenne-petstore/web/WEB-INF/licenses/
    incubator/cayenne/examples/trunk/cayenne-petstore/web/WEB-INF/licenses/LICENSE.apache.txt   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/WEB-INF/petstore-dataload.sql   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/WEB-INF/petstore.driver.xml
    incubator/cayenne/examples/trunk/cayenne-petstore/web/WEB-INF/petstore.map.xml
    incubator/cayenne/examples/trunk/cayenne-petstore/web/WEB-INF/struts-config.xml   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/WEB-INF/tld/
    incubator/cayenne/examples/trunk/cayenne-petstore/web/WEB-INF/tld/struts-bean.tld   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/WEB-INF/tld/struts-html.tld   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/WEB-INF/tld/struts-logic.tld   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/WEB-INF/tld/struts-nested.tld   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/WEB-INF/tld/struts-tiles.tld   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/WEB-INF/validation.xml   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/WEB-INF/validator-rules.xml   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/WEB-INF/web.xml   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/account/
    incubator/cayenne/examples/trunk/cayenne-petstore/web/account/EditAccountForm.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/account/IncludeAccountFields.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/account/NewAccountForm.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/account/SignonForm.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/cart/
    incubator/cayenne/examples/trunk/cayenne-petstore/web/cart/Cart.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/cart/Checkout.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/cart/IncludeMyList.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/catalog/
    incubator/cayenne/examples/trunk/cayenne-petstore/web/catalog/Category.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/catalog/Item.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/catalog/Main.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/catalog/Product.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/catalog/SearchProducts.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/common/
    incubator/cayenne/examples/trunk/cayenne-petstore/web/common/Error.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/common/IncludeBottom.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/common/IncludeTop.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/css/
    incubator/cayenne/examples/trunk/cayenne-petstore/web/css/jpetstore.css   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/help.html   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/banner_birds.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/banner_cats.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/banner_dogs.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/banner_fish.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/banner_reptiles.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/bird1.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/bird2.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/birds_icon.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/cart.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/cat1.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/cat2.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/cats_icon.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/dog1.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/dog2.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/dog3.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/dog4.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/dog5.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/dog6.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/dogs.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/dogs_icon.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/fish.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/fish1.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/fish2.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/fish3.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/fish4.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/fish_icon.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/lizard1.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/logo-topbar.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/poweredby.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/reptiles_icon.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/separator.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/sm_birds.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/sm_cats.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/sm_dogs.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/sm_fish.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/sm_reptiles.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/snake1.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/images/splash.gif   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/index.html   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/order/
    incubator/cayenne/examples/trunk/cayenne-petstore/web/order/ConfirmOrder.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/order/ListOrders.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/order/NewOrderForm.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/order/ShippingForm.jsp   (with props)
    incubator/cayenne/examples/trunk/cayenne-petstore/web/order/ViewOrder.jsp   (with props)

Added: incubator/cayenne/examples/trunk/cayenne-petstore/.classpath
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/.classpath?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/.classpath (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/.classpath Tue Jul  4 13:47:09 2006
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="lib" path="lib/struts.jar"/>
+	<classpathentry kind="lib" path="lib/jakarta-oro.jar"/>
+	<classpathentry kind="lib" path="lib/commons-validator.jar"/>
+	<classpathentry kind="lib" path="lib/commons-logging.jar"/>
+	<classpathentry kind="lib" path="lib/commons-fileupload.jar"/>
+	<classpathentry kind="lib" path="lib/commons-digester.jar"/>
+	<classpathentry kind="lib" path="lib/commons-beanutils.jar"/>
+	<classpathentry kind="lib" path="lib/beanaction.jar"/>
+	<classpathentry kind="lib" path="lib/antlr.jar"/>
+	<classpathentry kind="lib" path="devlib/servlet.jar"/>
+	<classpathentry kind="lib" path="lib/ibatis-common-2.jar"/>
+	<classpathentry kind="lib" path="lib/derby-10.2.1.0.jar"/>
+	<classpathentry kind="lib" path="lib/cayenne-1.2RC2.jar"/>
+	<classpathentry kind="output" path="bin/eclipse"/>
+</classpath>

Added: incubator/cayenne/examples/trunk/cayenne-petstore/.cvsignore
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/.cvsignore?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/.cvsignore (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/.cvsignore Tue Jul  4 13:47:09 2006
@@ -0,0 +1,3 @@
+petstoredb
+dist
+bin

Added: incubator/cayenne/examples/trunk/cayenne-petstore/.project
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/.project?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/.project (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/.project Tue Jul  4 13:47:09 2006
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>cayenne-petstore</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: incubator/cayenne/examples/trunk/cayenne-petstore/README.txt
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/README.txt?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/README.txt (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/README.txt Tue Jul  4 13:47:09 2006
@@ -0,0 +1,33 @@
+Cayenne/Struts PetStore
+=======================
+(distributed under Apache license, version 2.0)
+
+
+DESCRIPTION
+
+"cayenne-petstore" is a classic Petstore Java application implemented with Cayenne and Struts.
+By default application uses embedded Apache Derby database. 
+
+It was ported from iBatis JPetstore-5.0 application by replacing iBatis with Cayenne. In its 
+current reincarnation the application works but is not very polished. We demonstrated that 
+porting to Cayenne is easy, even given the unfriendly DB design, however if we were to 
+design the petstore from scratch, we would've done it differently in some aspects.
+
+
+DEPLOYING
+
+Just drop "dist/cayenne-petstore.war" in your favorite web container. 
+
+Note that by default Derby (db engine used by cayenne-petstore) will attempt to 
+create a database in the JVM "java.io.tmpdir" (whatever that is from the web container perspective;
+Tomcat puts the database in $CATALINA_HOME/temp/). If you want a different location, unpack the war 
+file and edit "WEB-INF/classes/derby.properties" setting "derby.system.home" to an absolute path.
+
+If you want a different database alltogether, open "WEB-INF/cayenne.xml" file in 
+CayenneModeler and do the needed changes (of course you can do them by hand as well).
+
+
+INSPECTING SOURCE CODE
+
+Petstore is a valid Eclispe project, just import it in Eclipse and do anything you want 
+with it.
\ No newline at end of file

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/README.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cayenne/examples/trunk/cayenne-petstore/build.xml
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/build.xml?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/build.xml (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/build.xml Tue Jul  4 13:47:09 2006
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+ 
+<!-- ================================================= -->
+<!--            Cayenne Petstore build file.           -->
+<!-- ================================================= -->
+<project name="cayenne-petstore" default="war">
+	
+	<property name="dist" value="dist"/>
+	<property name="build" value="bin/ant"/>
+	
+	<path id="classpath">
+		<fileset dir="lib" includes="*.jar"/>
+		<fileset dir="devlib" includes="*.jar"/>
+	</path>
+	
+	<target name="war" depends="compile">
+		<mkdir dir="${dist}"/>
+		<war destfile="${dist}/cayenne-petstore.war" webxml="web/WEB-INF/web.xml">
+			<fileset dir="web" excludes="WEB-INF/web.xml"/>
+			<lib dir="lib"/>
+			
+			<classes dir="src" excludes="**/*.java"/>
+			<classes dir="${build}"/>
+		</war>
+	</target>
+	
+	<target name="compile">
+		<mkdir dir="${build}"/>
+		
+		<javac srcdir="src" destdir="${build}" classpathref="classpath"
+			source="1.4"/>
+	</target>
+	
+	<target name="clean">
+		<delete dir="${build}"/>
+		<delete dir="${dist}"/>
+	</target>
+</project>

Added: incubator/cayenne/examples/trunk/cayenne-petstore/devlib/servlet.jar
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/devlib/servlet.jar?rev=419093&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/devlib/servlet.jar
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/devlib/servlet.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/cayenne/examples/trunk/cayenne-petstore/dist/cayenne-petstore.war
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/dist/cayenne-petstore.war?rev=419093&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/dist/cayenne-petstore.war
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/cayenne/examples/trunk/cayenne-petstore/lib/antlr.jar
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/lib/antlr.jar?rev=419093&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/antlr.jar
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/antlr.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/cayenne/examples/trunk/cayenne-petstore/lib/beanaction.jar
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/lib/beanaction.jar?rev=419093&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/beanaction.jar
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/beanaction.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/cayenne/examples/trunk/cayenne-petstore/lib/cayenne-1.2RC2.jar
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/lib/cayenne-1.2RC2.jar?rev=419093&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/cayenne-1.2RC2.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-beanutils.jar
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-beanutils.jar?rev=419093&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-beanutils.jar
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-beanutils.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-digester.jar
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-digester.jar?rev=419093&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-digester.jar
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-digester.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-fileupload.jar
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-fileupload.jar?rev=419093&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-fileupload.jar
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-fileupload.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-logging.jar
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-logging.jar?rev=419093&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-logging.jar
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-logging.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-validator.jar
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-validator.jar?rev=419093&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-validator.jar
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/commons-validator.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/cayenne/examples/trunk/cayenne-petstore/lib/derby-10.2.1.0.jar
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/lib/derby-10.2.1.0.jar?rev=419093&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/derby-10.2.1.0.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/cayenne/examples/trunk/cayenne-petstore/lib/ibatis-common-2.jar
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/lib/ibatis-common-2.jar?rev=419093&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/ibatis-common-2.jar
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/ibatis-common-2.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/cayenne/examples/trunk/cayenne-petstore/lib/jakarta-oro.jar
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/lib/jakarta-oro.jar?rev=419093&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/jakarta-oro.jar
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/jakarta-oro.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/cayenne/examples/trunk/cayenne-petstore/lib/struts.jar
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/lib/struts.jar?rev=419093&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/struts.jar
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/lib/struts.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/ConfigFilter.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/ConfigFilter.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/ConfigFilter.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/ConfigFilter.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,91 @@
+package org.objectstyle.petstore;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+
+import org.objectstyle.cayenne.conf.Configuration;
+import org.objectstyle.cayenne.conf.WebApplicationContextFilter;
+import org.objectstyle.petstore.dao.AccountDao;
+import org.objectstyle.petstore.dao.DaoManager;
+import org.objectstyle.petstore.dao.ItemDao;
+import org.objectstyle.petstore.dao.OrderDao;
+import org.objectstyle.petstore.dao.PersistenceManager;
+import org.objectstyle.petstore.dao.ProductDao;
+import org.objectstyle.petstore.dao.impl.AccountCayenneDao;
+import org.objectstyle.petstore.dao.impl.CayennePersistenceManager;
+import org.objectstyle.petstore.dao.impl.ItemCayenneDao;
+import org.objectstyle.petstore.dao.impl.OrderCayenneDao;
+import org.objectstyle.petstore.dao.impl.ProductCayenneDao;
+
+/**
+ * A servlet filter that performs initial configuraion later makes sure a DataContext is
+ * bound to each request thread. Startup configurion includes configuring DAOs, setting up
+ * an embedded database, and sets up Cayenne.
+ * 
+ * @author Andrus Adamchik
+ */
+public class ConfigFilter extends WebApplicationContextFilter {
+
+    static final String DERBY_SYSTEM_PROPERTY = "derby.system.home";
+
+    public synchronized void init(FilterConfig config) throws ServletException {
+
+        prepareDerby();
+
+        // this will init Cayenne
+        super.init(config);
+
+        new DBSetupHelper(config.getServletContext(), Configuration
+                .getSharedConfiguration()
+                .getDomain()).setupDatabase();
+
+        setupDao();
+    }
+
+    protected void prepareDerby() throws ServletException {
+        InputStream in = Thread
+                .currentThread()
+                .getContextClassLoader()
+                .getResourceAsStream("properties/derby.properties");
+        if (in != null) {
+            Properties props = new Properties();
+            
+            try {
+                props.load(in);
+            }
+            catch (IOException e) {
+                throw new ServletException("Error reading properties", e);
+            }
+
+            System.getProperties().putAll(props);
+        }
+
+        // setup Derby home to be Java TMP directory if not set explicitly
+
+        if (System.getProperty(DERBY_SYSTEM_PROPERTY) == null) {
+            System.setProperty(DERBY_SYSTEM_PROPERTY, System
+                    .getProperty("java.io.tmpdir"));
+        }
+
+    }
+
+    protected void setupDao() {
+
+        // some prefer XML to configure stuff...IMO Java is just as good.
+
+        Map daoMapping = new HashMap();
+        daoMapping.put(AccountDao.class, new AccountCayenneDao());
+        daoMapping.put(ItemDao.class, new ItemCayenneDao());
+        daoMapping.put(OrderDao.class, new OrderCayenneDao());
+        daoMapping.put(PersistenceManager.class, new CayennePersistenceManager());
+        daoMapping.put(ProductDao.class, new ProductCayenneDao());
+
+        DaoManager.setManager(new DaoManager(daoMapping));
+    }
+}

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/DBSetupHelper.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/DBSetupHelper.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/DBSetupHelper.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/DBSetupHelper.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,123 @@
+package org.objectstyle.petstore;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import org.objectstyle.cayenne.access.DataContext;
+import org.objectstyle.cayenne.access.DataDomain;
+import org.objectstyle.cayenne.access.DataNode;
+import org.objectstyle.cayenne.access.DbGenerator;
+import org.objectstyle.cayenne.map.DataMap;
+import org.objectstyle.cayenne.query.QueryChain;
+import org.objectstyle.cayenne.query.SQLTemplate;
+import org.objectstyle.petstore.domain.Account;
+
+/**
+ * Helper class to init test DB.
+ * 
+ * @author Andrus Adamchik
+ */
+class DBSetupHelper {
+
+    static final String TEST_DATA = "/WEB-INF/petstore-dataload.sql";
+
+    ServletContext context;
+    DataDomain domain;
+
+    DBSetupHelper(ServletContext context, DataDomain domain) {
+        this.context = context;
+        this.domain = domain;
+    }
+
+    void setupDatabase() throws ServletException {
+        if (checkDBSetupNeeded()) {
+            setupDemoSchema();
+
+            InputStream in = context.getResourceAsStream(TEST_DATA);
+            if (in == null) {
+                throw new ServletException("Can't find  resource " + TEST_DATA);
+            }
+
+            setupDemoData(in);
+        }
+    }
+
+    private DataNode getDataNode() {
+        return domain.lookupDataNode(getDataMap());
+    }
+
+    private DataMap getDataMap() {
+        return domain.getEntityResolver().lookupObjEntity(Account.class).getDataMap();
+    }
+
+    /**
+     * Runs a test query to see if a schema is initialized.
+     */
+    private boolean checkDBSetupNeeded() {
+        try {
+            DataContext.createDataContext().performNonSelectingQuery("schemaCheck");
+            return false;
+        }
+        catch (Throwable th) {
+            return true;
+        }
+    }
+
+    private void setupDemoSchema() throws ServletException {
+        DataNode node = getDataNode();
+        DbGenerator generator = new DbGenerator(node.getAdapter(), getDataMap());
+        try {
+            generator.runGenerator(node.getDataSource());
+        }
+        catch (Exception e) {
+            throw new ServletException("Error generating DB schema", e);
+        }
+    }
+
+    private void setupDemoData(InputStream sql) throws ServletException {
+
+        DataMap map = getDataMap();
+
+        // TODO: Andrus, 01/08/2006 - move code that loads SQL from file to QueryChain or
+        // some other Cayenne utilities class.
+        QueryChain chain = new QueryChain();
+        BufferedReader reader = new BufferedReader(new InputStreamReader(sql));
+        String line;
+        try {
+            while ((line = reader.readLine()) != null) {
+                line = line.trim();
+
+                if (line.length() == 0) {
+                    continue;
+                }
+
+                if (line.endsWith(";")) {
+                    line = line.substring(0, line.length() - 1);
+                }
+
+                chain.addQuery(new SQLTemplate(map, line));
+            }
+        }
+        catch (IOException e) {
+            throw new ServletException("Error reading " + TEST_DATA);
+        }
+        finally {
+            try {
+                reader.close();
+            }
+            catch (IOException e) {
+
+            }
+        }
+
+        if (!chain.isEmpty()) {
+            DataContext cayenneContext = DataContext.createDataContext();
+            cayenneContext.performNonSelectingQuery(chain);
+        }
+    }
+}

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/AccountDao.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/AccountDao.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/AccountDao.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/AccountDao.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,10 @@
+package org.objectstyle.petstore.dao;
+
+import org.objectstyle.petstore.domain.Account;
+
+public interface AccountDao {
+
+    Account getAccount(String username);
+
+    Account getAccount(String username, String password);
+}

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/AccountDao.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/DaoManager.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/DaoManager.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/DaoManager.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/DaoManager.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,44 @@
+package org.objectstyle.petstore.dao;
+
+import java.util.Map;
+
+/**
+ * A singleton storage of DAO's.
+ * 
+ * @author Andrus Adamchik
+ */
+public class DaoManager {
+
+    static DaoManager manager;
+
+    protected Map daosByType;
+
+    public static DaoManager getManager() {
+        return manager;
+    }
+
+    public static void setManager(DaoManager manager) {
+        DaoManager.manager = manager;
+    }
+
+    public DaoManager(Map daosByType) {
+        this.daosByType = daosByType;
+    }
+
+    /**
+     * Returns a DAO instance registered for a given type.
+     */
+    public Object getDao(Class daoType) {
+        Object dao = daosByType.get(daoType);
+
+        if (dao == null) {
+            throw new IllegalStateException("No DAO registered for " + daoType);
+        }
+
+        if (!(daoType.isAssignableFrom(dao.getClass()))) {
+            throw new IllegalStateException("Invalid DAO type registered for " + daoType);
+        }
+
+        return dao;
+    }
+}

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/ItemDao.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/ItemDao.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/ItemDao.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/ItemDao.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,15 @@
+package org.objectstyle.petstore.dao;
+
+import org.objectstyle.petstore.domain.Product;
+
+import com.ibatis.common.util.PaginatedList;
+
+public interface ItemDao {
+
+    /**
+     * Checking whether item is in stock is done via DAO to ensure that no caching occurs.
+     */
+    boolean isItemInStock(String itemId);
+    
+    PaginatedList getItemListByProduct(Product product);
+}

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/OrderDao.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/OrderDao.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/OrderDao.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/OrderDao.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,10 @@
+package org.objectstyle.petstore.dao;
+
+import org.objectstyle.petstore.domain.Account;
+
+import com.ibatis.common.util.PaginatedList;
+
+public interface OrderDao {
+
+    PaginatedList getOrdersByAccount(Account account);
+}

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/PersistenceManager.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/PersistenceManager.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/PersistenceManager.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/PersistenceManager.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,14 @@
+package org.objectstyle.petstore.dao;
+
+import java.util.List;
+
+public interface PersistenceManager {
+
+    void persistObject(Object object);
+
+    Object findObject(Class objectClass, Object pk);
+
+    List getAllObjects(Class objectClass);
+
+    void commitChanges();
+}

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/ProductDao.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/ProductDao.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/ProductDao.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/ProductDao.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,12 @@
+package org.objectstyle.petstore.dao;
+
+import org.objectstyle.petstore.domain.Category;
+
+import com.ibatis.common.util.PaginatedList;
+
+public interface ProductDao {
+
+    PaginatedList searchProductList(String keywords);
+
+    PaginatedList getProductListByCategory(Category category);
+}

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/ProductDao.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/AccountCayenneDao.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/AccountCayenneDao.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/AccountCayenneDao.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/AccountCayenneDao.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,23 @@
+package org.objectstyle.petstore.dao.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.objectstyle.petstore.dao.AccountDao;
+import org.objectstyle.petstore.domain.Account;
+
+public class AccountCayenneDao extends CayenneDao implements AccountDao {
+
+    public Account getAccount(String username) {
+        Map parameters = new HashMap();
+        parameters.put("userName", username);
+        return (Account) findObject("getAccount", parameters);
+    }
+
+    public Account getAccount(String username, String password) {
+        Map parameters = new HashMap();
+        parameters.put("userName", username);
+        parameters.put("password", password);
+        return (Account) findObject("getAccount", parameters);
+    }
+}

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/AccountCayenneDao.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/CayenneDao.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/CayenneDao.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/CayenneDao.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/CayenneDao.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,42 @@
+package org.objectstyle.petstore.dao.impl;
+
+import java.util.List;
+import java.util.Map;
+
+import org.objectstyle.cayenne.DataObjectUtils;
+import org.objectstyle.cayenne.access.DataContext;
+import org.objectstyle.cayenne.query.ParameterizedQuery;
+
+/**
+ * @author Andrus Adamchik
+ */
+public abstract class CayenneDao {
+
+    protected static final int PAGE_SIZE = 4;
+
+    /**
+     * Returns thread-bound DataContext.
+     */
+    protected DataContext getDataContext() {
+        return DataContext.getThreadDataContext();
+    }
+
+    /**
+     * Fetches a single object matching a named query and a set of parameters.
+     */
+    protected Object findObject(String queryName, Map parameters) {
+        DataContext context = getDataContext();
+        ParameterizedQuery q = (ParameterizedQuery) context
+                .getEntityResolver()
+                .lookupQuery(queryName);
+
+        return DataObjectUtils.objectForQuery(context, q.createQuery(parameters));
+    }
+
+    /**
+     * Returns a list of objects for the named query.
+     */
+    protected List findObjects(String queryName, Map parameters) {
+        return getDataContext().performQuery(queryName, parameters, false);
+    }
+}

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/CayenneDao.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/CayennePersistenceManager.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/CayennePersistenceManager.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/CayennePersistenceManager.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/CayennePersistenceManager.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,35 @@
+package org.objectstyle.petstore.dao.impl;
+
+import java.util.List;
+
+import org.objectstyle.cayenne.DataObject;
+import org.objectstyle.cayenne.DataObjectUtils;
+import org.objectstyle.cayenne.query.SelectQuery;
+import org.objectstyle.petstore.dao.PersistenceManager;
+
+public class CayennePersistenceManager extends CayenneDao implements PersistenceManager {
+
+    public void persistObject(Object object) {
+        if (!(object instanceof DataObject)) {
+            throw new IllegalArgumentException("Expected DataObject, got: " + object);
+        }
+
+        getDataContext().registerNewObject((DataObject) object);
+    }
+
+    public Object findObject(Class objectClass, Object pk) {
+        if (pk == null) {
+            return null;
+        }
+        
+        return DataObjectUtils.objectForPK(getDataContext(), objectClass, pk);
+    }
+
+    public List getAllObjects(Class objectClass) {
+        return getDataContext().performQuery(new SelectQuery(objectClass));
+    }
+
+    public void commitChanges() {
+        getDataContext().commitChanges();
+    }
+}

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/ItemCayenneDao.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/ItemCayenneDao.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/ItemCayenneDao.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/ItemCayenneDao.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,32 @@
+package org.objectstyle.petstore.dao.impl;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.objectstyle.petstore.dao.ItemDao;
+import org.objectstyle.petstore.domain.Product;
+
+import com.ibatis.common.util.PaginatedArrayList;
+import com.ibatis.common.util.PaginatedList;
+
+public class ItemCayenneDao extends CayenneDao implements ItemDao {
+
+    public boolean isItemInStock(String itemId) {
+        Map params = Collections.singletonMap("itemId", itemId);
+        List results = getDataContext()
+                .performQuery("getInventoryQuantity", params, true);
+
+        if (results.size() == 0) {
+            return false;
+        }
+
+        Map row = (Map) results.get(0);
+        Number quantity = (Number) row.get("quantity");
+        return quantity != null && quantity.intValue() > 0;
+    }
+
+    public PaginatedList getItemListByProduct(Product product) {
+        return new PaginatedArrayList(product.getItems(), PAGE_SIZE);
+    }
+}

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/OrderCayenneDao.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/OrderCayenneDao.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/OrderCayenneDao.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/OrderCayenneDao.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,14 @@
+package org.objectstyle.petstore.dao.impl;
+
+import org.objectstyle.petstore.dao.OrderDao;
+import org.objectstyle.petstore.domain.Account;
+
+import com.ibatis.common.util.PaginatedArrayList;
+import com.ibatis.common.util.PaginatedList;
+
+public class OrderCayenneDao extends CayenneDao implements OrderDao {
+
+    public PaginatedList getOrdersByAccount(Account account) {
+        return new PaginatedArrayList(account.getOrders(), PAGE_SIZE);
+    }
+}

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/ProductCayenneDao.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/ProductCayenneDao.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/ProductCayenneDao.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/ProductCayenneDao.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,72 @@
+package org.objectstyle.petstore.dao.impl;
+
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.objectstyle.cayenne.exp.Expression;
+import org.objectstyle.cayenne.exp.ExpressionFactory;
+import org.objectstyle.cayenne.query.SelectQuery;
+import org.objectstyle.cayenne.util.Util;
+import org.objectstyle.petstore.dao.ProductDao;
+import org.objectstyle.petstore.domain.Category;
+import org.objectstyle.petstore.domain.Product;
+
+import com.ibatis.common.util.PaginatedArrayList;
+import com.ibatis.common.util.PaginatedList;
+
+public class ProductCayenneDao extends CayenneDao implements ProductDao {
+
+    public PaginatedList searchProductList(String keywords) {
+
+        SelectQuery query = new SelectQuery(Product.class, buildSearchQualifier(keywords));
+        query.setPageSize(PAGE_SIZE);
+        List result = getDataContext().performQuery(query);
+        return new PaginatedArrayList(result, PAGE_SIZE);
+    }
+
+    public PaginatedList getProductListByCategory(Category category) {
+        // using query instead of a relationship to enable pagination
+        Expression qualifier = ExpressionFactory.matchExp(
+                Product.CATEGORY_PROPERTY,
+                category);
+        SelectQuery query = new SelectQuery(Product.class, qualifier);
+        query.setPageSize(PAGE_SIZE);
+        List result = getDataContext().performQuery(query);
+        return new PaginatedArrayList(result, PAGE_SIZE);
+    }
+
+    protected Expression buildSearchQualifier(String keywords) {
+        if (Util.isEmptyString(keywords)) {
+            return null;
+        }
+
+        return matchKeywords(Product.NAME_PROPERTY, keywords).orExp(
+                matchKeywords(Product.CATEGORY_NAME_PROPERTY, keywords)).orExp(
+                matchKeywords(Product.DESCRIPTION_PROPERTY, keywords));
+    }
+
+    /**
+     * Creates an expression that matches a String of space-separated keywords against a
+     * given property name.
+     */
+    protected Expression matchKeywords(String key, String keywords) {
+
+        StringTokenizer toks = new StringTokenizer(keywords);
+
+        if (!toks.hasMoreTokens()) {
+            throw new IllegalArgumentException("'keywords' must be a non-empty string");
+        }
+
+        Expression e = ExpressionFactory.likeIgnoreCaseExp(key, "%"
+                + toks.nextToken()
+                + "%");
+
+        while (toks.hasMoreTokens()) {
+            e = e.orExp(ExpressionFactory.likeIgnoreCaseExp(key, "%"
+                    + toks.nextToken()
+                    + "%"));
+        }
+
+        return e;
+    }
+}

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/dao/impl/ProductCayenneDao.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Account.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Account.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Account.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Account.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,23 @@
+package org.objectstyle.petstore.domain;
+
+import org.objectstyle.cayenne.PersistenceState;
+import org.objectstyle.petstore.domain.auto._Account;
+
+public class Account extends _Account {
+
+    public void setPersistenceState(int state) {
+
+        // create owned objects
+        if (state == PersistenceState.NEW) {
+            Profile profile = (Profile) getDataContext().createAndRegisterNewObject(
+                    Profile.class);
+            profile.setAccount(this);
+
+            User user = (User) getDataContext().createAndRegisterNewObject(User.class);
+            user.setAccount(this);
+        }
+
+        super.setPersistenceState(state);
+    }
+
+}

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/BannerData.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/BannerData.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/BannerData.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/BannerData.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,10 @@
+package org.objectstyle.petstore.domain;
+
+import org.objectstyle.petstore.domain.auto._BannerData;
+
+public class BannerData extends _BannerData {
+
+}
+
+
+

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Cart.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Cart.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Cart.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Cart.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,92 @@
+package org.objectstyle.petstore.domain;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import com.ibatis.common.util.PaginatedArrayList;
+import com.ibatis.common.util.PaginatedList;
+
+public class Cart implements Serializable {
+
+    private final Map itemMap = Collections.synchronizedMap(new HashMap());
+    private final PaginatedList itemList = new PaginatedArrayList(4);
+
+    public Iterator getCartItems() {
+        return itemList.iterator();
+    }
+
+    public PaginatedList getCartItemList() {
+        return itemList;
+    }
+
+    public int getNumberOfItems() {
+        return itemList.size();
+    }
+
+    public Iterator getAllCartItems() {
+        List allItems = new ArrayList();
+        itemList.gotoPage(0);
+        allItems.addAll(itemList);
+        while (itemList.nextPage()) {
+            allItems.addAll(itemList);
+        }
+        return allItems.iterator();
+    }
+
+    public boolean containsItemId(String itemId) {
+        return itemMap.containsKey(itemId);
+    }
+
+    public void addItem(Item item, boolean isInStock) {
+        CartItem cartItem = (CartItem) itemMap.get(item.getItemId());
+        if (cartItem == null) {
+            cartItem = new CartItem();
+            cartItem.setItem(item);
+            cartItem.setQuantity(0);
+            cartItem.setInStock(isInStock);
+            itemMap.put(item.getItemId(), cartItem);
+            itemList.add(cartItem);
+        }
+        cartItem.incrementQuantity();
+    }
+
+    public Item removeItemById(String itemId) {
+        CartItem cartItem = (CartItem) itemMap.remove(itemId);
+        if (cartItem == null) {
+            return null;
+        }
+        else {
+            itemList.remove(cartItem);
+            return cartItem.getItem();
+        }
+    }
+
+    public void incrementQuantityByItemId(String itemId) {
+        CartItem cartItem = (CartItem) itemMap.get(itemId);
+        cartItem.incrementQuantity();
+    }
+
+    public void setQuantityByItemId(Object itemId, int quantity) {
+        CartItem cartItem = (CartItem) itemMap.get(itemId);
+        cartItem.setQuantity(quantity);
+    }
+
+    public BigDecimal getSubTotal() {
+        BigDecimal subTotal = new BigDecimal("0");
+        Iterator items = getAllCartItems();
+        while (items.hasNext()) {
+            CartItem cartItem = (CartItem) items.next();
+            Item item = cartItem.getItem();
+            BigDecimal listPrice = item.getListPrice();
+            BigDecimal quantity = new BigDecimal(String.valueOf(cartItem.getQuantity()));
+            subTotal = subTotal.add(listPrice.multiply(quantity));
+        }
+        return subTotal;
+    }
+}

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Cart.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/CartItem.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/CartItem.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/CartItem.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/CartItem.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,56 @@
+package org.objectstyle.petstore.domain;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+public class CartItem implements Serializable {
+
+    private Item item;
+    private int quantity;
+    private boolean inStock;
+    private BigDecimal total;
+
+    public boolean isInStock() {
+        return inStock;
+    }
+
+    public void setInStock(boolean inStock) {
+        this.inStock = inStock;
+    }
+
+    public BigDecimal getTotal() {
+        return total;
+    }
+
+    public Item getItem() {
+        return item;
+    }
+
+    public void setItem(Item item) {
+        this.item = item;
+        calculateTotal();
+    }
+
+    public int getQuantity() {
+        return quantity;
+    }
+
+    public void setQuantity(int quantity) {
+        this.quantity = quantity;
+        calculateTotal();
+    }
+
+    public void incrementQuantity() {
+        quantity++;
+        calculateTotal();
+    }
+
+    private void calculateTotal() {
+        if (item != null && item.getListPrice() != null) {
+            total = item.getListPrice().multiply(new BigDecimal(quantity));
+        }
+        else {
+            total = null;
+        }
+    }
+}

Propchange: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/CartItem.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Category.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Category.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Category.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Category.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,11 @@
+package org.objectstyle.petstore.domain;
+
+import org.objectstyle.cayenne.DataObjectUtils;
+import org.objectstyle.petstore.domain.auto._Category;
+
+public class Category extends _Category {
+
+    public Object getCategoryId() {
+        return DataObjectUtils.pkForObject(this);
+    }
+}

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Inventory.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Inventory.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Inventory.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Inventory.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,10 @@
+package org.objectstyle.petstore.domain;
+
+import org.objectstyle.petstore.domain.auto._Inventory;
+
+public class Inventory extends _Inventory {
+
+}
+
+
+

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Item.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Item.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Item.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Item.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,24 @@
+package org.objectstyle.petstore.domain;
+
+import org.objectstyle.cayenne.DataObjectUtils;
+import org.objectstyle.petstore.domain.auto._Item;
+
+public class Item extends _Item {
+
+    public Object getItemId() {
+        return DataObjectUtils.pkForObject(this);
+    }
+
+    public Object getProductId() {
+        return DataObjectUtils.pkForObject(getProduct());
+    }
+
+    public Integer getQuantity() {
+        return getInventory().getQuantity();
+    }
+
+    public void setQuantity(Integer quantity) {
+        getInventory().setQuantity(quantity);
+    }
+
+}

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/LineItem.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/LineItem.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/LineItem.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/LineItem.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,28 @@
+package org.objectstyle.petstore.domain;
+
+import java.math.BigDecimal;
+
+import org.objectstyle.cayenne.DataObjectUtils;
+import org.objectstyle.petstore.domain.auto._LineItem;
+
+public class LineItem extends _LineItem {
+
+    /**
+     * Decreases the inventory based on the number of ordered items.
+     */
+    public void updateInventoryQuantity() {
+        int orderedQty = getQuantity().intValue();
+        int inventory = getItem().getInventory().getQuantity().intValue();
+        getItem().getInventory().setQuantity(new Integer(inventory - orderedQty));
+    }
+    
+    public Object getItemId() {
+        return DataObjectUtils.pkForObject(getItem());
+    }
+    
+    public BigDecimal getTotal() {
+        int quantity = getQuantity() != null ? getQuantity().intValue() : 0;
+        double price = getUnitPrice() != null ? getUnitPrice().doubleValue() : 0;
+        return new BigDecimal(quantity * price);
+    }
+}

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Order.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Order.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Order.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Order.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,84 @@
+package org.objectstyle.petstore.domain;
+
+import java.util.Date;
+import java.util.Iterator;
+
+import org.objectstyle.cayenne.DataObjectUtils;
+import org.objectstyle.petstore.domain.auto._Order;
+
+public class Order extends _Order {
+
+    /**
+     * Provides quick access to order id. Returns -1 if the order is transient.
+     */
+    public int getOrderId() {
+        return (getObjectId() != null && !getObjectId().isTemporary()) ? DataObjectUtils
+                .intPKForObject(this) : -1;
+    }
+
+    public String getStatus() {
+
+        if (getLineItems().isEmpty()) {
+            return "unknown";
+        }
+
+        // TODO: this is bogus ... we need an enum of possible statuses and business logic
+        // analyzing line item statuses...
+        LineItem li = (LineItem) getLineItems().get(0);
+        return li.getStatus() != null ? li.getStatus().getStatus() : "unknown";
+    }
+
+    public void initOrder(Account account, Cart cart) {
+
+        setOrderDate(new Date());
+        setShipToFirstName(account.getFirstName());
+        setShipToLastName(account.getLastName());
+        setShipAddress1(account.getAddress1());
+        setShipAddress2(account.getAddress2());
+        setShipCity(account.getCity());
+        setShipState(account.getState());
+        setShipZip(account.getZip());
+        setShipCountry(account.getCountry());
+
+        setBillToFirstName(account.getFirstName());
+        setBillToLastName(account.getLastName());
+        setBillAddress1(account.getAddress1());
+        setBillAddress2(account.getAddress2());
+        setBillCity(account.getCity());
+        setBillState(account.getState());
+        setBillZip(account.getZip());
+        setBillCountry(account.getCountry());
+
+        setTotalPrice(cart.getSubTotal());
+
+        setCreditCard("999 9999 9999 9999");
+        setExpiryDate("12/03");
+        setCardType("Visa");
+        setCourier("UPS");
+        setLocale("CA");
+    }
+
+    public void addLineItem(CartItem item) {
+        LineItem lineItem = (LineItem) getDataContext().createAndRegisterNewObject(
+                LineItem.class);
+
+        lineItem.setUnitPrice(item.getItem().getListPrice());
+        lineItem.setItem(item.getItem());
+        lineItem.setOrder(this);
+        lineItem.setQuantity(new Integer(item.getQuantity()));
+
+        OrderStatus status = (OrderStatus) getDataContext().createAndRegisterNewObject(
+                OrderStatus.class);
+        status.setStatus("P");
+        status.setTimestamp(this.getOrderDate());
+        lineItem.setStatus(status);
+    }
+
+    public void updateAllQuantities() {
+        Iterator it = getLineItems().iterator();
+        while (it.hasNext()) {
+            LineItem lineItem = (LineItem) it.next();
+            lineItem.updateInventoryQuantity();
+        }
+    }
+}

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/OrderStatus.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/OrderStatus.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/OrderStatus.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/OrderStatus.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,10 @@
+package org.objectstyle.petstore.domain;
+
+import org.objectstyle.petstore.domain.auto._OrderStatus;
+
+public class OrderStatus extends _OrderStatus {
+
+}
+
+
+

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Product.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Product.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Product.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Product.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,15 @@
+package org.objectstyle.petstore.domain;
+
+import org.objectstyle.cayenne.DataObjectUtils;
+import org.objectstyle.petstore.domain.auto._Product;
+
+public class Product extends _Product {
+
+    public Object getProductId() {
+        return DataObjectUtils.pkForObject(this);
+    }
+    
+    public Object getCategoryId() {
+        return DataObjectUtils.pkForObject(getCategory());
+    }
+}

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Profile.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Profile.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Profile.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Profile.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,10 @@
+package org.objectstyle.petstore.domain;
+
+import org.objectstyle.petstore.domain.auto._Profile;
+
+public class Profile extends _Profile {
+
+}
+
+
+

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Supplier.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Supplier.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Supplier.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/Supplier.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,10 @@
+package org.objectstyle.petstore.domain;
+
+import org.objectstyle.petstore.domain.auto._Supplier;
+
+public class Supplier extends _Supplier {
+
+}
+
+
+

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/User.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/User.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/User.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/User.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,10 @@
+package org.objectstyle.petstore.domain;
+
+import org.objectstyle.petstore.domain.auto._User;
+
+public class User extends _User {
+
+}
+
+
+

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Account.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Account.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Account.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Account.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,155 @@
+package org.objectstyle.petstore.domain.auto;
+
+import java.util.List;
+
+/** Class _Account was generated by Cayenne.
+  * It is probably a good idea to avoid changing this class manually, 
+  * since it may be overwritten next time code is regenerated. 
+  * If you need to make any customizations, please use subclass. 
+  */
+public class _Account extends org.objectstyle.cayenne.CayenneDataObject {
+
+    public static final String ADDRESS1_PROPERTY = "address1";
+    public static final String ADDRESS2_PROPERTY = "address2";
+    public static final String CITY_PROPERTY = "city";
+    public static final String COUNTRY_PROPERTY = "country";
+    public static final String EMAIL_PROPERTY = "email";
+    public static final String FIRST_NAME_PROPERTY = "firstName";
+    public static final String LAST_NAME_PROPERTY = "lastName";
+    public static final String PHONE_PROPERTY = "phone";
+    public static final String STATE_PROPERTY = "state";
+    public static final String STATUS_PROPERTY = "status";
+    public static final String USER_NAME_PROPERTY = "userName";
+    public static final String ZIP_PROPERTY = "zip";
+    public static final String ORDERS_PROPERTY = "orders";
+    public static final String PROFILE_PROPERTY = "profile";
+    public static final String USER_PROPERTY = "user";
+
+    public static final String USERID_PK_COLUMN = "userid";
+
+    public void setAddress1(String address1) {
+        writeProperty("address1", address1);
+    }
+    public String getAddress1() {
+        return (String)readProperty("address1");
+    }
+    
+    
+    public void setAddress2(String address2) {
+        writeProperty("address2", address2);
+    }
+    public String getAddress2() {
+        return (String)readProperty("address2");
+    }
+    
+    
+    public void setCity(String city) {
+        writeProperty("city", city);
+    }
+    public String getCity() {
+        return (String)readProperty("city");
+    }
+    
+    
+    public void setCountry(String country) {
+        writeProperty("country", country);
+    }
+    public String getCountry() {
+        return (String)readProperty("country");
+    }
+    
+    
+    public void setEmail(String email) {
+        writeProperty("email", email);
+    }
+    public String getEmail() {
+        return (String)readProperty("email");
+    }
+    
+    
+    public void setFirstName(String firstName) {
+        writeProperty("firstName", firstName);
+    }
+    public String getFirstName() {
+        return (String)readProperty("firstName");
+    }
+    
+    
+    public void setLastName(String lastName) {
+        writeProperty("lastName", lastName);
+    }
+    public String getLastName() {
+        return (String)readProperty("lastName");
+    }
+    
+    
+    public void setPhone(String phone) {
+        writeProperty("phone", phone);
+    }
+    public String getPhone() {
+        return (String)readProperty("phone");
+    }
+    
+    
+    public void setState(String state) {
+        writeProperty("state", state);
+    }
+    public String getState() {
+        return (String)readProperty("state");
+    }
+    
+    
+    public void setStatus(String status) {
+        writeProperty("status", status);
+    }
+    public String getStatus() {
+        return (String)readProperty("status");
+    }
+    
+    
+    public void setUserName(String userName) {
+        writeProperty("userName", userName);
+    }
+    public String getUserName() {
+        return (String)readProperty("userName");
+    }
+    
+    
+    public void setZip(String zip) {
+        writeProperty("zip", zip);
+    }
+    public String getZip() {
+        return (String)readProperty("zip");
+    }
+    
+    
+    public void addToOrders(org.objectstyle.petstore.domain.Order obj) {
+        addToManyTarget("orders", obj, true);
+    }
+    public void removeFromOrders(org.objectstyle.petstore.domain.Order obj) {
+        removeToManyTarget("orders", obj, true);
+    }
+    public List getOrders() {
+        return (List)readProperty("orders");
+    }
+    
+    
+    public void setProfile(org.objectstyle.petstore.domain.Profile profile) {
+        setToOneTarget("profile", profile, true);
+    }
+
+    public org.objectstyle.petstore.domain.Profile getProfile() {
+        return (org.objectstyle.petstore.domain.Profile)readProperty("profile");
+    } 
+    
+    
+    public void setUser(org.objectstyle.petstore.domain.User user) {
+        setToOneTarget("user", user, true);
+    }
+
+    public org.objectstyle.petstore.domain.User getUser() {
+        return (org.objectstyle.petstore.domain.User)readProperty("user");
+    } 
+    
+    
+}

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_BannerData.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_BannerData.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_BannerData.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_BannerData.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,32 @@
+package org.objectstyle.petstore.domain.auto;
+
+/** Class _BannerData was generated by Cayenne.
+  * It is probably a good idea to avoid changing this class manually, 
+  * since it may be overwritten next time code is regenerated. 
+  * If you need to make any customizations, please use subclass. 
+  */
+public class _BannerData extends org.objectstyle.cayenne.CayenneDataObject {
+
+    public static final String BANNER_NAME_PROPERTY = "bannerName";
+    public static final String CATEGORY_PROPERTY = "category";
+
+    public static final String FAVCATEGORY_PK_COLUMN = "favcategory";
+
+    public void setBannerName(String bannerName) {
+        writeProperty("bannerName", bannerName);
+    }
+    public String getBannerName() {
+        return (String)readProperty("bannerName");
+    }
+    
+    
+    public void setCategory(org.objectstyle.petstore.domain.Category category) {
+        setToOneTarget("category", category, true);
+    }
+
+    public org.objectstyle.petstore.domain.Category getCategory() {
+        return (org.objectstyle.petstore.domain.Category)readProperty("category");
+    } 
+    
+    
+}

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Category.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Category.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Category.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Category.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,67 @@
+package org.objectstyle.petstore.domain.auto;
+
+import java.util.List;
+
+/** Class _Category was generated by Cayenne.
+  * It is probably a good idea to avoid changing this class manually, 
+  * since it may be overwritten next time code is regenerated. 
+  * If you need to make any customizations, please use subclass. 
+  */
+public class _Category extends org.objectstyle.cayenne.CayenneDataObject {
+
+    public static final String DESCRIPTION_PROPERTY = "description";
+    public static final String NAME_PROPERTY = "name";
+    public static final String BANNER_PROPERTY = "banner";
+    public static final String PRODUCTS_PROPERTY = "products";
+    public static final String PROFILES_PROPERTY = "profiles";
+
+    public static final String CATID_PK_COLUMN = "catid";
+
+    public void setDescription(String description) {
+        writeProperty("description", description);
+    }
+    public String getDescription() {
+        return (String)readProperty("description");
+    }
+    
+    
+    public void setName(String name) {
+        writeProperty("name", name);
+    }
+    public String getName() {
+        return (String)readProperty("name");
+    }
+    
+    
+    public void setBanner(org.objectstyle.petstore.domain.BannerData banner) {
+        setToOneTarget("banner", banner, true);
+    }
+
+    public org.objectstyle.petstore.domain.BannerData getBanner() {
+        return (org.objectstyle.petstore.domain.BannerData)readProperty("banner");
+    } 
+    
+    
+    public void addToProducts(org.objectstyle.petstore.domain.Product obj) {
+        addToManyTarget("products", obj, true);
+    }
+    public void removeFromProducts(org.objectstyle.petstore.domain.Product obj) {
+        removeToManyTarget("products", obj, true);
+    }
+    public List getProducts() {
+        return (List)readProperty("products");
+    }
+    
+    
+    public void addToProfiles(org.objectstyle.petstore.domain.Profile obj) {
+        addToManyTarget("profiles", obj, true);
+    }
+    public void removeFromProfiles(org.objectstyle.petstore.domain.Profile obj) {
+        removeToManyTarget("profiles", obj, true);
+    }
+    public List getProfiles() {
+        return (List)readProperty("profiles");
+    }
+    
+    
+}

Added: incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Inventory.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Inventory.java?rev=419093&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Inventory.java (added)
+++ incubator/cayenne/examples/trunk/cayenne-petstore/src/org/objectstyle/petstore/domain/auto/_Inventory.java Tue Jul  4 13:47:09 2006
@@ -0,0 +1,32 @@
+package org.objectstyle.petstore.domain.auto;
+
+/** Class _Inventory was generated by Cayenne.
+  * It is probably a good idea to avoid changing this class manually, 
+  * since it may be overwritten next time code is regenerated. 
+  * If you need to make any customizations, please use subclass. 
+  */
+public class _Inventory extends org.objectstyle.cayenne.CayenneDataObject {
+
+    public static final String QUANTITY_PROPERTY = "quantity";
+    public static final String ITEM_PROPERTY = "item";
+
+    public static final String ITEMID_PK_COLUMN = "itemid";
+
+    public void setQuantity(Integer quantity) {
+        writeProperty("quantity", quantity);
+    }
+    public Integer getQuantity() {
+        return (Integer)readProperty("quantity");
+    }
+    
+    
+    public void setItem(org.objectstyle.petstore.domain.Item item) {
+        setToOneTarget("item", item, true);
+    }
+
+    public org.objectstyle.petstore.domain.Item getItem() {
+        return (org.objectstyle.petstore.domain.Item)readProperty("item");
+    } 
+    
+    
+}



Mime
View raw message