You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by pp...@apache.org on 2010/05/21 00:10:24 UTC
svn commit: r946808 - in
/openjpa/trunk/openjpa-examples/openbooks/src/main/java: jpa/tools/swing/
openbook/client/ openbook/domain/ openbook/server/ openbook/util/
Author: ppoddar
Date: Thu May 20 22:10:23 2010
New Revision: 946808
URL: http://svn.apache.org/viewvc?rev=946808&view=rev
Log:
Remove personal copyright headers
Added:
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/util/JSPUtility.java (with props)
Removed:
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ImageBorder.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SQLLogger.java
Modified:
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/AttributeLegendView.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/AttributeView.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ConfigurationViewer.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityDataModel.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTable.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTableView.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTypeView.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ErrorDialog.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/GraphicOutputStream.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/InstanceDataModel.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/InstanceView.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/Maze.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/MetamodelHelper.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/MetamodelView.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PathFinder.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PowerPointViewer.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PreparedQueryViewer.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/QueryStatisticsModel.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ScrollingTextPane.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SourceCodeViewer.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/StatusBar.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SwingHelper.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/TextStyles.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/BuyBookPage.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/DeliveryPage.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/Demo.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/Images.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/SQLLogger.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/SupplyPage.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/Book.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/Customer.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/PurchaseOrder.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/Range.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/ShoppingCart.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/OpenBookService.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/OpenBookServiceImpl.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/QueryParameterBinder.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/ServiceFactory.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/util/PropertyHelper.java
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/AttributeLegendView.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/AttributeLegendView.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/AttributeLegendView.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/AttributeLegendView.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/AttributeView.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/AttributeView.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/AttributeView.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/AttributeView.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ConfigurationViewer.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ConfigurationViewer.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ConfigurationViewer.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ConfigurationViewer.java Thu May 20 22:10:23 2010
@@ -1,6 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,16 +14,12 @@
*/
package jpa.tools.swing;
-import java.awt.BorderLayout;
import java.util.Arrays;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import javax.swing.BorderFactory;
-import javax.swing.JPanel;
-import javax.swing.JScrollBar;
-import javax.swing.JScrollPane;
import javax.swing.JTextPane;
/**
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityDataModel.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityDataModel.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityDataModel.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityDataModel.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTable.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTable.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTable.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTable.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTableView.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTableView.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTableView.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTableView.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTypeView.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTypeView.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTypeView.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTypeView.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ErrorDialog.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ErrorDialog.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ErrorDialog.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ErrorDialog.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/GraphicOutputStream.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/GraphicOutputStream.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/GraphicOutputStream.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/GraphicOutputStream.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/InstanceDataModel.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/InstanceDataModel.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/InstanceDataModel.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/InstanceDataModel.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/InstanceView.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/InstanceView.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/InstanceView.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/InstanceView.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/Maze.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/Maze.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/Maze.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/Maze.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/MetamodelHelper.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/MetamodelHelper.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/MetamodelHelper.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/MetamodelHelper.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/MetamodelView.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/MetamodelView.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/MetamodelView.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/MetamodelView.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PathFinder.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PathFinder.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PathFinder.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PathFinder.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PowerPointViewer.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PowerPointViewer.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PowerPointViewer.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PowerPointViewer.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PreparedQueryViewer.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PreparedQueryViewer.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PreparedQueryViewer.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PreparedQueryViewer.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/QueryStatisticsModel.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/QueryStatisticsModel.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/QueryStatisticsModel.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/QueryStatisticsModel.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ScrollingTextPane.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ScrollingTextPane.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ScrollingTextPane.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ScrollingTextPane.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SourceCodeViewer.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SourceCodeViewer.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SourceCodeViewer.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SourceCodeViewer.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/StatusBar.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/StatusBar.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/StatusBar.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/StatusBar.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SwingHelper.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SwingHelper.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SwingHelper.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SwingHelper.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/TextStyles.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/TextStyles.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/TextStyles.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/TextStyles.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/BuyBookPage.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/BuyBookPage.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/BuyBookPage.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/BuyBookPage.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/DeliveryPage.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/DeliveryPage.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/DeliveryPage.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/DeliveryPage.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -156,7 +153,7 @@ public class DeliveryPage extends JPanel
SwingWorker<List<PurchaseOrder>, Void> worker = new SwingWorker<List<PurchaseOrder>, Void>() {
@Override
protected List<PurchaseOrder> doInBackground() throws Exception {
- return _service.getOrders(status);
+ return _service.getOrders(status, null);
}
};
worker.execute();
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/Demo.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/Demo.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/Demo.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/Demo.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -26,6 +23,7 @@ import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.io.PrintStream;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@@ -69,6 +67,7 @@ import openbook.server.ServiceFactory;
import openbook.util.PropertyHelper;
import org.apache.openjpa.conf.OpenJPAVersion;
+import org.apache.openjpa.lib.jdbc.JDBCListener;
import org.apache.openjpa.persistence.OpenJPAPersistence;
/**
@@ -106,6 +105,7 @@ public class Demo extends JFrame impleme
private JTabbedPane _outputPane;
private StatusBar _statusBar;
private ScrollingTextPane _sqlLog;
+ private SQLLogger _sqlListener;
public static final Icon LOGO = Images.getIcon("images/OpenBooks.jpg");
private boolean _debug = Boolean.getBoolean("openbook.debug");
@@ -204,7 +204,11 @@ public class Demo extends JFrame impleme
SwingWorker<OpenBookService, Void> getService = new SwingWorker<OpenBookService, Void> () {
@Override
protected OpenBookService doInBackground() throws Exception {
- return ServiceFactory.getService(unitName);
+ Map<String, Object> runtimeConfig = new HashMap<String, Object>();
+ runtimeConfig.put("openjpa.jdbc.JDBCListeners", new JDBCListener[]{_sqlListener});
+ OpenBookService service = ServiceFactory.getService(unitName, runtimeConfig);
+ service.initialize(null);
+ return service;
}
};
@@ -543,15 +547,20 @@ public class Demo extends JFrame impleme
private JTabbedPane createOutputView() {
JTabbedPane pane = new JTabbedPane();
pane.setPreferredSize(OUT_VIEW);
+
+ _sqlListener = new SQLLogger();
_sqlLog = new ScrollingTextPane();
+
GraphicOutputStream stream = new GraphicOutputStream(_sqlLog);
_sqlLog.setPreferredSize(TAB_VIEW);
- SQLLogger.setOutput(stream);
+ _sqlListener.setOutput(stream);
pane.addTab("SQL Log", new JScrollPane(_sqlLog));
+
ScrollingTextPane consoleLog = new ScrollingTextPane();
GraphicOutputStream console = new GraphicOutputStream(consoleLog);
System.setErr(new PrintStream(console, true));
pane.addTab("Console", new JScrollPane(consoleLog));
+
return pane;
}
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/Images.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/Images.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/Images.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/Images.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/SQLLogger.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/SQLLogger.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/SQLLogger.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/SQLLogger.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -39,7 +36,7 @@ import org.apache.openjpa.lib.jdbc.JDBCE
*
*/
public class SQLLogger extends AbstractJDBCListener {
- private static PrintStream out = null;
+ private PrintStream out = null;
private static AttributeSet red, green, blue, magenta;
static {
StyleContext ctx = StyleContext.getDefaultStyleContext();
@@ -49,7 +46,7 @@ public class SQLLogger extends AbstractJ
magenta = ctx.addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.Foreground, Color.MAGENTA);
}
- public static void setOutput(GraphicOutputStream o) {
+ public void setOutput(GraphicOutputStream o) {
out = new PrintStream(o, true);
o.registerStyle("INSERT", green);
o.registerStyle("SELECT", blue);
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/SupplyPage.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/SupplyPage.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/SupplyPage.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/SupplyPage.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/Book.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/Book.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/Book.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/Book.java Thu May 20 22:10:23 2010
@@ -125,4 +125,29 @@ public class Book implements Serializabl
public int getVersion() {
return version;
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((ISBN == null) ? 0 : ISBN.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Book other = (Book) obj;
+ if (ISBN == null) {
+ if (other.ISBN != null)
+ return false;
+ } else if (!ISBN.equals(other.ISBN))
+ return false;
+ return true;
+ }
}
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/Customer.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/Customer.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/Customer.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/Customer.java Thu May 20 22:10:23 2010
@@ -74,6 +74,10 @@ public class Customer implements Seriali
return new ShoppingCart(this);
}
+ public String toString() {
+ return name;
+ }
+
@Version
private int version;
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/PurchaseOrder.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/PurchaseOrder.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/PurchaseOrder.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/PurchaseOrder.java Thu May 20 22:10:23 2010
@@ -17,7 +17,7 @@ package openbook.domain;
import java.io.Serializable;
-import java.sql.Time;
+import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -25,6 +25,7 @@ import java.util.Map;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
+import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
@@ -33,11 +34,24 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
- * A persistent entity.
- * Auto-generated identity.
- * Enum and Date type persistent attribute.
- * One-to-One uni-directional mapping to Customer.
- * One-to-Many bi-directional mapping to LineItem.
+ * A persistent entity to demonstrate Master in a Master-Details or Composite pattern for
+ * persistent domain model.
+ * <br>
+ * The Purchase Order - Line Items relationship typically demonstrates a Master-Details pattern.
+ * In JPA 2.0, following new features are added to support this common pattern used in domain modeling,
+ * and this example demonstrates them.<br>
+ * <LI> Compound, Derived identity: This feature allows the Details type to compose its identity from the
+ * the Master's identity.
+ * <LI> Orphan Delete or Dependent relation: This feature allows to impose composite relation semantics to
+ * normally associative relation semantics implied in Java. Composite relation in persistence terms also
+ * translates to deletion of Details record from database when the details lose their relation to master.
+ * <br>
+ * Besides the above two key features, this persistent type also shows usage of
+ * <LI>Auto-generated identity.
+ * <LI>Enum type persistent attribute.
+ * <LI>Date type persistent attribute.
+ * <LI>One-to-One uni-directional, immutable mapping to Customer.
+ * <LI>One-to-Many bi-directional, immutable mapping to LineItem.
*
* @author Pinaki Poddar
*
@@ -45,7 +59,15 @@ import javax.persistence.TemporalType;
@SuppressWarnings("serial")
@Entity
public class PurchaseOrder implements Serializable {
+<<<<<<< .mine
+ /**
+ * Enumerates the status of a Purchase Order.
+ *
+ */
public enum Status {PENDING, DELIVERED};
+=======
+ public enum Status {PENDING, DELIVERED};
+>>>>>>> .r946807
@Id
@GeneratedValue
@@ -54,73 +76,141 @@ public class PurchaseOrder implements Se
@OneToOne(optional=false)
private Customer customer;
- private Status status;
-
- @OneToMany(mappedBy="order", cascade=CascadeType.ALL, orphanRemoval=true)
+ @OneToMany(mappedBy="order", fetch=FetchType.EAGER, cascade=CascadeType.ALL, orphanRemoval=true)
private List<LineItem> items;
+ private Status status;
+
private int total;
- @Temporal(TemporalType.TIME)
- private Date placedOn;
+ @Temporal(TemporalType.TIMESTAMP)
+ private Timestamp placedOn;
- @Temporal(TemporalType.TIME)
- private Date deliveredOn;
+ @Temporal(TemporalType.TIMESTAMP)
+ private Timestamp deliveredOn;
- protected PurchaseOrder() {}
+ /**
+ * A protected constructor satisfies two purposes:<br>
+ * <LI>i) Status and creation time is set consistently.
+ * <LI>ii) OpenJPA Bytecode Enhancer requires an empty constructor for the domain classes.
+ * The public constructor of Purchase Order takes a Shopping Cart as argument.
+ *
+ */
+ protected PurchaseOrder() {
+ status = Status.PENDING;
+ placedOn = new Timestamp(System.currentTimeMillis());
+ }
/**
- * Constructed by transferring the content of the given {@linkplain ShoppingCart}.
- * @param cart
+ * Construct a new order by transferring the content of the given {@linkplain ShoppingCart}.
+ *
+ * @param cart a non-null, non-empty Shopping cart
+ * @exception NullPointerException if the cart is null
+ * @exception IllegalStateException if the cart is empty
*/
public PurchaseOrder(ShoppingCart cart) {
+ this();
+ if (cart == null)
+ throw new NullPointerException("Can not create new Purchase Order from null Shopping Cart");
+ if (cart.isEmpty())
+ throw new IllegalStateException("Can not create new Purchase Order from empty Shopping Cart");
customer = cart.getCustomer();
- status = Status.PENDING;
- placedOn = new Time(System.currentTimeMillis());
Map<Book, Integer> items = cart.getItems();
for (Map.Entry<Book, Integer> entry : items.entrySet()) {
addItem(entry.getKey(), entry.getValue());
}
}
+ /**
+ * Gets the immutable, auto-generated persistent identity of this Purchase Order.
+ */
public long getId() {
return id;
}
+ /**
+ * Gets the customer who placed this Purchase Order.
+ *
+ * @return immutable Customer.
+ */
public Customer getCustomer() {
return customer;
}
+ /**
+ * Gets the status of this Purchase Order.
+ *
+ */
public Status getStatus() {
return status;
}
+ /**
+ * Sets the status of this Purchase Order as delivered.
+ * Setting an order status as delivered nullifies the association to Line Items.
+ * Nullifying this association has the important side-effect of Line Item records
+ * be deleted from the database because the relation is annotated as orphan delete.
+ *
+ * @exception IllegalStateException if this order has already been delivered.
+ */
public void setDelivered() {
if (this.status == Status.DELIVERED)
throw new IllegalStateException(this + " has been delivered");
+<<<<<<< .mine
+ this.status = Status.DELIVERED;
+ this.deliveredOn = new Timestamp(System.currentTimeMillis());
+ this.items = null;
+=======
this.status = Status.DELIVERED;
this.deliveredOn = new Time(System.currentTimeMillis());
+>>>>>>> .r946807
}
+ /**
+ * Gets the items for this Purchase Order.
+ *
+ * @return the line items of this order. The line items for a delivered order is always null.
+ * @see #setDelivered()
+ */
public List<LineItem> getItems() {
return items;
}
+ /**
+ * Adds an item to this Purchase Order.
+ * The total is adjusted as a side-effect.
+ */
void addItem(Book book, int quantity) {
+ if (book == null)
+ throw new NullPointerException("Can not add Line Item to Purchase Order for null Book");
+ if (quantity < 1)
+ throw new IllegalArgumentException("Can not add Line Item to Purchase Order for negative (=" +
+ quantity + ") number of Book " + book);
if (items == null)
items = new ArrayList<LineItem>();
items.add(new LineItem(this, items.size()+1, book, quantity));
total += (book.getPrice() * quantity);
}
+ /**
+ * Gets the total cost of all the items in this order.
+ */
public double getTotal() {
return total;
}
- public Date getPlacedOn() {
+ /**
+ * Gets the time when this order was placed.
+ */
+ public Timestamp getPlacedOn() {
return placedOn;
}
+ /**
+ * Gets the time when this order was delivered.
+ *
+ * @return null if the order has not been delivered yet.
+ */
public Date getDeliveredOn() {
return deliveredOn;
}
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/Range.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/Range.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/Range.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/Range.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/ShoppingCart.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/ShoppingCart.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/ShoppingCart.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/domain/ShoppingCart.java Thu May 20 22:10:23 2010
@@ -116,5 +116,16 @@ public class ShoppingCart implements Ser
public void clear() {
items.clear();
}
+
+ public boolean isEmpty() {
+ return items.isEmpty();
+ }
+
+ public int getTotalCount() {
+ int sum = 0;
+ for (Integer q : items.values())
+ sum += q.intValue();
+ return sum;
+ }
}
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/OpenBookService.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/OpenBookService.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/OpenBookService.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/OpenBookService.java Thu May 20 22:10:23 2010
@@ -125,7 +125,7 @@ public interface OpenBookService {
*
* @return list of orders sorted by their placement dates.
*/
- public List<PurchaseOrder> getOrders(PurchaseOrder.Status status);
+ public List<PurchaseOrder> getOrders(PurchaseOrder.Status status, Customer customer);
/**
@@ -155,7 +155,13 @@ public interface OpenBookService {
* @return true if the repository is initialized by this invocation.
*/
public boolean initialize(Map<String,Object> loadParameters);
+
+ /**
+ * Cleans everything. Be careful.
+ */
public void clean();
+
+
/**
* Gets the underlying persistence unit.
*
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/OpenBookServiceImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/OpenBookServiceImpl.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/OpenBookServiceImpl.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/OpenBookServiceImpl.java Thu May 20 22:10:23 2010
@@ -269,23 +269,29 @@ class OpenBookServiceImpl extends Persis
public PurchaseOrder deliver(PurchaseOrder o) {
EntityManager em = begin();
o = em.merge(o);
- o.setDelivered();
for (LineItem item : o.getItems()) {
item.getBook().getInventory().decrement(item.getQuantity());
}
+ o.setDelivered();
commit();
return o;
}
- public List<PurchaseOrder> getOrders(PurchaseOrder.Status status) {
+ public List<PurchaseOrder> getOrders(PurchaseOrder.Status status, Customer customer) {
EntityManager em = begin();
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<PurchaseOrder> q = cb.createQuery(PurchaseOrder.class);
Root<PurchaseOrder> order = q.from(PurchaseOrder.class);
q.select(order);
+ List<Predicate> predicates = new ArrayList<Predicate>();
if (status != null) {
- q.where(cb.equal(order.get(PurchaseOrder_.status), status));
+ predicates.add(cb.equal(order.get(PurchaseOrder_.status), status));
+ }
+ if (customer != null) {
+ predicates.add(cb.equal(order.get(PurchaseOrder_.customer), customer));
}
+ if (!predicates.isEmpty())
+ q.where(predicates.toArray(new Predicate[predicates.size()]));
q.orderBy(cb.desc(order.get(PurchaseOrder_.placedOn)));
TypedQuery<PurchaseOrder> query = em.createQuery(q);
@@ -296,6 +302,7 @@ class OpenBookServiceImpl extends Persis
/**
* Creates a new {@linkplain PurchaseOrder} from the content of the given {@linkplain ShoppingCart}.
+ * The content of the cart is cleared as a result.
* <br>
* The transaction is not expected to fail because the inventory is
* not modified by placing an order.
@@ -307,6 +314,7 @@ class OpenBookServiceImpl extends Persis
PurchaseOrder order = new PurchaseOrder(cart);
em.persist(order);
commit();
+ cart.clear();
return order;
}
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/QueryParameterBinder.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/QueryParameterBinder.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/QueryParameterBinder.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/QueryParameterBinder.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/ServiceFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/ServiceFactory.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/ServiceFactory.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/ServiceFactory.java Thu May 20 22:10:23 2010
@@ -30,8 +30,11 @@ import javax.persistence.PersistenceCont
*
*/
public class ServiceFactory {
- private static final Map<String, OpenBookService> _services =
- new HashMap<String, OpenBookService>();
+ private static final Map<String, OpenBookService> _services = new HashMap<String, OpenBookService>();
+
+ public synchronized static OpenBookService getService(String unit) {
+ return getService(unit, null);
+ }
/**
* Creates a persistence unit of given name configured with the given
@@ -40,10 +43,10 @@ public class ServiceFactory {
* @param unit name of the persistence unit. A <code>META-INF/persistence.xml</code> must be
* available with the same unit name in the classpath.
*/
- public synchronized static OpenBookService getService(String unit) {
+ public synchronized static OpenBookService getService(String unit, Map<String,Object> config) {
OpenBookService service = _services.get(unit);
if (service == null) {
- EntityManagerFactory emf = Persistence.createEntityManagerFactory(unit);
+ EntityManagerFactory emf = Persistence.createEntityManagerFactory(unit, config);
service = new OpenBookServiceImpl(unit, emf, false, PersistenceContextType.TRANSACTION);
_services.put(unit, service);
}
Added: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/util/JSPUtility.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/util/JSPUtility.java?rev=946808&view=auto
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/util/JSPUtility.java (added)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/util/JSPUtility.java Thu May 20 22:10:23 2010
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package openbook.util;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.text.DateFormat;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+
+/**
+ * A set of static utilities used by the Java Server Pages.
+ *
+ * @author Pinaki Poddar
+ *
+ */
+public class JSPUtility {
+ /**
+ * Converts the given number in currency format.
+ */
+ public static final DecimalFormat currencyFormatter = new DecimalFormat("###.##");
+ public static final DateFormat dateFormatter = new SimpleDateFormat("MMM dd yyyy HH:mm");
+
+ public static String format(Number price) {
+ return currencyFormatter.format(price);
+ }
+
+ public static String format(Date date) {
+ return dateFormatter.format(date);
+ }
+
+ /**
+ * Converts the given String to a double.
+ * Return null if the String is null or non-numeric.
+ */
+ public static Double toDouble(String v) {
+ try {
+ return Double.parseDouble(v);
+ } catch (NumberFormatException e) {
+ return null;
+ }
+ }
+
+ /**
+ * Background color of table rows.
+ */
+ public static String EVEN_ROW_COLOR = "#E3E4FA";
+ public static String ODD_ROW_COLOR = "#E0FFFF";
+ public static String getRowStyle(int row) {
+ return "background-color:" + ((row % 2 == 0) ? EVEN_ROW_COLOR : ODD_ROW_COLOR);
+ }
+
+ /**
+ * Encodes parameter key-values in a URL.
+ *
+ * @param page the base page
+ * @param params key-value pairs of parameters passed in to the page URL.
+ * null or empty argument is allowed.
+ * @return a URL encoded string
+ */
+ public static String encodeURL(String page, Object...params) {
+ StringBuilder paramBuffer = new StringBuilder();
+ if (params != null && params.length != 0) {
+ if (params.length % 2 != 0) {
+ throw new IllegalArgumentException("Odd number of encoding parameters " +
+ Arrays.toString(params) + " to " + page);
+ }
+ for (int i = 0; i < params.length; i += 2) {
+ if (paramBuffer.length() > 0)
+ paramBuffer.append("&");
+ String key = params[i] == null ? "" : params[i].toString();
+ String value = params[i+1] == null ? "" : params[i+1].toString();
+ paramBuffer.append(key).append("=").append(encode(value));
+ }
+ }
+ if (paramBuffer.length() >0)
+ return page + "?" + paramBuffer;
+ else
+ return page;
+ }
+
+ private static String encode(String s) {
+ try {
+ return URLEncoder.encode(s, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ return s;
+ }
+ }
+}
Propchange: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/util/JSPUtility.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/util/PropertyHelper.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/util/PropertyHelper.java?rev=946808&r1=946807&r2=946808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/util/PropertyHelper.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/util/PropertyHelper.java Thu May 20 22:10:23 2010
@@ -1,7 +1,4 @@
/*
- * Copyright 2010-2012 Pinaki Poddar
- *
- *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at