diff --git a/LICENSE b/LICENSE index 5718cf5f7..fdfce74c0 100644 --- a/LICENSE +++ b/LICENSE @@ -250,7 +250,7 @@ openjpa-persistence - persistence-xsd.rsrc - CDDL 1.0 - included in the openjpa jar, taken from: http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd) persistence_2_0-xsd.rsrc - CDDL 1.0 - included in the openjpa jar, taken from: - http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd). + http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd). =========================== COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 diff --git a/openjpa-all/pom.xml b/openjpa-all/pom.xml index 0f58e1e9e..93cf796fc 100644 --- a/openjpa-all/pom.xml +++ b/openjpa-all/pom.xml @@ -7,18 +7,18 @@ 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. + under the License. --> - @@ -85,7 +85,7 @@ ${createSources} true true - diff --git a/openjpa-all/src/main/appended-resources/META-INF/LICENSE.vm b/openjpa-all/src/main/appended-resources/META-INF/LICENSE.vm index c7aecd18f..cb725c582 100644 --- a/openjpa-all/src/main/appended-resources/META-INF/LICENSE.vm +++ b/openjpa-all/src/main/appended-resources/META-INF/LICENSE.vm @@ -239,27 +239,27 @@ serp-1.13.1.jar - BSD License Copyright (c) 2002, A. Abram White All rights reserved. -Redistribution and use in source and binary forms, with or without +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -* Redistributions of source code must retain the above copyright notice, this +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of 'serp' nor the names of its contributors may - be used to endorse or promote products derived from this software without + be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =========================== @@ -271,7 +271,7 @@ openjpa-persistence - persistence-xsd.rsrc - CDDL 1.0 - included in the openjpa jar, taken from: http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd) persistence_2_0-xsd.rsrc - CDDL 1.0 - included in the openjpa jar, taken from: - http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd). + http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd). =========================== COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 diff --git a/openjpa-all/src/main/appended-resources/META-INF/NOTICE.vm b/openjpa-all/src/main/appended-resources/META-INF/NOTICE.vm index b972c99bc..9887cf61b 100644 --- a/openjpa-all/src/main/appended-resources/META-INF/NOTICE.vm +++ b/openjpa-all/src/main/appended-resources/META-INF/NOTICE.vm @@ -24,7 +24,7 @@ openjpa-all includes software developed by the: Apache Commons Lang project Apache Commons Logging project Apache Commons Pool project - Apache Geronimo project + Apache Geronimo project Java EE Specs - JMS 1.1, JTA 1.1, Bean Validation 1.0 and JPA 2.0 SERP project diff --git a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/ImageType.java b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/ImageType.java index 4dd40d249..49698c5cb 100644 --- a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/ImageType.java +++ b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/ImageType.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.example.gallery; diff --git a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/TestJPAValidation.java b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/TestJPAValidation.java index 4ddb36736..caaa261b1 100644 --- a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/TestJPAValidation.java +++ b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/TestJPAValidation.java @@ -37,7 +37,7 @@ public class TestJPAValidation extends junit.framework.TestCase { * and pre-persist lifecycle events. */ public void testValidation() { - EntityManagerFactory emf = + EntityManagerFactory emf = Persistence.createEntityManagerFactory("BeanValidation"); EntityManager em = emf.createEntityManager(); @@ -54,7 +54,7 @@ public class TestJPAValidation extends junit.framework.TestCase { img.setFileName("Winter_01.gif"); loadImage(img); img.setLocation(loc); - + // *** PERSIST *** try { em.getTransaction().begin(); @@ -77,7 +77,7 @@ public class TestJPAValidation extends junit.framework.TestCase { // *** UPDATE *** try { em.getTransaction().begin(); - // Modify the file name to a non-matching file name + // Modify the file name to a non-matching file name // and commit to trigger an update System.out.println("Modifying file name to use an extension that does not"); System.out.println("match the file type. This will cause a CVE."); @@ -90,7 +90,7 @@ public class TestJPAValidation extends junit.framework.TestCase { System.out.println("Update failed as expected"); handleConstraintViolation(cve); } - // The update failure caused img to be detached. It must be merged back + // The update failure caused img to be detached. It must be merged back // into the persistence context. img = em.merge(img); @@ -131,10 +131,10 @@ public class TestJPAValidation extends junit.framework.TestCase { } } - // Mock image loading utility... simply loads the GIF89a header to satisfy the + // Mock image loading utility... simply loads the GIF89a header to satisfy the // constraint validator. private static void loadImage(Image img) { img.setData(new byte[] { 'G', 'I', 'F', '8', '9', 'a' }); } - + } diff --git a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageConstraint.java b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageConstraint.java index e5c81a88a..ff2c569ce 100644 --- a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageConstraint.java +++ b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageConstraint.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.example.gallery.constraint; @@ -32,7 +32,7 @@ import static org.apache.openjpa.example.gallery.ImageType.GIF; import static org.apache.openjpa.example.gallery.ImageType.JPEG; /** - * Type-level annotation used to specify an image constraint. Uses + * Type-level annotation used to specify an image constraint. Uses * ImageValidator to perform the validation. */ @Documented diff --git a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageContent.java b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageContent.java index ba8703539..ee9153d07 100644 --- a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageContent.java +++ b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageContent.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.example.gallery.constraint; @@ -33,7 +33,7 @@ import static org.apache.openjpa.example.gallery.ImageType.GIF; import static org.apache.openjpa.example.gallery.ImageType.JPEG; /** - * Attribute-level annotation used to specify an image content constraint. Uses + * Attribute-level annotation used to specify an image content constraint. Uses * ImageContentValidator to perform the validation. */ @Documented diff --git a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageContentValidator.java b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageContentValidator.java index 6b0917e12..b07ac3ed1 100644 --- a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageContentValidator.java +++ b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageContentValidator.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.example.gallery.constraint; diff --git a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageGroup.java b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageGroup.java index 6cf7ada16..7df056279 100644 --- a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageGroup.java +++ b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageGroup.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.example.gallery.constraint; diff --git a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageValidator.java b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageValidator.java index 727dfa964..031ec63cb 100644 --- a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageValidator.java +++ b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/constraint/ImageValidator.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.example.gallery.constraint; @@ -51,13 +51,13 @@ public class ImageValidator implements ConstraintValidator images; - + @ManyToMany private List creator; diff --git a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/model/Creator.java b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/model/Creator.java index 419b61920..414fb129c 100644 --- a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/model/Creator.java +++ b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/model/Creator.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.example.gallery.model; @@ -38,20 +38,20 @@ public class Creator { @Id @GeneratedValue private long id; - + @NotNull(message="Photographer's first name must be specified.") private String firstName; - + @NotNull(message="Photographer's last name must be specified.") private String lastName; @OneToMany @OrderBy("fileName") private List images; - + @ManyToMany private List albums; - + public void setId(long id) { this.id = id; } diff --git a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/model/Image.java b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/model/Image.java index 78fcaf298..c62aebac9 100644 --- a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/model/Image.java +++ b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/model/Image.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.example.gallery.model; @@ -38,14 +38,14 @@ import org.apache.openjpa.example.gallery.constraint.ImageGroup; @Entity @ImageConstraint(groups=ImageGroup.class) public class Image { - + private long id; private ImageType type; private String fileName; - private byte[] data; + private byte[] data; private Location location; private Creator creator; - + @Id @GeneratedValue public long getId() { @@ -61,11 +61,11 @@ public class Image { public ImageType getType() { return type; } - + public void setType(ImageType type) { this.type = type; } - + @NotNull(message="Image file name must not be null.") public String getFileName() { return fileName; diff --git a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/model/Location.java b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/model/Location.java index c36453cf4..f1984e79d 100644 --- a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/model/Location.java +++ b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/model/Location.java @@ -33,16 +33,16 @@ public class Location { @NotNull(message="City must be specified.") private String city; - + private String street; - + private String state; @NotNull(message="Country must be specified.") @Size(message="Country must be 50 characters or less.", max=50) @Column(length=50) private String country; - + @Size(message="Zip code must be 10 characters or less.", max=10) @Pattern(message="Zip code must be 5 digits or use the 5+4 format.", regexp="^\\d{5}(([\\-]|[\\+])\\d{4})?$") diff --git a/openjpa-examples/image-gallery/src/test/resources/META-INF/persistence.xml b/openjpa-examples/image-gallery/src/test/resources/META-INF/persistence.xml index 0d1073715..19716d37e 100644 --- a/openjpa-examples/image-gallery/src/test/resources/META-INF/persistence.xml +++ b/openjpa-examples/image-gallery/src/test/resources/META-INF/persistence.xml @@ -7,22 +7,22 @@ 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. + under the License. --> - + Example persistence unit for Bean Validation org.apache.openjpa.example.gallery.model.Album @@ -32,13 +32,13 @@ true CALLBACK - - + @@ -41,20 +41,20 @@ tt {

Instructions to build, deploy and run JEST demo


- +
-
Step 1: Download OpenJPA binary
-
OpenJPA binaries are available from OpenJPA +
Step 1: Download OpenJPA binary
+
OpenJPA binaries are available from OpenJPA download site. - The nightly snapshots of version 2.2.0 that includes JEST are ready for - download at lower half of the page. -
+ The nightly snapshots of version 2.2.0 that includes JEST are ready for + download at lower half of the page. +
Step 2: Get the JEST demo application
A simple servlet based application is used to demonstrate JEST usage. This simple application merely defines a persistent unit with two persistent classes: Actor - and Movie. The source code, persistence unit descriptor + and Movie. The source code, persistence unit descriptor META-INF/persistence.xml, deployment descriptor WEB-INF/web.xml and Ant-based build script are available from OpenJPA svn repository.
Checkout these source files from the repository to a local directory. @@ -66,11 +66,11 @@ tt {
Step 3: Configure for your environment
The persistence unit descriptor META-INF/persistence.xml for the example application - needs to be configured with database details. By default, it is configured for a MySQL database. + needs to be configured with database details. By default, it is configured for a MySQL database.
- The build script requires the location of openjpa library and servlet API library jar. + The build script requires the location of openjpa library and servlet API library jar. Edit build.properties file to set the variables to locations appropriate for - your environment. + your environment.

Step 4: Build the application
@@ -92,7 +92,7 @@ tt {
Step 5: Deploy the web archive
Once the web archive is ready, deploy it in an application server or servlet container by - following standard practice. Needless to say, the database driver specified in + following standard practice. Needless to say, the database driver specified in META-INF/persistence.xml should also be available in the deployment environment.

@@ -101,12 +101,12 @@ tt { Once the web archive has been deployed, you can verify by visiting the home page (and the only page) of the sample application in your browser
http://localhost:8080/demo/
- The context path of the deployed servlet is demo as you may have noticed in WEB-INF/web.xml. + The context path of the deployed servlet is demo as you may have noticed in WEB-INF/web.xml. The JEST servlet is just next door at
http://localhost:8080/demo/jest/
notice the trailing forward slash in the URL above
Now you should see JEST home page with colorful icons. Enjoy browsing! - +
diff --git a/openjpa-examples/jest/build.properties b/openjpa-examples/jest/build.properties index 76e8ada8b..94f75f348 100644 --- a/openjpa-examples/jest/build.properties +++ b/openjpa-examples/jest/build.properties @@ -26,7 +26,7 @@ maven.repos=${user.home}/.m2/repository # OpenJPA version openjpa.version=2.2.0-SNAPSHOT -# The variable of interest are openjpa.dir and openjpa.jar. +# The variable of interest are openjpa.dir and openjpa.jar. # Though the varaible value is expressed in terms of other variables here, you can specify the value directly. openjpa.dir=${maven.repos}/org/apache/openjpa/openjpa-all/${openjpa.version} openjpa.jar=openjpa-all-${openjpa.version}.jar diff --git a/openjpa-examples/jest/build.xml b/openjpa-examples/jest/build.xml index 3ca430c77..ef936e6bc 100644 --- a/openjpa-examples/jest/build.xml +++ b/openjpa-examples/jest/build.xml @@ -7,15 +7,15 @@ 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. + under the License. --> @@ -50,7 +50,7 @@ - diff --git a/openjpa-examples/jest/src/main/java/demo/Actor.java b/openjpa-examples/jest/src/main/java/demo/Actor.java index 90142902c..54a9966ba 100644 --- a/openjpa-examples/jest/src/main/java/demo/Actor.java +++ b/openjpa-examples/jest/src/main/java/demo/Actor.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package demo; @@ -34,7 +34,7 @@ import org.apache.openjpa.persistence.FetchGroups; /** * A persistent entity with singular and plural association. - * + * * @author Pinaki Poddar * */ @@ -46,7 +46,7 @@ import org.apache.openjpa.persistence.FetchGroups; }) }) public class Actor { - public static enum Gender {Male, Female}; + public static enum Gender {Male, Female}; @Id private String id; private String firstName; @@ -57,11 +57,11 @@ public class Actor { private Actor partner; @OneToMany private Set movies; - + protected Actor() { - + } - + public Actor(String id, String firstName, String lastName, Gender gender, Date dob) { super(); this.id = id; diff --git a/openjpa-examples/jest/src/main/java/demo/DataLoader.java b/openjpa-examples/jest/src/main/java/demo/DataLoader.java index 47ccad6c1..de30d81f4 100644 --- a/openjpa-examples/jest/src/main/java/demo/DataLoader.java +++ b/openjpa-examples/jest/src/main/java/demo/DataLoader.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package demo; @@ -25,7 +25,7 @@ import javax.persistence.EntityManager; /** * Loads some example Actor-Movie data. - * + * * @author Pinaki Poddar * */ @@ -38,14 +38,14 @@ public class DataLoader { new Object[] {"m3", "Al", "Pacino", Actor.Gender.Male, new Date(50, 1, 12)}, new Object[] {"m4", "Jack", "Nichelson",Actor.Gender.Male, new Date(40, 4, 14)}, new Object[] {"m5", "Clint", "Eastwood", Actor.Gender.Male, new Date(50, 1, 12)}, - + new Object[] {"f1", "Meryl", "Streep", Actor.Gender.Female, new Date(40, 4, 14)}, new Object[] {"f2", "Fay", "Dunaway", Actor.Gender.Female, new Date(50, 1, 12)}, new Object[] {"f3", "Jodie", "Foster", Actor.Gender.Female, new Date(40, 4, 14)}, new Object[] {"f4", "Diane", "Keaton", Actor.Gender.Female, new Date(50, 1, 12)}, new Object[] {"f5", "Catherine", "Hepburn", Actor.Gender.Female, new Date(40, 4, 14)}, }; - + public static Object[][] MOVIE_DATA = { new Object[] {"1", "China Town", 1980}, new Object[] {"2", "Taxi Driver", 1980}, @@ -53,7 +53,7 @@ public class DataLoader { new Object[] {"4", "Godfather", 1980}, new Object[] {"5", "Horse Whisperer", 1980}, }; - + public static int[][] MOVIE_ACTORS = { new int[] {3,6}, new int[] {1,7}, @@ -61,7 +61,7 @@ public class DataLoader { new int[] {2,3,8}, new int[] {0} }; - + public static int[][] PARTNERS = { new int[] {3,6}, new int[] {1,7}, @@ -74,8 +74,8 @@ public class DataLoader { System.err.println("Found " + count + " Movie records in the database"); return; } - - + + Actor[] actors = createActors(); Movie[] movies = createMovies(); linkActorAndMovie(movies, actors); @@ -89,7 +89,7 @@ public class DataLoader { } em.getTransaction().commit(); } - + Actor[] createActors() { Actor[] actors = new Actor[ACTOR_DATA.length]; for (int i = 0; i < ACTOR_DATA.length; i++) { @@ -98,7 +98,7 @@ public class DataLoader { } return actors; } - + Movie[] createMovies() { Movie[] movies = new Movie[MOVIE_DATA.length]; for (int i = 0; i < MOVIE_DATA.length; i++) { @@ -107,7 +107,7 @@ public class DataLoader { } return movies; } - + void linkActorAndMovie(Movie[] movies, Actor[] actors) { for (int i = 0; i < MOVIE_ACTORS.length; i++) { int[] roles = MOVIE_ACTORS[i]; @@ -119,7 +119,7 @@ public class DataLoader { } } } - + void makePartner(Actor[] actors) { for (int i = 0; i < PARTNERS.length; i++) { int[] partners = PARTNERS[i]; @@ -129,5 +129,5 @@ public class DataLoader { a2.setPartner(a1); } } - + } diff --git a/openjpa-examples/jest/src/main/java/demo/Movie.java b/openjpa-examples/jest/src/main/java/demo/Movie.java index 962c3f0ad..cc0584cbf 100644 --- a/openjpa-examples/jest/src/main/java/demo/Movie.java +++ b/openjpa-examples/jest/src/main/java/demo/Movie.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package demo; @@ -49,38 +49,38 @@ public class Movie { private int year; @OneToMany(fetch=FetchType.EAGER) private Set actors; - + protected Movie() { - + } - + public Movie(String id, String title, int year) { super(); this.id = id; this.title = title; this.year = year; } - + public String getId() { return id; } - + public String getTitle() { return title; } - + public void addActor(Actor a) { if (actors == null) actors = new HashSet(); actors.add(a); } - + public Set getActors() { return actors; } - + public int getYear() { return year; } - + } diff --git a/openjpa-examples/jest/src/main/java/demo/SimpleApp.java b/openjpa-examples/jest/src/main/java/demo/SimpleApp.java index d05aeed16..c2538103b 100644 --- a/openjpa-examples/jest/src/main/java/demo/SimpleApp.java +++ b/openjpa-examples/jest/src/main/java/demo/SimpleApp.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package demo; @@ -42,7 +42,7 @@ import javax.servlet.http.HttpServletResponse; /** * A very simple servlet that is initialized with some example Actor-Movie records. - * + * * @author Pinaki Poddar * */ @@ -50,8 +50,8 @@ import javax.servlet.http.HttpServletResponse; public class SimpleApp extends HttpServlet { EntityManagerFactory _emf; private static String UNIT_NAME = "jestdemo"; - - @Override + + @Override public void init(ServletConfig config) throws ServletException { super.init(config); config.getServletContext().log("Initializing persistence unit [" + UNIT_NAME + "]"); @@ -65,7 +65,7 @@ public class SimpleApp extends HttpServlet { } config.getServletContext().log("Initialized with persistence unit [" + UNIT_NAME + "]"); } - + /** * The only response by this application is an index.html file. */ @@ -78,7 +78,7 @@ public class SimpleApp extends HttpServlet { out.write((char)c); } } - + @Override public void destroy() { if (_emf != null) { diff --git a/openjpa-examples/jest/src/main/resources/META-INF/persistence.xml b/openjpa-examples/jest/src/main/resources/META-INF/persistence.xml index 727b9fb41..1f5d26696 100644 --- a/openjpa-examples/jest/src/main/resources/META-INF/persistence.xml +++ b/openjpa-examples/jest/src/main/resources/META-INF/persistence.xml @@ -7,26 +7,26 @@ 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. + under the License. --> - + - + org.apache.openjpa.persistence.PersistenceProviderImpl - + demo.Movie demo.Actor - + @@ -37,7 +37,7 @@ - - + + diff --git a/openjpa-examples/jest/src/main/resources/WEB-INF/web.xml b/openjpa-examples/jest/src/main/resources/WEB-INF/web.xml index 708b18f83..00d3df06e 100644 --- a/openjpa-examples/jest/src/main/resources/WEB-INF/web.xml +++ b/openjpa-examples/jest/src/main/resources/WEB-INF/web.xml @@ -18,11 +18,11 @@ under the License. --> - - Demo Application with JEST Servlet + Demo Application with JEST Servlet index.html @@ -30,19 +30,19 @@ An example of deploying a simple web application with JEST servlet. This descriptor specifies the Demo Application servlet as well as JEST servlet. - + - + This is the Demo Application Servlet. The servlet is mapped to URL pattern /app/* so this servlet can be accessed as - http://host:port/demo/app/ + http://host:port/demo/app/ where "demo" is the name of the deployed web application. - - Assume that the Demo Application Servlet is using a persistence unit named + + Assume that the Demo Application Servlet is using a persistence unit named 'jestdemo'. The JEST Servlet will require the persistence unit name to - browse the Demo Application. + browse the Demo Application. - + demo demo.SimpleApp @@ -50,18 +50,18 @@ demo /* - + - This is the JEST servlet. + This is the JEST servlet. JEST Servlet needs to know the name of the persistence unit used by the Demo Application. The unit name is specified by mandatory "persistence.unit" parameter during initialization. - + The JEST servlet is mapped to URL pattern /jest/* in servlet mapping section. So to access JEST servlet, use the following URI http://host:port/demo/jest/ - Notice the trailing forward slash character is significant. + Notice the trailing forward slash character is significant. jest org.apache.openjpa.persistence.jest.JESTServlet @@ -78,5 +78,5 @@ jest /jest/* - + diff --git a/openjpa-examples/jest/src/main/resources/demo/index.html b/openjpa-examples/jest/src/main/resources/demo/index.html index 2b0d54340..06db7db19 100644 --- a/openjpa-examples/jest/src/main/resources/demo/index.html +++ b/openjpa-examples/jest/src/main/resources/demo/index.html @@ -28,36 +28,36 @@ body {background-image:url("images/back40.gif"); -

DNA: Do-Nothing Application

+

DNA: Do-Nothing Application


- DNA application is used to demonstrate + DNA application is used to demonstrate JEST.
DNA application is deployed as a HTTP Servlet.
- + The servlet creates an OpenJPA persistence unit at initialization.
- + It does nothing else, other than serving this single web page you are reading now. - The fact that you are reading this page means the persistence unit has been initialized. + The fact that you are reading this page means the persistence unit has been initialized.

- - + +

Requirement for enabling JEST

- + The requirements for an application to enable JEST are - +

► JEST Servlet must be deployed within the same module scope of the application.
► The unit name of the persistence unit used by the application must be known to JEST Servlet
► The persistence unit must be configured with
-    openjpa.EntityManagerFactoryPool=true +    openjpa.EntityManagerFactoryPool=true

Once JEST servlet knows the name of the persistence unit, it can
- + ► browse the domain model
► execute query
- from any web browser in a meta-data driven, generic fashion - i.e. without knowing anything further about he application. + from any web browser in a meta-data driven, generic fashion + i.e. without knowing anything further about he application.


@@ -73,7 +73,7 @@ body {background-image:url("images/back40.gif"); <servlet-name>demo</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> - + <!-- Deployment descriptor for JESTServlet. --> <servlet> <servlet-name>jest</servlet-name> diff --git a/openjpa-examples/openbooks/assembly.xml b/openjpa-examples/openbooks/assembly.xml index 45a9829bf..4d4cb91e7 100644 --- a/openjpa-examples/openbooks/assembly.xml +++ b/openjpa-examples/openbooks/assembly.xml @@ -7,15 +7,15 @@ 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. + under the License. --> binary diff --git a/openjpa-examples/openbooks/build.jee.liberty.xml b/openjpa-examples/openbooks/build.jee.liberty.xml index 742f916b3..962c3d240 100644 --- a/openjpa-examples/openbooks/build.jee.liberty.xml +++ b/openjpa-examples/openbooks/build.jee.liberty.xml @@ -7,15 +7,15 @@ 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. + under the License. --> @@ -25,16 +25,16 @@ - + - + - + - + @@ -42,12 +42,12 @@ - + - + @@ -64,7 +64,7 @@ Creating Derby JDBC provider and data source WAS Liberty Home: ${liberty.home} WAS Liberty Server: ${liberty.server} - + Nothing to do since "liberty.server" is not set... @@ -73,20 +73,20 @@ - + ------------------------------------------- Creating Derby JDBC Provider and DataSource WAS Home: ${liberty.home} WAS Server: ${liberty.server} - + Have to figure out how to configure datasources in server.xml... ------------------------------------- Deploying OpenBooks demo application - + Copying openbooks.war to dropins directory... Liberty server ${liberty.server} should automatically restart application... @@ -97,7 +97,7 @@ - + ------------------------------------- Start OpenBooks via http://localhost:9080/openbooks diff --git a/openjpa-examples/openbooks/build.jee.was.xml b/openjpa-examples/openbooks/build.jee.was.xml index d70253869..6ffaa8176 100644 --- a/openjpa-examples/openbooks/build.jee.was.xml +++ b/openjpa-examples/openbooks/build.jee.was.xml @@ -7,15 +7,15 @@ 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. + under the License. --> @@ -29,37 +29,37 @@ - + - + - + - + - + - + - + - + @@ -85,26 +85,26 @@ Uninstalling OpenBooks demo application WAS Home: ${was.home} - + - + --------------------------------------- Uninstalling OpenBooks demo application - + user="${was.user}" + password="${was.password}"/> - + @@ -112,32 +112,32 @@ Creating Derby JDBC provider and data source WAS Home: ${was.home} - - + ------------------------------------- Deploying OpenBooks demo application - - + ------------------------------------- Starting OpenBooks demo application - - + + - + ------------------------------------------- @@ -149,39 +149,39 @@ User: ${was.user} Password: Not shown - - + user="${was.user}" + password="${was.password}"/> + ------------------------------------- Deploying OpenBooks demo application - - + options="-usedefaultbindings -contextroot OpenBooks -appname OpenBooks"/> ------------------------------------- Starting OpenBooks demo application Start OpenBooks via http://server:port/OpenBooks - + user="${was.user}" + password="${was.password}"/> diff --git a/openjpa-examples/openbooks/build.jee.xml b/openjpa-examples/openbooks/build.jee.xml index b644ff92a..bfa1351c8 100644 --- a/openjpa-examples/openbooks/build.jee.xml +++ b/openjpa-examples/openbooks/build.jee.xml @@ -7,29 +7,29 @@ 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. + under the License. --> - + - + - - + + @@ -59,9 +59,9 @@ - @@ -73,27 +73,27 @@ - - + - - + @@ -108,11 +108,11 @@ - + - - - + diff --git a/openjpa-examples/openbooks/build.jse.xml b/openjpa-examples/openbooks/build.jse.xml index f3fbf186e..ec3e2a529 100644 --- a/openjpa-examples/openbooks/build.jse.xml +++ b/openjpa-examples/openbooks/build.jse.xml @@ -7,29 +7,29 @@ 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. + under the License. --> - + - + - + @@ -75,19 +75,19 @@ - - - + - - - + - + @@ -43,11 +43,11 @@ - + - + @@ -61,10 +61,10 @@ - + - @@ -73,8 +73,8 @@ - - @@ -84,13 +84,13 @@ - - - - + @@ -108,15 +108,15 @@ Deploy Location: ${deploy.dir} - - - + *** Error: - The directory for OpenJPA libraries can not be located at ${openjpa.lib}. - Make sure openjpa.lib property value is correct in build.properties file. + The directory for OpenJPA libraries can not be located at ${openjpa.lib}. + Make sure openjpa.lib property value is correct in build.properties file. @@ -131,7 +131,7 @@ - + - + @@ -161,16 +161,16 @@ - + - - + @@ -179,7 +179,7 @@ - + - - + @@ -222,12 +222,12 @@ - - + diff --git a/openjpa-examples/openbooks/index.html b/openjpa-examples/openbooks/index.html index e8006f4c4..b85b600bf 100644 --- a/openjpa-examples/openbooks/index.html +++ b/openjpa-examples/openbooks/index.html @@ -50,7 +50,7 @@ font-size:16px;

OpenBooks: A sample JPA 2.0 Application


- OpenBooks is a sample (and perhaps simple) application to demonstrate some of the new features of + OpenBooks is a sample (and perhaps simple) application to demonstrate some of the new features of version 2.0 of Java Persistence API (JPA) specification, such as
    @@ -60,20 +60,20 @@ font-size:16px;

- + OpenBooks runs with OpenJPA as its JPA provider.

Instructions to download and run OpenBooks Demo

- OpenBooks comes with + OpenBooks comes with
  1. complete source code -
  2. build scripts to demonstrate how to build a typical OpenJPA application and package it for JSE or JEE +
  3. build scripts to demonstrate how to build a typical OpenJPA application and package it for JSE or JEE environment -
  4. scripts to run OpenBooks in on your local database installation. +
  5. scripts to run OpenBooks in on your local database installation.

Follow the simple instructions below to build and run OpenBooks: - +
  1. Download OpenBooks distribution.
  2. Configure build and run environment. @@ -82,7 +82,7 @@ font-size:16px;

Download Instructions

- OpenBooks is distributed under Apache License, Version 2.0 + OpenBooks is distributed under Apache License, Version 2.0
OpenBooks can be checked out from OpenJPA repository.
@@ -95,70 +95,70 @@ font-size:16px;
  • Java Runtime version 6.0 or higher
  • OpenJPA Libraries version 2.0 or higher
  • Ant version 1.6 or higher -
  • Any JDBC complaint database supported by OpenJPA. +
  • Any JDBC complaint database supported by OpenJPA. See OpenJPA documentation for a list of supported databases.
    - +

    Configure build and run environment

    OpenBooks builds with Ant. The Ant build script is somewhat involved because OpenBooks can be built and packaged - either as a JSE (Swing based) application or a JEE Web Application. By default, OpenBooks is built as a + either as a JSE (Swing based) application or a JEE Web Application. By default, OpenBooks is built as a JSE application.
    Before you run a build, configure the build environment by editing - build.properties. - Essentially, you need to + build.properties. + Essentially, you need to
    1. point openjpa.lib variable to the local directory where OpenJPA class library(ies) reside. Notice that the variable points to a directory and not a *.jar file. All *.jar files found under the directory are included in compilation classpath. -
    +
    - The next step is to configure runtime environment. + The next step is to configure runtime environment.
      -
    1. Edit persistence.xml located in - resources/META-INF directory. +
    2. Edit persistence.xml located in + resources/META-INF directory. Modify the javax.persistence.jdbc.driver and javax.persistence.jdbc.url property to suit your local database and its driver.
      The example persistence.xml provided is primarily for a JSE environment. In JEE environment, you may already have a JTA data source configured and registered in JNDI. - Of course, then the persistence.xml is to be edited accordingly in - <jta-data-source> clause. -
    3. In JSE mode, edit run.properties to specify location of OpenJPA + Of course, then the persistence.xml is to be edited accordingly in + <jta-data-source> clause. +
    4. In JSE mode, edit run.properties to specify location of OpenJPA class libraries and JDBC Driver used in runtime classpath.
      In JEE mode, OpenJPA library and JDBC drivers are configured in JEE server and hence variables in - this file are irrelevant. -
    - - - Both build.properties and run.properties files are commented in-place on what is to be - edited. + this file are irrelevant. + + + + Both build.properties and run.properties files are commented in-place on what is to be + edited.
    - +

    Build OpenBooks from source

    - Once you have configured the environment, simply issue + Once you have configured the environment, simply issue
      $ ant
    or
      $ ant -Dbuild.mode=jee
    - The default target of the ant script will + The default target of the ant script will
  • generate metamodel classes (required for Criteria API)
  • compile the source code
  • enhance the persistence domain model
  • package the application based on the build.mode as a Swing-based application or a Web Application Archive. - and
  • copy the deployable artifacts to target/openbooks directory relative to the current directory. + and
  • copy the deployable artifacts to target/openbooks directory relative to the current directory.
    - -

    Run OpenBooks

    - If you have built OpenBooks for JSE, then go to the target/openbooks directory. + +

    Run OpenBooks

    + If you have built OpenBooks for JSE, then go to the target/openbooks directory.
    Invoke the Ant script to run OpenBooks
      $ ant -f run.xml - +
    If you have build OpenBooks for JEE, a Web Application Archive openbooks.war will be created in target/openbooks directory. You need to deploy openbooks.war @@ -168,16 +168,16 @@ font-size:16px;
    to access OpenBooks as an web application.
    - -

    Populate OpenBooks Database

    + +

    Populate OpenBooks Database

    OpenBooks checks for existing data at first connection to the database. If the database is empty, the schema is defined and populated with initial data. - However, you can explicitly populate the database in JSE build. - Edit load.properties - to specify load parameters such as number of Books etc. OpenBooks uses this data to populate a database - with some sample data. This example file has some typical values. If you are satisfied with it, + However, you can explicitly populate the database in JSE build. + Edit load.properties + to specify load parameters such as number of Books etc. OpenBooks uses this data to populate a database + with some sample data. This example file has some typical values. If you are satisfied with it, you can leave them as it is. Then invoke the Ant script
      $ ant -f run.xml load - + diff --git a/openjpa-examples/openbooks/pom.xml b/openjpa-examples/openbooks/pom.xml index ccd8d98d6..2a3be1bb6 100644 --- a/openjpa-examples/openbooks/pom.xml +++ b/openjpa-examples/openbooks/pom.xml @@ -7,19 +7,19 @@ 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. + under the License. --> - diff --git a/openjpa-examples/openbooks/run.properties b/openjpa-examples/openbooks/run.properties index a2aac40f5..01fe35fc0 100644 --- a/openjpa-examples/openbooks/run.properties +++ b/openjpa-examples/openbooks/run.properties @@ -16,7 +16,7 @@ # # ------------------------------------------------------------------------------- # Environment variables for provider specific library to run OpenBooks -# +# # ------------------------------------------------------------------------------- # Directory location of maven repository maven.repos=${user.home}/.m2/repository diff --git a/openjpa-examples/openbooks/run.xml b/openjpa-examples/openbooks/run.xml index 6a25f9061..1a7ca0af9 100644 --- a/openjpa-examples/openbooks/run.xml +++ b/openjpa-examples/openbooks/run.xml @@ -7,15 +7,15 @@ 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. + under the License. --> @@ -27,7 +27,7 @@ - + @@ -39,14 +39,14 @@ - + - - + + - + @@ -56,12 +56,12 @@ - + - + diff --git a/openjpa-examples/openbooks/scripts/liberty/server.xml b/openjpa-examples/openbooks/scripts/liberty/server.xml index 57faa5061..a6e5c8796 100644 --- a/openjpa-examples/openbooks/scripts/liberty/server.xml +++ b/openjpa-examples/openbooks/scripts/liberty/server.xml @@ -11,14 +11,14 @@ host="localhost" httpPort="9080" httpsPort="9443" /> - - - + + + - + - + \ No newline at end of file diff --git a/openjpa-examples/openbooks/scripts/was/ds_config.py b/openjpa-examples/openbooks/scripts/was/ds_config.py index 64fb9c375..aadd5a808 100644 --- a/openjpa-examples/openbooks/scripts/was/ds_config.py +++ b/openjpa-examples/openbooks/scripts/was/ds_config.py @@ -44,7 +44,7 @@ def getNodeId (): if (len(nodeList) == 1): node = nodeList[0] #endIf - + return node #endDef @@ -55,7 +55,7 @@ def getNodeId (): #----------------------------------------------------------------- def getServerId (): serverList = AdminConfig.list("Server").split("\n") - + server = serverList[0] return server #endDef @@ -63,7 +63,7 @@ def getServerId (): def addDatasourceProperty (datasourceId, name, value): parms = ["-propertyName", name, "-propertyValue", value] AdminTask.setResourceProperty(datasourceId, parms) -#endDef +#endDef # Set the default database provider to Derby DefaultProviderType="Derby" diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/AttributeLegendView.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/AttributeLegendView.java index 712fe5ecc..859c49b3c 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/AttributeLegendView.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/AttributeLegendView.java @@ -26,13 +26,13 @@ import javax.swing.JPanel; /** * Displays color codes of each attribute type. - * + * * @author Pinaki Poddar * */ @SuppressWarnings("serial") public class AttributeLegendView extends JPanel { - + public AttributeLegendView() { super(true); setBorder(BorderFactory.createTitledBorder("Attribute Legends")); @@ -41,13 +41,13 @@ public class AttributeLegendView extends JPanel { add(createColoredLabel("VERSION", Color.DARK_GRAY)); for (Attribute.PersistentAttributeType type : Attribute.PersistentAttributeType.values()) { add(createColoredLabel(type.toString().replace('_', ' '), MetamodelHelper.getColor(type))); - } + } } - + JComponent createColoredLabel(String text, Color c) { int width = 40; int height = 20; - BufferedImage bimage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + BufferedImage bimage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); for (int i = 0; i < width; i++) for (int j = 0; j < height; j++) bimage.setRGB(i, j, c.getRGB()); diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/AttributeView.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/AttributeView.java index 852667fa1..d29bc1274 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/AttributeView.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/AttributeView.java @@ -20,21 +20,21 @@ import javax.swing.JLabel; /** * View of a persistent attribute as a JLabel. - * + * * @author Pinaki Poddar * */ @SuppressWarnings("serial") public class AttributeView extends JLabel { private final Attribute _attr; - + public AttributeView(Attribute attr) { _attr = attr; Color color = MetamodelHelper.getColor(attr); setForeground(color); setText(MetamodelHelper.getDisplayName(attr)); } - + public Attribute getAttribute() { return _attr; } diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ConfigurationViewer.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ConfigurationViewer.java index 255aec8f2..52c7accbf 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ConfigurationViewer.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ConfigurationViewer.java @@ -24,9 +24,9 @@ import javax.swing.JTextPane; /** * Displays Properties. - * + * * @author Pinaki Poddar - * + * */ @SuppressWarnings("serial") public class ConfigurationViewer extends JTextPane { @@ -46,7 +46,7 @@ public class ConfigurationViewer extends JTextPane { replaceSelection(toString(config.get(key)) + "\r\n"); } } - + String toString(Object value) { if (value == null) return "null"; diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityDataModel.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityDataModel.java index 47e14ccc5..f712c00a8 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityDataModel.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityDataModel.java @@ -31,11 +31,11 @@ import javax.swing.table.TableModel; /** * A data model for a tabular view of a list of persistent entities. * The data supplied by this model can be filtered to display field values of - * basic type or single-valued or multi-valued relationships. + * basic type or single-valued or multi-valued relationships. *
    - * The meta-information about the attributes of the entity are supplied by + * The meta-information about the attributes of the entity are supplied by * newly defined {@link Metamodel meta-model API} of JPA 2.0 specification. - * + * * @author Pinaki Poddar * */ @@ -66,15 +66,15 @@ public class EntityDataModel extends AbstractTableModel implements TableModel private List> columnClasses; private List methods; private List data; - private List> attributes; + private List> attributes; private static Object[] EMPTY_ARGS = null; private static Class[] EMPTY_CLASSES = null; - + private boolean showsRowCount; private boolean showsBasicAttr; private boolean showsSingularAttr; private boolean showsPluralAttr; - + /** * Attributes of the entity are reordered with basic attributes, followed by singular * association followed by the many-valued attributes. @@ -83,17 +83,17 @@ public class EntityDataModel extends AbstractTableModel implements TableModel super(); this.data = data; EntityType entityType = meta.entity(cls); - + columnNames = new ArrayList(); columnClasses = new ArrayList>(); attributes = new ArrayList>(); methods = new ArrayList(); - + showsRowCount = (styleBits & ROW_COUNT) != 0; showsBasicAttr = (styleBits & BASIC_ATTR) != 0; showsSingularAttr = (styleBits & ASSOCIATION_ATTR) != 0; showsPluralAttr = (styleBits & PLURAL_ATTR) != 0; - + Set> sAttrs = entityType.getSingularAttributes(); if (showsBasicAttr) { for (SingularAttribute attr : sAttrs) { @@ -126,7 +126,7 @@ public class EntityDataModel extends AbstractTableModel implements TableModel methods.add(0, null); } } - + private void populate(Class cls, Attribute attr) { columnNames.add(attr.getName()); columnClasses.add(wrap(attr.getJavaType())); @@ -135,19 +135,19 @@ public class EntityDataModel extends AbstractTableModel implements TableModel /** * Gets the attribute at a given column index. - * Can be null for 0-th index if row count is being shown. + * Can be null for 0-th index if row count is being shown. */ - public Attribute getAttribute(int columnIndex) { + public Attribute getAttribute(int columnIndex) { return attributes.get(columnIndex); } - + /** * Gets the entity represented in the given row. */ public T getRow(int row) { return data.get(row); } - + @Override public Class getColumnClass(int columnIndex) { return columnClasses.get(columnIndex); @@ -176,7 +176,7 @@ public class EntityDataModel extends AbstractTableModel implements TableModel } Object row = data.get(rowIndex); Object val = getValueByReflection(rowIndex, row, columnIndex, method); - return val; + return val; } @Override @@ -209,7 +209,7 @@ public class EntityDataModel extends AbstractTableModel implements TableModel } return null; } - + Class wrap(Class c) { if (c == null || c.isInterface() || c.isArray()) return Object.class; @@ -225,7 +225,7 @@ public class EntityDataModel extends AbstractTableModel implements TableModel } return c; } - + private Method getMethod(Class type, String p) { try { String getter = "get" + Character.toUpperCase(p.charAt(0))+p.substring(1); @@ -234,9 +234,9 @@ public class EntityDataModel extends AbstractTableModel implements TableModel e.printStackTrace(); } return null; - + } - + public void updateData(List newData) { data = newData; fireTableDataChanged(); @@ -246,5 +246,5 @@ public class EntityDataModel extends AbstractTableModel implements TableModel public Iterator iterator() { return data.iterator(); } - + } diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTable.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTable.java index 414565d18..48a520c2f 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTable.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTable.java @@ -42,9 +42,9 @@ import org.apache.openjpa.enhance.StateManager; * that is supplied at construction. *
    * The table view uses specialized cell renderer to display single-valued and multi-valued - * association. - * - * + * association. + * + * * @author Pinaki Poddar * */ @@ -52,27 +52,27 @@ import org.apache.openjpa.enhance.StateManager; public class EntityTable extends JTable { private InstanceCellRenderer instanceCellRenderer; private CollectionCellRenderer collectionCellRenderer; - + public EntityTable(Class cls, List data, int styleBits, EntityManagerFactory unit) { super(); instanceCellRenderer = new InstanceCellRenderer(unit.getPersistenceUnitUtil()); collectionCellRenderer = new CollectionCellRenderer(); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - + setModel(new EntityDataModel(cls, data, unit.getMetamodel(), styleBits)); getModel().addTableModelListener(this); initColumnSizes(); setFillsViewportHeight(true); } - - + + public InstanceCellRenderer getInstanceRenderer() { return instanceCellRenderer; } - + /** * Gets the special renderer for single- and multi-valued association. - * Otherwise uses the super classes' renderer defined by the field type. + * Otherwise uses the super classes' renderer defined by the field type. */ public TableCellRenderer getCellRenderer(int row, int column) { Attribute attr = ((EntityDataModel)getModel()).getAttribute(column); @@ -89,10 +89,10 @@ public class EntityTable extends JTable { if (renderer instanceof DefaultTableCellRenderer) { ((DefaultTableCellRenderer)renderer).setHorizontalAlignment(JLabel.CENTER); } - + return renderer; } - + public TableCellEditor getCellEditor(int row, int column) { Attribute attr = ((EntityDataModel)getModel()).getAttribute(column); if (attr == null) @@ -101,7 +101,7 @@ public class EntityTable extends JTable { return new DefaultCellEditor((JComboBox)getCellRenderer(row, column)); return super.getCellEditor(row, column); } - + /** * Picks good column sizes. * If all column heads are wider than the column's cells' @@ -112,7 +112,7 @@ public class EntityTable extends JTable { TableColumn column = null; Component comp = null; int headerWidth = 0; - + TableCellRenderer headerRenderer = getTableHeader().getDefaultRenderer(); for (int columnIndex = 0; columnIndex < model.getColumnCount(); columnIndex++) { @@ -126,7 +126,7 @@ public class EntityTable extends JTable { TableCellRenderer renderer = getCellRenderer(0, columnIndex); int rowCount = Math.min(model.getRowCount(), 10); for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) { - Object value = model.getValueAt(rowIndex, columnIndex); + Object value = model.getValueAt(rowIndex, columnIndex); comp = renderer.getTableCellRendererComponent( this, value, false, false, rowIndex, columnIndex); @@ -135,26 +135,26 @@ public class EntityTable extends JTable { column.setPreferredWidth(Math.max(headerWidth, cellWidth)); } } - + /** * Renders the value of a persistent entity in a table column as the persistent identifier. * The persistent identifier is extracted by the new {@link PersistenceUnitUtil utility} feature * of JPA 2.0 API. - * + * * @author Pinaki Poddar * */ public class InstanceCellRenderer extends DefaultTableCellRenderer { private final PersistenceUnitUtil util; - + public InstanceCellRenderer(PersistenceUnitUtil util) { super(); this.util = util; } - + /** * Gets the stringified persistence identifier of the given instance. - * + * */ public String renderAsString(Object instance) { if (instance == null) { @@ -178,10 +178,10 @@ public class EntityTable extends JTable { } - + /** * Renders a many-valued attribute as simply three dots. - * + * * @author Pinaki Poddar * */ @@ -190,9 +190,9 @@ public class EntityTable extends JTable { setPreferredSize(new Dimension(10,20)); } @Override - public Component getTableCellRendererComponent(JTable table, Object value, + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - return super.getTableCellRendererComponent(table, value == null ? null : "...", + return super.getTableCellRendererComponent(table, value == null ? null : "...", isSelected, hasFocus, row, column); } @@ -200,5 +200,5 @@ public class EntityTable extends JTable { - + } diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTableView.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTableView.java index 1085cab15..0f0dac207 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTableView.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTableView.java @@ -38,7 +38,7 @@ import jpa.tools.swing.EntityTable.InstanceCellRenderer; /** * An entity table view consists of a JTable and optionally another table for many-valued associations. - * + * * @author Pinaki Poddar * */ @@ -46,16 +46,16 @@ import jpa.tools.swing.EntityTable.InstanceCellRenderer; public class EntityTableView extends JPanel implements ListSelectionListener { private EntityTable _table; private JTextArea _details; - + public EntityTableView(Class cls, int styleBits, EntityManagerFactory unit) { this(cls, (List)Collections.EMPTY_LIST, styleBits, unit); } - + public EntityTableView(Class cls, List data, int styleBits, EntityManagerFactory unit) { super(true); _table = new EntityTable(cls, data, styleBits, unit); _table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - + if ((styleBits & EntityDataModel.PLURAL_ATTR) != 0) { _table.getSelectionModel().addListSelectionListener(this); _details = new JTextArea("Click many-valued columns for display"); @@ -65,23 +65,23 @@ public class EntityTableView extends JPanel implements ListSelectionListener } setBorder(BorderFactory.createTitledBorder(_table.getModel().getRowCount() + " " + unit.getMetamodel().entity(cls).getName())); - + setLayout(new BoxLayout(this,BoxLayout.Y_AXIS)); - add(new JScrollPane(_table, - JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + add(new JScrollPane(_table, + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS)); if (_details != null) add(_details); } - + public EntityTable getTable() { return _table; } - + public EntityDataModel getDataModel() { return (EntityDataModel)_table.getModel(); } - + public void updateTitle(String txt) { Border border = getBorder(); if (border instanceof TitledBorder) { @@ -108,15 +108,15 @@ public class EntityTableView extends JPanel implements ListSelectionListener showDetails(attr, val); } } - + private void showDetails(Attribute attr, Object val) { _details.setText(null); ManagedType owner = attr.getDeclaringType(); - String title = (owner instanceof EntityType) + String title = (owner instanceof EntityType) ? ((EntityType)owner).getName() + "." + attr.getName() - : owner.getJavaType().getSimpleName() + "." + attr.getName(); + : owner.getJavaType().getSimpleName() + "." + attr.getName(); TitledBorder border = (TitledBorder)_details.getBorder(); - + if (val == null) { border.setTitle(title + " (null)"); } else { diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTypeView.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTypeView.java index 6ce30a4bb..54c8b4098 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTypeView.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/EntityTypeView.java @@ -27,7 +27,7 @@ import javax.swing.JPanel; /** * View of a persistent entity type as a JPanel. - * + * * @author Pinaki Poddar * */ @@ -36,14 +36,14 @@ public class EntityTypeView extends JPanel { final EntityType type; final int hgap = 4; final int vgap = 4; - + public EntityTypeView(EntityType type) { this.type = type; GridLayout layout = new GridLayout(0,1); setLayout(layout); layout.setVgap(vgap); layout.setHgap(hgap); - + setBackground(Color.WHITE); setBorder(BorderFactory.createTitledBorder(MetamodelHelper.getDisplayName(type))); @@ -58,12 +58,12 @@ public class EntityTypeView extends JPanel { } // setPreferredSize(new Dimension(w,h)); } - + public EntityType getEntityType() { return type; } - - + + /** * Gets the top left position of the attribute label relative to this entity view. */ diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ErrorDialog.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ErrorDialog.java index aea4b78da..ed8fad3dc 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ErrorDialog.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ErrorDialog.java @@ -35,25 +35,25 @@ import javax.swing.JTextPane; /** * A dialog to display runtime error. - * + * * @author Pinaki Poddar * */ @SuppressWarnings("serial") public class ErrorDialog extends JDialog { private static List filters = Arrays.asList( - "java.awt.", - "javax.swing.", + "java.awt.", + "javax.swing.", "sun.reflect.", "java.util.concurrent."); private static Dimension MESSAGE_SIZE = new Dimension(600,200); private static Dimension STACKTRACE_SIZE = new Dimension(600,300); private static Dimension TOTAL_SIZE = new Dimension(600,500); - - + + static String NEWLINE = "\r\n"; static String INDENT = " "; - + private boolean _showingDetails; private boolean _isFiltering = true; private JComponent _message; @@ -61,10 +61,10 @@ public class ErrorDialog extends JDialog { private JScrollPane _details; private JTextPane _stacktrace; private final Throwable _error; - + /** * Creates a modal dialog to display the given exception message. - * + * * @param t the exception to display */ public ErrorDialog(Throwable t) { @@ -74,10 +74,10 @@ public class ErrorDialog extends JDialog { public ErrorDialog(JComponent owner, Throwable t) { this(owner, null, t); } - + /** * Creates a modal dialog to display the given exception message. - * + * * @param owner if non-null, then the dialog is positioned (centered) w.r.t. this component * @param t the exception to display */ @@ -85,7 +85,7 @@ public class ErrorDialog extends JDialog { super(); setTitle(t.getClass().getName()); setModal(true); - if (icon != null && icon instanceof ImageIcon) + if (icon != null && icon instanceof ImageIcon) setIconImage(((ImageIcon)icon).getImage()); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); _error = t; @@ -96,11 +96,11 @@ public class ErrorDialog extends JDialog { pack(); SwingHelper.position(this, owner); } - + /** - * Creates the display with the top-level exception message + * Creates the display with the top-level exception message * followed by a pane (that toggles) for detailed stack traces. - * + * * @param t a non-null exception */ JComponent createContent() { @@ -129,7 +129,7 @@ public class ErrorDialog extends JDialog { } }); JPanel messagePanel = new JPanel(); - + final JCheckBox filter = new JCheckBox("Filter stack traces"); filter.setSelected(_isFiltering); filter.addActionListener(new ActionListener(){ @@ -151,16 +151,16 @@ public class ErrorDialog extends JDialog { messagePanel.add(_message, BorderLayout.CENTER); messagePanel.add(buttonPanel, BorderLayout.SOUTH); messagePanel.setPreferredSize(MESSAGE_SIZE); - + JPanel main = new JPanel(); main.setLayout(new BorderLayout()); main.add(messagePanel, BorderLayout.NORTH); return main; } - + /** * Creates a non-editable widget to display the error message. - * + * */ JComponent createErrorMessage(Throwable t) { String txt = t.getLocalizedMessage(); @@ -170,23 +170,23 @@ public class ErrorDialog extends JDialog { message.setText(txt); return message; } - + /** * Creates a non-editable widget to display the detailed stack trace. */ JScrollPane createDetailedMessage(Throwable t) { _stacktrace = new JTextPane(); _stacktrace.setEditable(false); - JScrollPane pane = new JScrollPane(_stacktrace, - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane pane = new JScrollPane(_stacktrace, + JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - + return pane; } - + /** * Recursively print the stack trace on the given buffer. - */ + */ StringBuilder generateStackTrace(Throwable t, StringBuilder buffer) { buffer.append(t.getClass().getName() + ": " + t.getMessage() + NEWLINE); buffer.append(toString(t.getStackTrace())); @@ -196,7 +196,7 @@ public class ErrorDialog extends JDialog { } return buffer; } - + StringBuilder toString(StackTraceElement[] traces) { StringBuilder error = new StringBuilder(); for (StackTraceElement e : traces) { @@ -207,7 +207,7 @@ public class ErrorDialog extends JDialog { } return error; } - + /** * Affirms if the error messages from the given class name is to be suppressed. */ @@ -218,12 +218,12 @@ public class ErrorDialog extends JDialog { } return false; } - + public static void main(String[] args) { - String m1 = "This is test error with very very very very very long line of error message that " + String m1 = "This is test error with very very very very very long line of error message that " + " should not be in a single line. Another message string that shoul dbe split across word." + "The quick brown fox jumpled over the lazy dog"; - String m2 = "This is another test error with very long line of error message that " + String m2 = "This is another test error with very long line of error message that " + " should not be in a single line"; Throwable nested = new NumberFormatException(m2); Throwable top = new IllegalArgumentException(m1, nested); diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/FileScanner.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/FileScanner.java index bbabbfcb3..911c813e3 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/FileScanner.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/FileScanner.java @@ -26,21 +26,21 @@ import java.util.List; public class FileScanner { private String ext; boolean recursive; - + public FileScanner(String ext, boolean recurse) { this.ext = ext; this.recursive = recurse; } - + /** - * Scans the given + * Scans the given */ public List scan(File dir) { List bag = new ArrayList(); scan(dir, bag); return bag; } - + private void scan(File dir, List bag) { if (dir == null || !dir.exists() || !dir.isDirectory()) return; @@ -54,5 +54,5 @@ public class FileScanner { } } } - + } diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/Finder.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/Finder.java index 5cbfd3dad..4e7461097 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/Finder.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/Finder.java @@ -29,19 +29,19 @@ import java.util.jar.JarFile; /** * Searches for a given class in the set of directories recursively. * If a given directory contains jar file then searches inside the jar. - * + * * Usage * $ java find.Finder class dir1 dir2... * where * class is fully qualified class name * dir name of a file system directory - * + * * Example * $ java find.Finder org.eclipse.ui.plugin.AbstractUIPlugin c:\eclipse\plugins * will print - * org.eclipse.ui.plugin.AbstractUIPlugin found in + * org.eclipse.ui.plugin.AbstractUIPlugin found in * c:\eclipse\plugins\org.eclipse.ui.workbench_3.4.1.M20080827-0800a.jar - * + * * @author Pinaki Poddar * */ @@ -50,7 +50,7 @@ public class Finder { private static final String JAR_SUFFIX = ".jar"; private static final char DOT = '.'; private static final boolean DEBUG = false; - + private static void usage() { System.err.println("Searches a given class in the given directories." + "\r\nIf a given directory contains jar then searches within the jar." @@ -64,7 +64,7 @@ public class Finder { System.err.println("\r\n Example:"); System.err.println(" $ java find.Finder java.lang.Object c:\\java"); } - + public static void main(String[] args) throws Exception { if (args.length < 2) { usage(); @@ -76,7 +76,7 @@ public class Finder { finder.scan(root, args[0]); } } - + private void scan(File dir, String cls) throws IOException { File[] classes = dir.listFiles(new FileFilter() { public boolean accept(File path) { @@ -95,21 +95,21 @@ public class Finder { return path.getName().endsWith(JAR_SUFFIX); } }); - + for (File jar : jars) { JarFile jarFile = new JarFile(jar); scan(jarFile, cls); } - + File[] dirs = dir.listFiles(new FileFilter() { public boolean accept(File path) { return path.isDirectory(); } }); - for (File cdir : dirs) + for (File cdir : dirs) scan(cdir, cls); } - + private void scan(JarFile jar, String cls) { String clsName = cls.replace('.', '/') + CLASS_SUFFIX; debug("Scanning " + jar.getName() + " for [" + clsName + "]"); @@ -123,7 +123,7 @@ public class Finder { System.err.println(cls + " found in " + jar.getName()); } } - + private void debug(String s) { if (DEBUG) System.err.println(s); diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/GraphicOutputStream.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/GraphicOutputStream.java index c89c29ec2..e83cc30cf 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/GraphicOutputStream.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/GraphicOutputStream.java @@ -24,7 +24,7 @@ import javax.swing.text.StyleContext; /** * An output stream that uses a {@link ScrollingTextPane} as its sink. * Flushes the buffer at line end. - * + * * @author Pinaki Poddar * */ @@ -35,15 +35,15 @@ public class GraphicOutputStream extends OutputStream { private Map _styles = new HashMap(); private static AttributeSet _defaultStyle = StyleContext.getDefaultStyleContext() .getStyle(StyleContext.DEFAULT_STYLE); - + public GraphicOutputStream(ScrollingTextPane delegate) { _sink = delegate; } - + public void registerStyle(String pattern, AttributeSet style) { _styles.put(pattern, style); } - + @Override public void write(int b) throws IOException { buffer[count++] = (char)b; @@ -51,7 +51,7 @@ public class GraphicOutputStream extends OutputStream { flushBuffer(); } } - + private void flushBuffer() { String txt = new String(buffer, 0, count); count = 0; @@ -59,7 +59,7 @@ public class GraphicOutputStream extends OutputStream { _sink.setCharacterAttributes(style, true); _sink.appendText(txt); } - + AttributeSet getStyle(String txt) { if (txt == null || txt.isEmpty()) return _defaultStyle; diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/IndexedMap.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/IndexedMap.java index 34a2afad5..d2babd7ab 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/IndexedMap.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/IndexedMap.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package jpa.tools.swing; @@ -31,8 +31,8 @@ import java.util.Set; * The index of a given key is stable. It never changes unless the map is cleared. * On remove(k), the key is not removed, but its value is nullified. * Then indexOf(k) will return -1. - * - * + * + * * @author Pinaki Poddar * * @param @@ -42,45 +42,45 @@ public class IndexedMap implements Map { private final List _keys = new ArrayList(); private final List _values = new ArrayList(); private final Set _nulls = new HashSet(); - + public void clear() { _keys.clear(); _values.clear(); } - - + + public boolean containsKey(Object key) { return _keys.contains(key) && !_nulls.contains(key); } - - + + public boolean containsValue(Object value) { return _values.contains(value); } - + /** * Not supported. */ public Set> entrySet() { throw new UnsupportedOperationException(); } - - + + public V get(Object key) { int i = indexOf(key); return i == -1 ? null : _values.get(i); } - + public boolean isEmpty() { return (_keys.size() - _nulls.size()) == 0; } - + public Set keySet() { Set result = new HashSet(_keys); result.removeAll(_nulls); return result; } - + public V put(K key, V value) { int i = _keys.indexOf(key); if (i == -1) { @@ -92,24 +92,24 @@ public class IndexedMap implements Map { return _values.set(i, value); } } - + public void putAll(Map m) { for (K k : m.keySet()) { this.put(k, m.get(k)); } } - + @SuppressWarnings("unchecked") public V remove(Object key) { V v = get(key); _nulls.add((K)key); return v; } - + public int size() { return _keys.size() - _nulls.size(); } - + public Collection values() { Collection result = new ArrayList(); for (int i = 0; i < _values.size(); i++) { @@ -118,7 +118,7 @@ public class IndexedMap implements Map { } return result; } - + public int indexOf(Object key) { return _keys.indexOf(key); } diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/MetamodelHelper.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/MetamodelHelper.java index 6bc21185d..35639054e 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/MetamodelHelper.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/MetamodelHelper.java @@ -34,7 +34,7 @@ import javax.persistence.metamodel.Type; /** * Static utility for analyzing persistent metadata model using JPA 2.0. - * + * * @author Pinaki Poddar * */ @@ -44,25 +44,25 @@ public class MetamodelHelper { public static final int ATTR_BASIC = 2; public static final int ATTR_SINGULAR_RELATION = 3; public static final int ATTR_PLURAL_RELATION = 4; - + public static final Color MIDNIGHT_BLUE = new Color(25,25,112); public static final Color DARK_GREEN = new Color(0,100,0); public static final Color KHAKI = new Color(240, 230, 140); - + public static String getDisplayName(Type type) { if (type instanceof EntityType) { return getDisplayName((EntityType)type); } return getDisplayName(type.getJavaType()); } - + /** * Gets the displayed name of a given entity type. */ public static String getDisplayName(EntityType type) { return type.getName(); } - + public static String getDisplayName(Class cls) { String fullName = cls.getName(); if (fullName.startsWith("java.") || fullName.startsWith("openbook.domain.")) { @@ -71,8 +71,8 @@ public class MetamodelHelper { } return fullName; } - - + + public static String getDisplayName(Attribute attr) { StringBuilder buffer = new StringBuilder(); buffer.append(getDisplayName(attr.getJavaType())); @@ -81,18 +81,18 @@ public class MetamodelHelper { .append(getDisplayName(((MapAttribute)attr).getElementType())).append(">"); } else if (attr instanceof PluralAttribute) { buffer.append("<").append(getDisplayName(((PluralAttribute)attr).getElementType())).append(">"); - } + } buffer.append(" ").append(attr.getName()); return buffer.toString(); } - - + + public static List> getAttributes(EntityType type) { List> list = new ArrayList>(type.getAttributes()); Collections.sort(list, new AttributeComparator()); return list; } - + public static int getAttributeType(Attribute a) { if (a instanceof SingularAttribute) { SingularAttribute sa = (SingularAttribute)a; @@ -105,9 +105,9 @@ public class MetamodelHelper { if (a.isCollection()) return ATTR_PLURAL_RELATION; } return ATTR_BASIC; - + } - + public static Set> getIdAttributes(EntityType type) { Set> attrs = type.getSingularAttributes(); Set> idAttrs = new HashSet>(); @@ -118,7 +118,7 @@ public class MetamodelHelper { } return idAttrs; } - + /** * Finds the derived target of the given type, if any. Otherwise null. */ @@ -132,7 +132,7 @@ public class MetamodelHelper { } return null; } - + public static EntityType getParentType(SingularAttribute id) { if (id.getType() instanceof EntityType) { return (EntityType)id.getType(); @@ -140,7 +140,7 @@ public class MetamodelHelper { return null; } - + public static boolean isId(Attribute a) { if (a instanceof SingularAttribute) return ((SingularAttribute)a).isId(); @@ -151,7 +151,7 @@ public class MetamodelHelper { return ((SingularAttribute)a).isVersion(); return false; } - + public static Color getColor(Attribute attr) { if (isId(attr)) return Color.RED; @@ -159,7 +159,7 @@ public class MetamodelHelper { return Color.DARK_GRAY; return getColor(attr.getPersistentAttributeType()); } - + public static Color getColor(Attribute.PersistentAttributeType type) { switch (type) { case BASIC : return Color.BLACK; @@ -172,18 +172,18 @@ public class MetamodelHelper { default: return Color.BLACK; } } - + public static Integer getAttributeTypeCode(Attribute attr) { if (isId(attr)) return 0; if (isVersion(attr)) return 1; - + switch (attr.getPersistentAttributeType()) { - case BASIC : + case BASIC : case EMBEDDED: return 2; - case ONE_TO_ONE: + case ONE_TO_ONE: case MANY_TO_ONE: return 3; case ONE_TO_MANY: @@ -217,7 +217,7 @@ public class MetamodelHelper { return null; } } - + private static Method getMethod(Class type, String p) { try { String getter = "get" + Character.toUpperCase(p.charAt(0))+p.substring(1); @@ -226,13 +226,13 @@ public class MetamodelHelper { e.printStackTrace(); } return null; - + } - + /** * Compares EntityType by their dependency of derived targets. - * + * * @author Pinaki Poddar * */ @@ -245,18 +245,18 @@ public class MetamodelHelper { return -1; return o1.getName().compareTo(o2.getName()); } - + } - + /** * Compares attribute by their qualification. - * Identity + * Identity * Version * Basic * Singular association * Plural association - * + * * @author Pinaki Poddar * */ diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/MetamodelView.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/MetamodelView.java index 24c420df9..2fa09d620 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/MetamodelView.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/MetamodelView.java @@ -37,22 +37,22 @@ import javax.swing.JPanel; * Hence the view is organized in terms of corresponding views of {@link EntityTypeView entity} * and their {@link AttributeView attributes}. *
    - * This view also draws linkage with A*-algorithm between the derived primary key attributes that - * reference other entity types. - * + * This view also draws linkage with A*-algorithm between the derived primary key attributes that + * reference other entity types. + * * @author Pinaki Poddar * */ @SuppressWarnings("serial") public class MetamodelView extends JPanel implements Maze { - + private static final int GRID = 8; int hgap = 40; int vgap = 40; - + /** * Creates a panel where each {@link EntityTypeView} is placed in a FlowLayout. - * Only the entities of the model are ordered based on their primary key + * Only the entities of the model are ordered based on their primary key * dependencies, if any. */ @SuppressWarnings("unchecked") @@ -70,7 +70,7 @@ public class MetamodelView extends JPanel implements Maze { add(view); } } - + EntityTypeView findViewByType(EntityType type) { if (type == null) return null; @@ -84,7 +84,7 @@ public class MetamodelView extends JPanel implements Maze { } return null; } - + @Override public void paint(Graphics g) { super.paint(g); @@ -97,11 +97,11 @@ public class MetamodelView extends JPanel implements Maze { EntityTypeView target = findViewByType(MetamodelHelper.getParentType(id)); if (target == null) continue; - + PathFinder runner = new PathFinder(this); Point start = getConnectLocation(view, id); Point finish = target.getLocation(); - List path = runner.findPath(start.x/GRID, start.y/GRID, + List path = runner.findPath(start.x/GRID, start.y/GRID, finish.x/GRID, finish.y/GRID); if (path.isEmpty()) continue; @@ -115,20 +115,20 @@ public class MetamodelView extends JPanel implements Maze { g.setColor(Color.BLACK); int r = 4; g.fillOval(p1.x*GRID -r, p1.y*GRID - r, 2*r, 2*r); - + } } } - + /** - * Gets the position of the attribute in the entity view relative to this panel. + * Gets the position of the attribute in the entity view relative to this panel. */ Point getConnectLocation(EntityTypeView a, Attribute attr) { Point p1 = a.getLocation(); Point p2 = a.getPosition(attr); return new Point(p1.x + p2.x, p1.y + p2.y); } - + // contract for the maze @Override public boolean isReachable(int x, int y) { @@ -136,7 +136,7 @@ public class MetamodelView extends JPanel implements Maze { Rectangle r = view.getBounds(); int px = x*GRID; int py = y*GRID; - if (r.contains(px, py)) + if (r.contains(px, py)) return false; } return true; diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PathFinder.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PathFinder.java index e8ae1047b..a70543586 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PathFinder.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PathFinder.java @@ -21,17 +21,17 @@ import java.util.List; /** * A* Algorithm to find rectilinear path through a {@link Maze}. - * + * * @author Pinaki Poddar * */ public class PathFinder { private final Maze _maze; - + public PathFinder(Maze maze) { _maze = maze; } - + /** * A* algorithm to find a path through a maze. * The algorithm follows these steps @@ -40,13 +40,13 @@ public class PathFinder { *
  • Current node is the lowest cost square on the open list *
  • Move current node to the closed list. *
  • For each of adjacent neighbor n to this current square - *
  • If n is not {@link Maze#isReachable(int, int) reachable} or if n is on the closed list, ignore. + *
  • If n is not {@link Maze#isReachable(int, int) reachable} or if n is on the closed list, ignore. * Otherwise do the following. - *
  • If n is not on the open list, add it to the open list. Make the current square - * the parent of n. Record the cost of n. - *
  • If n is on the open list already, replace if this path to n is lower cost. + *
  • If n is not on the open list, add it to the open list. Make the current square + * the parent of n. Record the cost of n. + *
  • If n is on the open list already, replace if this path to n is lower cost. * until the target node is added to the closed list, or fail to find the target square - * i.e. the open list is empty. + * i.e. the open list is empty. * * @param x1 the x-coordinate of the starting point * @param y1 the y-coordinate of the starting point @@ -69,11 +69,11 @@ public class PathFinder { } } while (!openList.isEmpty() && findMatchingNode(x2, y2, closedList) == null); target = findMatchingNode(x2, y2, closedList); - if (target == null) + if (target == null) return traceBackPath(closedList.get(closedList.size()-1)); return traceBackPath(target); } - + private void exploreNeighbours(Node current, Node target, List openList, List closedList) { insertNeighbour(current, current.x+1, current.y, target, openList, closedList); insertNeighbour(current, current.x-1, current.y, target, openList, closedList); @@ -81,7 +81,7 @@ public class PathFinder { insertNeighbour(current, current.x, current.y-1, target, openList, closedList); Collections.sort(openList); } - + private Node insertNeighbour(Node n, int x, int y, Node target, List openList, List closedList) { if (distance(x,y,target) != 0) { if (!_maze.isReachable(x, y) || findMatchingNode(x, y, closedList) != null) { @@ -102,7 +102,7 @@ public class PathFinder { } return m; } - + private Node findMatchingNode(int x, int y, List list) { for (Node n : list) { if (n.x == x && n.y == y) @@ -110,17 +110,17 @@ public class PathFinder { } return null; } - + int distance(Node n, Node m) { return Math.abs(n.x - m.x) + Math.abs(n.y - m.y); } int distance(int x, int y, Node m) { return Math.abs(x - m.x) + Math.abs(y - m.y); } - + List traceBackPath(Node target) { LinkedList path = new LinkedList(); - path.add(new Point(target.x, target.y)); + path.add(new Point(target.x, target.y)); Node next = target.parent; while (next != null) { path.add(0,new Point(next.x, next.y)); @@ -128,7 +128,7 @@ public class PathFinder { } return straighten(path); } - + List straighten(List path) { if (path.size() < 3) return path; @@ -146,18 +146,18 @@ public class PathFinder { path.removeAll(mids); return path; } - + private static class Node implements Comparable { int f,g,h; int x; int y; Node parent; - + public Node(Node p, int x, int y) { parent = p; this.x = x; this.y = y; } - + public boolean equals(Object o) { if (this == o) return true; if (o instanceof Node) { @@ -172,7 +172,7 @@ public class PathFinder { if (f == o.f) return 0; return f > o.f ? 1 : -1; } - + public String toString() { return "(" + x + "," + y + ":" + g + ")"; } diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PowerPointViewer.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PowerPointViewer.java index 1b2806423..49415dff2 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PowerPointViewer.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PowerPointViewer.java @@ -36,7 +36,7 @@ import openbook.client.Images; /** * Displays and navigates PowerPoint slides. - * + * * @author Pinaki Poddar * */ @@ -50,16 +50,16 @@ public class PowerPointViewer extends JPanel { private JSpinner _goto; private JButton[] _navButtons; private int MAX_BUTTONS = 10; // Total number of navigation buttons excluding the PREVIOUS and NEXT button. - + // The slide private JLabel _view; - - // The key for client property in the navigation buttons denoting the 0-based index of the slides. + + // The key for client property in the navigation buttons denoting the 0-based index of the slides. private static final String SLIDE_INDEX = "slide.index"; - + /** * Create a viewer with slides in the specified directory. - * + * * @param dir path to a directory containing PowerPoint slides. * @param slides name of the slides */ @@ -71,21 +71,21 @@ public class PowerPointViewer extends JPanel { for (int i = 0; i < _total; i++) { _slides.add(null); } - + setLayout(new BorderLayout()); _view = new JLabel(getSlideAt(0)); add(new JScrollPane(_view), BorderLayout.CENTER); add(createNavigationButtons(), BorderLayout.SOUTH); } - + /** * Create buttons to navigate the slides. - * + * * @return a panel containing the navigation buttons. */ private JPanel createNavigationButtons() { JPanel buttons = new JPanel(); - _navButtons = new JButton[Math.min(MAX_BUTTONS, _total)]; + _navButtons = new JButton[Math.min(MAX_BUTTONS, _total)]; _prev = new RoundButton(Images.BACK); buttons.add(_prev); _prev.addActionListener(new ActionListener() { @@ -128,9 +128,9 @@ public class PowerPointViewer extends JPanel { } }); return buttons; - + } - + /** * Show the next page. */ @@ -141,7 +141,7 @@ public class PowerPointViewer extends JPanel { current += 1; showPage(current); } - + private void prevPage() { int current = getCurrentPageIndex(); if (current <= 0) @@ -149,44 +149,44 @@ public class PowerPointViewer extends JPanel { current -= 1; showPage(current); } - + int getCurrentPageIndex() { return (Integer)_goto.getValue()-1; } - + /** * Shows the slide at the given index. - * + * * @param index 0-based index of the slides. */ private void showPage(int index) { _view.setIcon(getSlideAt(index)); updateButtons(index); } - + /** * Updates the buttons. - * + * * @param current 0-based index of the currently displayed slide. */ private void updateButtons(int index) { _goto.setValue(index+1); - + int last = index + _navButtons.length; if (last >= _total) return; - + for (int i = 0; i < _navButtons.length; i++) { int slideIndex = index+i+2; _navButtons[i].setText(String.format("%02d", slideIndex)); _navButtons[i].putClientProperty(SLIDE_INDEX, (index+i+1)); } } - + public int getSlideCount() { return _total; } - + public ImageIcon getSlideAt(int index) { WeakReference weak = _slides.get(index); if (weak == null) { @@ -194,14 +194,14 @@ public class PowerPointViewer extends JPanel { } return (weak.get() == null) ? loadSlide(index) : weak.get(); } - + ImageIcon loadSlide(int index) { URL imgURL = _slideURLs.get(index); ImageIcon icon = new ImageIcon(imgURL); _slides.add(index, new WeakReference(icon)); return icon; } - + List validateSlides(String dir, List slides) { List valid = new ArrayList(); for (String slide : slides) { @@ -212,7 +212,7 @@ public class PowerPointViewer extends JPanel { } return valid; } - + private URL findResource(String path) { if (path == null) return null; @@ -226,5 +226,5 @@ public class PowerPointViewer extends JPanel { } return imgURL; } - + } diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PreparedQueryViewer.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PreparedQueryViewer.java index efe4677e9..9b62c28f3 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PreparedQueryViewer.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/PreparedQueryViewer.java @@ -21,13 +21,13 @@ import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI; /** * A specialized table to display statistics of queries. - * + * * @author Pinaki Poddar * */ @SuppressWarnings("serial") public class PreparedQueryViewer extends JTable { - + public PreparedQueryViewer(OpenJPAEntityManagerFactory emf) { super(new QueryStatisticsModel(((OpenJPAEntityManagerFactorySPI)emf).getConfiguration() .getQuerySQLCacheInstance().getStatistics())); diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/QueryDecorator.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/QueryDecorator.java index dbb94976d..bf0165b8b 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/QueryDecorator.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/QueryDecorator.java @@ -18,7 +18,7 @@ import javax.persistence.Query; /** * Decorates an executable query. * Concrete decorative action can be binding parameters, limiting the result range etc. - * + * * @author Pinaki Poddar * */ diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/QueryStatisticsModel.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/QueryStatisticsModel.java index d0edfe1b6..65e22997a 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/QueryStatisticsModel.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/QueryStatisticsModel.java @@ -25,12 +25,12 @@ import org.apache.openjpa.kernel.QueryStatistics; class QueryStatisticsModel extends AbstractTableModel { QueryStatistics _stats; private List _keys = new ArrayList(); - + QueryStatisticsModel(QueryStatistics stats) { _stats = stats; sortKeys(stats); } - + @Override public int getColumnCount() { return 3; @@ -41,7 +41,7 @@ class QueryStatisticsModel extends AbstractTableModel { sortKeys(_stats); return _keys.size(); } - + @Override public String getColumnName(int columnIndex) { switch (columnIndex) { @@ -62,7 +62,7 @@ class QueryStatisticsModel extends AbstractTableModel { default : return null; } } - + void sortKeys(QueryStatistics stats) { if (_stats.keys().size() != _keys.size()) { _keys = new ArrayList(_stats.keys()); diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/RoundButton.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/RoundButton.java index f2e8eb977..004ef25f5 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/RoundButton.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/RoundButton.java @@ -30,31 +30,31 @@ import javax.swing.JButton; /** * A Circular Swing Button. - * + * * @author Pinaki Poddar * */ @SuppressWarnings("serial") public class RoundButton extends JButton { protected Shape shape, base; - + public RoundButton() { this(null, null); } - + public RoundButton(Icon icon) { this(null, icon); } - + public RoundButton(String text) { this(text, null); } - + public RoundButton(Action a) { this(); setAction(a); } - + public RoundButton(String text, Icon icon) { setModel(new DefaultButtonModel()); init(text, icon); @@ -74,7 +74,7 @@ public class RoundButton extends JButton { setAlignmentY(Component.TOP_ALIGNMENT); initShape(); } - + protected void initShape() { if(!getBounds().equals(base)) { Dimension s = getPreferredSize(); @@ -82,7 +82,7 @@ public class RoundButton extends JButton { shape = new Ellipse2D.Float(0, 0, s.width-1, s.height-1); } } - + @Override protected void paintBorder(Graphics g) { initShape(); @@ -92,7 +92,7 @@ public class RoundButton extends JButton { g2.draw(shape); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } - + @Override public boolean contains(int x, int y) { initShape(); diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ScrollingTextPane.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ScrollingTextPane.java index 3275d9341..d4ab5ef57 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ScrollingTextPane.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/ScrollingTextPane.java @@ -28,13 +28,13 @@ import javax.swing.text.Document; /** * A TextPane where text that scrolls as new text is appended. - * + * * @author Pinaki Poddar * */ @SuppressWarnings("serial") public class ScrollingTextPane extends JTextPane { - + public void appendText(String text) { if (text == null) return; @@ -47,21 +47,21 @@ public class ScrollingTextPane extends JTextPane { scrollRectToVisible(r); } } catch (Exception e) { - + } } - + public static void main(String[] args) throws Exception { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - + final ScrollingTextPane test = new ScrollingTextPane(); f.getContentPane().add(new JScrollPane(test)); f.pack(); f.setSize(600,450); f.setVisible(true); - + Timer timer = new Timer(1000, new ActionListener() { SimpleDateFormat fmt = new SimpleDateFormat("HH:mm:ss"); @Override diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SourceCodeViewer.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SourceCodeViewer.java index 1466140b9..6a7c8f972 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SourceCodeViewer.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SourceCodeViewer.java @@ -34,8 +34,8 @@ import javax.swing.JScrollPane; * An internal viewer for HTML formatted source code. * The input to this viewer is a root URL. * The viewer shows the anchors in a combo-box and displays the - * corresponding HTML in the main editor. - * + * corresponding HTML in the main editor. + * * @author Pinaki Poddar * */ @@ -45,45 +45,45 @@ public class SourceCodeViewer extends JPanel { private final JComboBox _bookmarks; private IndexedMap _anchors = new IndexedMap(); private LinkedList _visited = new LinkedList(); - + /** * Create a Source Code Browser. */ public SourceCodeViewer() { super(true); setLayout(new BorderLayout()); - + _editor = new JEditorPane(); _editor.setContentType("text/html"); _editor.setEditable(false); - + DefaultComboBoxModel model = new DefaultComboBoxModel(); _bookmarks = new JComboBox(model); _bookmarks.setEditable(false); - + _bookmarks.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { showAnchor((String)_bookmarks.getSelectedItem()); } }); - + JPanel topPanel = new JPanel(); ((FlowLayout)topPanel.getLayout()).setAlignment(FlowLayout.LEADING); topPanel.add(new JLabel("Go to ")); topPanel.add(_bookmarks); topPanel.add(Box.createHorizontalGlue()); - - + + add(new JScrollPane(_editor, - JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, - JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS), + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS), BorderLayout.CENTER); add(topPanel, BorderLayout.NORTH); } - + /** * Add a page to this browser. - * + * * @param anchor a user visible description to identify the page * @param uri the unique resource location */ @@ -91,10 +91,10 @@ public class SourceCodeViewer extends JPanel { _anchors.put(anchor, url); ((DefaultComboBoxModel)_bookmarks.getModel()).addElement(anchor); } - + /** * Shows the page identified by the given anchor. - * + * * @param anchor an anchor added a priori. */ public void showAnchor(String anchor) { @@ -103,14 +103,14 @@ public class SourceCodeViewer extends JPanel { return; showPage(anchor, _anchors.get(anchor)); } - + /** * Shows the given URI. * @param anchor an anchor added a priori or a new one. * @param uri the URI of the anchor */ public void showPage(String anchor, URI uri) { - if (anchor == null || uri == null) + if (anchor == null || uri == null) return; try { URL url = uri.toURL(); diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/StatusBar.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/StatusBar.java index 30ceeee03..fcdc406e4 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/StatusBar.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/StatusBar.java @@ -34,13 +34,13 @@ public class StatusBar extends JPanel implements PropertyChangeListener { private JProgressBar memoryBar; private JLabel messageText; private TaskProgress task; - + public StatusBar() { progressBar = new JProgressBar(); memoryBar = new JProgressBar(); - + messageText = new JLabel(); - + setLayout(new GridLayout(1,0)); add(messageText); add(Box.createHorizontalGlue()); @@ -50,11 +50,11 @@ public class StatusBar extends JPanel implements PropertyChangeListener { MemoryDisplay memory = new MemoryDisplay(memoryBar); new Timer(100, memory).start(); } - + public void showMessage(String text) { messageText.setText(text); } - + public void startTimer(long duration, int interval, TimeUnit unit) { progressBar.setEnabled(true); if (duration > 0) { @@ -72,17 +72,17 @@ public class StatusBar extends JPanel implements PropertyChangeListener { task.execute(); } } - + /** * Invoked when task's progress property changes. */ public void propertyChange(PropertyChangeEvent evt) { if ("progress".equals(evt.getPropertyName())) { progressBar.setValue((Integer)evt.getNewValue()); - } + } } - + public void stopTimer() { if (task != null) { task.cancel(true); @@ -92,7 +92,7 @@ public class StatusBar extends JPanel implements PropertyChangeListener { progressBar.setString(""); progressBar.setEnabled(false); } - + /* * Emits progress property from a background thread. */ @@ -100,7 +100,7 @@ public class StatusBar extends JPanel implements PropertyChangeListener { private long startTimeInMillis; private long _total = 100; private int _interval = 100; - + public TaskProgress(long total, int interval) { _total = Math.max(total, 1); _interval = Math.max(interval, 1); @@ -122,7 +122,7 @@ public class StatusBar extends JPanel implements PropertyChangeListener { return null; } } - + public class MemoryDisplay implements ActionListener { JProgressBar bar; public MemoryDisplay(JProgressBar bar) { @@ -141,16 +141,16 @@ public class StatusBar extends JPanel implements PropertyChangeListener { bar.setValue((int)usedPct); bar.setString(usedPct + "% (" + mb(usedMemory) + "/" + mb(totalMemory) + "MB) "); } - + private long mb(long m) { return m/1000000; } - + Color getColor(int pct) { int red = 255*pct/100; int green = 255*(100-pct)/100; return new Color(red, green, 0); } } - + } diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SwingHelper.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SwingHelper.java index 8e69490c4..1dd512067 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SwingHelper.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/SwingHelper.java @@ -36,18 +36,18 @@ import javax.swing.plaf.FontUIResource; /** * Assorted utility methods. - * + * * @author Pinaki Poddar * */ public class SwingHelper { /** * Position the given component at the center of the given parent component or physical screen. - * + * * @param c the component to be positioned * @param parent the component whose center will match the center of the given component. * If null, the given component will match the screen center. - * + * */ public static void position(Component c, Component parent) { Dimension d = c.getPreferredSize(); @@ -61,9 +61,9 @@ public class SwingHelper { c.setLocation(p.x + pw/2 - d.width/2, p.y + ph/2 - d.height/2); } } - + private static int[] factors = {1000, 1000, 1000, 1000, 60, 60, 24}; - + public static String getTimeString(long value, TimeUnit unit) { if (value <= 0) return ""; @@ -75,13 +75,13 @@ public class SwingHelper { next = units[i+1]; factor = factors[i+1]; long nextValue = value/factor; - if (nextValue > 0) - return getTimeString(value/factor, next) + " " + getTimeString(value%factor, unit); - } - + if (nextValue > 0) + return getTimeString(value/factor, next) + " " + getTimeString(value%factor, unit); + } + return value + toString(unit); } - + public static String toString(TimeUnit unit) { switch (unit) { case HOURS: @@ -98,7 +98,7 @@ public class SwingHelper { } return ""; } - + public static void print(Component c, String format, File output) { try { Robot robot = new Robot(); @@ -113,7 +113,7 @@ public class SwingHelper { e.printStackTrace(); } } - + public static AbstractButton getSelectedButton(ButtonGroup group) { Enumeration buttons = group.getElements(); while (buttons.hasMoreElements()) { @@ -124,7 +124,7 @@ public class SwingHelper { } return null; } - + public static void setLookAndFeel(int fontSize) throws Exception { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIDefaults defaults = UIManager.getDefaults(); @@ -138,7 +138,7 @@ public class SwingHelper { } } } - + } diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/TextStyles.java b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/TextStyles.java index b9d6d820d..83a117661 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/TextStyles.java +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/TextStyles.java @@ -28,7 +28,7 @@ public class TextStyles { KEYS = ctx.addAttribute(KEYS, StyleConstants.Bold, true); KEYS = ctx.addAttribute(KEYS, StyleConstants.FontSize, 14); KEYS = ctx.addAttribute(KEYS, StyleConstants.FontFamily, "Courier"); - + Color indianRed = new Color(205, 92, 92); VALUES = ctx.addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.Foreground, indianRed); VALUES = ctx.addAttribute(VALUES, StyleConstants.Bold, true); diff --git a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/package.html b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/package.html index 520c0eea2..2a2157fdc 100644 --- a/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/package.html +++ b/openjpa-examples/openbooks/src/main/java/jpa/tools/swing/package.html @@ -18,6 +18,6 @@ under the License. --> -Swing widgets to browse persistent entities using JPA 2.0 MetaModel API. +Swing widgets to browse persistent entities using JPA 2.0 MetaModel API. diff --git a/openjpa-examples/openbooks/src/main/java/openbook/client/BuyBookPage.java b/openjpa-examples/openbooks/src/main/java/openbook/client/BuyBookPage.java index 1f4a366b1..93985ef20 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/client/BuyBookPage.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/client/BuyBookPage.java @@ -53,22 +53,22 @@ import openbook.server.QueryDecorator; import org.apache.openjpa.lib.jdbc.SQLFormatter; /** - * A visual page coordinates the following functions of {@link OpenBookService} : + * A visual page coordinates the following functions of {@link OpenBookService} : *
  • query for books *
  • choose one or more of the selected books *
  • add them to Shopping Cart *
  • place a purchase order of the books in the shopping cart. *

    - * Each interaction with the underlying service occurs in a background i.e. + * Each interaction with the underlying service occurs in a background i.e. * a non-AWT event dispatching thread. The background threads are * used via {@link SwingWorker} and hence each persistence operation is * can be potentially handled by a different JPA persistence context. - * This threading model not only adheres to the good practice of responsive graphical - * user interface design, it exercises the remote nature of JPA service + * This threading model not only adheres to the good practice of responsive graphical + * user interface design, it exercises the remote nature of JPA service * (even within this single process Swing application) where every operation * on a persistence context results into a set of detached instances - * to the remote client. - * + * to the remote client. + * * @author Pinaki Poddar */ @SuppressWarnings("serial") @@ -79,10 +79,10 @@ public final class BuyBookPage extends JPanel { private final BuyPanel _buyPanel; private final SelectBookPanel _selectPanel; private final ShoppingCartPanel _cartPanel; - + /** * A Page with 2x2 Grid of panels each for one of the specific action. - * + * * @param service the OpenBooks service handle. */ public BuyBookPage(OpenBookService service, Customer customer) { @@ -102,7 +102,7 @@ public final class BuyBookPage extends JPanel { add(_cartPanel); add(_selectPanel); add(_buyPanel); - + _selectPanel._selectedBooks.getTable() .getSelectionModel() .addListSelectionListener(_buyPanel); @@ -112,16 +112,16 @@ public final class BuyBookPage extends JPanel { * A form like panel displays the different fields to search for books. * Zero or more form fields can be filled in. Though the service level * contract does not mandate how to form the exact query from the form - * field values, the actual implementation demonstrates how dynamic + * field values, the actual implementation demonstrates how dynamic * query construction introduced via Criteria Query API in JPA 2.0 * can aid in such common user scenarios. *
    * The object level query is displayed to demonstrate the ability of * OpenJPA to express a dynamic Criteria Query is a human-readable, * JPQL-like query string. - * + * * @author Pinaki Poddar - * + * */ class SearchPanel extends JPanel implements ActionListener { private final JTextField _title = new JTextField("", 20); @@ -130,7 +130,7 @@ public final class BuyBookPage extends JPanel { private final JTextField _minPrice = new JTextField("", 6); private final JTextArea _queryView = new JTextArea(); private final SQLFormatter _formatter = new SQLFormatter(); - + SearchPanel(String title) { super(true); setBorder(BorderFactory.createTitledBorder(title)); @@ -159,7 +159,7 @@ public final class BuyBookPage extends JPanel { .addComponent(_minPrice) .addComponent(toLabel) .addComponent(_maxPrice))); - + GroupLayout.SequentialGroup vGroup = layout.createSequentialGroup(); vGroup.addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(titleLabel) @@ -173,7 +173,7 @@ public final class BuyBookPage extends JPanel { .addComponent(_minPrice) .addComponent(toLabel) .addComponent(_maxPrice)); - + layout.setHorizontalGroup(hGroup); layout.setVerticalGroup(vGroup); @@ -182,19 +182,19 @@ public final class BuyBookPage extends JPanel { ShowCodeAction showCode = Demo.getInstance().new ShowCodeAction(); showCode.setPage("Dynamic Query", "server/OpenBookServiceImpl.java.html#buildQuery"); JButton viewCodeButton = new JButton(showCode); - + JPanel buttonPanel = new JPanel(); buttonPanel.add(Box.createHorizontalGlue()); buttonPanel.add(searchButton); buttonPanel.add(Box.createHorizontalGlue()); buttonPanel.add(viewCodeButton); - + BoxLayout box = new BoxLayout(this, BoxLayout.Y_AXIS); setLayout(box); add(panel); add(Box.createVerticalGlue()); add(buttonPanel); - + _queryView.setBorder(BorderFactory.createTitledBorder("Criteria Query as CQL")); _queryView.setWrapStyleWord(true); _queryView.setEditable(false); @@ -202,10 +202,10 @@ public final class BuyBookPage extends JPanel { add(_queryView); searchButton.addActionListener(this); } - + /** * Execute a query and displays the result onto {@linkplain SelectBookPanel}. - * + * * The query is executed in a background, non-AWT thread. */ public void actionPerformed(ActionEvent e) { @@ -213,12 +213,12 @@ public final class BuyBookPage extends JPanel { private String queryString; @Override protected List doInBackground() throws Exception { - queryString = _service.getQuery(_title.getText(), - asDouble(_minPrice), asDouble(_maxPrice), + queryString = _service.getQuery(_title.getText(), + asDouble(_minPrice), asDouble(_maxPrice), _author.getText()); - return _service.select(_title.getText(), - asDouble(_minPrice), asDouble(_maxPrice), - _author.getText(), + return _service.select(_title.getText(), + asDouble(_minPrice), asDouble(_maxPrice), + _author.getText(), (QueryDecorator[])null); } @@ -255,27 +255,27 @@ public final class BuyBookPage extends JPanel { /** * A panel to display the selected books in a tabular format. - * + * * @author Pinaki Poddar - * + * */ class SelectBookPanel extends JPanel { private final JLabel _bookCount; private final EntityTableView _selectedBooks; - + SelectBookPanel(String title) { setLayout(new BorderLayout()); setBorder(BorderFactory.createTitledBorder(title)); _selectedBooks = new EntityTableView(Book.class, - EntityDataModel.BASIC_ATTR | EntityDataModel.ROW_COUNT, + EntityDataModel.BASIC_ATTR | EntityDataModel.ROW_COUNT, _service.getUnit()); _bookCount = new JLabel(); - + add(_bookCount, BorderLayout.NORTH); add(_selectedBooks, BorderLayout.CENTER); } - + void updateDataModel(List books) { _bookCount.setText(books.size() + " Book selected"); _selectedBooks.getDataModel().updateData(books); @@ -285,9 +285,9 @@ public final class BuyBookPage extends JPanel { /** * A panel to display the details of a single book and a button to add the * book to cart. Listens to the selection in the selected books. - * + * * @author Pinaki Poddar - * + * */ class BuyPanel extends JPanel implements ListSelectionListener { JLabel _bookTitle; @@ -297,13 +297,13 @@ public final class BuyBookPage extends JPanel { JButton _addToCart; JSpinner _quantity; JPanel _quantityPanel; - + public BuyPanel(String title) { super(true); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createTitledBorder(title)); - + JPanel descPanel = new JPanel(); descPanel.setLayout(new BoxLayout(descPanel, BoxLayout.Y_AXIS)); _bookTitle = new JLabel(); @@ -324,9 +324,9 @@ public final class BuyBookPage extends JPanel { _quantityPanel.add(_quantity); _quantityPanel.setVisible(false); add(_quantityPanel); - + add(Box.createVerticalGlue()); - + JPanel buttonPanel = new JPanel(); buttonPanel.add(Box.createHorizontalGlue()); _addToCart = new JButton("Add to Cart", Images.CART); @@ -338,7 +338,7 @@ public final class BuyBookPage extends JPanel { _addToCart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - _cartPanel.addBook((Book)_addToCart.getClientProperty("Book"), + _cartPanel.addBook((Book)_addToCart.getClientProperty("Book"), (Integer)_quantity.getValue()); } }); @@ -380,23 +380,23 @@ public final class BuyBookPage extends JPanel { /** * A panel to display the shopping cart. - * + * * @author Pinaki Poddar - * + * */ class ShoppingCartPanel extends JPanel implements ActionListener { private static final int MAX_ITEMS = 10; private final ShoppingCart _cart; private final JButton _placeOrder; private final JLabel[] _items = new JLabel[MAX_ITEMS]; - + public ShoppingCartPanel(String title) { _cart = _customer.newCart(); setLayout(new BoxLayout(this,BoxLayout.Y_AXIS)); setBorder(BorderFactory.createTitledBorder(title)); _placeOrder = new JButton("Place Order", Images.START); _placeOrder.setHorizontalTextPosition(SwingConstants.LEADING); - + _placeOrder.setEnabled(false); for (int i = 0; i < MAX_ITEMS; i++) { _items[i] = new JLabel(""); @@ -410,7 +410,7 @@ public final class BuyBookPage extends JPanel { add(buttonPanel); _placeOrder.addActionListener(this); } - + /** * Add the given book to the cart. Updates the display. */ @@ -418,7 +418,7 @@ public final class BuyBookPage extends JPanel { _cart.addItem(book, quantity); updateDisplay(); } - + void updateDisplay() { Map items = _cart.getItems(); int i = 0; @@ -431,7 +431,7 @@ public final class BuyBookPage extends JPanel { } _placeOrder.setEnabled(items.size()>0); super.repaint(); - } + } @Override public void actionPerformed(ActionEvent e) { diff --git a/openjpa-examples/openbooks/src/main/java/openbook/client/DeliveryPage.java b/openjpa-examples/openbooks/src/main/java/openbook/client/DeliveryPage.java index 05f582738..50a069f51 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/client/DeliveryPage.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/client/DeliveryPage.java @@ -36,9 +36,9 @@ import openbook.server.OpenBookService; /** * A page to control delivery of pending orders. - * + * * @author Pinaki Poddar - * + * */ @SuppressWarnings("serial") public class DeliveryPage extends JPanel { @@ -147,7 +147,7 @@ public class DeliveryPage extends JPanel { * Gets the orders in a background (i.e. not AWT event dispatch thread) * thread.
    * But blocks painting anyway, because that is what is intended. - * + * */ private List getOrders(final PurchaseOrder.Status status) { SwingWorker, Void> worker = new SwingWorker, Void>() { diff --git a/openjpa-examples/openbooks/src/main/java/openbook/client/Demo.java b/openjpa-examples/openbooks/src/main/java/openbook/client/Demo.java index 599c66e5b..0a5badee9 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/client/Demo.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/client/Demo.java @@ -73,7 +73,7 @@ import org.apache.openjpa.persistence.OpenJPAPersistence; /** * A graphical user interface based client of OpenBooks for demonstration. - * + * * @author Pinaki Poddar * */ @@ -90,12 +90,12 @@ public class Demo extends JFrame { private Action _about; private Action _buyBook; private Action _deliver; - private Action _supply; - private Action _viewConfig; - private Action _viewDomain; + private Action _supply; + private Action _viewConfig; + private Action _viewDomain; private Action _viewSource; private Action _viewQuery; - + /** * The primary graphic widgets used to invoke and display the results of the actions. */ @@ -109,14 +109,14 @@ public class Demo extends JFrame { private SourceCodeBrowser _sourceBrowser; private static Demo _instance; private static final String SRC_ROOT = "source/"; - + /** * The handle to the service. */ private OpenBookService _service; private Customer _customer; private Map _config; - + /** * Runs the demo. */ @@ -134,14 +134,14 @@ public class Demo extends JFrame { } }); } - + public synchronized static Demo getInstance() { if (_instance == null) { _instance = new Demo(); } return _instance; } - + static void adjustWidgetSize() { Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); int sw = (int)(95*screen.getWidth()/100); @@ -151,13 +151,13 @@ public class Demo extends JFrame { OUT_VIEW = new Dimension(75*sw/100, 35*sh/100); } - + private Demo() { Thread.currentThread().setUncaughtExceptionHandler(new ErrorHandler()); _config = PropertyHelper.load(System.getProperty("openbook.client.config", "demo.properties")); setIconImage(((ImageIcon)Images.LOGO_OPENBOOKS).getImage()); setTitle("OpenBooks: A Sample JPA 2.0 Application"); - + _root = new WelcomeAction("OpenBooks", Images.LOGO_OPENBOOKS, "OpenBooks"); _about = new AboutAction("About OpenBooks", Images.LOGO_OPENBOOKS, "About OpenBooks"); _buyBook = new BuyBookAction("Buy", Images.BUY, "Browse and Buy Books"); @@ -167,13 +167,13 @@ public class Demo extends JFrame { _viewDomain = new ViewDomainAction("Domain", Images.VIEW_DOMAIN, "View Domain Model"); _viewSource = new ViewSourceAction("Source", Images.VIEW_CODE, "View Source Code"); _viewQuery = new ViewQueryCacheAction("Query", Images.VIEW_QUERY, "View Queries"); - + _toolBar = createToolBar(); _navigator = createNavigator(); _tabbedPane = createTabbedView(); _outputPane = createOutputView(); _statusBar = createStatusBar(); - + JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); horizontalSplitPane.setContinuousLayout(true); horizontalSplitPane.setDividerSize(5); @@ -181,29 +181,29 @@ public class Demo extends JFrame { scrollPane.setMinimumSize(new Dimension(NAV_VIEW.width/4, NAV_VIEW.height)); scrollPane.setPreferredSize(NAV_VIEW); horizontalSplitPane.add(scrollPane); - + JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); verticalSplitPane.setContinuousLayout(true); verticalSplitPane.setDividerSize(5); verticalSplitPane.add(_tabbedPane); verticalSplitPane.add(_outputPane); horizontalSplitPane.add(verticalSplitPane); - + Container content = getContentPane(); content.add(_toolBar, BorderLayout.PAGE_START); content.add(horizontalSplitPane, BorderLayout.CENTER); content.add(_statusBar, BorderLayout.SOUTH); - + _root.actionPerformed(null); } - + /** - * Gets the handle to OpenBooks service. + * Gets the handle to OpenBooks service. */ public OpenBookService getService() { if (_service == null) { final String unitName = getConfiguration("openbook.unit", OpenBookService.DEFAULT_UNIT_NAME); - + SwingWorker getService = new SwingWorker () { @Override protected OpenBookService doInBackground() throws Exception { @@ -213,7 +213,7 @@ public class Demo extends JFrame { service.initialize(null); return service; } - + }; getService.execute(); try { @@ -227,7 +227,7 @@ public class Demo extends JFrame { } return _service; } - + public Customer getCustomer() { if (_customer == null) { SwingWorker task = new SwingWorker () { @@ -235,7 +235,7 @@ public class Demo extends JFrame { protected Customer doInBackground() throws Exception { return getService().login("guest"); } - + }; task.execute(); try { @@ -246,7 +246,7 @@ public class Demo extends JFrame { } return _customer; } - + private JToolBar createToolBar() { JToolBar toolBar = new JToolBar(); toolBar.add(_buyBook); @@ -254,28 +254,28 @@ public class Demo extends JFrame { toolBar.add(_supply); Dimension d = new Dimension(40, 32); toolBar.addSeparator(d); - + toolBar.add(_viewConfig); toolBar.add(_viewDomain); toolBar.add(_viewSource); toolBar.add(_viewQuery); - + toolBar.addSeparator(d); - + toolBar.add(Box.createHorizontalGlue()); toolBar.add(_about); toolBar.add(Box.createHorizontalStrut(2)); return toolBar; } - + private StatusBar createStatusBar() { return new StatusBar(); } - + public String getConfiguration(String key, String def) { return PropertyHelper.getString(_config, key, def); } - + private SourceCodeBrowser getSourceCodeBrowser() { if (_sourceBrowser == null) { String root = getConfiguration("openbook.source.root", SRC_ROOT); @@ -297,7 +297,7 @@ public class Demo extends JFrame { /** * Abstract root of all Action objects helps to locate/configure visual action parameters such as * tooltip text or image. - * + * * @author Pinaki Poddar * */ @@ -308,13 +308,13 @@ public class Demo extends JFrame { putValue(Action.SMALL_ICON, icon); } } - + public class BuyBookAction extends OpenBookAction { BuyBookPage _buyBookPage; public BuyBookAction(String name, Icon icon, String tooltip) { super(name, icon, tooltip); } - + public void actionPerformed(ActionEvent e) { if (_buyBookPage == null) { _buyBookPage = new BuyBookPage(getService(), getCustomer()); @@ -322,7 +322,7 @@ public class Demo extends JFrame { showTab(_tabbedPane, "Buy Books", _buyBookPage); switchTab(_outputPane, _sqlLog); } - + } public class DeliveryAction extends OpenBookAction { DeliveryPage _deliveryPage; @@ -336,9 +336,9 @@ public class Demo extends JFrame { showTab(_tabbedPane, "Deliver Books", _deliveryPage); switchTab(_outputPane, _sqlLog); } - + } - + public class SupplyAction extends OpenBookAction { SupplyPage _supplyPage; public SupplyAction(String name, Icon icon, String tooltip) { @@ -351,9 +351,9 @@ public class Demo extends JFrame { showTab(_tabbedPane, "Supply Books", _supplyPage); switchTab(_outputPane, _sqlLog); } - + } - + public class ViewConfigAction extends OpenBookAction { ConfigurationViewer _configView; public ViewConfigAction(String name, Icon icon, String tooltip) { @@ -367,9 +367,9 @@ public class Demo extends JFrame { showTab(_tabbedPane, "Configuration", _configView); } } - + } - + public class ViewDomainAction extends OpenBookAction { MetamodelView _domainView; AttributeLegendView _legends; @@ -384,7 +384,7 @@ public class Demo extends JFrame { } showTab(_tabbedPane, "Domain Model", _domainView); } - + } public class ViewDataAction extends OpenBookAction { @@ -394,9 +394,9 @@ public class Demo extends JFrame { public void actionPerformed(ActionEvent e) { showTab(_tabbedPane, "Buy Books", null); } - + } - + public class ViewQueryCacheAction extends OpenBookAction { PreparedQueryViewer _queryView; public ViewQueryCacheAction(String name, Icon icon, String tooltip) { @@ -409,19 +409,19 @@ public class Demo extends JFrame { } showTab(_tabbedPane, "JPQL Queries", _queryView); } - + } - + public class ViewSourceAction extends OpenBookAction { public ViewSourceAction(String name, Icon icon, String tooltip) { super(name, icon, tooltip); } - + public void actionPerformed(ActionEvent e) { getSourceCodeBrowser(); } } - + /** * An action to show a piece of code in an internal or external browser. * @@ -429,24 +429,24 @@ public class Demo extends JFrame { public class ShowCodeAction extends OpenBookAction { private String _key; private String _page; - + public ShowCodeAction() { super("View Code", Images.VIEW_CODE, "View Java Source Code"); } - + public void setPage(String key, String page) { _key = key; _page = page; } - + public void actionPerformed(ActionEvent e) { getSourceCodeBrowser().showPage(_key, _page); } } - + /** * Displays the "welcome" page. - * + * * @author Pinaki Poddar * */ @@ -454,15 +454,15 @@ public class Demo extends JFrame { PowerPointViewer _powerpoint; JLabel _logoLabel = new JLabel(Images.LOGO_OPENBOOKS); boolean _showPresentation = true; - + public WelcomeAction(String name, Icon icon, String tooltip) { super(name, icon, tooltip); } - + public void actionPerformed(ActionEvent e) { if (_powerpoint == null && _showPresentation) { String dir = getConfiguration("openbook.slides.dir", "slides/"); - String[] defaultSlides = { + String[] defaultSlides = { "Slide1.JPG", "Slide2.JPG", "Slide3.JPG", @@ -486,19 +486,19 @@ public class Demo extends JFrame { _showPresentation = false; System.err.println("Error while opening slide deck at " + dir + ". \r\n"+ e1); } - } + } showTab(_tabbedPane, "Home", _powerpoint != null ? _powerpoint : _logoLabel); } - + } - + public class AboutAction extends OpenBookAction { AboutDialog _dialog; - + public AboutAction(String name, Icon icon, String tooltip) { super(name, icon, tooltip); } - + public void actionPerformed(ActionEvent e) { if (_dialog == null) { _dialog = new AboutDialog(Images.LOGO_OPENBOOKS); @@ -507,7 +507,7 @@ public class Demo extends JFrame { _dialog.setVisible(true); } } - + /** * Show the given tab in the given pane. * @param pane the tabbed pane @@ -525,22 +525,22 @@ public class Demo extends JFrame { pane.setSelectedComponent(c); } } - + void switchTab(JTabbedPane pane, Component tab) { if (tab == null) return; Component c = locateTab(pane, tab); if (c == null) { pane.setSelectedComponent(c); - } + } } - + Component locateTab(JTabbedPane pane, Component tab) { int index = pane.indexOfComponent(tab); if (index == -1) { Component[] components = pane.getComponents(); for (int i = 0; i < components.length; i++) { - if (components[i] instanceof JScrollPane + if (components[i] instanceof JScrollPane && (((JScrollPane)components[i]).getViewport().getView() == tab)) { return components[i]; } @@ -550,38 +550,38 @@ public class Demo extends JFrame { } return null; } - - + + private JTabbedPane createTabbedView() { JTabbedPane pane = new JTabbedPane(); pane.setPreferredSize(TAB_VIEW); pane.setMinimumSize(new Dimension(TAB_VIEW.width, TAB_VIEW.height)); return pane; } - + 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); _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; } - + /** * Creates the navigation tree and adds the tree nodes. Each tree node is attached with an action - * that fires when the node is selected. + * that fires when the node is selected. */ private JTree createNavigator() { ActionTreeNode root = new ActionTreeNode(_root); @@ -589,21 +589,21 @@ public class Demo extends JFrame { DefaultMutableTreeNode views = new DefaultMutableTreeNode("Views"); root.add(app); root.add(views); - - + + app.add(new ActionTreeNode(_buyBook)); app.add(new ActionTreeNode(_deliver)); app.add(new ActionTreeNode(_supply)); - + views.add(new ActionTreeNode(_viewConfig)); views.add(new ActionTreeNode(_viewDomain)); views.add(new ActionTreeNode(_viewQuery)); views.add(new ActionTreeNode(_viewSource)); - - + + JTree tree = new JTree(root); tree.setShowsRootHandles(true); - + tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { Object treeNode = _navigator.getLastSelectedPathComponent(); @@ -613,17 +613,17 @@ public class Demo extends JFrame { } }); tree.setCellRenderer(new TypedTreeCellRenderer()); - + for (int i = 0; i < tree.getRowCount(); i++) { tree.expandRow(i); } - + return tree; } - + /** * A tree node which may have an associated action. - * + * * @author Pinaki Poddar * */ @@ -632,30 +632,30 @@ public class Demo extends JFrame { public ActionTreeNode(Action action) { _action = action; } - + public String toString() { return _action.getValue(Action.SHORT_DESCRIPTION).toString(); } - + } - + public class TypedTreeCellRenderer extends DefaultTreeCellRenderer { @Override - public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, - boolean leaf, int row, boolean hasFocus) { + public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, + boolean leaf, int row, boolean hasFocus) { return super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); } } - + public static class AboutDialog extends JDialog { public AboutDialog(Icon logo) { setModal(true); setLayout(new BorderLayout()); - JButton button = new JButton("" - + "OpenBooks " + JButton button = new JButton("" + + "OpenBooks " + "

    " - + "
    by JPA Team, SWG" - + "
    IBM Corporation" + + "
    by JPA Team, SWG" + + "
    IBM Corporation" + "

    " + ""); button.setIcon(logo); diff --git a/openjpa-examples/openbooks/src/main/java/openbook/client/ErrorHandler.java b/openjpa-examples/openbooks/src/main/java/openbook/client/ErrorHandler.java index 1d4e54236..542ed3770 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/client/ErrorHandler.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/client/ErrorHandler.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package openbook.client; @@ -24,20 +24,20 @@ import jpa.tools.swing.ErrorDialog; /** * Handles error. - * + * * @author Pinaki Poddar * */ public class ErrorHandler implements Thread.UncaughtExceptionHandler{ - + static { System.setProperty("sun.awt.exception.handler", ErrorHandler.class.getName()); } - + public void handle(Throwable e) { uncaughtException(Thread.currentThread(), e); } - + public void uncaughtException(Thread t, Throwable e) { if (SwingUtilities.isEventDispatchThread()) { new ErrorDialog(null, Images.ERROR, e).setVisible(true); diff --git a/openjpa-examples/openbooks/src/main/java/openbook/client/Images.java b/openjpa-examples/openbooks/src/main/java/openbook/client/Images.java index cb74ca888..0c1c1c508 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/client/Images.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/client/Images.java @@ -24,35 +24,35 @@ import javax.swing.ImageIcon; /** * Utility to load and cache images. * Maintains a list of known images. - * + * * @author Pinaki Poddar * */ public class Images { - + private static Map images = new HashMap(); - + public static Icon NEXT = getIcon("images/arrow_right.jpg", 24, -1); public static Icon BACK = getIcon("images/arrow_left.jpg", 24, -1); public static Icon DONE = getIcon("images/done.png"); public static Icon ERROR = getIcon("images/error.png"); public static Icon START = getIcon("images/start_task.gif"); - + public static final Icon BUY = Images.getIcon("images/buy.jpg", 32, -1); public static final Icon DELIVERY = Images.getIcon("images/delivery.jpg", 32, -1); public static final Icon SUPPLY = Images.getIcon("images/supply.jpg", 32, -1); public static final Icon SEARCH = Images.getIcon("images/search.jpg", 24, -1); public static final Icon CART = Images.getIcon("images/cart.jpg", 24, -1); - + public static Icon VIEW_UNIT = Images.getIcon("images/view_unit.jpg", 32, -1); public static Icon VIEW_DOMAIN = Images.getIcon("images/view_domain.jpg", 32, -1); public static Icon VIEW_CODE = Images.getIcon("images/view_code.jpg", 32, -1); public static Icon VIEW_QUERY = Images.getIcon("images/view_query.jpg", 32, -1); - + public static final Icon LOGO_OPENBOOKS = Images.getIcon("images/OpenBooks.jpg", 32, -1); public static final Icon LOGO_OPENJPA = Images.getIcon("images/openjpa-logo-small.png"); - - + + public static Icon getIcon(String name) { Icon icon = images.get(name); if (icon == null) { @@ -61,11 +61,11 @@ public class Images { } return icon; } - + public static Icon getIcon(String name, boolean scale) { return getIcon(name, 32, -1); } - + public static Icon getIcon(String name, int width, int height) { Icon icon = getIcon(name); if (icon == null) { @@ -74,10 +74,10 @@ public class Images { icon = new ImageIcon(((ImageIcon)icon).getImage().getScaledInstance(width, height, Image.SCALE_SMOOTH)); return icon; } - - /** - * Returns an ImageIcon, or null if the path was invalid. - * + + /** + * Returns an ImageIcon, or null if the path was invalid. + * **/ protected static ImageIcon createImageIcon(String path) { if (path == null) diff --git a/openjpa-examples/openbooks/src/main/java/openbook/client/SQLLogger.java b/openjpa-examples/openbooks/src/main/java/openbook/client/SQLLogger.java index c303dfeea..834da3718 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/client/SQLLogger.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/client/SQLLogger.java @@ -31,7 +31,7 @@ import org.apache.openjpa.lib.jdbc.JDBCEvent; /** * Logs SQL statement to a graphic console. - * + * * @author Pinaki Poddar * */ @@ -45,7 +45,7 @@ public class SQLLogger extends AbstractJDBCListener { blue = ctx.addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.Foreground, Color.BLUE); magenta = ctx.addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.Foreground, Color.MAGENTA); } - + public void setOutput(GraphicOutputStream o) { out = new PrintStream(o, true); o.registerStyle("INSERT", green); @@ -53,7 +53,7 @@ public class SQLLogger extends AbstractJDBCListener { o.registerStyle("UPDATE", magenta); o.registerStyle("DELETE", red); } - + @Override public void beforeExecuteStatement(final JDBCEvent event) { if (out == null) diff --git a/openjpa-examples/openbooks/src/main/java/openbook/client/SourceCodeBrowser.java b/openjpa-examples/openbooks/src/main/java/openbook/client/SourceCodeBrowser.java index be4b0bd69..3811a6000 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/client/SourceCodeBrowser.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/client/SourceCodeBrowser.java @@ -30,9 +30,9 @@ import jpa.tools.swing.SourceCodeViewer; * Browses source code. * The source code URI is resolved with respect to a root URI. * The source code is expected to be in HTML format. - * The actual rendering of the source code can be either through an - * {@linkplain SourceCodeViewer internal} or an external browser. - * + * The actual rendering of the source code can be either through an + * {@linkplain SourceCodeViewer internal} or an external browser. + * * @author Pinaki Poddar * */ @@ -41,10 +41,10 @@ public class SourceCodeBrowser { private SourceCodeViewer _internal = new SourceCodeViewer(); private URI _rootURI; private File _rootDir; - + /** * Construct a browser. - * + * * @param root a path to be resolved as an URI to root of source tree. * @param useDesktop flags to use external or internal browser. */ @@ -52,11 +52,11 @@ public class SourceCodeBrowser { _rootURI = convertToURI(root); _useExternal = useDesktop; } - + public URI getRootURI() { return _rootURI; } - + /** * Gets the root source directory if the sources are being serverd from a local * file system directory. @@ -72,17 +72,17 @@ public class SourceCodeBrowser { public void showPage(String key, String page) { showPage(key, URI.create(_rootURI.toString() + page)); } - + public void addPage(String key, String path) { _internal.addPage(key, URI.create(_rootURI.toString() + path)); } - + public SourceCodeViewer getViewer() { return _internal; } /** * Shows the given page. - * + * * @param key a user visible moniker for the page. * @param uri the URI of the page content. */ @@ -98,7 +98,7 @@ public class SourceCodeBrowser { e.printStackTrace(); } } - + private URI convertToURI(String srcPath) { try { URI uri = URI.create(srcPath); @@ -120,7 +120,7 @@ public class SourceCodeBrowser { _rootDir = srcDir; return convertForWindows(_rootDir.toURI()); } - + URI convertForWindows(URI uri) { String os = System.getProperty("os.name"); boolean windows = os.toLowerCase().indexOf("windows") != -1; diff --git a/openjpa-examples/openbooks/src/main/java/openbook/client/SupplyPage.java b/openjpa-examples/openbooks/src/main/java/openbook/client/SupplyPage.java index 1ea85ddaf..9eed4fa25 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/client/SupplyPage.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/client/SupplyPage.java @@ -35,52 +35,52 @@ import openbook.server.OpenBookService; /** * A page to view and supply low inventory items. - * + * * @author Pinaki Poddar - * + * */ @SuppressWarnings("serial") public class SupplyPage extends JPanel { private final OpenBookService _service; private final EntityTableView _lowInventories; - + private final JButton _supply; private final JButton _view; private final JLabel _title; - + private static int REORDER_LIMIT = 10; private static int REORDER_QUANTITY = 40; public SupplyPage(final OpenBookService service) { setLayout(new BorderLayout()); - + _service = service; - + _title = new JLabel(REORDER_LIMIT + " lowest inventory items"); _view = new JButton("Show " + REORDER_LIMIT + " lowest inventory items"); _supply = new JButton("Supply " + REORDER_QUANTITY + " to each item"); - + List orders = getInventory(REORDER_LIMIT); - _lowInventories = new EntityTableView(Inventory.class, - orders, - EntityDataModel.BASIC_ATTR | EntityDataModel.ASSOCIATION_ATTR, + _lowInventories = new EntityTableView(Inventory.class, + orders, + EntityDataModel.BASIC_ATTR | EntityDataModel.ASSOCIATION_ATTR, service.getUnit()); - + add(_title, BorderLayout.NORTH); add(_lowInventories, BorderLayout.CENTER); JPanel buttons = new JPanel(); buttons.add(_view); buttons.add(_supply); add(buttons, BorderLayout.SOUTH); - - + + _view.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { _lowInventories.getDataModel().updateData(getInventory(REORDER_LIMIT)); } }); - + /** * Supplies each inventory displayed. */ @@ -98,7 +98,7 @@ public class SupplyPage extends JPanel { } return updated; } - + public void done() { try { _lowInventories.getDataModel().updateData(get(1, TimeUnit.SECONDS)); @@ -107,23 +107,23 @@ public class SupplyPage extends JPanel { } } }.execute(); - + } - + }); } - + /** * Gets the orders in a background (i.e. not AWT event dispatch thread) thread. *
    * But blocks painting anyway, because that is what is intended. - * + * */ private List getInventory(final Integer limit) { SwingWorker, Void> worker = new SwingWorker, Void>() { @Override protected List doInBackground() throws Exception { - return _service.getReorderableBooks(REORDER_LIMIT); + return _service.getReorderableBooks(REORDER_LIMIT); } }; worker.execute(); diff --git a/openjpa-examples/openbooks/src/main/java/openbook/domain/Author.java b/openjpa-examples/openbooks/src/main/java/openbook/domain/Author.java index 691d35db5..bcd9b7b13 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/domain/Author.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/domain/Author.java @@ -31,7 +31,7 @@ import javax.persistence.Version; *

  • Identity:Generated value as identity. *
  • Mapping:Many-to-Many mapping to Books. *
  • Version: Yes. - * + * * @author Pinaki Poddar * */ @@ -40,37 +40,37 @@ public class Author { @Id @GeneratedValue private long id; - + private String name; - + @ManyToMany(mappedBy="authors") private Set books; - + @Version private int version; - + public long getId() { return id; } - + public String getName() { return name; } - + public void setName(String name) { this.name = name; } - + public Set getBooks() { return books; } - + public void addBook(Book book) { if (books == null) books = new HashSet(); books.add(book); } - + public int getVersion() { return version; } diff --git a/openjpa-examples/openbooks/src/main/java/openbook/domain/Book.java b/openjpa-examples/openbooks/src/main/java/openbook/domain/Book.java index df2bb0297..3c8a1833a 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/domain/Book.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/domain/Book.java @@ -33,14 +33,14 @@ import javax.persistence.Version; * The mutable properties of the book such as number of items in stock etc. * are factored out in a separate {@link Inventory} instance. *
    - * The state of inventory is mutable, but the relation to inventory is immutable. - * + * The state of inventory is mutable, but the relation to inventory is immutable. + * *
  • Identity: Application-defined identity. *
  • Mapping: One-to-One bi-directional, immutable mapping to {@link Inventory}. * Many-to-Many bi-directional mapping to {@linkplain Author}. *
  • Version: No. *

    - * + * * @author Pinaki Poddar * */ @@ -49,35 +49,35 @@ import javax.persistence.Version; public class Book implements Serializable { @Id private String ISBN; - + private String title; - + private double price; - + @OneToOne(mappedBy="book", fetch=FetchType.LAZY, cascade=CascadeType.ALL, optional=false, orphanRemoval=true) private Inventory inventory; - + /** * - * A many-to-many eager relation. + * A many-to-many eager relation. * By default, many-to-many relations are lazily fetched. */ @ManyToMany(fetch=FetchType.EAGER) private List authors; - + /** * A no-arg constructor is required for JPA Specification. */ public Book() { } - + /** * Construct a book with given parameters. - * + * * @param ISBN primary identity of this Book * @param title Title of the book. * @param price price of the book. @@ -89,23 +89,23 @@ public class Book implements Serializable { this.price = price; inventory = new Inventory(this, initialSupply); } - + public String getISBN() { return ISBN; } - + public String getTitle() { return title; } - + public double getPrice() { return price; } - + public List getAuthors() { return authors; } - + public void addAuthor(Author...authors) { if (this.authors == null) this.authors = new ArrayList(); @@ -114,18 +114,18 @@ public class Book implements Serializable { this.authors.add(a); } } - + public void setAuthors(List authors) { this.authors = authors; } - + public Inventory getInventory() { return inventory; } - + @Version private int version; - + public int getVersion() { return version; } diff --git a/openjpa-examples/openbooks/src/main/java/openbook/domain/Customer.java b/openjpa-examples/openbooks/src/main/java/openbook/domain/Customer.java index 93715e15d..94c0f43fe 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/domain/Customer.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/domain/Customer.java @@ -23,12 +23,12 @@ import javax.persistence.Version; /** * A persistent entity represents a Customer. - * + * *
    Persistent Identity: auto-generated identity. *
    Mapping: - * + * *
    Design Notes: No setter for identity value. - * + * * @author Pinaki Poddar * */ @@ -40,22 +40,22 @@ public class Customer implements Serializable { private long id; private String name; private String email; - + public Customer() { } - + public long getId() { return id; } - + public String getName() { return name; } - + public void setName(String name) { this.name = name; } - + public String getEmail() { return email; } @@ -63,21 +63,21 @@ public class Customer implements Serializable { public void setEmail(String email) { this.email = email; } - + /** * Create a {@link ShoppingCart} for this customer. */ public ShoppingCart newCart() { return new ShoppingCart(this); } - + public String toString() { return name; } - + @Version private int version; - + public int getVersion() { return version; } diff --git a/openjpa-examples/openbooks/src/main/java/openbook/domain/Inventory.java b/openjpa-examples/openbooks/src/main/java/openbook/domain/Inventory.java index 3eb83d525..a321bcb82 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/domain/Inventory.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/domain/Inventory.java @@ -24,7 +24,7 @@ import javax.persistence.Version; /** * A mutable persistent entity. - * + * * @author Pinaki Poddar * */ @@ -34,18 +34,18 @@ public class Inventory implements Serializable { @Id @OneToOne(fetch=FetchType.EAGER, optional=false) private Book book; - + private int supplied; - + private int sold; - + protected Inventory() { - + } /** * Construct with the given Book and initial inventory count. * Package protected because only a Book can create its own inventory. - * + * * @param book non-null Book. * @param initialSupply must be greater than zero. */ @@ -58,16 +58,16 @@ public class Inventory implements Serializable { this.book = book; increment(initialSupply); } - + /** * Gets the Book that this inventory represents. - * + * * @return non-null Book. */ public Book getBook() { return book; } - + /** * Gets the available quantity. * This is an in-flight value representing the difference between the quantity supplied and quantity sold @@ -76,52 +76,52 @@ public class Inventory implements Serializable { public int getInStock() { return supplied - sold; } - + /** * Gets the quantity supplied so far. - * + * * @return a monotonically increasing positive number. */ public int getSupplied() { return supplied; } - + /** * Gets the quantity sold so far. - * + * * @return a monotonically increasing positive number. */ public int getSold() { return sold; } - + /** * Increment this inventory by the given quantity. - * + * * @param supplied must be positive. */ public void increment(int supplied) { if (supplied < 1) - throw new IllegalArgumentException("Can not add " + supplied + " supplies to " + this + + throw new IllegalArgumentException("Can not add " + supplied + " supplies to " + this + " Suuplied quanlity must be greater than zero."); this.supplied += supplied; } - + /** * Decrement this inventory by the given quantity. - * + * * @param sold must be positive. */ public void decrement(int sold) { if (sold < 1) - throw new IllegalArgumentException("can not sell " + sold + "quantity to " + this + throw new IllegalArgumentException("can not sell " + sold + "quantity to " + this + "Sold quantity Must be greater than zero."); this.sold += sold; } - + @Version private int version; - + public int getVersion() { return version; } diff --git a/openjpa-examples/openbooks/src/main/java/openbook/domain/LineItem.java b/openjpa-examples/openbooks/src/main/java/openbook/domain/LineItem.java index 0b19a8e53..a72b8d601 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/domain/LineItem.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/domain/LineItem.java @@ -28,7 +28,7 @@ import javax.persistence.OrderColumn; * An immutable persistent entity with complex primary key. * The primary key is combination of the primary identity of {@linkplain PurchaseOrder} and * an 1-based integer index. - * + * * @author Pinaki Poddar * */ @@ -43,29 +43,29 @@ public class LineItem implements Serializable { @Id @OneToOne private PurchaseOrder order; - + @Id @OrderColumn @Column(name="IDX") // index is keyword private int index; - + @ManyToOne(optional=false) private Book book; - + private int quantity; - + protected LineItem() { - + } - + /** * Constructed as a line item for the given PurchaseOrder for the given Book for the given quantity. * Package protected because only the PurchaseOrder can create its own LineItem. - * + * * @param order non-null PurchaseOrder - * @param i the 1-based index of this line item in its parent PurchaseOrder + * @param i the 1-based index of this line item in its parent PurchaseOrder * @param book non-null Book of this line item - * @param quantity no. of books must be greater than zero. + * @param quantity no. of books must be greater than zero. */ LineItem(PurchaseOrder order, int i, Book book, int quantity) { if (order == null) @@ -76,13 +76,13 @@ public class LineItem implements Serializable { throw new NullPointerException("Can not create LineItem for null Book"); if (quantity < 1) throw new IllegalArgumentException("Can not create LineItem with quantity " + i + ". Must be > 0"); - + this.order = order; this.index = i; this.book = book; this.quantity = quantity; } - + /** * Gets the Book for this line item. * @return non-null Book. @@ -114,17 +114,17 @@ public class LineItem implements Serializable { public int getIndex() { return index; } - + /** * Separate identity class. - * + * * @author Pinaki Poddar * */ public static class LineItemId implements Serializable { - long order; + long order; int index; - + @Override public boolean equals(Object other) { if (other == this) @@ -135,7 +135,7 @@ public class LineItem implements Serializable { } return false; } - + @Override public int hashCode() { return (int) (31 ^ order + index); diff --git a/openjpa-examples/openbooks/src/main/java/openbook/domain/PurchaseOrder.java b/openjpa-examples/openbooks/src/main/java/openbook/domain/PurchaseOrder.java index f3ca14316..477ca8020 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/domain/PurchaseOrder.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/domain/PurchaseOrder.java @@ -32,7 +32,7 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; /** - * A persistent entity to demonstrate Master in a Master-Details or Composite pattern for + * A persistent entity to demonstrate Master in a Master-Details or Composite pattern for * persistent domain model. *
    * The Purchase Order - Line Items relationship typically demonstrates a Master-Details pattern. @@ -42,15 +42,15 @@ import javax.persistence.TemporalType; * the Master's identity. *

  • 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. - *
    + * translates to deletion of Details record from database when the details lose their relation to master. + *
    * Besides the above two key features, this persistent type also shows usage of *
  • Auto-generated identity. *
  • Enum type persistent attribute. *
  • Date type persistent attribute. *
  • One-to-One uni-directional, immutable mapping to Customer. *
  • One-to-Many bi-directional, immutable mapping to LineItem. - * + * * @author Pinaki Poddar * */ @@ -62,7 +62,7 @@ public class PurchaseOrder implements Serializable { * */ public enum Status {PENDING, DELIVERED}; - + /** * * Persistent Identity is generated by the provider. @@ -70,48 +70,48 @@ public class PurchaseOrder implements Serializable { @Id @GeneratedValue private long id; - + @OneToOne(optional=false) private Customer customer; - + /** * * A composite relation. * All persistence operation on this order are cascaded to its line items. - * Moreover, a line item ceases to exist even in the database if it is no - * more referred to by a order. This is known as orphan delete - * and can be termed as persistent garbage collection. - * + * Moreover, a line item ceases to exist even in the database if it is no + * more referred to by a order. This is known as orphan delete + * and can be termed as persistent garbage collection. + * */ @OneToMany(mappedBy="order", fetch=FetchType.EAGER, cascade=CascadeType.ALL, orphanRemoval=true) private List items; - + private Status status; - + private int total; - + @Temporal(TemporalType.TIMESTAMP) private Timestamp placedOn; - + @Temporal(TemporalType.TIMESTAMP) private Timestamp deliveredOn; - + /** * A protected constructor satisfies two purposes:
    - *
  • i) Status and creation time is set consistently. + *
  • i) Status and creation time is set consistently. *
  • 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()); } - + /** * * 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 @@ -128,7 +128,7 @@ public class PurchaseOrder implements Serializable { addItem(entry.getKey(), entry.getValue()); } } - + /** * Gets the immutable, auto-generated persistent identity of this Purchase Order. */ @@ -138,32 +138,32 @@ public class PurchaseOrder implements Serializable { /** * 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; } - + public boolean isDelivered() { return Status.DELIVERED.equals(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() { @@ -173,17 +173,17 @@ public class PurchaseOrder implements Serializable { this.deliveredOn = new Timestamp(System.currentTimeMillis()); this.items = null; } - + /** * 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 getItems() { return items; } - + /** * Adds an item to this Purchase Order. * The total is adjusted as a side-effect. @@ -192,21 +192,21 @@ public class PurchaseOrder implements Serializable { 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 (=" + + throw new IllegalArgumentException("Can not add Line Item to Purchase Order for negative (=" + quantity + ") number of Book " + book); if (items == null) items = new ArrayList(); 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; } - + /** * Gets the time when this order was placed. */ @@ -216,7 +216,7 @@ public class PurchaseOrder implements Serializable { /** * Gets the time when this order was delivered. - * + * * @return null if the order has not been delivered yet. */ public Date getDeliveredOn() { diff --git a/openjpa-examples/openbooks/src/main/java/openbook/domain/Range.java b/openjpa-examples/openbooks/src/main/java/openbook/domain/Range.java index 4f5053d4a..9839dfad4 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/domain/Range.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/domain/Range.java @@ -17,7 +17,7 @@ package openbook.domain; /** * A simple numeric range. * Minimum value is included, maximum value is excluded. - * + * * @author Pinaki Poddar * */ @@ -25,7 +25,7 @@ public class Range { private N min; private N max; private final Class type; - + @SuppressWarnings("unchecked") public Range(Object min, Object max) { this((N)min, (N)max); @@ -33,7 +33,7 @@ public class Range { /** * Creates a range. Empty range i.e. where minimum equals maximum is allowed. - * + * * @param min non-null minimum value. * @param max non-null maximum value. */ @@ -47,53 +47,53 @@ public class Range { this.max = max; type = (Class)min.getClass(); } - + public Class type() { return type; } - + /** * Affirms if the given value is within this range. * Minimum is included, maximum is excluded. - * + * * @param x a non-null value * @return true if the given value is greater than or equals to minimum and less than the maximum. */ public boolean contains(Number x) { return x != null && x.doubleValue() >= min.doubleValue() && x.doubleValue() < max.doubleValue(); } - + /** * Affirms if the given range is within this range. * Minimum is included, maximum is excluded. - * + * * @param x a non-null value * @return true if the given value is greater than or equals to minimum and less than the maximum. */ public boolean contains(Range r) { - return r != null && r.getMinimum().doubleValue() >= min.doubleValue() && + return r != null && r.getMinimum().doubleValue() >= min.doubleValue() && r.getMaximum().doubleValue() <= max.doubleValue(); } - + /** * Gets the minimum value. */ public N getMinimum() { return min; } - + /** * Gets the maximum value. */ public N getMaximum() { return max; } - + /** * Adjusts this range by the given number. - * + * * @param x a non-null value. - * + * * @return if this range is adjusted by this value. */ public boolean adjust(N x) { @@ -109,7 +109,7 @@ public class Range { } return false; } - + @Override public int hashCode() { diff --git a/openjpa-examples/openbooks/src/main/java/openbook/domain/ShoppingCart.java b/openjpa-examples/openbooks/src/main/java/openbook/domain/ShoppingCart.java index 1d911346d..4cd303fff 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/domain/ShoppingCart.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/domain/ShoppingCart.java @@ -23,7 +23,7 @@ import java.util.Map; * A non-persistent entity holds the content of a shopping session for a {@linkplain Customer}. * Used to create a persistent PurchaseOrder. * Books can be added or removed from this cart. - * + * * @author Pinaki Poddar * */ @@ -33,60 +33,60 @@ public class ShoppingCart implements Serializable { * The owner of this cart. */ private Customer customer; - + /** * * The items in the cart and their respective quantity. */ private Map items; - + /** * Construct a cart for the given Customer. - * + * * @param c non-null Customer. */ ShoppingCart(Customer c) { customer = c; items = new HashMap(); } - + /** * Gets the Customer who owns this cart. - * + * * @return non-null Customer. */ public Customer getCustomer() { return customer; } - + /** * Gets the books with their corresponding quantity in this cart. - * + * */ public Map getItems() { return items; } - + /** * Add the given book with the given quantity in the cart. * If the book already exists then the quantity is added to the existing quantity. - * + * * @param book non-null Book - * @param quantity a positive quantity. + * @param quantity a positive quantity. */ public void addItem(Book book, int quantity) { if (book == null) throw new NullPointerException("Can not add null Book to " + this); if (quantity < 1) - throw new IllegalArgumentException("Can not add " + quantity + " " + book + " to " + this + + throw new IllegalArgumentException("Can not add " + quantity + " " + book + " to " + this + " Added qunatity must be greater than zero"); int current = items.containsKey(book) ? items.get(book) : 0; items.put(book, current + quantity); } - + /** * Change the quantity of the given book by the given delta. - * + * * @param book a non-null Book that must exist in this cart. * @param delta no. of quantity to change. Can be positive or negative. * If the resultant quantity becomes zero of negative, the book is removed from the cart. @@ -104,10 +104,10 @@ public class ShoppingCart implements Serializable { items.put(book, current + delta); } } - + /** * Removes the given book from this cart. - * + * * @param book book a non-null Book that must exist in this cart. */ public void remove(Book book) { @@ -118,15 +118,15 @@ public class ShoppingCart implements Serializable { "exist in " + this); items.remove(book); } - + public void clear() { items.clear(); } - + public boolean isEmpty() { return items.isEmpty(); } - + public int getTotalCount() { int sum = 0; for (Integer q : items.values()) diff --git a/openjpa-examples/openbooks/src/main/java/openbook/server/DataLoader.java b/openjpa-examples/openbooks/src/main/java/openbook/server/DataLoader.java index aa38a4553..c6023ae3a 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/server/DataLoader.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/server/DataLoader.java @@ -19,18 +19,18 @@ import openbook.util.PropertyHelper; /** * Cleans and loads a new OpenBooks database. - * + * * @author Pinaki Poddar * */ public class DataLoader { - + /** * Load data. - * + * * @param args 0-th argument is the name of persistence unit * 1-st argument is the path to the data file - * + * * @throws Exception */ public static void main(String[] args) throws Exception { diff --git a/openjpa-examples/openbooks/src/main/java/openbook/server/OpenBookService.java b/openjpa-examples/openbooks/src/main/java/openbook/server/OpenBookService.java index 3ee879e20..936bf9ca6 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/server/OpenBookService.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/server/OpenBookService.java @@ -27,57 +27,57 @@ import openbook.domain.ShoppingCart; /** * A simple service to select Books, purchase them and manage their inventory. * A service handle can be obtained from {@link ServiceFactory#getService(String) - * Service Factory}. - * + * Service Factory}. + * * @author Pinaki Poddar * */ public interface OpenBookService { public static final String DEFAULT_UNIT_NAME = "OpenBooks"; - + /** * Starts a session for the given named Customer. * If no record of the given name exists, a new Customer record is created. - * + * * @param name name of a possibly existing customer. Or a new one. - * + * * @return a Customer */ public Customer login(String name); - + /** * Selects a list of Books matching the given conditions. * Each of the conditional parameter can be null. * A null parameter implies that the resultant query should ignore that parameter. - * + * * @param title title of the Book * @param min minimum price * @param max maximum price * @param author name of author * @param decorators to modify the executable query such as its range. */ - public List select(String title, - Double min, Double max, - String author, + public List select(String title, + Double min, Double max, + String author, QueryDecorator...decorators); /** * Gets the query String for the given parameters. * Each of the conditional parameter can be null. * A null parameter implies that the resultant query should ignore that parameter. - * + * * @param title title of the Book * @param min minimum price * @param max maximum price * @param author name of author * @param decorators to modify the executable query such as its range. */ - public String getQuery(String title, - Double min, Double max, + public String getQuery(String title, + Double min, Double max, String author); - + /** * Runs an arbitrary JPQL query to return a list of result. - * + * * @param jpql a valid JPQL query string. * @param resultClass type of the result. * @param decorators zero or more QueryDecorators to be applied before Query is executed. @@ -88,93 +88,93 @@ public interface OpenBookService { /** * Buys the content of the given cart. - * + * * @param cart a non-empty cart. * @return a PurchaseOrder for the content of the cart. */ - public PurchaseOrder placeOrder(ShoppingCart cart); - + public PurchaseOrder placeOrder(ShoppingCart cart); + /** * Delivers the given order. Delivery changes the status of the order, decrements * inventory and finally removes the line items. - * + * * @param order a PENDING order to be delivered. * @return the PurchaseOrder after delivery. - * + * */ public PurchaseOrder deliver(PurchaseOrder order); - + /** * Add inventory of the given Book by the given quantity. - * + * * @param b a Book whose inventory is to be incremented * @param quantity positive number. - * + * * @return the Book after incrementing its inventory. */ public Book supply(Book b, int quantity); - + /** * Gets the list of orders of given status. - * + * * @param status status of the orders. null implies all orders. - * + * * @return list of orders sorted by their placement dates. */ public List getOrders(PurchaseOrder.Status status, Customer customer); - - + + /** * Gets the list of Books whose inventory is lower than the given limit. - * + * * @param limit reorder limit. null implies all inventory. - * + * * @return list of Books with inventory lower than the given limit. */ public List getReorderableBooks(int limit); - + /** * Count the number of instances of the given persistent type. - * + * * @param cls a persistent type. * @return number of persistent entity of the given type. */ public long count(Class cls); - + /** * Populates the underlying data repository with sample values, only if * the data repository is empty. - * + * * @param loadParameters control the number of Books etc. to be created. * null is allowed. - * + * * @return true if the repository is initialized by this invocation. */ public boolean initialize(Map loadParameters); - + /** * Cleans everything. Be careful. */ public void clean(); - - + + /** * Gets the underlying persistence unit. - * + * */ public EntityManagerFactory getUnit(); - + /** * Gets the name of the underlying persistence unit. - * + * */ public String getUnitName(); - + /** * Affirms if the transaction on this persistence unit is managed by a container. - * + * */ public boolean isManaged(); - - + + } diff --git a/openjpa-examples/openbooks/src/main/java/openbook/server/OpenBookServiceImpl.java b/openjpa-examples/openbooks/src/main/java/openbook/server/OpenBookServiceImpl.java index c35681528..c3039c4ac 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/server/OpenBookServiceImpl.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/server/OpenBookServiceImpl.java @@ -52,45 +52,45 @@ import org.apache.openjpa.persistence.criteria.OpenJPACriteriaBuilder; /** * A demonstrative example of a transaction service with persistent entity using Java Persistence API. *
    - * This example service operates on a persistent domain model to browse {@linkplain Book books}, - * occasionally {@linkplain #placeOrder(ShoppingCart) placing} {@linkplain PurchaseOrder purchase orders}, - * while {@linkplain Inventory inventory} gets updated either by {@linkplain #deliver() delivery} or - * by {@linkplain #supply() supply}. + * This example service operates on a persistent domain model to browse {@linkplain Book books}, + * occasionally {@linkplain #placeOrder(ShoppingCart) placing} {@linkplain PurchaseOrder purchase orders}, + * while {@linkplain Inventory inventory} gets updated either by {@linkplain #deliver() delivery} or + * by {@linkplain #supply() supply}. *
    * The operational model as well as the persistent domain model is influenced by the fact that - * a JPA based application can benefit from + * a JPA based application can benefit from *
  • Mostly Immutable Persistent Data Model - *
  • Optimistic Transaction Model + *
  • Optimistic Transaction Model *
    for better scalability and throughput. - *
    - * + *
    + * * @author Pinaki Poddar * */ @SuppressWarnings("serial") class OpenBookServiceImpl extends PersistenceService implements OpenBookService { - + public static final int CUSTOMER_COUNT = 10; public static final int BOOK_COUNT = 100; public static final int AUTHOR_COUNT = 40; public static final int AUTHOR_PER_BOOK = 3; - + /** * Range of number of queries executed for a {@linkplain #shop() shopping} trip. */ public static final Range PRICE_RANGE = new Range(4.99, 120.99); public static final Range STOCK_RANGE = new Range(5, 50); public static final int REORDER_LEVEL = 10; - + OpenBookServiceImpl(String unit, EntityManagerFactory emf, boolean managed, PersistenceContextType scope) { super(unit, emf, managed, scope); } - + /** * Initialize service by populating inventory of Books and Customers. * If the inventory exists, then returns immediately without creating any new inventory. - * + * * @return true if new inventory is created. false otherwise. */ public boolean initialize(Map config) { @@ -111,7 +111,7 @@ class OpenBookServiceImpl extends PersistenceService implements OpenBookService Integer stockMax = PropertyHelper.getInteger(config, "openbook.Inventory.Max", STOCK_RANGE.getMaximum()); Integer stockMin = PropertyHelper.getInteger(config, "openbook.Inventory.Min", STOCK_RANGE.getMinimum()); - + System.err.println("Creating " + nCustomer + " new Customer"); for (int i = 1; i < nCustomer; i++) { Customer customer = new Customer(); @@ -130,11 +130,11 @@ class OpenBookServiceImpl extends PersistenceService implements OpenBookService System.err.println("Creating " + nBook + " new Books"); System.err.println("Linking at most " + nAuthorPerBook + " Authors per Book"); for (int i = 1; i <= nBook; i++) { - Book book = new Book(Randomizer.randomString(4,2), - "Book-" + i, - Randomizer.random(priceMin, priceMax), + Book book = new Book(Randomizer.randomString(4,2), + "Book-" + i, + Randomizer.random(priceMin, priceMax), Randomizer.random(stockMin, stockMax)); - List authors = Randomizer.selectRandom(allAuthors, + List authors = Randomizer.selectRandom(allAuthors, Math.max(1, Randomizer.random(nAuthorPerBook))); for (Author author : authors) { author.addBook(book); @@ -142,31 +142,31 @@ class OpenBookServiceImpl extends PersistenceService implements OpenBookService } em.persist(book); } - - + + commit(); return true; } - + /** * Affirms whether the database is loaded with some records. */ public boolean isInitialized() { return count(Book.class) > 0; } - + /** *
    * Provide a name to login a Customer. * If such a customer exists, return it. Otherwise creates a new one. - * + * * @param name name of an existing or a new Customer - * + * * @return a Customer */ public Customer login(String name) { EntityManager em = begin(); - + CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery q = cb.createQuery(Customer.class); Customer customer = null; @@ -187,7 +187,7 @@ class OpenBookServiceImpl extends PersistenceService implements OpenBookService commit(); return customer; } - + /** * Find books that match title and price range. */ @@ -200,22 +200,22 @@ class OpenBookServiceImpl extends PersistenceService implements OpenBookService commit(); return result; } - + /** * * Gets the string representation of a Criteria Query. * The string form of a Criteria Query is not specified in JPA specification. - * But OpenJPA produces a readable form that is quite similar to + * But OpenJPA produces a readable form that is quite similar to * equivalent JPQL. */ public String getQuery(String title, Double minPrice, Double maxPrice, String author) { CriteriaQuery q = buildQuery(title, minPrice, maxPrice, author); return q.toString(); } - + /** * - * Creates a Query based on the values of the user input form. + * Creates a Query based on the values of the user input form. * The user may or may not have filled a value for each form field * and accordingly the query will be different.
    * This is typical of a form-based query. To account for all possible @@ -224,20 +224,20 @@ class OpenBookServiceImpl extends PersistenceService implements OpenBookService * conditional be alternatively developed using {@link CriteriaQuery} * introduced in JPA version 2.0. *
    - * + * * @return a typed query */ private CriteriaQuery buildQuery(String title, Double minPrice, Double maxPrice, String author) { // builder generates the Criteria Query as well as all the expressions CriteriaBuilder cb = getUnit().getCriteriaBuilder(); - // The query declares what type of result it will produce + // The query declares what type of result it will produce CriteriaQuery q = cb.createQuery(Book.class); // Which type will be searched Root book = q.from(Book.class); // of course, the projection term must match the result type declared earlier q.select(book); - - // Builds the predicates conditionally for the filled-in input fields + + // Builds the predicates conditionally for the filled-in input fields List predicates = new ArrayList(); if (!isEmpty(title)) { Predicate matchTitle = cb.like(book.get(Book_.title), title); @@ -248,7 +248,7 @@ class OpenBookServiceImpl extends PersistenceService implements OpenBookService predicates.add(matchAuthor); } // for price fields, also the comparison operation changes based on whether - // minimum or maximum price or both have been filled. + // minimum or maximum price or both have been filled. if (minPrice != null && maxPrice != null) { Predicate matchPrice = cb.between(book.get(Book_.price), minPrice, maxPrice); predicates.add(matchPrice); @@ -259,18 +259,18 @@ class OpenBookServiceImpl extends PersistenceService implements OpenBookService Predicate matchPrice = cb.le(book.get(Book_.price), maxPrice); predicates.add(matchPrice); } - // Sets the evaluation criteria + // Sets the evaluation criteria if (!predicates.isEmpty()) q.where(predicates.toArray(new Predicate[predicates.size()])); - + return q; } - + boolean isEmpty(String s) { - return s == null || s.trim().isEmpty(); + return s == null || s.trim().isEmpty(); } - + /** *
    * Delivers the given order, if it is pending. @@ -292,7 +292,7 @@ class OpenBookServiceImpl extends PersistenceService implements OpenBookService commit(); return o; } - + public List getOrders(PurchaseOrder.Status status, Customer customer) { EntityManager em = begin(); CriteriaBuilder cb = em.getCriteriaBuilder(); @@ -309,13 +309,13 @@ class OpenBookServiceImpl extends PersistenceService implements OpenBookService if (!predicates.isEmpty()) q.where(predicates.toArray(new Predicate[predicates.size()])); q.orderBy(cb.desc(order.get(PurchaseOrder_.placedOn))); - + TypedQuery query = em.createQuery(q); List result = query.getResultList(); commit(); return result; } - + /** * * Creates a new {@linkplain PurchaseOrder} from the content of the given {@linkplain ShoppingCart}. @@ -323,7 +323,7 @@ class OpenBookServiceImpl extends PersistenceService implements OpenBookService *
    * The transaction is not expected to fail because the inventory is * not modified by placing an order. - * + * * @param cart a non-null Shopping cart. */ public PurchaseOrder placeOrder(ShoppingCart cart) { @@ -334,13 +334,13 @@ class OpenBookServiceImpl extends PersistenceService implements OpenBookService cart.clear(); return order; } - + /** * Supply books that have low inventory. *
    * Queries for books with low inventory and supply each book in separate * transaction. Some of the transactions may fail due to concurrent modification on - * the {@linkplain Inventory} by the {@linkplain #deliver() delivery} process. + * the {@linkplain Inventory} by the {@linkplain #deliver() delivery} process. */ public Book supply(Book b, int quantity) { EntityManager em = begin(); @@ -349,7 +349,7 @@ class OpenBookServiceImpl extends PersistenceService implements OpenBookService commit(); return b; } - + public List getReorderableBooks(int limit) { EntityManager em = begin(); CriteriaBuilder cb = em.getCriteriaBuilder(); @@ -357,17 +357,17 @@ class OpenBookServiceImpl extends PersistenceService implements OpenBookService Root inv = q.from(Inventory.class); q.select(inv); Expression inStock = cb.diff( - inv.get(Inventory_.supplied), + inv.get(Inventory_.supplied), inv.get(Inventory_.sold)); q.orderBy(cb.asc(inStock)); - + List result = em.createQuery(q) .setMaxResults(limit) .getResultList(); commit(); return result; } - + public long count(Class cls) { EntityManager em = getEntityManager(); CriteriaBuilder cb = em.getCriteriaBuilder(); @@ -376,11 +376,11 @@ class OpenBookServiceImpl extends PersistenceService implements OpenBookService c.select(cb.count(from)); return em.createQuery(c).getSingleResult(); } - + public List selectByExample(Book b, QueryDecorator...decorators) { return queryByTemplate(Book.class, b); } - + private List queryByTemplate(Class type, T template) { EntityManager em = begin(); CriteriaBuilder cb = em.getCriteriaBuilder(); @@ -390,7 +390,7 @@ class OpenBookServiceImpl extends PersistenceService implements OpenBookService commit(); return result; } - + public List getExtent(Class entityClass) { EntityManager em = begin(); CriteriaQuery c = em.getCriteriaBuilder().createQuery(entityClass); @@ -399,7 +399,7 @@ class OpenBookServiceImpl extends PersistenceService implements OpenBookService commit(); return result; } - + public List query(String jpql, Class resultClass, QueryDecorator... decorators) { EntityManager em = begin(); TypedQuery query = em.createQuery(jpql, resultClass); @@ -412,7 +412,7 @@ class OpenBookServiceImpl extends PersistenceService implements OpenBookService commit(); return result; } - + public void clean() { EntityManager em = begin(); Set> entities = em.getMetamodel().getEntities(); diff --git a/openjpa-examples/openbooks/src/main/java/openbook/server/PersistenceService.java b/openjpa-examples/openbooks/src/main/java/openbook/server/PersistenceService.java index e5e149c70..b055c7af1 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/server/PersistenceService.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/server/PersistenceService.java @@ -21,16 +21,16 @@ import javax.persistence.EntityManagerFactory; import javax.persistence.PersistenceContextType; /** - * An abstract utility for JPA based service. + * An abstract utility for JPA based service. * This thin wrapper over a {@link EntityManagerFactory Persistence Unit} maintains *
  • per-thread persistence context - *
  • relinquishes direct transaction control under a managed environment - * + *
  • relinquishes direct transaction control under a managed environment + * * @see #getEntityManager() * @see #newEntityManager() - * + * * @author Pinaki Poddar - * + * */ @SuppressWarnings("serial") abstract class PersistenceService implements Serializable { @@ -38,18 +38,18 @@ abstract class PersistenceService implements Serializable { private final String unitName; private final boolean isManaged; private final PersistenceContextType scope; - + private ThreadLocal thread = new ThreadLocal(); private ReentrantLock lock = new ReentrantLock(); - protected PersistenceService(String unit, EntityManagerFactory emf, boolean managed, + protected PersistenceService(String unit, EntityManagerFactory emf, boolean managed, PersistenceContextType scope) { this.unitName = unit; this.emf = emf; this.isManaged = managed; this.scope = scope; } - + public final EntityManagerFactory getUnit() { return emf; } @@ -57,11 +57,11 @@ abstract class PersistenceService implements Serializable { public final String getUnitName() { return unitName; } - + public final boolean isManaged() { return isManaged; } - + public final PersistenceContextType getContextType() { return scope; } @@ -71,7 +71,7 @@ abstract class PersistenceService implements Serializable { * current thread is not associated with any entity manager or the * associated entity manager has been closed, creates a new entity manager * and associates with the current thread. - * + * * @return an entity manager associated with the current thread. */ protected EntityManager getEntityManager() { @@ -102,7 +102,7 @@ abstract class PersistenceService implements Serializable { * If the thread is not associated with a persistence context, then a new * context is created, associated with the thread, new transaction is * started. - * + * * @see #getEntityManager() */ protected EntityManager begin() { @@ -151,7 +151,7 @@ abstract class PersistenceService implements Serializable { lock.lock(); EntityManager em = getEntityManager(); if (isManaged) { - + } else { em.getTransaction().rollback(); } @@ -172,7 +172,7 @@ abstract class PersistenceService implements Serializable { assertTrue("No persistent context is associated with " + thread, em != null); assertTrue("Persistent context " + em + " associated with " + thread + " has been closed", em.isOpen()); if (!isManaged) { - assertTrue("Persistent context " + em + " associated with " + thread + " has no active transaction", + assertTrue("Persistent context " + em + " associated with " + thread + " has no active transaction", em.getTransaction().isActive()); } } diff --git a/openjpa-examples/openbooks/src/main/java/openbook/server/QueryDecorator.java b/openjpa-examples/openbooks/src/main/java/openbook/server/QueryDecorator.java index 734b1ad83..3f41af710 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/server/QueryDecorator.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/server/QueryDecorator.java @@ -18,7 +18,7 @@ import javax.persistence.Query; /** * Decorates an executable query. * Concrete decorative action can be binding parameters, limiting the result range etc. - * + * * @author Pinaki Poddar * */ diff --git a/openjpa-examples/openbooks/src/main/java/openbook/server/QueryParameterBinder.java b/openjpa-examples/openbooks/src/main/java/openbook/server/QueryParameterBinder.java index edf394a0a..8baf188f1 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/server/QueryParameterBinder.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/server/QueryParameterBinder.java @@ -17,20 +17,20 @@ import javax.persistence.Query; /** * Decorates a query by binding parameters. - * + * * @author Pinaki Poddar * */ public class QueryParameterBinder implements QueryDecorator { private final Object[] params; - + /** * Construct a parameter binder with the given parameters. */ public QueryParameterBinder(Object...params) { this.params = params; } - + @Override public void decorate(Query query) { if (params == null) @@ -41,7 +41,7 @@ public class QueryParameterBinder implements QueryDecorator { } else if (params[i] instanceof String) { query.setParameter((String)params[i], params[i+1]); } else { - throw new IllegalArgumentException("Parameter index " + params[i] + + throw new IllegalArgumentException("Parameter index " + params[i] + " is neither and integer nor String"); } } diff --git a/openjpa-examples/openbooks/src/main/java/openbook/server/ServiceFactory.java b/openjpa-examples/openbooks/src/main/java/openbook/server/ServiceFactory.java index 8babf7952..3c241c886 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/server/ServiceFactory.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/server/ServiceFactory.java @@ -22,23 +22,23 @@ import javax.persistence.PersistenceContextType; /** * A container of persistence units. Typically a JEE container will create, manage and inject - * the persistence units to the user artifacts. - * + * the persistence units to the user artifacts. + * * @author Pinaki Poddar * */ public class ServiceFactory { private static final Map _services = new HashMap(); - + public synchronized static OpenBookService getService(String unit) { return getService(unit, null); } - + /** * Creates a persistence unit of given name configured with the given - * name-value parameters. - * - * @param unit name of the persistence unit. A META-INF/persistence.xml must be + * name-value parameters. + * + * @param unit name of the persistence unit. A META-INF/persistence.xml must be * available with the same unit name in the classpath. */ public synchronized static OpenBookService getService(String unit, Map config) { diff --git a/openjpa-examples/openbooks/src/main/java/openbook/tools/CommandProcessor.java b/openjpa-examples/openbooks/src/main/java/openbook/tools/CommandProcessor.java index 5bfe4c8cf..52e5388de 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/tools/CommandProcessor.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/tools/CommandProcessor.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package openbook.tools; @@ -31,7 +31,7 @@ import java.util.Set; * User can register a set of command options. Then this processor will parse a set of Strings to * store the values for each of the registered options as well as optionally any unrecognized * option values. - * + * * @author Pinaki Poddar * */ @@ -39,39 +39,39 @@ public class CommandProcessor { private final Map registeredOptions = new HashMap(); private final Set
  • Line Breaks: Swing Editor seems to require an explicit carriage return-line feed * character to render in separate line. While a normal browser works with <br> - * tag alone. + * tag alone. *
  • White space: The CSS property white-space is sufficient for browsers - * to preserve white space within <span> tags. But Swing Editor seems to require + * to preserve white space within <span> tags. But Swing Editor seems to require * explicit nbsp; for white spaces within <span> tags. *
    - * Two boolean properties are provided to control these two properties. + * Two boolean properties are provided to control these two properties. *
    *
  • Line Numbering: A boolean property controls whether line numbers will be printed. * Line numbers are printed in 4 digits with leading zeros, by default. @@ -56,8 +56,8 @@ import org.antlr.runtime.Token; * JavaDoc tags that define an anchor in the source code or creates a hyperlink should * be preserved in the HTML output. The capacity and limitation of processing HTML tages * inside JavaDoc comments are described in {@linkplain TextProcessingUtility here}. - * - * + * + * * @author Pinaki Poddar * */ @@ -68,7 +68,7 @@ public class HTMLTokenRenderer implements TokenRenderer { private boolean addLineBreak = true; private boolean addExplicitSpace = true; private String lineNumberFormat = "%04d"; - + /** * The CSS named styles. */ @@ -80,13 +80,13 @@ public class HTMLTokenRenderer implements TokenRenderer { public static final String CSS_LITERAL = "literal"; public static final String CSS_DECIMAL = "decimal"; public static final String CSS_LINE_NO = "lineno"; - + private Set customIdentifiers = new HashSet(); public static final String NEW_LINE = "\r\n"; public static final String HTML_BR_TAG = "
    "; public static final String HTML_SPACE = " "; - + /** * Gets a end-of-line string: a HTML <br> tag followed by carriage return and line feed. */ @@ -95,7 +95,7 @@ public class HTMLTokenRenderer implements TokenRenderer { } /** - * Gets a string for beginning of a new line. + * Gets a string for beginning of a new line. */ public String newLine(int line) { String result = ""; @@ -156,15 +156,15 @@ public class HTMLTokenRenderer implements TokenRenderer { } return result; } - + String span(String id, String txt) { return "" + txt + ""; } - + String quote(String s) { return "\""+s+"\""; } - + boolean isWhiteSpace(String txt) { for (int i = 0; i < txt.length(); i++) { if (!Character.isWhitespace(txt.charAt(i))) @@ -172,7 +172,7 @@ public class HTMLTokenRenderer implements TokenRenderer { } return true; } - + String fillWhiteSpace(String txt) { StringBuilder space = new StringBuilder(); for (int i = 0; i < txt.length(); i++) { @@ -182,20 +182,20 @@ public class HTMLTokenRenderer implements TokenRenderer { } return space.toString(); } - + /** * Gets the opening <BODY> and <HTML> tags and the <link type="stylesheet"> clause. */ public String getPrologue() { return insertLines( - "", - "", + "", + "", "", "", ""); } - + /** * Gets the closing <BODY> and <HTML> tags */ @@ -213,9 +213,9 @@ public class HTMLTokenRenderer implements TokenRenderer { } // Bean Style setters for auto-configuration - + /** - * Gets the stylesheet to be linked at HTML output. + * Gets the stylesheet to be linked at HTML output. */ public String getStylesheet() { return stylesheet; @@ -257,9 +257,9 @@ public class HTMLTokenRenderer implements TokenRenderer { } /** - * Affirms if explicit line break (carriage return and line feed) will be added + * Affirms if explicit line break (carriage return and line feed) will be added * at the HTML output. - * + * * @see #endLine(int) */ public boolean getAddLineBreak() { @@ -267,9 +267,9 @@ public class HTMLTokenRenderer implements TokenRenderer { } /** - * Sets if explicit line break (carriage return and line feed) will be added + * Sets if explicit line break (carriage return and line feed) will be added * at the HTML output. - * + * * @see #endLine(int) */ public void setAddLineBreak(boolean addLineBreak) { @@ -300,9 +300,9 @@ public class HTMLTokenRenderer implements TokenRenderer { /** * Sets the format string to format line number such as "%%0%4d" - * for a 4-digit number with leading zeros. + * for a 4-digit number with leading zeros. */ public void setLineNumberFormat(String lineNumberFormat) { this.lineNumberFormat = lineNumberFormat; - } + } } diff --git a/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/Java2HTMLConverter.java b/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/Java2HTMLConverter.java index 150f751b6..f0cd0d2f7 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/Java2HTMLConverter.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/Java2HTMLConverter.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package openbook.tools.converter; @@ -24,13 +24,13 @@ import openbook.tools.CommandProcessor; import openbook.tools.util.URIUtils; public class Java2HTMLConverter extends SourceRenderer { - + private final HTMLTokenRenderer _renderer = new HTMLTokenRenderer(); - + public static void main(String[] args) throws Exception { new Java2HTMLConverter().run(args); } - + @Override public void registerOptions(CommandProcessor options) { options.register(true, "-stylesheet").setDefault("java.css"); @@ -40,18 +40,18 @@ public class Java2HTMLConverter extends SourceRenderer { options.register(true, "-showLineNumber").setDefault("true"); options.register(true, "-lineNumberFormat").setDefault("%%0%4d"); } - + @Override public TokenRenderer createRenderer(CommandProcessor options, File outFile) { File styleFile = null; styleFile = new File(getDestinationDirectory(), options.getValue("-stylesheet")); if (!styleFile.exists()) { throw new IllegalArgumentException("Stylesheet file " + styleFile.getAbsolutePath() + - " does not exist. Ensure that the file is available under destination directory" + + " does not exist. Ensure that the file is available under destination directory" + getDestinationDirectory().getAbsolutePath()); } _renderer.setStylesheet(getRelativeStylesheet(styleFile, outFile)); - + _renderer.setAddLineBreak("true".equals(options.getValue("-addLineBreak"))); _renderer.setAddExplicitSpace("true".equals(options.getValue("-addExplicitSpace"))); _renderer.setAnchorLineNumber("true".equals(options.getValue("-anchorLineNumber"))); @@ -59,8 +59,8 @@ public class Java2HTMLConverter extends SourceRenderer { _renderer.setShowLineNumber("true".equals(options.getValue("-showLineNumber"))); return _renderer; } - - + + String getRelativeStylesheet(File styleFile, File outFile) { String stylesheetPath = styleFile.getAbsolutePath().replace(File.separatorChar, FORWARD_SLASH); String outPath = outFile.getAbsolutePath().replace(File.separatorChar, FORWARD_SLASH); diff --git a/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/Java2TextConverter.java b/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/Java2TextConverter.java index cba535d7d..ff00b25c8 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/Java2TextConverter.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/Java2TextConverter.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package openbook.tools.converter; @@ -24,24 +24,24 @@ import openbook.tools.CommandProcessor; /** * Converts Java Source code to plain text with optional line number. - * + * * @author Pinaki Poddar * */ public class Java2TextConverter extends SourceRenderer { - + private final PlainTokenRenderer _renderer = new PlainTokenRenderer(); - + public static void main(String[] args) throws Exception { new Java2TextConverter().run(args); } - + @Override public void registerOptions(CommandProcessor options) { options.register(true, "-showLineNumber").setDefault("true"); options.register(true, "-lineNumberFormat").setDefault("%%0%4d"); } - + @Override public TokenRenderer createRenderer(CommandProcessor options, File outFile) { _renderer.setLineNumberFormat(options.getValue("-lineNumberFormat")); diff --git a/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/ParseTokenListener.java b/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/ParseTokenListener.java index 97e772f62..e03b748f2 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/ParseTokenListener.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/ParseTokenListener.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package openbook.tools.converter; @@ -29,11 +29,11 @@ import org.antlr.runtime.debug.BlankDebugEventListener; /** * A token processor to render the ANTLR tokens. - * + * * This token processor is notified as ANTLR parses every token. - * This processor controls a {@linkplain TokenRenderer renderer} + * This processor controls a {@linkplain TokenRenderer renderer} * that renders the token. - * + * * @author Pinaki Poddar * */ @@ -43,26 +43,26 @@ public class ParseTokenListener extends BlankDebugEventListener { private int decision; private TokenRenderer _renderer; private PrintStream _stream; - + /** * By default, uses a {@linkplain PlainTokenRenderer}. */ ParseTokenListener() { this(new PlainTokenRenderer()); } - + /** * Uses the given renderer and outputs to System output. - * + * * @param renderer a renderer to render the tokens. */ ParseTokenListener(TokenRenderer renderer) { this(renderer, System.out); } - + /** * Uses the given renderer and given outputs stream. - * + * * @param renderer a renderer to render the tokens. * @param stream a output stream where the rendered strings are streamed. */ @@ -70,18 +70,18 @@ public class ParseTokenListener extends BlankDebugEventListener { _renderer = renderer; _stream = stream; } - + @Override public void enterDecision(int d) { - backtracking += 1; + backtracking += 1; decision = d; - } - - @Override - public void exitDecision(int i) { - backtracking -= 1; } - + + @Override + public void exitDecision(int i) { + backtracking -= 1; + } + /** * A regular token is delegated to the renderer for a string representation * and the resultant string is sent to the output stream. @@ -92,14 +92,14 @@ public class ParseTokenListener extends BlankDebugEventListener { changeLine(token.getLine()); _stream.print(_renderer.render(decision, token)); } - + /** * Hidden tokens are tokens that are not processed at lexical processing * stage. The most important hidden token for rendering are the tokens * that represent multi-line or single line comments. The multi-line * comments must be broken into individual lines for line numbering to * remain consistent. - * + * */ @Override public void consumeHiddenToken(Token token) { @@ -115,15 +115,15 @@ public class ParseTokenListener extends BlankDebugEventListener { i++; } } else { - changeLine(token.getLine()); + changeLine(token.getLine()); _stream.print(_renderer.render(decision, token)); } } - + /** * If the given line is different than the current line, then asks the * renderer to end the current line and start a new line. Otherwise, does nothing. - * + * * @param newline */ void changeLine(int newline) { diff --git a/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/PlainTokenRenderer.java b/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/PlainTokenRenderer.java index 3d9a06098..6ee361640 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/PlainTokenRenderer.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/PlainTokenRenderer.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package openbook.tools.converter; @@ -22,7 +22,7 @@ package openbook.tools.converter; import org.antlr.runtime.Token; /** * A default implementation of {@linkplain TokenRenderer} that simply prints the token. - * + * * @author Pinaki Poddar * */ @@ -30,7 +30,7 @@ public class PlainTokenRenderer implements TokenRenderer { private static final String EMPTY = ""; private boolean showLineNumber = true; private String lineNumberFormat = "%04d"; - + public String endLine(int line) { return EMPTY; } diff --git a/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/SourceRenderer.java b/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/SourceRenderer.java index 80ac25087..967d882a1 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/SourceRenderer.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/SourceRenderer.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package openbook.tools.converter; @@ -34,17 +34,17 @@ import org.antlr.runtime.debug.DebugEventListener; /** * Renders Java Source Code. - * + * * @author Pinaki Poddar - * + * */ public abstract class SourceRenderer { - public final static char FORWARD_SLASH = '/'; - public final static String DOT = "."; - public final static String CURRENT_DIRECTORY = "."; - + public final static char FORWARD_SLASH = '/'; + public final static String DOT = "."; + public final static String CURRENT_DIRECTORY = "."; + private File _sourceDir, _destinationDir; - + boolean verbose = false; /** * Renders the given source files. The syntax of the command is @@ -54,27 +54,27 @@ public abstract class SourceRenderer { *
     $ java SourceRenderer -stylesheet mystyle.css -sourcepath test
          *  -d generated/html acme/foo/SomeClass.java
    *

    - * + * * Recognized options are
    * - * - * - * + * allowed. Default is html + * + * *
    -format
    the format of the converted output. Recognized monikers are + *
    -format
    the format of the converted output. Recognized monikers are * html and text. A fully qualified class name that implements {@link TokenRenderer} is - * allowed. Default is html
    -sourcepath
    the root of the source files. Default is the current directory
    -d
    the root of the generated files. Default is the current directory
    -sourcepath
    the root of the source files. Default is the current directory
    -d
    the root of the generated files. Default is the current directory
    * Besides these options, a renderer can accept more options. Any option -someProperty * will configure the renderer if a bean-style setter method setSomeProperty(String|boolean|int) * is available. See available documentation on the specific {@link HTMLTokenRenderer renderer}. - *
    + *
    * Stylesheet file must be under destination directory. *

    -stylesheet
    is relative to destination directory. - * + * * @param args command-line arguments. - * + * * @throws Exception */ - + protected final void run(String[] args) throws Exception { CommandProcessor options = new CommandProcessor(); options.register(true, "-sourcepath").setDefault(CURRENT_DIRECTORY); @@ -82,9 +82,9 @@ public abstract class SourceRenderer { options.register(true, "-extension").setDefault(""); options.register(true, "-verbose").setDefault("false"); registerOptions(options); - - String[] inputs = options.setFrom(args); - + + String[] inputs = options.setFrom(args); + _sourceDir = new File(options.getValue("-sourcepath")); _destinationDir = new File(options.getValue("-d")); verbose = "true".equalsIgnoreCase(options.getValue("-verbose")); @@ -94,7 +94,7 @@ public abstract class SourceRenderer { if (fin == null) { continue; } - + File outFile = new File(_destinationDir, suffix(path, options.getValue("-extension"))); FileOutputStream fout = createOutput(outFile); if (fout == null) { @@ -112,7 +112,7 @@ public abstract class SourceRenderer { out.close(); } } - + public File getDestinationDirectory() { return _destinationDir; } @@ -121,7 +121,7 @@ public abstract class SourceRenderer { } public abstract void registerOptions(CommandProcessor options); public abstract TokenRenderer createRenderer(CommandProcessor options, File outFile); - + private void render(InputStream is, TokenRenderer renderer, PrintStream out) throws Exception { ANTLRInputStream input = new ANTLRInputStream(is); JavaLexer lexer = new JavaLexer(input); @@ -131,15 +131,15 @@ public abstract class SourceRenderer { // launch the parser starting at compilation unit parser.compilationUnit(); } - + /** * Gets the input stream. - * + * * @param srcDir the root source directory. * @param path the path to input file. */ protected InputStream getInputStream(File srcDir, String path) { - File file = new File(srcDir, path); + File file = new File(srcDir, path); if (!file.exists()) { warn("Input file " + file.getAbsolutePath() + " does not exist"); return null; @@ -151,7 +151,7 @@ public abstract class SourceRenderer { } return null; } - + /** * Gets the output stream to write to. */ @@ -169,21 +169,21 @@ public abstract class SourceRenderer { } return null; } - - + + private String suffix(String s, String suffix) { if (suffix == null || suffix.isEmpty()) return s; - if (suffix.startsWith(".")) + if (suffix.startsWith(".")) return s + suffix; return s + "." + suffix; } - + protected void verbose(String s) { if (verbose) System.err.println(s); } - + protected void warn(String s) { System.err.println(s); } diff --git a/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/TokenRenderer.java b/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/TokenRenderer.java index 158eddc65..5ae1d30ec 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/TokenRenderer.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/TokenRenderer.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package openbook.tools.converter; @@ -23,17 +23,17 @@ import org.antlr.runtime.debug.DebugEventListener; /** * Renders a runtime ANTLR token. - * {@linkplain ParseTokenListener} controls a renderer and streams the rendered Strings - * to appropriate output. + * {@linkplain ParseTokenListener} controls a renderer and streams the rendered Strings + * to appropriate output. *
    * A renderer can define additional bean-style setter methods. They will be set before * renderer is used. *
    - * A concrete renderer should have a no argument constructor. + * A concrete renderer should have a no argument constructor. *
    * {@linkplain ParseTokenListener} or the framework calls a renderer in following sequence: *
    - *    bean-style setter methods as per the user configured 
    + *    bean-style setter methods as per the user configured
      *    getPrologue()
      *    for each token {
      *       if (line is changing) {
    @@ -57,47 +57,47 @@ public interface TokenRenderer {
          * the  tag to include the style sheet.
          */
         public String getPrologue();
    -    
    +
         /**
          * Gets a string to be added after token processing ends.
          * For example, a HTML renderer may return the closing HTML and BODY tags.
    -     * 
    +     *
          */
         public String getEpilogue();
    -    
    +
         /**
          * Produce a string representation of the given token.
    -     * 
    +     *
          * @param decision the index of the decision (or the context) in which
          * the current token is being processed. The index refers to ANTLR
          * {@link DebugEventListener#enterDecision(int)}.
    -     * 
    +     *
          * @param token the token to be rendered. Can be a hidden token as well.
    -     * 
    +     *
          * @return a string representation of the given token.
          */
         public String render(int decision, Token token);
    -    
    +
         /**
          * Produce a string to signal beginning of a line.
          * 
    * For example, a renderer printing line numbers can produce a String with the given line number. - * - * @param line the current line number - * + * + * @param line the current line number + * * @return a String can be a blank */ public String newLine(int line); - - + + /** * Produce a string to signal end of a line. *
    * For example, a renderer can produce a newline. - * - * @param line the line being ended - * + * + * @param line the line being ended + * * @return a String can be a blank */ - public String endLine(int line); + public String endLine(int line); } diff --git a/openjpa-examples/openbooks/src/main/java/openbook/tools/parser/JavaLexer.java b/openjpa-examples/openbooks/src/main/java/openbook/tools/parser/JavaLexer.java index d3bb94e3c..6efb35464 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/tools/parser/JavaLexer.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/tools/parser/JavaLexer.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package openbook.tools.parser; // $ANTLR 3.2 Sep 23, 2009 12:02:23 Java.g 2010-05-15 01:06:38 @@ -141,7 +141,7 @@ public class JavaLexer extends Lexer { // delegates // delegators - public JavaLexer() {;} + public JavaLexer() {;} public JavaLexer(CharStream input) { this(input, new RecognizerSharedState()); } @@ -159,7 +159,7 @@ public class JavaLexer extends Lexer { // Java.g:8:7: ( 'package' ) // Java.g:8:9: 'package' { - match("package"); + match("package"); } @@ -180,7 +180,7 @@ public class JavaLexer extends Lexer { // Java.g:9:7: ( ';' ) // Java.g:9:9: ';' { - match(';'); + match(';'); } @@ -200,7 +200,7 @@ public class JavaLexer extends Lexer { // Java.g:10:7: ( 'import' ) // Java.g:10:9: 'import' { - match("import"); + match("import"); } @@ -221,7 +221,7 @@ public class JavaLexer extends Lexer { // Java.g:11:7: ( 'static' ) // Java.g:11:9: 'static' { - match("static"); + match("static"); } @@ -242,7 +242,7 @@ public class JavaLexer extends Lexer { // Java.g:12:7: ( '.' ) // Java.g:12:9: '.' { - match('.'); + match('.'); } @@ -262,7 +262,7 @@ public class JavaLexer extends Lexer { // Java.g:13:7: ( '*' ) // Java.g:13:9: '*' { - match('*'); + match('*'); } @@ -282,7 +282,7 @@ public class JavaLexer extends Lexer { // Java.g:14:7: ( 'public' ) // Java.g:14:9: 'public' { - match("public"); + match("public"); } @@ -303,7 +303,7 @@ public class JavaLexer extends Lexer { // Java.g:15:7: ( 'protected' ) // Java.g:15:9: 'protected' { - match("protected"); + match("protected"); } @@ -324,7 +324,7 @@ public class JavaLexer extends Lexer { // Java.g:16:7: ( 'private' ) // Java.g:16:9: 'private' { - match("private"); + match("private"); } @@ -345,7 +345,7 @@ public class JavaLexer extends Lexer { // Java.g:17:7: ( 'abstract' ) // Java.g:17:9: 'abstract' { - match("abstract"); + match("abstract"); } @@ -366,7 +366,7 @@ public class JavaLexer extends Lexer { // Java.g:18:7: ( 'final' ) // Java.g:18:9: 'final' { - match("final"); + match("final"); } @@ -387,7 +387,7 @@ public class JavaLexer extends Lexer { // Java.g:19:7: ( 'strictfp' ) // Java.g:19:9: 'strictfp' { - match("strictfp"); + match("strictfp"); } @@ -408,7 +408,7 @@ public class JavaLexer extends Lexer { // Java.g:20:7: ( 'class' ) // Java.g:20:9: 'class' { - match("class"); + match("class"); } @@ -429,7 +429,7 @@ public class JavaLexer extends Lexer { // Java.g:21:7: ( 'extends' ) // Java.g:21:9: 'extends' { - match("extends"); + match("extends"); } @@ -450,7 +450,7 @@ public class JavaLexer extends Lexer { // Java.g:22:7: ( 'implements' ) // Java.g:22:9: 'implements' { - match("implements"); + match("implements"); } @@ -471,7 +471,7 @@ public class JavaLexer extends Lexer { // Java.g:23:7: ( '<' ) // Java.g:23:9: '<' { - match('<'); + match('<'); } @@ -491,7 +491,7 @@ public class JavaLexer extends Lexer { // Java.g:24:7: ( ',' ) // Java.g:24:9: ',' { - match(','); + match(','); } @@ -511,7 +511,7 @@ public class JavaLexer extends Lexer { // Java.g:25:7: ( '>' ) // Java.g:25:9: '>' { - match('>'); + match('>'); } @@ -531,7 +531,7 @@ public class JavaLexer extends Lexer { // Java.g:26:7: ( '&' ) // Java.g:26:9: '&' { - match('&'); + match('&'); } @@ -551,7 +551,7 @@ public class JavaLexer extends Lexer { // Java.g:27:7: ( '{' ) // Java.g:27:9: '{' { - match('{'); + match('{'); } @@ -571,7 +571,7 @@ public class JavaLexer extends Lexer { // Java.g:28:7: ( '}' ) // Java.g:28:9: '}' { - match('}'); + match('}'); } @@ -591,7 +591,7 @@ public class JavaLexer extends Lexer { // Java.g:29:7: ( 'interface' ) // Java.g:29:9: 'interface' { - match("interface"); + match("interface"); } @@ -612,7 +612,7 @@ public class JavaLexer extends Lexer { // Java.g:30:7: ( 'void' ) // Java.g:30:9: 'void' { - match("void"); + match("void"); } @@ -633,7 +633,7 @@ public class JavaLexer extends Lexer { // Java.g:31:7: ( '[' ) // Java.g:31:9: '[' { - match('['); + match('['); } @@ -653,7 +653,7 @@ public class JavaLexer extends Lexer { // Java.g:32:7: ( ']' ) // Java.g:32:9: ']' { - match(']'); + match(']'); } @@ -673,7 +673,7 @@ public class JavaLexer extends Lexer { // Java.g:33:7: ( 'throws' ) // Java.g:33:9: 'throws' { - match("throws"); + match("throws"); } @@ -694,7 +694,7 @@ public class JavaLexer extends Lexer { // Java.g:34:7: ( '=' ) // Java.g:34:9: '=' { - match('='); + match('='); } @@ -714,7 +714,7 @@ public class JavaLexer extends Lexer { // Java.g:35:7: ( 'native' ) // Java.g:35:9: 'native' { - match("native"); + match("native"); } @@ -735,7 +735,7 @@ public class JavaLexer extends Lexer { // Java.g:36:7: ( 'synchronized' ) // Java.g:36:9: 'synchronized' { - match("synchronized"); + match("synchronized"); } @@ -756,7 +756,7 @@ public class JavaLexer extends Lexer { // Java.g:37:7: ( 'transient' ) // Java.g:37:9: 'transient' { - match("transient"); + match("transient"); } @@ -777,7 +777,7 @@ public class JavaLexer extends Lexer { // Java.g:38:7: ( 'volatile' ) // Java.g:38:9: 'volatile' { - match("volatile"); + match("volatile"); } @@ -798,7 +798,7 @@ public class JavaLexer extends Lexer { // Java.g:39:7: ( 'boolean' ) // Java.g:39:9: 'boolean' { - match("boolean"); + match("boolean"); } @@ -819,7 +819,7 @@ public class JavaLexer extends Lexer { // Java.g:40:7: ( 'char' ) // Java.g:40:9: 'char' { - match("char"); + match("char"); } @@ -840,7 +840,7 @@ public class JavaLexer extends Lexer { // Java.g:41:7: ( 'byte' ) // Java.g:41:9: 'byte' { - match("byte"); + match("byte"); } @@ -861,7 +861,7 @@ public class JavaLexer extends Lexer { // Java.g:42:7: ( 'short' ) // Java.g:42:9: 'short' { - match("short"); + match("short"); } @@ -882,7 +882,7 @@ public class JavaLexer extends Lexer { // Java.g:43:7: ( 'int' ) // Java.g:43:9: 'int' { - match("int"); + match("int"); } @@ -903,7 +903,7 @@ public class JavaLexer extends Lexer { // Java.g:44:7: ( 'long' ) // Java.g:44:9: 'long' { - match("long"); + match("long"); } @@ -924,7 +924,7 @@ public class JavaLexer extends Lexer { // Java.g:45:7: ( 'float' ) // Java.g:45:9: 'float' { - match("float"); + match("float"); } @@ -945,7 +945,7 @@ public class JavaLexer extends Lexer { // Java.g:46:7: ( 'double' ) // Java.g:46:9: 'double' { - match("double"); + match("double"); } @@ -966,7 +966,7 @@ public class JavaLexer extends Lexer { // Java.g:47:7: ( '?' ) // Java.g:47:9: '?' { - match('?'); + match('?'); } @@ -986,7 +986,7 @@ public class JavaLexer extends Lexer { // Java.g:48:7: ( 'super' ) // Java.g:48:9: 'super' { - match("super"); + match("super"); } @@ -1007,7 +1007,7 @@ public class JavaLexer extends Lexer { // Java.g:49:7: ( '(' ) // Java.g:49:9: '(' { - match('('); + match('('); } @@ -1027,7 +1027,7 @@ public class JavaLexer extends Lexer { // Java.g:50:7: ( ')' ) // Java.g:50:9: ')' { - match(')'); + match(')'); } @@ -1047,7 +1047,7 @@ public class JavaLexer extends Lexer { // Java.g:51:7: ( '...' ) // Java.g:51:9: '...' { - match("..."); + match("..."); } @@ -1068,7 +1068,7 @@ public class JavaLexer extends Lexer { // Java.g:52:7: ( 'this' ) // Java.g:52:9: 'this' { - match("this"); + match("this"); } @@ -1089,7 +1089,7 @@ public class JavaLexer extends Lexer { // Java.g:53:7: ( 'null' ) // Java.g:53:9: 'null' { - match("null"); + match("null"); } @@ -1110,7 +1110,7 @@ public class JavaLexer extends Lexer { // Java.g:54:7: ( 'true' ) // Java.g:54:9: 'true' { - match("true"); + match("true"); } @@ -1131,7 +1131,7 @@ public class JavaLexer extends Lexer { // Java.g:55:7: ( 'false' ) // Java.g:55:9: 'false' { - match("false"); + match("false"); } @@ -1152,7 +1152,7 @@ public class JavaLexer extends Lexer { // Java.g:56:7: ( '@' ) // Java.g:56:9: '@' { - match('@'); + match('@'); } @@ -1172,7 +1172,7 @@ public class JavaLexer extends Lexer { // Java.g:57:7: ( 'default' ) // Java.g:57:9: 'default' { - match("default"); + match("default"); } @@ -1193,7 +1193,7 @@ public class JavaLexer extends Lexer { // Java.g:58:7: ( ':' ) // Java.g:58:9: ':' { - match(':'); + match(':'); } @@ -1213,7 +1213,7 @@ public class JavaLexer extends Lexer { // Java.g:59:7: ( 'if' ) // Java.g:59:9: 'if' { - match("if"); + match("if"); } @@ -1234,7 +1234,7 @@ public class JavaLexer extends Lexer { // Java.g:60:7: ( 'else' ) // Java.g:60:9: 'else' { - match("else"); + match("else"); } @@ -1255,7 +1255,7 @@ public class JavaLexer extends Lexer { // Java.g:61:7: ( 'for' ) // Java.g:61:9: 'for' { - match("for"); + match("for"); } @@ -1276,7 +1276,7 @@ public class JavaLexer extends Lexer { // Java.g:62:7: ( 'while' ) // Java.g:62:9: 'while' { - match("while"); + match("while"); } @@ -1297,7 +1297,7 @@ public class JavaLexer extends Lexer { // Java.g:63:7: ( 'do' ) // Java.g:63:9: 'do' { - match("do"); + match("do"); } @@ -1318,7 +1318,7 @@ public class JavaLexer extends Lexer { // Java.g:64:7: ( 'try' ) // Java.g:64:9: 'try' { - match("try"); + match("try"); } @@ -1339,7 +1339,7 @@ public class JavaLexer extends Lexer { // Java.g:65:7: ( 'finally' ) // Java.g:65:9: 'finally' { - match("finally"); + match("finally"); } @@ -1360,7 +1360,7 @@ public class JavaLexer extends Lexer { // Java.g:66:7: ( 'switch' ) // Java.g:66:9: 'switch' { - match("switch"); + match("switch"); } @@ -1381,7 +1381,7 @@ public class JavaLexer extends Lexer { // Java.g:67:7: ( 'return' ) // Java.g:67:9: 'return' { - match("return"); + match("return"); } @@ -1402,7 +1402,7 @@ public class JavaLexer extends Lexer { // Java.g:68:7: ( 'throw' ) // Java.g:68:9: 'throw' { - match("throw"); + match("throw"); } @@ -1423,7 +1423,7 @@ public class JavaLexer extends Lexer { // Java.g:69:7: ( 'break' ) // Java.g:69:9: 'break' { - match("break"); + match("break"); } @@ -1444,7 +1444,7 @@ public class JavaLexer extends Lexer { // Java.g:70:7: ( 'continue' ) // Java.g:70:9: 'continue' { - match("continue"); + match("continue"); } @@ -1465,7 +1465,7 @@ public class JavaLexer extends Lexer { // Java.g:71:7: ( 'catch' ) // Java.g:71:9: 'catch' { - match("catch"); + match("catch"); } @@ -1486,7 +1486,7 @@ public class JavaLexer extends Lexer { // Java.g:72:7: ( 'case' ) // Java.g:72:9: 'case' { - match("case"); + match("case"); } @@ -1507,7 +1507,7 @@ public class JavaLexer extends Lexer { // Java.g:73:7: ( '+=' ) // Java.g:73:9: '+=' { - match("+="); + match("+="); } @@ -1528,7 +1528,7 @@ public class JavaLexer extends Lexer { // Java.g:74:7: ( '-=' ) // Java.g:74:9: '-=' { - match("-="); + match("-="); } @@ -1549,7 +1549,7 @@ public class JavaLexer extends Lexer { // Java.g:75:7: ( '*=' ) // Java.g:75:9: '*=' { - match("*="); + match("*="); } @@ -1570,7 +1570,7 @@ public class JavaLexer extends Lexer { // Java.g:76:7: ( '/=' ) // Java.g:76:9: '/=' { - match("/="); + match("/="); } @@ -1591,7 +1591,7 @@ public class JavaLexer extends Lexer { // Java.g:77:7: ( '&=' ) // Java.g:77:9: '&=' { - match("&="); + match("&="); } @@ -1612,7 +1612,7 @@ public class JavaLexer extends Lexer { // Java.g:78:7: ( '|=' ) // Java.g:78:9: '|=' { - match("|="); + match("|="); } @@ -1633,7 +1633,7 @@ public class JavaLexer extends Lexer { // Java.g:79:7: ( '^=' ) // Java.g:79:9: '^=' { - match("^="); + match("^="); } @@ -1654,7 +1654,7 @@ public class JavaLexer extends Lexer { // Java.g:80:7: ( '%=' ) // Java.g:80:9: '%=' { - match("%="); + match("%="); } @@ -1675,7 +1675,7 @@ public class JavaLexer extends Lexer { // Java.g:81:7: ( '||' ) // Java.g:81:9: '||' { - match("||"); + match("||"); } @@ -1696,7 +1696,7 @@ public class JavaLexer extends Lexer { // Java.g:82:7: ( '&&' ) // Java.g:82:9: '&&' { - match("&&"); + match("&&"); } @@ -1717,7 +1717,7 @@ public class JavaLexer extends Lexer { // Java.g:83:8: ( '|' ) // Java.g:83:10: '|' { - match('|'); + match('|'); } @@ -1737,7 +1737,7 @@ public class JavaLexer extends Lexer { // Java.g:84:8: ( '^' ) // Java.g:84:10: '^' { - match('^'); + match('^'); } @@ -1757,7 +1757,7 @@ public class JavaLexer extends Lexer { // Java.g:85:8: ( '==' ) // Java.g:85:10: '==' { - match("=="); + match("=="); } @@ -1778,7 +1778,7 @@ public class JavaLexer extends Lexer { // Java.g:86:8: ( '!=' ) // Java.g:86:10: '!=' { - match("!="); + match("!="); } @@ -1799,7 +1799,7 @@ public class JavaLexer extends Lexer { // Java.g:87:8: ( 'instanceof' ) // Java.g:87:10: 'instanceof' { - match("instanceof"); + match("instanceof"); } @@ -1820,7 +1820,7 @@ public class JavaLexer extends Lexer { // Java.g:88:8: ( '+' ) // Java.g:88:10: '+' { - match('+'); + match('+'); } @@ -1840,7 +1840,7 @@ public class JavaLexer extends Lexer { // Java.g:89:8: ( '-' ) // Java.g:89:10: '-' { - match('-'); + match('-'); } @@ -1860,7 +1860,7 @@ public class JavaLexer extends Lexer { // Java.g:90:8: ( '/' ) // Java.g:90:10: '/' { - match('/'); + match('/'); } @@ -1880,7 +1880,7 @@ public class JavaLexer extends Lexer { // Java.g:91:8: ( '%' ) // Java.g:91:10: '%' { - match('%'); + match('%'); } @@ -1900,7 +1900,7 @@ public class JavaLexer extends Lexer { // Java.g:92:8: ( '++' ) // Java.g:92:10: '++' { - match("++"); + match("++"); } @@ -1921,7 +1921,7 @@ public class JavaLexer extends Lexer { // Java.g:93:8: ( '--' ) // Java.g:93:10: '--' { - match("--"); + match("--"); } @@ -1942,7 +1942,7 @@ public class JavaLexer extends Lexer { // Java.g:94:8: ( '~' ) // Java.g:94:10: '~' { - match('~'); + match('~'); } @@ -1962,7 +1962,7 @@ public class JavaLexer extends Lexer { // Java.g:95:8: ( '!' ) // Java.g:95:10: '!' { - match('!'); + match('!'); } @@ -1982,7 +1982,7 @@ public class JavaLexer extends Lexer { // Java.g:96:8: ( 'new' ) // Java.g:96:10: 'new' { - match("new"); + match("new"); } @@ -2003,7 +2003,7 @@ public class JavaLexer extends Lexer { // Java.g:909:12: ( '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )? ) // Java.g:909:14: '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )? { - match('0'); + match('0'); if ( input.LA(1)=='X'||input.LA(1)=='x' ) { input.consume(); @@ -2029,7 +2029,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:909:28: HexDigit { - mHexDigit(); + mHexDigit(); } break; @@ -2054,7 +2054,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:909:38: IntegerTypeSuffix { - mIntegerTypeSuffix(); + mIntegerTypeSuffix(); } break; @@ -2100,14 +2100,14 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:911:19: '0' { - match('0'); + match('0'); } break; case 2 : // Java.g:911:25: '1' .. '9' ( '0' .. '9' )* { - matchRange('1','9'); + matchRange('1','9'); // Java.g:911:34: ( '0' .. '9' )* loop3: do { @@ -2123,7 +2123,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:911:34: '0' .. '9' { - matchRange('0','9'); + matchRange('0','9'); } break; @@ -2150,7 +2150,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:911:45: IntegerTypeSuffix { - mIntegerTypeSuffix(); + mIntegerTypeSuffix(); } break; @@ -2176,7 +2176,7 @@ public class JavaLexer extends Lexer { // Java.g:913:14: ( '0' ( '0' .. '7' )+ ( IntegerTypeSuffix )? ) // Java.g:913:16: '0' ( '0' .. '7' )+ ( IntegerTypeSuffix )? { - match('0'); + match('0'); // Java.g:913:20: ( '0' .. '7' )+ int cnt6=0; loop6: @@ -2193,7 +2193,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:913:21: '0' .. '7' { - matchRange('0','7'); + matchRange('0','7'); } break; @@ -2218,7 +2218,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:913:32: IntegerTypeSuffix { - mIntegerTypeSuffix(); + mIntegerTypeSuffix(); } break; @@ -2312,7 +2312,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:922:10: '0' .. '9' { - matchRange('0','9'); + matchRange('0','9'); } break; @@ -2326,7 +2326,7 @@ public class JavaLexer extends Lexer { cnt8++; } while (true); - match('.'); + match('.'); // Java.g:922:25: ( '0' .. '9' )* loop9: do { @@ -2342,7 +2342,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:922:26: '0' .. '9' { - matchRange('0','9'); + matchRange('0','9'); } break; @@ -2363,7 +2363,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:922:37: Exponent { - mExponent(); + mExponent(); } break; @@ -2381,7 +2381,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:922:47: FloatTypeSuffix { - mFloatTypeSuffix(); + mFloatTypeSuffix(); } break; @@ -2394,7 +2394,7 @@ public class JavaLexer extends Lexer { case 2 : // Java.g:923:9: '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )? { - match('.'); + match('.'); // Java.g:923:13: ( '0' .. '9' )+ int cnt12=0; loop12: @@ -2411,7 +2411,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:923:14: '0' .. '9' { - matchRange('0','9'); + matchRange('0','9'); } break; @@ -2436,7 +2436,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:923:25: Exponent { - mExponent(); + mExponent(); } break; @@ -2454,7 +2454,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:923:35: FloatTypeSuffix { - mFloatTypeSuffix(); + mFloatTypeSuffix(); } break; @@ -2483,7 +2483,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:924:10: '0' .. '9' { - matchRange('0','9'); + matchRange('0','9'); } break; @@ -2497,7 +2497,7 @@ public class JavaLexer extends Lexer { cnt15++; } while (true); - mExponent(); + mExponent(); // Java.g:924:30: ( FloatTypeSuffix )? int alt16=2; int LA16_0 = input.LA(1); @@ -2509,7 +2509,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:924:30: FloatTypeSuffix { - mFloatTypeSuffix(); + mFloatTypeSuffix(); } break; @@ -2538,7 +2538,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:925:10: '0' .. '9' { - matchRange('0','9'); + matchRange('0','9'); } break; @@ -2552,7 +2552,7 @@ public class JavaLexer extends Lexer { cnt17++; } while (true); - mFloatTypeSuffix(); + mFloatTypeSuffix(); } break; @@ -2623,7 +2623,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:929:34: '0' .. '9' { - matchRange('0','9'); + matchRange('0','9'); } break; @@ -2678,7 +2678,7 @@ public class JavaLexer extends Lexer { // Java.g:935:5: ( '\\'' ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) '\\'' ) // Java.g:935:9: '\\'' ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) '\\'' { - match('\''); + match('\''); // Java.g:935:14: ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) int alt21=2; int LA21_0 = input.LA(1); @@ -2699,7 +2699,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:935:16: EscapeSequence { - mEscapeSequence(); + mEscapeSequence(); } break; @@ -2721,7 +2721,7 @@ public class JavaLexer extends Lexer { } - match('\''); + match('\''); } @@ -2741,7 +2741,7 @@ public class JavaLexer extends Lexer { // Java.g:939:5: ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' ) // Java.g:939:8: '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' { - match('\"'); + match('\"'); // Java.g:939:12: ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* loop22: do { @@ -2760,7 +2760,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:939:14: EscapeSequence { - mEscapeSequence(); + mEscapeSequence(); } break; @@ -2785,7 +2785,7 @@ public class JavaLexer extends Lexer { } } while (true); - match('\"'); + match('\"'); } @@ -2853,7 +2853,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:944:9: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) { - match('\\'); + match('\\'); if ( input.LA(1)=='\"'||input.LA(1)=='\''||input.LA(1)=='\\'||input.LA(1)=='b'||input.LA(1)=='f'||input.LA(1)=='n'||input.LA(1)=='r'||input.LA(1)=='t' ) { input.consume(); @@ -2869,14 +2869,14 @@ public class JavaLexer extends Lexer { case 2 : // Java.g:945:9: UnicodeEscape { - mUnicodeEscape(); + mUnicodeEscape(); } break; case 3 : // Java.g:946:9: OctalEscape { - mOctalEscape(); + mOctalEscape(); } break; @@ -2939,25 +2939,25 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:951:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) { - match('\\'); + match('\\'); // Java.g:951:14: ( '0' .. '3' ) // Java.g:951:15: '0' .. '3' { - matchRange('0','3'); + matchRange('0','3'); } // Java.g:951:25: ( '0' .. '7' ) // Java.g:951:26: '0' .. '7' { - matchRange('0','7'); + matchRange('0','7'); } // Java.g:951:36: ( '0' .. '7' ) // Java.g:951:37: '0' .. '7' { - matchRange('0','7'); + matchRange('0','7'); } @@ -2967,18 +2967,18 @@ public class JavaLexer extends Lexer { case 2 : // Java.g:952:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) { - match('\\'); + match('\\'); // Java.g:952:14: ( '0' .. '7' ) // Java.g:952:15: '0' .. '7' { - matchRange('0','7'); + matchRange('0','7'); } // Java.g:952:25: ( '0' .. '7' ) // Java.g:952:26: '0' .. '7' { - matchRange('0','7'); + matchRange('0','7'); } @@ -2988,11 +2988,11 @@ public class JavaLexer extends Lexer { case 3 : // Java.g:953:9: '\\\\' ( '0' .. '7' ) { - match('\\'); + match('\\'); // Java.g:953:14: ( '0' .. '7' ) // Java.g:953:15: '0' .. '7' { - matchRange('0','7'); + matchRange('0','7'); } @@ -3013,12 +3013,12 @@ public class JavaLexer extends Lexer { // Java.g:958:5: ( '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit ) // Java.g:958:9: '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit { - match('\\'); - match('u'); - mHexDigit(); - mHexDigit(); - mHexDigit(); - mHexDigit(); + match('\\'); + match('u'); + mHexDigit(); + mHexDigit(); + mHexDigit(); + mHexDigit(); } @@ -3036,7 +3036,7 @@ public class JavaLexer extends Lexer { // Java.g:961:5: ( 'enum' ) // Java.g:961:9: 'enum' { - match("enum"); + match("enum"); if (!enumIsKeyword) _type=Identifier; @@ -3058,7 +3058,7 @@ public class JavaLexer extends Lexer { // Java.g:965:5: ( 'assert' ) // Java.g:965:9: 'assert' { - match("assert"); + match("assert"); if (!assertIsKeyword) _type=Identifier; @@ -3080,7 +3080,7 @@ public class JavaLexer extends Lexer { // Java.g:969:5: ( Letter ( Letter | JavaIDDigit )* ) // Java.g:969:9: Letter ( Letter | JavaIDDigit )* { - mLetter(); + mLetter(); // Java.g:969:16: ( Letter | JavaIDDigit )* loop25: do { @@ -3210,7 +3210,7 @@ public class JavaLexer extends Lexer { // Java.g:1015:5: ( '/*' ( options {greedy=false; } : . )* '*/' ) // Java.g:1015:9: '/*' ( options {greedy=false; } : . )* '*/' { - match("/*"); + match("/*"); // Java.g:1015:14: ( options {greedy=false; } : . )* loop26: @@ -3239,7 +3239,7 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:1015:42: . { - matchAny(); + matchAny(); } break; @@ -3249,7 +3249,7 @@ public class JavaLexer extends Lexer { } } while (true); - match("*/"); + match("*/"); _channel=HIDDEN; @@ -3271,7 +3271,7 @@ public class JavaLexer extends Lexer { // Java.g:1019:5: ( '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' ) // Java.g:1019:7: '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' { - match("//"); + match("//"); // Java.g:1019:12: (~ ( '\\n' | '\\r' ) )* loop27: @@ -3317,14 +3317,14 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:1019:26: '\\r' { - match('\r'); + match('\r'); } break; } - match('\n'); + match('\n'); _channel=HIDDEN; } @@ -3345,707 +3345,707 @@ public class JavaLexer extends Lexer { case 1 : // Java.g:1:10: T__25 { - mT__25(); + mT__25(); } break; case 2 : // Java.g:1:16: T__26 { - mT__26(); + mT__26(); } break; case 3 : // Java.g:1:22: T__27 { - mT__27(); + mT__27(); } break; case 4 : // Java.g:1:28: T__28 { - mT__28(); + mT__28(); } break; case 5 : // Java.g:1:34: T__29 { - mT__29(); + mT__29(); } break; case 6 : // Java.g:1:40: T__30 { - mT__30(); + mT__30(); } break; case 7 : // Java.g:1:46: T__31 { - mT__31(); + mT__31(); } break; case 8 : // Java.g:1:52: T__32 { - mT__32(); + mT__32(); } break; case 9 : // Java.g:1:58: T__33 { - mT__33(); + mT__33(); } break; case 10 : // Java.g:1:64: T__34 { - mT__34(); + mT__34(); } break; case 11 : // Java.g:1:70: T__35 { - mT__35(); + mT__35(); } break; case 12 : // Java.g:1:76: T__36 { - mT__36(); + mT__36(); } break; case 13 : // Java.g:1:82: T__37 { - mT__37(); + mT__37(); } break; case 14 : // Java.g:1:88: T__38 { - mT__38(); + mT__38(); } break; case 15 : // Java.g:1:94: T__39 { - mT__39(); + mT__39(); } break; case 16 : // Java.g:1:100: T__40 { - mT__40(); + mT__40(); } break; case 17 : // Java.g:1:106: T__41 { - mT__41(); + mT__41(); } break; case 18 : // Java.g:1:112: T__42 { - mT__42(); + mT__42(); } break; case 19 : // Java.g:1:118: T__43 { - mT__43(); + mT__43(); } break; case 20 : // Java.g:1:124: T__44 { - mT__44(); + mT__44(); } break; case 21 : // Java.g:1:130: T__45 { - mT__45(); + mT__45(); } break; case 22 : // Java.g:1:136: T__46 { - mT__46(); + mT__46(); } break; case 23 : // Java.g:1:142: T__47 { - mT__47(); + mT__47(); } break; case 24 : // Java.g:1:148: T__48 { - mT__48(); + mT__48(); } break; case 25 : // Java.g:1:154: T__49 { - mT__49(); + mT__49(); } break; case 26 : // Java.g:1:160: T__50 { - mT__50(); + mT__50(); } break; case 27 : // Java.g:1:166: T__51 { - mT__51(); + mT__51(); } break; case 28 : // Java.g:1:172: T__52 { - mT__52(); + mT__52(); } break; case 29 : // Java.g:1:178: T__53 { - mT__53(); + mT__53(); } break; case 30 : // Java.g:1:184: T__54 { - mT__54(); + mT__54(); } break; case 31 : // Java.g:1:190: T__55 { - mT__55(); + mT__55(); } break; case 32 : // Java.g:1:196: T__56 { - mT__56(); + mT__56(); } break; case 33 : // Java.g:1:202: T__57 { - mT__57(); + mT__57(); } break; case 34 : // Java.g:1:208: T__58 { - mT__58(); + mT__58(); } break; case 35 : // Java.g:1:214: T__59 { - mT__59(); + mT__59(); } break; case 36 : // Java.g:1:220: T__60 { - mT__60(); + mT__60(); } break; case 37 : // Java.g:1:226: T__61 { - mT__61(); + mT__61(); } break; case 38 : // Java.g:1:232: T__62 { - mT__62(); + mT__62(); } break; case 39 : // Java.g:1:238: T__63 { - mT__63(); + mT__63(); } break; case 40 : // Java.g:1:244: T__64 { - mT__64(); + mT__64(); } break; case 41 : // Java.g:1:250: T__65 { - mT__65(); + mT__65(); } break; case 42 : // Java.g:1:256: T__66 { - mT__66(); + mT__66(); } break; case 43 : // Java.g:1:262: T__67 { - mT__67(); + mT__67(); } break; case 44 : // Java.g:1:268: T__68 { - mT__68(); + mT__68(); } break; case 45 : // Java.g:1:274: T__69 { - mT__69(); + mT__69(); } break; case 46 : // Java.g:1:280: T__70 { - mT__70(); + mT__70(); } break; case 47 : // Java.g:1:286: T__71 { - mT__71(); + mT__71(); } break; case 48 : // Java.g:1:292: T__72 { - mT__72(); + mT__72(); } break; case 49 : // Java.g:1:298: T__73 { - mT__73(); + mT__73(); } break; case 50 : // Java.g:1:304: T__74 { - mT__74(); + mT__74(); } break; case 51 : // Java.g:1:310: T__75 { - mT__75(); + mT__75(); } break; case 52 : // Java.g:1:316: T__76 { - mT__76(); + mT__76(); } break; case 53 : // Java.g:1:322: T__77 { - mT__77(); + mT__77(); } break; case 54 : // Java.g:1:328: T__78 { - mT__78(); + mT__78(); } break; case 55 : // Java.g:1:334: T__79 { - mT__79(); + mT__79(); } break; case 56 : // Java.g:1:340: T__80 { - mT__80(); + mT__80(); } break; case 57 : // Java.g:1:346: T__81 { - mT__81(); + mT__81(); } break; case 58 : // Java.g:1:352: T__82 { - mT__82(); + mT__82(); } break; case 59 : // Java.g:1:358: T__83 { - mT__83(); + mT__83(); } break; case 60 : // Java.g:1:364: T__84 { - mT__84(); + mT__84(); } break; case 61 : // Java.g:1:370: T__85 { - mT__85(); + mT__85(); } break; case 62 : // Java.g:1:376: T__86 { - mT__86(); + mT__86(); } break; case 63 : // Java.g:1:382: T__87 { - mT__87(); + mT__87(); } break; case 64 : // Java.g:1:388: T__88 { - mT__88(); + mT__88(); } break; case 65 : // Java.g:1:394: T__89 { - mT__89(); + mT__89(); } break; case 66 : // Java.g:1:400: T__90 { - mT__90(); + mT__90(); } break; case 67 : // Java.g:1:406: T__91 { - mT__91(); + mT__91(); } break; case 68 : // Java.g:1:412: T__92 { - mT__92(); + mT__92(); } break; case 69 : // Java.g:1:418: T__93 { - mT__93(); + mT__93(); } break; case 70 : // Java.g:1:424: T__94 { - mT__94(); + mT__94(); } break; case 71 : // Java.g:1:430: T__95 { - mT__95(); + mT__95(); } break; case 72 : // Java.g:1:436: T__96 { - mT__96(); + mT__96(); } break; case 73 : // Java.g:1:442: T__97 { - mT__97(); + mT__97(); } break; case 74 : // Java.g:1:448: T__98 { - mT__98(); + mT__98(); } break; case 75 : // Java.g:1:454: T__99 { - mT__99(); + mT__99(); } break; case 76 : // Java.g:1:460: T__100 { - mT__100(); + mT__100(); } break; case 77 : // Java.g:1:467: T__101 { - mT__101(); + mT__101(); } break; case 78 : // Java.g:1:474: T__102 { - mT__102(); + mT__102(); } break; case 79 : // Java.g:1:481: T__103 { - mT__103(); + mT__103(); } break; case 80 : // Java.g:1:488: T__104 { - mT__104(); + mT__104(); } break; case 81 : // Java.g:1:495: T__105 { - mT__105(); + mT__105(); } break; case 82 : // Java.g:1:502: T__106 { - mT__106(); + mT__106(); } break; case 83 : // Java.g:1:509: T__107 { - mT__107(); + mT__107(); } break; case 84 : // Java.g:1:516: T__108 { - mT__108(); + mT__108(); } break; case 85 : // Java.g:1:523: T__109 { - mT__109(); + mT__109(); } break; case 86 : // Java.g:1:530: T__110 { - mT__110(); + mT__110(); } break; case 87 : // Java.g:1:537: T__111 { - mT__111(); + mT__111(); } break; case 88 : // Java.g:1:544: T__112 { - mT__112(); + mT__112(); } break; case 89 : // Java.g:1:551: T__113 { - mT__113(); + mT__113(); } break; case 90 : // Java.g:1:558: HexLiteral { - mHexLiteral(); + mHexLiteral(); } break; case 91 : // Java.g:1:569: DecimalLiteral { - mDecimalLiteral(); + mDecimalLiteral(); } break; case 92 : // Java.g:1:584: OctalLiteral { - mOctalLiteral(); + mOctalLiteral(); } break; case 93 : // Java.g:1:597: FloatingPointLiteral { - mFloatingPointLiteral(); + mFloatingPointLiteral(); } break; case 94 : // Java.g:1:618: CharacterLiteral { - mCharacterLiteral(); + mCharacterLiteral(); } break; case 95 : // Java.g:1:635: StringLiteral { - mStringLiteral(); + mStringLiteral(); } break; case 96 : // Java.g:1:649: ENUM { - mENUM(); + mENUM(); } break; case 97 : // Java.g:1:654: ASSERT { - mASSERT(); + mASSERT(); } break; case 98 : // Java.g:1:661: Identifier { - mIdentifier(); + mIdentifier(); } break; case 99 : // Java.g:1:672: WS { - mWS(); + mWS(); } break; case 100 : // Java.g:1:675: COMMENT { - mCOMMENT(); + mCOMMENT(); } break; case 101 : // Java.g:1:683: LINE_COMMENT { - mLINE_COMMENT(); + mLINE_COMMENT(); } break; @@ -4760,6 +4760,6 @@ public class JavaLexer extends Lexer { return "1:1: Tokens : ( T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | T__46 | T__47 | T__48 | T__49 | T__50 | T__51 | T__52 | T__53 | T__54 | T__55 | T__56 | T__57 | T__58 | T__59 | T__60 | T__61 | T__62 | T__63 | T__64 | T__65 | T__66 | T__67 | T__68 | T__69 | T__70 | T__71 | T__72 | T__73 | T__74 | T__75 | T__76 | T__77 | T__78 | T__79 | T__80 | T__81 | T__82 | T__83 | T__84 | T__85 | T__86 | T__87 | T__88 | T__89 | T__90 | T__91 | T__92 | T__93 | T__94 | T__95 | T__96 | T__97 | T__98 | T__99 | T__100 | T__101 | T__102 | T__103 | T__104 | T__105 | T__106 | T__107 | T__108 | T__109 | T__110 | T__111 | T__112 | T__113 | HexLiteral | DecimalLiteral | OctalLiteral | FloatingPointLiteral | CharacterLiteral | StringLiteral | ENUM | ASSERT | Identifier | WS | COMMENT | LINE_COMMENT );"; } } - + } \ No newline at end of file diff --git a/openjpa-examples/openbooks/src/main/java/openbook/tools/parser/JavaParser.java b/openjpa-examples/openbooks/src/main/java/openbook/tools/parser/JavaParser.java index 999813935..c4a50defd 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/tools/parser/JavaParser.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/tools/parser/JavaParser.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package openbook.tools.parser; // $ANTLR 3.2 Sep 23, 2009 12:02:23 Java.g 2010-05-15 01:06:37 @@ -32,7 +32,7 @@ import java.io.IOException; * and some nasty looking enums from 1.5, but have not really * tested for 1.5 compatibility. * - * I built this with: java -Xmx100M org.antlr.Tool java.g + * I built this with: java -Xmx100M org.antlr.Tool java.g * and got two errors that are ok (for now): * java.g:691:9: Decision can match input such as * "'0'..'9'{'E', 'e'}{'+', '-'}'0'..'9'{'D', 'F', 'd', 'f'}" @@ -67,9 +67,9 @@ import java.io.IOException; * Factored out an annotationName rule and used it in the annotation rule. * Not sure why, but typeName wasn't recognizing references to inner * annotations (e.g. @InterfaceName.InnerAnnotation()) - * Factored out the elementValue section of an annotation reference. Created - * elementValuePair and elementValuePairs rules, then used them in the - * annotation rule. Allows it to recognize annotation references with + * Factored out the elementValue section of an annotation reference. Created + * elementValuePair and elementValuePairs rules, then used them in the + * annotation rule. Allows it to recognize annotation references with * multiple, comma separated attributes. * Updated elementValueArrayInitializer so that it allows multiple elements. * (It was only allowing 0 or 1 element). @@ -77,15 +77,15 @@ import java.io.IOException; * doesn't appear to indicate this is legal, but it does work as of at least * JDK 1.5.0_06. * Moved the Identifier portion of annotationTypeElementRest to annotationMethodRest. - * Because annotationConstantRest already references variableDeclarator which - * has the Identifier portion in it, the parser would fail on constants in - * annotation definitions because it expected two identifiers. + * Because annotationConstantRest already references variableDeclarator which + * has the Identifier portion in it, the parser would fail on constants in + * annotation definitions because it expected two identifiers. * Added optional trailing ';' to the alternatives in annotationTypeElementRest. * Wouldn't handle an inner interface that has a trailing ';'. - * Swapped the expression and type rule reference order in castExpression to + * Swapped the expression and type rule reference order in castExpression to * make it check for genericized casts first. It was failing to recognize a * statement like "Class TYPE = (Class)...;" because it was seeing - * 'Class'. * Changed createdName to use typeArguments instead of nonWildcardTypeArguments. * Again, JLS doesn't seem to allow this, but java.lang.Class has an example of @@ -94,7 +94,7 @@ import java.io.IOException; * just 'arguments'. The case it couldn't handle was a call to an explicit * generic method invocation (e.g. this.doSomething()). Using identifierSuffix * may be overly aggressive--perhaps should create a more constrained thisSuffix rule? - * + * * Version 1.0.4 -- Hiroaki Nakamura, May 3, 2007 * * Fixed formalParameterDecls, localVariableDeclaration, forInit, @@ -106,13 +106,13 @@ import java.io.IOException; * Version 1.0.6 -- John Ridgway, March 17, 2008 * Made "assert" a switchable keyword like "enum". * Fixed compilationUnit to disallow "annotation importDeclaration ...". - * Changed "Identifier ('.' Identifier)*" to "qualifiedName" in more + * Changed "Identifier ('.' Identifier)*" to "qualifiedName" in more * places. * Changed modifier* and/or variableModifier* to classOrInterfaceModifiers, * modifiers or variableModifiers, as appropriate. * Renamed "bound" to "typeBound" to better match language in the JLS. - * Added "memberDeclaration" which rewrites to methodDeclaration or - * fieldDeclaration and pulled type into memberDeclaration. So we parse + * Added "memberDeclaration" which rewrites to methodDeclaration or + * fieldDeclaration and pulled type into memberDeclaration. So we parse * type and then move on to decide whether we're dealing with a field * or a method. * Modified "constructorDeclaration" to use "constructorBody" instead of @@ -121,15 +121,15 @@ import java.io.IOException; * out of expressions allowed me to simplify "primary". * Changed variableDeclarator to simplify it. * Changed type to use classOrInterfaceType, thus simplifying it; of course - * I then had to add classOrInterfaceType, but it is used in several + * I then had to add classOrInterfaceType, but it is used in several * places. * Fixed annotations, old version allowed "@X(y,z)", which is illegal. * Added optional comma to end of "elementValueArrayInitializer"; as per JLS. - * Changed annotationTypeElementRest to use normalClassDeclaration and - * normalInterfaceDeclaration rather than classDeclaration and + * Changed annotationTypeElementRest to use normalClassDeclaration and + * normalInterfaceDeclaration rather than classDeclaration and * interfaceDeclaration, thus getting rid of a couple of grammar ambiguities. * Split localVariableDeclaration into localVariableDeclarationStatement - * (includes the terminating semi-colon) and localVariableDeclaration. + * (includes the terminating semi-colon) and localVariableDeclaration. * This allowed me to use localVariableDeclaration in "forInit" clauses, * simplifying them. * Changed switchBlockStatementGroup to use multiple labels. This adds an @@ -139,7 +139,7 @@ import java.io.IOException; * Added semantic predicates to test for shift operations rather than other * things. Thus, for instance, the string "< <" will never be treated * as a left-shift operator. - * In "creator" we rule out "nonWildcardTypeArguments" on arrayCreation, + * In "creator" we rule out "nonWildcardTypeArguments" on arrayCreation, * which are illegal. * Moved "nonWildcardTypeArguments into innerCreator. * Removed 'super' superSuffix from explicitGenericInvocation, since that @@ -151,15 +151,15 @@ import java.io.IOException; * Lexer -- removed "Exponent?" from FloatingPointLiteral choice 4, since it * led to an ambiguity. * - * This grammar successfully parses every .java file in the JDK 1.5 source + * This grammar successfully parses every .java file in the JDK 1.5 source * tree (excluding those whose file names include '-', which are not * valid Java compilation units). * * Known remaining problems: * "Letter" and "JavaIDDigit" are wrong. The actual specification of * "Letter" should be "a character for which the method - * Character.isJavaIdentifierStart(int) returns true." A "Java - * letter-or-digit is a character for which the method + * Character.isJavaIdentifierStart(int) returns true." A "Java + * letter-or-digit is a character for which the method * Character.isJavaIdentifierPart(int) returns true." */ public class JavaParser extends DebugParser { @@ -282,114 +282,114 @@ public class JavaParser extends DebugParser { // delegators public static final String[] ruleNames = new String[] { - "invalidRule", "synpred179_Java", "block", "synpred250_Java", "synpred137_Java", - "synpred169_Java", "synpred154_Java", "catches", "relationalExpression", - "synpred237_Java", "synpred105_Java", "synpred88_Java", "expression", - "synpred242_Java", "synpred138_Java", "synpred151_Java", "typeList", - "formalParameterDecls", "interfaceBodyDeclaration", "synpred74_Java", - "typeName", "classDeclaration", "synpred252_Java", "selector", "synpred25_Java", - "synpred7_Java", "modifiers", "exclusiveOrExpression", "synpred11_Java", - "synpred164_Java", "variableModifiers", "synpred261_Java", "synpred42_Java", - "synpred128_Java", "synpred245_Java", "synpred264_Java", "synpred100_Java", - "synpred206_Java", "elementValuePair", "packageDeclaration", "variableModifier", - "synpred196_Java", "synpred203_Java", "arguments", "synpred149_Java", - "booleanLiteral", "synpred254_Java", "synpred96_Java", "synpred176_Java", - "synpred195_Java", "innerCreator", "compilationUnit", "synpred22_Java", - "integerLiteral", "annotationTypeDeclaration", "synpred165_Java", - "synpred55_Java", "synpred106_Java", "synpred158_Java", "annotationMethodOrConstantRest", - "synpred6_Java", "instanceOfExpression", "enumBody", "synpred262_Java", - "synpred117_Java", "synpred228_Java", "synpred269_Java", "synpred97_Java", - "synpred112_Java", "interfaceMethodOrFieldDecl", "switchBlockStatementGroups", - "synpred210_Java", "synpred44_Java", "synpred188_Java", "statementExpression", - "annotationTypeBody", "synpred170_Java", "synpred120_Java", "interfaceGenericMethodDecl", - "synpred89_Java", "synpred205_Java", "synpred230_Java", "arrayCreatorRest", - "synpred75_Java", "synpred130_Java", "annotationTypeElementRest", - "creator", "variableDeclarator", "synpred93_Java", "synpred115_Java", - "synpred119_Java", "synpred110_Java", "synpred186_Java", "synpred265_Java", - "synpred202_Java", "synpred253_Java", "andExpression", "synpred32_Java", - "synpred135_Java", "synpred148_Java", "synpred132_Java", "conditionalOrExpression", - "relationalOp", "synpred21_Java", "qualifiedNameList", "synpred58_Java", - "qualifiedName", "synpred51_Java", "conditionalExpression", "synpred175_Java", - "synpred90_Java", "synpred181_Java", "synpred31_Java", "shiftExpression", - "synpred197_Java", "fieldDeclaration", "synpred17_Java", "synpred231_Java", - "literal", "expressionList", "classBody", "synpred3_Java", "synpred160_Java", - "synpred190_Java", "synpred20_Java", "synpred219_Java", "synpred235_Java", - "synpred184_Java", "synpred222_Java", "synpred94_Java", "synpred147_Java", - "elementValue", "synpred64_Java", "synpred180_Java", "synpred82_Java", - "synpred30_Java", "synpred26_Java", "statement", "inclusiveOrExpression", - "multiplicativeExpression", "switchLabel", "synpred168_Java", "blockStatement", - "synpred111_Java", "synpred270_Java", "synpred134_Java", "synpred236_Java", - "enhancedForControl", "synpred213_Java", "synpred62_Java", "synpred227_Java", - "classCreatorRest", "synpred54_Java", "synpred104_Java", "synpred136_Java", - "synpred191_Java", "interfaceMemberDecl", "enumConstantName", "synpred67_Java", - "synpred49_Java", "typeParameters", "synpred123_Java", "synpred50_Java", - "synpred15_Java", "classOrInterfaceModifiers", "catchClause", "shiftOp", - "synpred63_Java", "synpred86_Java", "synpred212_Java", "normalClassDeclaration", - "methodDeclaratorRest", "conditionalAndExpression", "synpred79_Java", - "synpred239_Java", "synpred260_Java", "equalityExpression", "synpred161_Java", - "synpred221_Java", "annotationMethodRest", "synpred214_Java", "synpred113_Java", - "synpred92_Java", "synpred101_Java", "synpred234_Java", "synpred272_Java", - "synpred258_Java", "synpred95_Java", "synpred10_Java", "synpred125_Java", - "enumBodyDeclarations", "additiveExpression", "synpred133_Java", - "synpred14_Java", "interfaceMethodDeclaratorRest", "synpred248_Java", - "synpred208_Java", "formalParameterDeclsRest", "primary", "synpred78_Java", - "normalInterfaceDeclaration", "synpred145_Java", "synpred85_Java", - "synpred33_Java", "localVariableDeclaration", "synpred211_Java", - "synpred204_Java", "primitiveType", "switchBlockStatementGroup", - "synpred40_Java", "interfaceDeclaration", "formalParameters", "synpred238_Java", - "synpred99_Java", "synpred56_Java", "synpred177_Java", "synpred37_Java", - "synpred249_Java", "synpred46_Java", "identifierSuffix", "synpred116_Java", - "synpred69_Java", "synpred259_Java", "synpred65_Java", "synpred80_Java", - "synpred68_Java", "synpred66_Java", "elementValuePairs", "synpred71_Java", - "annotation", "synpred126_Java", "synpred102_Java", "synpred223_Java", - "synpred87_Java", "synpred27_Java", "synpred34_Java", "arrayInitializer", - "synpred77_Java", "typeArguments", "synpred187_Java", "synpred140_Java", - "variableDeclarators", "memberDecl", "voidMethodDeclaratorRest", - "enumConstant", "typeBound", "synpred70_Java", "synpred224_Java", - "constructorBody", "synpred84_Java", "interfaceBody", "classOrInterfaceDeclaration", - "synpred166_Java", "annotationName", "synpred251_Java", "synpred226_Java", - "synpred189_Java", "synpred246_Java", "forControl", "synpred108_Java", - "explicitConstructorInvocation", "synpred157_Java", "synpred4_Java", - "memberDeclaration", "synpred12_Java", "synpred243_Java", "synpred201_Java", - "parExpression", "synpred209_Java", "typeArgument", "synpred73_Java", - "synpred167_Java", "synpred53_Java", "synpred59_Java", "classBodyDeclaration", - "synpred233_Java", "explicitGenericInvocation", "synpred244_Java", - "synpred215_Java", "synpred139_Java", "synpred122_Java", "synpred266_Java", - "classOrInterfaceModifier", "synpred267_Java", "genericMethodOrConstructorDecl", - "synpred271_Java", "synpred183_Java", "synpred216_Java", "nonWildcardTypeArguments", - "variableDeclaratorId", "synpred131_Java", "constructorDeclaratorRest", - "synpred268_Java", "typeDeclaration", "annotationTypeElementDeclaration", - "synpred103_Java", "synpred127_Java", "synpred263_Java", "synpred23_Java", - "synpred150_Java", "defaultValue", "constantDeclarator", "genericMethodOrConstructorRest", - "synpred72_Java", "synpred217_Java", "synpred8_Java", "constantExpression", - "synpred52_Java", "synpred152_Java", "createdName", "synpred178_Java", - "synpred156_Java", "synpred162_Java", "synpred232_Java", "synpred118_Java", - "synpred91_Java", "synpred19_Java", "synpred29_Java", "elementValueArrayInitializer", - "synpred61_Java", "synpred141_Java", "synpred114_Java", "unaryExpression", - "synpred45_Java", "synpred16_Java", "synpred229_Java", "synpred2_Java", - "enumConstants", "synpred194_Java", "synpred43_Java", "importDeclaration", - "localVariableDeclarationStatement", "synpred121_Java", "forUpdate", - "synpred60_Java", "synpred143_Java", "forInit", "constantDeclaratorsRest", - "annotationConstantRest", "synpred36_Java", "superSuffix", "synpred39_Java", - "enumDeclaration", "synpred192_Java", "castExpression", "synpred1_Java", - "formalParameter", "synpred107_Java", "synpred155_Java", "synpred163_Java", - "synpred83_Java", "synpred129_Java", "synpred146_Java", "synpred207_Java", - "synpred13_Java", "synpred218_Java", "classOrInterfaceType", "synpred109_Java", - "synpred9_Java", "assignmentOperator", "synpred255_Java", "constantDeclaratorRest", - "variableInitializer", "synpred256_Java", "synpred28_Java", "synpred35_Java", - "synpred193_Java", "synpred174_Java", "synpred124_Java", "modifier", - "synpred81_Java", "synpred159_Java", "synpred185_Java", "synpred38_Java", - "synpred144_Java", "synpred199_Java", "typeParameter", "annotations", - "synpred173_Java", "synpred172_Java", "synpred18_Java", "packageOrTypeName", - "synpred241_Java", "synpred153_Java", "synpred247_Java", "synpred48_Java", - "synpred47_Java", "synpred98_Java", "synpred5_Java", "interfaceMethodOrFieldRest", - "synpred57_Java", "methodDeclaration", "synpred76_Java", "methodBody", - "synpred41_Java", "synpred142_Java", "synpred198_Java", "synpred225_Java", - "unaryExpressionNotPlusMinus", "synpred240_Java", "synpred200_Java", - "voidInterfaceMethodDeclaratorRest", "synpred182_Java", "synpred24_Java", + "invalidRule", "synpred179_Java", "block", "synpred250_Java", "synpred137_Java", + "synpred169_Java", "synpred154_Java", "catches", "relationalExpression", + "synpred237_Java", "synpred105_Java", "synpred88_Java", "expression", + "synpred242_Java", "synpred138_Java", "synpred151_Java", "typeList", + "formalParameterDecls", "interfaceBodyDeclaration", "synpred74_Java", + "typeName", "classDeclaration", "synpred252_Java", "selector", "synpred25_Java", + "synpred7_Java", "modifiers", "exclusiveOrExpression", "synpred11_Java", + "synpred164_Java", "variableModifiers", "synpred261_Java", "synpred42_Java", + "synpred128_Java", "synpred245_Java", "synpred264_Java", "synpred100_Java", + "synpred206_Java", "elementValuePair", "packageDeclaration", "variableModifier", + "synpred196_Java", "synpred203_Java", "arguments", "synpred149_Java", + "booleanLiteral", "synpred254_Java", "synpred96_Java", "synpred176_Java", + "synpred195_Java", "innerCreator", "compilationUnit", "synpred22_Java", + "integerLiteral", "annotationTypeDeclaration", "synpred165_Java", + "synpred55_Java", "synpred106_Java", "synpred158_Java", "annotationMethodOrConstantRest", + "synpred6_Java", "instanceOfExpression", "enumBody", "synpred262_Java", + "synpred117_Java", "synpred228_Java", "synpred269_Java", "synpred97_Java", + "synpred112_Java", "interfaceMethodOrFieldDecl", "switchBlockStatementGroups", + "synpred210_Java", "synpred44_Java", "synpred188_Java", "statementExpression", + "annotationTypeBody", "synpred170_Java", "synpred120_Java", "interfaceGenericMethodDecl", + "synpred89_Java", "synpred205_Java", "synpred230_Java", "arrayCreatorRest", + "synpred75_Java", "synpred130_Java", "annotationTypeElementRest", + "creator", "variableDeclarator", "synpred93_Java", "synpred115_Java", + "synpred119_Java", "synpred110_Java", "synpred186_Java", "synpred265_Java", + "synpred202_Java", "synpred253_Java", "andExpression", "synpred32_Java", + "synpred135_Java", "synpred148_Java", "synpred132_Java", "conditionalOrExpression", + "relationalOp", "synpred21_Java", "qualifiedNameList", "synpred58_Java", + "qualifiedName", "synpred51_Java", "conditionalExpression", "synpred175_Java", + "synpred90_Java", "synpred181_Java", "synpred31_Java", "shiftExpression", + "synpred197_Java", "fieldDeclaration", "synpred17_Java", "synpred231_Java", + "literal", "expressionList", "classBody", "synpred3_Java", "synpred160_Java", + "synpred190_Java", "synpred20_Java", "synpred219_Java", "synpred235_Java", + "synpred184_Java", "synpred222_Java", "synpred94_Java", "synpred147_Java", + "elementValue", "synpred64_Java", "synpred180_Java", "synpred82_Java", + "synpred30_Java", "synpred26_Java", "statement", "inclusiveOrExpression", + "multiplicativeExpression", "switchLabel", "synpred168_Java", "blockStatement", + "synpred111_Java", "synpred270_Java", "synpred134_Java", "synpred236_Java", + "enhancedForControl", "synpred213_Java", "synpred62_Java", "synpred227_Java", + "classCreatorRest", "synpred54_Java", "synpred104_Java", "synpred136_Java", + "synpred191_Java", "interfaceMemberDecl", "enumConstantName", "synpred67_Java", + "synpred49_Java", "typeParameters", "synpred123_Java", "synpred50_Java", + "synpred15_Java", "classOrInterfaceModifiers", "catchClause", "shiftOp", + "synpred63_Java", "synpred86_Java", "synpred212_Java", "normalClassDeclaration", + "methodDeclaratorRest", "conditionalAndExpression", "synpred79_Java", + "synpred239_Java", "synpred260_Java", "equalityExpression", "synpred161_Java", + "synpred221_Java", "annotationMethodRest", "synpred214_Java", "synpred113_Java", + "synpred92_Java", "synpred101_Java", "synpred234_Java", "synpred272_Java", + "synpred258_Java", "synpred95_Java", "synpred10_Java", "synpred125_Java", + "enumBodyDeclarations", "additiveExpression", "synpred133_Java", + "synpred14_Java", "interfaceMethodDeclaratorRest", "synpred248_Java", + "synpred208_Java", "formalParameterDeclsRest", "primary", "synpred78_Java", + "normalInterfaceDeclaration", "synpred145_Java", "synpred85_Java", + "synpred33_Java", "localVariableDeclaration", "synpred211_Java", + "synpred204_Java", "primitiveType", "switchBlockStatementGroup", + "synpred40_Java", "interfaceDeclaration", "formalParameters", "synpred238_Java", + "synpred99_Java", "synpred56_Java", "synpred177_Java", "synpred37_Java", + "synpred249_Java", "synpred46_Java", "identifierSuffix", "synpred116_Java", + "synpred69_Java", "synpred259_Java", "synpred65_Java", "synpred80_Java", + "synpred68_Java", "synpred66_Java", "elementValuePairs", "synpred71_Java", + "annotation", "synpred126_Java", "synpred102_Java", "synpred223_Java", + "synpred87_Java", "synpred27_Java", "synpred34_Java", "arrayInitializer", + "synpred77_Java", "typeArguments", "synpred187_Java", "synpred140_Java", + "variableDeclarators", "memberDecl", "voidMethodDeclaratorRest", + "enumConstant", "typeBound", "synpred70_Java", "synpred224_Java", + "constructorBody", "synpred84_Java", "interfaceBody", "classOrInterfaceDeclaration", + "synpred166_Java", "annotationName", "synpred251_Java", "synpred226_Java", + "synpred189_Java", "synpred246_Java", "forControl", "synpred108_Java", + "explicitConstructorInvocation", "synpred157_Java", "synpred4_Java", + "memberDeclaration", "synpred12_Java", "synpred243_Java", "synpred201_Java", + "parExpression", "synpred209_Java", "typeArgument", "synpred73_Java", + "synpred167_Java", "synpred53_Java", "synpred59_Java", "classBodyDeclaration", + "synpred233_Java", "explicitGenericInvocation", "synpred244_Java", + "synpred215_Java", "synpred139_Java", "synpred122_Java", "synpred266_Java", + "classOrInterfaceModifier", "synpred267_Java", "genericMethodOrConstructorDecl", + "synpred271_Java", "synpred183_Java", "synpred216_Java", "nonWildcardTypeArguments", + "variableDeclaratorId", "synpred131_Java", "constructorDeclaratorRest", + "synpred268_Java", "typeDeclaration", "annotationTypeElementDeclaration", + "synpred103_Java", "synpred127_Java", "synpred263_Java", "synpred23_Java", + "synpred150_Java", "defaultValue", "constantDeclarator", "genericMethodOrConstructorRest", + "synpred72_Java", "synpred217_Java", "synpred8_Java", "constantExpression", + "synpred52_Java", "synpred152_Java", "createdName", "synpred178_Java", + "synpred156_Java", "synpred162_Java", "synpred232_Java", "synpred118_Java", + "synpred91_Java", "synpred19_Java", "synpred29_Java", "elementValueArrayInitializer", + "synpred61_Java", "synpred141_Java", "synpred114_Java", "unaryExpression", + "synpred45_Java", "synpred16_Java", "synpred229_Java", "synpred2_Java", + "enumConstants", "synpred194_Java", "synpred43_Java", "importDeclaration", + "localVariableDeclarationStatement", "synpred121_Java", "forUpdate", + "synpred60_Java", "synpred143_Java", "forInit", "constantDeclaratorsRest", + "annotationConstantRest", "synpred36_Java", "superSuffix", "synpred39_Java", + "enumDeclaration", "synpred192_Java", "castExpression", "synpred1_Java", + "formalParameter", "synpred107_Java", "synpred155_Java", "synpred163_Java", + "synpred83_Java", "synpred129_Java", "synpred146_Java", "synpred207_Java", + "synpred13_Java", "synpred218_Java", "classOrInterfaceType", "synpred109_Java", + "synpred9_Java", "assignmentOperator", "synpred255_Java", "constantDeclaratorRest", + "variableInitializer", "synpred256_Java", "synpred28_Java", "synpred35_Java", + "synpred193_Java", "synpred174_Java", "synpred124_Java", "modifier", + "synpred81_Java", "synpred159_Java", "synpred185_Java", "synpred38_Java", + "synpred144_Java", "synpred199_Java", "typeParameter", "annotations", + "synpred173_Java", "synpred172_Java", "synpred18_Java", "packageOrTypeName", + "synpred241_Java", "synpred153_Java", "synpred247_Java", "synpred48_Java", + "synpred47_Java", "synpred98_Java", "synpred5_Java", "interfaceMethodOrFieldRest", + "synpred57_Java", "methodDeclaration", "synpred76_Java", "methodBody", + "synpred41_Java", "synpred142_Java", "synpred198_Java", "synpred225_Java", + "unaryExpressionNotPlusMinus", "synpred240_Java", "synpred200_Java", + "voidInterfaceMethodDeclaratorRest", "synpred182_Java", "synpred24_Java", "synpred257_Java", "type", "synpred220_Java", "synpred171_Java" }; - + public int ruleLevel = 0; public int getRuleLevel() { return ruleLevel; } public void incRuleLevel() { ruleLevel++; } @@ -400,7 +400,7 @@ public class JavaParser extends DebugParser { public JavaParser(TokenStream input, int port, RecognizerSharedState state) { super(input, state); this.state.ruleMemo = new HashMap[407+1]; - + DebugEventSocketProxy proxy = new DebugEventSocketProxy(this, port, null); setDebugListener(proxy); @@ -414,7 +414,7 @@ public class JavaParser extends DebugParser { public JavaParser(TokenStream input, DebugEventListener dbg) { super(input, dbg, new RecognizerSharedState()); this.state.ruleMemo = new HashMap[407+1]; - + } protected boolean evalPredicate(boolean result, String predicate) { dbg.semanticPredicate(result, predicate); @@ -11518,8 +11518,8 @@ public class JavaParser extends DebugParser { t3=(Token)match(input,51,FOLLOW_51_in_assignmentOperator4218); if (state.failed) return ; dbg.location(723,9); if ( !(evalPredicate( t1.getLine() == t2.getLine() && - t1.getCharPositionInLine() + 1 == t2.getCharPositionInLine() && - t2.getLine() == t3.getLine() && + t1.getCharPositionInLine() + 1 == t2.getCharPositionInLine() && + t2.getLine() == t3.getLine() && t2.getCharPositionInLine() + 1 == t3.getCharPositionInLine() ," $t1.getLine() == $t2.getLine() &&\n $t1.getCharPositionInLine() + 1 == $t2.getCharPositionInLine() && \n $t2.getLine() == $t3.getLine() && \n $t2.getCharPositionInLine() + 1 == $t3.getCharPositionInLine() ")) ) { if (state.backtracking>0) {state.failed=true; return ;} throw new FailedPredicateException(input, "assignmentOperator", " $t1.getLine() == $t2.getLine() &&\n $t1.getCharPositionInLine() + 1 == $t2.getCharPositionInLine() && \n $t2.getLine() == $t3.getLine() && \n $t2.getCharPositionInLine() + 1 == $t3.getCharPositionInLine() "); @@ -11541,11 +11541,11 @@ public class JavaParser extends DebugParser { dbg.location(727,52); t4=(Token)match(input,51,FOLLOW_51_in_assignmentOperator4264); if (state.failed) return ; dbg.location(728,9); - if ( !(evalPredicate( t1.getLine() == t2.getLine() && + if ( !(evalPredicate( t1.getLine() == t2.getLine() && t1.getCharPositionInLine() + 1 == t2.getCharPositionInLine() && - t2.getLine() == t3.getLine() && + t2.getLine() == t3.getLine() && t2.getCharPositionInLine() + 1 == t3.getCharPositionInLine() && - t3.getLine() == t4.getLine() && + t3.getLine() == t4.getLine() && t3.getCharPositionInLine() + 1 == t4.getCharPositionInLine() ," $t1.getLine() == $t2.getLine() && \n $t1.getCharPositionInLine() + 1 == $t2.getCharPositionInLine() &&\n $t2.getLine() == $t3.getLine() && \n $t2.getCharPositionInLine() + 1 == $t3.getCharPositionInLine() &&\n $t3.getLine() == $t4.getLine() && \n $t3.getCharPositionInLine() + 1 == $t4.getCharPositionInLine() ")) ) { if (state.backtracking>0) {state.failed=true; return ;} throw new FailedPredicateException(input, "assignmentOperator", " $t1.getLine() == $t2.getLine() && \n $t1.getCharPositionInLine() + 1 == $t2.getCharPositionInLine() &&\n $t2.getLine() == $t3.getLine() && \n $t2.getCharPositionInLine() + 1 == $t3.getCharPositionInLine() &&\n $t3.getLine() == $t4.getLine() && \n $t3.getCharPositionInLine() + 1 == $t4.getCharPositionInLine() "); @@ -11565,9 +11565,9 @@ public class JavaParser extends DebugParser { dbg.location(734,41); t3=(Token)match(input,51,FOLLOW_51_in_assignmentOperator4303); if (state.failed) return ; dbg.location(735,9); - if ( !(evalPredicate( t1.getLine() == t2.getLine() && - t1.getCharPositionInLine() + 1 == t2.getCharPositionInLine() && - t2.getLine() == t3.getLine() && + if ( !(evalPredicate( t1.getLine() == t2.getLine() && + t1.getCharPositionInLine() + 1 == t2.getCharPositionInLine() && + t2.getLine() == t3.getLine() && t2.getCharPositionInLine() + 1 == t3.getCharPositionInLine() ," $t1.getLine() == $t2.getLine() && \n $t1.getCharPositionInLine() + 1 == $t2.getCharPositionInLine() && \n $t2.getLine() == $t3.getLine() && \n $t2.getCharPositionInLine() + 1 == $t3.getCharPositionInLine() ")) ) { if (state.backtracking>0) {state.failed=true; return ;} throw new FailedPredicateException(input, "assignmentOperator", " $t1.getLine() == $t2.getLine() && \n $t1.getCharPositionInLine() + 1 == $t2.getCharPositionInLine() && \n $t2.getLine() == $t3.getLine() && \n $t2.getCharPositionInLine() + 1 == $t3.getCharPositionInLine() "); @@ -12498,7 +12498,7 @@ public class JavaParser extends DebugParser { dbg.location(778,30); t2=(Token)match(input,51,FOLLOW_51_in_relationalOp4609); if (state.failed) return ; dbg.location(779,9); - if ( !(evalPredicate( t1.getLine() == t2.getLine() && + if ( !(evalPredicate( t1.getLine() == t2.getLine() && t1.getCharPositionInLine() + 1 == t2.getCharPositionInLine() ," $t1.getLine() == $t2.getLine() && \n $t1.getCharPositionInLine() + 1 == $t2.getCharPositionInLine() ")) ) { if (state.backtracking>0) {state.failed=true; return ;} throw new FailedPredicateException(input, "relationalOp", " $t1.getLine() == $t2.getLine() && \n $t1.getCharPositionInLine() + 1 == $t2.getCharPositionInLine() "); @@ -12516,7 +12516,7 @@ public class JavaParser extends DebugParser { dbg.location(781,30); t2=(Token)match(input,51,FOLLOW_51_in_relationalOp4643); if (state.failed) return ; dbg.location(782,9); - if ( !(evalPredicate( t1.getLine() == t2.getLine() && + if ( !(evalPredicate( t1.getLine() == t2.getLine() && t1.getCharPositionInLine() + 1 == t2.getCharPositionInLine() ," $t1.getLine() == $t2.getLine() && \n $t1.getCharPositionInLine() + 1 == $t2.getCharPositionInLine() ")) ) { if (state.backtracking>0) {state.failed=true; return ;} throw new FailedPredicateException(input, "relationalOp", " $t1.getLine() == $t2.getLine() && \n $t1.getCharPositionInLine() + 1 == $t2.getCharPositionInLine() "); @@ -12737,7 +12737,7 @@ public class JavaParser extends DebugParser { dbg.location(793,30); t2=(Token)match(input,40,FOLLOW_40_in_shiftOp4736); if (state.failed) return ; dbg.location(794,9); - if ( !(evalPredicate( t1.getLine() == t2.getLine() && + if ( !(evalPredicate( t1.getLine() == t2.getLine() && t1.getCharPositionInLine() + 1 == t2.getCharPositionInLine() ," $t1.getLine() == $t2.getLine() && \n $t1.getCharPositionInLine() + 1 == $t2.getCharPositionInLine() ")) ) { if (state.backtracking>0) {state.failed=true; return ;} throw new FailedPredicateException(input, "shiftOp", " $t1.getLine() == $t2.getLine() && \n $t1.getCharPositionInLine() + 1 == $t2.getCharPositionInLine() "); @@ -12757,9 +12757,9 @@ public class JavaParser extends DebugParser { dbg.location(796,41); t3=(Token)match(input,42,FOLLOW_42_in_shiftOp4776); if (state.failed) return ; dbg.location(797,9); - if ( !(evalPredicate( t1.getLine() == t2.getLine() && + if ( !(evalPredicate( t1.getLine() == t2.getLine() && t1.getCharPositionInLine() + 1 == t2.getCharPositionInLine() && - t2.getLine() == t3.getLine() && + t2.getLine() == t3.getLine() && t2.getCharPositionInLine() + 1 == t3.getCharPositionInLine() ," $t1.getLine() == $t2.getLine() && \n $t1.getCharPositionInLine() + 1 == $t2.getCharPositionInLine() &&\n $t2.getLine() == $t3.getLine() && \n $t2.getCharPositionInLine() + 1 == $t3.getCharPositionInLine() ")) ) { if (state.backtracking>0) {state.failed=true; return ;} throw new FailedPredicateException(input, "shiftOp", " $t1.getLine() == $t2.getLine() && \n $t1.getCharPositionInLine() + 1 == $t2.getCharPositionInLine() &&\n $t2.getLine() == $t3.getLine() && \n $t2.getCharPositionInLine() + 1 == $t3.getCharPositionInLine() "); @@ -12777,7 +12777,7 @@ public class JavaParser extends DebugParser { dbg.location(801,30); t2=(Token)match(input,42,FOLLOW_42_in_shiftOp4810); if (state.failed) return ; dbg.location(802,9); - if ( !(evalPredicate( t1.getLine() == t2.getLine() && + if ( !(evalPredicate( t1.getLine() == t2.getLine() && t1.getCharPositionInLine() + 1 == t2.getCharPositionInLine() ," $t1.getLine() == $t2.getLine() && \n $t1.getCharPositionInLine() + 1 == $t2.getCharPositionInLine() ")) ) { if (state.backtracking>0) {state.failed=true; return ;} throw new FailedPredicateException(input, "shiftOp", " $t1.getLine() == $t2.getLine() && \n $t1.getCharPositionInLine() + 1 == $t2.getCharPositionInLine() "); @@ -15349,7 +15349,7 @@ public class JavaParser extends DebugParser { // $ANTLR end "arguments" // $ANTLR start synpred5_Java - public final void synpred5_Java_fragment() throws RecognitionException { + public final void synpred5_Java_fragment() throws RecognitionException { // Java.g:178:9: ( annotations ( packageDeclaration ( importDeclaration )* ( typeDeclaration )* | classOrInterfaceDeclaration ( typeDeclaration )* ) ) dbg.enterAlt(1); @@ -15544,7 +15544,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred5_Java // $ANTLR start synpred113_Java - public final void synpred113_Java_fragment() throws RecognitionException { + public final void synpred113_Java_fragment() throws RecognitionException { // Java.g:492:13: ( explicitConstructorInvocation ) dbg.enterAlt(1); @@ -15562,7 +15562,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred113_Java // $ANTLR start synpred117_Java - public final void synpred117_Java_fragment() throws RecognitionException { + public final void synpred117_Java_fragment() throws RecognitionException { // Java.g:496:9: ( ( nonWildcardTypeArguments )? ( 'this' | 'super' ) arguments ';' ) dbg.enterAlt(1); @@ -15626,7 +15626,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred117_Java // $ANTLR start synpred128_Java - public final void synpred128_Java_fragment() throws RecognitionException { + public final void synpred128_Java_fragment() throws RecognitionException { // Java.g:528:9: ( annotation ) dbg.enterAlt(1); @@ -15644,7 +15644,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred128_Java // $ANTLR start synpred151_Java - public final void synpred151_Java_fragment() throws RecognitionException { + public final void synpred151_Java_fragment() throws RecognitionException { // Java.g:601:9: ( localVariableDeclarationStatement ) dbg.enterAlt(1); @@ -15662,7 +15662,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred151_Java // $ANTLR start synpred152_Java - public final void synpred152_Java_fragment() throws RecognitionException { + public final void synpred152_Java_fragment() throws RecognitionException { // Java.g:602:9: ( classOrInterfaceDeclaration ) dbg.enterAlt(1); @@ -15680,7 +15680,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred152_Java // $ANTLR start synpred157_Java - public final void synpred157_Java_fragment() throws RecognitionException { + public final void synpred157_Java_fragment() throws RecognitionException { // Java.g:621:54: ( 'else' statement ) dbg.enterAlt(1); @@ -15700,7 +15700,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred157_Java // $ANTLR start synpred162_Java - public final void synpred162_Java_fragment() throws RecognitionException { + public final void synpred162_Java_fragment() throws RecognitionException { // Java.g:626:11: ( catches 'finally' block ) dbg.enterAlt(1); @@ -15726,7 +15726,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred162_Java // $ANTLR start synpred163_Java - public final void synpred163_Java_fragment() throws RecognitionException { + public final void synpred163_Java_fragment() throws RecognitionException { // Java.g:627:11: ( catches ) dbg.enterAlt(1); @@ -15744,7 +15744,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred163_Java // $ANTLR start synpred178_Java - public final void synpred178_Java_fragment() throws RecognitionException { + public final void synpred178_Java_fragment() throws RecognitionException { // Java.g:662:9: ( switchLabel ) dbg.enterAlt(1); @@ -15762,7 +15762,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred178_Java // $ANTLR start synpred180_Java - public final void synpred180_Java_fragment() throws RecognitionException { + public final void synpred180_Java_fragment() throws RecognitionException { // Java.g:666:9: ( 'case' constantExpression ':' ) dbg.enterAlt(1); @@ -15784,7 +15784,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred180_Java // $ANTLR start synpred181_Java - public final void synpred181_Java_fragment() throws RecognitionException { + public final void synpred181_Java_fragment() throws RecognitionException { // Java.g:667:9: ( 'case' enumConstantName ':' ) dbg.enterAlt(1); @@ -15806,7 +15806,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred181_Java // $ANTLR start synpred182_Java - public final void synpred182_Java_fragment() throws RecognitionException { + public final void synpred182_Java_fragment() throws RecognitionException { // Java.g:673:9: ( enhancedForControl ) dbg.enterAlt(1); @@ -15824,7 +15824,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred182_Java // $ANTLR start synpred186_Java - public final void synpred186_Java_fragment() throws RecognitionException { + public final void synpred186_Java_fragment() throws RecognitionException { // Java.g:678:9: ( localVariableDeclaration ) dbg.enterAlt(1); @@ -15842,7 +15842,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred186_Java // $ANTLR start synpred188_Java - public final void synpred188_Java_fragment() throws RecognitionException { + public final void synpred188_Java_fragment() throws RecognitionException { // Java.g:709:32: ( assignmentOperator expression ) dbg.enterAlt(1); @@ -15866,7 +15866,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred188_Java // $ANTLR start synpred198_Java - public final void synpred198_Java_fragment() throws RecognitionException { + public final void synpred198_Java_fragment() throws RecognitionException { // Java.g:722:9: ( '<' '<' '=' ) dbg.enterAlt(1); @@ -15884,7 +15884,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred198_Java // $ANTLR start synpred199_Java - public final void synpred199_Java_fragment() throws RecognitionException { + public final void synpred199_Java_fragment() throws RecognitionException { // Java.g:727:9: ( '>' '>' '>' '=' ) dbg.enterAlt(1); @@ -15904,7 +15904,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred199_Java // $ANTLR start synpred200_Java - public final void synpred200_Java_fragment() throws RecognitionException { + public final void synpred200_Java_fragment() throws RecognitionException { // Java.g:734:9: ( '>' '>' '=' ) dbg.enterAlt(1); @@ -15922,7 +15922,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred200_Java // $ANTLR start synpred211_Java - public final void synpred211_Java_fragment() throws RecognitionException { + public final void synpred211_Java_fragment() throws RecognitionException { // Java.g:778:9: ( '<' '=' ) dbg.enterAlt(1); @@ -15938,7 +15938,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred211_Java // $ANTLR start synpred212_Java - public final void synpred212_Java_fragment() throws RecognitionException { + public final void synpred212_Java_fragment() throws RecognitionException { // Java.g:781:9: ( '>' '=' ) dbg.enterAlt(1); @@ -15954,7 +15954,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred212_Java // $ANTLR start synpred215_Java - public final void synpred215_Java_fragment() throws RecognitionException { + public final void synpred215_Java_fragment() throws RecognitionException { // Java.g:793:9: ( '<' '<' ) dbg.enterAlt(1); @@ -15970,7 +15970,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred215_Java // $ANTLR start synpred216_Java - public final void synpred216_Java_fragment() throws RecognitionException { + public final void synpred216_Java_fragment() throws RecognitionException { // Java.g:796:9: ( '>' '>' '>' ) dbg.enterAlt(1); @@ -15988,7 +15988,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred216_Java // $ANTLR start synpred217_Java - public final void synpred217_Java_fragment() throws RecognitionException { + public final void synpred217_Java_fragment() throws RecognitionException { // Java.g:801:9: ( '>' '>' ) dbg.enterAlt(1); @@ -16004,7 +16004,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred217_Java // $ANTLR start synpred229_Java - public final void synpred229_Java_fragment() throws RecognitionException { + public final void synpred229_Java_fragment() throws RecognitionException { // Java.g:826:9: ( castExpression ) dbg.enterAlt(1); @@ -16022,7 +16022,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred229_Java // $ANTLR start synpred233_Java - public final void synpred233_Java_fragment() throws RecognitionException { + public final void synpred233_Java_fragment() throws RecognitionException { // Java.g:831:8: ( '(' primitiveType ')' unaryExpression ) dbg.enterAlt(1); @@ -16050,7 +16050,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred233_Java // $ANTLR start synpred234_Java - public final void synpred234_Java_fragment() throws RecognitionException { + public final void synpred234_Java_fragment() throws RecognitionException { // Java.g:832:13: ( type ) dbg.enterAlt(1); @@ -16068,7 +16068,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred234_Java // $ANTLR start synpred236_Java - public final void synpred236_Java_fragment() throws RecognitionException { + public final void synpred236_Java_fragment() throws RecognitionException { // Java.g:837:17: ( '.' Identifier ) dbg.enterAlt(1); @@ -16084,7 +16084,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred236_Java // $ANTLR start synpred237_Java - public final void synpred237_Java_fragment() throws RecognitionException { + public final void synpred237_Java_fragment() throws RecognitionException { // Java.g:837:34: ( identifierSuffix ) dbg.enterAlt(1); @@ -16102,7 +16102,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred237_Java // $ANTLR start synpred242_Java - public final void synpred242_Java_fragment() throws RecognitionException { + public final void synpred242_Java_fragment() throws RecognitionException { // Java.g:841:21: ( '.' Identifier ) dbg.enterAlt(1); @@ -16118,7 +16118,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred242_Java // $ANTLR start synpred243_Java - public final void synpred243_Java_fragment() throws RecognitionException { + public final void synpred243_Java_fragment() throws RecognitionException { // Java.g:841:38: ( identifierSuffix ) dbg.enterAlt(1); @@ -16136,7 +16136,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred243_Java // $ANTLR start synpred249_Java - public final void synpred249_Java_fragment() throws RecognitionException { + public final void synpred249_Java_fragment() throws RecognitionException { // Java.g:848:10: ( '[' expression ']' ) dbg.enterAlt(1); @@ -16158,7 +16158,7 @@ public class JavaParser extends DebugParser { // $ANTLR end synpred249_Java // $ANTLR start synpred262_Java - public final void synpred262_Java_fragment() throws RecognitionException { + public final void synpred262_Java_fragment() throws RecognitionException { // Java.g:874:29: ( '[' expression ']' ) dbg.enterAlt(1); @@ -16783,10 +16783,10 @@ public class JavaParser extends DebugParser { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { - case 0 : + case 0 : int LA8_1 = input.LA(1); - + int index8_1 = input.index(); input.rewind(); s = -1; @@ -16794,7 +16794,7 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 2;} - + input.seek(index8_1); if ( s>=0 ) return s; break; @@ -16911,10 +16911,10 @@ public class JavaParser extends DebugParser { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { - case 0 : + case 0 : int LA81_2 = input.LA(1); - + int index81_2 = input.index(); input.rewind(); s = -1; @@ -16922,14 +16922,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 15;} - + input.seek(index81_2); if ( s>=0 ) return s; break; - case 1 : + case 1 : int LA81_3 = input.LA(1); - + int index81_3 = input.index(); input.rewind(); s = -1; @@ -16937,14 +16937,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 15;} - + input.seek(index81_3); if ( s>=0 ) return s; break; - case 2 : + case 2 : int LA81_4 = input.LA(1); - + int index81_4 = input.index(); input.rewind(); s = -1; @@ -16952,14 +16952,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 15;} - + input.seek(index81_4); if ( s>=0 ) return s; break; - case 3 : + case 3 : int LA81_5 = input.LA(1); - + int index81_5 = input.index(); input.rewind(); s = -1; @@ -16967,14 +16967,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 15;} - + input.seek(index81_5); if ( s>=0 ) return s; break; - case 4 : + case 4 : int LA81_6 = input.LA(1); - + int index81_6 = input.index(); input.rewind(); s = -1; @@ -16982,14 +16982,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 15;} - + input.seek(index81_6); if ( s>=0 ) return s; break; - case 5 : + case 5 : int LA81_7 = input.LA(1); - + int index81_7 = input.index(); input.rewind(); s = -1; @@ -16997,14 +16997,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 15;} - + input.seek(index81_7); if ( s>=0 ) return s; break; - case 6 : + case 6 : int LA81_8 = input.LA(1); - + int index81_8 = input.index(); input.rewind(); s = -1; @@ -17012,14 +17012,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 15;} - + input.seek(index81_8); if ( s>=0 ) return s; break; - case 7 : + case 7 : int LA81_9 = input.LA(1); - + int index81_9 = input.index(); input.rewind(); s = -1; @@ -17027,14 +17027,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 15;} - + input.seek(index81_9); if ( s>=0 ) return s; break; - case 8 : + case 8 : int LA81_10 = input.LA(1); - + int index81_10 = input.index(); input.rewind(); s = -1; @@ -17042,14 +17042,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 15;} - + input.seek(index81_10); if ( s>=0 ) return s; break; - case 9 : + case 9 : int LA81_11 = input.LA(1); - + int index81_11 = input.index(); input.rewind(); s = -1; @@ -17057,14 +17057,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 15;} - + input.seek(index81_11); if ( s>=0 ) return s; break; - case 10 : + case 10 : int LA81_12 = input.LA(1); - + int index81_12 = input.index(); input.rewind(); s = -1; @@ -17072,14 +17072,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 15;} - + input.seek(index81_12); if ( s>=0 ) return s; break; - case 11 : + case 11 : int LA81_13 = input.LA(1); - + int index81_13 = input.index(); input.rewind(); s = -1; @@ -17087,14 +17087,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 15;} - + input.seek(index81_13); if ( s>=0 ) return s; break; - case 12 : + case 12 : int LA81_14 = input.LA(1); - + int index81_14 = input.index(); input.rewind(); s = -1; @@ -17102,7 +17102,7 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 15;} - + input.seek(index81_14); if ( s>=0 ) return s; break; @@ -17184,10 +17184,10 @@ public class JavaParser extends DebugParser { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { - case 0 : + case 0 : int LA85_2 = input.LA(1); - + int index85_2 = input.index(); input.rewind(); s = -1; @@ -17195,14 +17195,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 3;} - + input.seek(index85_2); if ( s>=0 ) return s; break; - case 1 : + case 1 : int LA85_4 = input.LA(1); - + int index85_4 = input.index(); input.rewind(); s = -1; @@ -17210,7 +17210,7 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 3;} - + input.seek(index85_4); if ( s>=0 ) return s; break; @@ -17325,10 +17325,10 @@ public class JavaParser extends DebugParser { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { - case 0 : + case 0 : int LA106_1 = input.LA(1); - + int index106_1 = input.index(); input.rewind(); s = -1; @@ -17336,14 +17336,14 @@ public class JavaParser extends DebugParser { else if ( (synpred152_Java()) ) {s = 5;} - + input.seek(index106_1); if ( s>=0 ) return s; break; - case 1 : + case 1 : int LA106_2 = input.LA(1); - + int index106_2 = input.index(); input.rewind(); s = -1; @@ -17351,14 +17351,14 @@ public class JavaParser extends DebugParser { else if ( (synpred152_Java()) ) {s = 5;} - + input.seek(index106_2); if ( s>=0 ) return s; break; - case 2 : + case 2 : int LA106_3 = input.LA(1); - + int index106_3 = input.index(); input.rewind(); s = -1; @@ -17366,14 +17366,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 14;} - + input.seek(index106_3); if ( s>=0 ) return s; break; - case 3 : + case 3 : int LA106_4 = input.LA(1); - + int index106_4 = input.index(); input.rewind(); s = -1; @@ -17381,7 +17381,7 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 14;} - + input.seek(index106_4); if ( s>=0 ) return s; break; @@ -17669,10 +17669,10 @@ public class JavaParser extends DebugParser { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { - case 0 : + case 0 : int LA123_59 = input.LA(1); - + int index123_59 = input.index(); input.rewind(); s = -1; @@ -17680,14 +17680,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_59); if ( s>=0 ) return s; break; - case 1 : + case 1 : int LA123_60 = input.LA(1); - + int index123_60 = input.index(); input.rewind(); s = -1; @@ -17695,14 +17695,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_60); if ( s>=0 ) return s; break; - case 2 : + case 2 : int LA123_61 = input.LA(1); - + int index123_61 = input.index(); input.rewind(); s = -1; @@ -17710,14 +17710,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_61); if ( s>=0 ) return s; break; - case 3 : + case 3 : int LA123_62 = input.LA(1); - + int index123_62 = input.index(); input.rewind(); s = -1; @@ -17725,14 +17725,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_62); if ( s>=0 ) return s; break; - case 4 : + case 4 : int LA123_63 = input.LA(1); - + int index123_63 = input.index(); input.rewind(); s = -1; @@ -17740,14 +17740,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_63); if ( s>=0 ) return s; break; - case 5 : + case 5 : int LA123_64 = input.LA(1); - + int index123_64 = input.index(); input.rewind(); s = -1; @@ -17755,14 +17755,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_64); if ( s>=0 ) return s; break; - case 6 : + case 6 : int LA123_65 = input.LA(1); - + int index123_65 = input.index(); input.rewind(); s = -1; @@ -17770,14 +17770,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_65); if ( s>=0 ) return s; break; - case 7 : + case 7 : int LA123_66 = input.LA(1); - + int index123_66 = input.index(); input.rewind(); s = -1; @@ -17785,14 +17785,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_66); if ( s>=0 ) return s; break; - case 8 : + case 8 : int LA123_67 = input.LA(1); - + int index123_67 = input.index(); input.rewind(); s = -1; @@ -17800,14 +17800,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_67); if ( s>=0 ) return s; break; - case 9 : + case 9 : int LA123_68 = input.LA(1); - + int index123_68 = input.index(); input.rewind(); s = -1; @@ -17815,14 +17815,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_68); if ( s>=0 ) return s; break; - case 10 : + case 10 : int LA123_69 = input.LA(1); - + int index123_69 = input.index(); input.rewind(); s = -1; @@ -17830,14 +17830,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_69); if ( s>=0 ) return s; break; - case 11 : + case 11 : int LA123_70 = input.LA(1); - + int index123_70 = input.index(); input.rewind(); s = -1; @@ -17845,14 +17845,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_70); if ( s>=0 ) return s; break; - case 12 : + case 12 : int LA123_71 = input.LA(1); - + int index123_71 = input.index(); input.rewind(); s = -1; @@ -17860,14 +17860,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_71); if ( s>=0 ) return s; break; - case 13 : + case 13 : int LA123_72 = input.LA(1); - + int index123_72 = input.index(); input.rewind(); s = -1; @@ -17875,14 +17875,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_72); if ( s>=0 ) return s; break; - case 14 : + case 14 : int LA123_73 = input.LA(1); - + int index123_73 = input.index(); input.rewind(); s = -1; @@ -17890,14 +17890,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_73); if ( s>=0 ) return s; break; - case 15 : + case 15 : int LA123_74 = input.LA(1); - + int index123_74 = input.index(); input.rewind(); s = -1; @@ -17905,14 +17905,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_74); if ( s>=0 ) return s; break; - case 16 : + case 16 : int LA123_75 = input.LA(1); - + int index123_75 = input.index(); input.rewind(); s = -1; @@ -17920,14 +17920,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_75); if ( s>=0 ) return s; break; - case 17 : + case 17 : int LA123_78 = input.LA(1); - + int index123_78 = input.index(); input.rewind(); s = -1; @@ -17935,14 +17935,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_78); if ( s>=0 ) return s; break; - case 18 : + case 18 : int LA123_79 = input.LA(1); - + int index123_79 = input.index(); input.rewind(); s = -1; @@ -17950,14 +17950,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_79); if ( s>=0 ) return s; break; - case 19 : + case 19 : int LA123_80 = input.LA(1); - + int index123_80 = input.index(); input.rewind(); s = -1; @@ -17965,14 +17965,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_80); if ( s>=0 ) return s; break; - case 20 : + case 20 : int LA123_98 = input.LA(1); - + int index123_98 = input.index(); input.rewind(); s = -1; @@ -17980,14 +17980,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_98); if ( s>=0 ) return s; break; - case 21 : + case 21 : int LA123_104 = input.LA(1); - + int index123_104 = input.index(); input.rewind(); s = -1; @@ -17995,14 +17995,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_104); if ( s>=0 ) return s; break; - case 22 : + case 22 : int LA123_129 = input.LA(1); - + int index123_129 = input.index(); input.rewind(); s = -1; @@ -18010,7 +18010,7 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index123_129); if ( s>=0 ) return s; break; @@ -18099,10 +18099,10 @@ public class JavaParser extends DebugParser { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { - case 0 : + case 0 : int LA124_3 = input.LA(1); - + int index124_3 = input.index(); input.rewind(); s = -1; @@ -18110,14 +18110,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index124_3); if ( s>=0 ) return s; break; - case 1 : + case 1 : int LA124_4 = input.LA(1); - + int index124_4 = input.index(); input.rewind(); s = -1; @@ -18125,7 +18125,7 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 5;} - + input.seek(index124_4); if ( s>=0 ) return s; break; @@ -18207,10 +18207,10 @@ public class JavaParser extends DebugParser { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { - case 0 : + case 0 : int LA126_9 = input.LA(1); - + int index126_9 = input.index(); input.rewind(); s = -1; @@ -18218,14 +18218,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 12;} - + input.seek(index126_9); if ( s>=0 ) return s; break; - case 1 : + case 1 : int LA126_5 = input.LA(1); - + int index126_5 = input.index(); input.rewind(); s = -1; @@ -18233,14 +18233,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 12;} - + input.seek(index126_5); if ( s>=0 ) return s; break; - case 2 : + case 2 : int LA126_2 = input.LA(1); - + int index126_2 = input.index(); input.rewind(); s = -1; @@ -18248,14 +18248,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 12;} - + input.seek(index126_2); if ( s>=0 ) return s; break; - case 3 : + case 3 : int LA126_11 = input.LA(1); - + int index126_11 = input.index(); input.rewind(); s = -1; @@ -18263,14 +18263,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 12;} - + input.seek(index126_11); if ( s>=0 ) return s; break; - case 4 : + case 4 : int LA126_6 = input.LA(1); - + int index126_6 = input.index(); input.rewind(); s = -1; @@ -18278,14 +18278,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 12;} - + input.seek(index126_6); if ( s>=0 ) return s; break; - case 5 : + case 5 : int LA126_1 = input.LA(1); - + int index126_1 = input.index(); input.rewind(); s = -1; @@ -18293,14 +18293,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 12;} - + input.seek(index126_1); if ( s>=0 ) return s; break; - case 6 : + case 6 : int LA126_10 = input.LA(1); - + int index126_10 = input.index(); input.rewind(); s = -1; @@ -18308,14 +18308,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 12;} - + input.seek(index126_10); if ( s>=0 ) return s; break; - case 7 : + case 7 : int LA126_7 = input.LA(1); - + int index126_7 = input.index(); input.rewind(); s = -1; @@ -18323,14 +18323,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 12;} - + input.seek(index126_7); if ( s>=0 ) return s; break; - case 8 : + case 8 : int LA126_4 = input.LA(1); - + int index126_4 = input.index(); input.rewind(); s = -1; @@ -18338,14 +18338,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 12;} - + input.seek(index126_4); if ( s>=0 ) return s; break; - case 9 : + case 9 : int LA126_8 = input.LA(1); - + int index126_8 = input.index(); input.rewind(); s = -1; @@ -18353,14 +18353,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 12;} - + input.seek(index126_8); if ( s>=0 ) return s; break; - case 10 : + case 10 : int LA126_3 = input.LA(1); - + int index126_3 = input.index(); input.rewind(); s = -1; @@ -18368,7 +18368,7 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 12;} - + input.seek(index126_3); if ( s>=0 ) return s; break; @@ -18451,10 +18451,10 @@ public class JavaParser extends DebugParser { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { - case 0 : + case 0 : int LA127_12 = input.LA(1); - + int index127_12 = input.index(); input.rewind(); s = -1; @@ -18462,14 +18462,14 @@ public class JavaParser extends DebugParser { else if ( (LA127_12==51) && (synpred200_Java())) {s = 14;} - + input.seek(index127_12); if ( s>=0 ) return s; break; - case 1 : + case 1 : int LA127_0 = input.LA(1); - + int index127_0 = input.index(); input.rewind(); s = -1; @@ -18495,7 +18495,7 @@ public class JavaParser extends DebugParser { else if ( (LA127_0==42) ) {s = 11;} - + input.seek(index127_0); if ( s>=0 ) return s; break; @@ -18587,10 +18587,10 @@ public class JavaParser extends DebugParser { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { - case 0 : + case 0 : int LA139_0 = input.LA(1); - + int index139_0 = input.index(); input.rewind(); s = -1; @@ -18598,14 +18598,14 @@ public class JavaParser extends DebugParser { else if ( (LA139_0==42) ) {s = 2;} - + input.seek(index139_0); if ( s>=0 ) return s; break; - case 1 : + case 1 : int LA139_3 = input.LA(1); - + int index139_3 = input.index(); input.rewind(); s = -1; @@ -18649,7 +18649,7 @@ public class JavaParser extends DebugParser { else if ( (LA139_3==47) && (synpred217_Java())) {s = 23;} - + input.seek(index139_3); if ( s>=0 ) return s; break; @@ -18733,10 +18733,10 @@ public class JavaParser extends DebugParser { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { - case 0 : + case 0 : int LA145_3 = input.LA(1); - + int index145_3 = input.index(); input.rewind(); s = -1; @@ -18744,7 +18744,7 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 4;} - + input.seek(index145_3); if ( s>=0 ) return s; break; @@ -18818,10 +18818,10 @@ public class JavaParser extends DebugParser { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { - case 0 : + case 0 : int LA146_1 = input.LA(1); - + int index146_1 = input.index(); input.rewind(); s = -1; @@ -18829,7 +18829,7 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 3;} - + input.seek(index146_1); if ( s>=0 ) return s; break; @@ -18930,10 +18930,10 @@ public class JavaParser extends DebugParser { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { - case 0 : + case 0 : int LA149_1 = input.LA(1); - + int index149_1 = input.index(); input.rewind(); s = -1; @@ -18941,14 +18941,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 4;} - + input.seek(index149_1); if ( s>=0 ) return s; break; - case 1 : + case 1 : int LA149_3 = input.LA(1); - + int index149_3 = input.index(); input.rewind(); s = -1; @@ -18956,7 +18956,7 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 4;} - + input.seek(index149_3); if ( s>=0 ) return s; break; @@ -19057,10 +19057,10 @@ public class JavaParser extends DebugParser { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { - case 0 : + case 0 : int LA151_1 = input.LA(1); - + int index151_1 = input.index(); input.rewind(); s = -1; @@ -19068,14 +19068,14 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 4;} - + input.seek(index151_1); if ( s>=0 ) return s; break; - case 1 : + case 1 : int LA151_3 = input.LA(1); - + int index151_3 = input.index(); input.rewind(); s = -1; @@ -19083,7 +19083,7 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 4;} - + input.seek(index151_3); if ( s>=0 ) return s; break; @@ -19247,10 +19247,10 @@ public class JavaParser extends DebugParser { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { - case 0 : + case 0 : int LA155_2 = input.LA(1); - + int index155_2 = input.index(); input.rewind(); s = -1; @@ -19258,7 +19258,7 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 1;} - + input.seek(index155_2); if ( s>=0 ) return s; break; @@ -19359,10 +19359,10 @@ public class JavaParser extends DebugParser { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { - case 0 : + case 0 : int LA162_1 = input.LA(1); - + int index162_1 = input.index(); input.rewind(); s = -1; @@ -19370,7 +19370,7 @@ public class JavaParser extends DebugParser { else if ( (true) ) {s = 2;} - + input.seek(index162_1); if ( s>=0 ) return s; break; @@ -19382,7 +19382,7 @@ public class JavaParser extends DebugParser { throw nvae; } } - + public static final BitSet FOLLOW_annotations_in_compilationUnit44 = new BitSet(new long[]{0x0000403F92000020L,0x0000000000000200L}); public static final BitSet FOLLOW_packageDeclaration_in_compilationUnit58 = new BitSet(new long[]{0x0000403F9E000022L,0x0000000000000200L}); diff --git a/openjpa-examples/openbooks/src/main/java/openbook/tools/util/TextProcessingUtility.java b/openjpa-examples/openbooks/src/main/java/openbook/tools/util/TextProcessingUtility.java index 03deb3c81..aa1fa6e90 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/tools/util/TextProcessingUtility.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/tools/util/TextProcessingUtility.java @@ -14,14 +14,14 @@ * "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. + * under the License. */ package openbook.tools.util; public class TextProcessingUtility { /** * Replaces special characters < and > in a string. - * The complexity is not to replace if the tags represent a hyperlink. + * The complexity is not to replace if the tags represent a hyperlink. */ public static String replaceHTMLSpecialCharacters(String txt) { boolean inHyperlink = false; diff --git a/openjpa-examples/openbooks/src/main/java/openbook/tools/util/URIUtils.java b/openjpa-examples/openbooks/src/main/java/openbook/tools/util/URIUtils.java index 48cf68035..95855cbb2 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/tools/util/URIUtils.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/tools/util/URIUtils.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package openbook.tools.util; @@ -30,8 +30,8 @@ public class URIUtils { } /** - * Resolves a URI reference against a base URI. - * + * Resolves a URI reference against a base URI. + * * @param baseURI the base URI * @param reference the URI reference * @return the resulting URI @@ -58,7 +58,7 @@ public class URIUtils { /** * Removes dot segments according to RFC 3986, section 5.2.4 - * + * * @param uri * the original URI * @return the URI without dot segments @@ -98,7 +98,7 @@ public class URIUtils { File f = new File(targetPath); boolean isDir = f.isDirectory(); - // We need the -1 argument to split to make sure we get a trailing + // We need the -1 argument to split to make sure we get a trailing // "" token if the base ends in the path separator and is therefore // a directory. We require directory paths to end in the path // separator -- otherwise they are indistinguishable from files. @@ -106,7 +106,7 @@ public class URIUtils { String[] target = targetPath.split(Pattern.quote(pathSeparator), 0); // First get all the common elements. Store them as a string, - // and also count how many of them there are. + // and also count how many of them there are. String common = ""; int commonIndex = 0; for (int i = 0; i < target.length && i < base.length; i++) { @@ -119,7 +119,7 @@ public class URIUtils { if (commonIndex == 0) { // not even a single common path element. This most - // likely indicates differing drive letters, like C: and D:. + // likely indicates differing drive letters, like C: and D:. // These paths cannot be relativized. Return the target path. return targetPath; } @@ -130,14 +130,14 @@ public class URIUtils { relative = "." + pathSeparator; } else { int numDirsUp = base.length - commonIndex - (isDir ? 0 : 1); /* only subtract 1 if it is a file. */ - // The number of directories we have to backtrack is the length of + // The number of directories we have to backtrack is the length of // the base path MINUS the number of common path elements, minus // one because the last element in the path isn't a directory. for (int i = 1; i <= (numDirsUp); i++) { relative += ".." + pathSeparator; } } - //if we are comparing directories + //if we are comparing directories if (targetPath.length() > common.length()) { //it's OK, it isn't a directory relative += targetPath.substring(common.length()); diff --git a/openjpa-examples/openbooks/src/main/java/openbook/util/JSPUtility.java b/openjpa-examples/openbooks/src/main/java/openbook/util/JSPUtility.java index 69e486d12..42c738acb 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/util/JSPUtility.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/util/JSPUtility.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package openbook.util; @@ -28,26 +28,26 @@ 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, 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. @@ -59,20 +59,20 @@ public class JSPUtility { return null; } } - + /** * 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. + * 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 " + + throw new IllegalArgumentException("Odd number of encoding parameters " + Arrays.toString(params) + " to " + page); } for (int i = 0; i < params.length; i += 2) { @@ -88,7 +88,7 @@ public class JSPUtility { else return page; } - + private static String encode(String s) { try { return URLEncoder.encode(s, "UTF-8"); @@ -96,7 +96,7 @@ public class JSPUtility { return s; } } - + public static final String SRC_ROOT = "generated-html"; public static String getURL(String className, String anchor) { return SRC_ROOT + "/" + className.replace('.', '/') + (anchor != null ? "#"+anchor : ""); diff --git a/openjpa-examples/openbooks/src/main/java/openbook/util/PropertyHelper.java b/openjpa-examples/openbooks/src/main/java/openbook/util/PropertyHelper.java index fef6ec673..acd8b4ec7 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/util/PropertyHelper.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/util/PropertyHelper.java @@ -30,21 +30,21 @@ import java.util.Set; /** * A set of static utility functions to read properties from file, manage properties with multi-part keys, * array style properties etc. - * + * * @author Pinaki Poddar * */ public class PropertyHelper { /** * Filter the properties by the given name. - * + * * @param name a part of the key * @param prefix if true, property key must begin with the given name. Otherwise, the key merely contains the - * name to qualify. + * name to qualify. * * @return key-value pairs that match. */ - public static Map filter(Map props, String name, boolean prefix, + public static Map filter(Map props, String name, boolean prefix, boolean includeArrays) { Map result = new HashMap(); for (String key : props.keySet()) { @@ -61,24 +61,24 @@ public class PropertyHelper { } return result; } - + /** * Select only those property keys which ends with an array marker such as openjpa.DataCache[1]. - * The multiple values of the property is inserted into the resultant map as a List of object against the - * original key. + * The multiple values of the property is inserted into the resultant map as a List of object against the + * original key. *
    * For example, if the original map had three key-value pairs as - *
  • openjpa.DataCache[1]=true + *
  • openjpa.DataCache[1]=true *
  • openjpa.DataCache[2]=false *
  • openjpa.DataCache[3]=default *
    * Then that will result into a single entry in the resultant Map under the key openjpa.DataCache * with a value as a List of three elements namely {true, false, default}. The array index values * are not significant other than they must all be different for the same base key. - * + * * @param name part of the property key * @param prefix does the name must appear as a prefix? - * + * * @return key-value pairs that match. */ public static Map> filterArrayKeys(Map props, String name, boolean prefix) { @@ -98,14 +98,14 @@ public class PropertyHelper { return result; } - + /** * Load properties from the given name resource. * The given named resource is first looked up as resource on the current thread's context * and if not found as a file input. - * - * @param resource name a of resource. - * + * + * @param resource name a of resource. + * * @return empty properties if no resource found. */ public static Map load(String resource) { @@ -114,18 +114,18 @@ public class PropertyHelper { InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource); if (stream == null) { stream = new FileInputStream(resource); - } + } p.load(stream); } catch (Exception e) { System.err.println("Error reading " + resource + " due to " + e); } return toMap(p); } - + /** * Affirm if the given resource is available either as a resource in the current thread's context classpath * or as a file. - * + * */ public static boolean canFind(String resource) { if (resource == null) @@ -135,7 +135,7 @@ public class PropertyHelper { return true; return new File(resource).exists(); } - + public static Map toMap(Properties p) { Map result = new HashMap(); for (Object k : p.keySet()) { @@ -143,9 +143,9 @@ public class PropertyHelper { } return result; } - + /** - * Overwrites any key-value pair in the given map for which a System property is available + * Overwrites any key-value pair in the given map for which a System property is available * @param original properties to be overwritten * @return the original property overwritten with System properties */ @@ -159,7 +159,7 @@ public class PropertyHelper { return original; } - + public static int getInteger(Map props, String key, int def) { int result = def; try { @@ -167,11 +167,11 @@ public class PropertyHelper { if (value != null) result = Integer.parseInt(value.toString()); } catch (NumberFormatException nfe) { - + } return result; } - + public static double getDouble(Map props, String key, double def) { double result = def; try { @@ -179,33 +179,33 @@ public class PropertyHelper { if (value != null) result = Double.parseDouble(value.toString()); } catch (NumberFormatException nfe) { - + } return result; } - + public static String getString(Map props, String key, String def) { Object value = props.get(key); if (value != null) return value.toString(); return def; } - + public static List getStringList(Map props, String key) { return getStringList(props, key, Collections.EMPTY_LIST); } - + public static List getStringList(Map props, String key, List def) { Object value = props.get(key); if (value != null) return Arrays.asList(value.toString().split("\\,")); return def; } - + public static Map getMap(Map props, String key) { return getMap(props, key, Collections.EMPTY_MAP); } - + public static Map getMap(Map props, String key, Map def) { List pairs = getStringList(props, key); if (pairs == null || pairs.isEmpty()) @@ -224,7 +224,7 @@ public class PropertyHelper { /** * Affirms if the given string using array [] symbol at the end. - * + * * @param key a string to check for array symbol. */ private static boolean isArray(String key) { @@ -242,7 +242,7 @@ public class PropertyHelper { } return true; } - + private static String removeArray(String key) { int i = key.indexOf("["); return key.substring(0,i); @@ -258,7 +258,7 @@ public class PropertyHelper { } return subsections; } - + private static final String DOT = "."; private static String asPrefix(String s) { if (s.endsWith(DOT)) return s; @@ -268,28 +268,28 @@ public class PropertyHelper { int i = s.indexOf(DOT); return (i == -1) ? s : s.substring(0, i); } - + /** * Get the portion of the given map whose key has the given section at prefix. - * + * * @param props a set of name-value pair * @param section a string representing section of a key - * - * @return a new map with only the keys that starts with the given section. + * + * @return a new map with only the keys that starts with the given section. */ public static Map getSection(Map props, String section) { return getSection(props, section, false); } - + /** * Get the portion of the given map whose key has the given section at prefix. - * + * * @param props a set of name-value pair * @param section a string representing section of a key * @param retain if true the key of resultant map is same as the original map. Otherwise * the resultant map keys are without the section prefix. - * - * @return the map with only the keys that starts with the given section. + * + * @return the map with only the keys that starts with the given section. */ public static Map getSection(Map props, String section, boolean retain) { Map result = new HashMap(props); diff --git a/openjpa-examples/openbooks/src/main/java/openbook/util/Randomizer.java b/openjpa-examples/openbooks/src/main/java/openbook/util/Randomizer.java index 2901696a2..84f874601 100644 --- a/openjpa-examples/openbooks/src/main/java/openbook/util/Randomizer.java +++ b/openjpa-examples/openbooks/src/main/java/openbook/util/Randomizer.java @@ -29,7 +29,7 @@ import java.util.Set; /** * A set of static utility functions for simulating pseudo-randomness. - * + * * @author Pinaki Poddar * */ @@ -44,16 +44,16 @@ public class Randomizer { public static boolean probability(double p) { return rng.nextDouble() < p; } - + /** * Picks a random number between 0 (inclusive) and N (exclusive). */ public static int random(int n) { return rng.nextInt(n); } - + /** - * Picks a uniformly distributed random integer within the given range. + * Picks a uniformly distributed random integer within the given range. */ public static int random(int min, int max) { return min + rng.nextInt(max-min); @@ -61,9 +61,9 @@ public class Randomizer { public static double random(double min, double max) { return min + rng.nextDouble()*(max-min); } - + /** - * Generates a random alphanumeric String with each segment separated by a dash. + * Generates a random alphanumeric String with each segment separated by a dash. */ public static String randomString(int...segments) { StringBuilder tmp = new StringBuilder(); @@ -74,7 +74,7 @@ public class Randomizer { } return tmp.toString(); } - + /** * Picks a random element from the given list. */ @@ -85,7 +85,7 @@ public class Randomizer { return list.get(0); return list.get(random(list.size())); } - + /** * Selects n elements randomly from the given list. */ diff --git a/openjpa-examples/openbooks/src/main/resources/META-INF/persistence.jee.liberty.xml b/openjpa-examples/openbooks/src/main/resources/META-INF/persistence.jee.liberty.xml index e9850acbc..4763bba74 100644 --- a/openjpa-examples/openbooks/src/main/resources/META-INF/persistence.jee.liberty.xml +++ b/openjpa-examples/openbooks/src/main/resources/META-INF/persistence.jee.liberty.xml @@ -32,19 +32,19 @@ openbook.domain.LineItem openbook.domain.Customer openbook.domain.Author - + NONE - - - + + + - + - + diff --git a/openjpa-examples/openbooks/src/main/resources/META-INF/persistence.jee.was.xml b/openjpa-examples/openbooks/src/main/resources/META-INF/persistence.jee.was.xml index 4ebb9e6a6..87f93f27f 100644 --- a/openjpa-examples/openbooks/src/main/resources/META-INF/persistence.jee.was.xml +++ b/openjpa-examples/openbooks/src/main/resources/META-INF/persistence.jee.was.xml @@ -32,19 +32,19 @@ openbook.domain.LineItem openbook.domain.Customer openbook.domain.Author - + NONE - - - + + + - + - + diff --git a/openjpa-examples/openbooks/src/main/resources/META-INF/persistence.xml b/openjpa-examples/openbooks/src/main/resources/META-INF/persistence.xml index c94461ee2..c7a6ddd3b 100644 --- a/openjpa-examples/openbooks/src/main/resources/META-INF/persistence.xml +++ b/openjpa-examples/openbooks/src/main/resources/META-INF/persistence.xml @@ -24,16 +24,16 @@ version="2.0"> org.apache.openjpa.persistence.PersistenceProviderImpl - + openbook.domain.Book openbook.domain.Inventory openbook.domain.PurchaseOrder openbook.domain.LineItem openbook.domain.Customer openbook.domain.Author - + NONE - + - + @@ -49,17 +49,17 @@ - + - + - + - + - + diff --git a/openjpa-examples/openbooks/src/main/resources/META-INF/web.xml b/openjpa-examples/openbooks/src/main/resources/META-INF/web.xml index b72509eec..32b700b9b 100644 --- a/openjpa-examples/openbooks/src/main/resources/META-INF/web.xml +++ b/openjpa-examples/openbooks/src/main/resources/META-INF/web.xml @@ -19,21 +19,21 @@ --> - OpenBooks + OpenBooks intro.jsp - - jdbc/NonTxOpenBooks - javax.sql.DataSource - Container - Shareable - - - jdbc/OpenBooks - javax.sql.DataSource - Container - Shareable - + + jdbc/NonTxOpenBooks + javax.sql.DataSource + Container + Shareable + + + jdbc/OpenBooks + javax.sql.DataSource + Container + Shareable + diff --git a/openjpa-examples/openbooks/src/main/resources/demo.properties b/openjpa-examples/openbooks/src/main/resources/demo.properties index 2d1d7e007..94c36ebf3 100644 --- a/openjpa-examples/openbooks/src/main/resources/demo.properties +++ b/openjpa-examples/openbooks/src/main/resources/demo.properties @@ -25,19 +25,19 @@ # where slides files reside # openbook.slides.dir=slides/ # Slide files (not Powerpoint slides, but their converted images) resolved -# w.r.t openbook.slides.dir +# w.r.t openbook.slides.dir # openbook.slides.list=slide1.jpg,slide2.jpg,slide3.jpg,myslide4.jpg -# The root of viewable source code. +# The root of viewable source code. # All viewable source code path is specified and resolved w.r.t this URI. -# If the URI is without a scheme, then it is resolved against the current directory. +# If the URI is without a scheme, then it is resolved against the current directory. # If URI is a file system path, use a forward slash at the end to signify that it is a directory. -# The URI can be an external URI such as FishEye source code repository. +# The URI can be an external URI such as FishEye source code repository. # The value of this URI is defaulted to "source/openbook" i.e. in accordance to build.xml which installs # the viewable source code in "source/openbook" sub-directory w.r.t OpenBooks executable. openbook.source.root=source/openbook -# Following is where the files are originally created by the Ant build script. -# Useful for in-place testing +# Following is where the files are originally created by the Ant build script. +# Useful for in-place testing # openbook.source.root=openjpa-examples/openbooks/target/generated-html/openbook/ @@ -47,7 +47,7 @@ openbook.source.root=source/openbook # This boolean flag denotes if OpenBooks will use an external or internal browser # By default, OpenBooks uses an internal browser i.e. value of this flag is false -# To use an external browser, JDK6 DeskTop support is required +# To use an external browser, JDK6 DeskTop support is required # openbook.source.browser.external=true # Source list specifies the initial list of viewable source code to register in the internal viewer. @@ -61,4 +61,3 @@ openbook.source.list= Book-> domain/Book.java.html, Author -> domain/Author.java PurchaseOrder-> domain/PurchaseOrder.java.html, LineItem -> domain/LineItem.java.html, OpenBookService -> \ server/OpenBookService.java.html, OpenBookServiceImpl -> server/OpenBookServiceImpl.java.html, \ PersistenceService -> server/PersistenceService.java.html, BuyBookPage -> client/BuyBookPage.java.html - \ No newline at end of file diff --git a/openjpa-examples/openbooks/src/main/resources/java.css b/openjpa-examples/openbooks/src/main/resources/java.css index 2c5092254..153bc84b8 100644 --- a/openjpa-examples/openbooks/src/main/resources/java.css +++ b/openjpa-examples/openbooks/src/main/resources/java.css @@ -14,7 +14,7 @@ * "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. + * under the License. */ /* ------------------------------------------------------------- @@ -25,7 +25,7 @@ body{ font-family:"Courier New"; white-space:pre-wrap; - + } #keyword { diff --git a/openjpa-examples/openbooks/web/cart.jsp b/openjpa-examples/openbooks/web/cart.jsp index 0482ae17a..398ed7088 100644 --- a/openjpa-examples/openbooks/web/cart.jsp +++ b/openjpa-examples/openbooks/web/cart.jsp @@ -1,4 +1,4 @@ -<%-- +<%-- * 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 @@ -14,7 +14,7 @@ * "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. + * under the License. --%> @@ -32,47 +32,47 @@

    Shopping Cart

    <% if (ACTION_ADD.equals(request.getParameter(KEY_ACTION))) { %> - You have just added a Book to the cart. + You have just added a Book to the cart.
    -<% - } +<% + } %> - A
    Shopping Cart contains - Books that are persistent objects. + A Shopping Cart contains + Books that are persistent objects. Shopping Cart itself, however, is not a persistent object. - Shopping Cart is an in-memory data structure to hold the Books in the current web session and transfer - it to the server when a Purchase Order is to be placed. + Shopping Cart is an in-memory data structure to hold the Books in the current web session and transfer + it to the server when a Purchase Order is to be placed.
    -<% - OpenBookService service = (OpenBookService)session.getAttribute(KEY_SERVICE); +<% + OpenBookService service = (OpenBookService)session.getAttribute(KEY_SERVICE); Customer customer = (Customer)session.getAttribute(KEY_USER); ShoppingCart cart = (ShoppingCart)session.getAttribute(KEY_CART); if (ACTION_ADD.equals(request.getParameter(KEY_ACTION))) { String isbn = request.getParameter(KEY_ISBN); - Book book = (Book)session.getAttribute(isbn); + Book book = (Book)session.getAttribute(isbn); cart.addItem(book, 1); } if (cart.isEmpty()) { %> <%= customer.getName() %>, your Shopping Cart is empty.
    Continue Shopping -<% +<% return; - } + } %> - - - + + @@ -80,14 +80,14 @@ <% - + Map books = cart.getItems(); int i = 0; for (Book b : books.keySet()) { diff --git a/openjpa-examples/openbooks/web/checkout.jsp b/openjpa-examples/openbooks/web/checkout.jsp index e0c771d97..85280708e 100644 --- a/openjpa-examples/openbooks/web/checkout.jsp +++ b/openjpa-examples/openbooks/web/checkout.jsp @@ -1,4 +1,4 @@ -<%-- +<%-- * 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 @@ -14,7 +14,7 @@ * "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. + * under the License. --%> @@ -33,31 +33,31 @@

    Composite Relation and Derived Identity

    - You have just created a - new Purchase Order - . Each Book in + You have just created a + new Purchase Order + . Each Book in the Shopping Cart is turned into separate line item for the order and the Purchase Order and all its line items are inserted as new database records. All this happened with this - few lines of Java Code + few lines of Java Code
    • Transitive Persistence: - The line items are persisted without any explicit call to persist because persist operation - cascades + The line items are persisted without any explicit call to persist because persist operation + cascades via the order-line item relation. During persist, the JPA provider generated a new - identity of - the Purchase Order automatically. + identity of + the Purchase Order automatically.
    • Compound, Derived identity: - The identity generation, in this case, is more interesting if you look at the + The identity generation, in this case, is more interesting if you look at the identity used by the line items. Line Item uses compound, derived identity. It is compound because more than one field make up the identity. It is derived because one of the identity field borrows its value from the owning Purchase Order's identity. Because of such dependency, the persistent - identity of a Line Item can only be assigned only after a new - identity value for a Purchase Order gets generated during transaction commit. + identity of a Line Item can only be assigned only after a new + identity value for a Purchase Order gets generated during transaction commit.
    • Composite Relation: Purchase Order - Line Item relationship is by semantics, a composite relation. Simply stated, life time of a Line Item is completely controlled @@ -66,23 +66,23 @@
      The Java language provides no support for composite relationship -- but it is a common pattern for persistent objects. The new JPA features - of derived identity combined with orphan delete (another new feature) and cascaded + of derived identity combined with orphan delete (another new feature) and cascaded persistent operations provides an application to reliably express a classic Master-Details - pattern in their application. + pattern in their application.
    - +
    -<% - OpenBookService service = (OpenBookService)session.getAttribute(KEY_SERVICE); +<% + OpenBookService service = (OpenBookService)session.getAttribute(KEY_SERVICE); ShoppingCart cart = (ShoppingCart)session.getAttribute(KEY_CART); PurchaseOrder order = null; if (cart.isEmpty()) { %> -<% +<% } else { order = service.placeOrder(cart); } @@ -90,14 +90,14 @@

    Thank you for ordering from OpenBooks

    <%= cart.getTotalCount() %> Book<%= cart.getTotalCount() == 1 ? "" : "s" %> in + <%= cart.getTotalCount() %> Book<%= cart.getTotalCount() == 1 ? "" : "s" %> in <%= customer.getName() %>'s Shopping Cart
    TitlePriceTitlePrice Quantity
    Continue Shopping -
    - - + - + diff --git a/openjpa-examples/openbooks/web/footer.jsp b/openjpa-examples/openbooks/web/footer.jsp index 45e15d2a2..890fb2208 100644 --- a/openjpa-examples/openbooks/web/footer.jsp +++ b/openjpa-examples/openbooks/web/footer.jsp @@ -1,4 +1,4 @@ -<%-- +<%-- * 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 @@ -14,7 +14,7 @@ * "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. + * under the License. --%> @@ -22,8 +22,8 @@ <%@page import="org.apache.openjpa.conf.OpenJPAVersion"%>
    Order : <%= order.getId() %> on <%= JSPUtility.format(order.getPlacedOn()) %> + Order : <%= order.getId() %> on <%= JSPUtility.format(order.getPlacedOn()) %> for <%= order.getItems().size() %> Book<%= order.getItems().size() == 0 ? "" : "s" %>
    TitleTitle QuantityPricePrice
    - - - - - + + + + + @@ -113,26 +113,26 @@ are no more available. session.setAttribute(""+order.getId(), order); %> - -<% +<% if (order.isDelivered()) { -%> +%> <% } else { %> - -<% +<% } %> @@ -152,25 +152,25 @@ are no more available. if (items != null && items.isEmpty()) { %> Order <%= order.getId() %> has been delivered. Line items of delivered orders are automatically - deleted due to orphan delete nature of Master-Details relationship. + deleted due to orphan delete nature of Master-Details relationship. <% } else { %> - Order <%= order.getId() %> has been delivered but still contains line items. + Order <%= order.getId() %> has been delivered but still contains line items. This is an implementation error because delivered orders must have at least one line item by design. <% } } else { -%> +%>
    <%= customer.getName() %>, you have placed <%= orders.size() %> ( <%= pendingOrders.size() == 0 ? "none" : "" + pendingOrders.size()%> pending, - <%= deliveredOrders.size() == 0 ? " none" : " " + deliveredOrders.size()%> delivered) orders + <%= deliveredOrders.size() == 0 ? " none" : " " + deliveredOrders.size()%> delivered) orders
    IDTotalPlaced OnStatusDelivered OnIDTotalPlaced OnStatusDelivered On Deliver
    "> <%= order.getId() %> <%= order.getTotal() %> <%= JSPUtility.format(order.getPlacedOn()) %> <%= order.getStatus() %> <%= JSPUtility.format(order.getDeliveredOn()) %> ">
    - - - + + - + @@ -197,7 +197,7 @@ are no more available. } } %> - + diff --git a/openjpa-examples/openbooks/web/query.jsp b/openjpa-examples/openbooks/web/query.jsp index 0a33cce2e..200c0e5ac 100644 --- a/openjpa-examples/openbooks/web/query.jsp +++ b/openjpa-examples/openbooks/web/query.jsp @@ -1,4 +1,4 @@ -<%-- +<%-- * 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 @@ -14,7 +14,7 @@ * "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. + * under the License. --%> <%-- ==================================================================== --%> <%-- Executes a query which is determined by the request parameter. --%> @@ -31,18 +31,18 @@

    Query Result

    - + This page is displaying the result of the Criteria query specified in the previous Search page.
    • Readability: Criteria query is more powerful than JPQL but hardly as readable. JPA specification says nothing about how a Criteria Query should be displayed. - OpenJPA implementation provides a simple + OpenJPA implementation provides a simple - toString() method to display a Criteria query as a string that is quite + toString() method to display a Criteria query as a string that is quite similar to an equivalent JPQL string. Similar because Criteria query can - express certain queries that has no equivalent JPQL counterpart. + express certain queries that has no equivalent JPQL counterpart.
    • -
    • Eager Fetching: The query result displays the Author names as well, though the query +
    • Eager Fetching: The query result displays the Author names as well, though the query had only selected the Books. But the Authors have also been fetched because many-to-many Book-Author relationship is annotated to be eagerly fetched. @@ -70,8 +70,8 @@ %> -<% - OpenBookService service = (OpenBookService)session.getAttribute(KEY_SERVICE); +<% + OpenBookService service = (OpenBookService)session.getAttribute(KEY_SERVICE); if (service == null) { %> @@ -84,7 +84,7 @@ Double minPrice = JSPUtility.toDouble(request.getParameter(FORM_PRICE_MIN)); Double maxPrice = JSPUtility.toDouble(request.getParameter(FORM_PRICE_MAX)); String author = request.getParameter(FORM_AUTHOR); - + List books = service.select(title, minPrice, maxPrice, author); String query = service.getQuery(title, minPrice, maxPrice, author); %> @@ -93,9 +93,9 @@ Query : <%= query %> <% if (books.isEmpty()) { %> - did not select any book. + did not select any book.

      Search again

      -<% +<% return; } %> @@ -104,10 +104,10 @@ Query : <%= query %>
    - - - - + + + + @@ -124,7 +124,7 @@ Query : <%= query %> - diff --git a/openjpa-examples/openbooks/web/register.jsp b/openjpa-examples/openbooks/web/register.jsp index 614bd7d71..921400e7e 100644 --- a/openjpa-examples/openbooks/web/register.jsp +++ b/openjpa-examples/openbooks/web/register.jsp @@ -1,4 +1,4 @@ -<%-- +<%-- * 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 @@ -14,7 +14,7 @@ * "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. + * under the License. --%> <%@include file="header.jsp"%> @@ -29,7 +29,7 @@ <%-- Associates the current session with OpenBookService, if the request --%> <%-- carries user parameter. Otherwise redirects to login page. --%> <%-- ==================================================================== --%> -<% +<% Object user = request.getParameter(KEY_USER); String nextPage = PAGE_HOME; if (user != null && user.toString().trim().length() > 0) { diff --git a/openjpa-examples/openbooks/web/search.jsp b/openjpa-examples/openbooks/web/search.jsp index cc0440b2b..21d97649c 100644 --- a/openjpa-examples/openbooks/web/search.jsp +++ b/openjpa-examples/openbooks/web/search.jsp @@ -1,4 +1,4 @@ -<%-- +<%-- * 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 @@ -14,7 +14,7 @@ * "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. + * under the License. --%> @@ -26,7 +26,7 @@

    Criteria Query & Form-based Search

    - + This is a typical search form in a web page. The user fills in one or more fields about a Book, clicks Search and a set of Books matching the user criteria appear on the web page. @@ -34,28 +34,28 @@
    • Dynamic Query: Behind the page, the user input will be used to build up a query, executed on a database and the results - returned. The problem is how to build the right query based on the fields that the user had filled in. + returned. The problem is how to build the right query based on the fields that the user had filled in. If there are 6 input fields -- potentially there are 26=64 - ways to fill in the form and, hence, 64 possible queries. + ways to fill in the form and, hence, 64 possible queries.
      - Criteria Query -- introduced in JPA 2.0 -- can solve this combinatorial problem - by building the query + Criteria Query -- introduced in JPA 2.0 -- can solve this combinatorial problem + by building the query - dynamically. + dynamically.
      The code shows how the predicates are created based on availability of particular input fields. In the end, all the predicates are anded together to create the final selection criteria.
    • -
    • Safety by Strong Typing: This new query API is also strongly typed via usage of generic - type arguments. - For example, the API signature enforces that the type of the result returned by a query must match +
    • Safety by Strong Typing: This new query API is also strongly typed via usage of generic + type arguments. + For example, the API signature enforces that the type of the result returned by a query must match the type of arguments selected. Or, a String field can not be compared by mistake against a numeric value. All these new features reduces the risk of runtime errors that can be caused by String-based - query. + query.

    - More about Criteria Query can be found + More about Criteria Query can be found here.
    @@ -70,8 +70,8 @@ } %> -<% - OpenBookService service = (OpenBookService)session.getAttribute(KEY_SERVICE); +<% + OpenBookService service = (OpenBookService)session.getAttribute(KEY_SERVICE); if (service == null) { %> @@ -80,32 +80,32 @@ %>
    -Fill in the details for a book you are searching for. +Fill in the details for a book you are searching for.
    - Title :

    - Author:

    - Price from : to - to +

    -Search Tips: +Search Tips:
    1. You can leave one, more or all fields empty.
    2. OpenBooks database currently contains <%= service.count(Book.class) %> books.
    3. Book titles are Book-1, Book-2, Book-3,...
    4. Author names are Author-1, Author-2, Author-3,...
    5. Both Book and Author names accept wildcard characters.
      - For example, an underscore like Book-3_ will match any single character to return + For example, an underscore like Book-3_ will match any single character to return Book-31, Book-32, Book-33 ... - +
    - + <%@include file="footer.jsp"%> diff --git a/openjpa-examples/opentrader/build.properties b/openjpa-examples/opentrader/build.properties index c496a3747..9ee99fdcc 100644 --- a/openjpa-examples/opentrader/build.properties +++ b/openjpa-examples/opentrader/build.properties @@ -45,7 +45,7 @@ jdbc.jar=C:/mysql/mysql-connector-java-5.1.6/mysql-connector-java-5.1.6-bin.jar appserver.root=C:/apache-tomcat-6.0.29 auto.deploy.dir=${appserver.root}/webapps -# The root directory of the application server +# The root directory of the application server #appserver.root=C:/glassfishv3/glassfish appserver.root=C:/apache-tomcat-6.0.29 # The root directory of the deployed application domains diff --git a/openjpa-examples/opentrader/build.xml b/openjpa-examples/opentrader/build.xml index aa4177728..6666d5ba7 100644 --- a/openjpa-examples/opentrader/build.xml +++ b/openjpa-examples/opentrader/build.xml @@ -6,15 +6,15 @@ 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. + under the License. --> @@ -38,7 +38,7 @@ - + @@ -110,7 +110,7 @@ - + - + - - - + + + diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/FormatUtil.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/FormatUtil.java index 5a026c9ee..90528b005 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/FormatUtil.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/FormatUtil.java @@ -23,7 +23,7 @@ import com.google.gwt.user.client.ui.HTML; /** * A set of static utilities to create decorated HTML labels for price and price changes. - * + * * @author Pinaki Poddar * */ @@ -31,14 +31,14 @@ public class FormatUtil { public static final NumberFormat priceFormat = NumberFormat.getFormat("#,##0.00"); public static final NumberFormat changeFormat = NumberFormat.getFormat("+#,##0.00;-#,##0.00"); public static final NumberFormat volumeFormat = NumberFormat.getFormat("#,##0"); - + /** * Creates a HTML for the formatted price without any style. */ public static HTML formatPrice(double price) { return formatPrice(price, false); } - + /** * Creates a HTML label for the formatted price with a style based on the signum of the price. * The positive and negative values are formatted with CSS styles positive and @@ -51,7 +51,7 @@ public class FormatUtil { label.addStyleName(price >= 0 ? "positive" : "negative"); return label; } - + /** * Creates a HTML label for the given integer. */ @@ -60,11 +60,11 @@ public class FormatUtil { label.setText(volumeFormat.format(volume)); return label; } - + /** * Creates a HTML label for the difference of two given numbers and applies style based * on the sign of the difference. Optionally adds percentage change. - * + * * @param p1 first value * @param p2 second value * @param pct if true, adds a percentage change @@ -82,7 +82,7 @@ public class FormatUtil { html.addStyleName(style); return html; } - + /** * Creates a HTML label for the given value and applies style based on the sign. */ diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/LoginDialog.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/LoginDialog.java index 71f142cc8..fbdc7d0f8 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/LoginDialog.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/LoginDialog.java @@ -37,16 +37,16 @@ import com.google.gwt.user.client.ui.PopupPanel; import com.google.gwt.user.client.ui.TextBox; /** - * A dialog box for login a Trader. Once the trader's name is entered, this widget calls the server + * A dialog box for login a Trader. Once the trader's name is entered, this widget calls the server * to start a session for the trader, gets all the tradable Stocks and passes that initialization data * to the {@link OpenTrader main application} to {@link OpenTrader#init(Trader, List) initialize}. - * + * *
    * CSS styles used *
  • login : for the main dialog box *
  • login-caption: for the caption - * - * + * + * * @author Pinaki Poddar * */ @@ -54,13 +54,13 @@ public class LoginDialog extends PopupPanel { private Trader trader; private String serverURI; private final OpenTrader session; - + public LoginDialog(final OpenTrader session) { super(false, true); setAnimationEnabled(true); this.session = session; - + final FlexTable table = new FlexTable(); final HTML header = new HTML("  Welcome to OpenTrader  "); final Label label = new Label("Please enter name:"); @@ -73,7 +73,7 @@ public class LoginDialog extends PopupPanel { table.addStyleName("login"); label.addStyleName("login"); header.addStyleName("login-caption"); - + table.setWidget(0, 0, header); table.setWidget(2, 0, label); table.setWidget(2, 1, traderName); @@ -82,7 +82,7 @@ public class LoginDialog extends PopupPanel { enter.setEnabled(true); traderName.setFocus(true); - + enter.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (traderName.getText().trim().length() == 0) { @@ -96,7 +96,7 @@ public class LoginDialog extends PopupPanel { }); setWidget(table); } - + /** * --------------------------------------------------------------------------------- * Asynchronous RPC service callbacks @@ -107,21 +107,21 @@ public class LoginDialog extends PopupPanel { * Logs in a [@link Trader} and then invokes another RPC service to get the list of tradable stocks. * This pattern of calling one RPC from another addresses sequential execution of asynchronous * callbacks. This pattern is necessary when the second RPC depends in some way to the result of - * the first RPC. - * + * the first RPC. + * */ class LoginCallback implements AsyncCallback { public void onFailure(Throwable caught) { ProgressMonitor.stop(); session.handleError(caught); } - + public void onSuccess(Trader result) { trader = result; session.getService().getServiceURI(new GetServerURI()); } } - + /** * Initializes the server URI. * @@ -137,7 +137,7 @@ public class LoginDialog extends PopupPanel { } } - + /** * Initializes the tradable stocks followed by the main application. * diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/MarketDataPanel.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/MarketDataPanel.java index 2a733c3a7..a8db91444 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/MarketDataPanel.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/MarketDataPanel.java @@ -33,40 +33,40 @@ import com.google.gwt.user.client.ui.Widget; /** * Displays the current Stock prices and updates periodically. - * - * + * + * * @author Pinaki Poddar - * + * */ public class MarketDataPanel extends ScrollableTable implements UpdateStockHandler { private final OpenTrader session; private Timer refreshTimer; private static int refreshInterval = 60*1000; - + public MarketDataPanel(final OpenTrader session, final int w, final int h) { super("Market Prices (Updated every " + refreshInterval/1000 + "s)", w, h, true); this.session = session; - + session.registerHandler(ServiceEvent.StockUpdated.TYPE, this); - + setColumnHeader(0, "Symbol", "25%"); setColumnHeader(1, "Price", "25%"); setColumnHeader(2, "Change", "50%"); - + // Stock Symbol setRenderer(0, new GridCellRenderer() { public Widget render(Stock stock) { return new Label(stock.getSymbol()); } }); - + // Current Market Price setRenderer(1, new GridCellRenderer() { public Widget render(Stock stock) { return FormatUtil.formatPrice(stock.getMarketPrice()); } }); - + // Percent Change since last update setRenderer(2, new GridCellRenderer() { public Widget render(Stock stock) { @@ -74,10 +74,10 @@ public class MarketDataPanel extends ScrollableTable implements UpdateSto } }); } - + /** * Sets the interval to refresh the stock data from the server. - * + * * @param interval period in milliseconds. */ public void setRefreshInterval(int interval) { @@ -86,7 +86,7 @@ public class MarketDataPanel extends ScrollableTable implements UpdateSto if (refreshTimer != null) refreshTimer.scheduleRepeating(refreshInterval); } - + /** * Gets the interval (in milliseconds) to refresh the stock data from the server. */ @@ -110,7 +110,7 @@ public class MarketDataPanel extends ScrollableTable implements UpdateSto refreshTimer.run(); refreshTimer.scheduleRepeating(refreshInterval); } - + /** * Starts periodic update of the stocks from the server. */ @@ -120,13 +120,13 @@ public class MarketDataPanel extends ScrollableTable implements UpdateSto refreshTimer.cancel(); refreshTimer = null; } - + /** * --------------------------------------------------------------------------------- * Service Event Response Management * --------------------------------------------------------------------------------- */ - + /** * Updates the stock data. */ @@ -143,12 +143,12 @@ public class MarketDataPanel extends ScrollableTable implements UpdateSto */ /** - * Periodically update the stocks and notifies the listeners via the + * Periodically update the stocks and notifies the listeners via the * {@link OpenTrader#fireEvent(com.google.gwt.event.shared.GwtEvent) mediator}. * In this case, one of the listeners is this widget itself. Still the * {@link ServiceEvent.StockUpdated service event} is propagated via the * mediator (so that others can listen as well). - * + * */ public class UpdateStocks implements AsyncCallback> { public void onFailure(Throwable caught) { diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/MatchWindow.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/MatchWindow.java index e7c71fb0b..ca1a67a97 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/MatchWindow.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/MatchWindow.java @@ -43,28 +43,28 @@ import com.google.gwt.user.client.ui.RadioButton; /** * A popup presents a list of matching Tradables and lets the user select one of them * to commit a trade. - * + * * @author Pinaki Poddar * */ public class MatchWindow extends PopupPanel { private final OpenTrader session; - + public MatchWindow(final OpenTrader session, final Tradable tradable, final List matches) { super(false, true); this.session = session; setAnimationEnabled(true); - + DockPanel panel = new DockPanel(); panel.setHorizontalAlignment(DockPanel.ALIGN_CENTER); final HTML header = new HTML(); final boolean ask = (tradable instanceof Ask); - String txt = (matches.isEmpty() ? "No" : ""+matches.size()) + " matching "+ (ask ? "Bid" : "Ask") + " for " + String txt = (matches.isEmpty() ? "No" : ""+matches.size()) + " matching "+ (ask ? "Bid" : "Ask") + " for " + toString(tradable) + "
    "; header.setHTML(txt); header.addStyleName("table-caption"); - + Button close = new Button(matches.isEmpty() ? "OK" : "Cancel"); close.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { @@ -86,7 +86,7 @@ public class MatchWindow extends PopupPanel { body.setWidget(i, 2, FormatUtil.formatVolume(t2.getVolume())); body.setText(i, 3, " by " + cpty.getName()); } - + Button act = new Button(ask ? "Sell" : "Buy"); act.setFocus(true); body.setWidget(matches.size()+1, 1, act); @@ -106,31 +106,31 @@ public class MatchWindow extends PopupPanel { } else { body.setWidget(0,0, new HTML("

    Open a new browser page and login with a different Trader name
    " + "to create a matching " + (ask ? "Bid" : "Ask") + "

    ")); - + close.setFocus(true); body.setWidget(1, 0, close); - body.getFlexCellFormatter().setAlignment(1,0, - HasHorizontalAlignment.ALIGN_CENTER, + body.getFlexCellFormatter().setAlignment(1,0, + HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); } - - + + panel.add(header, DockPanel.NORTH); panel.add(body, DockPanel.CENTER); setWidget(panel); } - + String toString(Tradable t) { - return "" + t.getVolume() + " of " + t.getStock().getSymbol() + " at price " + return "" + t.getVolume() + " of " + t.getStock().getSymbol() + " at price " + FormatUtil.priceFormat.format(t.getPrice()); } - + /** * --------------------------------------------------------------------------------- * Asynchronous RPC service callbacks * --------------------------------------------------------------------------------- */ - + /** * Commits a Trade and notifies the listeners to {@link ServiceEvent.TradableRemoved * remove} the {@link Tradable tradable} and newly {@link ServiceEvent.TradeCommitted committed} @@ -142,7 +142,7 @@ public class MatchWindow extends PopupPanel { */ public class TradeCallback implements AsyncCallback { private final Tradable tradable; - + public TradeCallback(Tradable m) { tradable = m; } @@ -151,7 +151,7 @@ public class MatchWindow extends PopupPanel { } public void onSuccess(Trade trade) { - session.fireEvent(new ServiceEvent.TradableRemoved(tradable)); + session.fireEvent(new ServiceEvent.TradableRemoved(tradable)); session.fireEvent(new ServiceEvent.TradeCommitted(trade)); } } diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/OpenTradeImageBundle.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/OpenTradeImageBundle.java index 02aa0364c..4b5bd3989 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/OpenTradeImageBundle.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/OpenTradeImageBundle.java @@ -24,19 +24,19 @@ import com.google.gwt.resources.client.ImageResource; /** * A bundle of resources (a couple of tiny images for now). However, GWT framework * seems to have generalized and added performance boost to handle heavy resources - * such as images to be loaded from the web server. + * such as images to be loaded from the web server. *
    * This sample application does not explore this feature of GWT, only other than - * applying a singleton pattern. - * + * applying a singleton pattern. + * * @author Pinaki Poddar * */ public interface OpenTradeImageBundle extends ClientBundle { - + @Source("images/login.gif") public ImageResource login(); - + @Source("images/logo.gif") public ImageResource logo(); } diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/OpenTrader.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/OpenTrader.java index 6285ab7f3..a2088c95f 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/OpenTrader.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/OpenTrader.java @@ -51,54 +51,54 @@ import com.google.gwt.user.client.ui.Widget; /** * The GWT module for OpenTrader. - * + * *
    Initialization: * This module entry point acts as the Application Controller. - * It initializes the widget components and lays them out. As it is often the case, some of - * the widgets require initialization data. - * Hence, this entry point establishes connection to remote {@link TradingService} via + * It initializes the widget components and lays them out. As it is often the case, some of + * the widgets require initialization data. + * Hence, this entry point establishes connection to remote {@link TradingService} via * {@link TradingServiceAdapterAsync asynchronous}, client-side, proxy stub. The GWT * framework provides that stub when supplied with the original interface class. *
    * Operation: - * Once initialized, the widgets operate relatively independently throughout the rest of the + * Once initialized, the widgets operate relatively independently throughout the rest of the * operations. Each widget provides a view and invokes server functions (asynchronously via - * RPC) to update the view. + * RPC) to update the view. *
    * Event Management: * The widgets communicate to other widgets via this module entry point i.e. - * if the server callback results from a view action requires to update another view, then the request + * if the server callback results from a view action requires to update another view, then the request * is relayed through this entry point instead of one view calling the other directly. * The GWT framework does provide the core infrastructure for * DOM and user event propagation. This entry point reuses the same infrastructure with - * the application-defined specialized {@link ServiceEvent service events} to represent + * the application-defined specialized {@link ServiceEvent service events} to represent * the business functions such as a new Ask or Bid request is placed, or a Trade - * committed etc. + * committed etc. *
    * Session State Management: One of the core advantages of GWT framework (apart from ease * of development and out-of-the-box cross-browser compatibility), is that GWT allows the client to * maintain its own state, thereby opening up the possibility of state-less (or at least less * stateful and hence more scalable) servers. This client maintains its session state in the * {@link ScrollableTable#getModel() data models} of the core widgets. The only common, - * shared state held by this Application Controller is the logged-in {@link Trader}. - * - * + * shared state held by this Application Controller is the logged-in {@link Trader}. + * + * * @author Pinaki Poddar * */ public class OpenTrader implements EntryPoint, UncaughtExceptionHandler { // Event management private HandlerManager eventBus; - + // The main widget components - private MarketDataPanel stockPanel; // the market prices + private MarketDataPanel stockPanel; // the market prices private TradeOrderWindow orderPanel; // Creates a Ask/Bid request private TradingWindow tradePanel; // Issues a trade order private ScrollableTable soldTradePanel; // displays committed trades private ScrollableTable boughtTradePanel; // displays committed trades private ServerLogPanel serverPanel; // displays server logs - - + + // Server-State variables as Session Identifier private Trader trader; private String _serviceURI; @@ -108,7 +108,7 @@ public class OpenTrader implements EntryPoint, UncaughtExceptionHandler { // Resource bundle for images etc. public static final OpenTradeImageBundle bundle = GWT.create(OpenTradeImageBundle.class); - + /** * ------------------------------------------------------------------------ * The entry point for GWT module. @@ -119,10 +119,10 @@ public class OpenTrader implements EntryPoint, UncaughtExceptionHandler { eventBus = new HandlerManager(this); new LoginDialog(this).center(); } - + /** * Gets the handle to the remote service. The service handle is the asynchronous interface - * but it is created by the GWT framework from the synchronous interface class literal. + * but it is created by the GWT framework from the synchronous interface class literal. */ public TradingServiceAdapterAsync getService() { if (tradingService == null) { @@ -130,21 +130,21 @@ public class OpenTrader implements EntryPoint, UncaughtExceptionHandler { } return tradingService; } - + /** * Gets the name of the trader as the name of this session. */ public String getName() { return trader == null ? "" : trader.getName(); } - + /** * Gets the trader who is running this session. */ public Trader getTrader() { return trader; } - + /** * Gets all the traded stocks traded by the service. * The stocks are maintained by the {@link ScrollableTable#getModel() data model} of @@ -152,26 +152,26 @@ public class OpenTrader implements EntryPoint, UncaughtExceptionHandler { */ public List getTradedStocks() { return stockPanel.getModel(); - } - + } + String getServiceURI() { return _serviceURI; } - + /** * Builds up the widgets once the login is complete i.e. the server has supplied * the initialization data. - * + * */ void init(Trader trader, String uri, List stocks) { this.trader = trader; _serviceURI = uri; - + Window.setTitle(trader.getName()); int W = Window.getClientWidth(); int H = 900;//Window.getClientHeight(); - + int headerHeight = 05*H/100; int westWidth = 25*W/100; int westHeight = 80*H/100; int centerWidth = 60*W/100; int centerHeight = 80*H/100; @@ -183,14 +183,14 @@ public class OpenTrader implements EntryPoint, UncaughtExceptionHandler { for (int i = 0; i < N; i++) { stockPanel.insert(stocks.get(i)); } - + soldTradePanel = new TradeHistoryPanel(this, Ask.class, westWidth-10, 20*westHeight/100); boughtTradePanel = new TradeHistoryPanel(this, Bid.class, westWidth-10, 20*westHeight/100); serverPanel = new ServerLogPanel(this, centerWidth, 40*centerHeight/100); tradePanel = new TradingWindow(this, centerWidth, 40*centerHeight/100); orderPanel = new TradeOrderWindow(this,centerWidth, 10*centerHeight/100); - + FlowPanel west = new FlowPanel(); west.setSize((westWidth-10)+"px", westHeight+"px"); west.add(decorate(stockPanel)); @@ -198,7 +198,7 @@ public class OpenTrader implements EntryPoint, UncaughtExceptionHandler { west.add(decorate(soldTradePanel)); west.add(new HTML("

    ")); west.add(decorate(boughtTradePanel)); - + FlowPanel center = new FlowPanel(); center.setSize(centerWidth+"px", centerHeight+"px"); center.add(decorate(orderPanel)); @@ -206,9 +206,9 @@ public class OpenTrader implements EntryPoint, UncaughtExceptionHandler { center.add(decorate(tradePanel)); center.add(new HTML("

    ")); center.add(decorate(serverPanel)); - + DockLayoutPanel main = new DockLayoutPanel(unit); - + main.addNorth(createHeader(), headerHeight); main.addSouth(createFooter(), footerHeight); main.addWest(west, westWidth); @@ -220,7 +220,7 @@ public class OpenTrader implements EntryPoint, UncaughtExceptionHandler { stockPanel.startStockWatcher(); tradePanel.startTradableRefresher(); } - + /** * Decorates an widget by wrapping in a rounded panel (that seems to be cool thing nowadays). */ @@ -229,10 +229,10 @@ public class OpenTrader implements EntryPoint, UncaughtExceptionHandler { rp.setBorderColor("#005B9A"); return rp; } - + /** * Sets up a help page for each of the main widgets. - * + * * @see ScrollableTable#addHelp(String) */ void setUpHelp() { @@ -243,7 +243,7 @@ public class OpenTrader implements EntryPoint, UncaughtExceptionHandler { boughtTradePanel.addHelp("help/CommittedTrade.html"); serverPanel.addHelp("help/Logging.html"); } - + /** * Creates a header panel. Uses the image resources for a logo and a banner text. */ @@ -256,9 +256,9 @@ public class OpenTrader implements EntryPoint, UncaughtExceptionHandler { panel.add(banner); return panel; } - + /** - * Creates a footer panel. + * Creates a footer panel. */ Widget createFooter() { HorizontalPanel panel = new HorizontalPanel(); @@ -267,7 +267,7 @@ public class OpenTrader implements EntryPoint, UncaughtExceptionHandler { panel.add(footer); return panel; } - + /** * --------------------------------------------------------------------------------- * Error Handling @@ -279,7 +279,7 @@ public class OpenTrader implements EntryPoint, UncaughtExceptionHandler { public void onUncaughtException(Throwable t) { handleError(t); } - + /** * Pops up a modal {@link ErrorDialog error dialog} with the given error. */ @@ -287,31 +287,31 @@ public class OpenTrader implements EntryPoint, UncaughtExceptionHandler { t.printStackTrace(); ErrorDialog.showError(t); } - + /** * --------------------------------------------------------------------------------- * Service Event Handling * --------------------------------------------------------------------------------- */ - + /** * Registers a event with its handler. This mediator pattern facilitates communication * between the component widgets without them being aware of each other. *
    * GWT framework supports this patter out-of-the-box. This application reuses the - * framework for a set of {@link ServiceEvent service events}. + * framework for a set of {@link ServiceEvent service events}. */ public void registerHandler(Type eventType, H handler) { eventBus.addHandler(eventType, handler); } - + /** * Fires a event to the registered handlers. - * - * @param event can be any GwtEvent but used here for specialized {@link ServiceEvent service events}. + * + * @param event can be any GwtEvent but used here for specialized {@link ServiceEvent service events}. */ public void fireEvent(GwtEvent event) { eventBus.fireEvent(event); } - + } diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ServerLogPanel.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ServerLogPanel.java index 6310bad1a..8eab6155b 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ServerLogPanel.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ServerLogPanel.java @@ -44,21 +44,21 @@ import com.google.gwt.user.client.ui.Widget; *

  • sql-update *
  • sql-select *
  • sql-delete - * + * * @author Pinaki Poddar * */ -public class ServerLogPanel extends ScrollableTable - implements AddTradableHandler, RemoveTradableHandler, +public class ServerLogPanel extends ScrollableTable + implements AddTradableHandler, RemoveTradableHandler, AddTradeHandler, UpdateStockHandler { final OpenTrader session; - public static final String[] MARKERS_AND_STYLES = {"SELECT", "INSERT", "UPDATE", "DELETE"}; - - + public static final String[] MARKERS_AND_STYLES = {"SELECT", "INSERT", "UPDATE", "DELETE"}; + + public ServerLogPanel(final OpenTrader session, final int w, final int h) { super("Server Log (" + session.getServiceURI() + ")", w,h, false); this.session = session; - + session.registerHandler(ServiceEvent.TradableAdded.TYPE, this); session.registerHandler(ServiceEvent.TradableRemoved.TYPE, this); session.registerHandler(ServiceEvent.TradeCommitted.TYPE, this); @@ -66,7 +66,7 @@ public class ServerLogPanel extends ScrollableTable setColumnHeader(0, "Context", "10%"); setColumnHeader(1, "Message", "90%"); - + setRenderer(0, new GridCellRenderer() { public Widget render(LogStatement log) { return new Label(log.getContext()); @@ -78,7 +78,7 @@ public class ServerLogPanel extends ScrollableTable } }); } - + HTML decorate(String s, String[] markersAndStyles) { HTML html = new HTML(s); String style = getStyle(s, MARKERS_AND_STYLES); @@ -86,7 +86,7 @@ public class ServerLogPanel extends ScrollableTable html.addStyleName(style); return html; } - + static String getStyle(String s, String[] markersAndStyles) { String style = null; for (int i = 0; i < markersAndStyles.length; i++) { @@ -103,7 +103,7 @@ public class ServerLogPanel extends ScrollableTable } return null; } - + private void log() { session.getService().getLog(new LoggingCallback()); } @@ -111,7 +111,7 @@ public class ServerLogPanel extends ScrollableTable /** * --------------------------------------------------------------------------------- * Service Event Response Management - * + * * This widget receives all service event update and logs the corresponding server * logs. * --------------------------------------------------------------------------------- @@ -131,16 +131,16 @@ public class ServerLogPanel extends ScrollableTable public void onStockUpdated(ServiceEvent.StockUpdated event) { log(); } - + /** * --------------------------------------------------------------------------------- * Asynchronous RPC service callbacks * --------------------------------------------------------------------------------- */ - + /** * Unlike other callbacks, this callback on completion does not broadcast the log messages. - * Instead it simply inserts the message in its own tabular display. + * Instead it simply inserts the message in its own tabular display. */ public class LoggingCallback implements AsyncCallback> { public void onFailure(Throwable caught) { diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradeHistoryPanel.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradeHistoryPanel.java index 015208961..52ee6d8f9 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradeHistoryPanel.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradeHistoryPanel.java @@ -36,54 +36,54 @@ import com.google.gwt.user.client.ui.Widget; * One of the core component widgets to display the committed trades. * The panel is configured for either {@link Ask} or {@link Bid} and * accordingly it adjusts some of its labels or contents. - * + * * @author Pinaki Poddar * */ -public class TradeHistoryPanel extends ScrollableTable +public class TradeHistoryPanel extends ScrollableTable implements ServiceEventHandler.AddTradeHandler { - + private final OpenTrader session; private final Class _type; - - public TradeHistoryPanel(final OpenTrader session, Class type, + + public TradeHistoryPanel(final OpenTrader session, Class type, final int w, final int h) { super("Stocks " + (type == Ask.class ? "sold" : "bought") + " by " + session.getName(), w,h, true); this.session = session; this._type = type; - + session.registerHandler(ServiceEvent.TradeCommitted.TYPE, this); - + setColumnHeader(0, "Stock", "20%"); setColumnHeader(1, "Price", "20%"); setColumnHeader(2, "Volume", "20%"); setColumnHeader(3, type == Ask.class ? "Buyer" : "Seller", "40%"); - + // Stock symbol setRenderer(0, new GridCellRenderer() { public Widget render(Trade model) { return new Label(model.getStock().getSymbol()); } }); - + // Price of the trade setRenderer(1, new GridCellRenderer() { public Widget render(Trade t) { return FormatUtil.formatPrice(t.getPrice()); } }); - + // Volume of the trade setRenderer(2, new GridCellRenderer() { public Widget render(Trade t) { return FormatUtil.formatVolume(t.getVolume()); } }); - + // Counter Party setRenderer(3, new GridCellRenderer() { public Widget render(Trade t) { - Trader cpty = session.getTrader().equals(t.getBuyer()) ? t.getSeller() : t.getBuyer(); + Trader cpty = session.getTrader().equals(t.getBuyer()) ? t.getSeller() : t.getBuyer(); return new Label(cpty.getName()); } }); @@ -94,17 +94,17 @@ public class TradeHistoryPanel extends ScrollableTable * Service Event Response Management * --------------------------------------------------------------------------------- */ - + /** * On receipt of the event determines if it is relevant for this instance. * Because an instance display either the Trades sold or bought. - * If relevant then updates the display. + * If relevant then updates the display. */ public void onTradeCommitted(ServiceEvent.TradeCommitted event) { Trader trader = session.getTrader(); Trade trade = event.getPayload(); - if ((trader.equals(trade.getSeller()) && _type == Ask.class) - || (trader.equals(trade.getBuyer()) && _type == Bid.class)) { + if ((trader.equals(trade.getSeller()) && _type == Ask.class) + || (trader.equals(trade.getBuyer()) && _type == Bid.class)) { insert(trade); } } diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradeOrderWindow.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradeOrderWindow.java index ae7b447a8..c93a1eb2b 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradeOrderWindow.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradeOrderWindow.java @@ -45,7 +45,7 @@ import com.google.gwt.user.client.ui.TextBox; /** * This Widget allows the user to enter the details of a trade order (an Ask or - * Bid) and call the {@link TradingServiceAdapterAsync Trading Service} via asynchronous RPC + * Bid) and call the {@link TradingServiceAdapterAsync Trading Service} via asynchronous RPC * callback to record the order. *
    * The widget demonstrates the aspect where a displayed element can change either @@ -54,11 +54,11 @@ import com.google.gwt.user.client.ui.TextBox; * change as the user enters a different price. It can also change if the market * price of the stock has changed externally. The former changes are handled by adding * event handlers to the widget elements (such as onKeyUp in a text box), the later - * changes are notified by this widget registering to the {@link OpenTrader main application}. - * - * + * changes are notified by this widget registering to the {@link OpenTrader main application}. + * + * * @author Pinaki Poddar - * + * */ class TradeOrderWindow extends FlexTable implements UpdateStockHandler { private final OpenTrader session; @@ -79,7 +79,7 @@ class TradeOrderWindow extends FlexTable implements UpdateStockHandler { setStyleName("TradeOrderWindow"); session.registerHandler(ServiceEvent.StockUpdated.TYPE, this); - + marketPrice.setReadOnly(true); margin.setReadOnly(true); gain.setReadOnly(true); @@ -150,7 +150,7 @@ class TradeOrderWindow extends FlexTable implements UpdateStockHandler { gain.setText(FormatUtil.changeFormat.format(diff * volume)); } }); - + List stocks = session.getTradedStocks(); int n = stocks.size(); for (int i = 0; i < n; i++) { @@ -171,10 +171,10 @@ class TradeOrderWindow extends FlexTable implements UpdateStockHandler { public void onClick(ClickEvent ce) { if (!validateData()) return; - session.getService().ask(session.getTrader(), - getSelectedStock(), + session.getService().ask(session.getTrader(), + getSelectedStock(), Integer.parseInt(userVolume.getText()), - Double.parseDouble(userPrice.getText()), + Double.parseDouble(userPrice.getText()), new AskCallback()); } }); @@ -183,10 +183,10 @@ class TradeOrderWindow extends FlexTable implements UpdateStockHandler { public void onClick(ClickEvent ce) { if (!validateData()) return; - session.getService().bid(session.getTrader(), - getSelectedStock(), + session.getService().bid(session.getTrader(), + getSelectedStock(), Integer.parseInt(userVolume.getText()), - Double.parseDouble(userPrice.getText()), + Double.parseDouble(userPrice.getText()), new BidCallback()); } }); @@ -196,8 +196,8 @@ class TradeOrderWindow extends FlexTable implements UpdateStockHandler { /** * Sets the content of the widgets based on the given stock. The widget * content depends on the current stock price as well as user entered - * values. - * + * values. + * * @param stock * @param retainUserValue */ @@ -214,11 +214,11 @@ class TradeOrderWindow extends FlexTable implements UpdateStockHandler { gain.setText(FormatUtil.priceFormat.format(0)); } } - + public void addHelp(final String url) { HelpLink help = new HelpLink(url); setWidget(0, 6, help); - getCellFormatter().setAlignment(0, 6, + getCellFormatter().setAlignment(0, 6, HasHorizontalAlignment.ALIGN_RIGHT, HasVerticalAlignment.ALIGN_MIDDLE); } @@ -251,7 +251,7 @@ class TradeOrderWindow extends FlexTable implements UpdateStockHandler { double calculateDiff(double p1, double p2) { return truncate(Math.abs(p1-p2)); } - + private static double truncate (double x){ double fract; double whole; @@ -264,8 +264,8 @@ class TradeOrderWindow extends FlexTable implements UpdateStockHandler { } return whole + fract; } - - + + /** * --------------------------------------------------------------------------------- * Service Event Response Management @@ -278,22 +278,22 @@ class TradeOrderWindow extends FlexTable implements UpdateStockHandler { initialize(updated, true); } } - + /** * --------------------------------------------------------------------------------- * Asynchronous RPC service callbacks * --------------------------------------------------------------------------------- */ - + /** * Updates display once the offer to sell has been successfully placed. - * + * */ class AskCallback implements AsyncCallback { public void onSuccess(Ask result) { session.fireEvent(new ServiceEvent.TradableAdded(result)); } - + public void onFailure(Throwable caught) { session.handleError(caught); } @@ -301,13 +301,13 @@ class TradeOrderWindow extends FlexTable implements UpdateStockHandler { /** * Updates display once the offer to buy has been successfully placed. - * + * */ class BidCallback implements AsyncCallback { public void onSuccess(Bid result) { session.fireEvent(new ServiceEvent.TradableAdded(result)); } - + public void onFailure(Throwable caught) { session.handleError(caught); } diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradingServiceAdapter.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradingServiceAdapter.java index 47734f834..471a06ceb 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradingServiceAdapter.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradingServiceAdapter.java @@ -38,31 +38,31 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; *
    * This is a delegating interface to the original {@link TradingService} interface. This delegation * pattern serves several purposes - *
  • a) the delegator adds RuntimeException to each of the original service methods. - * The original {@link TradingService} has not defined the exception in its method signature, + *
  • a) the delegator adds RuntimeException to each of the original service methods. + * The original {@link TradingService} has not defined the exception in its method signature, * However, the actual implementation of {@link TradingService} is based on * JPA and hence will throw javax.persistence.PersistenceException. To propagate - * these exceptions to the client, these exceptions need to be translated for serialization by - * GWT compiler and will bring in heavier dependency. + * these exceptions to the client, these exceptions need to be translated for serialization by + * GWT compiler and will bring in heavier dependency. *
    * On the other hand, GWT will not propagate a non-translatable exception to the client, * thereby making develop-debug cycles harder. - *
  • b) GWT requires the service interface to extend GWT-defined + *
  • b) GWT requires the service interface to extend GWT-defined * com.google.gwt.user.client.rpc.RemoteService. But the discipline used for this * application dictates that the service interface be independent of either * how it is implemented or how it will be accessed. That is why original {@link TradingService} * definition neither depends on javax.persistence.* nor on com.google.gwt.*. *

    - * Because the interface is delegated, it is not necessary to have the same method name or + * Because the interface is delegated, it is not necessary to have the same method name or * even signature. It may not have to declare all the original service interface methods either. *

    - * + * * Any type appearing in this interface must be serializable per GWT requirement. */ /** * This @RemoteServiceRelativePath annotation defines the relative URL of the - * deployed servlet. It appears in web.xml as: + * deployed servlet. It appears in web.xml as: *

      *  <servlet-mapping>
      *       <servlet-name>opentrader</servlet-name>
    @@ -77,31 +77,31 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
      */
     @RemoteServiceRelativePath("trade")
     public interface TradingServiceAdapter extends RemoteService {
    -    Trader login(String name) 
    +    Trader login(String name)
                throws RuntimeException;
    -    List getStocks()   
    +    List getStocks()
                throws RuntimeException;
    -    Ask ask(Trader trader, Stock stock, int volume, double price) 
    +    Ask ask(Trader trader, Stock stock, int volume, double price)
                throws RuntimeException;
    -    Bid bid(Trader trader, Stock stock, int volume, double price) 
    +    Bid bid(Trader trader, Stock stock, int volume, double price)
                throws RuntimeException;
    -    Tradable withdraw(Tradable t) 
    +    Tradable withdraw(Tradable t)
                throws RuntimeException;
    -    Tradable refresh(Tradable t)  
    +    Tradable refresh(Tradable t)
                throws RuntimeException;
    -    List matchBid(Bid bid) 
    +    List matchBid(Bid bid)
                throws RuntimeException;
    -    List matchAsk(Ask ask) 
    +    List matchAsk(Ask ask)
                throws RuntimeException;
    -    Trade trade(Match match)      
    +    Trade trade(Match match)
                throws RuntimeException;
    -    List getTrades(Timestamp from, Timestamp to) 
    +    List getTrades(Timestamp from, Timestamp to)
                throws RuntimeException;
    -    List getTrades(Trader trader, Boolean boughtOrsold, Timestamp from, Timestamp to) 
    +    List getTrades(Trader trader, Boolean boughtOrsold, Timestamp from, Timestamp to)
                throws RuntimeException;
    -    Stock getStock(String symbol) 
    +    Stock getStock(String symbol)
                throws RuntimeException;
    -    List getLog() 
    +    List getLog()
                throws RuntimeException;
         String getServiceURI()
         		throws RuntimeException;
    diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradingServiceAdapterAsync.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradingServiceAdapterAsync.java
    index d84ceadb6..c24bbbff0 100644
    --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradingServiceAdapterAsync.java
    +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradingServiceAdapterAsync.java
    @@ -34,9 +34,9 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
     
     /**
      * The asynchronous counterpart of the interface.
    - * The equivalence between this asynchronous interface and its {@link TradingServiceAdapter 
    + * The equivalence between this asynchronous interface and its {@link TradingServiceAdapter
      * synchronous version} is validated during GWT compilation.
    - * 
    + *
      * @author Pinaki Poddar
      *
      */
    @@ -62,12 +62,12 @@ public interface TradingServiceAdapterAsync {
         void matchBid(Bid bid, AsyncCallback> callback);
     
         void trade(Match match, AsyncCallback callback);
    -    
    +
         void getLog(AsyncCallback> callback);
     
         void withdraw(Tradable t, AsyncCallback callback);
    -    
    +
         void refresh(Tradable t, AsyncCallback callback);
    -    
    +
         void getServiceURI(AsyncCallback callback);
     }
    diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradingWindow.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradingWindow.java
    index f22b38dc2..d0c10ab5a 100644
    --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradingWindow.java
    +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/TradingWindow.java
    @@ -42,25 +42,25 @@ import com.google.gwt.user.client.ui.Widget;
     /**
      * Trading Window allows the user to buy/sell a {@link Tradable tradable} or withdraw it.
      * 
    - * This widget demonstrates combination of both read-only and updatable visual elements + * This widget demonstrates combination of both read-only and updatable visual elements * as well as active widgets such as a button. *
    * Both the user actions (such as when a tradable is withdrawn) or other events such - * as a Stock price change changes the expected gain/loss of a tradable, + * as a Stock price change changes the expected gain/loss of a tradable, *
    * The complexity arises from the fact that a displayed tradable may have been consumed * by a matching tradable in another session. A tradable undergoes a state transition when * it is traded. Thus the displayed tradable can be an inconsistent state than its original * state in the server. Though all the displayed tradables are periodically refreshed, the - * latency still exists. - * - * + * latency still exists. + * + * * @author Pinaki Poddar * */ -public class TradingWindow extends ScrollableTable +public class TradingWindow extends ScrollableTable implements ServiceEventHandler.AddTradableHandler, - ServiceEventHandler.RemoveTradableHandler, + ServiceEventHandler.RemoveTradableHandler, ServiceEventHandler.UpdateStockHandler { private final OpenTrader session; private Timer refreshTimer; @@ -246,7 +246,7 @@ public class TradingWindow extends ScrollableTable session.fireEvent(new ServiceEvent.TradeCommitted(result.getTrade())); } } - + @Override public void onFailure(Throwable t) { session.handleError(t); diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/event/ServiceEvent.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/event/ServiceEvent.java index e479639d4..a0edfd15a 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/event/ServiceEvent.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/event/ServiceEvent.java @@ -29,13 +29,13 @@ import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.GwtEvent.Type; /** - * Specialization of GWTEvent (that represent mouse/keybord events and DOM events) + * Specialization of GWTEvent (that represent mouse/keybord events and DOM events) * for service related events such as a new trade has been committed or a tradable * is consumed. Each service event carries a payload and one or more handlers can - * register interest in that event via the - * {@link OpenTrader#registerHandler(com.google.gwt.event.shared.GwtEvent.Type, EventHandler) + * register interest in that event via the + * {@link OpenTrader#registerHandler(com.google.gwt.event.shared.GwtEvent.Type, EventHandler) * application controller}. - * + * * @author Pinaki Poddar * * @param @@ -53,7 +53,7 @@ public abstract class ServiceEvent extends GwtEvent { - public static Type TYPE = + public static Type TYPE = new Type(); public TradableAdded(Tradable tradable) { @@ -73,7 +73,7 @@ public abstract class ServiceEvent extends GwtEvent { - public static Type TYPE = + public static Type TYPE = new Type(); public TradableRemoved(Tradable tradable) { @@ -109,9 +109,9 @@ public abstract class ServiceEvent extends GwtEvent { - public static Type TYPE = + public static Type TYPE = new Type(); public TradeCommitted(Trade trade) { diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/event/ServiceEventHandler.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/event/ServiceEventHandler.java index b6385d655..47a7608b4 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/event/ServiceEventHandler.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/event/ServiceEventHandler.java @@ -22,8 +22,8 @@ import com.google.gwt.event.shared.EventHandler; /** * The contract to handle {@link ServiceEvent service events}. - * - * + * + * * @author Pinaki Poddar * */ @@ -32,15 +32,15 @@ public interface ServiceEventHandler { public interface AddTradableHandler extends EventHandler { public void onTradableAdded(ServiceEvent.TradableAdded event); } - + public static interface AddTradeHandler extends EventHandler { public void onTradeCommitted(ServiceEvent.TradeCommitted event); } - + public static interface RemoveTradableHandler extends EventHandler { public void onTradableRemoved(ServiceEvent.TradableRemoved event); } - + public static interface UpdateStockHandler extends EventHandler { public void onStockUpdated(ServiceEvent.StockUpdated event); } diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/ErrorDialog.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/ErrorDialog.java index b6f6ff763..ff46e8052 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/ErrorDialog.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/ErrorDialog.java @@ -37,7 +37,7 @@ import com.google.gwt.user.client.ui.TreeItem; * CSS Style names *
  • errorDialog-caption: *
  • errorDialog-message: - * + * * @author Pinaki Poddar * */ @@ -49,16 +49,16 @@ public class ErrorDialog extends PopupPanel { private static ErrorDialog _instance = new ErrorDialog(); private static final String STYLE_CAPTION = "errorDialog-caption"; private static final String STYLE_MESSAGE = "errorDialog-message"; - + private ErrorDialog() { super(false, true); setAnimationEnabled(true); setGlassEnabled(true); setVisible(false); - + header = new HTML(); header.addStyleName(STYLE_CAPTION); - + close = new Button("x"); close.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { @@ -70,7 +70,7 @@ public class ErrorDialog extends PopupPanel { scroll.setSize("600px", "200px"); scroll.add(tree); DOM.setStyleAttribute(scroll.getElement(), "border", "1px"); - + table = new FlexTable(); table.setWidget(0, 0, header); table.setWidget(0, 1, close); @@ -79,18 +79,18 @@ public class ErrorDialog extends PopupPanel { table.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT); setWidget(table); } - + public static void showError(Throwable t) { _instance.populate(t); _instance.center(); } - + private void populate(Throwable t) { header.setHTML(t.getClass().getName()); tree.clear(); tree = addStackTrace(t); } - + private Tree addStackTrace(Throwable t) { TreeItem root = new TreeItem(t.getClass().getName()); root.addItem(createMessageLabel(t)); @@ -105,13 +105,13 @@ public class ErrorDialog extends PopupPanel { } return addStackTrace(cause); } - + Label createMessageLabel(Throwable t) { HTML label = new HTML(t.getMessage()); label.addStyleName(STYLE_MESSAGE); return label; } - + Label createStackTrace(StackTraceElement trace) { HTML label = new HTML(trace.toString()); label.addStyleName(STYLE_MESSAGE); diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/FadeEffect.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/FadeEffect.java index 26b3e9118..fc76cc191 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/FadeEffect.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/FadeEffect.java @@ -25,7 +25,7 @@ import com.google.gwt.user.client.ui.Widget; /** * Fun stuff to fade-in, fade-out a changing label. - * + * * @author Pinaki Poddar * */ @@ -52,7 +52,7 @@ public class FadeEffect extends Timer { cancel(); } } - + boolean ended() { if (sign == -1) { return opacity <= 0.0; diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/GridCellRenderer.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/GridCellRenderer.java index 3d8d9d119..6a526c022 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/GridCellRenderer.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/GridCellRenderer.java @@ -22,7 +22,7 @@ import com.google.gwt.user.client.ui.Widget; /** * Protocol to render a Grid Cell. - * + * * @author Pinaki Poddar * * @param @@ -30,7 +30,7 @@ import com.google.gwt.user.client.ui.Widget; public interface GridCellRenderer { /** * Create an widget for the part of data this render is rendering. - * + * * @param data the entire data represented in this row. * @return a widget such as a Label or HTML to represent a part of the data. */ diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/HelpLink.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/HelpLink.java index b5cfc22dc..e71be0493 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/HelpLink.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/HelpLink.java @@ -29,14 +29,14 @@ import com.google.gwt.user.client.ui.VerticalPanel; /** * An anchor that pops up a min-browser with some hopefully helpful text. - * + * * @author Pinaki Poddar * */ public class HelpLink extends Anchor implements ClickHandler { private final String url; - private static HelpWindow window; - + private static HelpWindow window; + public HelpLink(String url) { super("Help", url, "Help"); this.url = url; @@ -46,26 +46,26 @@ public class HelpLink extends Anchor implements ClickHandler { } addStyleName("help"); } - + @Override public void onClick(ClickEvent event) { window.showHelp(url); event.preventDefault(); } - - + + public class HelpWindow extends PopupPanel implements PopupPanel.PositionCallback { private final Frame frame; - - + + public HelpWindow() { super(true); setAnimationEnabled(true); setAutoHideEnabled(true); setModal(false); - + VerticalPanel panel = new VerticalPanel(); - + frame = new Frame(); frame.setPixelSize(400, 300); Button close = new Button("close"); @@ -79,12 +79,12 @@ public class HelpLink extends Anchor implements ClickHandler { setWidget(panel); setVisible(true); } - + public void showHelp(String url) { frame.setUrl(url); super.setPopupPositionAndShow(this); } - + public void setPosition(int offsetWidth, int offsetHeight) { int left = Window.getClientWidth() - getWidget().getOffsetWidth() - 100; int top = 40; diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/MessageBox.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/MessageBox.java index ca87df577..41b6022b2 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/MessageBox.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/MessageBox.java @@ -30,30 +30,30 @@ import com.google.gwt.user.client.ui.PopupPanel; * A non-modal, pop-up message box. *
    * CSS Styles: - *
  • messageBox + *
  • messageBox *
  • messageBox-content - *
  • messageBox-caption + *
  • messageBox-caption *
  • - * The + * The * @author Pinaki Poddar * */ public class MessageBox extends PopupPanel { private static MessageBox _popup = new MessageBox(); - + private final HTML header; private final Label message; private MessageBox() { super(false, true); setAnimationEnabled(true); - + DockPanel panel = new DockPanel(); panel.setStyleName("messageBox"); panel.setHorizontalAlignment(DockPanel.ALIGN_CENTER); header = new HTML(); header.addStyleName("messageBox-caption"); - + Button close = new Button("OK"); close.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { @@ -62,21 +62,21 @@ public class MessageBox extends PopupPanel { }); close.setEnabled(true); close.setFocus(true); - + message = new Label(); message.addStyleName("messageBox-content"); - + panel.add(header, DockPanel.NORTH); panel.add(close, DockPanel.SOUTH); panel.add(message, DockPanel.CENTER); - + setWidget(panel); } - + public static void alert(String message) { alert("Alert", message); } - + public static void alert(String header, String message) { _popup.header.setText(message); _popup.message.setText(message); diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/ProgressMonitor.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/ProgressMonitor.java index ffca868f4..35ef19bb1 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/ProgressMonitor.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/ProgressMonitor.java @@ -44,15 +44,15 @@ public class ProgressMonitor extends Timer { private final int N = 10; private final PopupPanel popup; private final static ProgressMonitor _instance = new ProgressMonitor(); - + private ProgressMonitor() { popup = new PopupPanel(); popup.addStyleName("progressMonitor"); - - + + header = new HTML(); bar = new FlexTable(); - + bar.setCellSpacing(0); bar.setCellPadding(0); bar.setWidget(0, 0, header); @@ -65,7 +65,7 @@ public class ProgressMonitor extends Timer { bar.setWidget(1, i, box); } bar.getFlexCellFormatter().setColSpan(0, 0, N); - + popup.add(bar); } @@ -75,12 +75,12 @@ public class ProgressMonitor extends Timer { _instance.scheduleRepeating(10); _instance.run(); } - + public static void stop() { _instance.cancel(); _instance.popup.hide(); } - + @Override public void run() { Element elem = bar.getWidget(1, current).getElement(); diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/ScrollableTable.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/ScrollableTable.java index 4d694f73b..778915210 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/ScrollableTable.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/client/ui/ScrollableTable.java @@ -33,8 +33,8 @@ import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; /** - * A composite widget combines a data table, a table header, a scrollbar, - * and a caption and a {@link HelpLink help anchor}. + * A composite widget combines a data table, a table header, a scrollbar, + * and a caption and a {@link HelpLink help anchor}. *
    * Each row of the data table displays an instance of type T. How the instance * is displayed in controlled by a set of {@link GridCellRenderer renderers} @@ -45,8 +45,8 @@ import com.google.gwt.user.client.ui.Widget; *
  • column-header : for the column headers *
  • row-odd : for odd numbered rows *
  • row-even : for even numbered rows - * - * + * + * * @author Pinaki Poddar * * @param the type of data being displayed. @@ -59,17 +59,17 @@ public class ScrollableTable extends Composite { private List> _renderers; private List _rows; private boolean _stripeRows; - + private static final String STYLE_CAPTION = "table-caption"; private static final String STYLE_HEADER = "column-header"; private static final String STYLE_MAIN = "table"; private static final String ROW_EVEN = "row-even"; private static final String ROW_ODD = "row-odd"; - + /** * Create a scrollable table with the given caption and given pixel dimension. * The table will not be backed by a data storage model. - * + * * @param caption of the table * @param w width in pixel * @param h height in pixel @@ -77,11 +77,11 @@ public class ScrollableTable extends Composite { public ScrollableTable(String caption, int w, int h) { this(caption, w+"px", h+"px", false); } - + /** * Create a scrollable table with the given caption and given pixel dimension. * The table will not be backed by a data storage model. - * + * * @param caption of the table * @param w width in pixel * @param h height in pixel @@ -91,10 +91,10 @@ public class ScrollableTable extends Composite { public ScrollableTable(String caption, int w, int h, boolean updatable) { this(caption, w+"px", h+"px", updatable); } - + /** * Create a scrollable table with the given caption and given dimension. - * + * * @param caption of the table * @param w width in given unit * @param h height in given unit @@ -104,61 +104,61 @@ public class ScrollableTable extends Composite { public ScrollableTable(String caption, String w, String h, boolean updatable) { super(); _renderers = new ArrayList>(); - + VerticalPanel vert = new VerticalPanel(); vert.setSpacing(0); - + _caption = new Grid(1,2); _caption.setWidth("100%"); setCaption(caption); vert.add(_caption); - - + + _header = new FlexTable(); _header.addStyleName(STYLE_HEADER); _header.setWidth("100%"); - + _main = new FlexTable(); _main.addStyleName(STYLE_MAIN); - + _main.setWidth("100%"); _main.setBorderWidth(0); _scroll = new ScrollPanel(); _scroll.setSize(w, h); _scroll.setAlwaysShowScrollBars(true); _scroll.add(_main); - - + + vert.add(_header); vert.add(_scroll); if (updatable) { _rows = new ArrayList(); } - + initWidget(vert); } - + @SuppressWarnings("unchecked") public List getModel() { return _rows == null ? Collections.EMPTY_LIST : Collections.unmodifiableList(_rows); } - + public void setCaption(String str) { HTML caption = new HTML(str); caption.addStyleName(STYLE_CAPTION); _caption.setWidget(0, 0, caption); } - + public void setSize(int w, int h) { int dh = 0; if (_caption != null) { - dh += _caption.getOffsetHeight(); + dh += _caption.getOffsetHeight(); } dh += _header.getOffsetHeight(); _scroll.setPixelSize(w, h-dh); } - - + + public void setRenderer(int column, GridCellRenderer r) { if (column > _renderers.size()) { for (int i = _renderers.size(); i <= column; i++) { @@ -171,26 +171,26 @@ public class ScrollableTable extends Composite { _renderers.set(column, r); } } - + public void setColumnHeader(int column, String txt, String width) { HTML header = new HTML(txt); header.addStyleName(STYLE_HEADER); _header.setWidget(0, column, header); _main.getColumnFormatter().setWidth(column, width); } - + public void setStripeRows(boolean stripe) { _stripeRows = stripe; } - + public boolean isStripeRows() { return _stripeRows; } - + public void insert(T data) { setRow(_main.getRowCount(), data, null); } - + public void remove(T data) { int i = findRow(data); if (i != -1) { @@ -198,7 +198,7 @@ public class ScrollableTable extends Composite { _rows.remove(i); } } - + /** * Update entire row. */ @@ -210,7 +210,7 @@ public class ScrollableTable extends Composite { insert(data); } } - + public void updateCell(int row, int column, Widget widget, boolean animate) { if (animate) { FadeEffect fadeOut = new FadeEffect(_main.getWidget(row, column), false); @@ -223,14 +223,14 @@ public class ScrollableTable extends Composite { _main.setWidget(row, column, widget); } } - + public int getRowCount() { return _main.getRowCount(); } - + /** * Sets the cells of an existing row. - * Calls each renderer. + * Calls each renderer. * @param row * @param data */ @@ -238,7 +238,7 @@ public class ScrollableTable extends Composite { if (_rows != null) { if (row < 0 || row >= _rows.size()) _rows.add(data); - else + else _rows.set(row, data); } for (int i = 0; i < _renderers.size(); i++) { @@ -256,14 +256,14 @@ public class ScrollableTable extends Composite { } _scroll.scrollToBottom(); } - + public int findRow(T data) { - + if (_rows == null || data == null) return -1; return _rows.indexOf(data); } - + private boolean containsColumn(Integer[] columns, int i) { if (columns == null) return true; @@ -273,17 +273,17 @@ public class ScrollableTable extends Composite { } return false; } - + public T get(int i) { if (_rows == null || i < 0 || i >= _rows.size()) return null; return _rows.get(i); } - + public void scrollToBottom() { _scroll.scrollToBottom(); } - + public void addHelp(final String url) { if (_caption == null) { return; @@ -293,6 +293,6 @@ public class ScrollableTable extends Composite { _caption.setWidget(0, 1, help); _caption.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT); } - - + + } diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Ask.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Ask.java index 7a16b2de1..1d8c9a654 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Ask.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Ask.java @@ -26,7 +26,7 @@ import javax.persistence.ManyToOne; * An offer to sell a financial instrument. * The only mutable state of an offer is its expiration. * But that state is also mutable only once and is not reversible. - * + * * @author Pinaki Poddar * */ @@ -40,18 +40,18 @@ public class Ask extends Tradable { */ @ManyToOne(cascade={CascadeType.MERGE,CascadeType.DETACH},optional=false) private Trader seller; - + /** - * A no-arg constructor to comply to both GWT compiler and OpenJPA + * A no-arg constructor to comply to both GWT compiler and OpenJPA * bytecode enhancer. */ protected Ask() { super(); } - + /** * Real constructor populates the essential properties. - * + * * @param trader the trader who made this offer. Must not be null. * @param stock the underlying instrument. Must not be null. * @param price the offered price to sell. Must be positive. @@ -66,14 +66,14 @@ public class Ask extends Tradable { /** * Gets the trader who made this offer to sell. - * + * * @return the trader who made this offer. Never null. */ public Trader getSeller() { return seller; } - + public double getGain() { - return (getPrice() - getStock().getMarketPrice())*getVolume(); + return (getPrice() - getStock().getMarketPrice())*getVolume(); } } diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Bid.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Bid.java index 0f25aa53a..9660e2250 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Bid.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Bid.java @@ -25,7 +25,7 @@ import javax.persistence.ManyToOne; * An offer to buy a financial instrument. * The only mutable state of an offer is its expiration. * But that state is also mutable only once and is not reversible. - * + * * @author Pinaki Poddar * */ @@ -39,18 +39,18 @@ public class Bid extends Tradable { */ @ManyToOne(cascade={CascadeType.MERGE,CascadeType.DETACH},optional=false) private Trader buyer; - + /** - * A no-arg constructor to comply to both GWT compiler and OpenJPA + * A no-arg constructor to comply to both GWT compiler and OpenJPA * bytecode enhancer. */ protected Bid() { super(); } - + /** * Real constructor populates the essential properties. - * + * * @param trader the trader who made this offer. Must not be null. * @param stock the underlying instrument. Must not be null. * @param price the offered price to buy. Must be positive. @@ -62,18 +62,18 @@ public class Bid extends Tradable { throw new NullPointerException("Can not create Bid with null trader"); this.buyer = trader; } - + /** * Gets the trader who made this offer. - * + * * @return the trader who made this offer. Never null. */ public Trader getBuyer() { return buyer; - } - + } + public double getGain() { - return (getStock().getMarketPrice() - getPrice())*getVolume(); + return (getStock().getMarketPrice() - getPrice())*getVolume(); } } diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/LogStatement.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/LogStatement.java index 4b653105d..916f36ed9 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/LogStatement.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/LogStatement.java @@ -27,11 +27,11 @@ public class LogStatement implements Serializable { private String thread; private String channel; private String message; - + protected LogStatement() { - + } - + public LogStatement(String level, String context, String thread, String channel, String message) { super(); this.level = level; @@ -60,7 +60,7 @@ public class LogStatement implements Serializable { public String getMessage() { return message; } - + public String toString() { return level + " [" + context + "] [" + thread + "] [" + channel + "] :" + message; } diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Match.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Match.java index 7894b186f..043b5c1c8 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Match.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Match.java @@ -22,9 +22,9 @@ import java.io.Serializable; /** * A pair of matching offer to {@linkplain Bid buy} and {@linkplain Ask sell}. - * This is not a persistent entity. But it is in the persistent domain + * This is not a persistent entity. But it is in the persistent domain * because it is often is the result of query. - * + * * @author Pinaki Poddar * */ @@ -32,13 +32,13 @@ import java.io.Serializable; public class Match implements Serializable { private Ask ask; private Bid bid; - + /** * A no-arg constructor to comply to GWT compiler. */ protected Match() { } - + /** * Constructs a pair with matching offers. * @param a the offer to sell. Must not be null. @@ -50,7 +50,7 @@ public class Match implements Serializable { if (b == null) throw new NullPointerException("Can not create Match with null Bid"); if (a.getSeller().equals(b.getBuyer())) { - throw new NullPointerException("Can not create Match with same Trader " + throw new NullPointerException("Can not create Match with same Trader " + a.getSeller() + " for Ask and Bid"); } if (a.getPrice() > b.getPrice()) { @@ -60,26 +60,26 @@ public class Match implements Serializable { ask = a; bid = b; } - + /** - * Gets the matching offer to sell. - * - * @return the matching offer to sell. Never null. + * Gets the matching offer to sell. + * + * @return the matching offer to sell. Never null. */ public Ask getAsk() { return ask; } - + /** * Gets the matching offer to buy. - * - * @return the matching offer to buy. Never null. + * + * @return the matching offer to buy. Never null. */ public Bid getBid() { return bid; } - - + + public String toString() { return "Match ["+ ask + " and " + bid + "]"; } diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Sector.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Sector.java index 55d27adc0..73502e5a8 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Sector.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Sector.java @@ -20,7 +20,7 @@ package org.apache.openjpa.trader.domain; /** * Designates the business sector of a financial instrument. - * + * * @author Pinaki Poddar * */ diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Stock.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Stock.java index 00f1ebcaa..667224382 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Stock.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Stock.java @@ -26,8 +26,8 @@ import javax.persistence.Id; /** * A stock is a typical financial instrument that is bought and sold by {@linkplain Trader}. - * A stock is mostly an immutable entity, except its price. - * + * A stock is mostly an immutable entity, except its price. + * * @author Pinaki Poddar * */ @@ -37,32 +37,32 @@ public class Stock implements Serializable { /** * The primary identity of a Stock. * The uniqueness of the primary keys are often warranted by the persistence provider. - * In this case, unique of a Stock symbol is ensured by an external agency. + * In this case, unique of a Stock symbol is ensured by an external agency. */ @Id private String symbol; - + /** * The name of the company represented by this financial instrument. */ private String company; - + private Sector sector; - + @Column(precision=10,scale=2) private double price; - + @Column(precision=10,scale=2) private double lastPrice; - + /** - * A no-arg constructor to comply to both GWT compiler and OpenJPA + * A no-arg constructor to comply to both GWT compiler and OpenJPA * bytecode enhancer. */ protected Stock() { - + } - + public Stock(String symbol, String company, Sector sector, double price) { super(); this.symbol = symbol; @@ -71,28 +71,28 @@ public class Stock implements Serializable { this.price = price; this.lastPrice = price; } - + public String getSymbol() { return symbol; } - + public String getCompany() { return company; } - + public Sector getSector() { return sector; } - + public double getMarketPrice() { return price; } - + public void setMarketPrice(double newPrice) { this.lastPrice = this.price; this.price = newPrice; } - + public double getLastPrice() { return lastPrice; } diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Tradable.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Tradable.java index 469e5267b..7ff773d79 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Tradable.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Tradable.java @@ -32,8 +32,8 @@ import javax.persistence.Version; /** * An abstract root for domain objects in OpenTrader designates a {@link Stock financial instrument} - * that can be traded. An abstract state of a tradable entity is immutable by the application. - * + * that can be traded. An abstract state of a tradable entity is immutable by the application. + * * @author Pinaki Poddar * */ @@ -44,20 +44,20 @@ public abstract class Tradable implements Serializable { * Primary identity of a traded entity. * Its value is generated by the persistence provider. * The application must not set or change this value. - * Hence no setter method is provided. + * Hence no setter method is provided. */ @Id @GeneratedValue private Long id; - + /** * The price at which the underlying instrument be traded. * Must always be positive. */ @Column(precision=10,scale=2) private double price; - - + + /** * The volume or discreet number of underlying instrument be traded. * Must always be positive. @@ -70,12 +70,12 @@ public abstract class Tradable implements Serializable { */ @ManyToOne(cascade={CascadeType.MERGE,CascadeType.DETACH,CascadeType.REFRESH},optional=false) private Stock stock; - - @OneToOne(cascade={CascadeType.MERGE,CascadeType.DETACH, CascadeType.REFRESH}, optional=true, - fetch=FetchType.LAZY) - private Trade trade; - - + + @OneToOne(cascade={CascadeType.MERGE,CascadeType.DETACH, CascadeType.REFRESH}, optional=true, + fetch=FetchType.LAZY) + private Trade trade; + + /** * A version identifier. * Important (and almost mandatory) for any persistent entity to be part of @@ -85,18 +85,18 @@ public abstract class Tradable implements Serializable { */ @Version private int version; - + /** - * A no-arg constructor to comply to both GWT compiler and OpenJPA + * A no-arg constructor to comply to both GWT compiler and OpenJPA * bytecode enhancer. */ protected Tradable() { - + } - + /** * Real constructor to be used by the concrete derivations. - * + * * @param stock the underlying instrument. Must not be null. * @param price the price. Must be positive. * @param volume the volume. Must be positive. @@ -108,24 +108,24 @@ public abstract class Tradable implements Serializable { throw new IllegalArgumentException("Can not create Tradable with non-positive price " + price); if (volume <= 0) throw new IllegalArgumentException("Can not create Tradable with non-positive volume " + volume); - + this.stock = stock; this.price = price; this.volume = volume; } - + /** * Gets the identifier of this entity. - * + * * @return identifier generated by the persistence provider. */ public long getId() { return id; } - + /** * Gets the underlying instrument. - * + * * @return the underlying instrument. Never null. */ public Stock getStock() { @@ -134,7 +134,7 @@ public abstract class Tradable implements Serializable { /** * Gets the price at which the underlying instrument be traded. - * + * * @return the price of the underlying instrument for trading. Always greater than zero. */ public double getPrice() { @@ -143,53 +143,53 @@ public abstract class Tradable implements Serializable { /** * Gets the volume of the underlying instrument be traded. - * + * * @return the volume of the underlying instrument for trading. Always greater than zero. */ public int getVolume() { return volume; } - + public abstract double getGain(); - + /** * Affirms if this offer has expired. */ public boolean isTraded() { return trade != null; } - + public void updateStock(Stock updated) { if (this.stock.equals(updated)) { this.stock = updated; } else { - throw new IllegalArgumentException(this + " can not change Stock from " + this.stock + throw new IllegalArgumentException(this + " can not change Stock from " + this.stock + " to " + updated); } } - + public void setTrade(Trade t) { if (trade != null) throw new IllegalStateException(this + " has already been traded"); this.trade = t; } - + public Trade getTrade() { return trade; } /** * The version of the entity. Updated by the persistence provider. - * - * @return the current version of this entity. + * + * @return the current version of this entity. */ public int getVersion() { return version; } - + /** * It is important for persistence entity to overwrite the equals() - * method, preferably based only on its primary key attribute(s). + * method, preferably based only on its primary key attribute(s). */ @Override public int hashCode() { @@ -200,7 +200,7 @@ public abstract class Tradable implements Serializable { } /** * It is important for persistence entity to overwrite the hashCode() - * method, preferably based only on its primary key attribute(s). + * method, preferably based only on its primary key attribute(s). */ @Override public boolean equals(Object obj) { @@ -218,7 +218,7 @@ public abstract class Tradable implements Serializable { return false; return true; } - + public String toString() { String typeName = getClass().getName(); return typeName.substring(typeName.lastIndexOf('.')+1) + "-" + id; diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Trade.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Trade.java index 95d66db2b..8db4b9558 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Trade.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Trade.java @@ -34,7 +34,7 @@ public class Trade implements Serializable { * Primary identity of a committed trade. * Its value is generated by the persistence provider. * The application must not set or change this value. - * Hence no setter method is provided. + * Hence no setter method is provided. */ @Id @GeneratedValue @@ -46,27 +46,27 @@ public class Trade implements Serializable { @OneToOne(cascade={CascadeType.MERGE,CascadeType.DETACH}, optional=false) private Ask ask; - + @OneToOne(cascade={CascadeType.MERGE,CascadeType.DETACH}, optional=false) private Bid bid; - + protected Trade() { - + } - + public Trade(Ask a, Bid b) { if (a == null) throw new NullPointerException("Can not create Trade with null Ask"); if (b == null) throw new NullPointerException("Can not create Trade with null Bid"); - if (a.getSeller() == null) + if (a.getSeller() == null) throw new NullPointerException("Can not create Trade with null trader for Ask"); - if (b.getBuyer() == null) + if (b.getBuyer() == null) throw new NullPointerException("Can not create Trade with null trader for Bid"); if (a.getSeller().equals(b.getBuyer())) throw new IllegalArgumentException("Ask and Bid have same trader " + a.getSeller()); if (!a.getStock().equals(b.getStock())) { - throw new IllegalArgumentException("Stock (ask) " + a.getStock() + throw new IllegalArgumentException("Stock (ask) " + a.getStock() + " does not match Stock (bid) " + b.getStock()); } ask = a; @@ -88,11 +88,11 @@ public class Trade implements Serializable { public Trader getSeller() { return ask.getSeller(); } - + public Stock getStock() { return ask.getStock(); } - + public double getPrice() { return price; } @@ -100,7 +100,7 @@ public class Trade implements Serializable { public int getVolume() { return volume; } - + @Override public int hashCode() { final int prime = 31; @@ -108,7 +108,7 @@ public class Trade implements Serializable { result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } - + @Override public boolean equals(Object obj) { if (this == obj) @@ -125,7 +125,7 @@ public class Trade implements Serializable { return false; return true; } - + public String toString() { return "Trade-"+id; } diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Trader.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Trader.java index 51da38738..006e94a7e 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Trader.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/Trader.java @@ -34,26 +34,26 @@ import javax.persistence.Version; public class Trader implements Serializable { @Id private String name; - + @Version private int version; - + protected Trader() { super(); } - + public Trader(String name) { this.name = name; } - + public String getName() { return name; } - + public int getVersion() { return version; } - + public String toString() { return name; } diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/package.html b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/package.html index 5686f90d1..7f9a8d60e 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/package.html +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/domain/package.html @@ -6,23 +6,23 @@ 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. + under the License. --> Persistent Domain Model for OpenTrader. -The domain model is designed to be a operable in the client-side Java runtime environment (JRE) provided by +The domain model is designed to be a operable in the client-side Java runtime environment (JRE) provided by Google Web Toolkit (GWT). Because JRE Emulation Library GWT -allows a subset of standard Java library classes, these domain classes are defined to use only that subset so that +allows a subset of standard Java library classes, these domain classes are defined to use only that subset so that they can be translated by GWT Compiler. diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/server/ExceptionAdapter.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/server/ExceptionAdapter.java index 6d509a3d7..ae3130b60 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/server/ExceptionAdapter.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/server/ExceptionAdapter.java @@ -27,19 +27,19 @@ import java.util.List; * source code for this dependent packages. The purpose of this translator is to translate * the stack trace of those exceptions, such as org.apache.openjpa.persistence.PersistenceException * without bringing in that dependency. - * + * * @author Pinaki Poddar * */ public class ExceptionAdapter { static List exceptionTypes = Arrays.asList("org.apache.openjpa.persistence.PersistenceException"); - + private boolean _printStackTrace; - + public void setPrintServerSideStackTrace(boolean flag) { _printStackTrace = flag; } - + public RuntimeException translate(Throwable t) { if (_printStackTrace) t.printStackTrace(); @@ -51,7 +51,7 @@ public class ExceptionAdapter { e.setStackTrace(t.getStackTrace()); return e; } - + private Throwable searchForKnownButNonTranslatableException(Throwable t) { if (isAssignable(t.getClass())) return t; @@ -61,7 +61,7 @@ public class ExceptionAdapter { } return null; } - + private boolean isAssignable(Class t) { if (exceptionTypes.contains(t.getName())) { return true; diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/server/TradingServiceAdapterImpl.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/server/TradingServiceAdapterImpl.java index 41e8ae745..92c0c70f4 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/server/TradingServiceAdapterImpl.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/server/TradingServiceAdapterImpl.java @@ -44,23 +44,23 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet; * The server side implementation of the GWT RPC service. *

    * This implementation delegates to original implementation, thereby blocking the GWT Servlet - * dependency to the original implementation of the service. This implementation being a - * servlet allows us to switch the delegate during {@#init(ServletConfig) initialization} + * dependency to the original implementation of the service. This implementation being a + * servlet allows us to switch the delegate during {@#init(ServletConfig) initialization} * to either a {@link Exchange real JPA-based } implementation or a {@link MockTradingService simple in-memory} * implementation of the {@link TradingService service interface}. *

    * The other important advantage of such delegation is to translate exception. The underlying service * exceptions are translated by an {@link ExceptionAdapter exception translator} that ensures that - * the translated exceptions are serializable and hence accessible to the browser-based client. - * + * the translated exceptions are serializable and hence accessible to the browser-based client. + * * @author Pinaki Poddar */ @SuppressWarnings("serial") public class TradingServiceAdapterImpl extends RemoteServiceServlet implements TradingServiceAdapter { - + private TradingService _del; private ExceptionAdapter _translator = new ExceptionAdapter(); - + public void init(ServletConfig config) throws ServletException { super.init(config); String unit = config.getInitParameter("persistence.unit"); @@ -69,12 +69,12 @@ public class TradingServiceAdapterImpl extends RemoteServiceServlet implements T _del = ("true".equalsIgnoreCase(mock)) ? new MockTradingService() : new Exchange(unit); _translator.setPrintServerSideStackTrace("true".equalsIgnoreCase(serverTrace)); } - + public void destroy() { _del.close(); super.destroy(); } - + public Ask ask(Trader trader, Stock stock, int volume, double price) { try { return _del.ask(trader, stock, volume, price); @@ -82,7 +82,7 @@ public class TradingServiceAdapterImpl extends RemoteServiceServlet implements T throw translate(e); } } - + public Bid bid(Trader trader, Stock stock, int volume, double price) { try { return _del.bid(trader, stock, volume, price); @@ -90,7 +90,7 @@ public class TradingServiceAdapterImpl extends RemoteServiceServlet implements T throw translate(e); } } - + public Tradable withdraw(Tradable t) { try { return _del.withdraw(t); @@ -98,7 +98,7 @@ public class TradingServiceAdapterImpl extends RemoteServiceServlet implements T throw translate(e); } } - + public Tradable refresh(Tradable t) { try { return _del.refresh(t); @@ -106,7 +106,7 @@ public class TradingServiceAdapterImpl extends RemoteServiceServlet implements T throw translate(e); } } - + public Stock getStock(String symbol) { try { return _del.getStock(symbol); @@ -114,7 +114,7 @@ public class TradingServiceAdapterImpl extends RemoteServiceServlet implements T throw translate(e); } } - + public List getStocks() { try { return new ArrayList(_del.getStocks()); @@ -122,7 +122,7 @@ public class TradingServiceAdapterImpl extends RemoteServiceServlet implements T throw translate(e); } } - + public List getTrades(Timestamp from, Timestamp to) { try { return _del.getTrades(from, to); @@ -130,7 +130,7 @@ public class TradingServiceAdapterImpl extends RemoteServiceServlet implements T throw translate(e); } } - + public List getTrades(Trader trader, Boolean boughtOrsold, Timestamp from, Timestamp to) { try { return _del.getTrades(trader, boughtOrsold, from, to); @@ -138,7 +138,7 @@ public class TradingServiceAdapterImpl extends RemoteServiceServlet implements T throw translate(e); } } - + public Trader login(String trader) throws RuntimeException { try { return _del.login(trader); @@ -146,7 +146,7 @@ public class TradingServiceAdapterImpl extends RemoteServiceServlet implements T throw translate(e); } } - + public List matchAsk(Ask ask) { try { return new ArrayList(_del.matchAsk(ask)); @@ -154,7 +154,7 @@ public class TradingServiceAdapterImpl extends RemoteServiceServlet implements T throw translate(e); } } - + public List matchBid(Bid bid) { try { return new ArrayList(_del.matchBid(bid)); @@ -162,7 +162,7 @@ public class TradingServiceAdapterImpl extends RemoteServiceServlet implements T throw translate(e); } } - + public Trade trade(Match match) { try { return _del.trade(match); @@ -170,7 +170,7 @@ public class TradingServiceAdapterImpl extends RemoteServiceServlet implements T throw translate(e); } } - + @Override public List getLog() { try { @@ -179,7 +179,7 @@ public class TradingServiceAdapterImpl extends RemoteServiceServlet implements T throw translate(e); } } - + public String getServiceURI() { try { return _del.getServiceURI(); diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/BufferedLog.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/BufferedLog.java index 41020052d..ce0fe648e 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/BufferedLog.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/BufferedLog.java @@ -37,11 +37,11 @@ import org.apache.openjpa.trader.domain.LogStatement; * Specialized log to consolidate multiple logs into a single one. * Selects only query related messages. *
    - * Designed to capture multiple logs used by different slices. It would have + * Designed to capture multiple logs used by different slices. It would have * been more useful to capture the slice thread that executed the query, but * that is not possible in all cases as the log statement is emitted from the * kernel's main thread. - * + * * @author Pinaki Poddar * */ @@ -52,12 +52,12 @@ public class BufferedLog implements LogFactory, Configurable { static String[] SQL_MARKERS = {"INSERT INTO", "SELECT", "UPDATE", "DELETE"}; static String[] JPQL_MARKERS = {"Executing query: ["}; static List CHANNELS = Arrays.asList(OpenJPAConfiguration.LOG_QUERY, JDBCConfiguration.LOG_SQL); - + private static LinkedList _messageModel; static { _messageModel = new LinkedList(); } - + public void setConfiguration(Configuration conf) { _conf = conf; } @@ -68,17 +68,17 @@ public class BufferedLog implements LogFactory, Configurable { public void startConfiguration() { } - + public BufferedLog() { super(); } - + public void setDiagnosticContext(String ctx) { System.err.println(ctx); _diagCtx = ctx; } - - + + public Log getLog(String channel) { return new ChannelLog(channel); } @@ -86,11 +86,11 @@ public class BufferedLog implements LogFactory, Configurable { public void setHistory(int i) { _history = Math.max(i, 1); } - + public int getHistory() { return _history; } - + String getContext() { if (_diagCtx != null) return _diagCtx; @@ -101,25 +101,25 @@ public class BufferedLog implements LogFactory, Configurable { return _conf.getId(); } } - + void addStatement(LogStatement stmt) { _messageModel.addLast(stmt); if (_messageModel.size() > _history) { _messageModel.removeFirst(); } } - + boolean isEmpty(String s) { return s == null || s.trim().length() == 0; } - + public List get() { List result = new ArrayList(_messageModel); _messageModel.clear(); return result; } - + public class ChannelLog implements Log { final String _channel; final String _thread; @@ -127,7 +127,7 @@ public class BufferedLog implements LogFactory, Configurable { _channel = channel; _thread = Thread.currentThread().getName(); } - + public void error(Object o) { createLogStatement("ERROR", o, null); } @@ -136,82 +136,82 @@ public class BufferedLog implements LogFactory, Configurable { createLogStatement("ERROR", o, t); } - + public void fatal(Object o) { createLogStatement("FATAL", o, null); } - + public void fatal(Object o, Throwable t) { createLogStatement("FATAL", o, t); } - + public void info(Object o) { createLogStatement("INFO", o, null); } - + public void info(Object o, Throwable t) { createLogStatement("INFO", o, t); } - + public boolean isErrorEnabled() { return true; } - + public boolean isFatalEnabled() { return true; } - + public boolean isInfoEnabled() { return CHANNELS.contains(_channel); } - + public boolean isTraceEnabled() { return CHANNELS.contains(_channel); } - + public boolean isWarnEnabled() { return true; } - + public void trace(Object o) { createLogStatement("TRACE", o, null); } - + public void trace(Object o, Throwable t) { createLogStatement("TRACE", o, t); } - + public void warn(Object o) { createLogStatement("WARN", o, null); } - + public void warn(Object o, Throwable t) { createLogStatement("WARN", o, t); } - + protected void createLogStatement(String level, Object message, Throwable t) { String msg = message == null ? null : message.toString(); msg = extractQuery(msg); if (msg == null) { return; } - addStatement(new LogStatement(level, getContext(), + addStatement(new LogStatement(level, getContext(), _thread, _channel, msg)); if (t != null) { StringWriter buffer = new StringWriter(); t.printStackTrace(new PrintWriter(buffer)); addStatement(new LogStatement( - level, getContext(), - Thread.currentThread().getName(), _channel, + level, getContext(), + Thread.currentThread().getName(), _channel, buffer.toString())); } } - + public String extractQuery(String msg) { if (msg == null) return null; @@ -219,10 +219,10 @@ public class BufferedLog implements LogFactory, Configurable { return getQuery(msg, SQL_MARKERS, true); } else if ("openjpa.Query".equals(_channel)) { return getQuery(msg, JPQL_MARKERS, false); - } + } return null; } - + private String getQuery(String message, String[] markers, boolean sql) { int k = -1; for (int i = 0; i < markers.length; i++) { @@ -234,7 +234,7 @@ public class BufferedLog implements LogFactory, Configurable { } return null; } - + } diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/Exchange.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/Exchange.java index 1e4ed8858..dc79cbe58 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/Exchange.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/Exchange.java @@ -43,11 +43,11 @@ import org.apache.openjpa.trader.domain.Trader; @SuppressWarnings("serial") public class Exchange extends PersistenceService implements TradingService { private BufferedLog log; - + public Exchange(String unit) { this(unit, null); } - + public Exchange(String unit, Map config) { super(unit, false, PersistenceContextType.TRANSACTION, addLog(config)); LogFactory serverLog = getUnit().getConfiguration().getLogFactory(); @@ -61,8 +61,8 @@ public class Exchange extends PersistenceService implements TradingService { populate(); new MarketFeed(this).start(60*1000); } - - + + public Ask ask(Trader trader, Stock stock, int volume, double price) { EntityManager em = getEntityManager(); begin(); @@ -72,7 +72,7 @@ public class Exchange extends PersistenceService implements TradingService { return ask; } - + public Bid bid(Trader trader, Stock stock, int volume, double price) { EntityManager em = getEntityManager(); begin(); @@ -82,7 +82,7 @@ public class Exchange extends PersistenceService implements TradingService { return bid; } - + public List matchBid(Bid bid) { EntityManager em = getEntityManager(); begin(); @@ -92,7 +92,7 @@ public class Exchange extends PersistenceService implements TradingService { commit(); return matches; } - + public List matchAsk(Ask ask) { EntityManager em = getEntityManager(); begin(); @@ -102,7 +102,7 @@ public class Exchange extends PersistenceService implements TradingService { commit(); return matches; } - + @Override public Tradable withdraw(Tradable t) { if (t.isTraded()) { @@ -116,7 +116,7 @@ public class Exchange extends PersistenceService implements TradingService { commit(); return t; } - + /** * Refresh may fail for various reasons. * The tradable might have been traded or withdrawn. @@ -132,7 +132,7 @@ public class Exchange extends PersistenceService implements TradingService { commit(); return t; } - + public Trade trade(Match match) { EntityManager em = getEntityManager(); begin(); @@ -193,13 +193,13 @@ public class Exchange extends PersistenceService implements TradingService { } q.setParameter("from", from.getNanos()) .setParameter("to", to.getNanos()); - + List result = q.getResultList(); commit(); return result; } - + public void populate() { Object[][] data = { new Object[]{"IBM", Sector.INFRASTRUCTURE, 140.03}, @@ -210,10 +210,10 @@ public class Exchange extends PersistenceService implements TradingService { new Object[]{"CSCO", Sector.INFRASTRUCTURE, 23.45}, new Object[]{"GS", Sector.FINACE, 120.09}, new Object[]{"IFN", Sector.FINACE, 265.87}, - + }; EntityManager em = getEntityManager(); - + begin(); List stocks = em.createQuery(GET_ALL_STOCKS, Stock.class).getResultList(); if (stocks.isEmpty()) { @@ -222,7 +222,7 @@ public class Exchange extends PersistenceService implements TradingService { Stock stock = new Stock((String)d[0], (String)d[0], (Sector)d[1], (Double)d[2]); em.persist(stock); } - + for (int i = 0; i < 4; i++) { Trader trader = new Trader("Trader-"+i); em.persist(trader); @@ -233,7 +233,7 @@ public class Exchange extends PersistenceService implements TradingService { } - + public List getStocks() { EntityManager em = getEntityManager(); begin(); @@ -241,7 +241,7 @@ public class Exchange extends PersistenceService implements TradingService { commit(); return stocks; } - + public List getLog() { if (log == null) { @@ -254,7 +254,7 @@ public class Exchange extends PersistenceService implements TradingService { public void close() { super.close(); } - + static Map addLog(Map config) { if (config == null) { config = new HashMap(); @@ -262,7 +262,7 @@ public class Exchange extends PersistenceService implements TradingService { config.put("openjpa.Log", BufferedLog.class.getName()); return config; } - + public String getServiceURI() { Map props = getUnit().getProperties(); Object url = props.get("openjpa.ConnectionURL"); diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/MockTradingService.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/MockTradingService.java index ed7f66b79..b7b85d539 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/MockTradingService.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/MockTradingService.java @@ -43,7 +43,7 @@ public class MockTradingService implements TradingService { List _logs = new ArrayList(); int counter = 0; private static Random rng = new Random(System.currentTimeMillis()); - + public MockTradingService() { Sector[] sectors = Sector.values(); for (int i = 0; i < 10; i++) { @@ -52,7 +52,7 @@ public class MockTradingService implements TradingService { _stocks.add(stock); } } - + @Override public Ask ask(Trader trader, Stock stock, int volume, double price) { Ask ask = new Ask(trader, stock, price, volume); @@ -112,7 +112,7 @@ public class MockTradingService implements TradingService { for (Trader t : _traders) { if (t.getName().equals(trader)) return t; - } + } Trader t = new Trader(trader); _traders.add(t); return t; @@ -139,7 +139,7 @@ public class MockTradingService implements TradingService { } return result; } - + public Tradable refresh(Tradable t) { return t; } @@ -149,14 +149,14 @@ public class MockTradingService implements TradingService { Trade trade = new Trade(match.getAsk(), match.getBid()); return trade; } - + private boolean matches(Ask ask, Bid bid) { return ((bid.getStock().getSymbol().equals(ask.getStock().getSymbol())) && (!bid.getBuyer().equals(ask.getSeller())) && (bid.getPrice() >= ask.getPrice()) && (bid.getVolume()) <= ask.getVolume()); } - + private void log(String s) { _logs.add(new LogStatement("INFO", "Context", "Thread", "Channel", s)); System.err.println("server log:" + s ); @@ -171,7 +171,7 @@ public class MockTradingService implements TradingService { @Override public void close() { } - + public String getServiceURI() { return "Mock"; } diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/PersistenceService.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/PersistenceService.java index 14c186243..46e93fed6 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/PersistenceService.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/PersistenceService.java @@ -32,16 +32,16 @@ import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory; import org.apache.openjpa.persistence.OpenJPAPersistence; /** - * An abstract utility for JPA based service. + * An abstract utility for JPA based service. * This thin wrapper over a {@link EntityManagerFactory Persistence Unit} maintains *

  • per-thread persistence context - *
  • relinquishes direct transaction control under a managed environment - * + *
  • relinquishes direct transaction control under a managed environment + * * @see #getEntityManager() * @see #newEntityManager() - * + * * @author Pinaki Poddar - * + * */ @SuppressWarnings("serial") public abstract class PersistenceService extends Observable implements Serializable { @@ -49,14 +49,14 @@ public abstract class PersistenceService extends Observable implements Serializa private final String unitName; private final boolean isManaged; private final PersistenceContextType scope; - + private ThreadLocal thread = new ThreadLocal(); private ReentrantLock lock = new ReentrantLock(); protected PersistenceService(String unit) { this(unit, false, PersistenceContextType.EXTENDED, null); } - + protected PersistenceService(String unit, boolean managed, PersistenceContextType scope, Map config) { this.emf = OpenJPAPersistence.cast(Persistence.createEntityManagerFactory(unit, config)); @@ -64,7 +64,7 @@ public abstract class PersistenceService extends Observable implements Serializa this.isManaged = managed; this.scope = scope; } - + public final OpenJPAEntityManagerFactory getUnit() { return emf; } @@ -72,11 +72,11 @@ public abstract class PersistenceService extends Observable implements Serializa public final String getUnitName() { return unitName; } - + public final boolean isManaged() { return isManaged; } - + public final PersistenceContextType getContextType() { return scope; } @@ -86,7 +86,7 @@ public abstract class PersistenceService extends Observable implements Serializa * current thread is not associated with any entity manager or the * associated entity manager has been closed, creates a new entity manager * and associates with the current thread. - * + * * @return an entity manager associated with the current thread. */ protected EntityManager getEntityManager() { @@ -117,7 +117,7 @@ public abstract class PersistenceService extends Observable implements Serializa * If the thread is not associated with a persistence context, then a new * context is created, associated with the thread, new transaction is * started. - * + * * @see #getEntityManager() */ protected EntityManager begin() { @@ -166,7 +166,7 @@ public abstract class PersistenceService extends Observable implements Serializa lock.lock(); EntityManager em = getEntityManager(); if (isManaged) { - + } else { em.getTransaction().rollback(); } @@ -177,7 +177,7 @@ public abstract class PersistenceService extends Observable implements Serializa lock.unlock(); } } - + public void close() { try { EntityManager em = thread.get(); @@ -188,9 +188,9 @@ public abstract class PersistenceService extends Observable implements Serializa thread.set(null); emf.close(); } finally { - + } - + } /** @@ -202,7 +202,7 @@ public abstract class PersistenceService extends Observable implements Serializa assertTrue("No persistent context is associated with " + thread, em != null); assertTrue("Persistent context " + em + " associated with " + thread + " has been closed", em.isOpen()); if (!isManaged) { - assertTrue("Persistent context " + em + " associated with " + thread + " has no active transaction", + assertTrue("Persistent context " + em + " associated with " + thread + " has no active transaction", em.getTransaction().isActive()); } } diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/TradeEvent.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/TradeEvent.java index 84fa2368b..69b2527ff 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/TradeEvent.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/TradeEvent.java @@ -19,17 +19,17 @@ package org.apache.openjpa.trader.service; public class TradeEvent { - enum Type {LOGIN, ASK, BID, WITHDRAW, REFRESH, TRADE, MATCH, + enum Type {LOGIN, ASK, BID, WITHDRAW, REFRESH, TRADE, MATCH, STOCK_LOOKUP, QUERY_TRADE, MARKET_FEED}; - + public final Type type; public final long time; public final String description; - + public TradeEvent(Type type, long elapsedTime) { this(type, elapsedTime, ""); } - + public TradeEvent(Type type, long elapsedTime, String txt) { this.type = type; this.time = elapsedTime; diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/TradingService.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/TradingService.java index fe2bfe525..75d150608 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/TradingService.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/TradingService.java @@ -31,9 +31,9 @@ import org.apache.openjpa.trader.domain.Trade; import org.apache.openjpa.trader.domain.Trader; /** - * A service to place offer to {@link Bid buy} and {@link Ask sell} stocks, + * A service to place offer to {@link Bid buy} and {@link Ask sell} stocks, * matches asks to bids and registers trades. - * + * * @author Pinaki Poddar * */ @@ -42,122 +42,122 @@ public interface TradingService { * A query to find symbols of all stocks. */ public static final String GET_ALL_STOCKS = "select s from Stock s"; - + /** * A query to match asks to a given bid. */ - public static final String MATCH_BID = "select new Match(a,b) from Ask a, Bid b " - + "where b = :bid and a.stock.symbol = b.stock.symbol " - + "and a.price <= b.price and a.volume >= b.volume " + public static final String MATCH_BID = "select new Match(a,b) from Ask a, Bid b " + + "where b = :bid and a.stock.symbol = b.stock.symbol " + + "and a.price <= b.price and a.volume >= b.volume " + "and NOT(a.seller = b.buyer) and a.trade is NULL and b.trade is NULL"; // + "order by a.price ASC"; - + /** * A query to match bids of a given ask. */ - public static final String MATCH_ASK = "select new Match(a,b) from Ask a, Bid b " - + "where a = :ask and a.stock.symbol = b.stock.symbol " - + "and a.price <= b.price and a.volume >= b.volume " - + "and NOT(a.seller = b.buyer) and a.trade is NULL and b.trade is NULL"; + public static final String MATCH_ASK = "select new Match(a,b) from Ask a, Bid b " + + "where a = :ask and a.stock.symbol = b.stock.symbol " + + "and a.price <= b.price and a.volume >= b.volume " + + "and NOT(a.seller = b.buyer) and a.trade is NULL and b.trade is NULL"; // + "order by b.price DESC"; - + /** * A query to find a trader by his/her name. */ public static final String QUERY_TRADER_BY_NAME = "select t from Trader t where t.name=:name"; - - + + /** * A query to find all trades in a given period. */ public static final String QUERY_TRADE_BY_PERIOD = "select t from Trade t where t.id between (:from, :to)"; - - + + public static final String DEFAULT_UNIT_NAME = "exchange-local"; - + /** * Gets the list of stocks registered with this service. */ List getStocks(); - + /** * Logs in a trader of given name. - * + * * @param trader */ Trader login(String trader); - + /** - * The given Trader asks (offers to sell) the given stock at given price. + * The given Trader asks (offers to sell) the given stock at given price. * @param trader * @param stock * @param volume * @param price */ Ask ask(Trader trader, Stock stock, int volume, double price); - - + + /** - * The given Trader bids (offers to buy) the given stock at given price. + * The given Trader bids (offers to buy) the given stock at given price. * @param trader * @param stock * @param volume * @param price */ Bid bid(Trader trader, Stock stock, int volume, double price); - + /** * Matches existing asks to the given bid. * @param bid the bid to be matched * @return possible (uncommitted) trades matching the bids */ List matchBid(Bid bid); - + /** * Matches existing bids to the given ask. * @param ask the ask to be matched with the bids * @return possible (uncommitted) trades matching the given ask */ List matchAsk(Ask ask); - + Tradable withdraw(Tradable t); Tradable refresh(Tradable t); - + void close(); /** * Registers the given trade. * @param trade */ Trade trade(Match match); - + /** * Gets the trades executed between the given time periods. * @param from * @param to */ List getTrades(Timestamp from, Timestamp to); - + /** * Gets the trades executed by the given trader between the given time periods. * @param from * @param to */ List getTrades(Trader trader, Boolean boughtOrsold, Timestamp from, Timestamp to); - + /** * Gets the current value of the stock given its symbol. * @param symbol */ Stock getStock(String symbol); - + /** * Gets the statements logged since the last call. */ List getLog(); - + /** * Get a descriptive URI-like string for this service. - * + * */ String getServiceURI(); } diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/slice/SectorBasedQueryTargetPolicy.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/slice/SectorBasedQueryTargetPolicy.java index c6571037a..565f75fed 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/slice/SectorBasedQueryTargetPolicy.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/slice/SectorBasedQueryTargetPolicy.java @@ -29,7 +29,7 @@ import org.apache.openjpa.trader.service.TradingService; /** * An example of a {@link QueryTargetPolicy query target policy} that directs the query based * on its parameters. - * + * * @author Pinaki Poddar * */ @@ -37,7 +37,7 @@ public class SectorBasedQueryTargetPolicy implements QueryTargetPolicy { @Override public String[] getTargets(String query, Map params, - String language, List slices, Object context) { + String language, List slices, Object context) { Stock stock = null; if (TradingService.MATCH_ASK.equals(query)) { stock = ((Tradable)params.get("ask")).getStock(); diff --git a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/slice/SectorDistributionPolicy.java b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/slice/SectorDistributionPolicy.java index 676e965fd..0ab38634e 100644 --- a/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/slice/SectorDistributionPolicy.java +++ b/openjpa-examples/opentrader/src/main/java/org/apache/openjpa/trader/service/slice/SectorDistributionPolicy.java @@ -28,11 +28,11 @@ import org.apache.openjpa.trader.domain.Trade; import org.apache.openjpa.trader.domain.Trader; /** - * An example of {@link DistributionPolicy distribution policy} that distributes each persistent + * An example of {@link DistributionPolicy distribution policy} that distributes each persistent * domain instances of OpenTrader model into specific slice based on the {@link Sector} to which * a {@link Stock} belongs. This policy demonstrates the use case where data is distributed by * a related property of the instance. - * + * * @author Pinaki Poddar * */ diff --git a/openjpa-examples/opentrader/src/main/resources/META-INF/persistence.xml b/openjpa-examples/opentrader/src/main/resources/META-INF/persistence.xml index 482822edb..e73d63669 100644 --- a/openjpa-examples/opentrader/src/main/resources/META-INF/persistence.xml +++ b/openjpa-examples/opentrader/src/main/resources/META-INF/persistence.xml @@ -28,37 +28,37 @@ org.apache.openjpa.trader.domain.Trader org.apache.openjpa.trader.domain.Trade org.apache.openjpa.trader.domain.Stock - + - + - + - + - - - + + + - - + + - - + + - - + + org.apache.openjpa.persistence.PersistenceProviderImpl org.apache.openjpa.trader.domain.Tradable @@ -76,11 +76,11 @@ - + - + org.apache.openjpa.persistence.PersistenceProviderImpl org.apache.openjpa.trader.domain.Tradable @@ -98,9 +98,9 @@ - + - + diff --git a/openjpa-examples/opentrader/src/main/resources/OpenTrader.html b/openjpa-examples/opentrader/src/main/resources/OpenTrader.html index 858d3f640..a8c5aac22 100644 --- a/openjpa-examples/opentrader/src/main/resources/OpenTrader.html +++ b/openjpa-examples/opentrader/src/main/resources/OpenTrader.html @@ -34,9 +34,9 @@ - + OpenTrader - + @@ -48,13 +48,13 @@ - + - + diff --git a/openjpa-examples/opentrader/src/main/resources/css/OpenTrader.css b/openjpa-examples/opentrader/src/main/resources/css/OpenTrader.css index 8238a695a..2d9b36270 100644 --- a/openjpa-examples/opentrader/src/main/resources/css/OpenTrader.css +++ b/openjpa-examples/opentrader/src/main/resources/css/OpenTrader.css @@ -14,11 +14,11 @@ * "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. + * under the License. */ /** * The stylesheet for OpenTrader sample application. - * + * **/ /** @@ -69,7 +69,7 @@ * --------------------------------------------------------------------------- **/ -.cbg-RP { +.cbg-RP { background-color:#005B9A; border-color: #005B9A; } @@ -122,7 +122,7 @@ float:right; text-align:right; margin-right:1em; - + } .error-message { color:red; @@ -149,7 +149,7 @@ color: #0000FF; /* vertical-align:-25%; */ } -/** Panel on top-right corner displays current Trader details **/ +/** Panel on top-right corner displays current Trader details **/ #TraderPanel { position: absolute; top:10px; diff --git a/openjpa-examples/pom.xml b/openjpa-examples/pom.xml index e77870d00..6aea2321b 100644 --- a/openjpa-examples/pom.xml +++ b/openjpa-examples/pom.xml @@ -7,18 +7,18 @@ 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. + under the License. --> - @@ -56,7 +56,7 @@ ${basedir}/../../openjpa-persistence-jdbc/src/test/resources/j2.security.test.policy - + diff --git a/openjpa-examples/simple/pom.xml b/openjpa-examples/simple/pom.xml index 7ed630518..ef0b72a62 100644 --- a/openjpa-examples/simple/pom.xml +++ b/openjpa-examples/simple/pom.xml @@ -7,18 +7,18 @@ 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. + under the License. --> - diff --git a/openjpa-examples/simple/src/main/java/META-INF/persistence.xml b/openjpa-examples/simple/src/main/java/META-INF/persistence.xml index a47ca2df7..694473e89 100644 --- a/openjpa-examples/simple/src/main/java/META-INF/persistence.xml +++ b/openjpa-examples/simple/src/main/java/META-INF/persistence.xml @@ -7,15 +7,15 @@ 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. + under the License. --> mapping.BuildSchemaPC mapping.BuildUTF8SchemaPC - + reversemapping/orm.xml hellojpa.Message @@ -66,13 +66,13 @@ --> @@ -87,7 +87,7 @@ reversemapping/orm.xml - + org.apache.openjpa.persistence.PersistenceProviderImpl embeddables.Address @@ -96,5 +96,5 @@ embeddables.Phone embeddables.User - + diff --git a/openjpa-examples/simple/src/main/java/build.xml b/openjpa-examples/simple/src/main/java/build.xml index f39aed81e..12cc881a2 100644 --- a/openjpa-examples/simple/src/main/java/build.xml +++ b/openjpa-examples/simple/src/main/java/build.xml @@ -7,15 +7,15 @@ 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. + under the License. --> @@ -65,7 +65,7 @@ Please traverse to a sub-directory, like hellojpa, and run "ant" from there. - + diff --git a/openjpa-examples/simple/src/main/java/embeddables/Address.java b/openjpa-examples/simple/src/main/java/embeddables/Address.java index 6e998410a..83345ccce 100644 --- a/openjpa-examples/simple/src/main/java/embeddables/Address.java +++ b/openjpa-examples/simple/src/main/java/embeddables/Address.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package embeddables; diff --git a/openjpa-examples/simple/src/main/java/embeddables/ContactInfo.java b/openjpa-examples/simple/src/main/java/embeddables/ContactInfo.java index b5338bcae..60ec93a06 100644 --- a/openjpa-examples/simple/src/main/java/embeddables/ContactInfo.java +++ b/openjpa-examples/simple/src/main/java/embeddables/ContactInfo.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package embeddables; diff --git a/openjpa-examples/simple/src/main/java/embeddables/Coordinates.java b/openjpa-examples/simple/src/main/java/embeddables/Coordinates.java index 889b5de01..526304a26 100644 --- a/openjpa-examples/simple/src/main/java/embeddables/Coordinates.java +++ b/openjpa-examples/simple/src/main/java/embeddables/Coordinates.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package embeddables; diff --git a/openjpa-examples/simple/src/main/java/embeddables/Main.java b/openjpa-examples/simple/src/main/java/embeddables/Main.java index c82e49874..2901566c5 100644 --- a/openjpa-examples/simple/src/main/java/embeddables/Main.java +++ b/openjpa-examples/simple/src/main/java/embeddables/Main.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package embeddables; diff --git a/openjpa-examples/simple/src/main/java/embeddables/Phone.java b/openjpa-examples/simple/src/main/java/embeddables/Phone.java index 0583f09fc..88a62bd51 100644 --- a/openjpa-examples/simple/src/main/java/embeddables/Phone.java +++ b/openjpa-examples/simple/src/main/java/embeddables/Phone.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package embeddables; diff --git a/openjpa-examples/simple/src/main/java/embeddables/User.java b/openjpa-examples/simple/src/main/java/embeddables/User.java index f6700ca39..09e6d5d57 100644 --- a/openjpa-examples/simple/src/main/java/embeddables/User.java +++ b/openjpa-examples/simple/src/main/java/embeddables/User.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package embeddables; diff --git a/openjpa-examples/simple/src/main/java/embeddables/build.xml b/openjpa-examples/simple/src/main/java/embeddables/build.xml index 78d405082..206c95d6f 100644 --- a/openjpa-examples/simple/src/main/java/embeddables/build.xml +++ b/openjpa-examples/simple/src/main/java/embeddables/build.xml @@ -7,15 +7,15 @@ 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. + under the License. --> diff --git a/openjpa-examples/simple/src/main/java/hellojpa/Main.java b/openjpa-examples/simple/src/main/java/hellojpa/Main.java index 7ae8c6d17..09e3ebe96 100644 --- a/openjpa-examples/simple/src/main/java/hellojpa/Main.java +++ b/openjpa-examples/simple/src/main/java/hellojpa/Main.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package hellojpa; @@ -22,7 +22,7 @@ import java.util.*; import javax.persistence.*; -/** +/** * A very simple, stand-alone program that stores a new entity in the * database and then performs a query to retrieve it. */ @@ -63,10 +63,10 @@ public class Main { Query q = em2.createQuery("select m from Message m"); // Go through each of the entities and print out each of their - // messages, as well as the date on which it was created + // messages, as well as the date on which it was created for (Message m : (List) q.getResultList()) { System.out.println(m.getMessage() - + " (created on: " + m.getCreated() + ")"); + + " (created on: " + m.getCreated() + ")"); } // Again, it is always good to clean up after ourselves diff --git a/openjpa-examples/simple/src/main/java/hellojpa/Message.java b/openjpa-examples/simple/src/main/java/hellojpa/Message.java index 38a084d04..41f80d5b3 100644 --- a/openjpa-examples/simple/src/main/java/hellojpa/Message.java +++ b/openjpa-examples/simple/src/main/java/hellojpa/Message.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package hellojpa; @@ -22,7 +22,7 @@ import java.util.*; import javax.persistence.*; -/** +/** * A very simple persistent entity that holds a "message", has a * "created" field that is initialized to the time at which the * object was created, and an id field that is initialized to the diff --git a/openjpa-examples/simple/src/main/java/hellojpa/build.xml b/openjpa-examples/simple/src/main/java/hellojpa/build.xml index 007f64d77..c325b43d4 100644 --- a/openjpa-examples/simple/src/main/java/hellojpa/build.xml +++ b/openjpa-examples/simple/src/main/java/hellojpa/build.xml @@ -7,15 +7,15 @@ 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. + under the License. --> diff --git a/openjpa-examples/simple/src/main/java/mapping/BuildSchemaPC.java b/openjpa-examples/simple/src/main/java/mapping/BuildSchemaPC.java index d021cfea9..b6763e97b 100644 --- a/openjpa-examples/simple/src/main/java/mapping/BuildSchemaPC.java +++ b/openjpa-examples/simple/src/main/java/mapping/BuildSchemaPC.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package mapping; @@ -40,15 +40,15 @@ public class BuildSchemaPC { @Basic @Column(name = "chain", length = 50) private String stringField = null; - - + + public BuildSchemaPC() {} - + public BuildSchemaPC(String chain) { stringField = chain; } - + public String getStringField() { return stringField; } diff --git a/openjpa-examples/simple/src/main/java/mapping/BuildUTF8SchemaPC.java b/openjpa-examples/simple/src/main/java/mapping/BuildUTF8SchemaPC.java index 1062322ec..42e3dddc0 100644 --- a/openjpa-examples/simple/src/main/java/mapping/BuildUTF8SchemaPC.java +++ b/openjpa-examples/simple/src/main/java/mapping/BuildUTF8SchemaPC.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package mapping; @@ -40,15 +40,15 @@ public class BuildUTF8SchemaPC { @Basic @Column(name = "cha\u00EEne", length = 50) private String stringField = null; - - + + public BuildUTF8SchemaPC() {} - + public BuildUTF8SchemaPC(String chain) { stringField = chain; } - + public String getStringField() { return stringField; } diff --git a/openjpa-examples/simple/src/main/java/mapping/build.xml b/openjpa-examples/simple/src/main/java/mapping/build.xml index 259a72357..b9abbc226 100644 --- a/openjpa-examples/simple/src/main/java/mapping/build.xml +++ b/openjpa-examples/simple/src/main/java/mapping/build.xml @@ -7,15 +7,15 @@ 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. + under the License. --> @@ -35,7 +35,7 @@ - @@ -46,12 +46,12 @@ java -cp .:openjpa-all-.jar:derby-10.8.2.2.jar -Dopenjpa.ConnectionDriverName="org.apache.derby.jdbc.EmbeddedDriver" -Dopenjpa.ConnectionURL="jdbc:derby:mapping-database;create=true" - -Dopenjpa.ConnectionUserName= -Dopenjpa.ConnectionPassword= + -Dopenjpa.ConnectionUserName= -Dopenjpa.ConnectionPassword= org.apache.openjpa.jdbc.meta.MappingTool BuildSchemaPC.class -a buildSchema --> - @@ -64,12 +64,12 @@ java -cp .:openjpa-all-.jar:derby-10.8.2.2.jar -Dopenjpa.ConnectionDriverName="org.apache.derby.jdbc.EmbeddedDriver" -Dopenjpa.ConnectionURL="jdbc:derby:mapping-database;create=true" - -Dopenjpa.ConnectionUserName= -Dopenjpa.ConnectionPassword= + -Dopenjpa.ConnectionUserName= -Dopenjpa.ConnectionPassword= org.apache.openjpa.jdbc.meta.MappingTool BuildUTF8SchemaPC.class -sa build -sql createUTF8.sql -se UTF-8 --> - @@ -82,12 +82,12 @@ java -cp .:openjpa-all-.jar:derby-10.8.2.2.jar -Dopenjpa.ConnectionDriverName="org.apache.derby.jdbc.EmbeddedDriver" -Dopenjpa.ConnectionURL="jdbc:derby:mapping-database;create=true" - -Dopenjpa.ConnectionUserName= -Dopenjpa.ConnectionPassword= + -Dopenjpa.ConnectionUserName= -Dopenjpa.ConnectionPassword= org.apache.openjpa.jdbc.meta.MappingTool BuildSchemaPC.class -sa build -sql create.sql --> - diff --git a/openjpa-examples/simple/src/main/java/relations/Deity.java b/openjpa-examples/simple/src/main/java/relations/Deity.java index 0118e46ed..8d8faaece 100644 --- a/openjpa-examples/simple/src/main/java/relations/Deity.java +++ b/openjpa-examples/simple/src/main/java/relations/Deity.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package relations; @@ -34,7 +34,7 @@ import javax.persistence.OneToMany; import javax.persistence.OneToOne; -/** +/** * An entity that contains relations corresponding to family tree relations. * This entity demonstrates the following JPA features: * @@ -105,9 +105,9 @@ public class Deity implements Serializable { // Business methods follow ////////////////////////// - /** - * She's having a baby... - * + /** + * She's having a baby... + * * @param childName the baby name * @return the new child * diff --git a/openjpa-examples/simple/src/main/java/relations/Main.java b/openjpa-examples/simple/src/main/java/relations/Main.java index d9a58cf13..9463ed7f9 100644 --- a/openjpa-examples/simple/src/main/java/relations/Main.java +++ b/openjpa-examples/simple/src/main/java/relations/Main.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package relations; @@ -25,7 +25,7 @@ import javax.persistence.*; import static relations.Deity.Gender.*; -/** +/** * A very simple, stand-alone program that stores a new entity in the * database and then performs a query to retrieve it. */ @@ -54,9 +54,9 @@ public class Main { factory.close(); } - /** + /** * Creates a partial family tree of the Greek dieties. - * + * * @param em the EntityManager to use in the persistence process */ public static void initFamilyTree(EntityManager em) { @@ -121,9 +121,9 @@ public class Main { em.getTransaction().commit(); } - /** + /** * Run some sample queries against the family tree model. - * + * * @param em the EntityManager to use */ public static void runQueries(EntityManager em) { @@ -134,7 +134,7 @@ public class Main { Query q = em.createQuery("select x from Deity x"); // Go through each of the entities and print out each of their - // messages, as well as the date on which it was created + // messages, as well as the date on which it was created for (Deity m : (List) q.getResultList()) { System.out.println(m.getName()); } diff --git a/openjpa-examples/simple/src/main/java/relations/build.xml b/openjpa-examples/simple/src/main/java/relations/build.xml index 7f254d6ad..1418561a0 100644 --- a/openjpa-examples/simple/src/main/java/relations/build.xml +++ b/openjpa-examples/simple/src/main/java/relations/build.xml @@ -7,15 +7,15 @@ 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. + under the License. --> diff --git a/openjpa-examples/simple/src/main/java/reversemapping/Main.java b/openjpa-examples/simple/src/main/java/reversemapping/Main.java index fb9f787aa..c6f5d98bf 100644 --- a/openjpa-examples/simple/src/main/java/reversemapping/Main.java +++ b/openjpa-examples/simple/src/main/java/reversemapping/Main.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package reversemapping; @@ -23,9 +23,9 @@ import java.util.*; import javax.persistence.*; -/** +/** * A simple program that uses the reverse-mapped classes from the airlines - * schema to print out a list of schedules flightes and the + * schema to print out a list of schedules flightes and the * projected profits from them. */ public class Main { @@ -110,7 +110,7 @@ public class Main { print(" total profit: " + NumberFormat.getCurrencyInstance(). format(income - totalCost)); - } + } // Again, it is always good to clean up after ourselves em.close(); diff --git a/openjpa-examples/simple/src/main/java/reversemapping/build.xml b/openjpa-examples/simple/src/main/java/reversemapping/build.xml index 680bba9e9..f95e6d1c2 100644 --- a/openjpa-examples/simple/src/main/java/reversemapping/build.xml +++ b/openjpa-examples/simple/src/main/java/reversemapping/build.xml @@ -7,15 +7,15 @@ 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. + under the License. --> diff --git a/openjpa-examples/simple/src/main/java/reversemapping/db.xml b/openjpa-examples/simple/src/main/java/reversemapping/db.xml index cbbb50141..1971a7c44 100644 --- a/openjpa-examples/simple/src/main/java/reversemapping/db.xml +++ b/openjpa-examples/simple/src/main/java/reversemapping/db.xml @@ -7,15 +7,15 @@ 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. + under the License. --> diff --git a/openjpa-examples/simple/src/main/java/reversemapping/schema/ToursDB_schema.sql b/openjpa-examples/simple/src/main/java/reversemapping/schema/ToursDB_schema.sql index ab3c84ebb..e7b655635 100644 --- a/openjpa-examples/simple/src/main/java/reversemapping/schema/ToursDB_schema.sql +++ b/openjpa-examples/simple/src/main/java/reversemapping/schema/ToursDB_schema.sql @@ -40,7 +40,7 @@ CREATE TABLE COUNTRIES COUNTRY_ISO_CODE CHAR(2) NOT NULL , REGION VARCHAR(26) ); - + ALTER TABLE COUNTRIES ADD CONSTRAINT COUNTRIES_PK Primary Key ( @@ -65,7 +65,7 @@ CREATE TABLE CITIES COUNTRY VARCHAR(26) NOT NULL, AIRPORT VARCHAR(3), LANGUAGE VARCHAR(16), - COUNTRY_ISO_CODE CHAR(2) + COUNTRY_ISO_CODE CHAR(2) ); @@ -98,10 +98,10 @@ CREATE TABLE FLIGHTS CREATE INDEX DESTINDEX ON FLIGHTS ( DEST_AIRPORT) ; - + CREATE INDEX ORIGINDEX ON FLIGHTS ( ORIG_AIRPORT) ; - + ALTER TABLE FLIGHTS ADD CONSTRAINT FLIGHTS_PK Primary Key ( FLIGHT_ID, @@ -167,7 +167,7 @@ CREATE TABLE FLIGHTS_HISTORY MEAL CHAR(1), FLYING_TIME DOUBLE PRECISION, MILES INTEGER, - AIRCRAFT VARCHAR(6), + AIRCRAFT VARCHAR(6), STATUS VARCHAR (20) ); diff --git a/openjpa-examples/simple/src/main/java/reversemapping/schema/loadFLIGHTAVAILABILITY1.sql b/openjpa-examples/simple/src/main/java/reversemapping/schema/loadFLIGHTAVAILABILITY1.sql index 623134de8..fd46fc137 100644 --- a/openjpa-examples/simple/src/main/java/reversemapping/schema/loadFLIGHTAVAILABILITY1.sql +++ b/openjpa-examples/simple/src/main/java/reversemapping/schema/loadFLIGHTAVAILABILITY1.sql @@ -13,298 +13,298 @@ -- See the License for the specific language governing permissions and -- limitations under the License. -insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-30',2,2,2); - +insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1116',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1122',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1124',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1126',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1128',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1134',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1140',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1148',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1150',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1158',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1168',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1172',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1176',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1178',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1181',2,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1182',2,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1188',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1195',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1197',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1203',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1207',1,'2004-05-30',2,2,2); + diff --git a/openjpa-examples/simple/src/main/java/reversemapping/schema/loadFLIGHTAVAILABILITY2.sql b/openjpa-examples/simple/src/main/java/reversemapping/schema/loadFLIGHTAVAILABILITY2.sql index db3eae1c5..c2b1173f2 100644 --- a/openjpa-examples/simple/src/main/java/reversemapping/schema/loadFLIGHTAVAILABILITY2.sql +++ b/openjpa-examples/simple/src/main/java/reversemapping/schema/loadFLIGHTAVAILABILITY2.sql @@ -13,227 +13,227 @@ -- See the License for the specific language governing permissions and -- limitations under the License. -insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-05-17',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-05-18',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-05-29',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-05-30',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-03-31',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-04-11',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-04-12',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-04-15',5,5,0); -insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-04-20',10,0,0); -insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-04-23',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-04-24',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-05-03',11,0,0); -insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-05-05',1,1,1); -insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-05-06',2,2,2); -insert into FLIGHTAVAILABILITY values ('AA1290',1,'2004-04-05',3,0,0); -insert into FLIGHTAVAILABILITY values ('AA1285',1,'2004-04-11',3,0,0); -insert into FLIGHTAVAILABILITY values ('AA1223',2,'2004-04-11',3,0,0); -insert into FLIGHTAVAILABILITY values ('US1552',1,'2004-04-19',3,0,0); -insert into FLIGHTAVAILABILITY values ('AA1221',1,'2004-04-19',3,0,0); -insert into FLIGHTAVAILABILITY values ('US1518',1,'2004-04-12',0,0,3); -insert into FLIGHTAVAILABILITY values ('US1518',2,'2004-04-12',0,0,3); -insert into FLIGHTAVAILABILITY values ('US1499',1,'2004-04-25',0,0,3); -insert into FLIGHTAVAILABILITY values ('US1404',1,'2004-04-30',0,3,0); -insert into FLIGHTAVAILABILITY values ('US1519',2,'2004-04-30',0,3,0); -insert into FLIGHTAVAILABILITY values ('US1560',1,'2004-04-25',0,3,0); -insert into FLIGHTAVAILABILITY values ('US1276',2,'2004-05-05',0,3,0); -insert into FLIGHTAVAILABILITY values ('US1439',1,'2004-05-15',0,3,0); -insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-04-02',0,0,3); -insert into FLIGHTAVAILABILITY values ('AA1248',1,'2004-04-02',0,0,3); -insert into FLIGHTAVAILABILITY values ('AA1245',1,'2004-04-10',0,0,3); -insert into FLIGHTAVAILABILITY values ('US1435',1,'2004-04-18',0,0,3); -insert into FLIGHTAVAILABILITY values ('US1357',2,'2004-04-18',0,0,3); +insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1211',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1217',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1224',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1229',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1231',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1239',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1241',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1243',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1247',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1252',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1258',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1259',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-05-17',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-05-18',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-05-29',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1265',1,'2004-05-30',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-03-31',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-04-11',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-04-12',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-04-15',5,5,0); +insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-04-20',10,0,0); +insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-04-23',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-04-24',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-05-03',11,0,0); +insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-05-05',1,1,1); +insert into FLIGHTAVAILABILITY values ('AA1271',1,'2004-05-06',2,2,2); +insert into FLIGHTAVAILABILITY values ('AA1290',1,'2004-04-05',3,0,0); +insert into FLIGHTAVAILABILITY values ('AA1285',1,'2004-04-11',3,0,0); +insert into FLIGHTAVAILABILITY values ('AA1223',2,'2004-04-11',3,0,0); +insert into FLIGHTAVAILABILITY values ('US1552',1,'2004-04-19',3,0,0); +insert into FLIGHTAVAILABILITY values ('AA1221',1,'2004-04-19',3,0,0); +insert into FLIGHTAVAILABILITY values ('US1518',1,'2004-04-12',0,0,3); +insert into FLIGHTAVAILABILITY values ('US1518',2,'2004-04-12',0,0,3); +insert into FLIGHTAVAILABILITY values ('US1499',1,'2004-04-25',0,0,3); +insert into FLIGHTAVAILABILITY values ('US1404',1,'2004-04-30',0,3,0); +insert into FLIGHTAVAILABILITY values ('US1519',2,'2004-04-30',0,3,0); +insert into FLIGHTAVAILABILITY values ('US1560',1,'2004-04-25',0,3,0); +insert into FLIGHTAVAILABILITY values ('US1276',2,'2004-05-05',0,3,0); +insert into FLIGHTAVAILABILITY values ('US1439',1,'2004-05-15',0,3,0); +insert into FLIGHTAVAILABILITY values ('AA1219',1,'2004-04-02',0,0,3); +insert into FLIGHTAVAILABILITY values ('AA1248',1,'2004-04-02',0,0,3); +insert into FLIGHTAVAILABILITY values ('AA1245',1,'2004-04-10',0,0,3); +insert into FLIGHTAVAILABILITY values ('US1435',1,'2004-04-18',0,0,3); +insert into FLIGHTAVAILABILITY values ('US1357',2,'2004-04-18',0,0,3); diff --git a/openjpa-examples/simple/src/main/java/reversemapping/schema/loadFLIGHTS1.sql b/openjpa-examples/simple/src/main/java/reversemapping/schema/loadFLIGHTS1.sql index 2092f1ab5..39c9a08bb 100644 --- a/openjpa-examples/simple/src/main/java/reversemapping/schema/loadFLIGHTS1.sql +++ b/openjpa-examples/simple/src/main/java/reversemapping/schema/loadFLIGHTS1.sql @@ -13,262 +13,262 @@ -- See the License for the specific language governing permissions and -- limitations under the License. -insert into FLIGHTS values ('AA1111',1,'ABQ','09:00:00','LAX','09:19:00','S',1.328,664,'B747'); -insert into FLIGHTS values ('AA1112',1,'LAX','09:00:00','ABQ','11:19:00','S',1.328,664,'B747'); -insert into FLIGHTS values ('AA1113',1,'ABQ','09:00:00','PHX','09:39:00','S',0.658,329,'B747'); -insert into FLIGHTS values ('AA1114',1,'PHX','09:00:00','ABQ','09:39:00','S',0.658,329,'B747'); -insert into FLIGHTS values ('AA1115',1,'ABQ','09:00:00','OKC','11:02:00','B',1.034,517,'B747'); -insert into FLIGHTS values ('AA1116',1,'OKC','09:00:00','ABQ','09:02:00','B',1.034,517,'B747'); -insert into FLIGHTS values ('AA1117',1,'AKL','09:00:00','HNL','18:48:00','L',8.804,4402,'B747'); -insert into FLIGHTS values ('AA1118',1,'HNL','13:30:00','AKL','21:18:00','D',8.804,4402,'DC10'); -insert into FLIGHTS values ('AA1119',1,'AKL','09:00:00','NRT','15:59:00','L',10.996,5498,'B747'); -insert into FLIGHTS values ('AA1120',1,'NRT','09:00:00','AKL','23:59:00','L',10.996,5498,'B747'); -insert into FLIGHTS values ('AA1121',1,'AKL','09:00:00','SYD','09:40:00','B',2.682,1341,'B747'); -insert into FLIGHTS values ('AA1122',1,'SYD','09:00:00','AKL','13:40:00','L',2.682,1341,'B747'); -insert into FLIGHTS values ('AA1123',1,'ALB','09:00:00','JFK','09:16:00','S',0.27,135,'DC10'); -insert into FLIGHTS values ('AA1124',1,'JFK','09:00:00','ALB','09:16:00','S',0.27,135,'DC10'); -insert into FLIGHTS values ('AA1125',1,'ALB','07:00:00','BOS','07:16:00','S',0.278,139,'B747'); -insert into FLIGHTS values ('AA1126',1,'BOS','14:00:00','ALB','14:16:00','S',0.278,139,'B747'); -insert into FLIGHTS values ('AA1127',1,'ALB','09:00:00','IAD','09:32:00','S',0.548,274,'B747'); -insert into FLIGHTS values ('AA1128',1,'IAD','09:00:00','ALB','09:32:00','S',0.548,274,'B747'); -insert into FLIGHTS values ('US1517',1,'AMS','09:00:00','JFK','10:17:00','B',7.296,3648,'B747'); -insert into FLIGHTS values ('US1516',2,'JFK','20:59:00','AMS','10:16:00','L',7.296,3648,'B747'); -insert into FLIGHTS values ('AA1131',1,'AMS','09:00:00','ATH','12:41:00','L',2.688,1344,'B747'); -insert into FLIGHTS values ('AA1132',1,'ATH','09:00:00','AMS','10:41:00','B',2.688,1344,'B747'); -insert into FLIGHTS values ('AA1133',1,'AMS','09:00:00','CDG','09:31:00','S',0.532,266,'B747'); -insert into FLIGHTS values ('AA1134',1,'CDG','09:00:00','AMS','09:31:00','S',0.532,266,'B747'); -insert into FLIGHTS values ('AA1135',1,'ARN','09:00:00','BOS','11:07:00','L',8.126,4063,'B747'); -insert into FLIGHTS values ('AA1136',1,'BOS','22:00:00','ARN','12:07:00','L',8.126,4063,'B747'); -insert into FLIGHTS values ('AA1137',1,'ARN','09:00:00','SVO','12:51:00','B',1.858,929,'A320'); -insert into FLIGHTS values ('AA1138',2,'SVO','16:00:00','ARN','15:51:00','S',1.858,929,'A320'); -insert into FLIGHTS values ('AA1139',1,'ARN','09:00:00','CPH','09:59:00','S',0.988,494,'B747'); -insert into FLIGHTS values ('AA1140',1,'CPH','09:00:00','ARN','09:59:00','S',0.988,494,'B747'); -insert into FLIGHTS values ('AA1141',1,'ATH','09:00:00','LHR','09:58:00','B',2.974,1487,'B747'); -insert into FLIGHTS values ('AA1142',1,'LHR','09:00:00','ATH','13:58:00','L',2.974,1487,'B747'); -insert into FLIGHTS values ('AA1143',1,'ATH','09:00:00','CAI','10:23:00','B',1.394,697,'B747'); -insert into FLIGHTS values ('AA1144',1,'CAI','09:00:00','ATH','10:23:00','B',1.394,697,'B747'); -insert into FLIGHTS values ('AA1145',1,'ATH','09:00:00','CDG','10:36:00','B',2.608,1304,'B747'); -insert into FLIGHTS values ('AA1146',1,'CDG','09:00:00','ATH','12:36:00','L',2.608,1304,'B747'); -insert into FLIGHTS values ('AA1147',1,'ATL','09:00:00','LAX','09:52:00','B',3.87,1935,'B747'); -insert into FLIGHTS values ('AA1148',1,'LAX','09:00:00','ATL','15:52:00','L',3.87,1935,'B747'); -insert into FLIGHTS values ('AA1149',1,'ATL','09:00:00','DFW','09:26:00','B',1.442,721,'B747'); -insert into FLIGHTS values ('AA1150',1,'DFW','09:00:00','ATL','11:26:00','B',1.442,721,'B747'); -insert into FLIGHTS values ('AA1151',1,'ATL','09:00:00','SEA','10:21:00','B',4.36,2180,'B747'); -insert into FLIGHTS values ('AA1152',1,'SEA','12:00:00','ATL','19:21:00','L',4.36,2180,'B747'); -insert into FLIGHTS values ('AA1153',1,'BEY','09:00:00','CAI','09:43:00','S',0.726,363,'B747'); -insert into FLIGHTS values ('AA1154',1,'CAI','11:00:00','BEY','11:43:00','S',0.726,363,'B747'); -insert into FLIGHTS values ('AA1270',1,'BEY','09:00:00','MAD','12:22:00','L',4.376,2188,'B747'); -insert into FLIGHTS values ('AA1269',2,'MAD','12:25:00','BEY','17:47:00','L',4.376,2188,'B747'); -insert into FLIGHTS values ('AA1157',1,'BEY','09:00:00','BOM','17:31:00','L',5.026,2513,'B747'); -insert into FLIGHTS values ('AA1158',1,'BOM','09:00:00','BEY','10:31:00','L',5.026,2513,'B747'); -insert into FLIGHTS values ('AA1159',1,'BNA','09:00:00','MIA','11:37:00','B',1.63,815,'B747'); -insert into FLIGHTS values ('AA1160',1,'MIA','09:00:00','BNA','09:37:00','B',1.63,815,'B747'); -insert into FLIGHTS values ('AA1161',1,'BNA','09:00:00','JFK','11:31:00','L',1.518,759,'B747'); -insert into FLIGHTS values ('AA1162',1,'JFK','09:00:00','BNA','09:31:00','L',1.518,759,'B747'); -insert into FLIGHTS values ('AA1163',1,'BNA','09:00:00','CHS','10:54:00','B',0.91,455,'B747'); -insert into FLIGHTS values ('AA1164',1,'GIG','09:00:00','BNA','15:57:00','L',9.964,4982,'B747'); -insert into FLIGHTS values ('US1591',1,'BOG','09:00:00','MIA','12:02:00','L',3.04,1520,'DC10'); -insert into FLIGHTS values ('AA1190',2,'MIA','12:13:00','BOG','15:15:00','L',3.04,1520,'B747'); -insert into FLIGHTS values ('AA1167',1,'BOG','09:00:00','LIM','11:20:00','B',2.338,1169,'B747'); -insert into FLIGHTS values ('AA1168',1,'LIM','08:00:00','BOG','10:20:00','B',2.338,1169,'B747'); -insert into FLIGHTS values ('AA1169',1,'BOG','09:00:00','GIG','16:38:00','L',5.648,2824,'B747'); -insert into FLIGHTS values ('AA1170',1,'GIG','09:00:00','BOG','12:38:00','L',5.648,2824,'B747'); -insert into FLIGHTS values ('AA1171',1,'BOI','09:00:00','SEA','08:48:00','S',0.808,404,'B747'); -insert into FLIGHTS values ('AA1172',1,'SEA','09:00:00','BOI','10:48:00','S',0.808,404,'B747'); -insert into FLIGHTS values ('AA1173',1,'BOI','09:00:00','DSM','12:18:00','L',2.31,1155,'A320'); -insert into FLIGHTS values ('AA1174',1,'DSM','09:00:00','BOI','10:18:00','B',2.31,1155,'A320'); -insert into FLIGHTS values ('AA1175',1,'BOI','09:00:00','HLN','09:34:00','S',0.58,290,'B747'); -insert into FLIGHTS values ('AA1176',1,'HLN','09:00:00','BOI','09:34:00','S',0.58,290,'B747'); -insert into FLIGHTS values ('AA1177',1,'BOM','09:00:00','CCU','11:03:00','B',2.066,1033,'B747'); -insert into FLIGHTS values ('AA1178',1,'CCU','09:00:00','BOM','11:03:00','B',2.066,1033,'B747'); -insert into FLIGHTS values ('AA1179',1,'BOM','09:00:00','KHI','09:36:00','B',1.102,551,'B747'); -insert into FLIGHTS values ('AA1180',1,'KHI','09:00:00','BOM','10:36:00','B',1.102,551,'B747'); -insert into FLIGHTS values ('AA1181',1,'BOM','09:00:00','HKG','16:51:00','L',5.354,2677,'B747'); -insert into FLIGHTS values ('AA1182',2,'HKG','11:15:00','BOM','14:06:00','L',5.354,2677,'B747'); -insert into FLIGHTS values ('AA1183',1,'BOS','09:00:00','SFO','11:23:00','L',5.39,2695,'B747'); -insert into FLIGHTS values ('AA1184',1,'SFO','09:00:00','BOS','17:23:00','L',5.39,2695,'B747'); -insert into FLIGHTS values ('AA1185',1,'BOS','09:00:00','MIA','11:31:00','B',2.518,1259,'B747'); -insert into FLIGHTS values ('AA1186',2,'MIA','10:40:00','BOS','13:11:00','L',2.518,1259,'B747'); -insert into FLIGHTS values ('AA1187',1,'BOS','09:00:00','IAD','09:29:00','S',0.49,245,'B747'); -insert into FLIGHTS values ('AA1188',1,'IAD','09:00:00','BOS','09:29:00','S',0.49,245,'B747'); -insert into FLIGHTS values ('AA1189',1,'BUD','09:00:00','GVA','10:13:00','B',1.232,616,'B747'); -insert into FLIGHTS values ('AA1190',1,'GVA','09:00:00','BUD','10:13:00','B',1.232,616,'B747'); -insert into FLIGHTS values ('AA1191',1,'BUD','09:00:00','SVO','12:56:00','L',1.946,973,'B747'); -insert into FLIGHTS values ('AA1192',1,'SVO','09:00:00','BUD','08:56:00','B',1.946,973,'B747'); -insert into FLIGHTS values ('AA1193',1,'BUD','09:00:00','FCO','10:00:00','B',1.008,504,'B747'); -insert into FLIGHTS values ('AA1194',1,'FCO','09:00:00','BUD','10:00:00','B',1.008,504,'B747'); -insert into FLIGHTS values ('AA1195',1,'CAI','09:00:00','CAS','11:33:00','B',4.562,2281,'B747'); -insert into FLIGHTS values ('AA1196',1,'MIA','09:00:00','CAI','04:59:00','D',12.984,6492,'B747'); -insert into FLIGHTS values ('AA1197',1,'CAI','09:00:00','IST','10:32:00','B',1.538,769,'B747'); -insert into FLIGHTS values ('AA1198',1,'IST','09:00:00','CAI','10:32:00','B',1.538,769,'B747'); -insert into FLIGHTS values ('AA1199',1,'CAI','09:00:00','KBL','16:27:00','L',4.454,2227,'B747'); -insert into FLIGHTS values ('AA1200',1,'GIG','09:00:00','CAI','02:18:00','D',12.308,6154,'B747'); -insert into FLIGHTS values ('AA1201',1,'CAS','09:00:00','KHI','22:54:00','L',8.9,4450,'B747'); -insert into FLIGHTS values ('AA1202',1,'KHI','09:00:00','CAS','12:54:00','L',8.9,4450,'B747'); -insert into FLIGHTS values ('AA1203',1,'CAS','09:00:00','LOS','14:00:00','L',4.006,2003,'B747'); -insert into FLIGHTS values ('AA1204',1,'LOS','09:00:00','CAS','12:00:00','L',4.006,2003,'B747'); -insert into FLIGHTS values ('AA1205',1,'CAS','09:00:00','MAD','11:02:00','B',1.036,518,'B747'); -insert into FLIGHTS values ('AA1206',1,'MAD','09:00:00','CAS','09:02:00','B',1.036,518,'B747'); -insert into FLIGHTS values ('AA1207',1,'CCS','09:00:00','SCL','16:05:00','L',6.098,3049,'B747'); -insert into FLIGHTS values ('AA1208',1,'SCL','09:00:00','CCS','14:05:00','L',6.098,3049,'B747'); -insert into FLIGHTS values ('AA1209',1,'CCS','09:00:00','MEX','11:28:00','L',4.47,2235,'B747'); -insert into FLIGHTS values ('AA1210',1,'MEX','09:00:00','CCS','15:28:00','L',4.47,2235,'B747'); -insert into FLIGHTS values ('AA1211',1,'CCS','09:00:00','BUE','17:20:00','L',6.336,3168,'B747'); -insert into FLIGHTS values ('AA1212',1,'BUE','09:00:00','CCS','13:20:00','L',6.336,3168,'B747'); -insert into FLIGHTS values ('AA1213',1,'CCU','09:00:00','HKG','14:47:00','L',3.294,1647,'B747'); -insert into FLIGHTS values ('AA1214',2,'HKG','10:30:00','CCU','11:17:00','L',3.294,1647,'B747'); -insert into FLIGHTS values ('AA1215',1,'CCU','09:00:00','NRT','18:53:00','L',6.396,3198,'B747'); -insert into FLIGHTS values ('AA1216',1,'NRT','09:00:00','CCU','11:53:00','L',6.396,3198,'B747'); -insert into FLIGHTS values ('AA1217',1,'CCU','09:00:00','SIN','15:06:00','L',3.6,1800,'B747'); -insert into FLIGHTS values ('AA1218',1,'SIN','09:00:00','CCU','10:06:00','L',3.6,1800,'B747'); -insert into FLIGHTS values ('AA1219',1,'CDG','09:00:00','LHR','08:25:00','S',0.422,211,'B747'); -insert into FLIGHTS values ('AA1220',1,'LHR','09:00:00','CDG','10:25:00','S',0.422,211,'B747'); -insert into FLIGHTS values ('AA1221',1,'CDG','18:00:00','JFK','19:15:00','D',7.258,3629,'B747'); -insert into FLIGHTS values ('AA1222',1,'JFK','09:00:00','CDG','22:15:00','L',7.258,3629,'B747'); -insert into FLIGHTS values ('AA1223',2,'CDG','13:40:00','SVO','18:45:00','L',3.09,1545,'B747'); -insert into FLIGHTS values ('AA1224',1,'SVO','09:00:00','CDG','10:05:00','B',3.09,1545,'B747'); -insert into FLIGHTS values ('AA1225',1,'CHS','09:00:00','ATL','09:31:00','S',0.532,266,'B747'); -insert into FLIGHTS values ('AA1226',1,'ATL','09:00:00','CHS','09:31:00','S',0.532,266,'B747'); -insert into FLIGHTS values ('AA1227',1,'CHS','11:00:00','MCI','11:51:00','S',1.856,928,'B747'); -insert into FLIGHTS values ('AA1228',1,'MCI','09:00:00','CHS','11:51:00','L',1.856,928,'B747'); -insert into FLIGHTS values ('AA1229',1,'CHS','09:00:00','MSY','09:15:00','L',1.256,628,'B747'); -insert into FLIGHTS values ('AA1230',1,'MSY','09:00:00','CHS','11:15:00','L',1.256,628,'B747'); -insert into FLIGHTS values ('AA1231',1,'CLE','09:00:00','LAX','10:05:00','L',4.092,2046,'B747'); -insert into FLIGHTS values ('AA1232',1,'LAX','09:00:00','CLE','16:05:00','L',4.092,2046,'B747'); -insert into FLIGHTS values ('AA1233',1,'CLE','09:00:00','DFW','10:03:00','L',2.052,1026,'B747'); -insert into FLIGHTS values ('AA1234',1,'DFW','09:00:00','CLE','12:03:00','L',2.052,1026,'B747'); -insert into FLIGHTS values ('AA1235',1,'CLE','09:00:00','MDW','08:37:00','S',0.618,309,'B747'); -insert into FLIGHTS values ('AA1236',1,'MDW','09:00:00','CLE','10:37:00','S',0.618,309,'B747'); -insert into FLIGHTS values ('AA1237',1,'CPH','09:00:00','FCO','10:54:00','L',1.904,952,'B747'); -insert into FLIGHTS values ('AA1238',1,'FCO','09:00:00','CPH','10:54:00','L',1.904,952,'B747'); -insert into FLIGHTS values ('AA1239',1,'CPH','09:00:00','REY','10:37:00','L',2.622,1311,'B747'); -insert into FLIGHTS values ('AA1240',1,'REY','09:00:00','CPH','12:37:00','L',2.622,1311,'B747'); -insert into FLIGHTS values ('AA1241',1,'CPH','09:00:00','CDG','10:16:00','L',1.276,638,'B747'); -insert into FLIGHTS values ('AA1242',1,'CDG','09:00:00','CPH','10:16:00','L',1.276,638,'B747'); -insert into FLIGHTS values ('AA1243',1,'CPT','09:00:00','LOS','13:55:00','L',5.92,2960,'B747'); -insert into FLIGHTS values ('AA1244',1,'LOS','09:00:00','CPT','15:55:00','L',5.92,2960,'B747'); -insert into FLIGHTS values ('AA1245',1,'CPT','09:00:00','NBO','15:06:00','L',5.102,2551,'DC10'); -insert into FLIGHTS values ('AA1246',1,'NBO','09:00:00','CPT','13:06:00','L',5.102,2551,'DC10'); -insert into FLIGHTS values ('AA1247',1,'CPT','09:00:00','LHR','19:01:00','L',12.026,6013,'B747'); -insert into FLIGHTS values ('AA1248',1,'LHR','09:00:00','CPT','23:01:00','L',12.026,6013,'B747'); -insert into FLIGHTS values ('AA1249',2,'DEN','10:30:00','SEA','11:32:00','L',2.04,1020,'B747'); -insert into FLIGHTS values ('AA1250',1,'SEA','09:00:00','DEN','12:02:00','L',2.04,1020,'B747'); -insert into FLIGHTS values ('AA1251',2,'DEN','10:03:00','BOI','11:19:00','L',1.276,638,'B747'); -insert into FLIGHTS values ('AA1252',1,'BOI','09:00:00','DEN','10:16:00','L',1.276,638,'B747'); -insert into FLIGHTS values ('AA1253',1,'DEN','09:00:00','JFK','14:15:00','L',3.258,1629,'B747'); -insert into FLIGHTS values ('AA1254',1,'JFK','09:00:00','DEN','10:15:00','L',3.258,1629,'B747'); -insert into FLIGHTS values ('AA1255',1,'DFW','09:00:00','SAT','09:30:00','S',0.506,253,'B747'); -insert into FLIGHTS values ('AA1256',1,'SAT','09:00:00','DFW','09:30:00','S',0.506,253,'B747'); -insert into FLIGHTS values ('AA1257',1,'DFW','09:00:00','ATL','11:26:00','L',1.442,721,'B747'); -insert into FLIGHTS values ('AA1258',2,'ATL','11:05:00','DFW','11:31:00','L',1.442,721,'B747'); -insert into FLIGHTS values ('AA1259',1,'DFW','09:00:00','MIA','12:13:00','L',2.218,1109,'B747'); -insert into FLIGHTS values ('AA1260',1,'MIA','09:00:00','DFW','10:13:00','L',2.218,1109,'B747'); -insert into FLIGHTS values ('AA1261',1,'DSM','09:00:00','MDW','09:36:00','S',0.612,306,'B747'); -insert into FLIGHTS values ('AA1262',1,'MDW','09:00:00','DSM','09:36:00','S',0.612,306,'B747'); -insert into FLIGHTS values ('AA1263',1,'DSM','09:00:00','SLC','09:53:00','L',1.9,950,'B747'); -insert into FLIGHTS values ('AA1264',1,'SLC','09:00:00','DSM','11:53:00','L',1.9,950,'B747'); -insert into FLIGHTS values ('AA1265',1,'DSM','09:00:00','OKC','09:56:00','L',0.94,470,'B747'); -insert into FLIGHTS values ('AA1266',1,'OKC','09:00:00','DSM','09:56:00','L',0.94,470,'B747'); -insert into FLIGHTS values ('AA1267',1,'DUB','09:00:00','LHR','09:34:00','S',0.574,287,'B747'); -insert into FLIGHTS values ('AA1268',1,'LHR','09:00:00','DUB','09:34:00','S',0.574,287,'B747'); -insert into FLIGHTS values ('AA1269',1,'DUB','09:00:00','MAD','11:48:00','L',1.804,902,'B747'); -insert into FLIGHTS values ('AA1270',2,'MAD','13:10:00','DUB','13:58:00','L',1.804,902,'B747'); -insert into FLIGHTS values ('AA1271',1,'DUB','09:00:00','CDG','10:57:00','L',0.966,483,'B747'); -insert into FLIGHTS values ('AA1272',1,'CDG','09:00:00','DUB','08:57:00','L',0.966,483,'B747'); -insert into FLIGHTS values ('AA1273',1,'BUE','09:00:00','SCL','09:24:00','L',1.408,704,'B747'); -insert into FLIGHTS values ('AA1274',1,'SCL','09:00:00','BUE','11:24:00','L',1.408,704,'B747'); -insert into FLIGHTS values ('AA1275',1,'BUE','09:00:00','GRU','10:05:00','L',2.09,1045,'B747'); -insert into FLIGHTS values ('AA1276',1,'GRU','09:00:00','BUE','12:05:00','L',2.09,1045,'B747'); -insert into FLIGHTS values ('US1509',1,'BUE','23:00:00','MIA','04:49:00','L',8.826,4413,'B747'); -insert into FLIGHTS values ('US1508',2,'MIA','18:30:00','BUE','06:19:00','L',8.826,4413,'B747'); -insert into FLIGHTS values ('AA1279',1,'FAI','09:00:00','JNU','10:15:00','L',1.254,627,'B747'); -insert into FLIGHTS values ('AA1280',1,'JNU','09:00:00','FAI','10:15:00','L',1.254,627,'B747'); -insert into FLIGHTS values ('AA1281',1,'FAI','09:00:00','SEA','13:02:00','L',3.038,1519,'B747'); -insert into FLIGHTS values ('AA1282',1,'SEA','09:00:00','FAI','11:02:00','L',3.038,1519,'B747'); -insert into FLIGHTS values ('US1443',1,'FAI','09:00:00','NRT','10:01:00','L',7.026,3513,'B747'); -insert into FLIGHTS values ('US1444',2,'NRT','14:05:00','FAI','03:06:00','L',7.026,3513,'B747'); -insert into FLIGHTS values ('AA1285',1,'FCO','09:00:00','CDG','10:22:00','L',1.376,688,'B747'); -insert into FLIGHTS values ('AA1286',1,'CDG','09:00:00','FCO','10:22:00','L',1.376,688,'B747'); -insert into FLIGHTS values ('AA1287',1,'FCO','09:00:00','CAI','12:39:00','L',2.654,1327,'B747'); -insert into FLIGHTS values ('AA1288',1,'CAI','09:00:00','FCO','10:39:00','L',2.654,1327,'B747'); -insert into FLIGHTS values ('AA1289',1,'FCO','13:00:00','JFK','15:34:00','L',8.57,4285,'B747'); -insert into FLIGHTS values ('AA1290',1,'JFK','23:00:00','FCO','13:34:00','L',8.57,4285,'B747'); -insert into FLIGHTS values ('AA1291',1,'GIG','13:00:00','MIA','19:22:00','L',8.37,4185,'B747'); -insert into FLIGHTS values ('AA1292',1,'MIA','13:00:00','GIG','23:22:00','L',8.37,4185,'B747'); -insert into FLIGHTS values ('AA1293',1,'GIG','09:00:00','LIM','11:41:00','L',4.694,2347,'B747'); -insert into FLIGHTS values ('AA1294',1,'LIM','15:00:00','GIG','21:41:00','L',4.694,2347,'B747'); -insert into FLIGHTS values ('AA1295',1,'GIG','09:00:00','BUE','12:26:00','L',2.44,1220,'B747'); -insert into FLIGHTS values ('AA1296',1,'BUE','09:00:00','GIG','10:26:00','L',2.44,1220,'B747'); -insert into FLIGHTS values ('US1249',1,'GRU','09:00:00','CCS','13:26:00','L',5.448,2724,'B747'); -insert into FLIGHTS values ('US1250',1,'CCS','09:00:00','GRU','15:26:00','L',5.448,2724,'B747'); -insert into FLIGHTS values ('US1251',1,'GRU','09:00:00','JFK','16:33:00','L',9.556,4778,'B747'); -insert into FLIGHTS values ('US1252',1,'JFK','09:00:00','GRU','20:33:00','L',9.556,4778,'B747'); -insert into FLIGHTS values ('US1253',1,'GRU','09:00:00','LAX','16:19:00','L',12.322,6161,'B747'); -insert into FLIGHTS values ('US1254',1,'LAX','09:00:00','GRU','02:19:00','L',12.322,6161,'B747'); -insert into FLIGHTS values ('AA1053',1,'GRU','09:00:00','LIM','11:17:00','L',4.298,2149,'B747'); -insert into FLIGHTS values ('AA1054',1,'LIM','14:00:00','GRU','20:17:00','L',4.298,2149,'B747'); -insert into FLIGHTS values ('US1255',1,'GVA','09:00:00','CPH','10:25:00','L',1.422,711,'B747'); -insert into FLIGHTS values ('US1256',1,'CPH','09:00:00','GVA','10:25:00','L',1.422,711,'B747'); -insert into FLIGHTS values ('US1257',1,'GVA','09:00:00','LIS','09:52:00','L',1.868,934,'B747'); -insert into FLIGHTS values ('US1258',1,'LIS','09:00:00','GVA','11:52:00','L',1.868,934,'B747'); -insert into FLIGHTS values ('US1259',1,'GVA','09:00:00','OSL','10:56:00','L',1.934,967,'B747'); -insert into FLIGHTS values ('US1260',1,'OSL','09:00:00','GVA','10:56:00','L',1.934,967,'B747'); -insert into FLIGHTS values ('AA1181',2,'HKG','17:15:00','SHA','18:45:00','L',1.514,757,'B747'); -insert into FLIGHTS values ('AA1182',1,'SHA','09:00:00','HKG','10:30:00','L',1.514,757,'B747'); -insert into FLIGHTS values ('US1266',2,'HKG','11:15:00','SIN','14:27:00','L',3.214,1607,'B747'); -insert into FLIGHTS values ('US1264',1,'SIN','09:00:00','HKG','12:12:00','L',3.214,1607,'B747'); -insert into FLIGHTS values ('US1264',2,'HKG','13:00:00','SEL','16:36:00','L',2.612,1306,'B747'); -insert into FLIGHTS values ('US1266',1,'SEL','09:00:00','HKG','10:36:00','L',2.612,1306,'B747'); -insert into FLIGHTS values ('US1267',1,'HLN','09:00:00','SEA','08:58:00','L',0.978,489,'B747'); -insert into FLIGHTS values ('US1268',1,'SEA','09:00:00','HLN','10:58:00','L',0.978,489,'B747'); -insert into FLIGHTS values ('US1269',1,'HLN','09:00:00','BOI','09:34:00','S',0.58,290,'B747'); -insert into FLIGHTS values ('US1270',1,'BOI','09:00:00','HLN','09:34:00','S',0.58,290,'B747'); -insert into FLIGHTS values ('US1271',1,'HLN','09:00:00','DEN','10:11:00','L',1.184,592,'B747'); -insert into FLIGHTS values ('US1272',1,'DEN','09:00:00','HLN','10:11:00','L',1.184,592,'B747'); -insert into FLIGHTS values ('US1276',2,'HNL','12:30:00','NRT','15:12:00','L',7.708,3854,'B747'); -insert into FLIGHTS values ('US1274',1,'NRT','09:00:00','HNL','21:42:00','L',7.708,3854,'B747'); -insert into FLIGHTS values ('US1274',2,'HNL','22:30:00','SFO','05:17:00','L',4.794,2397,'B747'); -insert into FLIGHTS values ('US1276',1,'SFO','09:00:00','HNL','11:47:00','L',4.794,2397,'B747'); -insert into FLIGHTS values ('US1277',1,'HNL','13:00:00','SYD','20:09:00','L',10.16,5080,'B747'); -insert into FLIGHTS values ('US1278',1,'SYD','09:00:00','HNL','22:09:00','L',10.16,5080,'B747'); -insert into FLIGHTS values ('AA1251',1,'HOU','09:00:00','DEN','09:45:00','L',1.756,878,'B747'); -insert into FLIGHTS values ('AA1252',2,'DEN','10:55:00','HOU','13:40:00','L',1.756,878,'B747'); -insert into FLIGHTS values ('US1281',1,'HOU','09:00:00','SAT','09:22:00','S',0.378,189,'B747'); -insert into FLIGHTS values ('US1282',1,'SAT','09:00:00','HOU','09:22:00','S',0.378,189,'B747'); -insert into FLIGHTS values ('US1283',1,'HOU','09:00:00','IAD','12:56:00','L',2.936,1468,'B747'); -insert into FLIGHTS values ('US1284',1,'IAD','09:00:00','HOU','10:56:00','L',2.936,1468,'B747'); -insert into FLIGHTS values ('US1285',1,'IAD','09:00:00','BOS','09:29:00','S',0.49,245,'B747'); -insert into FLIGHTS values ('US1286',1,'BOS','09:00:00','IAD','09:29:00','S',0.49,245,'B747'); -insert into FLIGHTS values ('US1287',1,'IAD','09:00:00','MSP','09:49:00','L',1.83,915,'B747'); -insert into FLIGHTS values ('US1288',1,'MSP','09:00:00','IAD','11:49:00','L',1.83,915,'B747'); -insert into FLIGHTS values ('US1289',1,'IAD','09:00:00','MIA','11:02:00','L',2.048,1024,'B747'); -insert into FLIGHTS values ('US1290',1,'MIA','09:00:00','IAD','11:02:00','L',2.048,1024,'B747'); -insert into FLIGHTS values ('US1291',1,'IST','09:00:00','THR','13:02:00','L',2.538,1269,'B747'); -insert into FLIGHTS values ('US1292',1,'THR','09:00:00','IST','10:02:00','L',2.538,1269,'B747'); -insert into FLIGHTS values ('US1293',1,'IST','09:00:00','FCO','09:42:00','L',1.71,855,'B747'); -insert into FLIGHTS values ('US1294',1,'FCO','09:00:00','IST','11:42:00','L',1.71,855,'B747'); -insert into FLIGHTS values ('US1295',1,'IST','09:00:00','ATH','09:41:00','S',0.698,349,'B747'); -insert into FLIGHTS values ('US1296',1,'ATH','09:00:00','IST','09:41:00','S',0.698,349,'B747'); -insert into FLIGHTS values ('US1381',2,'JFK','12:00:00','CDG','01:15:00','L',7.258,3629,'B747'); -insert into FLIGHTS values ('US1382',1,'CDG','09:00:00','JFK','10:15:00','L',7.258,3629,'B747'); -insert into FLIGHTS values ('US1349',2,'JFK','13:49:00','LAX','15:42:00','L',4.896,2448,'B747'); -insert into FLIGHTS values ('US1300',1,'LAX','09:00:00','JFK','16:53:00','L',4.896,2448,'B747'); -insert into FLIGHTS values ('US1301',1,'JFK','09:00:00','GRU','20:33:00','L',9.556,4778,'B747'); -insert into FLIGHTS values ('US1302',1,'GRU','09:00:00','JFK','16:33:00','L',9.556,4778,'B747'); -insert into FLIGHTS values ('US1303',1,'JKT','09:00:00','HKG','14:03:00','L',4.054,2027,'B747'); -insert into FLIGHTS values ('US1304',1,'HKG','09:00:00','JKT','12:03:00','L',4.054,2027,'B747'); -insert into FLIGHTS values ('US1308',2,'JKT','13:35:00','SYD','00:25:00','L',6.844,3422,'B747'); -insert into FLIGHTS values ('US1307',1,'SYD','09:00:00','JKT','11:50:00','L',6.844,3422,'B747'); -insert into FLIGHTS values ('US1307',2,'JKT','12:15:00','TPE','17:59:00','L',4.748,2374,'B747'); -insert into FLIGHTS values ('US1308',1,'TPE','09:00:00','JKT','12:44:00','L',4.748,2374,'B747'); -insert into FLIGHTS values ('US1309',1,'JNU','09:00:00','SEA','11:46:00','L',1.782,891,'B747'); -insert into FLIGHTS values ('US1310',1,'SEA','09:00:00','JNU','09:46:00','L',1.782,891,'B747'); -insert into FLIGHTS values ('US1311',1,'JNU','09:00:00','SFO','13:02:00','L',3.034,1517,'B747'); -insert into FLIGHTS values ('US1312',1,'SFO','09:00:00','JNU','11:02:00','L',3.034,1517,'B747'); -insert into FLIGHTS values ('US1313',1,'JNU','09:00:00','HNL','13:37:00','L',5.626,2813,'B747'); -insert into FLIGHTS values ('US1314',1,'HNL','09:00:00','JNU','15:37:00','L',5.626,2813,'B747'); -insert into FLIGHTS values ('US1315',1,'KBL','09:00:00','KHI','10:21:00','L',1.358,679,'B747'); -insert into FLIGHTS values ('US1316',1,'KHI','09:00:00','KBL','10:21:00','L',1.358,679,'B747'); -insert into FLIGHTS values ('US1317',1,'KBL','09:00:00','IST','10:26:00','L',4.448,2224,'B747'); -insert into FLIGHTS values ('US1318',1,'IST','09:00:00','KBL','16:26:00','L',4.448,2224,'B747'); +insert into FLIGHTS values ('AA1111',1,'ABQ','09:00:00','LAX','09:19:00','S',1.328,664,'B747'); +insert into FLIGHTS values ('AA1112',1,'LAX','09:00:00','ABQ','11:19:00','S',1.328,664,'B747'); +insert into FLIGHTS values ('AA1113',1,'ABQ','09:00:00','PHX','09:39:00','S',0.658,329,'B747'); +insert into FLIGHTS values ('AA1114',1,'PHX','09:00:00','ABQ','09:39:00','S',0.658,329,'B747'); +insert into FLIGHTS values ('AA1115',1,'ABQ','09:00:00','OKC','11:02:00','B',1.034,517,'B747'); +insert into FLIGHTS values ('AA1116',1,'OKC','09:00:00','ABQ','09:02:00','B',1.034,517,'B747'); +insert into FLIGHTS values ('AA1117',1,'AKL','09:00:00','HNL','18:48:00','L',8.804,4402,'B747'); +insert into FLIGHTS values ('AA1118',1,'HNL','13:30:00','AKL','21:18:00','D',8.804,4402,'DC10'); +insert into FLIGHTS values ('AA1119',1,'AKL','09:00:00','NRT','15:59:00','L',10.996,5498,'B747'); +insert into FLIGHTS values ('AA1120',1,'NRT','09:00:00','AKL','23:59:00','L',10.996,5498,'B747'); +insert into FLIGHTS values ('AA1121',1,'AKL','09:00:00','SYD','09:40:00','B',2.682,1341,'B747'); +insert into FLIGHTS values ('AA1122',1,'SYD','09:00:00','AKL','13:40:00','L',2.682,1341,'B747'); +insert into FLIGHTS values ('AA1123',1,'ALB','09:00:00','JFK','09:16:00','S',0.27,135,'DC10'); +insert into FLIGHTS values ('AA1124',1,'JFK','09:00:00','ALB','09:16:00','S',0.27,135,'DC10'); +insert into FLIGHTS values ('AA1125',1,'ALB','07:00:00','BOS','07:16:00','S',0.278,139,'B747'); +insert into FLIGHTS values ('AA1126',1,'BOS','14:00:00','ALB','14:16:00','S',0.278,139,'B747'); +insert into FLIGHTS values ('AA1127',1,'ALB','09:00:00','IAD','09:32:00','S',0.548,274,'B747'); +insert into FLIGHTS values ('AA1128',1,'IAD','09:00:00','ALB','09:32:00','S',0.548,274,'B747'); +insert into FLIGHTS values ('US1517',1,'AMS','09:00:00','JFK','10:17:00','B',7.296,3648,'B747'); +insert into FLIGHTS values ('US1516',2,'JFK','20:59:00','AMS','10:16:00','L',7.296,3648,'B747'); +insert into FLIGHTS values ('AA1131',1,'AMS','09:00:00','ATH','12:41:00','L',2.688,1344,'B747'); +insert into FLIGHTS values ('AA1132',1,'ATH','09:00:00','AMS','10:41:00','B',2.688,1344,'B747'); +insert into FLIGHTS values ('AA1133',1,'AMS','09:00:00','CDG','09:31:00','S',0.532,266,'B747'); +insert into FLIGHTS values ('AA1134',1,'CDG','09:00:00','AMS','09:31:00','S',0.532,266,'B747'); +insert into FLIGHTS values ('AA1135',1,'ARN','09:00:00','BOS','11:07:00','L',8.126,4063,'B747'); +insert into FLIGHTS values ('AA1136',1,'BOS','22:00:00','ARN','12:07:00','L',8.126,4063,'B747'); +insert into FLIGHTS values ('AA1137',1,'ARN','09:00:00','SVO','12:51:00','B',1.858,929,'A320'); +insert into FLIGHTS values ('AA1138',2,'SVO','16:00:00','ARN','15:51:00','S',1.858,929,'A320'); +insert into FLIGHTS values ('AA1139',1,'ARN','09:00:00','CPH','09:59:00','S',0.988,494,'B747'); +insert into FLIGHTS values ('AA1140',1,'CPH','09:00:00','ARN','09:59:00','S',0.988,494,'B747'); +insert into FLIGHTS values ('AA1141',1,'ATH','09:00:00','LHR','09:58:00','B',2.974,1487,'B747'); +insert into FLIGHTS values ('AA1142',1,'LHR','09:00:00','ATH','13:58:00','L',2.974,1487,'B747'); +insert into FLIGHTS values ('AA1143',1,'ATH','09:00:00','CAI','10:23:00','B',1.394,697,'B747'); +insert into FLIGHTS values ('AA1144',1,'CAI','09:00:00','ATH','10:23:00','B',1.394,697,'B747'); +insert into FLIGHTS values ('AA1145',1,'ATH','09:00:00','CDG','10:36:00','B',2.608,1304,'B747'); +insert into FLIGHTS values ('AA1146',1,'CDG','09:00:00','ATH','12:36:00','L',2.608,1304,'B747'); +insert into FLIGHTS values ('AA1147',1,'ATL','09:00:00','LAX','09:52:00','B',3.87,1935,'B747'); +insert into FLIGHTS values ('AA1148',1,'LAX','09:00:00','ATL','15:52:00','L',3.87,1935,'B747'); +insert into FLIGHTS values ('AA1149',1,'ATL','09:00:00','DFW','09:26:00','B',1.442,721,'B747'); +insert into FLIGHTS values ('AA1150',1,'DFW','09:00:00','ATL','11:26:00','B',1.442,721,'B747'); +insert into FLIGHTS values ('AA1151',1,'ATL','09:00:00','SEA','10:21:00','B',4.36,2180,'B747'); +insert into FLIGHTS values ('AA1152',1,'SEA','12:00:00','ATL','19:21:00','L',4.36,2180,'B747'); +insert into FLIGHTS values ('AA1153',1,'BEY','09:00:00','CAI','09:43:00','S',0.726,363,'B747'); +insert into FLIGHTS values ('AA1154',1,'CAI','11:00:00','BEY','11:43:00','S',0.726,363,'B747'); +insert into FLIGHTS values ('AA1270',1,'BEY','09:00:00','MAD','12:22:00','L',4.376,2188,'B747'); +insert into FLIGHTS values ('AA1269',2,'MAD','12:25:00','BEY','17:47:00','L',4.376,2188,'B747'); +insert into FLIGHTS values ('AA1157',1,'BEY','09:00:00','BOM','17:31:00','L',5.026,2513,'B747'); +insert into FLIGHTS values ('AA1158',1,'BOM','09:00:00','BEY','10:31:00','L',5.026,2513,'B747'); +insert into FLIGHTS values ('AA1159',1,'BNA','09:00:00','MIA','11:37:00','B',1.63,815,'B747'); +insert into FLIGHTS values ('AA1160',1,'MIA','09:00:00','BNA','09:37:00','B',1.63,815,'B747'); +insert into FLIGHTS values ('AA1161',1,'BNA','09:00:00','JFK','11:31:00','L',1.518,759,'B747'); +insert into FLIGHTS values ('AA1162',1,'JFK','09:00:00','BNA','09:31:00','L',1.518,759,'B747'); +insert into FLIGHTS values ('AA1163',1,'BNA','09:00:00','CHS','10:54:00','B',0.91,455,'B747'); +insert into FLIGHTS values ('AA1164',1,'GIG','09:00:00','BNA','15:57:00','L',9.964,4982,'B747'); +insert into FLIGHTS values ('US1591',1,'BOG','09:00:00','MIA','12:02:00','L',3.04,1520,'DC10'); +insert into FLIGHTS values ('AA1190',2,'MIA','12:13:00','BOG','15:15:00','L',3.04,1520,'B747'); +insert into FLIGHTS values ('AA1167',1,'BOG','09:00:00','LIM','11:20:00','B',2.338,1169,'B747'); +insert into FLIGHTS values ('AA1168',1,'LIM','08:00:00','BOG','10:20:00','B',2.338,1169,'B747'); +insert into FLIGHTS values ('AA1169',1,'BOG','09:00:00','GIG','16:38:00','L',5.648,2824,'B747'); +insert into FLIGHTS values ('AA1170',1,'GIG','09:00:00','BOG','12:38:00','L',5.648,2824,'B747'); +insert into FLIGHTS values ('AA1171',1,'BOI','09:00:00','SEA','08:48:00','S',0.808,404,'B747'); +insert into FLIGHTS values ('AA1172',1,'SEA','09:00:00','BOI','10:48:00','S',0.808,404,'B747'); +insert into FLIGHTS values ('AA1173',1,'BOI','09:00:00','DSM','12:18:00','L',2.31,1155,'A320'); +insert into FLIGHTS values ('AA1174',1,'DSM','09:00:00','BOI','10:18:00','B',2.31,1155,'A320'); +insert into FLIGHTS values ('AA1175',1,'BOI','09:00:00','HLN','09:34:00','S',0.58,290,'B747'); +insert into FLIGHTS values ('AA1176',1,'HLN','09:00:00','BOI','09:34:00','S',0.58,290,'B747'); +insert into FLIGHTS values ('AA1177',1,'BOM','09:00:00','CCU','11:03:00','B',2.066,1033,'B747'); +insert into FLIGHTS values ('AA1178',1,'CCU','09:00:00','BOM','11:03:00','B',2.066,1033,'B747'); +insert into FLIGHTS values ('AA1179',1,'BOM','09:00:00','KHI','09:36:00','B',1.102,551,'B747'); +insert into FLIGHTS values ('AA1180',1,'KHI','09:00:00','BOM','10:36:00','B',1.102,551,'B747'); +insert into FLIGHTS values ('AA1181',1,'BOM','09:00:00','HKG','16:51:00','L',5.354,2677,'B747'); +insert into FLIGHTS values ('AA1182',2,'HKG','11:15:00','BOM','14:06:00','L',5.354,2677,'B747'); +insert into FLIGHTS values ('AA1183',1,'BOS','09:00:00','SFO','11:23:00','L',5.39,2695,'B747'); +insert into FLIGHTS values ('AA1184',1,'SFO','09:00:00','BOS','17:23:00','L',5.39,2695,'B747'); +insert into FLIGHTS values ('AA1185',1,'BOS','09:00:00','MIA','11:31:00','B',2.518,1259,'B747'); +insert into FLIGHTS values ('AA1186',2,'MIA','10:40:00','BOS','13:11:00','L',2.518,1259,'B747'); +insert into FLIGHTS values ('AA1187',1,'BOS','09:00:00','IAD','09:29:00','S',0.49,245,'B747'); +insert into FLIGHTS values ('AA1188',1,'IAD','09:00:00','BOS','09:29:00','S',0.49,245,'B747'); +insert into FLIGHTS values ('AA1189',1,'BUD','09:00:00','GVA','10:13:00','B',1.232,616,'B747'); +insert into FLIGHTS values ('AA1190',1,'GVA','09:00:00','BUD','10:13:00','B',1.232,616,'B747'); +insert into FLIGHTS values ('AA1191',1,'BUD','09:00:00','SVO','12:56:00','L',1.946,973,'B747'); +insert into FLIGHTS values ('AA1192',1,'SVO','09:00:00','BUD','08:56:00','B',1.946,973,'B747'); +insert into FLIGHTS values ('AA1193',1,'BUD','09:00:00','FCO','10:00:00','B',1.008,504,'B747'); +insert into FLIGHTS values ('AA1194',1,'FCO','09:00:00','BUD','10:00:00','B',1.008,504,'B747'); +insert into FLIGHTS values ('AA1195',1,'CAI','09:00:00','CAS','11:33:00','B',4.562,2281,'B747'); +insert into FLIGHTS values ('AA1196',1,'MIA','09:00:00','CAI','04:59:00','D',12.984,6492,'B747'); +insert into FLIGHTS values ('AA1197',1,'CAI','09:00:00','IST','10:32:00','B',1.538,769,'B747'); +insert into FLIGHTS values ('AA1198',1,'IST','09:00:00','CAI','10:32:00','B',1.538,769,'B747'); +insert into FLIGHTS values ('AA1199',1,'CAI','09:00:00','KBL','16:27:00','L',4.454,2227,'B747'); +insert into FLIGHTS values ('AA1200',1,'GIG','09:00:00','CAI','02:18:00','D',12.308,6154,'B747'); +insert into FLIGHTS values ('AA1201',1,'CAS','09:00:00','KHI','22:54:00','L',8.9,4450,'B747'); +insert into FLIGHTS values ('AA1202',1,'KHI','09:00:00','CAS','12:54:00','L',8.9,4450,'B747'); +insert into FLIGHTS values ('AA1203',1,'CAS','09:00:00','LOS','14:00:00','L',4.006,2003,'B747'); +insert into FLIGHTS values ('AA1204',1,'LOS','09:00:00','CAS','12:00:00','L',4.006,2003,'B747'); +insert into FLIGHTS values ('AA1205',1,'CAS','09:00:00','MAD','11:02:00','B',1.036,518,'B747'); +insert into FLIGHTS values ('AA1206',1,'MAD','09:00:00','CAS','09:02:00','B',1.036,518,'B747'); +insert into FLIGHTS values ('AA1207',1,'CCS','09:00:00','SCL','16:05:00','L',6.098,3049,'B747'); +insert into FLIGHTS values ('AA1208',1,'SCL','09:00:00','CCS','14:05:00','L',6.098,3049,'B747'); +insert into FLIGHTS values ('AA1209',1,'CCS','09:00:00','MEX','11:28:00','L',4.47,2235,'B747'); +insert into FLIGHTS values ('AA1210',1,'MEX','09:00:00','CCS','15:28:00','L',4.47,2235,'B747'); +insert into FLIGHTS values ('AA1211',1,'CCS','09:00:00','BUE','17:20:00','L',6.336,3168,'B747'); +insert into FLIGHTS values ('AA1212',1,'BUE','09:00:00','CCS','13:20:00','L',6.336,3168,'B747'); +insert into FLIGHTS values ('AA1213',1,'CCU','09:00:00','HKG','14:47:00','L',3.294,1647,'B747'); +insert into FLIGHTS values ('AA1214',2,'HKG','10:30:00','CCU','11:17:00','L',3.294,1647,'B747'); +insert into FLIGHTS values ('AA1215',1,'CCU','09:00:00','NRT','18:53:00','L',6.396,3198,'B747'); +insert into FLIGHTS values ('AA1216',1,'NRT','09:00:00','CCU','11:53:00','L',6.396,3198,'B747'); +insert into FLIGHTS values ('AA1217',1,'CCU','09:00:00','SIN','15:06:00','L',3.6,1800,'B747'); +insert into FLIGHTS values ('AA1218',1,'SIN','09:00:00','CCU','10:06:00','L',3.6,1800,'B747'); +insert into FLIGHTS values ('AA1219',1,'CDG','09:00:00','LHR','08:25:00','S',0.422,211,'B747'); +insert into FLIGHTS values ('AA1220',1,'LHR','09:00:00','CDG','10:25:00','S',0.422,211,'B747'); +insert into FLIGHTS values ('AA1221',1,'CDG','18:00:00','JFK','19:15:00','D',7.258,3629,'B747'); +insert into FLIGHTS values ('AA1222',1,'JFK','09:00:00','CDG','22:15:00','L',7.258,3629,'B747'); +insert into FLIGHTS values ('AA1223',2,'CDG','13:40:00','SVO','18:45:00','L',3.09,1545,'B747'); +insert into FLIGHTS values ('AA1224',1,'SVO','09:00:00','CDG','10:05:00','B',3.09,1545,'B747'); +insert into FLIGHTS values ('AA1225',1,'CHS','09:00:00','ATL','09:31:00','S',0.532,266,'B747'); +insert into FLIGHTS values ('AA1226',1,'ATL','09:00:00','CHS','09:31:00','S',0.532,266,'B747'); +insert into FLIGHTS values ('AA1227',1,'CHS','11:00:00','MCI','11:51:00','S',1.856,928,'B747'); +insert into FLIGHTS values ('AA1228',1,'MCI','09:00:00','CHS','11:51:00','L',1.856,928,'B747'); +insert into FLIGHTS values ('AA1229',1,'CHS','09:00:00','MSY','09:15:00','L',1.256,628,'B747'); +insert into FLIGHTS values ('AA1230',1,'MSY','09:00:00','CHS','11:15:00','L',1.256,628,'B747'); +insert into FLIGHTS values ('AA1231',1,'CLE','09:00:00','LAX','10:05:00','L',4.092,2046,'B747'); +insert into FLIGHTS values ('AA1232',1,'LAX','09:00:00','CLE','16:05:00','L',4.092,2046,'B747'); +insert into FLIGHTS values ('AA1233',1,'CLE','09:00:00','DFW','10:03:00','L',2.052,1026,'B747'); +insert into FLIGHTS values ('AA1234',1,'DFW','09:00:00','CLE','12:03:00','L',2.052,1026,'B747'); +insert into FLIGHTS values ('AA1235',1,'CLE','09:00:00','MDW','08:37:00','S',0.618,309,'B747'); +insert into FLIGHTS values ('AA1236',1,'MDW','09:00:00','CLE','10:37:00','S',0.618,309,'B747'); +insert into FLIGHTS values ('AA1237',1,'CPH','09:00:00','FCO','10:54:00','L',1.904,952,'B747'); +insert into FLIGHTS values ('AA1238',1,'FCO','09:00:00','CPH','10:54:00','L',1.904,952,'B747'); +insert into FLIGHTS values ('AA1239',1,'CPH','09:00:00','REY','10:37:00','L',2.622,1311,'B747'); +insert into FLIGHTS values ('AA1240',1,'REY','09:00:00','CPH','12:37:00','L',2.622,1311,'B747'); +insert into FLIGHTS values ('AA1241',1,'CPH','09:00:00','CDG','10:16:00','L',1.276,638,'B747'); +insert into FLIGHTS values ('AA1242',1,'CDG','09:00:00','CPH','10:16:00','L',1.276,638,'B747'); +insert into FLIGHTS values ('AA1243',1,'CPT','09:00:00','LOS','13:55:00','L',5.92,2960,'B747'); +insert into FLIGHTS values ('AA1244',1,'LOS','09:00:00','CPT','15:55:00','L',5.92,2960,'B747'); +insert into FLIGHTS values ('AA1245',1,'CPT','09:00:00','NBO','15:06:00','L',5.102,2551,'DC10'); +insert into FLIGHTS values ('AA1246',1,'NBO','09:00:00','CPT','13:06:00','L',5.102,2551,'DC10'); +insert into FLIGHTS values ('AA1247',1,'CPT','09:00:00','LHR','19:01:00','L',12.026,6013,'B747'); +insert into FLIGHTS values ('AA1248',1,'LHR','09:00:00','CPT','23:01:00','L',12.026,6013,'B747'); +insert into FLIGHTS values ('AA1249',2,'DEN','10:30:00','SEA','11:32:00','L',2.04,1020,'B747'); +insert into FLIGHTS values ('AA1250',1,'SEA','09:00:00','DEN','12:02:00','L',2.04,1020,'B747'); +insert into FLIGHTS values ('AA1251',2,'DEN','10:03:00','BOI','11:19:00','L',1.276,638,'B747'); +insert into FLIGHTS values ('AA1252',1,'BOI','09:00:00','DEN','10:16:00','L',1.276,638,'B747'); +insert into FLIGHTS values ('AA1253',1,'DEN','09:00:00','JFK','14:15:00','L',3.258,1629,'B747'); +insert into FLIGHTS values ('AA1254',1,'JFK','09:00:00','DEN','10:15:00','L',3.258,1629,'B747'); +insert into FLIGHTS values ('AA1255',1,'DFW','09:00:00','SAT','09:30:00','S',0.506,253,'B747'); +insert into FLIGHTS values ('AA1256',1,'SAT','09:00:00','DFW','09:30:00','S',0.506,253,'B747'); +insert into FLIGHTS values ('AA1257',1,'DFW','09:00:00','ATL','11:26:00','L',1.442,721,'B747'); +insert into FLIGHTS values ('AA1258',2,'ATL','11:05:00','DFW','11:31:00','L',1.442,721,'B747'); +insert into FLIGHTS values ('AA1259',1,'DFW','09:00:00','MIA','12:13:00','L',2.218,1109,'B747'); +insert into FLIGHTS values ('AA1260',1,'MIA','09:00:00','DFW','10:13:00','L',2.218,1109,'B747'); +insert into FLIGHTS values ('AA1261',1,'DSM','09:00:00','MDW','09:36:00','S',0.612,306,'B747'); +insert into FLIGHTS values ('AA1262',1,'MDW','09:00:00','DSM','09:36:00','S',0.612,306,'B747'); +insert into FLIGHTS values ('AA1263',1,'DSM','09:00:00','SLC','09:53:00','L',1.9,950,'B747'); +insert into FLIGHTS values ('AA1264',1,'SLC','09:00:00','DSM','11:53:00','L',1.9,950,'B747'); +insert into FLIGHTS values ('AA1265',1,'DSM','09:00:00','OKC','09:56:00','L',0.94,470,'B747'); +insert into FLIGHTS values ('AA1266',1,'OKC','09:00:00','DSM','09:56:00','L',0.94,470,'B747'); +insert into FLIGHTS values ('AA1267',1,'DUB','09:00:00','LHR','09:34:00','S',0.574,287,'B747'); +insert into FLIGHTS values ('AA1268',1,'LHR','09:00:00','DUB','09:34:00','S',0.574,287,'B747'); +insert into FLIGHTS values ('AA1269',1,'DUB','09:00:00','MAD','11:48:00','L',1.804,902,'B747'); +insert into FLIGHTS values ('AA1270',2,'MAD','13:10:00','DUB','13:58:00','L',1.804,902,'B747'); +insert into FLIGHTS values ('AA1271',1,'DUB','09:00:00','CDG','10:57:00','L',0.966,483,'B747'); +insert into FLIGHTS values ('AA1272',1,'CDG','09:00:00','DUB','08:57:00','L',0.966,483,'B747'); +insert into FLIGHTS values ('AA1273',1,'BUE','09:00:00','SCL','09:24:00','L',1.408,704,'B747'); +insert into FLIGHTS values ('AA1274',1,'SCL','09:00:00','BUE','11:24:00','L',1.408,704,'B747'); +insert into FLIGHTS values ('AA1275',1,'BUE','09:00:00','GRU','10:05:00','L',2.09,1045,'B747'); +insert into FLIGHTS values ('AA1276',1,'GRU','09:00:00','BUE','12:05:00','L',2.09,1045,'B747'); +insert into FLIGHTS values ('US1509',1,'BUE','23:00:00','MIA','04:49:00','L',8.826,4413,'B747'); +insert into FLIGHTS values ('US1508',2,'MIA','18:30:00','BUE','06:19:00','L',8.826,4413,'B747'); +insert into FLIGHTS values ('AA1279',1,'FAI','09:00:00','JNU','10:15:00','L',1.254,627,'B747'); +insert into FLIGHTS values ('AA1280',1,'JNU','09:00:00','FAI','10:15:00','L',1.254,627,'B747'); +insert into FLIGHTS values ('AA1281',1,'FAI','09:00:00','SEA','13:02:00','L',3.038,1519,'B747'); +insert into FLIGHTS values ('AA1282',1,'SEA','09:00:00','FAI','11:02:00','L',3.038,1519,'B747'); +insert into FLIGHTS values ('US1443',1,'FAI','09:00:00','NRT','10:01:00','L',7.026,3513,'B747'); +insert into FLIGHTS values ('US1444',2,'NRT','14:05:00','FAI','03:06:00','L',7.026,3513,'B747'); +insert into FLIGHTS values ('AA1285',1,'FCO','09:00:00','CDG','10:22:00','L',1.376,688,'B747'); +insert into FLIGHTS values ('AA1286',1,'CDG','09:00:00','FCO','10:22:00','L',1.376,688,'B747'); +insert into FLIGHTS values ('AA1287',1,'FCO','09:00:00','CAI','12:39:00','L',2.654,1327,'B747'); +insert into FLIGHTS values ('AA1288',1,'CAI','09:00:00','FCO','10:39:00','L',2.654,1327,'B747'); +insert into FLIGHTS values ('AA1289',1,'FCO','13:00:00','JFK','15:34:00','L',8.57,4285,'B747'); +insert into FLIGHTS values ('AA1290',1,'JFK','23:00:00','FCO','13:34:00','L',8.57,4285,'B747'); +insert into FLIGHTS values ('AA1291',1,'GIG','13:00:00','MIA','19:22:00','L',8.37,4185,'B747'); +insert into FLIGHTS values ('AA1292',1,'MIA','13:00:00','GIG','23:22:00','L',8.37,4185,'B747'); +insert into FLIGHTS values ('AA1293',1,'GIG','09:00:00','LIM','11:41:00','L',4.694,2347,'B747'); +insert into FLIGHTS values ('AA1294',1,'LIM','15:00:00','GIG','21:41:00','L',4.694,2347,'B747'); +insert into FLIGHTS values ('AA1295',1,'GIG','09:00:00','BUE','12:26:00','L',2.44,1220,'B747'); +insert into FLIGHTS values ('AA1296',1,'BUE','09:00:00','GIG','10:26:00','L',2.44,1220,'B747'); +insert into FLIGHTS values ('US1249',1,'GRU','09:00:00','CCS','13:26:00','L',5.448,2724,'B747'); +insert into FLIGHTS values ('US1250',1,'CCS','09:00:00','GRU','15:26:00','L',5.448,2724,'B747'); +insert into FLIGHTS values ('US1251',1,'GRU','09:00:00','JFK','16:33:00','L',9.556,4778,'B747'); +insert into FLIGHTS values ('US1252',1,'JFK','09:00:00','GRU','20:33:00','L',9.556,4778,'B747'); +insert into FLIGHTS values ('US1253',1,'GRU','09:00:00','LAX','16:19:00','L',12.322,6161,'B747'); +insert into FLIGHTS values ('US1254',1,'LAX','09:00:00','GRU','02:19:00','L',12.322,6161,'B747'); +insert into FLIGHTS values ('AA1053',1,'GRU','09:00:00','LIM','11:17:00','L',4.298,2149,'B747'); +insert into FLIGHTS values ('AA1054',1,'LIM','14:00:00','GRU','20:17:00','L',4.298,2149,'B747'); +insert into FLIGHTS values ('US1255',1,'GVA','09:00:00','CPH','10:25:00','L',1.422,711,'B747'); +insert into FLIGHTS values ('US1256',1,'CPH','09:00:00','GVA','10:25:00','L',1.422,711,'B747'); +insert into FLIGHTS values ('US1257',1,'GVA','09:00:00','LIS','09:52:00','L',1.868,934,'B747'); +insert into FLIGHTS values ('US1258',1,'LIS','09:00:00','GVA','11:52:00','L',1.868,934,'B747'); +insert into FLIGHTS values ('US1259',1,'GVA','09:00:00','OSL','10:56:00','L',1.934,967,'B747'); +insert into FLIGHTS values ('US1260',1,'OSL','09:00:00','GVA','10:56:00','L',1.934,967,'B747'); +insert into FLIGHTS values ('AA1181',2,'HKG','17:15:00','SHA','18:45:00','L',1.514,757,'B747'); +insert into FLIGHTS values ('AA1182',1,'SHA','09:00:00','HKG','10:30:00','L',1.514,757,'B747'); +insert into FLIGHTS values ('US1266',2,'HKG','11:15:00','SIN','14:27:00','L',3.214,1607,'B747'); +insert into FLIGHTS values ('US1264',1,'SIN','09:00:00','HKG','12:12:00','L',3.214,1607,'B747'); +insert into FLIGHTS values ('US1264',2,'HKG','13:00:00','SEL','16:36:00','L',2.612,1306,'B747'); +insert into FLIGHTS values ('US1266',1,'SEL','09:00:00','HKG','10:36:00','L',2.612,1306,'B747'); +insert into FLIGHTS values ('US1267',1,'HLN','09:00:00','SEA','08:58:00','L',0.978,489,'B747'); +insert into FLIGHTS values ('US1268',1,'SEA','09:00:00','HLN','10:58:00','L',0.978,489,'B747'); +insert into FLIGHTS values ('US1269',1,'HLN','09:00:00','BOI','09:34:00','S',0.58,290,'B747'); +insert into FLIGHTS values ('US1270',1,'BOI','09:00:00','HLN','09:34:00','S',0.58,290,'B747'); +insert into FLIGHTS values ('US1271',1,'HLN','09:00:00','DEN','10:11:00','L',1.184,592,'B747'); +insert into FLIGHTS values ('US1272',1,'DEN','09:00:00','HLN','10:11:00','L',1.184,592,'B747'); +insert into FLIGHTS values ('US1276',2,'HNL','12:30:00','NRT','15:12:00','L',7.708,3854,'B747'); +insert into FLIGHTS values ('US1274',1,'NRT','09:00:00','HNL','21:42:00','L',7.708,3854,'B747'); +insert into FLIGHTS values ('US1274',2,'HNL','22:30:00','SFO','05:17:00','L',4.794,2397,'B747'); +insert into FLIGHTS values ('US1276',1,'SFO','09:00:00','HNL','11:47:00','L',4.794,2397,'B747'); +insert into FLIGHTS values ('US1277',1,'HNL','13:00:00','SYD','20:09:00','L',10.16,5080,'B747'); +insert into FLIGHTS values ('US1278',1,'SYD','09:00:00','HNL','22:09:00','L',10.16,5080,'B747'); +insert into FLIGHTS values ('AA1251',1,'HOU','09:00:00','DEN','09:45:00','L',1.756,878,'B747'); +insert into FLIGHTS values ('AA1252',2,'DEN','10:55:00','HOU','13:40:00','L',1.756,878,'B747'); +insert into FLIGHTS values ('US1281',1,'HOU','09:00:00','SAT','09:22:00','S',0.378,189,'B747'); +insert into FLIGHTS values ('US1282',1,'SAT','09:00:00','HOU','09:22:00','S',0.378,189,'B747'); +insert into FLIGHTS values ('US1283',1,'HOU','09:00:00','IAD','12:56:00','L',2.936,1468,'B747'); +insert into FLIGHTS values ('US1284',1,'IAD','09:00:00','HOU','10:56:00','L',2.936,1468,'B747'); +insert into FLIGHTS values ('US1285',1,'IAD','09:00:00','BOS','09:29:00','S',0.49,245,'B747'); +insert into FLIGHTS values ('US1286',1,'BOS','09:00:00','IAD','09:29:00','S',0.49,245,'B747'); +insert into FLIGHTS values ('US1287',1,'IAD','09:00:00','MSP','09:49:00','L',1.83,915,'B747'); +insert into FLIGHTS values ('US1288',1,'MSP','09:00:00','IAD','11:49:00','L',1.83,915,'B747'); +insert into FLIGHTS values ('US1289',1,'IAD','09:00:00','MIA','11:02:00','L',2.048,1024,'B747'); +insert into FLIGHTS values ('US1290',1,'MIA','09:00:00','IAD','11:02:00','L',2.048,1024,'B747'); +insert into FLIGHTS values ('US1291',1,'IST','09:00:00','THR','13:02:00','L',2.538,1269,'B747'); +insert into FLIGHTS values ('US1292',1,'THR','09:00:00','IST','10:02:00','L',2.538,1269,'B747'); +insert into FLIGHTS values ('US1293',1,'IST','09:00:00','FCO','09:42:00','L',1.71,855,'B747'); +insert into FLIGHTS values ('US1294',1,'FCO','09:00:00','IST','11:42:00','L',1.71,855,'B747'); +insert into FLIGHTS values ('US1295',1,'IST','09:00:00','ATH','09:41:00','S',0.698,349,'B747'); +insert into FLIGHTS values ('US1296',1,'ATH','09:00:00','IST','09:41:00','S',0.698,349,'B747'); +insert into FLIGHTS values ('US1381',2,'JFK','12:00:00','CDG','01:15:00','L',7.258,3629,'B747'); +insert into FLIGHTS values ('US1382',1,'CDG','09:00:00','JFK','10:15:00','L',7.258,3629,'B747'); +insert into FLIGHTS values ('US1349',2,'JFK','13:49:00','LAX','15:42:00','L',4.896,2448,'B747'); +insert into FLIGHTS values ('US1300',1,'LAX','09:00:00','JFK','16:53:00','L',4.896,2448,'B747'); +insert into FLIGHTS values ('US1301',1,'JFK','09:00:00','GRU','20:33:00','L',9.556,4778,'B747'); +insert into FLIGHTS values ('US1302',1,'GRU','09:00:00','JFK','16:33:00','L',9.556,4778,'B747'); +insert into FLIGHTS values ('US1303',1,'JKT','09:00:00','HKG','14:03:00','L',4.054,2027,'B747'); +insert into FLIGHTS values ('US1304',1,'HKG','09:00:00','JKT','12:03:00','L',4.054,2027,'B747'); +insert into FLIGHTS values ('US1308',2,'JKT','13:35:00','SYD','00:25:00','L',6.844,3422,'B747'); +insert into FLIGHTS values ('US1307',1,'SYD','09:00:00','JKT','11:50:00','L',6.844,3422,'B747'); +insert into FLIGHTS values ('US1307',2,'JKT','12:15:00','TPE','17:59:00','L',4.748,2374,'B747'); +insert into FLIGHTS values ('US1308',1,'TPE','09:00:00','JKT','12:44:00','L',4.748,2374,'B747'); +insert into FLIGHTS values ('US1309',1,'JNU','09:00:00','SEA','11:46:00','L',1.782,891,'B747'); +insert into FLIGHTS values ('US1310',1,'SEA','09:00:00','JNU','09:46:00','L',1.782,891,'B747'); +insert into FLIGHTS values ('US1311',1,'JNU','09:00:00','SFO','13:02:00','L',3.034,1517,'B747'); +insert into FLIGHTS values ('US1312',1,'SFO','09:00:00','JNU','11:02:00','L',3.034,1517,'B747'); +insert into FLIGHTS values ('US1313',1,'JNU','09:00:00','HNL','13:37:00','L',5.626,2813,'B747'); +insert into FLIGHTS values ('US1314',1,'HNL','09:00:00','JNU','15:37:00','L',5.626,2813,'B747'); +insert into FLIGHTS values ('US1315',1,'KBL','09:00:00','KHI','10:21:00','L',1.358,679,'B747'); +insert into FLIGHTS values ('US1316',1,'KHI','09:00:00','KBL','10:21:00','L',1.358,679,'B747'); +insert into FLIGHTS values ('US1317',1,'KBL','09:00:00','IST','10:26:00','L',4.448,2224,'B747'); +insert into FLIGHTS values ('US1318',1,'IST','09:00:00','KBL','16:26:00','L',4.448,2224,'B747'); diff --git a/openjpa-examples/simple/src/main/java/reversemapping/schema/loadFLIGHTS2.sql b/openjpa-examples/simple/src/main/java/reversemapping/schema/loadFLIGHTS2.sql index 75dc402c9..2587b6ba2 100644 --- a/openjpa-examples/simple/src/main/java/reversemapping/schema/loadFLIGHTS2.sql +++ b/openjpa-examples/simple/src/main/java/reversemapping/schema/loadFLIGHTS2.sql @@ -13,287 +13,287 @@ -- See the License for the specific language governing permissions and -- limitations under the License. -insert into FLIGHTS values ('AA1137',2,'KBL','13:30:00','SVO','15:41:00','S',4.192,2096,'A320'); -insert into FLIGHTS values ('AA1138',1,'SVO','09:00:00','KBL','15:11:00','L',4.192,2096,'A320'); -insert into FLIGHTS values ('US1321',1,'KHI','09:00:00','IST','10:54:00','L',4.9,2450,'B747'); -insert into FLIGHTS values ('US1322',1,'IST','09:00:00','KHI','16:54:00','L',4.9,2450,'B747'); -insert into FLIGHTS values ('US1323',1,'KHI','09:00:00','IST','10:54:00','L',4.9,2450,'B747'); -insert into FLIGHTS values ('US1324',1,'IST','09:00:00','KHI','16:54:00','L',4.9,2450,'B747'); -insert into FLIGHTS values ('US1325',1,'KHI','09:00:00','THR','09:53:00','L',2.384,1192,'B747'); -insert into FLIGHTS values ('US1326',1,'THR','09:00:00','KHI','12:53:00','L',2.384,1192,'B747'); -insert into FLIGHTS values ('US1327',1,'LAX','09:00:00','HNL','12:07:00','L',5.124,2562,'B747'); -insert into FLIGHTS values ('US1328',1,'HNL','09:00:00','LAX','16:07:00','L',5.124,2562,'B747'); -insert into FLIGHTS values ('US1329',1,'LAX','09:00:00','GRU','02:19:00','L',12.322,6161,'B747'); -insert into FLIGHTS values ('US1330',1,'GRU','09:00:00','LAX','16:19:00','L',12.322,6161,'B747'); -insert into FLIGHTS values ('US1331',1,'LAX','09:00:00','NRT','12:57:00','L',10.956,5478,'B747'); -insert into FLIGHTS values ('US1332',1,'NRT','09:00:00','LAX','02:57:00','L',10.956,5478,'B747'); -insert into FLIGHTS values ('US1333',1,'LHR','09:00:00','WAW','11:47:00','L',1.798,899,'B747'); -insert into FLIGHTS values ('US1334',1,'WAW','09:00:00','LHR','09:47:00','L',1.798,899,'B747'); -insert into FLIGHTS values ('US1335',1,'LHR','09:00:00','YYZ','11:06:00','L',7.106,3553,'B747'); -insert into FLIGHTS values ('US1336',1,'YYZ','09:00:00','LHR','21:06:00','L',7.106,3553,'B747'); -insert into FLIGHTS values ('US1337',1,'LHR','09:00:00','NBO','20:28:00','L',8.48,4240,'B747'); -insert into FLIGHTS values ('US1338',1,'NBO','09:00:00','LHR','14:28:00','L',8.48,4240,'B747'); -insert into FLIGHTS values ('US1501',2,'LIM','11:00:00','MIA','16:15:00','L',5.25,625,'B747'); -insert into FLIGHTS values ('US1340',1,'MIA','09:00:00','LIM','14:15:00','L',5.25,2625,'B747'); -insert into FLIGHTS values ('US1338',2,'LIM','20:00:00','MIA','01:15:00','L',5.25,2625,'B747'); -insert into FLIGHTS values ('US1339',1,'MIA','18:00:00','LIM','23:15:00','L',5.25,2625,'B747'); -insert into FLIGHTS values ('US1344',2,'LIM','12:00:00','BUE','18:53:00','L',3.896,1948,'B747'); -insert into FLIGHTS values ('US1342',1,'BUE','09:00:00','LIM','09:53:00','L',3.896,1948,'B747'); -insert into FLIGHTS values ('US1342',2,'LIM','10:30:00','BOG','12:50:00','L',2.338,1169,'B747'); -insert into FLIGHTS values ('US1344',1,'BOG','09:00:00','LIM','11:20:00','L',2.338,1169,'B747'); -insert into FLIGHTS values ('US1345',1,'LIS','09:00:00','CDG','11:48:00','L',1.806,903,'B747'); -insert into FLIGHTS values ('US1346',1,'CDG','09:00:00','LIS','09:48:00','L',1.806,903,'B747'); -insert into FLIGHTS values ('US1347',1,'LIS','09:00:00','CAS','09:43:00','S',0.73,365,'B747'); -insert into FLIGHTS values ('US1348',1,'CAS','09:00:00','LIS','09:43:00','S',0.73,365,'B747'); -insert into FLIGHTS values ('US1349',1,'LIS','09:00:00','JFK','10:44:00','L',6.744,3372,'B747'); -insert into FLIGHTS values ('US1300',2,'JFK','17:45:00','LIS','05:29:00','L',6.744,3372,'B747'); -insert into FLIGHTS values ('AA1223',1,'LOS','09:00:00','CDG','14:52:00','L',5.868,2934,'B747'); -insert into FLIGHTS values ('AA1224',2,'CDG','11:00:00','LOS','16:52:00','L',5.868,2934,'B747'); -insert into FLIGHTS values ('US1353',1,'LOS','09:00:00','MAD','13:46:00','L',4.776,2388,'B747'); -insert into FLIGHTS values ('US1354',1,'MAD','09:00:00','LOS','13:46:00','L',4.776,2388,'B747'); -insert into FLIGHTS values ('US1355',1,'LOS','09:00:00','ATH','15:03:00','L',5.054,2527,'B747'); -insert into FLIGHTS values ('US1356',1,'ATH','09:00:00','LOS','13:03:00','L',5.054,2527,'B747'); -insert into FLIGHTS values ('US1357',2,'MAD','11:45:00','CDG','13:03:00','L',1.31,655,'B747'); -insert into FLIGHTS values ('US1358',1,'CDG','09:00:00','MAD','10:18:00','L',1.31,655,'B747'); -insert into FLIGHTS values ('US1358',2,'MAD','11:05:00','CAS','11:07:00','L',1.036,518,'B747'); -insert into FLIGHTS values ('US1357',1,'CAS','09:00:00','MAD','11:02:00','L',1.036,518,'B747'); -insert into FLIGHTS values ('US1361',1,'MAD','09:00:00','JFK','10:10:00','L',7.178,3589,'B747'); -insert into FLIGHTS values ('US1362',1,'JFK','09:00:00','MAD','22:10:00','L',7.178,3589,'B747'); -insert into FLIGHTS values ('US1363',1,'MCI','09:00:00','LAX','09:42:00','L',2.71,1355,'B747'); -insert into FLIGHTS values ('US1364',1,'LAX','09:00:00','MCI','13:42:00','L',2.71,1355,'B747'); -insert into FLIGHTS values ('US1365',1,'MCI','09:00:00','DFW','09:54:00','L',0.908,454,'B747'); -insert into FLIGHTS values ('US1366',1,'DFW','09:00:00','MCI','09:54:00','L',0.908,454,'B747'); -insert into FLIGHTS values ('US1367',1,'MCI','09:00:00','JFK','12:11:00','L',2.19,1095,'B747'); -insert into FLIGHTS values ('US1368',1,'JFK','09:00:00','MCI','10:11:00','L',2.19,1095,'B747'); -insert into FLIGHTS values ('US1379',2,'MDW','10:03:00','LAX','11:31:00','L',3.482,1741,'B747'); -insert into FLIGHTS values ('US1380',1,'LAX','09:00:00','MDW','14:28:00','L',3.482,1741,'B747'); -insert into FLIGHTS values ('US1473',2,'MDW','13:30:00','JFK','15:55:00','L',1.428,714,'B747'); -insert into FLIGHTS values ('US1474',1,'JFK','11:00:00','MDW','11:25:00','L',1.428,714,'B747'); -insert into FLIGHTS values ('US1383',1,'MDW','12:15:00','ATL','14:25:00','L',1.174,587,'B747'); -insert into FLIGHTS values ('US1384',1,'ATL','11:30:00','MDW','11:40:00','L',1.174,587,'B747'); -insert into FLIGHTS values ('US1385',1,'MEL','09:00:00','SYD','09:52:00','L',0.882,441,'B747'); -insert into FLIGHTS values ('US1386',1,'SYD','09:00:00','MEL','09:52:00','L',0.882,441,'B747'); -insert into FLIGHTS values ('US1387',1,'MEL','09:00:00','SIN','13:32:00','L',7.536,3768,'B747'); -insert into FLIGHTS values ('US1388',2,'SIN','14:15:00','MEL','00:47:00','L',7.536,3768,'B747'); -insert into FLIGHTS values ('US1389',1,'MEL','09:00:00','HNL','23:02:00','L',11.044,5522,'B747'); -insert into FLIGHTS values ('US1390',1,'HNL','12:45:00','MEL','20:47:00','L',11.044,5522,'B747'); -insert into FLIGHTS values ('US1391',1,'MEM','09:00:00','MIA','11:44:00','L',1.742,871,'B747'); -insert into FLIGHTS values ('US1392',1,'MIA','09:00:00','MEM','09:44:00','L',1.742,871,'B747'); -insert into FLIGHTS values ('US1393',1,'MEM','09:00:00','JFK','11:54:00','L',1.908,954,'B747'); -insert into FLIGHTS values ('US1394',1,'JFK','09:00:00','MEM','09:54:00','L',1.908,954,'B747'); -insert into FLIGHTS values ('US1395',1,'MEM','09:00:00','LAX','10:12:00','L',3.202,1601,'B747'); -insert into FLIGHTS values ('US1396',1,'LAX','09:00:00','MEM','14:12:00','L',3.202,1601,'B747'); -insert into FLIGHTS values ('US1397',1,'MEX','09:00:00','SFO','10:46:00','L',3.78,1890,'B747'); -insert into FLIGHTS values ('US1398',1,'SFO','09:00:00','MEX','14:46:00','L',3.78,1890,'B747'); -insert into FLIGHTS values ('US1399',1,'MEX','15:00:00','LAX','16:06:00','S',3.1,1550,'B747'); -insert into FLIGHTS values ('US1400',1,'LAX','09:00:00','MEX','14:06:00','L',3.1,1550,'B747'); -insert into FLIGHTS values ('US1401',1,'MEX','09:00:00','BOG','13:57:00','L',3.95,1975,'B747'); -insert into FLIGHTS values ('US1402',1,'BOG','09:00:00','MEX','11:57:00','L',3.95,1975,'B747'); -insert into FLIGHTS values ('US1403',1,'MIA','18:00:00','GRU','04:10:00','L',8.172,4086,'B747'); -insert into FLIGHTS values ('US1404',1,'GRU','23:00:00','MIA','05:10:00','L',8.172,4086,'B747'); -insert into FLIGHTS values ('US1405',1,'MIA','17:30:00','LAX','19:10:00','D',4.67,2335,'B747'); -insert into FLIGHTS values ('US1406',1,'LAX','08:00:00','MIA','15:40:00','L',4.67,2335,'B747'); -insert into FLIGHTS values ('US1407',1,'MIA','09:00:00','JFK','11:11:00','L',2.184,1092,'B747'); -insert into FLIGHTS values ('US1408',1,'JFK','09:00:00','MIA','11:11:00','L',2.184,1092,'B747'); -insert into FLIGHTS values ('US1409',1,'MKE','09:00:00','JFK','11:27:00','L',1.466,733,'B747'); -insert into FLIGHTS values ('US1410',1,'JFK','09:00:00','MKE','09:27:00','L',1.466,733,'B747'); -insert into FLIGHTS values ('US1411',1,'MKE','09:00:00','MDW','09:09:00','S',0.166,83,'B747'); -insert into FLIGHTS values ('US1412',1,'MDW','09:00:00','MKE','09:09:00','S',0.166,83,'B747'); -insert into FLIGHTS values ('US1413',1,'MKE','09:00:00','JFK','11:27:00','L',1.466,733,'B747'); -insert into FLIGHTS values ('US1414',1,'JFK','09:00:00','MKE','09:27:00','L',1.466,733,'B747'); -insert into FLIGHTS values ('US1415',1,'MNL','09:00:00','SYD','19:47:00','L',7.794,3897,'B747'); -insert into FLIGHTS values ('US1416',1,'SYD','09:00:00','MNL','13:47:00','L',7.794,3897,'B747'); -insert into FLIGHTS values ('US1417',1,'MNL','09:00:00','TPE','10:26:00','L',1.448,724,'B747'); -insert into FLIGHTS values ('US1418',1,'TPE','09:00:00','MNL','10:26:00','L',1.448,724,'B747'); -insert into FLIGHTS values ('US1419',1,'MNL','09:00:00','SIN','11:58:00','L',2.978,1489,'B747'); -insert into FLIGHTS values ('US1420',2,'SIN','11:53:00','MNL','14:51:00','L',2.978,1489,'B747'); -insert into FLIGHTS values ('AA1419',1,'MNL','12:00:00','HKG','13:23:00','L',1.388,694,'B747'); -insert into FLIGHTS values ('AA1420',2,'HKG','17:53:00','MNL','19:16:00','D',1.388,694,'B747'); -insert into FLIGHTS values ('AA1421',1,'MNL','07:00:00','HNL','23:36:00','B',10.604,5302,'B747'); -insert into FLIGHTS values ('US1422',2,'HNL','14:05:00','MNL','18:41:00','L',10.604,5302,'B747'); -insert into FLIGHTS values ('AA1249',1,'MSP','09:00:00','DEN','09:52:00','L',1.882,941,'B747'); -insert into FLIGHTS values ('AA1250',2,'DEN','12:37:00','MSP','15:29:00','L',1.882,941,'B747'); -insert into FLIGHTS values ('US1423',1,'MSP','09:00:00','MDW','09:25:00','S',0.43,215,'B747'); -insert into FLIGHTS values ('US1424',1,'MDW','09:00:00','MSP','09:25:00','S',0.43,215,'B747'); -insert into FLIGHTS values ('AA1423',1,'MDW','08:00:00','MIA','11:22:00','L',2.376,1188,'B747'); -insert into FLIGHTS values ('AA1424',1,'MIA','17:00:00','MDW','18:22:00','L',2.376,1188,'B747'); -insert into FLIGHTS values ('US1427',1,'MSY','09:00:00','SFO','10:50:00','L',3.846,1923,'B747'); -insert into FLIGHTS values ('US1428',1,'SFO','09:00:00','MSY','14:50:00','L',3.846,1923,'B747'); -insert into FLIGHTS values ('US1429',1,'MSY','09:00:00','ATL','10:50:00','L',0.848,424,'B747'); -insert into FLIGHTS values ('US1430',1,'ATL','09:00:00','MSY','08:50:00','L',0.848,424,'B747'); -insert into FLIGHTS values ('US1431',1,'MSY','09:00:00','JFK','12:20:00','L',2.336,1168,'B747'); -insert into FLIGHTS values ('US1432',1,'JFK','09:00:00','MSY','10:20:00','L',2.336,1168,'B747'); -insert into FLIGHTS values ('US1433',1,'NBO','09:00:00','FCO','13:42:00','L',6.702,3351,'B747'); -insert into FLIGHTS values ('US1434',1,'FCO','09:00:00','NBO','17:42:00','L',6.702,3351,'B747'); -insert into FLIGHTS values ('US1435',1,'NBO','06:00:00','MAD','11:41:00','L',7.694,3847,'B747'); -insert into FLIGHTS values ('US1436',1,'MAD','13:10:00','NBO','22:51:00','L',7.694,3847,'B747'); -insert into FLIGHTS values ('US1437',1,'NBO','09:00:00','CAS','13:31:00','L',7.518,3759,'B747'); -insert into FLIGHTS values ('US1438',1,'CAS','09:00:00','NBO','19:31:00','L',7.518,3759,'B747'); -insert into FLIGHTS values ('US1439',1,'NRT','09:00:00','SYD','20:44:00','L',9.736,4868,'B747'); -insert into FLIGHTS values ('US1440',1,'SYD','09:00:00','NRT','16:44:00','L',9.736,4868,'B747'); -insert into FLIGHTS values ('US1441',1,'NRT','09:00:00','LAX','02:57:00','L',10.956,5478,'B747'); -insert into FLIGHTS values ('US1442',1,'LAX','09:00:00','NRT','12:57:00','L',10.956,5478,'B747'); -insert into FLIGHTS values ('US1443',2,'NRT','14:45:00','HKG','17:20:00','L',3.596,1798,'B747'); -insert into FLIGHTS values ('US1444',1,'HKG','09:00:00','NRT','13:35:00','L',3.596,1798,'B747'); -insert into FLIGHTS values ('US1445',1,'OKC','09:00:00','SLC','09:43:00','L',1.722,861,'B747'); -insert into FLIGHTS values ('US1446',1,'SLC','09:00:00','OKC','11:43:00','L',1.722,861,'B747'); -insert into FLIGHTS values ('US1447',1,'OKC','09:00:00','JFK','12:38:00','L',2.648,1324,'B747'); -insert into FLIGHTS values ('US1448',1,'JFK','09:00:00','OKC','10:38:00','L',2.648,1324,'B747'); -insert into FLIGHTS values ('US1449',1,'OKC','09:00:00','LAX','09:21:00','L',2.36,1180,'B747'); -insert into FLIGHTS values ('US1450',1,'LAX','09:00:00','OKC','13:21:00','L',2.36,1180,'B747'); -insert into FLIGHTS values ('US1451',1,'OSA','09:00:00','NRT','09:30:00','S',0.502,251,'B747'); -insert into FLIGHTS values ('US1452',1,'NRT','09:00:00','OSA','09:30:00','S',0.502,251,'B747'); -insert into FLIGHTS values ('US1453',1,'OSA','09:00:00','TPE','10:08:00','L',2.138,1069,'B747'); -insert into FLIGHTS values ('US1454',1,'TPE','09:00:00','OSA','12:08:00','L',2.138,1069,'B747'); -insert into FLIGHTS values ('US1455',1,'OSA','09:00:00','SVO','12:07:00','L',9.13,4565,'B747'); -insert into FLIGHTS values ('US1456',1,'SVO','09:00:00','OSA','00:07:00','L',9.13,4565,'B747'); -insert into FLIGHTS values ('US1457',1,'OSL','09:00:00','PRG','10:23:00','L',1.39,695,'B747'); -insert into FLIGHTS values ('US1458',1,'PRG','11:00:00','OSL','12:23:00','L',1.39,695,'B747'); -insert into FLIGHTS values ('US1459',1,'OSL','09:00:00','ARN','10:34:00','L',1.574,787,'B747'); -insert into FLIGHTS values ('US1460',1,'ARN','09:00:00','OSL','10:34:00','L',1.574,787,'B747'); -insert into FLIGHTS values ('US1461',1,'OSL','09:00:00','WAW','10:19:00','L',1.318,659,'B747'); -insert into FLIGHTS values ('US1462',1,'WAW','09:00:00','OSL','10:19:00','L',1.318,659,'B747'); -insert into FLIGHTS values ('AA1462',1,'OSL','07:15:00','CDG','08:55:00','B',1.668,834,'B747'); -insert into FLIGHTS values ('AA1463',1,'CDG','11:00:00','OSL','12:40:00','L',1.668,834,'B747'); -insert into FLIGHTS values ('US1463',1,'PHL','09:00:00','IAD','09:21:00','S',0.364,182,'B747'); -insert into FLIGHTS values ('US1464',1,'IAD','09:00:00','PHL','09:21:00','S',0.364,182,'B747'); -insert into FLIGHTS values ('US1465',1,'PHL','09:00:00','MIA','11:02:00','L',2.044,1022,'B747'); -insert into FLIGHTS values ('US1466',1,'MIA','09:00:00','PHL','11:02:00','L',2.044,1022,'B747'); -insert into FLIGHTS values ('AA1258',1,'PHL','09:00:00','ATL','10:19:00','L',1.33,665,'B747'); -insert into FLIGHTS values ('AA1257',2,'ATL','12:10:00','PHL','13:29:00','L',1.33,665,'B747'); -insert into FLIGHTS values ('US1469',1,'PHX','09:00:00','LAX','08:42:00','S',0.714,357,'B747'); -insert into FLIGHTS values ('US1470',1,'LAX','09:00:00','PHX','10:42:00','S',0.714,357,'B747'); -insert into FLIGHTS values ('US1471',1,'PHX','09:00:00','SEA','10:13:00','L',2.23,1115,'B747'); -insert into FLIGHTS values ('US1472',1,'SEA','09:00:00','PHX','12:13:00','L',2.23,1115,'B747'); -insert into FLIGHTS values ('US1473',1,'PHX','09:00:00','MDW','12:53:00','L',2.898,1449,'B747'); -insert into FLIGHTS values ('US1474',2,'MDW','09:55:00','PHX','11:48:00','L',2.898,1449,'B747'); -insert into FLIGHTS values ('US1475',1,'PRG','09:00:00','CDG','10:06:00','L',1.102,551,'B747'); -insert into FLIGHTS values ('US1476',1,'CDG','09:00:00','PRG','10:06:00','L',1.102,551,'B747'); -insert into FLIGHTS values ('US1477',1,'PRG','09:00:00','FCO','10:08:00','L',1.146,573,'B747'); -insert into FLIGHTS values ('US1478',1,'FCO','09:00:00','PRG','10:08:00','L',1.146,573,'B747'); -insert into FLIGHTS values ('US1479',1,'PRG','09:00:00','REY','11:16:00','B',3.282,1641,'A320'); -insert into FLIGHTS values ('US1480',1,'REY','09:00:00','PRG','13:16:00','L',3.282,1641,'A320'); -insert into FLIGHTS values ('US1481',1,'REY','09:00:00','SVO','16:06:00','L',4.112,2056,'B747'); -insert into FLIGHTS values ('US1482',2,'SVO','13:15:00','REY','14:21:00','L',4.112,2056,'B747'); -insert into FLIGHTS values ('US1483',1,'REY','09:00:00','CDG','12:46:00','L',2.776,1388,'B747'); -insert into FLIGHTS values ('US1484',1,'CDG','09:00:00','REY','10:46:00','L',2.776,1388,'B747'); -insert into FLIGHTS values ('US1485',1,'REY','09:00:00','DUB','10:51:00','L',1.862,931,'B747'); -insert into FLIGHTS values ('US1486',1,'DUB','09:00:00','REY','10:51:00','L',1.862,931,'B747'); -insert into FLIGHTS values ('US1487',1,'SAN','09:00:00','SFO','09:55:00','L',0.918,459,'B747'); -insert into FLIGHTS values ('US1488',1,'SFO','09:00:00','SAN','09:55:00','L',0.918,459,'B747'); -insert into FLIGHTS values ('US1489',1,'SAN','09:00:00','DFW','13:21:00','L',2.36,1180,'B747'); -insert into FLIGHTS values ('US1490',1,'DFW','09:00:00','SAN','09:21:00','L',2.36,1180,'B747'); -insert into FLIGHTS values ('US1491',1,'SAN','09:00:00','MEX','13:53:00','L',2.888,1444,'B747'); -insert into FLIGHTS values ('US1492',1,'MEX','09:00:00','SAN','09:53:00','L',2.888,1444,'B747'); -insert into FLIGHTS values ('US1493',1,'SAT','09:00:00','ATL','11:45:00','L',1.766,883,'B747'); -insert into FLIGHTS values ('US1494',1,'ATL','09:00:00','SAT','09:45:00','L',1.766,883,'B747'); -insert into FLIGHTS values ('US1495',1,'SAT','09:00:00','LAX','09:24:00','L',2.404,1202,'B747'); -insert into FLIGHTS values ('US1496',1,'LAX','09:00:00','SAT','13:24:00','L',2.404,1202,'B747'); -insert into FLIGHTS values ('US1497',1,'SAT','09:00:00','MIA','12:17:00','L',2.292,1146,'B747'); -insert into FLIGHTS values ('US1498',1,'MIA','09:00:00','SAT','10:17:00','L',2.292,1146,'B747'); -insert into FLIGHTS values ('US1499',1,'SCL','09:00:00','GRU','12:13:00','L',3.218,1609,'B747'); -insert into FLIGHTS values ('US1500',1,'GRU','09:00:00','SCL','12:13:00','L',3.218,1609,'B747'); -insert into FLIGHTS values ('US1501',1,'SCL','09:00:00','LIM','10:04:00','L',3.068,1534,'B747'); -insert into FLIGHTS values ('US1340',2,'LIM','15:00:00','SCL','20:04:00','L',3.068,1534,'B747'); -insert into FLIGHTS values ('US1503',1,'SCL','09:00:00','BUE','11:24:00','L',1.408,704,'B747'); -insert into FLIGHTS values ('US1504',1,'BUE','09:00:00','SCL','09:24:00','L',1.408,704,'B747'); -insert into FLIGHTS values ('US1505',1,'SEA','09:00:00','SFO','10:21:00','L',1.356,678,'B747'); -insert into FLIGHTS values ('AA1505',1,'SFO','09:00:00','SEA','10:21:00','L',1.356,678,'B747'); -insert into FLIGHTS values ('US1506',1,'SEA','09:00:00','JFK','16:48:00','L',4.81,2405,'B747'); -insert into FLIGHTS values ('US1507',1,'JFK','09:00:00','SEA','10:48:00','L',4.81,2405,'B747'); -insert into FLIGHTS values ('US1508',1,'SEA','09:00:00','MIA','17:27:00','L',5.462,2731,'B747'); -insert into FLIGHTS values ('US1509',2,'MIA','15:15:00','SEA','17:42:00','L',5.462,2731,'B747'); -insert into FLIGHTS values ('US1510',1,'SEL','09:00:00','NRT','10:26:00','L',1.438,719,'B747'); -insert into FLIGHTS values ('US1511',1,'NRT','09:00:00','SEL','10:26:00','L',1.438,719,'B747'); -insert into FLIGHTS values ('US1388',1,'SEL','09:00:00','SIN','13:49:00','L',5.818,2909,'B747'); -insert into FLIGHTS values ('US1387',2,'SIN','14:05:00','SEL','20:54:00','L',5.818,2909,'B747'); -insert into FLIGHTS values ('US1514',1,'SEL','09:00:00','SHA','09:05:00','L',1.098,549,'B747'); -insert into FLIGHTS values ('US1515',1,'SHA','09:00:00','SEL','11:05:00','L',1.098,549,'B747'); -insert into FLIGHTS values ('US1516',1,'SFO','12:00:00','JFK','20:08:00','L',5.136,2568,'B747'); -insert into FLIGHTS values ('US1517',2,'JFK','11:05:00','SFO','13:13:00','L',5.136,2568,'B747'); -insert into FLIGHTS values ('US1518',1,'SFO','09:00:00','MIA','17:10:00','L',5.18,2590,'B747'); -insert into FLIGHTS values ('US1518',2,'MIA','18:05:00','SCL','04:22:00','L',8.288,4144,'B747'); -insert into FLIGHTS values ('US1519',1,'SCL','09:00:00','MIA','15:17:00','D',8.288,4144,'B747'); -insert into FLIGHTS values ('US1519',2,'MIA','16:10:00','SFO','18:20:00','D',5.18,2590,'B747'); -insert into FLIGHTS values ('US1529',1,'SFO','09:00:00','HNL','11:47:00','L',4.794,2397,'B747'); -insert into FLIGHTS values ('US1521',1,'HNL','09:00:00','SFO','15:47:00','L',4.794,2397,'B747'); -insert into FLIGHTS values ('US1522',1,'SHA','09:00:00','SIN','13:43:00','L',4.72,2360,'B747'); -insert into FLIGHTS values ('US1523',1,'SIN','09:00:00','SHA','13:43:00','L',4.72,2360,'B747'); -insert into FLIGHTS values ('US1524',1,'SHA','09:00:00','HKG','10:30:00','L',1.514,757,'B747'); -insert into FLIGHTS values ('US1525',1,'HKG','09:00:00','SHA','10:30:00','L',1.514,757,'B747'); -insert into FLIGHTS values ('US1526',1,'SHA','09:00:00','SVO','12:29:00','L',8.486,4243,'B747'); -insert into FLIGHTS values ('US1527',1,'SVO','09:00:00','SHA','22:29:00','L',8.486,4243,'B747'); -insert into FLIGHTS values ('AA1528',1,'SIN','09:00:00','SYD','19:50:00','L',7.834,3917,'B747'); -insert into FLIGHTS values ('AA1529',1,'SYD','09:00:00','SIN','13:50:00','L',7.834,3917,'B747'); -insert into FLIGHTS values ('US1419',2,'SIN','12:35:00','JKT','12:41:00','L',1.108,554,'B747'); -insert into FLIGHTS values ('US1420',1,'JKT','09:00:00','SIN','11:06:00','L',1.108,554,'B747'); -insert into FLIGHTS values ('AA1532',1,'SIN','09:00:00','HKG','12:12:00','L',3.214,1607,'B747'); -insert into FLIGHTS values ('AA1533',1,'HKG','09:00:00','SIN','12:12:00','L',3.214,1607,'B747'); -insert into FLIGHTS values ('AA1186',1,'SJU','09:00:00','MIA','10:04:00','L',2.07,1035,'B747'); -insert into FLIGHTS values ('AA1185',2,'MIA','12:20:00','SJU','15:24:00','L',2.07,1035,'B747'); -insert into FLIGHTS values ('US1536',1,'SJU','09:00:00','CCS','10:06:00','L',1.106,553,'B747'); -insert into FLIGHTS values ('US1537',1,'CCS','09:00:00','SJU','10:06:00','L',1.106,553,'B747'); -insert into FLIGHTS values ('US1538',1,'SJU','09:00:00','MEL','20:17:00','L',20.288,10144,'B747'); -insert into FLIGHTS values ('US1539',1,'MEL','09:00:00','SJU','14:17:00','L',20.288,10144,'B747'); -insert into FLIGHTS values ('US1540',1,'SLC','09:00:00','DEN','09:44:00','S',0.74,370,'B747'); -insert into FLIGHTS values ('US1541',1,'DEN','09:00:00','SLC','09:44:00','S',0.74,370,'B747'); -insert into FLIGHTS values ('US1542',1,'SLC','09:00:00','SFO','09:11:00','L',1.198,599,'B747'); -insert into FLIGHTS values ('US1543',1,'SFO','09:00:00','SLC','11:11:00','L',1.198,599,'B747'); -insert into FLIGHTS values ('US1544',1,'SLC','09:00:00','MDW','12:30:00','L',2.51,1255,'B747'); -insert into FLIGHTS values ('US1545',1,'MDW','09:00:00','SLC','10:30:00','L',2.51,1255,'B747'); -insert into FLIGHTS values ('US1546',1,'STL','09:00:00','MDW','09:31:00','S',0.518,259,'B747'); -insert into FLIGHTS values ('US1547',1,'MDW','09:00:00','STL','09:31:00','S',0.518,259,'B747'); -insert into FLIGHTS values ('US1548',1,'STL','09:00:00','JFK','11:44:00','L',1.746,873,'B747'); -insert into FLIGHTS values ('US1549',1,'JFK','09:00:00','STL','09:44:00','L',1.746,873,'B747'); -insert into FLIGHTS values ('US1550',1,'STL','09:00:00','LAX','10:10:00','L',3.174,1587,'B747'); -insert into FLIGHTS values ('US1551',1,'LAX','09:00:00','STL','14:10:00','L',3.174,1587,'B747'); -insert into FLIGHTS values ('US1552',1,'SVO','14:00:00','CDG','15:05:00','L',3.09,1545,'B747'); -insert into FLIGHTS values ('US1553',1,'CDG','14:00:00','SVO','19:05:00','L',3.09,1545,'B747'); -insert into FLIGHTS values ('US1554',1,'SVO','09:00:00','NRT','00:18:00','L',9.308,4654,'B747'); -insert into FLIGHTS values ('US1555',1,'NRT','09:00:00','SVO','12:18:00','L',9.308,4654,'B747'); -insert into FLIGHTS values ('US1481',2,'SVO','13:45:00','BOM','22:30:00','L',6.266,3133,'B747'); -insert into FLIGHTS values ('US1482',1,'BOM','09:00:00','SVO','12:45:00','L',6.266,3133,'B747'); -insert into FLIGHTS values ('US1558',1,'SYD','09:00:00','AKL','13:40:00','L',2.682,1341,'B747'); -insert into FLIGHTS values ('US1559',1,'AKL','09:00:00','SYD','09:40:00','L',2.682,1341,'B747'); -insert into FLIGHTS values ('US1560',1,'SYD','15:00:00','HNL','04:09:00','L',10.16,5080,'B747'); -insert into FLIGHTS values ('US1561',1,'HNL','13:00:00','SYD','20:09:00','L',10.16,5080,'B747'); -insert into FLIGHTS values ('US1562',1,'SYD','09:00:00','HKG','15:09:00','L',9.166,4583,'B747'); -insert into FLIGHTS values ('US1563',1,'HKG','09:00:00','SYD','21:09:00','L',9.166,4583,'B747'); -insert into FLIGHTS values ('US1564',1,'THR','09:00:00','KBL','12:30:00','L',2.014,1007,'B747'); -insert into FLIGHTS values ('US1565',1,'KBL','09:00:00','THR','09:30:00','L',2.014,1007,'B747'); -insert into FLIGHTS values ('US1566',1,'THR','09:00:00','KHI','12:53:00','L',2.384,1192,'B747'); -insert into FLIGHTS values ('US1567',1,'KHI','09:00:00','THR','09:53:00','L',2.384,1192,'B747'); -insert into FLIGHTS values ('US1568',1,'THR','09:00:00','CAI','09:57:00','L',2.464,1232,'B747'); -insert into FLIGHTS values ('US1569',1,'CAI','09:00:00','THR','12:57:00','L',2.464,1232,'B747'); -insert into FLIGHTS values ('AA1214',1,'TPE','09:00:00','HKG','10:00:00','L',1.006,503,'B747'); -insert into FLIGHTS values ('AA1213',2,'HKG','15:33:00','TPE','16:33:00','L',1.006,503,'B747'); -insert into FLIGHTS values ('US1572',1,'TPE','09:00:00','SYD','21:02:00','L',9.036,4518,'B747'); -insert into FLIGHTS values ('US1573',1,'SYD','09:00:00','TPE','15:02:00','L',9.036,4518,'B747'); -insert into FLIGHTS values ('US1574',1,'TPE','09:00:00','OSA','12:08:00','L',2.138,1069,'B747'); -insert into FLIGHTS values ('US1575',1,'OSA','09:00:00','TPE','10:08:00','L',2.138,1069,'B747'); -insert into FLIGHTS values ('US1576',1,'WAW','09:00:00','PRG','09:38:00','S',0.64,320,'B747'); -insert into FLIGHTS values ('US1577',1,'PRG','09:00:00','WAW','09:38:00','S',0.64,320,'B747'); -insert into FLIGHTS values ('US1578',1,'WAW','09:00:00','SVO','12:25:00','L',1.428,714,'B747'); -insert into FLIGHTS values ('US1579',1,'SVO','09:00:00','WAW','08:25:00','L',1.428,714,'B747'); -insert into FLIGHTS values ('US1580',1,'WAW','09:00:00','ARN','09:28:00','S',0.478,239,'B747'); -insert into FLIGHTS values ('US1581',1,'ARN','09:00:00','WAW','09:28:00','S',0.478,239,'B747'); -insert into FLIGHTS values ('US1379',1,'YUL','09:00:00','MDW','09:29:00','L',1.494,747,'B747'); -insert into FLIGHTS values ('US1380',2,'MDW','13:03:00','YUL','15:32:00','L',1.494,747,'B747'); -insert into FLIGHTS values ('US1584',1,'YUL','09:00:00','JFK','09:39:00','S',0.664,332,'B747'); -insert into FLIGHTS values ('US1585',1,'JFK','09:00:00','YUL','09:39:00','S',0.664,332,'B747'); -insert into FLIGHTS values ('US1586',1,'YUL','09:00:00','SFO','11:04:00','L',5.076,2538,'B747'); -insert into FLIGHTS values ('US1587',1,'SFO','09:00:00','YUL','17:04:00','L',5.076,2538,'B747'); -insert into FLIGHTS values ('US1588',1,'YYZ','09:00:00','SEA','10:08:00','L',4.134,2067,'B747'); -insert into FLIGHTS values ('US1589',1,'SEA','09:00:00','YYZ','16:08:00','L',4.134,2067,'B747'); -insert into FLIGHTS values ('US1590',1,'YYZ','09:00:00','MIA','11:28:00','L',2.474,1237,'B747'); -insert into FLIGHTS values ('US1591',2,'MIA','12:45:00','YYZ','15:13:00','L',2.474,1237,'DC10'); -insert into FLIGHTS values ('US1592',1,'YYZ','09:00:00','LHR','21:06:00','L',7.106,3553,'DC10'); -insert into FLIGHTS values ('US1593',1,'LHR','09:00:00','YYZ','11:06:00','L',7.106,3553,'B747'); -insert into FLIGHTS values ('AA1600',1,'SFO','07:00:00','LAX','07:41:00','S',0.694,347,'B767'); -insert into FLIGHTS values ('AA1601',1,'LAX','07:00:00','SFO','07:41:00','S',0.694,347,'B767'); -insert into FLIGHTS values ('AA1602',1,'SFO','14:00:00','LAX','14:41:00','S',0.694,347,'B767'); -insert into FLIGHTS values ('AA1603',1,'LAX','14:00:00','SFO','14:41:00','S',0.622,347,'B767'); -insert into FLIGHTS values ('US1600',1,'YYZ','09:00:00','YUL','09:37:00','S',0.694,311,'DC10'); -insert into FLIGHTS values ('US1600',2,'YUL','10:00:00','SCL','18:55:00','L',10.926,5463,'DC10'); -insert into FLIGHTS values ('US1601',1,'SCL','05:00:00','YUL','17:55:00','L',10.926,5463,'DC10'); -insert into FLIGHTS values ('US1601',2,'YUL','19:00:00','YYZ','19:37:00','L',0.622,311,'DC10'); +insert into FLIGHTS values ('AA1137',2,'KBL','13:30:00','SVO','15:41:00','S',4.192,2096,'A320'); +insert into FLIGHTS values ('AA1138',1,'SVO','09:00:00','KBL','15:11:00','L',4.192,2096,'A320'); +insert into FLIGHTS values ('US1321',1,'KHI','09:00:00','IST','10:54:00','L',4.9,2450,'B747'); +insert into FLIGHTS values ('US1322',1,'IST','09:00:00','KHI','16:54:00','L',4.9,2450,'B747'); +insert into FLIGHTS values ('US1323',1,'KHI','09:00:00','IST','10:54:00','L',4.9,2450,'B747'); +insert into FLIGHTS values ('US1324',1,'IST','09:00:00','KHI','16:54:00','L',4.9,2450,'B747'); +insert into FLIGHTS values ('US1325',1,'KHI','09:00:00','THR','09:53:00','L',2.384,1192,'B747'); +insert into FLIGHTS values ('US1326',1,'THR','09:00:00','KHI','12:53:00','L',2.384,1192,'B747'); +insert into FLIGHTS values ('US1327',1,'LAX','09:00:00','HNL','12:07:00','L',5.124,2562,'B747'); +insert into FLIGHTS values ('US1328',1,'HNL','09:00:00','LAX','16:07:00','L',5.124,2562,'B747'); +insert into FLIGHTS values ('US1329',1,'LAX','09:00:00','GRU','02:19:00','L',12.322,6161,'B747'); +insert into FLIGHTS values ('US1330',1,'GRU','09:00:00','LAX','16:19:00','L',12.322,6161,'B747'); +insert into FLIGHTS values ('US1331',1,'LAX','09:00:00','NRT','12:57:00','L',10.956,5478,'B747'); +insert into FLIGHTS values ('US1332',1,'NRT','09:00:00','LAX','02:57:00','L',10.956,5478,'B747'); +insert into FLIGHTS values ('US1333',1,'LHR','09:00:00','WAW','11:47:00','L',1.798,899,'B747'); +insert into FLIGHTS values ('US1334',1,'WAW','09:00:00','LHR','09:47:00','L',1.798,899,'B747'); +insert into FLIGHTS values ('US1335',1,'LHR','09:00:00','YYZ','11:06:00','L',7.106,3553,'B747'); +insert into FLIGHTS values ('US1336',1,'YYZ','09:00:00','LHR','21:06:00','L',7.106,3553,'B747'); +insert into FLIGHTS values ('US1337',1,'LHR','09:00:00','NBO','20:28:00','L',8.48,4240,'B747'); +insert into FLIGHTS values ('US1338',1,'NBO','09:00:00','LHR','14:28:00','L',8.48,4240,'B747'); +insert into FLIGHTS values ('US1501',2,'LIM','11:00:00','MIA','16:15:00','L',5.25,625,'B747'); +insert into FLIGHTS values ('US1340',1,'MIA','09:00:00','LIM','14:15:00','L',5.25,2625,'B747'); +insert into FLIGHTS values ('US1338',2,'LIM','20:00:00','MIA','01:15:00','L',5.25,2625,'B747'); +insert into FLIGHTS values ('US1339',1,'MIA','18:00:00','LIM','23:15:00','L',5.25,2625,'B747'); +insert into FLIGHTS values ('US1344',2,'LIM','12:00:00','BUE','18:53:00','L',3.896,1948,'B747'); +insert into FLIGHTS values ('US1342',1,'BUE','09:00:00','LIM','09:53:00','L',3.896,1948,'B747'); +insert into FLIGHTS values ('US1342',2,'LIM','10:30:00','BOG','12:50:00','L',2.338,1169,'B747'); +insert into FLIGHTS values ('US1344',1,'BOG','09:00:00','LIM','11:20:00','L',2.338,1169,'B747'); +insert into FLIGHTS values ('US1345',1,'LIS','09:00:00','CDG','11:48:00','L',1.806,903,'B747'); +insert into FLIGHTS values ('US1346',1,'CDG','09:00:00','LIS','09:48:00','L',1.806,903,'B747'); +insert into FLIGHTS values ('US1347',1,'LIS','09:00:00','CAS','09:43:00','S',0.73,365,'B747'); +insert into FLIGHTS values ('US1348',1,'CAS','09:00:00','LIS','09:43:00','S',0.73,365,'B747'); +insert into FLIGHTS values ('US1349',1,'LIS','09:00:00','JFK','10:44:00','L',6.744,3372,'B747'); +insert into FLIGHTS values ('US1300',2,'JFK','17:45:00','LIS','05:29:00','L',6.744,3372,'B747'); +insert into FLIGHTS values ('AA1223',1,'LOS','09:00:00','CDG','14:52:00','L',5.868,2934,'B747'); +insert into FLIGHTS values ('AA1224',2,'CDG','11:00:00','LOS','16:52:00','L',5.868,2934,'B747'); +insert into FLIGHTS values ('US1353',1,'LOS','09:00:00','MAD','13:46:00','L',4.776,2388,'B747'); +insert into FLIGHTS values ('US1354',1,'MAD','09:00:00','LOS','13:46:00','L',4.776,2388,'B747'); +insert into FLIGHTS values ('US1355',1,'LOS','09:00:00','ATH','15:03:00','L',5.054,2527,'B747'); +insert into FLIGHTS values ('US1356',1,'ATH','09:00:00','LOS','13:03:00','L',5.054,2527,'B747'); +insert into FLIGHTS values ('US1357',2,'MAD','11:45:00','CDG','13:03:00','L',1.31,655,'B747'); +insert into FLIGHTS values ('US1358',1,'CDG','09:00:00','MAD','10:18:00','L',1.31,655,'B747'); +insert into FLIGHTS values ('US1358',2,'MAD','11:05:00','CAS','11:07:00','L',1.036,518,'B747'); +insert into FLIGHTS values ('US1357',1,'CAS','09:00:00','MAD','11:02:00','L',1.036,518,'B747'); +insert into FLIGHTS values ('US1361',1,'MAD','09:00:00','JFK','10:10:00','L',7.178,3589,'B747'); +insert into FLIGHTS values ('US1362',1,'JFK','09:00:00','MAD','22:10:00','L',7.178,3589,'B747'); +insert into FLIGHTS values ('US1363',1,'MCI','09:00:00','LAX','09:42:00','L',2.71,1355,'B747'); +insert into FLIGHTS values ('US1364',1,'LAX','09:00:00','MCI','13:42:00','L',2.71,1355,'B747'); +insert into FLIGHTS values ('US1365',1,'MCI','09:00:00','DFW','09:54:00','L',0.908,454,'B747'); +insert into FLIGHTS values ('US1366',1,'DFW','09:00:00','MCI','09:54:00','L',0.908,454,'B747'); +insert into FLIGHTS values ('US1367',1,'MCI','09:00:00','JFK','12:11:00','L',2.19,1095,'B747'); +insert into FLIGHTS values ('US1368',1,'JFK','09:00:00','MCI','10:11:00','L',2.19,1095,'B747'); +insert into FLIGHTS values ('US1379',2,'MDW','10:03:00','LAX','11:31:00','L',3.482,1741,'B747'); +insert into FLIGHTS values ('US1380',1,'LAX','09:00:00','MDW','14:28:00','L',3.482,1741,'B747'); +insert into FLIGHTS values ('US1473',2,'MDW','13:30:00','JFK','15:55:00','L',1.428,714,'B747'); +insert into FLIGHTS values ('US1474',1,'JFK','11:00:00','MDW','11:25:00','L',1.428,714,'B747'); +insert into FLIGHTS values ('US1383',1,'MDW','12:15:00','ATL','14:25:00','L',1.174,587,'B747'); +insert into FLIGHTS values ('US1384',1,'ATL','11:30:00','MDW','11:40:00','L',1.174,587,'B747'); +insert into FLIGHTS values ('US1385',1,'MEL','09:00:00','SYD','09:52:00','L',0.882,441,'B747'); +insert into FLIGHTS values ('US1386',1,'SYD','09:00:00','MEL','09:52:00','L',0.882,441,'B747'); +insert into FLIGHTS values ('US1387',1,'MEL','09:00:00','SIN','13:32:00','L',7.536,3768,'B747'); +insert into FLIGHTS values ('US1388',2,'SIN','14:15:00','MEL','00:47:00','L',7.536,3768,'B747'); +insert into FLIGHTS values ('US1389',1,'MEL','09:00:00','HNL','23:02:00','L',11.044,5522,'B747'); +insert into FLIGHTS values ('US1390',1,'HNL','12:45:00','MEL','20:47:00','L',11.044,5522,'B747'); +insert into FLIGHTS values ('US1391',1,'MEM','09:00:00','MIA','11:44:00','L',1.742,871,'B747'); +insert into FLIGHTS values ('US1392',1,'MIA','09:00:00','MEM','09:44:00','L',1.742,871,'B747'); +insert into FLIGHTS values ('US1393',1,'MEM','09:00:00','JFK','11:54:00','L',1.908,954,'B747'); +insert into FLIGHTS values ('US1394',1,'JFK','09:00:00','MEM','09:54:00','L',1.908,954,'B747'); +insert into FLIGHTS values ('US1395',1,'MEM','09:00:00','LAX','10:12:00','L',3.202,1601,'B747'); +insert into FLIGHTS values ('US1396',1,'LAX','09:00:00','MEM','14:12:00','L',3.202,1601,'B747'); +insert into FLIGHTS values ('US1397',1,'MEX','09:00:00','SFO','10:46:00','L',3.78,1890,'B747'); +insert into FLIGHTS values ('US1398',1,'SFO','09:00:00','MEX','14:46:00','L',3.78,1890,'B747'); +insert into FLIGHTS values ('US1399',1,'MEX','15:00:00','LAX','16:06:00','S',3.1,1550,'B747'); +insert into FLIGHTS values ('US1400',1,'LAX','09:00:00','MEX','14:06:00','L',3.1,1550,'B747'); +insert into FLIGHTS values ('US1401',1,'MEX','09:00:00','BOG','13:57:00','L',3.95,1975,'B747'); +insert into FLIGHTS values ('US1402',1,'BOG','09:00:00','MEX','11:57:00','L',3.95,1975,'B747'); +insert into FLIGHTS values ('US1403',1,'MIA','18:00:00','GRU','04:10:00','L',8.172,4086,'B747'); +insert into FLIGHTS values ('US1404',1,'GRU','23:00:00','MIA','05:10:00','L',8.172,4086,'B747'); +insert into FLIGHTS values ('US1405',1,'MIA','17:30:00','LAX','19:10:00','D',4.67,2335,'B747'); +insert into FLIGHTS values ('US1406',1,'LAX','08:00:00','MIA','15:40:00','L',4.67,2335,'B747'); +insert into FLIGHTS values ('US1407',1,'MIA','09:00:00','JFK','11:11:00','L',2.184,1092,'B747'); +insert into FLIGHTS values ('US1408',1,'JFK','09:00:00','MIA','11:11:00','L',2.184,1092,'B747'); +insert into FLIGHTS values ('US1409',1,'MKE','09:00:00','JFK','11:27:00','L',1.466,733,'B747'); +insert into FLIGHTS values ('US1410',1,'JFK','09:00:00','MKE','09:27:00','L',1.466,733,'B747'); +insert into FLIGHTS values ('US1411',1,'MKE','09:00:00','MDW','09:09:00','S',0.166,83,'B747'); +insert into FLIGHTS values ('US1412',1,'MDW','09:00:00','MKE','09:09:00','S',0.166,83,'B747'); +insert into FLIGHTS values ('US1413',1,'MKE','09:00:00','JFK','11:27:00','L',1.466,733,'B747'); +insert into FLIGHTS values ('US1414',1,'JFK','09:00:00','MKE','09:27:00','L',1.466,733,'B747'); +insert into FLIGHTS values ('US1415',1,'MNL','09:00:00','SYD','19:47:00','L',7.794,3897,'B747'); +insert into FLIGHTS values ('US1416',1,'SYD','09:00:00','MNL','13:47:00','L',7.794,3897,'B747'); +insert into FLIGHTS values ('US1417',1,'MNL','09:00:00','TPE','10:26:00','L',1.448,724,'B747'); +insert into FLIGHTS values ('US1418',1,'TPE','09:00:00','MNL','10:26:00','L',1.448,724,'B747'); +insert into FLIGHTS values ('US1419',1,'MNL','09:00:00','SIN','11:58:00','L',2.978,1489,'B747'); +insert into FLIGHTS values ('US1420',2,'SIN','11:53:00','MNL','14:51:00','L',2.978,1489,'B747'); +insert into FLIGHTS values ('AA1419',1,'MNL','12:00:00','HKG','13:23:00','L',1.388,694,'B747'); +insert into FLIGHTS values ('AA1420',2,'HKG','17:53:00','MNL','19:16:00','D',1.388,694,'B747'); +insert into FLIGHTS values ('AA1421',1,'MNL','07:00:00','HNL','23:36:00','B',10.604,5302,'B747'); +insert into FLIGHTS values ('US1422',2,'HNL','14:05:00','MNL','18:41:00','L',10.604,5302,'B747'); +insert into FLIGHTS values ('AA1249',1,'MSP','09:00:00','DEN','09:52:00','L',1.882,941,'B747'); +insert into FLIGHTS values ('AA1250',2,'DEN','12:37:00','MSP','15:29:00','L',1.882,941,'B747'); +insert into FLIGHTS values ('US1423',1,'MSP','09:00:00','MDW','09:25:00','S',0.43,215,'B747'); +insert into FLIGHTS values ('US1424',1,'MDW','09:00:00','MSP','09:25:00','S',0.43,215,'B747'); +insert into FLIGHTS values ('AA1423',1,'MDW','08:00:00','MIA','11:22:00','L',2.376,1188,'B747'); +insert into FLIGHTS values ('AA1424',1,'MIA','17:00:00','MDW','18:22:00','L',2.376,1188,'B747'); +insert into FLIGHTS values ('US1427',1,'MSY','09:00:00','SFO','10:50:00','L',3.846,1923,'B747'); +insert into FLIGHTS values ('US1428',1,'SFO','09:00:00','MSY','14:50:00','L',3.846,1923,'B747'); +insert into FLIGHTS values ('US1429',1,'MSY','09:00:00','ATL','10:50:00','L',0.848,424,'B747'); +insert into FLIGHTS values ('US1430',1,'ATL','09:00:00','MSY','08:50:00','L',0.848,424,'B747'); +insert into FLIGHTS values ('US1431',1,'MSY','09:00:00','JFK','12:20:00','L',2.336,1168,'B747'); +insert into FLIGHTS values ('US1432',1,'JFK','09:00:00','MSY','10:20:00','L',2.336,1168,'B747'); +insert into FLIGHTS values ('US1433',1,'NBO','09:00:00','FCO','13:42:00','L',6.702,3351,'B747'); +insert into FLIGHTS values ('US1434',1,'FCO','09:00:00','NBO','17:42:00','L',6.702,3351,'B747'); +insert into FLIGHTS values ('US1435',1,'NBO','06:00:00','MAD','11:41:00','L',7.694,3847,'B747'); +insert into FLIGHTS values ('US1436',1,'MAD','13:10:00','NBO','22:51:00','L',7.694,3847,'B747'); +insert into FLIGHTS values ('US1437',1,'NBO','09:00:00','CAS','13:31:00','L',7.518,3759,'B747'); +insert into FLIGHTS values ('US1438',1,'CAS','09:00:00','NBO','19:31:00','L',7.518,3759,'B747'); +insert into FLIGHTS values ('US1439',1,'NRT','09:00:00','SYD','20:44:00','L',9.736,4868,'B747'); +insert into FLIGHTS values ('US1440',1,'SYD','09:00:00','NRT','16:44:00','L',9.736,4868,'B747'); +insert into FLIGHTS values ('US1441',1,'NRT','09:00:00','LAX','02:57:00','L',10.956,5478,'B747'); +insert into FLIGHTS values ('US1442',1,'LAX','09:00:00','NRT','12:57:00','L',10.956,5478,'B747'); +insert into FLIGHTS values ('US1443',2,'NRT','14:45:00','HKG','17:20:00','L',3.596,1798,'B747'); +insert into FLIGHTS values ('US1444',1,'HKG','09:00:00','NRT','13:35:00','L',3.596,1798,'B747'); +insert into FLIGHTS values ('US1445',1,'OKC','09:00:00','SLC','09:43:00','L',1.722,861,'B747'); +insert into FLIGHTS values ('US1446',1,'SLC','09:00:00','OKC','11:43:00','L',1.722,861,'B747'); +insert into FLIGHTS values ('US1447',1,'OKC','09:00:00','JFK','12:38:00','L',2.648,1324,'B747'); +insert into FLIGHTS values ('US1448',1,'JFK','09:00:00','OKC','10:38:00','L',2.648,1324,'B747'); +insert into FLIGHTS values ('US1449',1,'OKC','09:00:00','LAX','09:21:00','L',2.36,1180,'B747'); +insert into FLIGHTS values ('US1450',1,'LAX','09:00:00','OKC','13:21:00','L',2.36,1180,'B747'); +insert into FLIGHTS values ('US1451',1,'OSA','09:00:00','NRT','09:30:00','S',0.502,251,'B747'); +insert into FLIGHTS values ('US1452',1,'NRT','09:00:00','OSA','09:30:00','S',0.502,251,'B747'); +insert into FLIGHTS values ('US1453',1,'OSA','09:00:00','TPE','10:08:00','L',2.138,1069,'B747'); +insert into FLIGHTS values ('US1454',1,'TPE','09:00:00','OSA','12:08:00','L',2.138,1069,'B747'); +insert into FLIGHTS values ('US1455',1,'OSA','09:00:00','SVO','12:07:00','L',9.13,4565,'B747'); +insert into FLIGHTS values ('US1456',1,'SVO','09:00:00','OSA','00:07:00','L',9.13,4565,'B747'); +insert into FLIGHTS values ('US1457',1,'OSL','09:00:00','PRG','10:23:00','L',1.39,695,'B747'); +insert into FLIGHTS values ('US1458',1,'PRG','11:00:00','OSL','12:23:00','L',1.39,695,'B747'); +insert into FLIGHTS values ('US1459',1,'OSL','09:00:00','ARN','10:34:00','L',1.574,787,'B747'); +insert into FLIGHTS values ('US1460',1,'ARN','09:00:00','OSL','10:34:00','L',1.574,787,'B747'); +insert into FLIGHTS values ('US1461',1,'OSL','09:00:00','WAW','10:19:00','L',1.318,659,'B747'); +insert into FLIGHTS values ('US1462',1,'WAW','09:00:00','OSL','10:19:00','L',1.318,659,'B747'); +insert into FLIGHTS values ('AA1462',1,'OSL','07:15:00','CDG','08:55:00','B',1.668,834,'B747'); +insert into FLIGHTS values ('AA1463',1,'CDG','11:00:00','OSL','12:40:00','L',1.668,834,'B747'); +insert into FLIGHTS values ('US1463',1,'PHL','09:00:00','IAD','09:21:00','S',0.364,182,'B747'); +insert into FLIGHTS values ('US1464',1,'IAD','09:00:00','PHL','09:21:00','S',0.364,182,'B747'); +insert into FLIGHTS values ('US1465',1,'PHL','09:00:00','MIA','11:02:00','L',2.044,1022,'B747'); +insert into FLIGHTS values ('US1466',1,'MIA','09:00:00','PHL','11:02:00','L',2.044,1022,'B747'); +insert into FLIGHTS values ('AA1258',1,'PHL','09:00:00','ATL','10:19:00','L',1.33,665,'B747'); +insert into FLIGHTS values ('AA1257',2,'ATL','12:10:00','PHL','13:29:00','L',1.33,665,'B747'); +insert into FLIGHTS values ('US1469',1,'PHX','09:00:00','LAX','08:42:00','S',0.714,357,'B747'); +insert into FLIGHTS values ('US1470',1,'LAX','09:00:00','PHX','10:42:00','S',0.714,357,'B747'); +insert into FLIGHTS values ('US1471',1,'PHX','09:00:00','SEA','10:13:00','L',2.23,1115,'B747'); +insert into FLIGHTS values ('US1472',1,'SEA','09:00:00','PHX','12:13:00','L',2.23,1115,'B747'); +insert into FLIGHTS values ('US1473',1,'PHX','09:00:00','MDW','12:53:00','L',2.898,1449,'B747'); +insert into FLIGHTS values ('US1474',2,'MDW','09:55:00','PHX','11:48:00','L',2.898,1449,'B747'); +insert into FLIGHTS values ('US1475',1,'PRG','09:00:00','CDG','10:06:00','L',1.102,551,'B747'); +insert into FLIGHTS values ('US1476',1,'CDG','09:00:00','PRG','10:06:00','L',1.102,551,'B747'); +insert into FLIGHTS values ('US1477',1,'PRG','09:00:00','FCO','10:08:00','L',1.146,573,'B747'); +insert into FLIGHTS values ('US1478',1,'FCO','09:00:00','PRG','10:08:00','L',1.146,573,'B747'); +insert into FLIGHTS values ('US1479',1,'PRG','09:00:00','REY','11:16:00','B',3.282,1641,'A320'); +insert into FLIGHTS values ('US1480',1,'REY','09:00:00','PRG','13:16:00','L',3.282,1641,'A320'); +insert into FLIGHTS values ('US1481',1,'REY','09:00:00','SVO','16:06:00','L',4.112,2056,'B747'); +insert into FLIGHTS values ('US1482',2,'SVO','13:15:00','REY','14:21:00','L',4.112,2056,'B747'); +insert into FLIGHTS values ('US1483',1,'REY','09:00:00','CDG','12:46:00','L',2.776,1388,'B747'); +insert into FLIGHTS values ('US1484',1,'CDG','09:00:00','REY','10:46:00','L',2.776,1388,'B747'); +insert into FLIGHTS values ('US1485',1,'REY','09:00:00','DUB','10:51:00','L',1.862,931,'B747'); +insert into FLIGHTS values ('US1486',1,'DUB','09:00:00','REY','10:51:00','L',1.862,931,'B747'); +insert into FLIGHTS values ('US1487',1,'SAN','09:00:00','SFO','09:55:00','L',0.918,459,'B747'); +insert into FLIGHTS values ('US1488',1,'SFO','09:00:00','SAN','09:55:00','L',0.918,459,'B747'); +insert into FLIGHTS values ('US1489',1,'SAN','09:00:00','DFW','13:21:00','L',2.36,1180,'B747'); +insert into FLIGHTS values ('US1490',1,'DFW','09:00:00','SAN','09:21:00','L',2.36,1180,'B747'); +insert into FLIGHTS values ('US1491',1,'SAN','09:00:00','MEX','13:53:00','L',2.888,1444,'B747'); +insert into FLIGHTS values ('US1492',1,'MEX','09:00:00','SAN','09:53:00','L',2.888,1444,'B747'); +insert into FLIGHTS values ('US1493',1,'SAT','09:00:00','ATL','11:45:00','L',1.766,883,'B747'); +insert into FLIGHTS values ('US1494',1,'ATL','09:00:00','SAT','09:45:00','L',1.766,883,'B747'); +insert into FLIGHTS values ('US1495',1,'SAT','09:00:00','LAX','09:24:00','L',2.404,1202,'B747'); +insert into FLIGHTS values ('US1496',1,'LAX','09:00:00','SAT','13:24:00','L',2.404,1202,'B747'); +insert into FLIGHTS values ('US1497',1,'SAT','09:00:00','MIA','12:17:00','L',2.292,1146,'B747'); +insert into FLIGHTS values ('US1498',1,'MIA','09:00:00','SAT','10:17:00','L',2.292,1146,'B747'); +insert into FLIGHTS values ('US1499',1,'SCL','09:00:00','GRU','12:13:00','L',3.218,1609,'B747'); +insert into FLIGHTS values ('US1500',1,'GRU','09:00:00','SCL','12:13:00','L',3.218,1609,'B747'); +insert into FLIGHTS values ('US1501',1,'SCL','09:00:00','LIM','10:04:00','L',3.068,1534,'B747'); +insert into FLIGHTS values ('US1340',2,'LIM','15:00:00','SCL','20:04:00','L',3.068,1534,'B747'); +insert into FLIGHTS values ('US1503',1,'SCL','09:00:00','BUE','11:24:00','L',1.408,704,'B747'); +insert into FLIGHTS values ('US1504',1,'BUE','09:00:00','SCL','09:24:00','L',1.408,704,'B747'); +insert into FLIGHTS values ('US1505',1,'SEA','09:00:00','SFO','10:21:00','L',1.356,678,'B747'); +insert into FLIGHTS values ('AA1505',1,'SFO','09:00:00','SEA','10:21:00','L',1.356,678,'B747'); +insert into FLIGHTS values ('US1506',1,'SEA','09:00:00','JFK','16:48:00','L',4.81,2405,'B747'); +insert into FLIGHTS values ('US1507',1,'JFK','09:00:00','SEA','10:48:00','L',4.81,2405,'B747'); +insert into FLIGHTS values ('US1508',1,'SEA','09:00:00','MIA','17:27:00','L',5.462,2731,'B747'); +insert into FLIGHTS values ('US1509',2,'MIA','15:15:00','SEA','17:42:00','L',5.462,2731,'B747'); +insert into FLIGHTS values ('US1510',1,'SEL','09:00:00','NRT','10:26:00','L',1.438,719,'B747'); +insert into FLIGHTS values ('US1511',1,'NRT','09:00:00','SEL','10:26:00','L',1.438,719,'B747'); +insert into FLIGHTS values ('US1388',1,'SEL','09:00:00','SIN','13:49:00','L',5.818,2909,'B747'); +insert into FLIGHTS values ('US1387',2,'SIN','14:05:00','SEL','20:54:00','L',5.818,2909,'B747'); +insert into FLIGHTS values ('US1514',1,'SEL','09:00:00','SHA','09:05:00','L',1.098,549,'B747'); +insert into FLIGHTS values ('US1515',1,'SHA','09:00:00','SEL','11:05:00','L',1.098,549,'B747'); +insert into FLIGHTS values ('US1516',1,'SFO','12:00:00','JFK','20:08:00','L',5.136,2568,'B747'); +insert into FLIGHTS values ('US1517',2,'JFK','11:05:00','SFO','13:13:00','L',5.136,2568,'B747'); +insert into FLIGHTS values ('US1518',1,'SFO','09:00:00','MIA','17:10:00','L',5.18,2590,'B747'); +insert into FLIGHTS values ('US1518',2,'MIA','18:05:00','SCL','04:22:00','L',8.288,4144,'B747'); +insert into FLIGHTS values ('US1519',1,'SCL','09:00:00','MIA','15:17:00','D',8.288,4144,'B747'); +insert into FLIGHTS values ('US1519',2,'MIA','16:10:00','SFO','18:20:00','D',5.18,2590,'B747'); +insert into FLIGHTS values ('US1529',1,'SFO','09:00:00','HNL','11:47:00','L',4.794,2397,'B747'); +insert into FLIGHTS values ('US1521',1,'HNL','09:00:00','SFO','15:47:00','L',4.794,2397,'B747'); +insert into FLIGHTS values ('US1522',1,'SHA','09:00:00','SIN','13:43:00','L',4.72,2360,'B747'); +insert into FLIGHTS values ('US1523',1,'SIN','09:00:00','SHA','13:43:00','L',4.72,2360,'B747'); +insert into FLIGHTS values ('US1524',1,'SHA','09:00:00','HKG','10:30:00','L',1.514,757,'B747'); +insert into FLIGHTS values ('US1525',1,'HKG','09:00:00','SHA','10:30:00','L',1.514,757,'B747'); +insert into FLIGHTS values ('US1526',1,'SHA','09:00:00','SVO','12:29:00','L',8.486,4243,'B747'); +insert into FLIGHTS values ('US1527',1,'SVO','09:00:00','SHA','22:29:00','L',8.486,4243,'B747'); +insert into FLIGHTS values ('AA1528',1,'SIN','09:00:00','SYD','19:50:00','L',7.834,3917,'B747'); +insert into FLIGHTS values ('AA1529',1,'SYD','09:00:00','SIN','13:50:00','L',7.834,3917,'B747'); +insert into FLIGHTS values ('US1419',2,'SIN','12:35:00','JKT','12:41:00','L',1.108,554,'B747'); +insert into FLIGHTS values ('US1420',1,'JKT','09:00:00','SIN','11:06:00','L',1.108,554,'B747'); +insert into FLIGHTS values ('AA1532',1,'SIN','09:00:00','HKG','12:12:00','L',3.214,1607,'B747'); +insert into FLIGHTS values ('AA1533',1,'HKG','09:00:00','SIN','12:12:00','L',3.214,1607,'B747'); +insert into FLIGHTS values ('AA1186',1,'SJU','09:00:00','MIA','10:04:00','L',2.07,1035,'B747'); +insert into FLIGHTS values ('AA1185',2,'MIA','12:20:00','SJU','15:24:00','L',2.07,1035,'B747'); +insert into FLIGHTS values ('US1536',1,'SJU','09:00:00','CCS','10:06:00','L',1.106,553,'B747'); +insert into FLIGHTS values ('US1537',1,'CCS','09:00:00','SJU','10:06:00','L',1.106,553,'B747'); +insert into FLIGHTS values ('US1538',1,'SJU','09:00:00','MEL','20:17:00','L',20.288,10144,'B747'); +insert into FLIGHTS values ('US1539',1,'MEL','09:00:00','SJU','14:17:00','L',20.288,10144,'B747'); +insert into FLIGHTS values ('US1540',1,'SLC','09:00:00','DEN','09:44:00','S',0.74,370,'B747'); +insert into FLIGHTS values ('US1541',1,'DEN','09:00:00','SLC','09:44:00','S',0.74,370,'B747'); +insert into FLIGHTS values ('US1542',1,'SLC','09:00:00','SFO','09:11:00','L',1.198,599,'B747'); +insert into FLIGHTS values ('US1543',1,'SFO','09:00:00','SLC','11:11:00','L',1.198,599,'B747'); +insert into FLIGHTS values ('US1544',1,'SLC','09:00:00','MDW','12:30:00','L',2.51,1255,'B747'); +insert into FLIGHTS values ('US1545',1,'MDW','09:00:00','SLC','10:30:00','L',2.51,1255,'B747'); +insert into FLIGHTS values ('US1546',1,'STL','09:00:00','MDW','09:31:00','S',0.518,259,'B747'); +insert into FLIGHTS values ('US1547',1,'MDW','09:00:00','STL','09:31:00','S',0.518,259,'B747'); +insert into FLIGHTS values ('US1548',1,'STL','09:00:00','JFK','11:44:00','L',1.746,873,'B747'); +insert into FLIGHTS values ('US1549',1,'JFK','09:00:00','STL','09:44:00','L',1.746,873,'B747'); +insert into FLIGHTS values ('US1550',1,'STL','09:00:00','LAX','10:10:00','L',3.174,1587,'B747'); +insert into FLIGHTS values ('US1551',1,'LAX','09:00:00','STL','14:10:00','L',3.174,1587,'B747'); +insert into FLIGHTS values ('US1552',1,'SVO','14:00:00','CDG','15:05:00','L',3.09,1545,'B747'); +insert into FLIGHTS values ('US1553',1,'CDG','14:00:00','SVO','19:05:00','L',3.09,1545,'B747'); +insert into FLIGHTS values ('US1554',1,'SVO','09:00:00','NRT','00:18:00','L',9.308,4654,'B747'); +insert into FLIGHTS values ('US1555',1,'NRT','09:00:00','SVO','12:18:00','L',9.308,4654,'B747'); +insert into FLIGHTS values ('US1481',2,'SVO','13:45:00','BOM','22:30:00','L',6.266,3133,'B747'); +insert into FLIGHTS values ('US1482',1,'BOM','09:00:00','SVO','12:45:00','L',6.266,3133,'B747'); +insert into FLIGHTS values ('US1558',1,'SYD','09:00:00','AKL','13:40:00','L',2.682,1341,'B747'); +insert into FLIGHTS values ('US1559',1,'AKL','09:00:00','SYD','09:40:00','L',2.682,1341,'B747'); +insert into FLIGHTS values ('US1560',1,'SYD','15:00:00','HNL','04:09:00','L',10.16,5080,'B747'); +insert into FLIGHTS values ('US1561',1,'HNL','13:00:00','SYD','20:09:00','L',10.16,5080,'B747'); +insert into FLIGHTS values ('US1562',1,'SYD','09:00:00','HKG','15:09:00','L',9.166,4583,'B747'); +insert into FLIGHTS values ('US1563',1,'HKG','09:00:00','SYD','21:09:00','L',9.166,4583,'B747'); +insert into FLIGHTS values ('US1564',1,'THR','09:00:00','KBL','12:30:00','L',2.014,1007,'B747'); +insert into FLIGHTS values ('US1565',1,'KBL','09:00:00','THR','09:30:00','L',2.014,1007,'B747'); +insert into FLIGHTS values ('US1566',1,'THR','09:00:00','KHI','12:53:00','L',2.384,1192,'B747'); +insert into FLIGHTS values ('US1567',1,'KHI','09:00:00','THR','09:53:00','L',2.384,1192,'B747'); +insert into FLIGHTS values ('US1568',1,'THR','09:00:00','CAI','09:57:00','L',2.464,1232,'B747'); +insert into FLIGHTS values ('US1569',1,'CAI','09:00:00','THR','12:57:00','L',2.464,1232,'B747'); +insert into FLIGHTS values ('AA1214',1,'TPE','09:00:00','HKG','10:00:00','L',1.006,503,'B747'); +insert into FLIGHTS values ('AA1213',2,'HKG','15:33:00','TPE','16:33:00','L',1.006,503,'B747'); +insert into FLIGHTS values ('US1572',1,'TPE','09:00:00','SYD','21:02:00','L',9.036,4518,'B747'); +insert into FLIGHTS values ('US1573',1,'SYD','09:00:00','TPE','15:02:00','L',9.036,4518,'B747'); +insert into FLIGHTS values ('US1574',1,'TPE','09:00:00','OSA','12:08:00','L',2.138,1069,'B747'); +insert into FLIGHTS values ('US1575',1,'OSA','09:00:00','TPE','10:08:00','L',2.138,1069,'B747'); +insert into FLIGHTS values ('US1576',1,'WAW','09:00:00','PRG','09:38:00','S',0.64,320,'B747'); +insert into FLIGHTS values ('US1577',1,'PRG','09:00:00','WAW','09:38:00','S',0.64,320,'B747'); +insert into FLIGHTS values ('US1578',1,'WAW','09:00:00','SVO','12:25:00','L',1.428,714,'B747'); +insert into FLIGHTS values ('US1579',1,'SVO','09:00:00','WAW','08:25:00','L',1.428,714,'B747'); +insert into FLIGHTS values ('US1580',1,'WAW','09:00:00','ARN','09:28:00','S',0.478,239,'B747'); +insert into FLIGHTS values ('US1581',1,'ARN','09:00:00','WAW','09:28:00','S',0.478,239,'B747'); +insert into FLIGHTS values ('US1379',1,'YUL','09:00:00','MDW','09:29:00','L',1.494,747,'B747'); +insert into FLIGHTS values ('US1380',2,'MDW','13:03:00','YUL','15:32:00','L',1.494,747,'B747'); +insert into FLIGHTS values ('US1584',1,'YUL','09:00:00','JFK','09:39:00','S',0.664,332,'B747'); +insert into FLIGHTS values ('US1585',1,'JFK','09:00:00','YUL','09:39:00','S',0.664,332,'B747'); +insert into FLIGHTS values ('US1586',1,'YUL','09:00:00','SFO','11:04:00','L',5.076,2538,'B747'); +insert into FLIGHTS values ('US1587',1,'SFO','09:00:00','YUL','17:04:00','L',5.076,2538,'B747'); +insert into FLIGHTS values ('US1588',1,'YYZ','09:00:00','SEA','10:08:00','L',4.134,2067,'B747'); +insert into FLIGHTS values ('US1589',1,'SEA','09:00:00','YYZ','16:08:00','L',4.134,2067,'B747'); +insert into FLIGHTS values ('US1590',1,'YYZ','09:00:00','MIA','11:28:00','L',2.474,1237,'B747'); +insert into FLIGHTS values ('US1591',2,'MIA','12:45:00','YYZ','15:13:00','L',2.474,1237,'DC10'); +insert into FLIGHTS values ('US1592',1,'YYZ','09:00:00','LHR','21:06:00','L',7.106,3553,'DC10'); +insert into FLIGHTS values ('US1593',1,'LHR','09:00:00','YYZ','11:06:00','L',7.106,3553,'B747'); +insert into FLIGHTS values ('AA1600',1,'SFO','07:00:00','LAX','07:41:00','S',0.694,347,'B767'); +insert into FLIGHTS values ('AA1601',1,'LAX','07:00:00','SFO','07:41:00','S',0.694,347,'B767'); +insert into FLIGHTS values ('AA1602',1,'SFO','14:00:00','LAX','14:41:00','S',0.694,347,'B767'); +insert into FLIGHTS values ('AA1603',1,'LAX','14:00:00','SFO','14:41:00','S',0.622,347,'B767'); +insert into FLIGHTS values ('US1600',1,'YYZ','09:00:00','YUL','09:37:00','S',0.694,311,'DC10'); +insert into FLIGHTS values ('US1600',2,'YUL','10:00:00','SCL','18:55:00','L',10.926,5463,'DC10'); +insert into FLIGHTS values ('US1601',1,'SCL','05:00:00','YUL','17:55:00','L',10.926,5463,'DC10'); +insert into FLIGHTS values ('US1601',2,'YUL','19:00:00','YYZ','19:37:00','L',0.622,311,'DC10'); diff --git a/openjpa-features/pom.xml b/openjpa-features/pom.xml index 9aff04188..c184099b1 100644 --- a/openjpa-features/pom.xml +++ b/openjpa-features/pom.xml @@ -1,15 +1,15 @@ - - diff --git a/openjpa-integration/daytrader/pom.xml b/openjpa-integration/daytrader/pom.xml index 3fcf1c8c8..e33a3d272 100644 --- a/openjpa-integration/daytrader/pom.xml +++ b/openjpa-integration/daytrader/pom.xml @@ -7,18 +7,18 @@ 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. + under the License. --> - @@ -119,7 +119,7 @@ test-compile - + @@ -173,7 +173,7 @@ ${surefire.jvm.args} - org/apache/openjpa/**/*Test.java diff --git a/openjpa-integration/daytrader/src/main/ant/enhancer.xml b/openjpa-integration/daytrader/src/main/ant/enhancer.xml index d80d9bece..6929512c0 100644 --- a/openjpa-integration/daytrader/src/main/ant/enhancer.xml +++ b/openjpa-integration/daytrader/src/main/ant/enhancer.xml @@ -7,24 +7,24 @@ 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. + under the License. --> @@ -40,8 +40,8 @@ - - running enhancer - diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/AccountDataBean.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/AccountDataBean.java index 79d90c403..5bf4ddefa 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/AccountDataBean.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/AccountDataBean.java @@ -67,38 +67,38 @@ public class AccountDataBean implements Serializable { valueColumnName="KEYVAL", pkColumnValue="account", allocationSize=1000) - + @Id @GeneratedValue(strategy=GenerationType.TABLE, generator="accountIdGen") @Column(name = "ACCOUNTID", nullable = false) private Integer accountID; /* accountID */ - + @Column(name = "LOGINCOUNT", nullable = false) private int loginCount; /* loginCount */ - + @Column(name = "LOGOUTCOUNT", nullable = false) private int logoutCount; /* logoutCount */ - + @Column(name = "LASTLOGIN") @Temporal(TemporalType.TIMESTAMP) private Date lastLogin; /* lastLogin Date */ - + @Column(name = "CREATIONDATE") @Temporal(TemporalType.TIMESTAMP) private Date creationDate; /* creationDate */ - + @Column(name = "BALANCE", precision=12, scale=2) private BigDecimal balance; /* balance */ - + @Column(name = "OPENBALANCE", precision=12, scale=2) private BigDecimal openBalance; /* open balance */ - + @OneToMany(mappedBy = "account", fetch=FetchType.LAZY) private Collection orders; - + @OneToMany(mappedBy = "account", fetch=FetchType.LAZY) private Collection holdings; - + @OneToOne(fetch=FetchType.LAZY) @JoinColumn(name="PROFILE_USERID") private AccountProfileDataBean profile; @@ -264,7 +264,7 @@ public class AccountDataBean implements Serializable { public void setOrders(Collection orders) { this.orders = orders; } - + public Collection getHoldings() { return holdings; } @@ -288,7 +288,7 @@ public class AccountDataBean implements Serializable { ((profile == null) ? "null AccountProfile" : "\n\tIncorrect password-->" + profile.getUserID() + ":" + profile.getPassword()); throw new RuntimeException(error); - + } setLastLogin(new Timestamp(System.currentTimeMillis())); diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/AccountProfileDataBean.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/AccountProfileDataBean.java index cb008fc9f..e1be98b5b 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/AccountProfileDataBean.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/AccountProfileDataBean.java @@ -47,22 +47,22 @@ public class AccountProfileDataBean implements java.io.Serializable { @Id @Column(name = "USERID", nullable = false) private String userID; /* userID */ - + @Column(name = "PASSWD") private String passwd; /* password */ - + @Column(name = "FULLNAME") private String fullName; /* fullName */ - + @Column(name = "ADDRESS") private String address; /* address */ - + @Column(name = "EMAIL") private String email; /* email */ - + @Column(name = "CREDITCARD") private String creditCard; /* creditCard */ - + @OneToOne(mappedBy="profile", fetch=FetchType.LAZY) private AccountDataBean account; @@ -176,7 +176,7 @@ public class AccountProfileDataBean implements java.io.Serializable { public void setAccount(AccountDataBean account) { this.account = account; } - + @Override public int hashCode() { int hash = 0; diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/HoldingDataBean.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/HoldingDataBean.java index ca066c723..a5beacf7e 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/HoldingDataBean.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/HoldingDataBean.java @@ -65,24 +65,24 @@ public class HoldingDataBean implements Serializable { @GeneratedValue(strategy=GenerationType.TABLE, generator="holdingIdGen") @Column(name = "HOLDINGID", nullable = false) private Integer holdingID; /* holdingID */ - + @Column(name = "QUANTITY", nullable = false) private double quantity; /* quantity */ - + @Column(name = "PURCHASEPRICE") private BigDecimal purchasePrice; /* purchasePrice */ - + @Column(name = "PURCHASEDATE") @Temporal(TemporalType.TIMESTAMP) private Date purchaseDate; /* purchaseDate */ - + @Transient private String quoteID; /* Holding(*) ---> Quote(1) */ - + @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="ACCOUNT_ACCOUNTID") private AccountDataBean account; - + @ManyToOne(fetch=FetchType.EAGER) @JoinColumn(name = "QUOTE_SYMBOL") private QuoteDataBean quote; @@ -205,7 +205,7 @@ public class HoldingDataBean implements Serializable { return getQuoteID(); } */ - + public QuoteDataBean getQuote() { return quote; } @@ -213,7 +213,7 @@ public class HoldingDataBean implements Serializable { public void setQuote(QuoteDataBean quote) { this.quote = quote; } - + @Override public int hashCode() { int hash = 0; diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/MarketSummaryDataBean.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/MarketSummaryDataBean.java index 51b5bdc52..f5c0fda5e 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/MarketSummaryDataBean.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/MarketSummaryDataBean.java @@ -31,15 +31,15 @@ public class MarketSummaryDataBean implements Serializable { private static final long serialVersionUID = -2753373502228082501L; - + private BigDecimal TSIA; /* Trade Stock Index Average */ - private BigDecimal openTSIA; /* Trade Stock Index Average at the open */ + private BigDecimal openTSIA; /* Trade Stock Index Average at the open */ private double volume; /* volume of shares traded */ private Collection topGainers; /* Collection of top gaining stocks */ - private Collection topLosers; /* Collection of top losing stocks */ - //FUTURE private Collection topVolume; /* Collection of top stocks by volume */ + private Collection topLosers; /* Collection of top losing stocks */ + //FUTURE private Collection topVolume; /* Collection of top stocks by volume */ private Date summaryDate; /* Date this summary was taken */ - + //cache the gainPercent once computed for this bean private BigDecimal gainPercent=null; @@ -58,21 +58,21 @@ public class MarketSummaryDataBean implements Serializable setTopLosers(topLosers); setSummaryDate(new java.sql.Date(System.currentTimeMillis())); gainPercent = computeGainPercent(getTSIA(), getOpenTSIA()); - + } - + public static MarketSummaryDataBean getRandomInstance() { Collection gain = new ArrayList(); Collection lose = new ArrayList(); - + for (int ii = 0; ii < 5; ii++) { QuoteDataBean quote1 = QuoteDataBean.getRandomInstance(); QuoteDataBean quote2 = QuoteDataBean.getRandomInstance(); - + gain.add(quote1); lose.add(quote2); } - + return new MarketSummaryDataBean( TradeConfig.rndBigDecimal(1000000.0f), TradeConfig.rndBigDecimal(1000000.0f), @@ -95,19 +95,19 @@ public class MarketSummaryDataBean implements Serializable return ret; ret += "\n\t\t Current Top Gainers:"; Iterator it = getTopGainers().iterator(); - while ( it.hasNext() ) + while ( it.hasNext() ) { QuoteDataBean quoteData = (QuoteDataBean) it.next(); ret += ( "\n\t\t\t" + quoteData.toString() ); } ret += "\n\t\t Current Top Losers:"; it = getTopLosers().iterator(); - while ( it.hasNext() ) + while ( it.hasNext() ) { QuoteDataBean quoteData = (QuoteDataBean) it.next(); ret += ( "\n\t\t\t" + quoteData.toString() ); } - return ret; + return ret; } public String toHTML() { @@ -120,14 +120,14 @@ public class MarketSummaryDataBean implements Serializable return ret; ret += "
    Current Top Gainers:"; Iterator it = getTopGainers().iterator(); - while ( it.hasNext() ) + while ( it.hasNext() ) { QuoteDataBean quoteData = (QuoteDataBean) it.next(); ret += ( "
  • " + quoteData.toString() + "
  • " ); } ret += "
    Current Top Losers:"; it = getTopLosers().iterator(); - while ( it.hasNext() ) + while ( it.hasNext() ) { QuoteDataBean quoteData = (QuoteDataBean) it.next(); ret += ( "
  • " + quoteData.toString() + "
  • " ); @@ -137,8 +137,8 @@ public class MarketSummaryDataBean implements Serializable public void print() { // Log.log( this.toString() ); - } - + } + public BigDecimal getGainPercent() { if ( gainPercent == null ) diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/OrderDataBean.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/OrderDataBean.java index 0d619be18..dbebcb8b4 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/OrderDataBean.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/OrderDataBean.java @@ -72,45 +72,45 @@ public class OrderDataBean implements Serializable allocationSize=1000) @Id @GeneratedValue(strategy=GenerationType.TABLE, generator="orderIdGen") - @Column(name = "ORDERID", nullable = false) + @Column(name = "ORDERID", nullable = false) private Integer orderID; /* orderID */ - + @Column(name = "ORDERTYPE") private String orderType; /* orderType (buy, sell, etc.) */ - + @Column(name = "ORDERSTATUS") private String orderStatus; /* orderStatus (open, processing, completed, closed, cancelled) */ - + @Column(name = "OPENDATE") @Temporal(TemporalType.TIMESTAMP) private Date openDate; /* openDate (when the order was entered) */ - + @Column(name = "COMPLETIONDATE") @Temporal(TemporalType.TIMESTAMP) private Date completionDate; /* completionDate */ - + @Column(name = "QUANTITY", nullable = false) private double quantity; /* quantity */ - + @Column(name = "PRICE") private BigDecimal price; /* price */ - + @Column(name = "ORDERFEE") private BigDecimal orderFee; /* price */ - + @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="ACCOUNT_ACCOUNTID") private AccountDataBean account; - + @ManyToOne(fetch=FetchType.EAGER) @JoinColumn(name="QUOTE_SYMBOL") private QuoteDataBean quote; - + // Cause sell operation failed, see JIRA DAYTRADER-63 for details. @OneToOne(fetch=FetchType.LAZY) @JoinColumn(name = "HOLDING_HOLDINGID") // Cause sell operation failed, see JIRA DAYTRADER-63 for details. - //@Transient + //@Transient private HoldingDataBean holding; // @Version @@ -120,7 +120,7 @@ public class OrderDataBean implements Serializable @Transient private String symbol; - public OrderDataBean() { + public OrderDataBean() { } public OrderDataBean(Integer orderID, @@ -143,7 +143,7 @@ public class OrderDataBean implements Serializable setOrderFee(orderFee); setSymbol(symbol); } - + public OrderDataBean(String orderType, String orderStatus, Date openDate, @@ -366,7 +366,7 @@ public class OrderDataBean implements Serializable hash += (this.orderID != null ? this.orderID.hashCode() : 0); return hash; } - + @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/QuoteDataBean.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/QuoteDataBean.java index 6807f6fff..efcb2fe0e 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/QuoteDataBean.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/QuoteDataBean.java @@ -59,37 +59,37 @@ public class QuoteDataBean implements Serializable { @Id @Column(name = "SYMBOL", nullable = false) private String symbol; /* symbol */ - + @Column(name = "COMPANYNAME") private String companyName; /* companyName */ - + @Column(name = "VOLUME", nullable = false) private double volume; /* volume */ - + @Column(name = "PRICE") private BigDecimal price; /* price */ - + @Column(name = "OPEN1") private BigDecimal open1; /* open1 price */ - + @Column(name = "LOW") private BigDecimal low; /* low price */ - + @Column(name = "HIGH") private BigDecimal high; /* high price */ - + @Column(name = "CHANGE1", nullable = false) private double change1; /* price change */ - + /* @OneToMany(mappedBy = "quote") private Collection orders; */ - + // @Version // private Integer optLock; /* Accessor methods for relationship fields are not kept in the DataBean */ - + public QuoteDataBean() { } @@ -222,7 +222,7 @@ public class QuoteDataBean implements Serializable { hash += (this.symbol != null ? this.symbol.hashCode() : 0); return hash; } - + @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TestDaytrader.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TestDaytrader.java index 836f3c843..99a223d3b 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TestDaytrader.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TestDaytrader.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.daytrader; @@ -41,12 +41,12 @@ public class TestDaytrader extends AbstractPersistenceTestCase { Log log = null; private TradeAction trade = null; - + @Override public void setUp() { // Mimic EM pooling boolean poolEm = true; - + Map map = new HashMap(); map.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true," + "SchemaAction='add,deleteTableContents')"); @@ -59,14 +59,14 @@ public class TestDaytrader extends AbstractPersistenceTestCase { em.createQuery("DELETE FROM accountejb").executeUpdate(); em.createQuery("DELETE FROM accountprofileejb").executeUpdate(); em.getTransaction().commit(); - - + + log = new LogFactoryImpl().getLog("test"); TradeConfig.setRunTimeMode(TradeConfig.JPA); TradeConfig.setLog(log); trade = new TradeAction(log, emf, poolEm); } - + @Override public void tearDown() throws Exception { trade = null; @@ -75,15 +75,15 @@ public class TestDaytrader extends AbstractPersistenceTestCase { emf = null; super.tearDown(); } - + /** * Scenario being tested: * - Creates 1000 quotes * - Creates 500 user accounts w/ 10 holdings each * - Perform the following 15 tasks for the first 50 user ids: * login, home, account, update, home, portfolio, sell, buy, home, portfolio, sell, buy, home, account, logout - * @throws Exception - * + * @throws Exception + * */ public void testTrade() throws Exception { log.info("TestDaytrader.testTrade() started"); @@ -101,7 +101,7 @@ public class TestDaytrader extends AbstractPersistenceTestCase { } log.info("TestDaytrader.testTrade() completed"); } - + private EntityManagerFactory createEmf(final String pu, Object... props) { Map map = getPropertiesMap(props); EntityManagerFactory emf = null; diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeAction.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeAction.java index 91601f53c..38d44c070 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeAction.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeAction.java @@ -34,7 +34,7 @@ import org.apache.openjpa.lib.log.Log; * HttpRequests/HttpResponse objects and forwarding results to the appropriate * JSP page for the web interface. TradeServletAction invokes * {@link TradeAction} methods to actually perform each trading operation. - * + * */ public class TradeAction extends TradeJPADirect { @@ -45,7 +45,7 @@ public class TradeAction extends TradeJPADirect { /** * Display User Profile information such as address, email, etc. for the * given Trader Dispatch to the Trade Account JSP for display - * + * */ void doAccount(StringBuilder sb, String userID, String results) throws RuntimeException, java.io.IOException { @@ -79,7 +79,7 @@ public class TradeAction extends TradeJPADirect { * Update User Profile information such as address, email, etc. for the * given Trader Dispatch to the Trade Account JSP for display If any in put * is incorrect revert back to the account page w/ an appropriate message - * + * */ void doAccountUpdate(StringBuilder sb, String userID, String password, String cpassword, String fullName, String address, @@ -125,7 +125,7 @@ public class TradeAction extends TradeJPADirect { /** * Buy a new holding of shares for the given trader Dispatch to the Trade * Portfolio JSP for display - * + * */ void doBuy(StringBuilder sb, String userID, String symbol, String quantity) throws RuntimeException, IOException { @@ -157,7 +157,7 @@ public class TradeAction extends TradeJPADirect { /** * Create the Trade Home page with personalized information such as the * traders account balance Dispatch to the Trade Home JSP for display - * + * */ void doHome(StringBuilder sb, String userID, String results) throws RuntimeException, java.io.IOException { @@ -207,7 +207,7 @@ public class TradeAction extends TradeJPADirect { /** * Login a Trade User. Dispatch to the Trade Home JSP for display - * + * */ boolean doLogin(StringBuilder sb, String userID, String passwd) throws RuntimeException, java.io.IOException { @@ -248,7 +248,7 @@ public class TradeAction extends TradeJPADirect { /** * Logout a Trade User Dispatch to the Trade Welcome JSP for display - * + * */ void doLogout(StringBuilder sb, String userID) throws RuntimeException, IOException { @@ -275,7 +275,7 @@ public class TradeAction extends TradeJPADirect { /** * Retrieve the current portfolio of stock holdings for the given trader * Dispatch to the Trade Portfolio JSP for display - * + * */ void doPortfolio(StringBuilder sb, String userID, String results) throws RuntimeException, IOException { @@ -319,7 +319,7 @@ public class TradeAction extends TradeJPADirect { /** * Retrieve the current Quote for the given stock symbol Dispatch to the * Trade Quote JSP for display - * + * */ void doQuotes(StringBuilder sb, String userID, String symbols) throws RuntimeException, IOException { @@ -330,7 +330,7 @@ public class TradeAction extends TradeJPADirect { // Quote.jsp. This makes each Quote a // standalone "fragment", and thus is a candidate for // Edge caching. - // + // // requestDispatch(ctx, req, resp, userID, TradeConfig.getPage(TradeConfig.QUOTE_PAGE)); try { Collection closedOrders = getClosedOrders(userID); @@ -355,7 +355,7 @@ public class TradeAction extends TradeJPADirect { /** * Register a new trader given the provided user Profile information such as * address, email, etc. Dispatch to the Trade Home JSP for display - * + * */ void doRegister(StringBuilder sb, String userID, String passwd, String cpasswd, String fullname, String ccn, @@ -398,7 +398,7 @@ public class TradeAction extends TradeJPADirect { /** * Sell a current holding of stock shares for the given trader. Dispatch to * the Trade Portfolio JSP for display - * + * */ void doSell(StringBuilder sb, String userID, Integer holdingID) throws RuntimeException, IOException { @@ -447,7 +447,7 @@ public class TradeAction extends TradeJPADirect { resp.sendRedirect(resp.encodeRedirectURL(page)); } */ - + private void setAttribute(StringBuilder sb, String attribute, Object value) { if (log != null && log.isTraceEnabled()) { sb.append(attribute); diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeBuildDB.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeBuildDB.java index 98334499d..345c0aa1e 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeBuildDB.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeBuildDB.java @@ -26,37 +26,37 @@ import org.apache.openjpa.lib.log.Log; // import org.apache.geronimo.samples.daytrader.util.*; /** - * TradeBuildDB uses operations provided by the TradeApplication to - * (a) create the Database tables - * (b) populate a DayTrader database without creating the tables. + * TradeBuildDB uses operations provided by the TradeApplication to + * (a) create the Database tables + * (b) populate a DayTrader database without creating the tables. * Specifically, a new DayTrader User population is created using - * UserIDs of the form "uid:xxx" where xxx is a sequential number + * UserIDs of the form "uid:xxx" where xxx is a sequential number * (e.g. uid:0, uid:1, etc.). New stocks are also created of the form "s:xxx", * again where xxx represents sequential numbers (e.g. s:1, s:2, etc.) */ public class TradeBuildDB { private TradeAction trade = null; - + /** - * Re-create the DayTrader db tables and populate them OR just populate a + * Re-create the DayTrader db tables and populate them OR just populate a * DayTrader DB, logging to the provided output stream */ public TradeBuildDB(Log log, TradeAction trade) throws Exception { this.trade = trade; // update config - + // always use TradeJPADirect mode // removed - createDBTables // removed - Attempt to delete all of the Trade users and Trade Quotes first - + } public void setup(int quotes, int users) { createQuotes(quotes); - createAccounts(users); + createAccounts(users); } private void createQuotes(int quotes) { int errorCount = 0; @@ -77,7 +77,7 @@ public class TradeBuildDB { } } - + private void createAccounts(int users) { TradeConfig.log.info("TradeBuildDB.createAccounts(" + users + ")"); for (int i = 0; i < users; i++) { @@ -90,7 +90,7 @@ public class TradeBuildDB { if (i == 0) { initialBalance = 1000000; // uid:0 starts with a cool million. } - + AccountDataBean accountData = trade.register(userID, "xxx", fullname, address, email, creditcard, new BigDecimal(initialBalance)); diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeConfig.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeConfig.java index e161d3a9b..8e2d65c46 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeConfig.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeConfig.java @@ -33,7 +33,7 @@ public class TradeConfig { // added by OpenJPA public static Log log = null; - + /* Trade Runtime Configuration Parameters */ public static final int UNKNOWN = -1; @@ -46,7 +46,7 @@ public class TradeConfig { public static final int JDBC = 3; public static final int JPA = 4; public static int runTimeMode = JPA; - + /* Trade JPA Layer parameters */ public static String[] jpaLayerNames = {"OpenJPA", "Hibernate"}; public static final int OPENJPA = 0; @@ -82,7 +82,7 @@ public class TradeConfig { public static final int COMMAND_CACHING = 1; public static final int NO_CACHING = 2; public static int cachingType = NO_CACHING; - + /* Trade Database Scaling parameters*/ private static int MAX_USERS = 500; private static int MAX_QUOTES = 1000; @@ -121,12 +121,12 @@ public class TradeConfig { private static int primIterations = 1; private static boolean longRun = true; private static boolean publishQuotePriceChange = false; - + /** * -1 means every operation * 0 means never perform a market summary * > 0 means number of seconds between summaries. These will be - * synchronized so only one transaction in this period will create a summary and + * synchronized so only one transaction in this period will create a summary and * will cache its results. */ private static int marketSummaryInterval = 20; @@ -162,8 +162,8 @@ public class TradeConfig { MAXIMUM_STOCK_SPLIT_MULTIPLIER.setScale(2, BigDecimal.ROUND_HALF_UP); } - /* Trade Scenario actions mixes. Each of the array rows represents a specific Trade Scenario Mix. - The columns give the percentages for each action in the column header. Note: "login" is always 0. + /* Trade Scenario actions mixes. Each of the array rows represents a specific Trade Scenario Mix. + The columns give the percentages for each action in the column header. Note: "login" is always 0. logout represents both login and logout (because each logout operation will cause a new login when the user context attempts the next action. */ @@ -227,18 +227,18 @@ public class TradeConfig { "/orderImg.jsp", "/config.jsp", "/runStats.jsp" }, - //JSP Interface + //JSP Interface }; - // These are the property settings the VAJ access beans look for. + // These are the property settings the VAJ access beans look for. private static final String NAMESERVICE_TYPE_PROPERTY = "java.naming.factory.initial"; private static final String NAMESERVICE_PROVIDER_URL_PROPERTY = "java.naming.provider.url"; // FUTURE: - // If a "trade2.properties" property file is supplied, reset the default values - // to match those specified in the file. This provides a persistent runtime + // If a "trade2.properties" property file is supplied, reset the default values + // to match those specified in the file. This provides a persistent runtime // property mechanism during server startup /** @@ -267,7 +267,7 @@ public class TradeConfig { /** * Return a Trade UI Web page based on the current configuration - * This may return a JSP page or a Servlet page + * This may return a JSP page or a Servlet page * Creation date: (3/14/2000 9:08:34 PM) */ @@ -474,7 +474,7 @@ public class TradeConfig { } - //Trade implements a card deck approach to selecting + //Trade implements a card deck approach to selecting // users for trading with tradescenarioservlet private static ArrayList deck = null; private static int card = 0; @@ -493,7 +493,7 @@ public class TradeConfig { * from servlet initialization parameters. The servlet provides the init param and its * value as strings. This method then parses the parameter, converts the value to the * correct type and sets the corresponding TradeConfig parameter to the converted value - * + * */ public static void setConfigParam(String parm, String value) { if (log.isTraceEnabled()) @@ -546,7 +546,7 @@ public class TradeConfig { + orderProcessingModeNames[orderProcessingMode], e); } // If the value is bad, simply revert to current - } else if (parm.equalsIgnoreCase("accessMode")) { + } else if (parm.equalsIgnoreCase("accessMode")) { try { for (int i = 0; i < accessModeNames.length; i++) { if (value.equalsIgnoreCase(accessModeNames[i])) { @@ -572,7 +572,7 @@ public class TradeConfig { "TradeConfig.setConfigParm(..): minor exception caught" + "Setting web services endpoint", e); - } //On error, revert to saved + } //On error, revert to saved } else if (parm.equalsIgnoreCase("workloadMix")) { try { for (int i = 0; i < workloadMixNames.length; i++) { @@ -589,7 +589,7 @@ public class TradeConfig { + "reverting to current value: " + workloadMixNames[workloadMix], e); - } // If the value is bad, simply revert to current + } // If the value is bad, simply revert to current } else if (parm.equalsIgnoreCase("WebInterface")) { try { for (int i = 0; i < webInterfaceNames.length; i++) { @@ -636,7 +636,7 @@ public class TradeConfig { + "revering to current value: " + MAX_USERS, e); - } //On error, revert to saved + } //On error, revert to saved } else if (parm.equalsIgnoreCase("maxQuotes")) { try { MAX_QUOTES = Integer.parseInt(value); @@ -650,7 +650,7 @@ public class TradeConfig { + MAX_QUOTES, e); //< Completed Order " + order.getOrderID() + "\n\t Order info: " + order @@ -615,10 +615,10 @@ public class TradeJPADirect { if (TradeConfig.jpaLayer == TradeConfig.HIBERNATE) { quote = entityManager.find(QuoteDataBean.class, symbol); } else if (TradeConfig.jpaLayer == TradeConfig.OPENJPA) { - + Query q = entityManager.createNamedQuery("quoteejb.quoteForUpdate"); q.setParameter(1, symbol); - + quote = (QuoteDataBean) q.getSingleResult(); } @@ -736,9 +736,9 @@ public class TradeJPADirect { * profileData.getUserID()); // In order for the object to merge * correctly, the account has to be hooked into the temp object... // - * may need to reverse this and obtain the full object first - * + * * profileData.setAccount(temp.getAccount()); - * + * * //TODO this might not be correct temp = * entityManager.merge(profileData); //System.out.println(temp); */ @@ -822,7 +822,7 @@ public class TradeJPADirect { log.trace("TradeJPADirect:logout(" + userID + ") success"); } - public AccountDataBean register(String userID, String password, String fullname, + public AccountDataBean register(String userID, String password, String fullname, String address, String email, String creditcard, BigDecimal openBalance) { AccountDataBean account = null; @@ -833,7 +833,7 @@ public class TradeJPADirect { //Log.trace("TradeJPADirect:register", userID, password, fullname, address, email, creditcard, openBalance); log.trace("TradeJPADirect:register - userID=" + userID); } - + // Check to see if a profile with the desired userID already exists profile = entityManager.find(AccountProfileDataBean.class, userID); if (profile != null) { @@ -901,16 +901,16 @@ public class TradeJPADirect { + " quote=" + ((quote == null) ? null : quote.getSymbol()) + " orderType=" + orderType + " quantity=" + quantity); try { - order = new OrderDataBean(orderType, - "open", - new Timestamp(System.currentTimeMillis()), - null, - quantity, + order = new OrderDataBean(orderType, + "open", + new Timestamp(System.currentTimeMillis()), + null, + quantity, // quote.getPrice().setScale(FinancialUtils.SCALE, FinancialUtils.ROUND), quote.getPrice().setScale(2, BigDecimal.ROUND_HALF_UP), - TradeConfig.getOrderFee(orderType), - account, - quote, + TradeConfig.getOrderFee(orderType), + account, + quote, holding); entityManager.persist(order); } @@ -993,7 +993,7 @@ public class TradeJPADirect { /** * Get mode - returns the persistence mode (TradeConfig.JPA) - * + * * @return int mode */ public int getMode() { diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeScenario.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeScenario.java index d0afba6ef..29ccd1276 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeScenario.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeScenario.java @@ -21,9 +21,9 @@ import java.util.Iterator; import java.io.IOException; /** - * TradeScenarioServlet emulates a population of web users by generating a specific Trade operation - * for a randomly chosen user on each access to the URL. Test this servlet by clicking Trade Scenario - * and hit "Reload" on your browser to step through a Trade Scenario. To benchmark using this URL aim + * TradeScenarioServlet emulates a population of web users by generating a specific Trade operation + * for a randomly chosen user on each access to the URL. Test this servlet by clicking Trade Scenario + * and hit "Reload" on your browser to step through a Trade Scenario. To benchmark using this URL aim * your favorite web load generator (such as AKStress) at the Trade Scenario URL and fire away. */ public class TradeScenario { @@ -33,11 +33,11 @@ public class TradeScenario { public TradeScenario(TradeAction tAction) { this.tAction = tAction; } - + /** * Perform the following 15 tasks for the given userID: * login, home, account, update, home, portfolio, sell, buy, home, portfolio, sell, buy, home, account, logout - * + * * @param userID */ public boolean performUserTasks(String userID) { @@ -47,7 +47,7 @@ public class TradeScenario { if (TradeConfig.log.isTraceEnabled()) { TradeConfig.log.trace("TradeScenario.performUserTasks(" + userID + ")"); } - + try { // login log(sb, performTask("l", userID)); @@ -85,16 +85,16 @@ public class TradeScenario { } } catch (Exception e) { TradeConfig.log.error("TradeScenario.performUserTasks(" + userID + ") failed", e); - } + } return brc; } - - /** + + /** * Main service method for TradeScenarioServlet * * @param request Object that encapsulates the request to the servlet * @param response Object that encapsulates the response from the servlet - */ + */ public String performTask(String scenarioAction, String userID) throws IOException { StringBuilder sb = new StringBuilder(256); String results = ""; @@ -111,7 +111,7 @@ public class TradeScenario { { //null; try { - log(sb, "TradeScenario.performTask() scenarioAction=" + scenarioAction + ", userID=" + userID); + log(sb, "TradeScenario.performTask() scenarioAction=" + scenarioAction + ", userID=" + userID); } catch (Exception e) { @@ -130,12 +130,12 @@ public class TradeScenario { TradeConfig.incrementScenarioCount(); } else if (action == ' ') { //action is not specified perform a random operation according to current mix - // Tell getScenarioAction if we are an original user or a registered user + // Tell getScenarioAction if we are an original user or a registered user // -- sellDeficits should only be compensated for with original users. action = TradeConfig.getScenarioAction( userID.startsWith(TradeConfig.newUserPrefix)); } - + switch (action) { case 'q' : //quote tAction.doQuotes(sb, userID, TradeConfig.rndSymbols()); @@ -161,7 +161,7 @@ public class TradeScenario { // login is successful if the userID is written to the HTTP session if (!brc) { log(sb, "TradeScenario login failed. Reset DB between runs."); - } + } break; case 'o' : //logout tAction.doLogout(sb, userID); @@ -188,10 +188,10 @@ public class TradeScenario { int numHoldings = holdings.size(); if (numHoldings > 0) { - //sell first available security out of holding + //sell first available security out of holding Iterator it = holdings.iterator(); boolean foundHoldingToSell = false; - while (it.hasNext()) + while (it.hasNext()) { HoldingDataBean holdingData = (HoldingDataBean) it.next(); if ( !(holdingData.getPurchaseDate().equals(new java.util.Date(0))) ) @@ -199,7 +199,7 @@ public class TradeScenario { Integer holdingID = holdingData.getHoldingID(); tAction.doSell(sb, userID, holdingID); foundHoldingToSell = true; - break; + break; } } if (foundHoldingToSell) break; diff --git a/openjpa-integration/daytrader/src/test/resources/META-INF/persistence.xml b/openjpa-integration/daytrader/src/test/resources/META-INF/persistence.xml index 3014e075c..0e13b0f6f 100644 --- a/openjpa-integration/daytrader/src/test/resources/META-INF/persistence.xml +++ b/openjpa-integration/daytrader/src/test/resources/META-INF/persistence.xml @@ -27,7 +27,7 @@ org.apache.openjpa.integration.daytrader.OrderDataBean org.apache.openjpa.integration.daytrader.QuoteDataBean true - + diff --git a/openjpa-integration/examples/pom.xml b/openjpa-integration/examples/pom.xml index 03e2f1732..2c983d3fb 100644 --- a/openjpa-integration/examples/pom.xml +++ b/openjpa-integration/examples/pom.xml @@ -7,15 +7,15 @@ 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. + under the License. --> - @@ -71,7 +71,7 @@ - + diff --git a/openjpa-integration/jmx/src/test/java/org/apache/openjpa/integration/jmx/CachedEntity.java b/openjpa-integration/jmx/src/test/java/org/apache/openjpa/integration/jmx/CachedEntity.java index 0f4866aef..5edb0036b 100644 --- a/openjpa-integration/jmx/src/test/java/org/apache/openjpa/integration/jmx/CachedEntity.java +++ b/openjpa-integration/jmx/src/test/java/org/apache/openjpa/integration/jmx/CachedEntity.java @@ -29,7 +29,7 @@ public class CachedEntity { @Id private int id; - + @Basic private String name; diff --git a/openjpa-integration/jmx/src/test/java/org/apache/openjpa/integration/jmx/TestJMXPlatformMBeans.java b/openjpa-integration/jmx/src/test/java/org/apache/openjpa/integration/jmx/TestJMXPlatformMBeans.java index 99c095f06..b07068c8c 100644 --- a/openjpa-integration/jmx/src/test/java/org/apache/openjpa/integration/jmx/TestJMXPlatformMBeans.java +++ b/openjpa-integration/jmx/src/test/java/org/apache/openjpa/integration/jmx/TestJMXPlatformMBeans.java @@ -52,14 +52,14 @@ public class TestJMXPlatformMBeans extends AbstractPersistenceTestCase { */ public void testDataCacheInstrument() { OpenJPAEntityManagerFactorySPI oemf = createNamedEMF("openjpa-integration-jmx"); - + // Verify an EMF was created with the supplied instrumentation assertNotNull(oemf); // Verify an instrumentation manager is available InstrumentationManager mgr = oemf.getConfiguration().getInstrumentationManagerInstance(); assertNotNull(mgr); - + // Get the in-band data cache instrument Set providers = mgr.getProviders(); assertNotNull(providers); @@ -71,20 +71,20 @@ public class TestJMXPlatformMBeans extends AbstractPersistenceTestCase { assertTrue(inst instanceof DataCacheInstrument); DataCacheInstrument dci = (DataCacheInstrument)inst; assertEquals(dci.getCacheName(), "default"); - + OpenJPAEntityManagerSPI oem = oemf.createEntityManager(); - + CachedEntity ce = new CachedEntity(); int id = new Random().nextInt(); ce.setId(id); - + oem.getTransaction().begin(); oem.persist(ce); oem.getTransaction().commit(); oem.clear(); assertTrue(oemf.getCache().contains(CachedEntity.class, id)); ce = oem.find(CachedEntity.class, id); - + assertTrue(dci.getHitCount() > 0); assertTrue(dci.getHitCount(clsName) > 0); assertTrue(dci.getWriteCount() > 0); @@ -99,23 +99,23 @@ public class TestJMXPlatformMBeans extends AbstractPersistenceTestCase { } catch (Throwable t) { fail("DataCache verification failed: " + t); } - + closeEMF(oemf); } - + /** * Verifies query cache metrics are available through simple instrumentation. */ public void testQueryCacheInstrument() { OpenJPAEntityManagerFactorySPI oemf = createNamedEMF("openjpa-integration-jmx"); - + // Verify an EMF was created with the supplied instrumentation assertNotNull(oemf); // Verify an instrumentation manager is available InstrumentationManager mgr = oemf.getConfiguration().getInstrumentationManagerInstance(); assertNotNull(mgr); - + // Get the in-band data cache instrument Set providers = mgr.getProviders(); assertNotNull(providers); @@ -127,14 +127,14 @@ public class TestJMXPlatformMBeans extends AbstractPersistenceTestCase { assertNotNull(inst); assertTrue(inst instanceof QueryCacheInstrument); QueryCacheInstrument qci = (QueryCacheInstrument)inst; - + assertEquals(0,qci.getExecutionCount()); assertEquals(0,qci.getTotalExecutionCount()); assertEquals(0,qci.getHitCount()); assertEquals(0,qci.getTotalHitCount()); - + OpenJPAEntityManagerSPI oem = oemf.createEntityManager(); - + CachedEntity ce = new CachedEntity(); int id = new Random().nextInt(); ce.setId(id); @@ -146,16 +146,16 @@ public class TestJMXPlatformMBeans extends AbstractPersistenceTestCase { oem.persist(ce); oem.persist(ce2); oem.getTransaction().commit(); - + Query q = oem.createQuery("SELECT ce FROM CachedEntity ce"); - + List result = q.getResultList(); assertNotNull(result); assertTrue(result.size() > 1); oem.clear(); result = q.getResultList(); - + assertTrue(qci.getExecutionCount() > 0); assertTrue(qci.getTotalExecutionCount() > 0); assertTrue(qci.getHitCount() > 0); @@ -181,14 +181,14 @@ public class TestJMXPlatformMBeans extends AbstractPersistenceTestCase { */ public void testPreparedQueryCacheInstrument() { OpenJPAEntityManagerFactorySPI oemf = createNamedEMF("openjpa-integration-jmx-qsc"); - + // Verify an EMF was created with the supplied instrumentation assertNotNull(oemf); // Verify an instrumentation manager is available InstrumentationManager mgr = oemf.getConfiguration().getInstrumentationManagerInstance(); assertNotNull(mgr); - + // Get the in-band data cache instrument Set providers = mgr.getProviders(); assertNotNull(providers); @@ -200,14 +200,14 @@ public class TestJMXPlatformMBeans extends AbstractPersistenceTestCase { assertNotNull(inst); assertTrue(inst instanceof PreparedQueryCacheInstrument); PreparedQueryCacheInstrument qci = (PreparedQueryCacheInstrument)inst; - + assertEquals(0,qci.getExecutionCount()); assertEquals(0,qci.getTotalExecutionCount()); assertEquals(0,qci.getHitCount()); assertEquals(0,qci.getTotalHitCount()); - + OpenJPAEntityManagerSPI oem = oemf.createEntityManager(); - + CachedEntity ce = new CachedEntity(); int id = new Random().nextInt(); ce.setId(id); @@ -219,16 +219,16 @@ public class TestJMXPlatformMBeans extends AbstractPersistenceTestCase { oem.persist(ce); oem.persist(ce2); oem.getTransaction().commit(); - + Query q = oem.createQuery("SELECT ce FROM CachedEntity ce"); - + List result = q.getResultList(); assertNotNull(result); assertTrue(result.size() > 1); oem.clear(); result = q.getResultList(); - + assertTrue(qci.getExecutionCount() > 0); assertTrue(qci.getTotalExecutionCount() > 0); assertTrue(qci.getHitCount() > 0); @@ -262,25 +262,25 @@ public class TestJMXPlatformMBeans extends AbstractPersistenceTestCase { Set ons = mbs.queryNames(objname, null); assertEquals(1, ons.size()); ObjectName on = ons.iterator().next(); - + DataCacheJMXInstrumentMBean mbean = JMX.newMBeanProxy(mbs, on, DataCacheJMXInstrumentMBean.class); // Assert data cache attributes can be accessed and are being updated through the MBean assertTrue(mbean.getHitCount() > 0); assertTrue(mbean.getReadCount() > 0); assertTrue(mbean.getWriteCount() > 0); - + // Assert data cache MBean methods can be invoked assertTrue(mbean.getHitCount(clsName) > 0); assertTrue(mbean.getReadCount(clsName) > 0); assertTrue(mbean.getWriteCount(clsName) > 0); - + Map stats = mbean.getCacheStatistics(); assertNotNull(stats); - // Comment out classNames portion of the test which is currently broken. + // Comment out classNames portion of the test which is currently broken. Set classNames = stats.keySet(); assertNotNull(classNames); assertTrue(classNames.contains(clsName)); - + // Invoke the reset method and recollect stats mbean.reset(); @@ -302,18 +302,18 @@ public class TestJMXPlatformMBeans extends AbstractPersistenceTestCase { public class QueryCachesMBeanCallable implements Callable { public static final String QC_OBJNAME = "org.apache.openjpa:type=QueryCache,cfgid=openjpa-integration-jmx,*"; - public static final String QSC_OBJNAME = "org.apache.openjpa:type=QuerySQLCache,cfgid=openjpa-integration-jmx-qsc,*"; + public static final String QSC_OBJNAME = "org.apache.openjpa:type=QuerySQLCache,cfgid=openjpa-integration-jmx-qsc,*"; public static final String QC_QM = "queryKeys"; public static final String QSC_QM = "queries"; - + private String _objNameStr; private String _queryMethod; - + public QueryCachesMBeanCallable(String objName, String queryMethod) { setObjName(objName); setQueryMethod(queryMethod); } - + @SuppressWarnings("unchecked") public Boolean call() { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); @@ -331,7 +331,7 @@ public class TestJMXPlatformMBeans extends AbstractPersistenceTestCase { assertTrue(hitCount > 0); assertTrue(execCount > 0); // Assert data cache MBean methods can be invoked - + Set keys = (Set)mbs.invoke(on, getQueryMethod(), null, null); assertNotNull(keys); assertTrue(keys.size() > 0); @@ -339,7 +339,7 @@ public class TestJMXPlatformMBeans extends AbstractPersistenceTestCase { for (String key : keys) { Object[] parms = new Object[] { key }; long queryHitCount = (Long)mbs.invoke(on, "getHitCount", parms, sigs); - long queryReadCount = (Long)mbs.invoke(on, "getExecutionCount", parms, sigs); + long queryReadCount = (Long)mbs.invoke(on, "getExecutionCount", parms, sigs); assertTrue(queryHitCount > 0); assertTrue(queryReadCount > 0); } diff --git a/openjpa-integration/jmx/src/test/resources/META-INF/persistence.xml b/openjpa-integration/jmx/src/test/resources/META-INF/persistence.xml index d4f6c0972..12ca59bae 100644 --- a/openjpa-integration/jmx/src/test/resources/META-INF/persistence.xml +++ b/openjpa-integration/jmx/src/test/resources/META-INF/persistence.xml @@ -7,15 +7,15 @@ 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. + under the License. --> - + PU for JMX Platform MBean Testing with PreparedQueryCache/QuerySQLCache org.apache.openjpa.integration.jmx.CachedEntity @@ -42,5 +42,5 @@ - + diff --git a/openjpa-integration/pom.xml b/openjpa-integration/pom.xml index 310cbd59e..cbbc719e2 100644 --- a/openjpa-integration/pom.xml +++ b/openjpa-integration/pom.xml @@ -7,18 +7,18 @@ 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. + under the License. --> - @@ -51,7 +51,7 @@ ${basedir}/../../openjpa-persistence-jdbc/src/test/resources/j2.security.test.policy - + diff --git a/openjpa-integration/slf4j/pom.xml b/openjpa-integration/slf4j/pom.xml index 08d45d170..3b7dbe028 100644 --- a/openjpa-integration/slf4j/pom.xml +++ b/openjpa-integration/slf4j/pom.xml @@ -7,18 +7,18 @@ 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. + under the License. --> - @@ -140,7 +140,7 @@ ${surefire.jvm.args} - org/apache/openjpa/**/*Test.java diff --git a/openjpa-integration/slf4j/src/test/java/org/apache/openjpa/integration/slf4j/TestLogFactory.java b/openjpa-integration/slf4j/src/test/java/org/apache/openjpa/integration/slf4j/TestLogFactory.java index 8c7e75495..b2c5824c0 100644 --- a/openjpa-integration/slf4j/src/test/java/org/apache/openjpa/integration/slf4j/TestLogFactory.java +++ b/openjpa-integration/slf4j/src/test/java/org/apache/openjpa/integration/slf4j/TestLogFactory.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.slf4j; @@ -29,41 +29,41 @@ import org.apache.openjpa.persistence.test.SingleEMFTestCase; */ public class TestLogFactory extends SingleEMFTestCase { String systemPropLog = null; - + public void setUp() throws Exception { - // Maven users may disable logging via a global system prop - which breaks this testcase. + // Maven users may disable logging via a global system prop - which breaks this testcase. systemPropLog = System.getProperty("openjpa.Log"); System.getProperties().remove("openjpa.Log"); super.setUp(); } - + public void tearDown() throws Exception { super.tearDown(); - if(systemPropLog != null) { + if(systemPropLog != null) { System.setProperty("openjpa.Log", systemPropLog); } } - + public void testSLF4J() { try { EntityManager em = emf.createEntityManager(); // do some logging - Log log = getLog(); + Log log = getLog(); String logFactory = log.getClass().getName(); log.info("Log class=" + logFactory); assertEquals(SLF4JLogFactory.LogAdapter.class.getName(), logFactory); // next one should not be logged if using slf4j-simple binding - only INFO, WARN and ERROR log.trace("TRACE level logging"); - + em.close(); } finally { closeEMF(emf); } } - - public String getPersistenceUnitName() { - // override puName instead of creating our own EMF. - // getLog uses the SingleEMFTestCase's emf. + + public String getPersistenceUnitName() { + // override puName instead of creating our own EMF. + // getLog uses the SingleEMFTestCase's emf. return "openjpa-integration-slf4j"; } } diff --git a/openjpa-integration/slf4j/src/test/resources/META-INF/persistence.xml b/openjpa-integration/slf4j/src/test/resources/META-INF/persistence.xml index cf2674c97..1ca45eefb 100644 --- a/openjpa-integration/slf4j/src/test/resources/META-INF/persistence.xml +++ b/openjpa-integration/slf4j/src/test/resources/META-INF/persistence.xml @@ -23,7 +23,7 @@ PU for SLF4J tests org.apache.openjpa.persistence.PersistenceProviderImpl true - + diff --git a/openjpa-integration/tck/pom.xml b/openjpa-integration/tck/pom.xml index 4fb1bdd39..5bce7d812 100644 --- a/openjpa-integration/tck/pom.xml +++ b/openjpa-integration/tck/pom.xml @@ -180,10 +180,10 @@ - + - + @@ -217,18 +217,18 @@ ${slf4jVersion} - + - + - + tck-profile @@ -454,7 +454,7 @@ databaseName=${db.name} ${project.version} - + diff --git a/openjpa-integration/tck/sql/create.openjpa.sql.xml b/openjpa-integration/tck/sql/create.openjpa.sql.xml index f1fe00ccf..25099624f 100644 --- a/openjpa-integration/tck/sql/create.openjpa.sql.xml +++ b/openjpa-integration/tck/sql/create.openjpa.sql.xml @@ -20,23 +20,23 @@ - + Creating OpenJPA specific sql for JPA 2.0 TCK tests Create TCK specific database tables returned result=${tsant.result} - + - + databaseName=${databaseName} - + - + - + diff --git a/openjpa-integration/tck/tck2-20091209.xml b/openjpa-integration/tck/tck2-20091209.xml index 321fb2ebb..73897036b 100644 --- a/openjpa-integration/tck/tck2-20091209.xml +++ b/openjpa-integration/tck/tck2-20091209.xml @@ -7,15 +7,15 @@ 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. + under the License. --> - @@ -137,7 +137,7 @@ database.classes= openjpa.properties=${openjpa.properties} toplink.properties=${toplink.properties} # Need to specify java.* classes, both in Windows/UNIX locations as well as Mac. -# This includes a few different possible locations; only one of them needs to +# This includes a few different possible locations; only one of them needs to # actually work for a given environment. sigTestClasspath=${JAVA_HOME}/lib/rt.jar${path.separator}${JAVA_HOME}/jre/lib/rt.jar${path.separator}${JAVA_HOME}/../Classes/classes.jar${path.separator}$${jpa.classes} persistence.unit.properties.file.full.path=${provider.properties} @@ -150,7 +150,7 @@ databaseName=${db.name} Update directory paths if running on Windows @@ -323,7 +323,7 @@ com/sun/ts/tests/pluggability/contracts/Client.java#getTransactionType_from_stan - + @@ -366,7 +366,7 @@ com/sun/ts/tests/pluggability/contracts/Client.java#getTransactionType_from_stan - + diff --git a/openjpa-integration/tck/tck2-20110815.xml b/openjpa-integration/tck/tck2-20110815.xml index deddece74..0763973d6 100644 --- a/openjpa-integration/tck/tck2-20110815.xml +++ b/openjpa-integration/tck/tck2-20110815.xml @@ -197,7 +197,7 @@ create.cmp.tables=false + --> @@ -40,8 +40,8 @@ - - running enhancer - diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyPersistenceProviderResolver.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyPersistenceProviderResolver.java index 99e97c367..441e892ce 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyPersistenceProviderResolver.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyPersistenceProviderResolver.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.persistence.provider; diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyProvider1.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyProvider1.java index a6bbedd95..d77c81645 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyProvider1.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyProvider1.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.persistence.provider; diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyProvider2.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyProvider2.java index fdae33a77..16e6150b6 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyProvider2.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyProvider2.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.persistence.provider; diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/TestPersistenceProviderResolver.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/TestPersistenceProviderResolver.java index b7d815784..6367f3c5b 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/TestPersistenceProviderResolver.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/TestPersistenceProviderResolver.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.persistence.provider; @@ -52,44 +52,44 @@ public class TestPersistenceProviderResolver extends TestCase { String dummyProvider1 = "org.apache.openjpa.integration.persistence.provider.DummyProvider1"; String dummyProvider2 = "org.apache.openjpa.integration.persistence.provider.DummyProvider2"; DummyPersistenceProviderResolver dummyResolver = new DummyPersistenceProviderResolver(); - + ClassLoader originalLoader = null; TempUrlLoader tempLoader = null; - + public void setUp() throws Exception { super.setUp(); - + currentDir = System.getProperty("user.dir"); - - targetJar1 = new File(currentDir + File.separator + "target" + - File.separator + + + targetJar1 = new File(currentDir + File.separator + "target" + + File.separator + "TestPersistenceProviderResolver1.jar"); - targetJar2 = new File(currentDir + File.separator + "target" + - File.separator + + targetJar2 = new File(currentDir + File.separator + "target" + + File.separator + "TestPersistenceProviderResolver2.jar"); - + deleteTargetJars(); - + File classesDir = new File(currentDir + File.separator + "target" + File.separator + "test-classes" + File.separator); classesDirUrl = classesDir.toURI().toURL(); - + originalLoader = (URLClassLoader)Thread.currentThread().getContextClassLoader(); } - + protected void tearDown() throws Exception { super.tearDown(); // Restore the original classloader, in case there was an exception Thread.currentThread().setContextClassLoader(originalLoader); } - + public void testDefault() { List providerNames = new LinkedList(); providerNames.add(openjpaProvider); checkProviders(providerNames); } - - + + public void testDefaultMultipleJars() throws Exception { String[] contents = new String[]{dummyProvider1}; buildFile("testPersistenceProviderResolver1", contents); @@ -98,61 +98,61 @@ public class TestPersistenceProviderResolver extends TestCase { ,originalLoader); AccessController.doPrivileged(J2DoPrivHelper .setContextClassLoaderAction(tempLoader)); - + List providerNames = new LinkedList(); providerNames.add(openjpaProvider); providerNames.add(dummyProvider1); checkProviders(providerNames); - + AccessController.doPrivileged(J2DoPrivHelper .setContextClassLoaderAction(originalLoader)); } - + public void testDefaultMultipleProviders() throws Exception { String[] contents = new String[]{dummyProvider1, dummyProvider2}; buildFile("testPersistenceProviderResolver2", contents); buildTargetJar(targetJar2); tempLoader = new TempUrlLoader(new URL[]{targetJar2.toURI().toURL(), classesDirUrl} - ,originalLoader); - + ,originalLoader); + AccessController.doPrivileged(J2DoPrivHelper .setContextClassLoaderAction(tempLoader)); - + List providerNames = new LinkedList(); providerNames.add(openjpaProvider); providerNames.add(dummyProvider1); providerNames.add(dummyProvider2); checkProviders(providerNames); - - + + AccessController.doPrivileged(J2DoPrivHelper .setContextClassLoaderAction(originalLoader)); } - + public void testClearCachedProviders() { - PersistenceProviderResolver resolver = + PersistenceProviderResolver resolver = PersistenceProviderResolverHolder.getPersistenceProviderResolver(); List providers = resolver.getPersistenceProviders(); assertNotNull(providers); resolver.clearCachedProviders(); - + List providerNames = new LinkedList(); providerNames.add(openjpaProvider); checkProviders(providerNames); } - + public void testNonDefaultResolver() { PersistenceProviderResolver originalResolver = PersistenceProviderResolverHolder.getPersistenceProviderResolver(); PersistenceProviderResolverHolder.setPersistenceProviderResolver(dummyResolver); - PersistenceProviderResolver retrievedResolver = + PersistenceProviderResolver retrievedResolver = PersistenceProviderResolverHolder.getPersistenceProviderResolver(); assertTrue(retrievedResolver instanceof DummyPersistenceProviderResolver); - + PersistenceProviderResolverHolder.setPersistenceProviderResolver(originalResolver); } - - + + private void deleteTargetJars() { if (targetJar1.exists()) { targetJar1.delete(); @@ -161,7 +161,7 @@ public class TestPersistenceProviderResolver extends TestCase { targetJar2.delete(); } } - + private void buildFile(String dir, String[] contents) throws Exception { File servicesDir = new File(currentDir + File.separator + "target" + File.separator + "test-classes" + File.separator + dir + File.separator + "META-INF" + File.separator @@ -179,7 +179,7 @@ public class TestPersistenceProviderResolver extends TestCase { bw.write(line); bw.newLine(); } - + bw.flush(); bw.close(); } catch (IOException e) { @@ -188,13 +188,13 @@ public class TestPersistenceProviderResolver extends TestCase { } assertTrue(persistenceProviderFile.exists()); } - - + + private void buildTargetJar(File targetJar) throws Exception { JarOutputStream out = new JarOutputStream( new BufferedOutputStream(new FileOutputStream(targetJar))); - - BufferedInputStream in = + + BufferedInputStream in = new BufferedInputStream(new FileInputStream(persistenceProviderFile)); out.putNextEntry(new JarEntry("META-INF/")); @@ -206,13 +206,13 @@ public class TestPersistenceProviderResolver extends TestCase { while ((i = in.read(buf)) != -1) { out.write(buf, 0, i); } - + out.close(); - in.close(); + in.close(); } - + private void checkProviders(List providerNames) { - PersistenceProviderResolver resolver = + PersistenceProviderResolver resolver = PersistenceProviderResolverHolder.getPersistenceProviderResolver(); List providers = resolver.getPersistenceProviders(); assertNotNull(providers); @@ -225,7 +225,7 @@ public class TestPersistenceProviderResolver extends TestCase { } assertTrue(providerNames.isEmpty()); } - + class TempUrlLoader extends URLClassLoader { public TempUrlLoader(URL[] urls, ClassLoader parent) { super(urls,parent); diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Address.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Address.java index 461ce276d..fe324fc2d 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Address.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Address.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -65,7 +65,7 @@ public class Address implements IAddress, Serializable { @Basic private String phoneNumber; - + public void setStreetAddress(String streetAddress) { this.streetAddress = streetAddress; } diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Book.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Book.java index b548b831e..e9e7d5c60 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Book.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Book.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -32,9 +32,9 @@ public class Book { String title; int pages; Publisher publisher; - + public Book() {} - + public Book(int id) { this.id = id; } diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintBoolean.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintBoolean.java index 3f30dd068..fd29ff242 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintBoolean.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintBoolean.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -47,8 +47,8 @@ public class ConstraintBoolean implements Serializable { @Basic private Boolean falseRequired; // @AssertFalse constraint is on the getter - - /* + + /* * Some helper methods to create the entities to test with */ public static ConstraintBoolean createInvalidTrue() { @@ -57,7 +57,7 @@ public class ConstraintBoolean implements Serializable { c.setFalseRequired(Boolean.FALSE); return c; } - + public static ConstraintBoolean createInvalidFalse() { ConstraintBoolean c = new ConstraintBoolean(); c.setTrueRequired(Boolean.TRUE); @@ -72,7 +72,7 @@ public class ConstraintBoolean implements Serializable { return c; } - + /* * Main entity code */ @@ -90,7 +90,7 @@ public class ConstraintBoolean implements Serializable { public void setTrueRequired(Boolean b) { trueRequired = b; } - + @AssertFalse public Boolean getFalseRequired() { return falseRequired; diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintDates.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintDates.java index 08c6f2056..c7e705168 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintDates.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintDates.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -39,7 +39,7 @@ public class ConstraintDates implements Serializable { @Transient private static final long serialVersionUID = 1L; - + // current time when class loaded @Transient private static final Date CURRENT_DATE = new Date(); @@ -65,8 +65,8 @@ public class ConstraintDates implements Serializable { @Basic private GregorianCalendar pastCalendar; // @Past constraint is on the getter - - /* + + /* * Some helper methods to create the entities to test with */ public static ConstraintDates createInvalidFuture() { @@ -99,7 +99,7 @@ public class ConstraintDates implements Serializable { return c; } - + /* * Main entity code * Create a valid entity by default @@ -120,7 +120,7 @@ public class ConstraintDates implements Serializable { } public void setFutureDate(Date d) { - futureDate = d; + futureDate = d; } @Past diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintDecimal.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintDecimal.java index a2b64844e..44233dbdb 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintDecimal.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintDecimal.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -37,7 +37,7 @@ public class ConstraintDecimal implements Serializable { @Transient private static final long serialVersionUID = 1L; - + @Transient private static final BigDecimal negative = new BigDecimal(-99.99); @@ -55,8 +55,8 @@ public class ConstraintDecimal implements Serializable { @Basic private BigDecimal maxZero; // @DecimalMax(value = "0") constraint is on the getter - - /* + + /* * Some helper methods to create the entities to test with */ public static ConstraintDecimal createInvalidMin() { @@ -87,7 +87,7 @@ public class ConstraintDecimal implements Serializable { return c; } - + /* * Main entity code */ diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintDigits.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintDigits.java index 793af0a79..7e108e23d 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintDigits.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintDigits.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -36,7 +36,7 @@ public class ConstraintDigits implements Serializable { @Transient private static final long serialVersionUID = 1L; - + @Transient private static final BigDecimal SIX_DIGITS = new BigDecimal("666666.666666"); @@ -57,8 +57,8 @@ public class ConstraintDigits implements Serializable { @Basic private BigDecimal fiveDigits; // @Digits(5,5) constraint is on the getter - - /* + + /* * Some helper methods to create the entities to test with */ public static ConstraintDigits createInvalidTwoDigits() { @@ -91,7 +91,7 @@ public class ConstraintDigits implements Serializable { return c; } - + /* * Main entity code */ @@ -122,11 +122,11 @@ public class ConstraintDigits implements Serializable { public void setFiveDigits(BigDecimal d) { fiveDigits = d; } - + public void setFiveDigits(String s) { fiveDigits = toBigDecimal(s); } - + private BigDecimal toBigDecimal(String s) { try { diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintNull.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintNull.java index 378578355..5e02f1da7 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintNull.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintNull.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -47,8 +47,8 @@ public class ConstraintNull implements Serializable { @Basic private String nullInvalid; // @NotNull constraint is on the getter - - /* + + /* * Some helper methods to create the entities to test with */ public static ConstraintNull createInvalidNotNull() { @@ -70,7 +70,7 @@ public class ConstraintNull implements Serializable { return c; } - + /* * Main entity code */ diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintNumber.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintNumber.java index c059995ec..0bddb87f2 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintNumber.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintNumber.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -36,7 +36,7 @@ public class ConstraintNumber implements Serializable { @Transient private static final long serialVersionUID = 1L; - + @Transient private static final long negative = -99; @@ -54,8 +54,8 @@ public class ConstraintNumber implements Serializable { @Basic private long maxZero; // @Max(value = 0) constraint is on the getter - - /* + + /* * Some helper methods to create the entities to test with */ public static ConstraintNumber createInvalidMin() { @@ -86,7 +86,7 @@ public class ConstraintNumber implements Serializable { return c; } - + /* * Main entity code */ diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintPattern.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintPattern.java index 30ef3ef53..b4eb11ca1 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintPattern.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintPattern.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -35,7 +35,7 @@ public class ConstraintPattern implements Serializable { @Transient private static final long serialVersionUID = 1L; - + @Id @GeneratedValue private long id; @@ -48,8 +48,8 @@ public class ConstraintPattern implements Serializable { @Basic private String zipcode; // @Pattern([0-9]) constraint is on the getter - - /* + + /* * Some helper methods to create the entities to test with */ public static ConstraintPattern createInvalidString() { @@ -73,7 +73,7 @@ public class ConstraintPattern implements Serializable { return c; } - + /* * Main entity code */ diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintSize.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintSize.java index b17ba61bd..6c7bb524a 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintSize.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ConstraintSize.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -37,7 +37,7 @@ public class ConstraintSize implements Serializable { @Transient private static final long serialVersionUID = 1L; - + @Id @GeneratedValue private long id; @@ -48,8 +48,8 @@ public class ConstraintSize implements Serializable { private Map myMap; // @Size(1,2) constraint is on the getter - - /* + + /* * Some helper methods to create the entities to test with */ public static ConstraintSize createInvalidString() { @@ -80,7 +80,7 @@ public class ConstraintSize implements Serializable { return c; } - + /* * Main entity code */ @@ -107,8 +107,8 @@ public class ConstraintSize implements Serializable { public void setMyMap(Map m) { myMap = m; } - - + + private void setInvalidMap() { Map m = new HashMap(); m.put("a", "a value"); @@ -116,11 +116,11 @@ public class ConstraintSize implements Serializable { m.put("c", "c value"); setMyMap(m); } - + private void setValidMap() { Map m = new HashMap(); m.put("a", "a value"); setMyMap(m); } - + } diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Customer.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Customer.java index ea4561fea..7f1bc4652 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Customer.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Customer.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/DefGrpEntity.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/DefGrpEntity.java index f9dfd9053..d3f93aae1 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/DefGrpEntity.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/DefGrpEntity.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -29,7 +29,7 @@ public class DefGrpEntity { @Id @GeneratedValue private int id; - + // NotNull constraint with default validation group @NotNull private String dgName; @@ -48,5 +48,5 @@ public class DefGrpEntity { public String getDgName() { return dgName; - } + } } diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/IAddress.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/IAddress.java index 53a497fb4..2a3c2b879 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/IAddress.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/IAddress.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ICustomer.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ICustomer.java index 6c4857c92..f7987ded1 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ICustomer.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ICustomer.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/IPerson.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/IPerson.java index dde0a3d0e..57d948330 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/IPerson.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/IPerson.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Image.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Image.java index 6052b3cf1..9d1d3137a 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Image.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Image.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/MixedGrpEntity.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/MixedGrpEntity.java index 4b8aafa2c..f6241f0a8 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/MixedGrpEntity.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/MixedGrpEntity.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -32,13 +32,13 @@ public class MixedGrpEntity { @NotNull private String defNotNull; - + @NotNull(groups=ValGroup1.class) private String vg1NotNull; - + @NotNull(groups=ValGroup2.class) private String vg2NotNull; - + @NotNull(groups={ValGroup1.class, ValGroup2.class}) private String vg12NotNull; diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/NonDefGrpEntity.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/NonDefGrpEntity.java index 14b4803c1..4cc961963 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/NonDefGrpEntity.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/NonDefGrpEntity.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -30,11 +30,11 @@ public class NonDefGrpEntity { @Id @GeneratedValue private int id; - + // NotNull constraint with default validation group @NotNull private String dgName; - + // NotNull constraint with specified validation group @NotNull(groups=ValGroup1.class) private String ndgName; @@ -53,7 +53,7 @@ public class NonDefGrpEntity { public String getDgName() { return dgName; - } + } public void setNdgName(String dgName) { this.ndgName = dgName; @@ -61,5 +61,5 @@ public class NonDefGrpEntity { public String getNdgName() { return ndgName; - } + } } diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Person.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Person.java index 6a4f44a01..807af9049 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Person.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Person.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -57,7 +57,7 @@ public class Person implements IPerson, Serializable { @Valid private Address homeAddress; - + public void setFirstName(String firstName) { this.firstName = firstName; } diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Publisher.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Publisher.java index d42918c7c..4ea0afdb8 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Publisher.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/Publisher.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -27,11 +27,11 @@ public class Publisher { @Basic @Size(min = 0, max = 5) String name; - + String publisherID; - + public Publisher() {} - + /** * @return the name */ diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/SimpleEntity.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/SimpleEntity.java index 069cb2479..f78287b07 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/SimpleEntity.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/SimpleEntity.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -39,14 +39,14 @@ import javax.persistence.Table; @NamedQuery(name="FindAll", query="select s from simple s") }) -@NamedNativeQueries( { +@NamedNativeQueries( { @NamedNativeQuery(name = "findSimpleEntitites", - query = "SELECT ID, NAME, VALUE FROM SIMPLE_ENTITY", + query = "SELECT ID, NAME, VALUE FROM SIMPLE_ENTITY", resultSetMapping = "simpleEntitiesResult") }) @SqlResultSetMapping(name = "simpleEntitiesResult", entities = @EntityResult( - entityClass = org.apache.openjpa.integration.validation.SimpleEntity.class, + entityClass = org.apache.openjpa.integration.validation.SimpleEntity.class, fields = {@FieldResult(name = "id", column = "ID"), @FieldResult(name = "name", column = "NAME"), @FieldResult(name = "value", column = "VALUE") })) diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestConstraintViolation.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestConstraintViolation.java index c68eaa068..f8d298644 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestConstraintViolation.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestConstraintViolation.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -215,7 +215,7 @@ public class TestConstraintViolation extends AbstractPersistenceTestCase { } catch (ConstraintViolationException cve) { fail(); } - + try { em.getTransaction().begin(); log.trace("** set null city name in location and remove" ); diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestConstraints.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestConstraints.java index 70dea2e8d..0c5d541c2 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestConstraints.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestConstraints.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -34,7 +34,7 @@ import org.apache.openjpa.persistence.test.AbstractPersistenceTestCase; /** * Tests the new Bean Validation constraint support in the JPA 2.0 spec by * focusing on the following Validation scenarios: - * + * * Check special update/delete/ignore cases once: * 1) Update @Null constraint exception on variables in mode=AUTO * Tests that a constraint violation will occur on invalid update. @@ -42,7 +42,7 @@ import org.apache.openjpa.persistence.test.AbstractPersistenceTestCase; * Tests that a violation will not occur when deleting invalid entity. * 3) No invalid Persist constraint exception when mode=NONE * Tests that no Validation Providers are used when disabled. - * + * * Basic constraint tests for violation exceptions: * 4) Persist @Null constraint exception on variables in mode=AUTO * 5) Persist @NotNull constraint exception on getter in mode=AUTO @@ -61,7 +61,7 @@ import org.apache.openjpa.persistence.test.AbstractPersistenceTestCase; * 25) Test @Pattern constraint exception on variables in mode=AUTO * 26) Test @Pattern constraint exception on getter in mode=AUTO * 28) Test @Valid constraint exceptions in mode=AUTO - * + * * Basic constraint test for no violations: * 6) Persist @NotNull and @Null constraints pass in mode=AUTO * 9) Test @AssertFalse and @AssertTrue constraints pass in mode=AUTO @@ -78,16 +78,16 @@ import org.apache.openjpa.persistence.test.AbstractPersistenceTestCase; public class TestConstraints extends AbstractPersistenceTestCase { private static OpenJPAEntityManagerFactorySPI emf = null; - + @Override public void setUp() throws Exception { super.setUp(); - emf = (OpenJPAEntityManagerFactorySPI) + emf = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory( "ConstraintPU", "org/apache/openjpa/integration/validation/persistence.xml"); } - + @Override public void tearDown() throws Exception { closeEMF(emf); @@ -102,7 +102,7 @@ public class TestConstraints extends AbstractPersistenceTestCase { */ public void testNullUpdateConstraint() { getLog().trace("testNullUpdateConstraint() started"); - + long id = 0; // Part 1 - Create and persist a valid entity // create EM from default EMF @@ -128,18 +128,18 @@ public class TestConstraints extends AbstractPersistenceTestCase { } finally { closeEM(em); } - + // Part 2 - Verify that invalid properties are caught on an update // create EM from default EMF em = emf.createEntityManager(); - assertNotNull(em); + assertNotNull(em); try { // update entity to be invalid ConstraintNull c = em.find(ConstraintNull.class, id); em.getTransaction().begin(); c.setNullRequired(new String("not null")); em.flush(); - em.getTransaction().commit(); + em.getTransaction().commit(); getLog().trace("testNullUpdateConstraint() Part 2 of 2 failed"); fail("Expected a ConstraintViolationException"); } catch (ConstraintViolationException e) { @@ -158,7 +158,7 @@ public class TestConstraints extends AbstractPersistenceTestCase { */ public void testNullDeleteIgnored() { getLog().trace("testNullDeleteIgnored() started"); - + // Part 1 - Create an invalid entity // create our EMF w/ props OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) @@ -221,7 +221,7 @@ public class TestConstraints extends AbstractPersistenceTestCase { closeEMF(emf); } } - + /** * Scenario being tested: * 3) No invalid Persist constraint exception when mode=NONE @@ -1028,7 +1028,7 @@ public class TestConstraints extends AbstractPersistenceTestCase { public void testValidFailuresConstraint() { Address a = new Address(); getLog().trace("testValidFailuresConstraint() started"); - + // Part 1 - Create an invalid Address entity try { OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) @@ -1106,9 +1106,9 @@ public class TestConstraints extends AbstractPersistenceTestCase { getLog().trace("testValidFailuresConstraint() Part 2 of 2 passed"); } finally { closeEM(em); - } + } } - + /** * Scenario being tested: * 29) Test @Pattern constraints pass in mode=AUTO @@ -1153,7 +1153,7 @@ public class TestConstraints extends AbstractPersistenceTestCase { /** * Internal convenience method for getting the OpenJPA logger - * + * */ private Log getLog() { return emf.getConfiguration().getLog("Tests"); diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestEagerInit.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestEagerInit.java index 62c10ba48..0221603ae 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestEagerInit.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestEagerInit.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestMappedSuper.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestMappedSuper.java index dcc532854..1bfb50283 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestMappedSuper.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestMappedSuper.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -36,14 +36,14 @@ public class TestMappedSuper extends AbstractPersistenceTestCase { * Verify constraints defined via XML on a mapped superclass are validated. */ public void testMappedSuperXMLConstraint() { - OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) + OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory( "XMLConstraintPU", "org/apache/openjpa/integration/validation/persistence.xml"); assertNotNull(emf); OpenJPAEntityManager em = emf.createEntityManager(); assertNotNull(em); - + XMLBase be = new XMLBase(); try { em.getTransaction().begin(); @@ -65,14 +65,14 @@ public class TestMappedSuper extends AbstractPersistenceTestCase { closeEMF(emf); } } - + private void checkCVE(ConstraintViolationException e, String... vioProperties) { Set>cvs = e.getConstraintViolations(); if (vioProperties.length == 0 && cvs == null) return; assertEquals(vioProperties.length, cvs.size()); - Iterator> i = + Iterator> i = (Iterator>) cvs.iterator(); while (i.hasNext()) { ConstraintViolation v = (ConstraintViolation)i.next(); @@ -84,7 +84,7 @@ public class TestMappedSuper extends AbstractPersistenceTestCase { } } if (!found) { - fail("Unexpected ConstraintViolation for: " + + fail("Unexpected ConstraintViolation for: " + v.getPropertyPath()); } } diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestMerge.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestMerge.java index 625f8238e..81a493867 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestMerge.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestMerge.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -29,24 +29,24 @@ import org.apache.openjpa.persistence.OpenJPAPersistence; import org.apache.openjpa.persistence.test.AbstractPersistenceTestCase; /** - * Tests the Bean Validation support when using the em.merge() + * Tests the Bean Validation support when using the em.merge() * operation. - * + * * @version $Rev$ $Date$ */ public class TestMerge extends AbstractPersistenceTestCase { private static OpenJPAEntityManagerFactorySPI emf = null; - + @Override public void setUp() throws Exception { super.setUp(); - emf = (OpenJPAEntityManagerFactorySPI) + emf = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory( "ConstraintPU", "org/apache/openjpa/integration/validation/persistence.xml"); } - + @Override public void tearDown() throws Exception { closeEMF(emf); @@ -55,12 +55,12 @@ public class TestMerge extends AbstractPersistenceTestCase { } /** - * Verifies constraint validation occurs on a "new" merged entity only after - * the state of the persistent entity is properly set. + * Verifies constraint validation occurs on a "new" merged entity only after + * the state of the persistent entity is properly set. */ public void testMergeNew() { getLog().trace("testMergeNew() started"); - + // Part 1 - Create and persist a valid entity // create EM from default EMF OpenJPAEntityManager em = emf.createEntityManager(); @@ -85,10 +85,10 @@ public class TestMerge extends AbstractPersistenceTestCase { } finally { closeEM(em); } - + // Part 2 - Verify that merge throws a CVE when a constraint is not met. em = emf.createEntityManager(); - assertNotNull(em); + assertNotNull(em); try { Person p = createPerson(em); em.getTransaction().begin(); @@ -106,12 +106,12 @@ public class TestMerge extends AbstractPersistenceTestCase { } /** - * Verifies constraint validation occurs on a "new" merged entity only after - * the state of the persistent entity is properly set. + * Verifies constraint validation occurs on a "new" merged entity only after + * the state of the persistent entity is properly set. */ public void testMergeExisting() { getLog().trace("testMergeExisting() started"); - + // Part 1 - Create and persist a valid entity // create EM from default EMF OpenJPAEntityManager em = emf.createEntityManager(); @@ -133,7 +133,7 @@ public class TestMerge extends AbstractPersistenceTestCase { // find the entity p = em.find(Person.class, p.getId()); - + // modify the entity and merge em.getTransaction().begin(); p.setFirstName("NewFirst"); @@ -151,10 +151,10 @@ public class TestMerge extends AbstractPersistenceTestCase { } finally { closeEM(em); } - + // Part 2 - Verify that merge throws a CVE when a constraint is not met. em = emf.createEntityManager(); - assertNotNull(em); + assertNotNull(em); try { // Create and persist a new entity @@ -190,8 +190,8 @@ public class TestMerge extends AbstractPersistenceTestCase { closeEM(em); } } - - + + private Person createPerson(EntityManager em) { Person p = new Person(); p.setFirstName("First"); @@ -217,7 +217,7 @@ public class TestMerge extends AbstractPersistenceTestCase { /** * Internal convenience method for getting the OpenJPA logger - * + * */ private Log getLog() { return emf.getConfiguration().getLog("Tests"); diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestTraversableResolver.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestTraversableResolver.java index 4f39abb62..05fb39e57 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestTraversableResolver.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestTraversableResolver.java @@ -41,13 +41,13 @@ import org.apache.openjpa.persistence.validation.TraversableResolverImpl; /** * Test the TraversableResolver methods - * + * * First run several testcases from a user perspective. These test the methods * indirectly: * 1) testLoadedTitle() * 2} testUnloaded() * 3) testCascading() - * + * * Then test the methods directly: * 1) testPages() * 2) testTitle @@ -69,7 +69,7 @@ public class TestTraversableResolver extends TestCase { public void setUp() { createBook(1, "long title", 234); } - + private void createEMF(String pu, String schemaAction) { Map map = new HashMap(); map.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true," @@ -93,7 +93,7 @@ public class TestTraversableResolver extends TestCase { emf = null; } } - + /** * By default, the title is not loaded. Make sure it gets loaded, * make a change in a different field, and commit. The isLoaded() method @@ -119,11 +119,11 @@ public class TestTraversableResolver extends TestCase { } assertTrue(exceptionCaught); } - + /** * By default, the title and publisher are not loaded. Make a change in a different field * and commit. The isLoaded() method of the TraversableResolver should return - * false for both of these. Therefore a validation should not be performed. + * false for both of these. Therefore a validation should not be performed. * The commit should succeed with no exception. */ public void testUnloaded() { @@ -142,7 +142,7 @@ public class TestTraversableResolver extends TestCase { assertFalse(exceptionCaught); closeEMF(); } - + /** * By default, the publisher is not loaded. Make sure it gets loaded. * The isLoaded() and isCascadable() methods should both return true, @@ -169,10 +169,10 @@ public class TestTraversableResolver extends TestCase { assertTrue(exceptionCaught); closeEMF(); } - + /** * Test the isReachable() and isCascadable() methods on the pages element of Book, - * which is eagerly fetched by default. + * which is eagerly fetched by default. */ public void testPages() { createEMF("validation-pu", "SchemaAction='add')"); @@ -189,7 +189,7 @@ public class TestTraversableResolver extends TestCase { em.getTransaction().commit(); closeEMF(); } - + /** * Test the isReachable() method on the title. * It is configured with fetch=FetvhType.LAZY. @@ -208,7 +208,7 @@ public class TestTraversableResolver extends TestCase { em.getTransaction().commit(); closeEMF(); } - + private void createBook(int id, String title, int pages) { createEMF("non-validation-pu", "SchemaAction='drop,add')"); em = emf.createEntityManager(); diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestValidatingLEM.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestValidatingLEM.java index 177eaef86..15e950f9a 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestValidatingLEM.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestValidatingLEM.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -41,7 +41,7 @@ import org.apache.openjpa.validation.ValidatingLifecycleEventManager; * 2) Mode of AUTO will create a ValidatingLifecycleEventManager * 3) Map mode of CALLBACK will create a ValidatingLifecycleEventManager * 4) Verify a passed in ValidatorFactory is used - * + * * @version $Rev$ $Date$ */ public class TestValidatingLEM extends SingleEMFTestCase { @@ -93,7 +93,7 @@ public class TestValidatingLEM extends SingleEMFTestCase { conf.getValidationMode().equalsIgnoreCase("NONE")); Class lem = conf.getLifecycleEventManagerInstance().getClass(); assertNotNull(lem); - assertFalse("Expected a LifecycleEventManager instance", + assertFalse("Expected a LifecycleEventManager instance", ValidatingLifecycleEventManager.class.isAssignableFrom(lem)); } catch (Exception e) { fail("Unexpected testValidatingLEM1() exception = " + e); @@ -129,7 +129,7 @@ public class TestValidatingLEM extends SingleEMFTestCase { conf.getValidationMode().equalsIgnoreCase("AUTO")); Class lem = conf.getLifecycleEventManagerInstance().getClass(); assertNotNull(lem); - assertTrue("Expected a ValidatingLifecycleEventManager instance", + assertTrue("Expected a ValidatingLifecycleEventManager instance", ValidatingLifecycleEventManager.class.isAssignableFrom(lem)); } catch (Exception e) { fail("Unexpected testValidatingLEM2() exception = " + e); @@ -171,7 +171,7 @@ public class TestValidatingLEM extends SingleEMFTestCase { conf.getValidationMode().equalsIgnoreCase("CALLBACK")); Class lem = conf.getLifecycleEventManagerInstance().getClass(); assertNotNull(lem); - assertTrue("Expected a ValidatingLifecycleEventManager instance", + assertTrue("Expected a ValidatingLifecycleEventManager instance", ValidatingLifecycleEventManager.class.isAssignableFrom(lem)); } catch (Exception e) { fail("Unexpected testValidatingLEM3() exception = " + e); @@ -219,7 +219,7 @@ public class TestValidatingLEM extends SingleEMFTestCase { conf.getValidationMode().equalsIgnoreCase("AUTO")); Class lem = conf.getLifecycleEventManagerInstance().getClass(); assertNotNull(lem); - assertTrue("Expected a ValidatingLifecycleEventManager instance", + assertTrue("Expected a ValidatingLifecycleEventManager instance", ValidatingLifecycleEventManager.class.isAssignableFrom(lem)); // verify factory matches assertEquals("Expected same ValidatorFactory instance", @@ -234,7 +234,7 @@ public class TestValidatingLEM extends SingleEMFTestCase { } } - + /** * Helper method to remove entities and close the emf an any open em's. * @param emf @@ -242,6 +242,6 @@ public class TestValidatingLEM extends SingleEMFTestCase { private void cleanup(OpenJPAEntityManagerFactorySPI emf) { clear(emf); closeEMF(emf); - } + } } diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestValidationGroups.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestValidationGroups.java index f968b8a64..a083953c0 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestValidationGroups.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestValidationGroups.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; @@ -35,25 +35,25 @@ import org.apache.openjpa.persistence.test.AbstractPersistenceTestCase; /** * Tests the Bean Validation groups support as defined in the JPA 2.0 spec * via the following scenarios: - * + * * Verify default validation group on lifecycle events: * 1a) PrePersist and PreUpdate validate with default validation group * 1b) PreRemove does not validate with default validation group * 1c) Specify the default group for PreRemove and verify that it validates with * the default group. - * 1d) Verify validation for constraints using non-default validation groups + * 1d) Verify validation for constraints using non-default validation groups * does not occur. * 1e) PrePersist does not validate with no validation group defined. * 1f) PreUpdate does not validate when no validation group defined. - * 1g) PreUpdate only called when a pre-update validation group defined + * 1g) PreUpdate only called when a pre-update validation group defined * (ie. per-persist and pre-remove are disabled). * 1h) PrePersist only called when pre-persist validation group defined * (ie. per-persist and pre-remove are disabled). - * + * * Verify validation occurs when specific validation groups are specified: * 2a) Specify a non-default group for all lifecycle events. * 2b) Specify multiple/mixed non-default groups for lifecycle events. - * + * * Verify validation does not occur when no validation groups are specified: * 3a) Specify an empty validation group for PrePersist and PreUpdate and * verify validation does not occur on these events. @@ -77,11 +77,11 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { public void testDefaultValidationGroupFlush() { verifyDefaultValidationGroup(true); } - + /** * 1b) verify validation does not occur using the default validation group - * on the PreRemove lifecycle event on commit. + * on the PreRemove lifecycle event on commit. */ public void testDefaultPreRemove() { verifyDefaultPreRemove(false); @@ -89,14 +89,14 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { /** * 1bf) verify validation does not occur using the default validation group - * on the PreRemove lifecycle event on flush. + * on the PreRemove lifecycle event on flush. */ public void testDefaultPreRemoveFlush() { verifyDefaultPreRemove(true); } - + /** - * 1c) verify validation occurs on the default group when default is + * 1c) verify validation occurs on the default group when default is * specified for pre-remove on commit */ public void testSpecifiedDefaultPreRemove() { @@ -104,18 +104,18 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { } /** - * 1cf) verify validation occurs on the default group when default is + * 1cf) verify validation occurs on the default group when default is * specified for pre-remove on flush */ public void testSpecifiedDefaultPreRemoveFlush() { verifySpecifiedDefaultPreRemove(false); } - - /** + + /** * 1e) PrePersist does not validate with no validation group defined. */ public void testPersistNoValidationGroup() { - OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) + OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory( "no-pre-persist-default-validation-group", "org/apache/openjpa/integration/validation/persistence.xml"); @@ -143,12 +143,12 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { closeEMF(emf); } } - + /** * 1f) PreUpdate does not validate when no validation group defined. */ public void testUpdateNoValidationGroup() { - OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) + OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory( "no-pre-update-default-validation-group", "org/apache/openjpa/integration/validation/persistence.xml"); @@ -166,7 +166,7 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { } catch (ConstraintViolationException e) { fail("A ConstraintViolationException should not have been thrown " + "on pre-persist"); - } + } try { em.getTransaction().begin(); dge.setDgName(null); @@ -185,12 +185,12 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { } } - /** - * 1g) PreUpdate only called when a pre-update validation group defined + /** + * 1g) PreUpdate only called when a pre-update validation group defined * (ie. per-persist and pre-remove are disabled). */ public void testUpdateOnlyValidationGroup() { - OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) + OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory( "no-pre-persist-default-validation-group", "org/apache/openjpa/integration/validation/persistence.xml"); @@ -208,7 +208,7 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { } catch (ConstraintViolationException e) { fail("A ConstraintViolationException should not have been thrown " + "on pre-persist"); - } + } try { em.getTransaction().begin(); dge.setDgName("NotNull"); @@ -218,7 +218,7 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { "on pre-update"); } catch (ConstraintViolationException e) { // expected - } + } finally { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); @@ -234,7 +234,7 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { * (ie. per-persist and pre-remove are disabled). */ public void testPersistOnlyValidationGroup() { - OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) + OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory( "no-pre-update-default-validation-group", "org/apache/openjpa/integration/validation/persistence.xml"); @@ -274,19 +274,19 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { } catch (ConstraintViolationException e) { fail("A ConstraintViolationException should not have been thrown " + "on pre-update"); - } + } finally { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } } - + } finally { closeEM(em); closeEMF(emf); } } - + /** * 2a) verify non-default validation group for all lifecycle events on * commit. default validation group constraints should not validate @@ -302,14 +302,14 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { public void testNonDefaultValidationGroupFlush() { verifyNonDefaultValidationGroup(true); } - + /** * 2b1) verify multiple/mixed validation groups via persistence.xml * @param flush */ public void testPesistenceXMLMultipleValidationGroups() { - OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) + OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory( "multi-validation-group-xml", "org/apache/openjpa/integration/validation/persistence.xml"); @@ -334,7 +334,7 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { propMap.put("javax.persistence.validation.group.pre-remove", "org.apache.openjpa.integration.validation.ValGroup2"); - OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) + OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory( "multi-validation-group", "org/apache/openjpa/integration/validation/persistence.xml", @@ -342,15 +342,15 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { assertNotNull(emf); verifyMultipleValidationGroups(emf); } - + private void verifyMultipleValidationGroups(OpenJPAEntityManagerFactorySPI emf) { // create EM OpenJPAEntityManager em = emf.createEntityManager(); assertNotNull(em); - + try { MixedGrpEntity mge = new MixedGrpEntity(); - + // Assert vg1 and vg2 fire on pre-persist try { @@ -358,7 +358,7 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { em.persist(mge); em.getTransaction().commit(); } catch (ConstraintViolationException e) { - checkCVE(e, + checkCVE(e, "vg1NotNull", "vg2NotNull", "vg12NotNull"); @@ -370,7 +370,7 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } - } + } // Assert no validation occurs on pre-update // Persist an entity. Default should not validate on pre-persist em.getTransaction().begin(); @@ -380,14 +380,14 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { em.persist(mge); em.getTransaction().commit(); - + try { em.getTransaction().begin(); mge.setDefNotNull(null); mge.setVg12NotNull(null); mge.setVg1NotNull(null); mge.setVg2NotNull(null); - em.getTransaction().commit(); + em.getTransaction().commit(); } catch (ConstraintViolationException e) { fail("Update should have been successful." + " Caught unexpected ConstraintViolationException."); @@ -396,13 +396,13 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { fail("Update should have been successful." + " Caught unexpected exception."); } - + // Update the entity again so that it can be cleaned up by the // emf cleanup facility. The update should not validate em.getTransaction().begin(); mge.setVg2NotNull("Vg2NotNull"); mge.setVg12NotNull("Vg12NotNull"); - em.getTransaction().commit(); + em.getTransaction().commit(); // Assert vg2 and default groups validate on pre-remove try { @@ -412,9 +412,9 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { mge.setVg2NotNull(null); mge.setVg12NotNull(null); em.remove(mge); - em.getTransaction().commit(); + em.getTransaction().commit(); } catch (ConstraintViolationException e) { - checkCVE(e, + checkCVE(e, "vg2NotNull", "vg12NotNull"); } @@ -426,12 +426,12 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { em.getTransaction().rollback(); } } - + } finally { closeEM(em); closeEMF(emf); - } + } } /** @@ -446,7 +446,7 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { propMap.put("javax.persistence.validation.group.pre-update",""); - OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) + OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory( "multi-validation-group", "org/apache/openjpa/integration/validation/persistence.xml", @@ -458,14 +458,14 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { try { MixedGrpEntity mge = new MixedGrpEntity(); - + try { // No validation on pre-persist em.getTransaction().begin(); em.persist(mge); - em.getTransaction().commit(); - + em.getTransaction().commit(); + // No validation on pre-update em.getTransaction().begin(); mge.setVg12NotNull(null); @@ -482,16 +482,16 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { catch (Exception e) { fail("Operations should have been successful." + " Caught unexpected exception."); - } + } } finally { closeEM(em); closeEMF(emf); - } + } } private void verifyDefaultValidationGroup(boolean flush) { - OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) + OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory( "default-validation-group", "org/apache/openjpa/integration/validation/persistence.xml"); @@ -537,7 +537,7 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { em.persist(dge); em.getTransaction().commit(); try { - // Update the entity with null value. pre-update + // Update the entity with null value. pre-update // validation should fail on flush or commit em.getTransaction().begin(); dge.setDgName(null); @@ -571,7 +571,7 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { } private void verifyNonDefaultValidationGroup(boolean flush) { - OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) + OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory( "non-default-validation-group", "org/apache/openjpa/integration/validation/persistence.xml"); @@ -626,11 +626,11 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { fail("Caught unexpected exception"); if (em.getTransaction().isActive()) em.getTransaction().rollback(); - } + } try { - // Update the entity with null value. pre-update + // Update the entity with null value. pre-update // validation should fail on flush or commit - + em.getTransaction().begin(); ndge.setNdgName(null); if (flush) @@ -662,9 +662,9 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { ndge.setNdgName("Some name"); ndge = em.merge(ndge); em.getTransaction().commit(); - + try { - // Update the entity with null value and remove the entity. + // Update the entity with null value and remove the entity. // validation should not fail on pre-remove em.getTransaction().begin(); ndge.setNdgName(null); @@ -696,10 +696,10 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { /** * verify validation does not occur using the default validation group - * on the PreRemove lifecycle event. + * on the PreRemove lifecycle event. */ public void verifyDefaultPreRemove(boolean flush) { - OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) + OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory( "default-validation-group", "org/apache/openjpa/integration/validation/persistence.xml"); @@ -710,14 +710,14 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { assertNotNull(em); try { - // Add an entity + // Add an entity DefGrpEntity dge = new DefGrpEntity(); dge.setDgName("NonNullName"); em.getTransaction().begin(); em.persist(dge); em.getTransaction().commit(); try { - // Update the entity with null value and remove the entity. + // Update the entity with null value and remove the entity. // validation should not fail on pre-remove em.getTransaction().begin(); dge.setDgName(null); @@ -749,11 +749,11 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { /** * verify validation occurs when the default validation group - * is specified for the PreRemove lifecycle event via the + * is specified for the PreRemove lifecycle event via the * "javax.persistence.validation.group.pre-remove" property. */ public void verifySpecifiedDefaultPreRemove(boolean flush) { - OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) + OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory( "pre-remove-default-validation-group", "org/apache/openjpa/integration/validation/persistence.xml"); @@ -764,14 +764,14 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { assertNotNull(em); try { - // Add an entity + // Add an entity DefGrpEntity dge = new DefGrpEntity(); dge.setDgName("NonNullName"); em.getTransaction().begin(); em.persist(dge); em.getTransaction().commit(); try { - // Update the entity with null value and remove the entity. + // Update the entity with null value and remove the entity. // validation should not fail on pre-remove em.getTransaction().begin(); dge.setDgName(null); @@ -811,7 +811,7 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { if (vioProperties.length == 0 && cvs == null) return; assertEquals(vioProperties.length, cvs.size()); - Iterator> i = + Iterator> i = (Iterator>) cvs.iterator(); while (i.hasNext()) { ConstraintViolation v = (ConstraintViolation)i.next(); @@ -823,15 +823,15 @@ public class TestValidationGroups extends AbstractPersistenceTestCase { } } if (!found) { - fail("Unexpected ConstraintViolation for: " + + fail("Unexpected ConstraintViolation for: " + v.getPropertyPath()); } } } - + /** * Internal convenience method for getting the OpenJPA logger - * + * * @return Log */ private Log getLog(OpenJPAEntityManagerFactorySPI emf) { diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ValGroup1.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ValGroup1.java index 052253c79..501fb5a0d 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ValGroup1.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ValGroup1.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ValGroup2.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ValGroup2.java index 77a1a5fb1..be00ae70a 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ValGroup2.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ValGroup2.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLBase.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLBase.java index 048fb2065..e15f8487e 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLBase.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLBase.java @@ -14,26 +14,26 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; public class XMLBase extends XMLSuper { - - private int id; + + private int id; private String strValue; - + public void setId(int id) { this.id = id; } public int getId() { return id; } - + public void setStrValue(String strValue) { this.strValue = strValue; } public String getStrValue() { return strValue; - } + } } diff --git a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLSuper.java b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLSuper.java index e91f85996..d38e7c8b0 100644 --- a/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLSuper.java +++ b/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLSuper.java @@ -14,18 +14,18 @@ * "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. + * under the License. */ package org.apache.openjpa.integration.validation; public class XMLSuper { private String superStrValue; - + public void setSuperStrValue(String superStrValue) { this.superStrValue = superStrValue; } public String getSuperStrValue() { return superStrValue; - } + } } diff --git a/openjpa-integration/validation/src/test/resources/META-INF/ehn-persistence.xml b/openjpa-integration/validation/src/test/resources/META-INF/ehn-persistence.xml index 0fa5ea09b..498048312 100644 --- a/openjpa-integration/validation/src/test/resources/META-INF/ehn-persistence.xml +++ b/openjpa-integration/validation/src/test/resources/META-INF/ehn-persistence.xml @@ -7,15 +7,15 @@ 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. + under the License. --> - + org.apache.openjpa.integration.validation.SimpleEntity @@ -39,7 +39,7 @@ org.apache.openjpa.integration.validation.SimpleEntity NONE - + org.apache.openjpa.integration.validation.ConstraintBoolean NONE @@ -49,7 +49,7 @@ org.apache.openjpa.integration.validation.ConstraintBoolean CALLBACK - + org.apache.openjpa.integration.validation.ConstraintDecimal NONE @@ -59,7 +59,7 @@ org.apache.openjpa.integration.validation.ConstraintDecimal CALLBACK - + org.apache.openjpa.integration.validation.ConstraintNull NONE @@ -84,27 +84,27 @@ org.apache.openjpa.integration.validation.DefGrpEntity CALLBACK - - + - + org.apache.openjpa.integration.validation.DefGrpEntity CALLBACK - - + org.apache.openjpa.integration.validation.DefGrpEntity CALLBACK - @@ -115,7 +115,7 @@ org.apache.openjpa.integration.validation.DefGrpEntity CALLBACK - @@ -126,7 +126,7 @@ org.apache.openjpa.integration.validation.NonDefGrpEntity CALLBACK - @@ -141,7 +141,7 @@ org.apache.openjpa.integration.validation.MixedGrpEntity CALLBACK - @@ -151,7 +151,7 @@ org.apache.openjpa.integration.validation.MixedGrpEntity CALLBACK - org.apache.openjpa.integration.validation.ConstraintDates org.apache.openjpa.integration.validation.ConstraintPattern org.apache.openjpa.integration.validation.Person - org.apache.openjpa.integration.validation.Address + org.apache.openjpa.integration.validation.Address org.apache.openjpa.integration.validation.Book org.apache.openjpa.integration.validation.Publisher AUTO - - + - org.apache.openjpa.integration.validation.Book - org.apache.openjpa.integration.validation.Publisher + org.apache.openjpa.integration.validation.Book + org.apache.openjpa.integration.validation.Publisher AUTO - + - org.apache.openjpa.integration.validation.Book - org.apache.openjpa.integration.validation.Publisher + org.apache.openjpa.integration.validation.Book + org.apache.openjpa.integration.validation.Publisher NONE - - + + Make sure the mapping file and class listings match the same PU in META-INF/ehn-persistence.xml @@ -205,11 +205,11 @@ org.apache.openjpa.integration.validation.XMLSuper AUTO - - + diff --git a/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/validation-orm.xml b/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/validation-orm.xml index 213f477cd..c8ce9caa2 100644 --- a/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/validation-orm.xml +++ b/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/validation-orm.xml @@ -29,8 +29,8 @@ - @@ -38,5 +38,5 @@ - + diff --git a/openjpa-jdbc/pom.xml b/openjpa-jdbc/pom.xml index 0752a3652..a407ae488 100644 --- a/openjpa-jdbc/pom.xml +++ b/openjpa-jdbc/pom.xml @@ -7,18 +7,18 @@ 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. + under the License. --> - diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/MappingToolTask.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/MappingToolTask.java index ff7d02f32..59af52dd8 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/MappingToolTask.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/MappingToolTask.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.ant; @@ -66,7 +66,7 @@ public class MappingToolTask protected String sqlFile; protected String sqlEncode; protected boolean tmpClassLoader = true; - + /** * Set the enumerated MappingTool action type. */ @@ -178,7 +178,7 @@ public class MappingToolTask public void setSQLEncode(String sqlEncode) { this.sqlEncode = sqlEncode; } - + /** * Sets the characters used to terminate a generated SQL. * By default, a semicolon. @@ -215,7 +215,7 @@ public class MappingToolTask resolver.addClassLoader(loader); } resolver.addClassLoader(toolLoader); - + if (flags.meta && MappingTool.ACTION_ADD.equals(flags.action)) flags.metaDataFile = Files.getFile(file, loader); else @@ -226,7 +226,7 @@ public class MappingToolTask JDBCConfiguration conf = (JDBCConfiguration) getConfiguration(); conf.setClassResolver(resolver); - + if (!MappingTool.run(conf, files, flags, loader)) throw new BuildException(_loc.get("bad-conf", "MappingToolTask") .getMessage()); @@ -257,7 +257,7 @@ public class MappingToolTask * Set whether a temporary ClassLoader should be used by the MappingTool. * The default value is true *

    - * + * * @param tmpClassLoader * Whether the temporary ClassLoader should be used. */ diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/ReverseMappingToolTask.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/ReverseMappingToolTask.java index cbdad3000..34ed0be06 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/ReverseMappingToolTask.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/ReverseMappingToolTask.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.ant; @@ -104,7 +104,7 @@ public class ReverseMappingToolTask public void setUseSchemaName(boolean useSchemaName) { flags.useSchemaName = useSchemaName; } - + /** * Set whether to use the schema name in generated files */ @@ -139,7 +139,7 @@ public class ReverseMappingToolTask * relations instead of untyped collections. */ public void setUseGenericCollections(boolean useGenericCollections) { - flags.useGenericCollections = useGenericCollections; + flags.useGenericCollections = useGenericCollections; } /** @@ -236,7 +236,7 @@ public class ReverseMappingToolTask public void setAccessType(AccessType accessType) { flags.accessType = accessType.getValue(); } - + /** * Set a customizer class to use. */ diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/SchemaToolTask.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/SchemaToolTask.java index 64944a4f6..56af7308c 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/SchemaToolTask.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/SchemaToolTask.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.ant; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/package.html b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/package.html index 263f1ba2b..886ba7a5a 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/package.html +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/package.html @@ -6,15 +6,15 @@ 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. + under the License. --> diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/FetchModeValue.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/FetchModeValue.java index c0e62ce32..0965824bc 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/FetchModeValue.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/FetchModeValue.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.conf; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCConfiguration.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCConfiguration.java index 931af86c5..04ee41d32 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCConfiguration.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCConfiguration.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.conf; @@ -577,7 +577,7 @@ public interface JDBCConfiguration public MappingRepository getMappingRepositoryInstance(); /** - * Return a new empty mapping repository of the configured type. + * Return a new empty mapping repository of the configured type. * Convenience method to cast from metadata repository. */ public MappingRepository newMappingRepositoryInstance(); @@ -610,7 +610,7 @@ public interface JDBCConfiguration * @see #getDataSource */ public DataSource getDataSource2(StoreContext ctx); - + /** * Gets the String constant that matches the {@link IdentifierUtil} * @return String-based name of the {@link IdentifierUtil} @@ -622,7 +622,7 @@ public interface JDBCConfiguration * @return DBIdentifierUtil */ public DBIdentifierUtil getIdentifierUtilInstance(); - + /** * Sets the {@link DBIdentifierUtil} * @param util instance of the identifier utility diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCConfigurationImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCConfigurationImpl.java index 581d6feb2..c27e48529 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCConfigurationImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCConfigurationImpl.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.conf; @@ -93,7 +93,7 @@ public class JDBCConfigurationImpl private String firstPass = null; private DecoratingDataSource dataSource = null; private DecoratingDataSource dataSource2 = null; - + private static final Localizer _loc = Localizer.forPackage(JDBCConfigurationImpl.class); /** @@ -314,7 +314,7 @@ public class JDBCConfigurationImpl seqPlugin.setAliases(JDBCSeqValue.ALIASES); seqPlugin.setDefault(JDBCSeqValue.ALIASES[0]); seqPlugin.setString(JDBCSeqValue.ALIASES[0]); - + // This plug-in is declared in superclass but defined here // because PreparedQueryCache is currently available for JDBC // backend only @@ -344,14 +344,14 @@ public class JDBCConfigurationImpl finderCachePlugin.setInstantiatingGetter("getFinderCacheInstance"); identifierUtilPlugin = addPlugin("jdbc.IdentifierUtil", true); - aliases = new String[] { + aliases = new String[] { "default", "org.apache.openjpa.jdbc.identifier.DBIdentifierUtilImpl" }; identifierUtilPlugin.setAliases(aliases); identifierUtilPlugin.setDefault(aliases[0]); identifierUtilPlugin.setString(aliases[0]); identifierUtilPlugin.setInstantiatingGetter("getIdentifierUtilInstance"); - + // this static initializer is to get past a weird // ClassCircularityError that happens only under IBM's // JDK 1.3.1 on Linux from within the JRun ClassLoader; @@ -359,9 +359,9 @@ public class JDBCConfigurationImpl // a bug in JRun, and we can get around it by forcing // Instruction.class to be loaded and initialized // before TypedInstruction.class - try { serp.bytecode.lowlevel.Entry.class.getName(); } + try { serp.bytecode.lowlevel.Entry.class.getName(); } catch (Throwable t) {} - try { serp.bytecode.Instruction.class.getName(); } + try { serp.bytecode.Instruction.class.getName(); } catch (Throwable t) {} supportedOptions().add(OPTION_QUERY_SQL); @@ -783,18 +783,18 @@ public class JDBCConfigurationImpl Object obj = super.getConnectionFactory2(); DataSource ds = null; if (obj != null) { - if (obj instanceof DataSource) + if (obj instanceof DataSource) ds = (DataSource) obj; else { Log log = getLog(LOG_JDBC); if (log.isTraceEnabled()) { Localizer loc = Localizer.forPackage(JDBCConfigurationImpl.class); - log.trace(loc.get("unknown-datasource", getConnectionFactory2Name(), + log.trace(loc.get("unknown-datasource", getConnectionFactory2Name(), obj.getClass().getName())); } } } - + if (ds == null) { // the driver name is always required, so if not specified, // then no connection factory 2 @@ -839,7 +839,7 @@ public class JDBCConfigurationImpl return setupConnectionFactory(ds, false); } - + if (log.isTraceEnabled()) log.trace("createConnectionFactory: connectionFactory not created yet, attempt JNDI lookup..."); @@ -856,31 +856,31 @@ public class JDBCConfigurationImpl return setupConnectionFactory(ds, false); } - public DataSource getDataSource(StoreContext ctx) { + public DataSource getDataSource(StoreContext ctx) { Log log = getLog(LOG_RUNTIME); DataSource ds = null; - + if(ctx != null && StringUtil.isNotEmpty(ctx.getConnectionFactoryName())) { - ds = getDataSource(ctx, (DataSource) ctx.getConnectionFactory()); + ds = getDataSource(ctx, (DataSource) ctx.getConnectionFactory()); // fail fast if a cfName has been provided, but was not available in JNDI if (ds == null) { throw new UserException(_loc.get("invalid-datasource", ctx.getConnectionFactoryName())).setFatal(true); } - if(! (ds instanceof DecoratingDataSource)) { + if(! (ds instanceof DecoratingDataSource)) { ds = DataSourceFactory.decorateDataSource(ds, this, false); } if (log.isTraceEnabled()) { log.trace("Found datasource1: " + ds + " from StoreContext using jndiName: " + ctx.getConnectionFactory2Name()); } - return ds; + return ds; } else { ds = getDataSource(ctx, (DataSource) getConnectionFactory()); if (log.isTraceEnabled()) { log.trace("Found datasource1: " + ds + " from configuration. StoreContext: " + ctx ); } - return ds; + return ds; } } @@ -892,10 +892,10 @@ public class JDBCConfigurationImpl if (ctx != null && StringUtil.isNotEmpty(ctx.getConnectionFactory2Name())) { ds = (DataSource) ctx.getConnectionFactory2(); if (ds == null) { - // fail fast. If the non-jta-data-source is configured on the context we want an immediate error. + // fail fast. If the non-jta-data-source is configured on the context we want an immediate error. throw new UserException(_loc.get("invalid-datasource", ctx.getConnectionFactory2Name())).setFatal(true); } - if(! (ds instanceof DecoratingDataSource)) { + if(! (ds instanceof DecoratingDataSource)) { ds = DataSourceFactory.decorateDataSource(ds, this, false); } if (log.isTraceEnabled()) { @@ -906,16 +906,16 @@ public class JDBCConfigurationImpl } // If not set on context or value from context is not available try cf2 from config - else{ + else{ ds = (DataSource) getConnectionFactory2(); if (log.isTraceEnabled()) { log.trace("Found datasource 2: "+ ds + " from config. StoreContext: " + ctx); } } - + // fallback to cf1 / datasource1 if (ds == null) { - if(log.isTraceEnabled()) { + if(log.isTraceEnabled()) { log.trace("Trying datasource1"); } return getDataSource(ctx); @@ -986,10 +986,10 @@ public class JDBCConfigurationImpl String[] prefixes = ProductDerivations.getConfigurationPrefixes(); for (int i = 0; i < prefixes.length; i++) if (propName.toLowerCase(Locale.ENGLISH).startsWith(prefixes[i] + ".jdbc")) - return true; + return true; return false; } - + public String getIdentifierUtil() { return identifierUtilPlugin.getString(); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCProductDerivation.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCProductDerivation.java index 571b66567..0a135fe78 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCProductDerivation.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCProductDerivation.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.conf; @@ -38,8 +38,8 @@ import org.apache.openjpa.lib.conf.ConfigurationProvider; public class JDBCProductDerivation extends AbstractProductDerivation implements OpenJPAProductDerivation { - public static final String PREFIX = "openjpa.jdbc"; - + public static final String PREFIX = "openjpa.jdbc"; + public void putBrokerFactoryAliases(Map m) { m.put("jdbc", JDBCBrokerFactory.class.getName()); } @@ -56,7 +56,7 @@ public class JDBCProductDerivation extends AbstractProductDerivation } return false; } - + /** * Hint keys correspond to some (not all) bean-style mutable property name in JDBCFetchConfiguration. * The fully qualified key is prefixed with openjpa.jdbc. @@ -70,11 +70,11 @@ public class JDBCProductDerivation extends AbstractProductDerivation _hints.add(PREFIX + ".LRSSize"); _hints.add(PREFIX + ".ResultSetType"); _hints.add(PREFIX + ".SubclassFetchMode"); - + _hints.add(MariaDBDictionary.SELECT_HINT); _hints.add(MySQLDictionary.SELECT_HINT); _hints.add(OracleDictionary.SELECT_HINT); - + _hints = Collections.unmodifiableSet(_hints); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCSeqValue.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCSeqValue.java index b2c08ea7e..7a8110947 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCSeqValue.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCSeqValue.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.conf; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/MappingFactoryValue.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/MappingFactoryValue.java index 3c19ef67f..e638b4dd5 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/MappingFactoryValue.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/MappingFactoryValue.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.conf; @@ -156,7 +156,7 @@ public class MappingFactoryValue // if no mapping setting, return meta factory alone, assuming it handles // both metadata and mapping MetaDataFactory ret = null; - if(map == null ) { + if(map == null ) { ret = meta; } else { @@ -167,8 +167,8 @@ public class MappingFactoryValue ret = new MetaDataPlusMappingFactory(meta, map); } } - - return ret; - + + return ret; + } } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/MappingRepositoryValue.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/MappingRepositoryValue.java index d857cbff3..e1dd327ec 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/MappingRepositoryValue.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/MappingRepositoryValue.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.conf; @@ -47,7 +47,7 @@ public class MappingRepositoryValue try { Class cls = ClassUtil.toClass(clsName, AccessController.doPrivileged( - J2DoPrivHelper.getClassLoaderAction(type))); + J2DoPrivHelper.getClassLoaderAction(type))); return cls.getConstructor(new Class[]{ JDBCConfiguration.class }). newInstance(new Object[]{ conf }); } catch (RuntimeException e) { diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/package.html b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/package.html index 5e869b739..25650433a 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/package.html +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/package.html @@ -6,15 +6,15 @@ 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. + under the License. --> diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/ColumnDefIdentifierRule.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/ColumnDefIdentifierRule.java index 1a7201dca..63cae5504 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/ColumnDefIdentifierRule.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/ColumnDefIdentifierRule.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.identifier; @@ -22,7 +22,7 @@ import org.apache.openjpa.jdbc.identifier.DBIdentifier.DBIdentifierType; /** * Default rule for column definition. This rule disables delimiting of - * column definitions. Column definitions can be extremely tricky to + * column definitions. Column definitions can be extremely tricky to * delimit correctly. Blindly delimiting them causes failures on most * databases. Where user defined types are concerned, generally they don't * need to be delimited and if so, they are more appropriately delimited diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifier.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifier.java index b6cb60239..bdb83471e 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifier.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifier.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.identifier; @@ -25,8 +25,8 @@ import org.apache.openjpa.lib.identifier.Identifier; import org.apache.openjpa.lib.identifier.IdentifierImpl; /** - * Encapsulates a database identifier. With a few exceptions, this class is - * intended to treated as immutable. + * Encapsulates a database identifier. With a few exceptions, this class is + * intended to treated as immutable. */ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifier, Serializable { @@ -49,12 +49,12 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie PROCEDURE, NULL } - + // Array for quick compound identifier determination. Compound identifiers // can have multi-part names, such as {schema, table} and should be stored // as a QualifiedDBIdentifier. private static boolean _compoundIdentifier[] = new boolean[DBIdentifierType.values().length]; - + static { _compoundIdentifier[DBIdentifierType.TABLE.ordinal()] = true; _compoundIdentifier[DBIdentifierType.COLUMN.ordinal()] = true; @@ -62,16 +62,16 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie _compoundIdentifier[DBIdentifierType.CONSTRAINT.ordinal()] = true; _compoundIdentifier[DBIdentifierType.INDEX.ordinal()] = true; } - + private DBIdentifierType _type = DBIdentifierType.DEFAULT; - + /** * Special NULL indicator for db identifiers. */ public static final DBIdentifier NULL = new DBIdentifier(DBIdentifierType.NULL); - + public boolean _ignoreCase = false; - + // All constructors are protected or private. Static factory operations // should be used to construct new identifiers. protected DBIdentifier() { @@ -83,7 +83,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie public boolean getIgnoreCase() { return _ignoreCase; } - + public void setIgnoreCase(boolean ignoreCase) { _ignoreCase = ignoreCase; } @@ -101,7 +101,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie setType(type); setName(name, delimit); } - + protected DBIdentifier(String name, boolean delimit) { setName(name, delimit); } @@ -129,11 +129,11 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie } /** - * Set the name of the identifier and optionally force delimiting of the identifier. + * Set the name of the identifier and optionally force delimiting of the identifier. */ public void setName(String name, boolean delimit) { assertNotNull(); - + // Normalize the name, if necessary. Do not normalize constants or column definitions. if (DBIdentifierType.CONSTANT != getType() && DBIdentifierType.COLUMN_DEFINITION != getType()) { if (delimit) { @@ -144,7 +144,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie } super.setName(name); } - + /** * Set the type of the identifier * @param type @@ -160,7 +160,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie public DBIdentifierType getType() { return _type; } - + /** * Splits a string delimited by the specified delimiter of a given name type @@ -171,11 +171,11 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie * @param delim */ public static DBIdentifier[] split(String name, DBIdentifierType id, String delim) { - + if (!Normalizer.canSplit(name, delim)) { return new DBIdentifier[] { new DBIdentifier(name, id) }; } - + String[] names = Normalizer.splitName(name, delim); if (names.length == 0) { return new DBIdentifier[] { }; @@ -186,7 +186,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie } return sNames; } - + /** * Joins the list of identifiers using the appropriate delimiters and * returns a string based identifier. @@ -204,13 +204,13 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie return Normalizer.joinNames(strNames); } /** - * Splits a given DBIdentifier into multiple DBIdentifiers. Uses the base name + * Splits a given DBIdentifier into multiple DBIdentifiers. Uses the base name * type and heuristics to determine the types and placement of the resulting * components. * @param name */ public static DBIdentifier[] split(DBIdentifierType resultType, String name) { - + String[] names = Normalizer.splitName(name); switch (names.length) { case 2: @@ -303,7 +303,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie return StringUtil.isEmpty(name.getName()); } - + /** * Returns true if the identifier is null. * @param name @@ -322,9 +322,9 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie sName.setIgnoreCase(getIgnoreCase()); return sName; } - + /* - * Internal method to set the base name and avoid normalizing an already + * Internal method to set the base name and avoid normalizing an already * normalized name. * @param name */ @@ -333,7 +333,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie } /* - * Internal method to get the base name. + * Internal method to get the base name. * normalized name. * @param name */ @@ -396,10 +396,10 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie } return super.compareTo(o); } - + /** - * Converts the provided set of names to an array of identifiers of the + * Converts the provided set of names to an array of identifiers of the * provided type * @param columnNames * @param id @@ -409,7 +409,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie } /** - * Converts the provided set of names to an array of identifiers of the + * Converts the provided set of names to an array of identifiers of the * provided type, optionally delimiting the names. * @param columnNames * @param id @@ -424,7 +424,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie } return sNames; } - + /** * Returns a string array of names based upon the provided set of identifiers. * @param sNames @@ -454,7 +454,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie public static DBIdentifier newCatalog(String name, boolean delimit) { return newIdentifier(name, DBIdentifierType.CATALOG, false, delimit); } - + /** * Constructs a new identifier of type Table. */ @@ -469,7 +469,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie public static DBIdentifier newTable(String name, boolean delimit) { return newIdentifier(name, DBIdentifierType.TABLE, false, delimit); } - + /** * Constructs a new identifier of type Column. */ @@ -597,7 +597,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie } /** - * Constructs a new identifier (potentially a compound QualifiedDBIdentifier) with the provided + * Constructs a new identifier (potentially a compound QualifiedDBIdentifier) with the provided * name an type. Optionally, converting the name to upper case and delimiting it. */ protected static DBIdentifier newIdentifier(String name, DBIdentifierType id, boolean toUpper, boolean delimit) { @@ -609,7 +609,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie } /** - * Constructs a new identifier (potentially a compound QualifiedDBIdentifier) with the provided + * Constructs a new identifier (potentially a compound QualifiedDBIdentifier) with the provided * name an type. Optionally, converting the name to upper case and delimiting it. */ protected static DBIdentifier newIdentifier(String name, DBIdentifierType id, boolean toUpper, boolean delimit, @@ -617,7 +617,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie if (name == null) { return DBIdentifier.NULL; } - + DBIdentifier dbId = DBIdentifier.NULL; // Create a DBIDentifier for single component names. Otherwise, create a QualifiedDBIdentifier. if (!_compoundIdentifier[id.ordinal()] || delimit) { @@ -651,13 +651,13 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie return ((DBIdentifier)name1).equals(name2, false); } - + private void assertNotNull() { if (this == DBIdentifier.NULL || getType() == DBIdentifierType.NULL) { throw new IllegalStateException("Cannot modify NULL instance"); } } - + /** * Returns a new DBIdentifier truncated to length * @param name @@ -688,7 +688,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie } /** - * Returns a new DBIdentifier with the given string combined using + * Returns a new DBIdentifier with the given string combined using * delimiting rules and appropriate separators. * @param name * @param length @@ -708,7 +708,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie public static DBIdentifier toLower(DBIdentifier name) { return toLower(name, false); } - + /** * Returns a new DBIdentifier converted to lower case. If delimited, * force to lower case using force option. @@ -776,7 +776,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie sName.setNameInternal(strName); return sName; } - + /** * Returns a new DBIdentifier with Hungarian notation removed. * @param name diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifierRule.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifierRule.java index 1a49fcb23..514e552c1 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifierRule.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifierRule.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.identifier; @@ -27,11 +27,11 @@ import org.apache.openjpa.lib.identifier.IdentifierRule; * The default DBIdentifier rule. Closely matches SQL92 naming rules. */ public class DBIdentifierRule extends IdentifierRule { - + public static final String DEFAULT_SQL_92 = "DefaultSQL92"; - + public static final String SPECIAL_CHARS = " #$&%!?,.:;\"\'"; - + public DBIdentifierRule() { setName(DEFAULT_SQL_92); // SQL92 Identifier rule 1) Can be up to 128 characters long @@ -42,7 +42,7 @@ public class DBIdentifierRule extends IdentifierRule { setMustBeginWithLetter(true); // SQL92 Identifier rule 3) Can contain letters, digits, and underscores setOnlyLettersDigitsUnderscores(true); - // SQL Identifier rule 4) Can't contain spaces or special characters such + // SQL Identifier rule 4) Can't contain spaces or special characters such // as #, $, &, %, or punctuation. setSpecialCharacters(SPECIAL_CHARS); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifierUtil.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifierUtil.java index 4ebe9ff88..05ed8dfe7 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifierUtil.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifierUtil.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.identifier; @@ -43,11 +43,11 @@ public interface DBIdentifierUtil extends IdentifierUtil { * Shortens the given name to the given maximum length, then checks that * it is not a reserved word. If it is reserved, appends a "0". If * the name conflicts with an existing schema component and uniqueness - * checking is enabled, the last character is replace with '0', then - * '1', etc. - * Note that the given max len may be 0 if the database metadata is + * checking is enabled, the last character is replace with '0', then + * '1', etc. + * Note that the given max len may be 0 if the database metadata is * incomplete. - * + * * Note: If the name is delimited, make sure the ending delimiter is * not stripped off. */ @@ -58,11 +58,11 @@ public interface DBIdentifierUtil extends IdentifierUtil { * Shortens the given name to the given maximum length, then checks that * it is not a reserved word. If it is reserved, appends a "0". If * the name conflicts with an existing schema component and uniqueness - * checking is enabled, the last character is replace with '0', then - * '1', etc. - * Note that the given max len may be 0 if the database metadata is + * checking is enabled, the last character is replace with '0', then + * '1', etc. + * Note that the given max len may be 0 if the database metadata is * incomplete. - * + * * Note: If the name is delimited, make sure the ending delimiter is * not stripped off. */ @@ -77,9 +77,9 @@ public interface DBIdentifierUtil extends IdentifierUtil { * @param maxLen * @param checkForUniqueness */ - public DBIdentifier getValidColumnIdentifier(DBIdentifier name, Table table, int maxLen, + public DBIdentifier getValidColumnIdentifier(DBIdentifier name, Table table, int maxLen, boolean checkForUniqueness); - + /** * Returns a valid index identifier, based upon the configuration and * provided parameters. @@ -99,7 +99,7 @@ public interface DBIdentifierUtil extends IdentifierUtil { * @param checkForUniqueness */ public DBIdentifier getValidSequenceIdentifier(DBIdentifier name, Schema schema, int maxLen); - + /** * Returns a valid table identifier, based upon the configuration and provided * parameters. @@ -135,7 +135,7 @@ public interface DBIdentifierUtil extends IdentifierUtil { public String toDBName(DBIdentifier name); /** - * Converts the specified identifier to a format required by the database, + * Converts the specified identifier to a format required by the database, * optionally delimiting the name. * @param name * @param delimit diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifierUtilImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifierUtilImpl.java index a4f4183f0..c1d57ac3f 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifierUtilImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifierUtilImpl.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.identifier; @@ -36,16 +36,16 @@ import org.apache.openjpa.lib.identifier.IdentifierUtilImpl; public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdentifierUtil, Configurable { - + private JDBCConfiguration _conf = null; public DBIdentifierUtilImpl() { } - + public DBIdentifierUtilImpl(IdentifierConfiguration config) { super(config); } - + public DBIdentifier getValidColumnIdentifier(DBIdentifier name, Table table, int maxLen, boolean checkForUniqueness) { if (DBIdentifier.isNull(name)) { @@ -57,7 +57,7 @@ public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdenti DBIdentifier sName = DBIdentifier.removeLeading(name, IdentifierUtil.UNDERSCORE); return makeIdentifierValid(sName, table, maxLen, checkForUniqueness); } - + public DBIdentifier getValidForeignKeyIdentifier(DBIdentifier name, Table table, Table toTable, int maxLen) { if (DBIdentifier.isNull(name)) { return name; @@ -70,7 +70,7 @@ public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdenti maxLen, true); } - + public DBIdentifier getValidUniqueIdentifier(DBIdentifier name, Table table, int maxLen) { if (DBIdentifier.isNull(name)) { return name; @@ -114,7 +114,7 @@ public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdenti maxLen = getMaxLen(rule, name, maxLen); DBIdentifier sName = makeName(rule, name, null); - + return makeIdentifierValid(sName, schema.getSchemaGroup(), maxLen, true); } @@ -140,7 +140,7 @@ public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdenti boolean checkForUniqueness) { DBIdentifier validName = sname; String rule = sname.getType().name(); - + maxLen = getMaxLen(rule, validName, maxLen); int nameLen = validName.getName().length(); @@ -181,11 +181,11 @@ public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdenti if (nameLen + chars > maxLen) { validName = DBIdentifier.truncate(validName, nameLen + chars - maxLen); } - validName = DBIdentifier.append(validName, Integer.toString(version)); + validName = DBIdentifier.append(validName, Integer.toString(version)); nameLen = validName.getName().length(); } } - + if (validName.isDelimited()) { String delimCase = getIdentifierConfiguration().getDelimitedCase(); if (delimCase.equals(CASE_LOWER)) { @@ -203,25 +203,25 @@ public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdenti /** * Converts the name to a name which can be used within a SQL statement. Uses - * the appropriate delimiters and separators. + * the appropriate delimiters and separators. * @parm name a DBIdentifier */ public String toDBName(DBIdentifier name) { return toDBName(name, true); } - + /** * Converts the name to a name which can be used within a SQL statement. Uses - * the appropriate delimiters and separators. + * the appropriate delimiters and separators. * @parm name a DBIdentifier - * @param delimit If true, allows the name to be delimited, if necessary. + * @param delimit If true, allows the name to be delimited, if necessary. * Otherwise, the identifier is not delimited. */ public String toDBName(DBIdentifier name, boolean delimit) { if (DBIdentifier.isNull(name)) { return null; } - if (getIdentifierConfiguration().getSupportsDelimitedIdentifiers() && delimit + if (getIdentifierConfiguration().getSupportsDelimitedIdentifiers() && delimit && getIdentifierConfiguration().delimitAll() && !name.isDelimited()) { return delimit(name, true); } @@ -259,7 +259,7 @@ public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdenti if (name == null) { return null; } - if (getIdentifierConfiguration().getSupportsDelimitedIdentifiers() && delimit && + if (getIdentifierConfiguration().getSupportsDelimitedIdentifiers() && delimit && getIdentifierConfiguration().delimitAll() && !Normalizer.isDelimited(name)) { return delimit(rule, name, true); } @@ -268,7 +268,7 @@ public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdenti /** * Creates a new identifier of a given type based upon the name returned - * from the database. + * from the database. */ public DBIdentifier fromDBName(String name, DBIdentifierType id) { if (name == null) { @@ -280,14 +280,14 @@ public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdenti String delimCase = getIdentifierConfiguration().getDelimitedCase(); String nonDelimCase = getIdentifierConfiguration().getSchemaCase(); String caseName = name; - - // If delimited and non-delimited case are the same, don't change + + // If delimited and non-delimited case are the same, don't change // case or try to determine whether delimiting is required. Let the // normalizer figure it out using standard rules. if (delimCase.equals(nonDelimCase)) { return DBIdentifier.newIdentifier(name, id, false, false, !delimCase.equals(CASE_PRESERVE)); } - + // Otherwise, try to determine whether to delimit based on an expected vs. // actual name comparison. if (delimCase.equals(CASE_PRESERVE)) { @@ -305,9 +305,9 @@ public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdenti caseName = name.toLowerCase(); } } - + boolean delimit = !caseName.equals(name) || getIdentifierConfiguration().delimitAll(); - return DBIdentifier.newIdentifier((delimit ? name : caseName), id, false, delimit, + return DBIdentifier.newIdentifier((delimit ? name : caseName), id, false, delimit, !delimCase.equals(CASE_PRESERVE)); } @@ -321,7 +321,7 @@ public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdenti } return sName; } - + public String appendColumns(Column[] columns) { if (columns == null || columns.length == 0) { return ""; @@ -338,7 +338,7 @@ public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdenti } return colsb.toString(); } - + public String delimit(DBIdentifier name, boolean force) { String rule = name.getType().name(); // If this is a compound path, each item must be delimited @@ -364,11 +364,11 @@ public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdenti } return delimit(rule, name.getName(), force); } - + public String shorten(String name, int targetLength) { return DBDictionary.shorten(name, targetLength); } - + public DBIdentifier getGeneratedKeySequenceName(Column col, int maxLen) { DBIdentifier tname = col.getTableIdentifier(); DBIdentifier cname = col.getIdentifier(); @@ -382,7 +382,7 @@ public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdenti } return DBIdentifier.combine(DBIdentifierType.SEQUENCE, tsname, cname.getName(), "SEQ"); } - + /** * Convert the specified schema name to a name that the database will * be able to understand in metadata operations. @@ -401,7 +401,7 @@ public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdenti else if (CASE_LOWER.equals(delimCase)) { sName = DBIdentifier.toLower(sName,true); } - + return DBIdentifier.removeDelimiters(sName); } if (!getIdentifierConfiguration().delimitAll()) { @@ -415,7 +415,7 @@ public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdenti } return sName; } - + /** * Converts a column alias to use the appropriate delimiters */ @@ -440,10 +440,10 @@ public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdenti DBIdentifier sName = DBIdentifier.removeLeading(name, IdentifierUtil.UNDERSCORE); String tableName = tbl.getIdentifier().getName(); int len = Math.min(tableName.length(), 7); - - // Combine the names using the normalized configuration. - String str = combineNames(Normalizer.getNamingConfiguration(), rule, - new String[] { prefix == null ? "" : prefix, + + // Combine the names using the normalized configuration. + String str = combineNames(Normalizer.getNamingConfiguration(), rule, + new String[] { prefix == null ? "" : prefix, shorten(tableName, len), sName.getName() }); sName.setName(str); return sName; @@ -467,10 +467,10 @@ public class DBIdentifierUtilImpl extends IdentifierUtilImpl implements DBIdenti if (config.delimitAll() || name.isDelimited()) { maxLen = maxLen - (config.getLeadingDelimiter().length() + config.getTrailingDelimiter().length()); } - + return maxLen; } - + /** * System configuration. */ diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DefaultIdentifierConfiguration.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DefaultIdentifierConfiguration.java index 3c6a76880..720c36f89 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DefaultIdentifierConfiguration.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DefaultIdentifierConfiguration.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.identifier; @@ -34,7 +34,7 @@ public class DefaultIdentifierConfiguration implements IdentifierConfiguration { public DefaultIdentifierConfiguration() { normalizingRules.put(IdentifierRule.DEFAULT_RULE, normalizingRule); } - + public boolean delimitAll() { return false; } @@ -79,7 +79,7 @@ public class DefaultIdentifierConfiguration implements IdentifierConfiguration { public boolean getSupportsDelimitedIdentifiers() { return true; } - + public String getConversionKey() { return conversionKey; } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/Normalizer.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/Normalizer.java index 6545744bd..1f0adc20e 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/Normalizer.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/Normalizer.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.identifier; @@ -26,15 +26,15 @@ import org.apache.openjpa.lib.identifier.IdentifierRule; import org.apache.openjpa.lib.identifier.IdentifierUtil; /** - * Static utility class used for operating on string based identifiers. + * Static utility class used for operating on string based identifiers. */ public class Normalizer { - private static IdentifierUtil normalizer = + private static IdentifierUtil normalizer = new DBIdentifierUtilImpl(new DefaultIdentifierConfiguration()); - + private static IdentifierRule defaultRule; - + static { defaultRule = normalizer.getIdentifierConfiguration().getDefaultIdentifierRule(); } @@ -42,7 +42,7 @@ public class Normalizer { public static IdentifierConfiguration getNamingConfiguration() { return normalizer.getIdentifierConfiguration(); } - + /** * Normalizes a multi-part name * @param name @@ -69,7 +69,7 @@ public class Normalizer { } return name; } - + /** * Returns true if the name is delimited with default delimiters * @param name @@ -80,7 +80,7 @@ public class Normalizer { } return normalizer.isDelimited(defaultRule, name); } - + /** * Splits names into individual components and compares individually * for equality @@ -114,7 +114,7 @@ public class Normalizer { /** * Compares two string names for equality. If delimited, does a - * case comparison. If not delimited, does a case insensitive + * case comparison. If not delimited, does a case insensitive * comparison. * @param name1 * @param name2 @@ -148,7 +148,7 @@ public class Normalizer { } return nName; } - + /** * Splits a name into normalized components * @param name @@ -156,8 +156,8 @@ public class Normalizer { public static String[] splitName(String name) { return normalizer.splitName(defaultRule, name); } - - + + /** * Splits a name into normalized components using the specified * name delimiter (ex. schema:table, delim = : --> { schema, table } @@ -182,7 +182,7 @@ public class Normalizer { public static String joinNames(String[] names, String delimiter) { return normalizer.joinNames(defaultRule, names, delimiter); } - + /** * Joins two names using the default identifier rules. * @param names @@ -190,7 +190,7 @@ public class Normalizer { public static String joinNames(String name1, String name2) { return joinNames(new String[] { name1, name2}); } - + /** * Truncates a name to the specified length while maintaining @@ -232,7 +232,7 @@ public class Normalizer { return normalizer.combineNames(defaultRule, names); } - + /** * Appends one string to another using default identifier rules. * @param name1 @@ -241,7 +241,7 @@ public class Normalizer { public static String append(String name1, String name2) { return normalizer.appendNames(defaultRule, name1, name2); } - + /** * Removes Hungarian notation from a string. * @param name1 diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/QualifiedDBIdentifier.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/QualifiedDBIdentifier.java index 370f0049f..1834059f0 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/QualifiedDBIdentifier.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/QualifiedDBIdentifier.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.identifier; @@ -31,16 +31,16 @@ import org.apache.openjpa.lib.identifier.Identifier; * */ public class QualifiedDBIdentifier extends DBIdentifier implements Identifier, Cloneable, Serializable { - + private DBIdentifier _schemaName = DBIdentifier.NULL; // The schema name // The table name if the object (column, constraint) is qualified by a table name - private DBIdentifier _objectTableName = DBIdentifier.NULL; - - + private DBIdentifier _objectTableName = DBIdentifier.NULL; + + protected QualifiedDBIdentifier(DBIdentifier... sNames) { setPath(sNames); } - + /** * Creates a qualified identifier based upon an array of DBIdentifiers. Identifiers * must be specified in order. @@ -49,7 +49,7 @@ public class QualifiedDBIdentifier extends DBIdentifier implements Identifier, C public static QualifiedDBIdentifier newPath(DBIdentifier...names) { return new QualifiedDBIdentifier(names); } - + /** * Set the identifiers that make up the path. Identifiers must be specified * in path order. (ex. [ table, column ] ) @@ -60,7 +60,7 @@ public class QualifiedDBIdentifier extends DBIdentifier implements Identifier, C if (sNames == null || sNames.length == 0) { return; } - + if (sNames.length == 1) { DBIdentifier sName = sNames[0]; if (sName.getType() == DBIdentifierType.SCHEMA) { @@ -86,9 +86,9 @@ public class QualifiedDBIdentifier extends DBIdentifier implements Identifier, C setObjectTableName(sName.clone()); } } - } + } } - + // Reset the path names private void resetNames() { _schemaName = DBIdentifier.NULL; @@ -103,7 +103,7 @@ public class QualifiedDBIdentifier extends DBIdentifier implements Identifier, C if (sName instanceof QualifiedDBIdentifier && sName.getType() != DBIdentifierType.SCHEMA) { QualifiedDBIdentifier path = (QualifiedDBIdentifier)sName; List names = new ArrayList(); - + if (!DBIdentifier.isNull(path.getSchemaName())) { names.add(path.getSchemaName().clone()); } @@ -154,7 +154,7 @@ public class QualifiedDBIdentifier extends DBIdentifier implements Identifier, C _objectTableName = objectName; } - + /** * Gets the object table name component of the path, if the path * is a table qualified identifier such as a constraint or column. @@ -171,7 +171,7 @@ public class QualifiedDBIdentifier extends DBIdentifier implements Identifier, C } /** - * Returns true if this object is not qualified by a table or schema + * Returns true if this object is not qualified by a table or schema * component. */ public boolean isUnqualifiedColumn() { @@ -190,7 +190,7 @@ public class QualifiedDBIdentifier extends DBIdentifier implements Identifier, C return DBIdentifier.equal(sPath.getSchemaName(), getSchemaName()) && DBIdentifier.equal(sPath.getObjectTableName(), getObjectTableName()) && DBIdentifier.equal(sPath, this); - + } else if (obj instanceof DBIdentifier) { DBIdentifier sName = (DBIdentifier)obj; @@ -200,7 +200,7 @@ public class QualifiedDBIdentifier extends DBIdentifier implements Identifier, C } throw new IllegalArgumentException("Cannot compare to type: " + obj.getClass().getName()); } - + /** * Compares two qualified identifiers for equality. * @param path1 @@ -244,9 +244,9 @@ public class QualifiedDBIdentifier extends DBIdentifier implements Identifier, C DBIdentifier[] names = QualifiedDBIdentifier.splitPath(this); return DBIdentifier.join(names); } - + /** - * Returns the base name of this qualified name. For example, if the + * Returns the base name of this qualified name. For example, if the * qualified name is a schema qualified table, the table name is returned. */ public String getBaseName() { @@ -259,7 +259,7 @@ public class QualifiedDBIdentifier extends DBIdentifier implements Identifier, C public DBIdentifier getIdentifier() { return this; } - + /** * Set the name of this qualified identifier. Splits the string into * multiple components. This method assumes the type does not change. @@ -301,7 +301,7 @@ public class QualifiedDBIdentifier extends DBIdentifier implements Identifier, C } return getName().compareTo(o.getName()); } - + /** * Returns true if all identifiers within this compound identifier are * delimited. Otherwise, false. @@ -323,7 +323,7 @@ public class QualifiedDBIdentifier extends DBIdentifier implements Identifier, C } return super.isDelimited(); } - + /** * Returns a new unqualified name based on this instance. */ @@ -334,7 +334,7 @@ public class QualifiedDBIdentifier extends DBIdentifier implements Identifier, C newName.setSchemaName(DBIdentifier.NULL); return newName; } - + /** * Creates a clone of this identifier. */ diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSavepointManager.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSavepointManager.java index 847419712..05dc4648a 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSavepointManager.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSavepointManager.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java index 5c244f7c5..0be426547 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -110,7 +110,7 @@ public abstract class AbstractJDBCSeq protected abstract Object nextInternal(JDBCStore store, ClassMapping mapping) throws Exception; - + /** * Return the {@link JDBCConfiguration} for this sequence. */ @@ -144,13 +144,13 @@ public abstract class AbstractJDBCSeq /** *

    Return the connection to use based on the type of sequence. This * connection will automatically be closed; do not close it.

    - * - * @return If the sequence type is TYPE_TRANSACTIONAL or + * + * @return If the sequence type is TYPE_TRANSACTIONAL or * TYPE_CONTIGUOUS the connection from the {@link StoreManager} - * will be returned. - * + * will be returned. + * *

    Otherwise a new connection will be obtained using DataSource2 from the - * current configuration. In this case autocommit is set to false prior to + * current configuration. In this case autocommit is set to false prior to * returning the connection.

    */ protected Connection getConnection(JDBCStore store) @@ -173,19 +173,19 @@ public abstract class AbstractJDBCSeq * Close the current connection. If the sequence is * TYPE_TRANSACTIONAL or TYPE_CONTIGUOUS * we will decrement the ref count. Otherwise the connection will be - * committed and then closed. + * committed and then closed. */ protected void closeConnection(Connection conn) { if (conn == null) return; if (type == TYPE_TRANSACTIONAL || type == TYPE_CONTIGUOUS) { // The seq is part of the business transaction however we need - // to decrement the ref count so that the connection may be + // to decrement the ref count so that the connection may be // closed appropriately. - try { + try { conn.close(); } - catch(SQLException se) { + catch(SQLException se) { throw SQLExceptions.getStore(se); } return; @@ -200,13 +200,13 @@ public abstract class AbstractJDBCSeq } } } - + /** - * Detect whether or not OpenJPA should suspend the transaction in + * Detect whether or not OpenJPA should suspend the transaction in * a managed environment. */ protected boolean suspendInJTA() { - return getConfiguration().isConnectionFactoryModeManaged() && + return getConfiguration().isConnectionFactoryModeManaged() && getConfiguration().getConnectionFactory2() == null; } } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractUpdateManager.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractUpdateManager.java index b46197e81..508b8a57c 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractUpdateManager.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractUpdateManager.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -95,14 +95,14 @@ public abstract class AbstractUpdateManager mappedByIdStates.add(sm); else exceps = populateRowManager(sm, rowMgr, store, exceps, customs); - } else + } else exceps = populateRowManager(obj, rowMgr, store, exceps, customs); } // flush rows exceps = flush(rowMgr, psMgr, exceps); - + if (mappedByIdStates.size() != 0) { for (Iterator itr = mappedByIdStates.iterator(); itr.hasNext();) { StateManagerImpl sm = (StateManagerImpl) itr.next(); @@ -187,7 +187,7 @@ public abstract class AbstractUpdateManager RowImpl row = (RowImpl) rowMgr.getRow(((ClassMapping) sm.getMetaData()).getTable(), action, sm, false); if (row != null) { row.setFlushed(true); - } + } exceps = addException(exceps, ke); } return exceps; @@ -229,8 +229,8 @@ public abstract class AbstractUpdateManager // the id fields. Once the id fields are fully populated, // we will then insert the id fields. fields = reorderFields(fields); - } - + } + BitSet dirty = sm.getDirty(); for (int i = 0; i < fields.length; i++) { if (dirty.get(fields[i].getIndex()) @@ -247,7 +247,7 @@ public abstract class AbstractUpdateManager dsc.insert(sm, store, rowMgr); } } - + private FieldMapping[] reorderFields(FieldMapping[] fields) { List pkFmds = new ArrayList(); FieldMapping[] ret = new FieldMapping[fields.length]; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingConstraintUpdateManager.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingConstraintUpdateManager.java index 14bdd66e9..569abad81 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingConstraintUpdateManager.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingConstraintUpdateManager.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -27,15 +27,15 @@ import org.apache.openjpa.jdbc.sql.SQLExceptions; import org.apache.openjpa.util.OpenJPAException; /** - *

    Batch update manager that writes the SQL in object-level operation order. - * This update manager initiates a BatchPreparedStatementManagerImpl which - * will utilize the JDBC addBatch() and executeBatch() APIs to batch the + *

    Batch update manager that writes the SQL in object-level operation order. + * This update manager initiates a BatchPreparedStatementManagerImpl which + * will utilize the JDBC addBatch() and executeBatch() APIs to batch the * statements for performance improvement.

    - *

    This is the default plug-in class for UpdateManager to support statement - * batching. You can plug-in your own statement batch implementation through - * the following property: + *

    This is the default plug-in class for UpdateManager to support statement + * batching. You can plug-in your own statement batch implementation through + * the following property: *

    - *   < property name="openjpa.jdbc.UpdateManager" 
    + *   < property name="openjpa.jdbc.UpdateManager"
      *     value="org.apache.openjpa.jdbc.kernel.YourOperationOrderUpdateManager" />
      * 

    * @author Teresa Kan diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingOperationOrderUpdateManager.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingOperationOrderUpdateManager.java index 11364981a..3a5e50d48 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingOperationOrderUpdateManager.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingOperationOrderUpdateManager.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -27,17 +27,17 @@ import org.apache.openjpa.jdbc.sql.SQLExceptions; import org.apache.openjpa.util.OpenJPAException; /** - *

    Batch update manager that writes the SQL in object-level operation order. - * This update manager initiates a BatchPreparedStatementManagerImpl which - * will utilize the JDBC addBatch() and executeBatch() APIs to batch the + *

    Batch update manager that writes the SQL in object-level operation order. + * This update manager initiates a BatchPreparedStatementManagerImpl which + * will utilize the JDBC addBatch() and executeBatch() APIs to batch the * statements for performance improvement.

    - *

    This is the plug-in class for UpdateManager to support statement - * batching for ordering. You can plug-in this statement batch implementation - * through the following property: + *

    This is the plug-in class for UpdateManager to support statement + * batching for ordering. You can plug-in this statement batch implementation + * through the following property: *

    - * < property name="openjpa.jdbc.UpdateManager" 
    + * < property name="openjpa.jdbc.UpdateManager"
      *   value="org.apache.openjpa.jdbc.kernel.BatchingOperationOrderUpdateManager"
    - *    />   
    + *    />
      * 

    * @author Teresa Kan */ @@ -51,7 +51,7 @@ public class BatchingOperationOrderUpdateManager extends return new BatchingPreparedStatementManagerImpl(store, conn, batchLimit); } - + /* * Override this method to flush any remaining batched row in the * PreparedStatementManager. @@ -59,7 +59,7 @@ public class BatchingOperationOrderUpdateManager extends protected Collection flush(RowManager rowMgr, PreparedStatementManager psMgr, Collection exceps) { exceps = super.flush(rowMgr, psMgr, exceps); - BatchingPreparedStatementManagerImpl bPsMgr = + BatchingPreparedStatementManagerImpl bPsMgr = (BatchingPreparedStatementManagerImpl) psMgr; try { bPsMgr.flushBatch(); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java index 8e9fbabd3..939170023 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -40,7 +40,7 @@ import org.apache.openjpa.util.OptimisticException; * Batch prepared statement manager implementation. This prepared statement * manager will utilize the JDBC addBatch() and exceuteBatch() to batch the SQL * statements together to improve the execution performance. - * + * * @author Teresa Kan */ @@ -95,7 +95,7 @@ public class BatchingPreparedStatementManagerImpl extends case 0: break; case 1: - // single entry in cache, direct SQL execution. + // single entry in cache, direct SQL execution. try { super.flushAndUpdate((RowImpl) _batchedRows.get(0)); } finally { @@ -134,7 +134,7 @@ public class BatchingPreparedStatementManagerImpl extends } return rtnVal; } - + /** * flush all cached up statements to be executed as a single or batched * prepared statements. @@ -199,7 +199,7 @@ public class BatchingPreparedStatementManagerImpl extends if (sqex == null){ sqex = se; } - + if (se instanceof ReportingSQLException){ int index = ((ReportingSQLException) se).getIndexOfFirstFailedObject(); @@ -209,24 +209,24 @@ public class BatchingPreparedStatementManagerImpl extends if (batchSize == 1){ index = 0; } - + //index should not be less than 0 in this path, but if for some reason it is, lets //resort to the 'old way' and simply pass the 'ps' as the failed object. - if (index < 0){ + if (index < 0){ throw SQLExceptions.getStore(se, ps, _dict); } else{ - if(_batchedRows.size() == 0) { - if(_log.isTraceEnabled()) { - _log.trace("No batched rows found. The failed object may not be reliable"); + if(_batchedRows.size() == 0) { + if(_log.isTraceEnabled()) { + _log.trace("No batched rows found. The failed object may not be reliable"); } throw SQLExceptions.getStore(se, ps, _dict); } throw SQLExceptions.getStore(se, (_batchedRows.get(index)).getFailedObject(), _dict); - } + } } else{ - //per comments above, use 'sqex' rather than 'se'. + //per comments above, use 'sqex' rather than 'se'. throw SQLExceptions.getStore(sqex, ps, _dict); } } finally { @@ -269,7 +269,7 @@ public class BatchingPreparedStatementManagerImpl extends private void checkUpdateCount(int[] count, int batchedRowsBaseIndex, PreparedStatement ps) throws SQLException { - // value in int[] count returned from executeBatch: + // value in int[] count returned from executeBatch: // Update Delete Insert // =============================================================== // OK / Error OK / Error OK / Error @@ -291,7 +291,7 @@ public class BatchingPreparedStatementManagerImpl extends else if (row.getAction() == Row.ACTION_INSERT) throw new SQLException(_loc.get( "update-failed-no-failed-obj", - String.valueOf(count[i]), + String.valueOf(count[i]), row.getSQL(_dict)).getMessage()); break; case Statement.SUCCESS_NO_INFO: // -2 @@ -308,12 +308,12 @@ public class BatchingPreparedStatementManagerImpl extends else if (row.getAction() == Row.ACTION_INSERT) throw new SQLException(_loc.get( "update-failed-no-failed-obj", - String.valueOf(count[i]), + String.valueOf(count[i]), row.getSQL(_dict)).getMessage()); } if (_log.isTraceEnabled()) _log.trace(_loc.get("batch_update_info", - String.valueOf(cnt), + String.valueOf(cnt), row.getSQL(_dict)).getMessage()); break; case 0: // no row is inserted, treats it as failed @@ -324,7 +324,7 @@ public class BatchingPreparedStatementManagerImpl extends else if (row.getAction() == Row.ACTION_INSERT) throw new SQLException(_loc.get( "update-failed-no-failed-obj", - String.valueOf(count[i]), + String.valueOf(count[i]), row.getSQL(_dict)).getMessage()); } } @@ -354,12 +354,12 @@ public class BatchingPreparedStatementManagerImpl extends return _batchedSql; } - protected void addBatch(PreparedStatement ps, RowImpl row, + protected void addBatch(PreparedStatement ps, RowImpl row, int count) throws SQLException { ps.addBatch(); } - protected int[] executeBatch(PreparedStatement ps) + protected int[] executeBatch(PreparedStatement ps) throws SQLException { return ps.executeBatch(); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ClassTableJDBCSeq.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ClassTableJDBCSeq.java index 11df73aeb..638c3e216 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ClassTableJDBCSeq.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ClassTableJDBCSeq.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -44,7 +44,7 @@ import org.apache.openjpa.meta.JavaTypes; * * @author Abe White */ -public class ClassTableJDBCSeq +public class ClassTableJDBCSeq extends TableJDBCSeq { private static final Localizer _loc = Localizer.forPackage diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ConnectionInfo.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ConnectionInfo.java index 45bce30f0..64d16d4d3 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ConnectionInfo.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ConnectionInfo.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ConstraintUpdateManager.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ConstraintUpdateManager.java index 42537e672..fbb2deca3 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ConstraintUpdateManager.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ConstraintUpdateManager.java @@ -87,7 +87,7 @@ public class ConstraintUpdateManager Collection inserts = rmimpl.getInserts(); Collection updates = rmimpl.getUpdates(); Collection deletes = rmimpl.getDeletes(); - + Graph[] graphs = new Graph[2]; // insert graph, delete graph analyzeForeignKeys(inserts, updates, deletes, rmimpl, graphs); @@ -326,13 +326,13 @@ public class ConstraintUpdateManager boolean recalculate; // Handle circular constraints: - // - if deleted row A has a ciricular fk to deleted row B, - // then use an update statement to null A's fk to B before flushing, + // - if deleted row A has a ciricular fk to deleted row B, + // then use an update statement to null A's fk to B before flushing, // and then flush // - if inserted row A has a circular fk to updated/inserted row B, // then null the fk in the B row object, then flush, // and after flushing, use an update to set the fk back to A - // Depending on where circular dependencies are broken, the + // Depending on where circular dependencies are broken, the // topological order of the graph nodes has to be re-calculated. recalculate = resolveCycles(graph, dfa.getEdges(Edge.TYPE_BACK), deleteUpdates, insertUpdates); @@ -359,12 +359,12 @@ public class ConstraintUpdateManager /** * Break a circular dependency caused by delete operations. - * If deleted row A has a ciricular fk to deleted row B, then use an update + * If deleted row A has a ciricular fk to deleted row B, then use an update * statement to null A's fk to B before deleting B, then delete A. * @param edge Edge in the dependency graph corresponding to a foreign key * constraint. This dependency is broken by nullifying the foreign key. * @param deleteUpdates Collection of update statements that are executed - * before the delete operations are flushed + * before the delete operations are flushed */ private void addDeleteUpdate(Edge edge, Collection deleteUpdates) throws SQLException { @@ -394,7 +394,7 @@ public class ConstraintUpdateManager * @param edge Edge in the dependency graph corresponding to a foreign key * constraint. This dependency is broken by nullifying the foreign key. * @param insertUpdates Collection of update statements that are executed - * after the insert/update operations are flushed + * after the insert/update operations are flushed */ private void addInsertUpdate(PrimaryRow row, Edge edge, Collection insertUpdates) throws SQLException { @@ -428,7 +428,7 @@ public class ConstraintUpdateManager } /** - * Finds a nullable foreign key by walking the dependency cycle. + * Finds a nullable foreign key by walking the dependency cycle. * Circular dependencies can be broken at this point. * @param cycle Cycle in the dependency graph. * @return Edge corresponding to a nullable foreign key. @@ -454,7 +454,7 @@ public class ConstraintUpdateManager } /** - * Re-calculates the DepthFirstSearch analysis of the graph + * Re-calculates the DepthFirstSearch analysis of the graph * after some of the edges have been removed. Ensures * that the dependency graph is cycle free. * @param graph The graph of statements to be walked @@ -476,15 +476,15 @@ public class ConstraintUpdateManager * Resolve circular dependencies by identifying and breaking * a nullable foreign key. * @param graph Dependency graph. - * @param edges Collection of edges. Each edge indicates a possible + * @param edges Collection of edges. Each edge indicates a possible * circular dependency - * @param deleteUpdates Collection of update operations (nullifying - * foreign keys) to be filled. These updates will be executed before + * @param deleteUpdates Collection of update operations (nullifying + * foreign keys) to be filled. These updates will be executed before * the rows in the dependency graph are flushed - * @param insertUpdates CCollection of update operations (nullifying - * foreign keys) to be filled. These updates will be executed after + * @param insertUpdates CCollection of update operations (nullifying + * foreign keys) to be filled. These updates will be executed after * the rows in the dependency graph are flushed - * @return Depending on where circular dependencies are broken, the + * @return Depending on where circular dependencies are broken, the * topological order of the graph nodes has to be re-calculated. */ private boolean resolveCycles(Graph graph, Collection edges, diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/DelegatingJDBCFetchConfiguration.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/DelegatingJDBCFetchConfiguration.java index d240da97a..3b5ec0c42 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/DelegatingJDBCFetchConfiguration.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/DelegatingJDBCFetchConfiguration.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -27,7 +27,7 @@ import org.apache.openjpa.meta.FieldMetaData; import org.apache.openjpa.util.RuntimeExceptionTranslator; /////////////////////////////////////////////////////////////// -// NOTE: when adding a public API method, be sure to add it to +// NOTE: when adding a public API method, be sure to add it to // JDO and JPA facades! /////////////////////////////////////////////////////////////// diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/EagerFetchModes.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/EagerFetchModes.java index 1f70dd85b..7af22385f 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/EagerFetchModes.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/EagerFetchModes.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/FinderCacheImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/FinderCacheImpl.java index 71adf439e..2415ffd5e 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/FinderCacheImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/FinderCacheImpl.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -41,17 +41,17 @@ import org.apache.openjpa.lib.conf.Configuration; /** * Implementation of FinderCache for JDBC. - * + * * @author Pinaki Poddar - * + * * @since 2.0.0 * */ -public class FinderCacheImpl +public class FinderCacheImpl implements FinderCache { private static final String PATTERN_SEPARATOR = "\\;"; private static final String EXLUDED_BY_USER = "Excluded by user"; - + private final Map> _delegate; // Key: class name Value: Reason why excluded private final Map _uncachables; @@ -59,24 +59,24 @@ public class FinderCacheImpl private QueryStatistics _stats; private ReentrantLock _lock = new ReentrantLock(); private boolean _enableStats = false; - + public FinderCacheImpl() { _delegate = new HashMap>(); _uncachables = new HashMap(); _stats = new QueryStatistics.None(); } - + /** * Get a map-oriented view of the cache. - * - * @return a map of the query string with class names as key. + * + * @return a map of the query string with class names as key. */ public Map getMapView() { lock(); try { Map view = new TreeMap(); for (ClassMapping mapping : _delegate.keySet()) { - view.put(mapping.getDescribedType().getName(), + view.put(mapping.getDescribedType().getName(), _delegate.get(mapping).getQueryString()); } return view; @@ -86,7 +86,7 @@ public class FinderCacheImpl } /** - * Gets basic statistics of execution and hit count of finder queries. + * Gets basic statistics of execution and hit count of finder queries. */ public QueryStatistics getStatistics() { return _stats; @@ -94,24 +94,24 @@ public class FinderCacheImpl /** * Gets the finder query for the given mapping. The get operation can be - * controlled by FetchConfiguration hints. + * controlled by FetchConfiguration hints. * {@link QueryHints#HINT_IGNORE_FINDER HINT_IGNORE_FINDER} will ignore * any cached finder that may exist in this cache and will return null. - * {@link QueryHints#HINT_INVALIDATE_FINDER HINT_INVALIDATE_FINDER} will + * {@link QueryHints#HINT_INVALIDATE_FINDER HINT_INVALIDATE_FINDER} will * invalidate any cached finder that may exist in this cache and will return * null. - * + * */ - public FinderQuery + public FinderQuery get(ClassMapping mapping, FetchConfiguration fetch) { if (fetch.getReadLockLevel() != 0) { return null; } - + if (!fetch.isFetchConfigurationSQLCacheAdmissible()) { return null; } - + boolean ignore = isHinted(fetch, QueryHints.HINT_IGNORE_FINDER); boolean invalidate = isHinted(fetch, QueryHints.HINT_INVALIDATE_FINDER); if (invalidate) { @@ -124,20 +124,20 @@ public class FinderCacheImpl _stats.recordExecution(mapping); return result; } - + /** - * Cache a Finder Query for the given mapping and select. The put operation - * can be controlled by FetchConfiguration hints. - * If no entry exists for the given mapping then an attempt is made to + * Cache a Finder Query for the given mapping and select. The put operation + * can be controlled by FetchConfiguration hints. + * If no entry exists for the given mapping then an attempt is made to * create a new FinderQuery. The attempt, however, may not be successful * because all Selects can not be cached. * @see FinderQueryImpl#newFinder(ClassMapping, Select). - * + * * If a entry for the given mapping exists then the value of - * {@link QueryHints#HINT_RECACHE_FINDER HINT_RECACHE_FINDER} hint - * determines whether the existing entry is returned or a new FinderQuery + * {@link QueryHints#HINT_RECACHE_FINDER HINT_RECACHE_FINDER} hint + * determines whether the existing entry is returned or a new FinderQuery * with the given argument overwrites the existing one. - * + * * @param mapping the class for which the finder is to be cached * @param select the finder query * @param fetch may contain hints to control cache operation @@ -149,11 +149,11 @@ public class FinderCacheImpl if (fetch.getReadLockLevel() != 0) { return null; } - + if (!fetch.isFetchConfigurationSQLCacheAdmissible()) { return null; - } - + } + boolean recache = isHinted(fetch, QueryHints.HINT_RECACHE_FINDER); if (isExcluded(mapping)) { return recache ? put(mapping, select) : null; @@ -166,13 +166,13 @@ public class FinderCacheImpl unlock(); } } - + /** * Creates and puts a FinderQuery in the internal map indexed by the * given ClassMapping. * If a new FinderQuery can not be created for the given Select (because * some Select are not cached), then the mapping is marked invalid. - * + * */ private FinderQuery put(ClassMapping mapping, SelectExecutor select) { FinderQuery finder = FinderQueryImpl.newFinder(mapping, select); @@ -183,7 +183,7 @@ public class FinderCacheImpl } return finder; } - + /** * Affirms if the given mapping is excluded from being cached. */ @@ -211,7 +211,7 @@ public class FinderCacheImpl if (_exclusionPatterns == null) _exclusionPatterns = new ArrayList(); _exclusionPatterns.add(pattern); - Collection invalidMappings = getMatchedKeys(pattern, + Collection invalidMappings = getMatchedKeys(pattern, _delegate.keySet()); for (ClassMapping invalidMapping : invalidMappings) markUncachable(invalidMapping, pattern); @@ -220,7 +220,7 @@ public class FinderCacheImpl } } /** - * Removes a pattern for exclusion. Any query identifier marked as not + * Removes a pattern for exclusion. Any query identifier marked as not * cachable due to the given pattern will now be removed from the list of * uncachables as a side-effect. */ @@ -230,7 +230,7 @@ public class FinderCacheImpl if (_exclusionPatterns == null) return; _exclusionPatterns.remove(pattern); - Collection reborns = getMatchedKeys(pattern, + Collection reborns = getMatchedKeys(pattern, _uncachables.keySet()); for (String rebornKey : reborns) _uncachables.remove(rebornKey); @@ -238,7 +238,7 @@ public class FinderCacheImpl unlock(); } } - + /** * Gets the pattern that matches the given identifier. */ @@ -250,9 +250,9 @@ public class FinderCacheImpl return pattern; return null; } - + /** - * Gets the elements of the given set that match the given pattern. + * Gets the elements of the given set that match the given pattern. */ private Collection getMatchedKeys(String pattern, Set set) { List result = new ArrayList(); @@ -263,9 +263,9 @@ public class FinderCacheImpl } return result; } - + /** - * Gets the elements of the given list which match the given pattern. + * Gets the elements of the given list which match the given pattern. */ private Collection getMatchedKeys(String pattern, Collection coll) { List result = new ArrayList(); @@ -280,12 +280,12 @@ public class FinderCacheImpl boolean matches(String pattern, ClassMapping mapping) { return matches(pattern, mapping.getDescribedType().getName()); } - + boolean matches(String pattern, String target) { - return target != null && (target.equals(pattern) + return target != null && (target.equals(pattern) || target.matches(pattern)); } - + public boolean invalidate(ClassMapping mapping) { lock(); try { @@ -302,7 +302,7 @@ public class FinderCacheImpl public FinderQuery markUncachable(String id) { return markUncachable(id, EXLUDED_BY_USER); } - + private FinderQuery markUncachable(String cls, String reason) { lock(); try { @@ -314,7 +314,7 @@ public class FinderCacheImpl unlock(); } } - + private FinderQuery markUncachable(ClassMapping mapping, String reason) { lock(); try { @@ -327,7 +327,7 @@ public class FinderCacheImpl unlock(); } } - + ClassMapping searchMappingByName(String cls) { for (ClassMapping mapping : _delegate.keySet()) if (matches(cls, mapping)) @@ -335,7 +335,7 @@ public class FinderCacheImpl return null; } - + public void setExcludes(String excludes) { lock(); try { @@ -353,18 +353,18 @@ public class FinderCacheImpl @SuppressWarnings("unchecked") public List getExcludes() { - return (List)_exclusionPatterns == null - ? Collections.EMPTY_LIST + return (List)_exclusionPatterns == null + ? Collections.EMPTY_LIST : Collections.unmodifiableList(_exclusionPatterns); } - + boolean isHinted(FetchConfiguration fetch, String hint) { if (fetch == null) return false; Object result = fetch.getHint(hint); return result != null && "true".equalsIgnoreCase(result.toString()); } - + void lock() { if (_lock != null) _lock.lock(); @@ -374,8 +374,8 @@ public class FinderCacheImpl if (_lock != null && _lock.isLocked()) _lock.unlock(); } - - public void setEnableStats(boolean b) { + + public void setEnableStats(boolean b) { _enableStats = b; if (_enableStats) { _stats = new QueryStatistics.Default(); @@ -390,7 +390,7 @@ public class FinderCacheImpl // ---------------------------------------------------- public void startConfiguration() { } - + public void setConfiguration(Configuration conf) { } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/FinderQueryImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/FinderQueryImpl.java index 3cbc0f68e..f9e143df4 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/FinderQueryImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/FinderQueryImpl.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -43,14 +43,14 @@ import org.apache.openjpa.util.Id; /** - * Implements Finder Query identified by ClassMappping for SelectExecutor that - * can be executed to generate Result. - * + * Implements Finder Query identified by ClassMappping for SelectExecutor that + * can be executed to generate Result. + * * @author Pinaki Poddar * * @since 2.0.0 */ -public class FinderQueryImpl +public class FinderQueryImpl implements FinderQuery { private final ClassMapping _mapping; private final SelectImpl _select; @@ -59,11 +59,11 @@ public class FinderQueryImpl private final int[] _pkIndices; private final SQLBuffer _buffer; private final String _sql; - + /** * Attempts to construct a FinderQuery from the given Select for the given * mapping. The given Select may not be amenable for caching and then a null - * value is returned. + * value is returned. */ static FinderQueryImpl newFinder(ClassMapping mapping, SelectExecutor select) { @@ -73,16 +73,16 @@ public class FinderQueryImpl SQLBuffer buffer = impl.getSQL(); Column[] pkCols = mapping.getPrimaryKeyColumns(); - //OPENJPA-2557: Typically the number of pkCols (length) should match the number (size) of + //OPENJPA-2557: Typically the number of pkCols (length) should match the number (size) of //parameters. However, there are a few cases (e.g. when extra parameters are needed for - //discriminator data) where the pkCols length may be different than the parameters. + //discriminator data) where the pkCols length may be different than the parameters. //If we find the number of pkCols is equal to the number of parameters, we need to do //one last check to verify that the buffers columns match the pkCols exactly. boolean canCache = (pkCols.length == buffer.getParameters().size()); for(int i=0; i < pkCols.length && canCache; i++){ - canCache = canCache && buffer.getColumns().contains(pkCols[i]); + canCache = canCache && buffer.getColumns().contains(pkCols[i]); } - + return (canCache) ? new FinderQueryImpl(mapping, impl, buffer) : null; } @@ -103,46 +103,46 @@ public class FinderQueryImpl FieldMetaData pk = _mapping.getField(_joins[i].getFieldIndex()); _pkIndices[i] = pk == null ? 0 : pk.getPrimaryKeyIndex(); } - + } - + public ClassMapping getIdentifier() { return _mapping; } - + public SelectExecutor getDelegate() { return _select; } - + public String getQueryString() { return _sql; } - + public Column[] getPKColumns() { return _pkCols; } - + private Object[] getPKValues(OpenJPAStateManager sm, JDBCStore store) { Object[] pks = null; Object oid = sm.getObjectId(); if (_mapping.getIdentityType() == ClassMapping.ID_APPLICATION) pks = ApplicationIds.toPKValues(oid, _mapping); - + Object[] val = new Object[_pkCols.length]; int count = 0; for (int i = 0; i < _pkCols.length; i++, count++) { if (pks == null) - val[0] = (oid == null) + val[0] = (oid == null) ? null : ((Id) oid).getId(); else { - val[i] = _joins[i].getJoinValue(pks[_pkIndices[i]], _pkCols[i], + val[i] = _joins[i].getJoinValue(pks[_pkIndices[i]], _pkCols[i], store); } } return val; } - - public Result execute(OpenJPAStateManager sm, StoreManager store, + + public Result execute(OpenJPAStateManager sm, StoreManager store, FetchConfiguration fetch) { boolean forUpdate = false; JDBCStore jstore = (JDBCStore)store; @@ -161,7 +161,7 @@ public class FinderQueryImpl dict.setTimeouts(stmnt, (JDBCFetchConfiguration)fetch, forUpdate); rs = _select.executeQuery(conn, stmnt, getQueryString(), jstore, params, _pkCols); - return _select.getEagerResult(conn, stmnt, rs, jstore, + return _select.getEagerResult(conn, stmnt, rs, jstore, (JDBCFetchConfiguration)fetch, forUpdate, _buffer); } catch (SQLException se) { if (stmnt != null) @@ -170,20 +170,20 @@ public class FinderQueryImpl throw new RuntimeException(se); } } - + private static SelectImpl extractImplementation(SelectExecutor selector) { if (selector == null || selector.hasMultipleSelects()) return null; - if (selector instanceof SelectImpl) + if (selector instanceof SelectImpl) return (SelectImpl)selector; if (selector instanceof LogicalUnion.UnionSelect) return ((LogicalUnion.UnionSelect)selector).getDelegate(); - if (selector instanceof Union) + if (selector instanceof Union) return extractImplementation(((Union)selector).getSelects()[0]); - + return null; } - + public String toString() { return _mapping + ": [" + getQueryString() + "]"; } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/GenericResultObjectProvider.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/GenericResultObjectProvider.java index 46294b9e8..ce4f8f8cc 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/GenericResultObjectProvider.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/GenericResultObjectProvider.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/InstanceResultObjectProvider.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/InstanceResultObjectProvider.java index 68b78338e..820b2dfae 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/InstanceResultObjectProvider.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/InstanceResultObjectProvider.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBC3SavepointManager.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBC3SavepointManager.java index e0b2c0be4..803c70bcd 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBC3SavepointManager.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBC3SavepointManager.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -29,7 +29,7 @@ import org.apache.openjpa.util.UserException; * {@link SavepointManager} implementation that uses JDBC 3 savepoints * to store state. This plugin has the side effect of triggering * a flush on the {@link Broker}. - * + * * Note that this plugin requires a database and JDBC driver which * supports JDBC 3 savepoints * diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCBrokerFactory.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCBrokerFactory.java index d119bcd70..ff26d5591 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCBrokerFactory.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCBrokerFactory.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -85,7 +85,7 @@ public class JDBCBrokerFactory JDBCBrokerFactory factory = (JDBCBrokerFactory) getPooledFactoryForKey(key); if (factory != null) return factory; - + // The creation of all BrokerFactories should be driven through Bootstrap. factory = (JDBCBrokerFactory) Bootstrap.newBrokerFactory(cp, loader); pool(key, factory); @@ -99,7 +99,7 @@ public class JDBCBrokerFactory public JDBCBrokerFactory(JDBCConfiguration conf) { super(conf); } - + public Map getProperties() { // add platform property Map props = super.getProperties(); @@ -113,7 +113,7 @@ public class JDBCBrokerFactory return props; } - + @Override public void postCreationCallback() { super.postCreationCallback(); @@ -145,7 +145,7 @@ public class JDBCBrokerFactory /** * Synchronize the mappings of the classes listed in the configuration. */ - protected void synchronizeMappings(ClassLoader loader, + protected void synchronizeMappings(ClassLoader loader, JDBCConfiguration conf) { mapSchemaGenerationToSynchronizeMappings(conf); String action = conf.getSynchronizeMappings(); @@ -174,7 +174,7 @@ public class JDBCBrokerFactory } tool.record(); } - + protected void synchronizeMappings(ClassLoader loader) { synchronizeMappings(loader, (JDBCConfiguration) getConfiguration()); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfiguration.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfiguration.java index ad5eb1833..b7b27af5c 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfiguration.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfiguration.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -241,13 +241,13 @@ public interface JDBCFetchConfiguration * @since 1.0.3 */ public JDBCFetchConfiguration addFetchInnerJoins(Collection fields); - + /** * Affirms if foreign key for a relation field will be pre-fetched as part of the owning object irrespective of * whether the field is included in the default fetch group of this fetch configuration.
    * By default, foreign key for a relation field is pre-fetched as part of the owning object only if the * field in included in the default fetch group of this fetch configuration. - * + * * @since 2.2.0 */ public boolean getIgnoreDfgForFkSelect(); @@ -257,7 +257,7 @@ public interface JDBCFetchConfiguration * whether the field is included in the default fetch group of this fetch configuration.
    * By default, foreign key for a relation field is pre-fetched as part of the owning object only if the * field in included in the default fetch group of this fetch configuration. - * + * * @since 2.2.0 */ public void setIgnoreDfgForFkSelect(boolean b); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfigurationImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfigurationImpl.java index e6b6f218d..eec6a3c06 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfigurationImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfigurationImpl.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -57,7 +57,7 @@ public class JDBCFetchConfigurationImpl implements JDBCFetchConfiguration { private static final Localizer _loc = Localizer.forPackage(JDBCFetchConfigurationImpl.class); - + /** * Hint keys that correspond to a mutable bean-style setter in this receiver. * These keys are registered with both openjpa.FetchPlan and openjpa.jdbc as prefix. @@ -100,7 +100,7 @@ public class JDBCFetchConfigurationImpl this(null, null); } - protected JDBCFetchConfigurationImpl(ConfigurationState state, + protected JDBCFetchConfigurationImpl(ConfigurationState state, JDBCConfigurationState jstate) { super(state); _state = (jstate == null) ? new JDBCConfigurationState() : jstate; @@ -168,7 +168,7 @@ public class JDBCFetchConfigurationImpl _state.eagerMode = mode; return this; } - + public int getSubclassFetchMode() { return _state.subclassMode; } @@ -313,7 +313,7 @@ public class JDBCFetchConfigurationImpl } public Set getJoins() { - if (_state.joins == null) + if (_state.joins == null) return Collections.emptySet(); return _state.joins; } @@ -325,7 +325,7 @@ public class JDBCFetchConfigurationImpl public JDBCFetchConfiguration addJoin(String join) { if (StringUtil.isEmpty(join)) throw new UserException(_loc.get("null-join")); - + lock(); try { if (_state.joins == null) @@ -418,7 +418,7 @@ public class JDBCFetchConfigurationImpl } public Set getFetchInnerJoins() { - if (_state.fetchInnerJoins == null) + if (_state.fetchInnerJoins == null) return Collections.emptySet(); return _state.fetchInnerJoins; } @@ -431,7 +431,7 @@ public class JDBCFetchConfigurationImpl public JDBCFetchConfiguration addFetchInnerJoin(String join) { if (StringUtil.isEmpty(join)) throw new UserException(_loc.get("null-join")); - + lock(); try { if (_state.fetchInnerJoins == null) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCLockManager.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCLockManager.java index f168688ac..4ff301c35 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCLockManager.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCLockManager.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCSeq.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCSeq.java index 5aae21623..904626ddb 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCSeq.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCSeq.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStore.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStore.java index ee430e306..cd6bdab41 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStore.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStore.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -68,11 +68,11 @@ public interface JDBCStore { * method is implemented as a no-op. */ public Connection getConnection(); - + /** * Return a new SQL connection to the database. * This is used when the current connection still has a open result set - * and a new database operation needs to be done. + * and a new database operation needs to be done. * The close method should always be called on the connection * to free any resources it is using. When appropriate, the close * method is implemented as a no-op. diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java index 74aa6cd51..0f3d6f026 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -104,14 +104,14 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { private RefCountConnection _conn = null; private boolean _active = false; private Log _log = null; - + // track the pending statements so we can cancel them private List _stmnts = Collections.synchronizedList(new ArrayList()); - + // pool statements so that we can try to reuse rather than recreate private List _cancelPreparedStatementsPool = new ArrayList(); private List _cancelStatementPool = new ArrayList(); - + public StoreContext getContext() { return _ctx; } @@ -119,7 +119,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { public void setContext(StoreContext ctx) { setContext(ctx, (JDBCConfiguration) ctx.getConfiguration()); } - + public void setContext(StoreContext ctx, JDBCConfiguration conf) { _ctx = ctx; _conf = conf; @@ -136,21 +136,21 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { if (_conf.getUpdateManagerInstance().orderDirty()) ctx.setOrderDirtyObjects(true); } - + private boolean useConnectionFactory2(StoreContext ctx) { - return (!ctx.isManaged() && _conf.isConnectionFactoryModeManaged()); + return (!ctx.isManaged() && _conf.isConnectionFactoryModeManaged()); } - + private DataSource getDataSource(StoreContext ctx) { DataSource ds; - if(useConnectionFactory2(ctx)) { - ds = _conf.getDataSource2(ctx); + if(useConnectionFactory2(ctx)) { + ds = _conf.getDataSource2(ctx); } else { ds = _conf.getDataSource(ctx); } - return ds; + return ds; } public JDBCConfiguration getConfiguration() { @@ -241,7 +241,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { connect(true); return _conn; } - + protected DataSource getDataSource() { return _ds; } @@ -257,7 +257,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { // JDBCStoreManager doesn't store oids in memory. return false; } - + private boolean exists(ClassMapping mapping, Object oid, Object context) { // add where conditions on base class to avoid joins if subclass // doesn't use oid as identifier @@ -302,12 +302,12 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { FetchConfiguration fetch, Object context) { ConnectionInfo info = (ConnectionInfo) context; try { - return initializeState(sm, state, (JDBCFetchConfiguration) fetch, + return initializeState(sm, state, (JDBCFetchConfiguration) fetch, info); } catch (ClassNotFoundException cnfe) { throw new UserException(cnfe); } catch (SQLException se) { - throw SQLExceptions.getStore(se, Exceptions.toString(sm.getPersistenceCapable()), + throw SQLExceptions.getStore(se, Exceptions.toString(sm.getPersistenceCapable()), _dict, fetch.getReadLockLevel()); } } @@ -387,7 +387,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { mapping.getExtraFieldDataIndex(mappedByFieldMapping.getIndex()) != -1) { // The inverse relation can not be set since // we are eagerly loading this sm for - // a sm owner that is still in the process of + // a sm owner that is still in the process of // initializing itself. // Remember owner oid by setIntermediate(). // The inverse relation is set later by @@ -432,13 +432,13 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { Object coll = owner.fetchObject(fms[i].getIndex()); if (coll instanceof Map) coll = ((Map)coll).values(); - if (coll instanceof Collection && + if (coll instanceof Collection && ((Collection) coll).size() > 0) { // Found eagerly loaded collection. // Publisher (1) <==> (M) Magazine // publisher has a EAGER OneToMany relation // magazine has a EAGER or LAZY ManyToOne publisher - // For each member (Magazine) in the collection, + // For each member (Magazine) in the collection, // set its inverse relation (Publisher). for (Iterator itr = ((Collection) coll).iterator(); itr.hasNext();) { @@ -481,16 +481,16 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { } /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of getting version from the result set. */ protected void getVersion(ClassMapping mapping, OpenJPAStateManager sm, Result res) throws SQLException { mapping.getVersion().afterLoad(sm, this); } - + /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of checking whether the result set is empty or not. */ protected boolean isEmptyResult(Result res) throws SQLException { @@ -498,9 +498,9 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { return true; return false; } - + /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of getting type from the result set. */ protected Class getType(Result res, ClassMapping mapping){ @@ -638,16 +638,16 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { // if the instance is hollow and there's a customized // get by id method, use it - if (sm.getLoaded().length() == 0 + if (sm.getLoaded().length() == 0 && mapping.customLoad(sm, this, null, jfetch)) removeLoadedFields(sm, fields); - + //### select is kind of a big object, and in some cases we don't //### use it... would it be worth it to have a small shell select //### object that only creates a real select when actually used? - //### Delayed proxy specific optimization: If the only fields that - //### need to be loaded are delayed proxies, building the select is + //### Delayed proxy specific optimization: If the only fields that + //### need to be loaded are delayed proxies, building the select is //### not necessary. if (!isDelayedLoadOnly(sm, fields, mapping)) { @@ -656,7 +656,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { EagerFetchModes.EAGER_JOIN, true, false)) { sel.wherePrimaryKey(sm.getObjectId(), mapping, this); if (_log.isTraceEnabled()) { - _log.trace("load: "+mapping.getDescribedType()+" oid: "+sm.getObjectId()); + _log.trace("load: "+mapping.getDescribedType()+" oid: "+sm.getObjectId()); } res = sel.execute(this, jfetch, lockLevel); try { @@ -689,7 +689,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { } private boolean isDelayedLoadOnly(OpenJPAStateManager sm, BitSet fields, ClassMapping mapping) { - if (!sm.getContext().getConfiguration().getProxyManagerInstance().getDelayCollectionLoading() + if (!sm.getContext().getConfiguration().getProxyManagerInstance().getDelayCollectionLoading() || fields.isEmpty()) { return false; } @@ -703,7 +703,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { } return true; } - + /** * Return a list formed by removing all loaded fields from the given one. */ @@ -901,7 +901,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { private StoreQuery newStoreQuery(String language) { ExpressionParser ep = QueryLanguages.parserForLanguage(language); - if (ep != null) { + if (ep != null) { return new JDBCStoreQuery(this, ep); } if (QueryLanguages.LANG_SQL.equals(language)) { @@ -915,9 +915,9 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { } return null; } - + public StoreQuery newQuery(String language) { - StoreQuery sq = newStoreQuery(language); + StoreQuery sq = newStoreQuery(language); if (sq == null || QueryLanguages.parserForLanguage(language) == null) { return sq; } @@ -926,7 +926,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { if (queryCache == null) { return sq; } - + return new QueryCacheStoreQuery(sq, queryCache); } @@ -980,7 +980,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { protected RefCountConnection connectInternal() throws SQLException { return new RefCountConnection(_ds.getConnection()); } - + public Connection getNewConnection() { try { return _ds.getConnection(); @@ -992,7 +992,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { /** * Find the object with the given oid. */ - public Object find(Object oid, ValueMapping vm, + public Object find(Object oid, ValueMapping vm, JDBCFetchConfiguration fetch) { if (oid == null) return null; @@ -1015,7 +1015,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { public Object load(ClassMapping mapping, JDBCFetchConfiguration fetch, BitSet exclude, Result result) throws SQLException { if (!mapping.isMapped()) - throw new InvalidStateException(_loc.get("virtual-mapping", + throw new InvalidStateException(_loc.get("virtual-mapping", mapping)); // get the object id for the row; base class selects pk columns @@ -1093,7 +1093,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { for (int i = 0; i < fms.length; i++) { if (fms[i].isPrimaryKey() || sm.getLoaded().get(fms[i].getIndex())) continue; - + // check for eager result, and if not present do standard load eres = res.getEager(fms[i]); res.startDataRequest(fms[i]); @@ -1102,10 +1102,10 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { if (eagerToMany == null && fms[i].isEagerSelectToMany()) eagerToMany = fms[i]; else - fms[i].loadEagerJoin(sm, this, + fms[i].loadEagerJoin(sm, this, fetch.traverseJDBC(fms[i]), res); } else if (eres != null) { - processed = fms[i].loadEagerParallel(sm, this, + processed = fms[i].loadEagerParallel(sm, this, fetch.traverseJDBC(fms[i]), eres); if (processed != eres) res.putEager(fms[i], processed); @@ -1144,11 +1144,11 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { OpenJPAStateManager sm, BitSet fields, JDBCFetchConfiguration fetch, int eager, boolean ident, boolean outer) { // add class conditions so that they're cloned for any batched selects - boolean joinedSupers = false; + boolean joinedSupers = false; if(needClassCondition(mapping, subs, sm)) { joinedSupers = getJoinedSupers(sel, mapping, subs, outer); } - + // create all our eager selects so that those fields are reserved // and cannot be reused during the actual eager select process, // preventing infinite recursion @@ -1166,7 +1166,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { // advance the result set and could exhaust it, so no other mappings // can load afterwords if (eagerToMany != null) - eagerToMany.selectEagerJoin(sel, sm, this, + eagerToMany.selectEagerJoin(sel, sm, this, fetch.traverseJDBC(eagerToMany), eager); // optionally select subclass mappings @@ -1178,7 +1178,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { } private boolean getJoinedSupers(Select sel, ClassMapping mapping, int subs, boolean outer) { - loadSubclasses(mapping); + loadSubclasses(mapping); Joins joins = (outer) ? sel.newOuterJoins() : null; boolean includeSubs = false; if (subs == Select.SUBS_JOINABLE || subs == Select.SUBS_ANY_JOINABLE) { @@ -1186,7 +1186,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { } return mapping.getDiscriminator().addClassConditions(sel, includeSubs, joins); } - + private boolean needClassCondition(ClassMapping mapping, int subs, OpenJPAStateManager sm) { boolean retVal = false; @@ -1205,7 +1205,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { } return retVal; } - + /** * Mark the fields of this mapping as reserved so that eager fetches can't * get into infinite recursive situations. @@ -1216,7 +1216,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { if (mapping == null || eager == JDBCFetchConfiguration.EAGER_NONE) return null; - FieldMapping eagerToMany = createEagerSelects(sel, + FieldMapping eagerToMany = createEagerSelects(sel, mapping.getJoinablePCSuperclassMapping(), sm, fields, fetch, eager); FieldMapping[] fms = mapping.getDefinedFieldMappings(); @@ -1232,7 +1232,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { continue; // try to select with join first - jtype = (fms[i].getNullValue() == FieldMetaData.NULL_EXCEPTION) + jtype = (fms[i].getNullValue() == FieldMetaData.NULL_EXCEPTION) ? Select.EAGER_INNER : Select.EAGER_OUTER; if (mode != EagerFetchModes.EAGER_PARALLEL && !fms[i].isEagerSelectToMany() && fms[i].supportsSelect(sel, jtype, sm, this, fetch) > 0 @@ -1246,13 +1246,13 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { // to use a to-many join also. currently we limit eager // outer joins to non-LRS, non-ranged selects that don't already // have an eager to-many join - if ((hasJoin || mode == EagerFetchModes.EAGER_JOIN + if ((hasJoin || mode == EagerFetchModes.EAGER_JOIN || (mode == FetchConfiguration.DEFAULT && sm != null)) && fms[i].isEagerSelectToMany() && !inEagerJoin && !sel.hasEagerJoin(true) && (!sel.getAutoDistinct() || (!sel.isLRS() - && sel.getStartIndex() == 0 + && sel.getStartIndex() == 0 && sel.getEndIndex() == Long.MAX_VALUE)) && fms[i].supportsSelect(sel, jtype, sm, this, fetch) > 0) { if (sel.eagerClone(fms[i], jtype, true, 1) != null) @@ -1265,7 +1265,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { if (eager == EagerFetchModes.EAGER_PARALLEL && (sels = fms[i].supportsSelect(sel, Select.EAGER_PARALLEL, sm, this, fetch)) != 0) - sel.eagerClone(fms[i], Select.EAGER_PARALLEL, + sel.eagerClone(fms[i], Select.EAGER_PARALLEL, fms[i].isEagerSelectToMany(), sels); } return eagerToMany; @@ -1323,8 +1323,8 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { } // if no instance or not initialized and not exact oid, select type - if ((sm == null || (sm.getPCState() == PCState.TRANSIENT - && (!(sm.getObjectId() instanceof OpenJPAId) + if ((sm == null || (sm.getPCState() == PCState.TRANSIENT + && (!(sm.getObjectId() instanceof OpenJPAId) || ((OpenJPAId) sm.getObjectId()).hasSubclasses()))) && mapping.getDiscriminator().select(sel, orig)) seld = 1; @@ -1354,18 +1354,18 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { esel = sel.getEager(fms[i]); if (esel != null) { if (esel == sel) - fms[i].selectEagerJoin(sel, sm, this, + fms[i].selectEagerJoin(sel, sm, this, fetch.traverseJDBC(fms[i]), eager); else - fms[i].selectEagerParallel(esel, sm, this, + fms[i].selectEagerParallel(esel, sm, this, fetch.traverseJDBC(fms[i]), eager); seld = Math.max(0, seld); } else if (requiresSelect(fms[i], sm, fields, fetch)) { - fseld = fms[i].select(sel, sm, this, + fseld = fms[i].select(sel, sm, this, fetch.traverseJDBC(fms[i]), eager); seld = Math.max(fseld, seld); } else if (optSelect(fms[i], sel, sm, fetch)) { - fseld = fms[i].select(sel, sm, this, + fseld = fms[i].select(sel, sm, this, fetch.traverseJDBC(fms[i]), EagerFetchModes.EAGER_NONE); // don't upgrade seld to > 0 based on these fields, since @@ -1387,7 +1387,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { } } } - + // join to parent table if the parent / any ancestors have selected // anything if (!joined && pseld >= 0 && parent.getTable() != mapping.getTable()) @@ -1404,7 +1404,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { */ private boolean optSelect(FieldMapping fm, Select sel, OpenJPAStateManager sm, JDBCFetchConfiguration fetch) { boolean dfg = - fetch.getIgnoreDfgForFkSelect() || + fetch.getIgnoreDfgForFkSelect() || !fm.isInDefaultFetchGroup() && !fm.isDefaultFetchGroupExplicit(); return dfg && (sm == null || sm.getPCState() == PCState.TRANSIENT || !sm.getLoaded().get(fm.getIndex())) @@ -1449,10 +1449,10 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { for (int j = 0; j < fms.length; j++) { // make sure in one of configured fetch groups if (fetch.requiresFetch(fms[j]) != FetchConfiguration.FETCH_LOAD - && ((!fms[j].isInDefaultFetchGroup() + && ((!fms[j].isInDefaultFetchGroup() && fms[j].isDefaultFetchGroupExplicit()) - || fms[j].supportsSelect(sel, Select.TYPE_TWO_PART, sm, this, - fetch) <= 0)) + || fms[j].supportsSelect(sel, Select.TYPE_TWO_PART, sm, this, + fetch) <= 0)) continue; // if we can join to the subclass, do so; much better chance @@ -1527,19 +1527,19 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { private void afterExecuteStatement(Statement stmnt) { _stmnts.remove(stmnt); } - + FinderQueryImpl getFinder(ClassMapping mapping, FetchConfiguration fetch) { FinderCache cache = getFinderCache(); - return cache == null + return cache == null ? null : (FinderQueryImpl)cache.get(mapping, fetch); } - - boolean cacheFinder(ClassMapping mapping, SelectExecutor select, + + boolean cacheFinder(ClassMapping mapping, SelectExecutor select, FetchConfiguration fetch) { FinderCache cache = getFinderCache(); return cache != null && cache.cache(mapping, select, fetch) != null; } - + FinderCache getFinderCache() { return (((BrokerImpl)getContext()).getCacheFinderQuery()) ? getConfiguration().getFinderCacheInstance() : null; @@ -1663,7 +1663,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { } return new CancelPreparedStatement(stmnt, conn); } - + private Statement getCancelStatement(Statement stmnt, Connection conn) { synchronized (_cancelStatementPool) { if (!_cancelStatementPool.isEmpty()) { @@ -1675,7 +1675,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { return new CancelStatement(stmnt, conn); } - + /** * Statement type that adds and removes itself from the set of active * statements so that it can be canceled. @@ -1783,7 +1783,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { private class CancelPreparedStatement extends DelegatingPreparedStatement { - public CancelPreparedStatement(PreparedStatement stmnt, + public CancelPreparedStatement(PreparedStatement stmnt, Connection conn) { super(stmnt, conn); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreQuery.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreQuery.java index e80a36c37..d9ea5409b 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreQuery.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreQuery.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -82,7 +82,7 @@ import org.apache.openjpa.util.UserException; * * @author Abe White */ -public class JDBCStoreQuery +public class JDBCStoreQuery extends ExpressionStoreQuery { private static final Table INVALID = new Table(); @@ -147,7 +147,7 @@ public class JDBCStoreQuery factory.setBooleanLiteralAsNumeric(false); return factory; } - + protected ResultObjectProvider executeQuery(Executor ex, ClassMetaData base, ClassMetaData[] metas, boolean subclasses, ExpressionFactory[] facts, QueryExpressions[] exps, Object[] params, @@ -161,7 +161,7 @@ public class JDBCStoreQuery get("mult-mapping-aggregate", Arrays.asList(metas))); ClassMapping[] mappings = (ClassMapping[]) metas; - JDBCFetchConfiguration fetch = (JDBCFetchConfiguration) + JDBCFetchConfiguration fetch = (JDBCFetchConfiguration) ctx.getFetchConfiguration(); if (exps[0].fetchPaths != null) { fetch.addFields(Arrays.asList(exps[0].fetchPaths)); @@ -173,7 +173,7 @@ public class JDBCStoreQuery int eager = calculateEagerMode(exps[0], range.start, range.end); int subclassMode = fetch.getSubclassFetchMode((ClassMapping) base); DBDictionary dict = _store.getDBDictionary(); - long start = (mappings.length == 1 && dict.supportsSelectStartIndex) + long start = (mappings.length == 1 && dict.supportsSelectStartIndex) ? range.start : 0L; long end = (dict.supportsSelectEndIndex) ? range.end : Long.MAX_VALUE; @@ -199,7 +199,7 @@ public class JDBCStoreQuery // we might want to use lrs settings if we can't use the range if (sels.size() > 1) start = 0L; - boolean lrs = range.lrs || (fetch.getFetchBatchSize() >= 0 + boolean lrs = range.lrs || (fetch.getFetchBatchSize() >= 0 && (start != range.start || end != range.end)); ResultObjectProvider[] rops = null; @@ -243,7 +243,7 @@ public class JDBCStoreQuery } // need to fake result range? - if ((rops != null && range.end != Long.MAX_VALUE) + if ((rops != null && range.end != Long.MAX_VALUE) || start != range.start || end != range.end) rop = new RangeResultObjectProvider(rop, range.start, range.end); @@ -300,7 +300,7 @@ public class JDBCStoreQuery * Execute the given union. */ private ResultObjectProvider executeUnion(Union union, - ClassMapping[] mappings, QueryExpressions[] exps, + ClassMapping[] mappings, QueryExpressions[] exps, QueryExpressionsState[] states, ExpContext ctx, BitSet[] paged) { if (exps[0].projections.length > 0) return new ProjectionResultObjectProvider(union, exps, states, ctx); @@ -319,14 +319,14 @@ public class JDBCStoreQuery * Execute the given select. */ private ResultObjectProvider executeSelect(Select sel, ClassMapping mapping, - QueryExpressions exps, QueryExpressionsState state, ExpContext ctx, + QueryExpressions exps, QueryExpressionsState state, ExpContext ctx, BitSet paged, long start, long end) { if (exps.projections.length > 0) return new ProjectionResultObjectProvider(sel, exps, state, ctx); if (paged != null) - return new PagingResultObjectProvider(sel, mapping, _store, + return new PagingResultObjectProvider(sel, mapping, _store, ctx.fetch, paged, end - start); - return new InstanceResultObjectProvider(sel, mapping, _store, + return new InstanceResultObjectProvider(sel, mapping, _store, ctx.fetch); } @@ -362,13 +362,13 @@ public class JDBCStoreQuery sel.setExpectedResultCount(optHint.intValue(), true); else if (this.ctx.isUnique()) sel.setExpectedResultCount(1, false); - + List selectFrom = getJoinedTableMeta(sel); int size = 0; if (selectFrom != null) { size = selectFrom.size(); for (int j = 0; j < size; j++) { - ClassMapping vert = (ClassMapping)selectFrom.get(j); + ClassMapping vert = (ClassMapping)selectFrom.get(j); selMappings.add(vert); if (j == size - 1) { nextBits.set(sels.size()); @@ -390,7 +390,7 @@ public class JDBCStoreQuery sels.add(sel.fullClone(1)); } } - + // turn off unioning if a given independent mapping requires // multiple selects, or if we're using FROM selects if (verts.length > 1 || size > 1 || sel.getFromSelect() != null) @@ -398,7 +398,7 @@ public class JDBCStoreQuery } return unionable; } - + private List getJoinedTableMeta(Select sel) { List selectFrom = sel.getJoinedTableClassMeta(); List exSelectFrom = sel.getExcludedJoinedTableClassMeta(); @@ -505,7 +505,7 @@ public class JDBCStoreQuery for (int i = 0; i < exps.length; i++) ctxs[i] = exps[i].ctx(); localContext.set(clone(ctxs, null)); - + // we cannot execute a bulk delete statement when have mappings in // multiple tables, so indicate we want to use in-memory with null ClassMapping[] mappings = (ClassMapping[]) metas; @@ -528,7 +528,7 @@ public class JDBCStoreQuery } } - JDBCFetchConfiguration fetch = (JDBCFetchConfiguration) + JDBCFetchConfiguration fetch = (JDBCFetchConfiguration) ctx.getFetchConfiguration(); ExpContext ctx = new ExpContext(_store, params, fetch); DBDictionary dict = _store.getDBDictionary(); @@ -543,8 +543,8 @@ public class JDBCStoreQuery jdbcFactory = (JDBCExpressionFactory) facts[i]; sel = jdbcFactory.getSelectConstructor().evaluate(ctx, null, null, exps[i], state[i]); - jdbcFactory.getSelectConstructor().select(sel, ctx, mappings[i], - subclasses, exps[i], state[i], + jdbcFactory.getSelectConstructor().select(sel, ctx, mappings[i], + subclasses, exps[i], state[i], JDBCFetchConfiguration.EAGER_NONE); // The bulk operation will return null to indicate that the database @@ -575,7 +575,7 @@ public class JDBCStoreQuery dict.setTimeouts(stmnt, fetch, true); count += executeUpdate(conn, stmnt, sql[i], isUpdate); } catch (SQLException se) { - throw SQLExceptions.getStore(se, sql[i].getSQL(), + throw SQLExceptions.getStore(se, sql[i].getSQL(), _store.getDBDictionary()); } finally { if (stmnt != null) @@ -583,11 +583,11 @@ public class JDBCStoreQuery } } } finally { - try { + try { if (conn.getAutoCommit()) - conn.close(); + conn.close(); } catch (SQLException se) { - + } } @@ -650,7 +650,7 @@ public class JDBCStoreQuery * returns INVALID. Also returns INVALID if field is dependent. */ private Table getTable(FieldMapping fm, Table table) { - if (fm.getCascadeDelete() != ValueMetaData.CASCADE_NONE + if (fm.getCascadeDelete() != ValueMetaData.CASCADE_NONE && !fm.isEmbeddedPC()) return INVALID; @@ -693,7 +693,7 @@ public class JDBCStoreQuery eager = Math.min(eager, JDBCFetchConfiguration.EAGER_JOIN); int subclassMode = fetch.getSubclassFetchMode((ClassMapping) base); DBDictionary dict = _store.getDBDictionary(); - long start = (mappings.length == 1 && dict.supportsSelectStartIndex) + long start = (mappings.length == 1 && dict.supportsSelectStartIndex) ? range.start : 0L; long end = (dict.supportsSelectEndIndex) ? range.end : Long.MAX_VALUE; @@ -708,7 +708,7 @@ public class JDBCStoreQuery BitSet subclassBits = new BitSet(); BitSet nextBits = new BitSet(); boolean unionable = createWhereSelects(sels, mappings, selMappings, - subclasses, subclassBits, nextBits, facts, exps, states, ctx, + subclasses, subclassBits, nextBits, facts, exps, states, ctx, subclassMode) && subclassMode == JDBCFetchConfiguration.EAGER_JOIN; if (sels.size() > 1) start = 0L; @@ -740,32 +740,32 @@ public class JDBCStoreQuery localContext.remove(); return sql; } - + /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of executing update. */ - protected int executeUpdate(Connection conn, PreparedStatement stmnt, + protected int executeUpdate(Connection conn, PreparedStatement stmnt, SQLBuffer sqlBuf, boolean isUpdate) throws SQLException { return stmnt.executeUpdate(); } - + /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of preparing statement. */ protected PreparedStatement prepareStatement(Connection conn, SQLBuffer sql) throws SQLException { return sql.prepareStatement(conn); - } + } - public Object evaluate(Object value, Object ob, Object[] params, + public Object evaluate(Object value, Object ob, Object[] params, OpenJPAStateManager sm) { int id = 0; if (value instanceof org.apache.openjpa.jdbc.kernel.exps.Val) id = ((org.apache.openjpa.jdbc.kernel.exps.Val)value).getId(); else - throw new UnsupportedException(); + throw new UnsupportedException(); switch(id) { case Val.MATH_VAL: @@ -790,12 +790,12 @@ public class JDBCStoreQuery return handleAbsVal(value, ob, params, sm); case Val.SQRT_VAL: return handleSqrtVal(value, ob, params, sm); - default: + default: throw new UnsupportedException(); } } - private Object handleMathVal(Object value, Object ob, Object[] params, + private Object handleMathVal(Object value, Object ob, Object[] params, OpenJPAStateManager sm) { org.apache.openjpa.jdbc.kernel.exps.Math mathVal = (org.apache.openjpa.jdbc.kernel.exps.Math) value; @@ -808,18 +808,18 @@ public class JDBCStoreQuery Class c2 = value2.getType(); String op = mathVal.getOperation(); - if (op.equals(org.apache.openjpa.jdbc.kernel.exps.Math.ADD)) + if (op.equals(org.apache.openjpa.jdbc.kernel.exps.Math.ADD)) return Filters.add(val1, c1, val2, c2); else if (op.equals( org.apache.openjpa.jdbc.kernel.exps.Math.SUBTRACT)) return Filters.subtract(val1, c1, val2, c2); else if (op.equals( - org.apache.openjpa.jdbc.kernel.exps.Math.MULTIPLY)) + org.apache.openjpa.jdbc.kernel.exps.Math.MULTIPLY)) return Filters.multiply(val1, c1, val2, c2); else if (op.equals( - org.apache.openjpa.jdbc.kernel.exps.Math.DIVIDE)) + org.apache.openjpa.jdbc.kernel.exps.Math.DIVIDE)) return Filters.divide(val1, c1, val2, c2); - else if (op.equals(org.apache.openjpa.jdbc.kernel.exps.Math.MOD)) + else if (op.equals(org.apache.openjpa.jdbc.kernel.exps.Math.MOD)) return Filters.mod(val1, c1, val2, c2); throw new UnsupportedException(); } @@ -846,7 +846,7 @@ public class JDBCStoreQuery Val value2 = substrVal.getVal2(); Object val2 = getValue(value2, ob, params, sm); - org.apache.openjpa.kernel.exps.Value[] valAry2 = + org.apache.openjpa.kernel.exps.Value[] valAry2 = (org.apache.openjpa.kernel.exps.Value[]) val2; Object arg1 = getValue(valAry2[0], ob, params, sm); //starting pos Object arg2 = getValue(valAry2[1], ob, params, sm); // length @@ -856,40 +856,40 @@ public class JDBCStoreQuery return val1.substring(startIdx, endIdx); } - private Object handleArgsVal(Object value, Object ob, Object[] params, + private Object handleArgsVal(Object value, Object ob, Object[] params, OpenJPAStateManager sm) { - org.apache.openjpa.jdbc.kernel.exps.Args argsVal = + org.apache.openjpa.jdbc.kernel.exps.Args argsVal = (org.apache.openjpa.jdbc.kernel.exps.Args) value; return argsVal.getValues(); } - private Object handleLowerVal(Object value, Object ob, Object[] params, + private Object handleLowerVal(Object value, Object ob, Object[] params, OpenJPAStateManager sm) { - org.apache.openjpa.jdbc.kernel.exps.ToLowerCase lowerVal = + org.apache.openjpa.jdbc.kernel.exps.ToLowerCase lowerVal = (org.apache.openjpa.jdbc.kernel.exps.ToLowerCase) value; Val val = lowerVal.getValue(); return ((String) getValue(val, ob, params, sm)).toLowerCase(); } - private Object handleUpperVal(Object value, Object ob, Object[] params, + private Object handleUpperVal(Object value, Object ob, Object[] params, OpenJPAStateManager sm){ - org.apache.openjpa.jdbc.kernel.exps.ToUpperCase upperVal = + org.apache.openjpa.jdbc.kernel.exps.ToUpperCase upperVal = (org.apache.openjpa.jdbc.kernel.exps.ToUpperCase) value; Val val = upperVal.getValue(); return ((String) getValue(val, ob, params, sm)).toUpperCase(); } - private Object handleLengthVal(Object value, Object ob, Object[] params, + private Object handleLengthVal(Object value, Object ob, Object[] params, OpenJPAStateManager sm){ - org.apache.openjpa.jdbc.kernel.exps.StringLength strLenVal = + org.apache.openjpa.jdbc.kernel.exps.StringLength strLenVal = (org.apache.openjpa.jdbc.kernel.exps.StringLength) value; Val val = strLenVal.getValue(); return ((String) getValue(val, ob, params, sm)).length(); } - private Object handleTrimVal(Object value, Object ob, Object[] params, + private Object handleTrimVal(Object value, Object ob, Object[] params, OpenJPAStateManager sm) { - org.apache.openjpa.jdbc.kernel.exps.Trim trimVal = + org.apache.openjpa.jdbc.kernel.exps.Trim trimVal = (org.apache.openjpa.jdbc.kernel.exps.Trim) value; Val val = trimVal.getVal(); String valStr = (String) getValue(val, ob, params, sm); @@ -932,7 +932,7 @@ public class JDBCStoreQuery private Object handleIndexOfVal(Object value, Object ob, Object[] params, OpenJPAStateManager sm) { - org.apache.openjpa.jdbc.kernel.exps.IndexOf locateVal = + org.apache.openjpa.jdbc.kernel.exps.IndexOf locateVal = (org.apache.openjpa.jdbc.kernel.exps.IndexOf) value; String val1 = (String) getValue(locateVal.getVal1(), ob, params, sm); Val[] val2 = (Val[]) getValue(locateVal.getVal2(), ob, params, sm); @@ -941,9 +941,9 @@ public class JDBCStoreQuery return strVal.indexOf(val1, idx); } - private Object handleAbsVal(Object value, Object ob, Object[] params, + private Object handleAbsVal(Object value, Object ob, Object[] params, OpenJPAStateManager sm) { - org.apache.openjpa.jdbc.kernel.exps.Abs absVal = + org.apache.openjpa.jdbc.kernel.exps.Abs absVal = (org.apache.openjpa.jdbc.kernel.exps.Abs) value; Object val = getValue(absVal.getValue(), ob, params, sm); Class c = val.getClass(); @@ -958,9 +958,9 @@ public class JDBCStoreQuery throw new UnsupportedException(); } - private Object handleSqrtVal(Object value, Object ob, Object[] params, + private Object handleSqrtVal(Object value, Object ob, Object[] params, OpenJPAStateManager sm) { - org.apache.openjpa.jdbc.kernel.exps.Sqrt sqrtVal = + org.apache.openjpa.jdbc.kernel.exps.Sqrt sqrtVal = (org.apache.openjpa.jdbc.kernel.exps.Sqrt) value; Object val = getValue(sqrtVal.getValue(), ob, params, sm); Class c = val.getClass(); @@ -973,7 +973,7 @@ public class JDBCStoreQuery else if (c == Long.class) return Double.valueOf(java.lang.Math.sqrt(((Long) val).doubleValue())); throw new UnsupportedException(); - } + } private Object getValue(Object value, Object ob, Object[] params, OpenJPAStateManager sm) { @@ -1109,10 +1109,10 @@ public class JDBCStoreQuery newCtx.subquery = orig.subquery; List subsels = orig.getSubselContexts(); if (subsels != null) { - for (Context subsel : subsels) + for (Context subsel : subsels) newCtx.addSubselContext(clone(subsel, newCtx)); } - return newCtx; + return newCtx; } } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/LRSSizes.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/LRSSizes.java index d1917479d..d88830d9b 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/LRSSizes.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/LRSSizes.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/MappedQueryResultObjectProvider.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/MappedQueryResultObjectProvider.java index 562e7f554..f56930ee5 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/MappedQueryResultObjectProvider.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/MappedQueryResultObjectProvider.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -404,12 +404,12 @@ class MappedQueryResultObjectProvider return _res.getLong((Column) obj, joins); return _res.getLong(obj); } - + /* * OPENJPA-2651: Added to allow the column to be translated (from the * actual column name to the name provided in an @SqlResultSetMapping/@FieldResult. - * - * (non-Javadoc) + * + * (non-Javadoc) * @see org.apache.openjpa.jdbc.sql.AbstractResult#getObject(org.apache. * openjpa.jdbc.schema.Column, java.lang.Object, org.apache.openjpa.jdbc.sql.Joins) */ @@ -428,10 +428,10 @@ class MappedQueryResultObjectProvider if (resultCol != null) { int javaType = col.getJavaType(); col = new Column(DBIdentifier.newColumn(resultCol.toString()), col.getTable()); - col.setJavaType(javaType); + col.setJavaType(javaType); } return _res.getObject(col, arg, joins); - } + } return _res.getObject(obj, metaTypeCode, arg); } @@ -448,7 +448,7 @@ class MappedQueryResultObjectProvider return _res.getObject((Column) obj, arg, joins); return _res.getObject(obj, metaTypeCode, arg); } - + protected Ref getRefInternal(Object obj, Map map, Joins joins) throws SQLException { if (obj instanceof Column) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/MixedLockManager.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/MixedLockManager.java index 690701640..c985ade2b 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/MixedLockManager.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/MixedLockManager.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -52,7 +52,7 @@ public class MixedLockManager extends PessimisticLockManager { * #selectForUpdate(org.apache.openjpa.jdbc.sql.Select,int) */ public boolean selectForUpdate(Select sel, int lockLevel) { - return (lockLevel >= MixedLockLevels.LOCK_PESSIMISTIC_READ) + return (lockLevel >= MixedLockLevels.LOCK_PESSIMISTIC_READ) ? super.selectForUpdate(sel, lockLevel) : false; } @@ -83,7 +83,7 @@ public class MixedLockManager extends PessimisticLockManager { protected List getLockRows(DBDictionary dict, Object id, ClassMapping mapping, JDBCFetchConfiguration fetch, SQLFactory factory) { List sqls = super.getLockRows(dict, id, mapping, fetch, factory); - // + // if(!dict.supportsLockingWithMultipleTables) { // look for columns mapped to secondary tables which need to be locked FieldMapping fms[] = mapping.getFieldMappings(); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/NativeJDBCSeq.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/NativeJDBCSeq.java index 11703f96d..92cd10891 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/NativeJDBCSeq.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/NativeJDBCSeq.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -167,7 +167,7 @@ public class NativeJDBCSeq public JDBCConfiguration getConfiguration() { return _conf; } - + public void setConfiguration(Configuration conf) { _conf = (JDBCConfiguration) conf; } @@ -188,10 +188,10 @@ public class NativeJDBCSeq // Increment step is needed for Firebird which uses non-standard sequence fetch syntax. // Use String.valueOf to get rid of possible locale-specific number formatting. _select = MessageFormat.format(format, new Object[]{name, String.valueOf(_allocate * _increment)}); - + type = dict.nativeSequenceType; } - + @Override protected synchronized Object nextInternal(JDBCStore store, ClassMapping mapping) throws SQLException { @@ -209,7 +209,7 @@ public class NativeJDBCSeq /** * Allocate additional sequence values. - * @param additional ignored - the allocation size is fixed and determined by allocate and increment properties. + * @param additional ignored - the allocation size is fixed and determined by allocate and increment properties. * @param store used to obtain connection * @param mapping ignored */ @@ -242,7 +242,7 @@ public class NativeJDBCSeq } } - alreadyLoggedAlterSeqDisabled = true; + alreadyLoggedAlterSeqDisabled = true; } } _nextValue = getSequence(conn); @@ -258,10 +258,10 @@ public class NativeJDBCSeq private void buildSequence() { QualifiedDBIdentifier path = QualifiedDBIdentifier.getPath(_seqName); DBIdentifier seqName = path.getIdentifier(); - // JPA 2 added schema as a configurable attribute on + // JPA 2 added schema as a configurable attribute on // sequence generator. OpenJPA <= 1.x allowed this via // schema.sequence on the sequence name. Specifying a schema - // name on the annotation or in the orm will override the old + // name on the annotation or in the orm will override the old // behavior. DBIdentifier schemaName = _schema; if (DBIdentifier.isEmpty(schemaName)) { diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/OperationOrderUpdateManager.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/OperationOrderUpdateManager.java index 1059d613b..7009d974a 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/OperationOrderUpdateManager.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/OperationOrderUpdateManager.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PagingResultObjectProvider.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PagingResultObjectProvider.java index a47af91d8..0bdfbf0a1 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PagingResultObjectProvider.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PagingResultObjectProvider.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -392,7 +392,7 @@ public class PagingResultObjectProvider /** * Based on the DBDictionary, create the needed IN clauses. */ - private void createInContains(Select sel, DBDictionary dict, SQLBuffer buf, + private void createInContains(Select sel, DBDictionary dict, SQLBuffer buf, ClassMapping mapping, Column[] pks, int start, int end) { int inClauseLimit = dict.inClauseLimit; if (inClauseLimit <= 0 || end - start <= inClauseLimit) @@ -408,7 +408,7 @@ public class PagingResultObjectProvider buf.append(")"); } } - + /** * Create an IN clause limiting the results to the current page. */ diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java index 99dff9be5..3e0e7ab60 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -103,7 +103,7 @@ public class PessimisticLockManager Object sdata, boolean postVersionCheck) { // we can skip any already-locked instance regardless of level because // we treat all locks the same (though super doesn't). - + // only need to lock if not loaded from locking result ConnectionInfo info = (ConnectionInfo) sdata; if (info == null || info.result == null || !info.result.isLocking()) @@ -129,9 +129,9 @@ public class PessimisticLockManager ClassMapping mapping = (ClassMapping) sm.getMetaData(); //Code changed for OPENJPA-2449, code updated for OPENJPA-2547. OPENJPA-2547 added - //one check to determine if the lock is a value of LockLevels.LOCK_NONE. The first - //time a thread attempts to get a lock the lock will be null. If the thread can't - //get the lock because another thread holds it, the lock will be non-null and have + //one check to determine if the lock is a value of LockLevels.LOCK_NONE. The first + //time a thread attempts to get a lock the lock will be null. If the thread can't + //get the lock because another thread holds it, the lock will be non-null and have //a value of LockLevels.LOCK_NONE. List sqls = (sm.getLock() == null || sm.getLock().equals(LockLevels.LOCK_NONE)) ? getLockRows(dict, id, mapping, fetch, _store.getSQLFactory()) @@ -153,7 +153,7 @@ public class PessimisticLockManager } catch (SQLException se) { LockException e = new LockException(sm.getPersistenceCapable(), timeout, level); e.setCause(se); - e.setFatal(dict.isFatalException(StoreException.LOCK, se) + e.setFatal(dict.isFatalException(StoreException.LOCK, se) || level >= MixedLockLevels.LOCK_PESSIMISTIC_READ); throw e; } finally { @@ -177,7 +177,7 @@ public class PessimisticLockManager sqls.add(select.toSelect(true, fetch)); return sqls; } - + protected void lockJoinTables(List sqls, DBDictionary dict, Object id, ClassMapping mapping, JDBCFetchConfiguration fetch, SQLFactory factory) { FieldMapping[] fms = mapping.getFieldMappings(); @@ -206,35 +206,35 @@ public class PessimisticLockManager log.trace(_loc.get("start-trans-for-lock")); } } - + public JDBCStore getStore() { return _store; } - + /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of preparing statement. */ protected PreparedStatement prepareStatement(Connection conn, SQLBuffer sql) throws SQLException { return sql.prepareStatement(conn); } - + /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of executing query. */ - protected ResultSet executeQuery(Connection conn, PreparedStatement stmnt, + protected ResultSet executeQuery(Connection conn, PreparedStatement stmnt, SQLBuffer sql) throws SQLException { return stmnt.executeQuery(); } - + /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of checking lock from the result set. */ protected void checkLock(ResultSet rs, OpenJPAStateManager sm, int timeout) - throws SQLException { + throws SQLException { if (!rs.next()) throw new LockException(sm.getManagedInstance(), timeout); return; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedProjectionResultObjectProvider.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedProjectionResultObjectProvider.java index 93e640da0..254c45d2e 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedProjectionResultObjectProvider.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedProjectionResultObjectProvider.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -34,13 +34,13 @@ import org.apache.openjpa.kernel.exps.QueryExpressions; class PreparedProjectionResultObjectProvider extends ProjectionResultObjectProvider { - public PreparedProjectionResultObjectProvider(SelectExecutor sel, + public PreparedProjectionResultObjectProvider(SelectExecutor sel, QueryExpressions exps, QueryExpressionsState state, ExpContext ctx, Result res) { super(sel, exps, state, ctx); _res = res; } - public PreparedProjectionResultObjectProvider(SelectExecutor sel, + public PreparedProjectionResultObjectProvider(SelectExecutor sel, QueryExpressions[] exps, QueryExpressionsState[] state, ExpContext ctx, Result res){ super(sel, exps, state, ctx); _res = res; @@ -49,7 +49,7 @@ class PreparedProjectionResultObjectProvider public Result getResult() { return _res; } - + public void open() throws SQLException { // do nothing } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryCacheImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryCacheImpl.java index fe1ec2a73..854789741 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryCacheImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryCacheImpl.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -43,16 +43,16 @@ import org.apache.openjpa.lib.util.Localizer; import org.apache.openjpa.util.CacheMap; /** - * An implementation of the cache of {@link PreparedQuery prepared queries}. - * + * An implementation of the cache of {@link PreparedQuery prepared queries}. + * * @author Pinaki Poddar * * @since 2.0.0 - * + * */ public class PreparedQueryCacheImpl implements PreparedQueryCache { private static final String PATTERN_SEPARATOR = "\\;"; - // Key: Query identifier + // Key: Query identifier private final Map _delegate; // Key: Query identifier Value: Reason why excluded private final Map _uncachables; @@ -64,21 +64,21 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { private Lock _readLock; private Log _log; private static Localizer _loc = Localizer.forPackage(PreparedQueryCacheImpl.class); - + public PreparedQueryCacheImpl() { _delegate = new CacheMap(); _uncachables = new CacheMap(); _exclusionPatterns = new ArrayList(); - + ReentrantReadWriteLock _rwl = new ReentrantReadWriteLock(); _writeLock = _rwl.writeLock(); _readLock = _rwl.readLock(); } - + public Boolean register(String id, Query query, FetchConfiguration hints) { - if (id == null - || query == null - || QueryLanguages.LANG_SQL.equals(query.getLanguage()) + if (id == null + || query == null + || QueryLanguages.LANG_SQL.equals(query.getLanguage()) || QueryLanguages.LANG_METHODQL.equals(query.getLanguage()) || isHinted(hints, QueryHints.HINT_IGNORE_PREPARED_QUERY) || isHinted(hints, QueryHints.HINT_INVALIDATE_PREPARED_QUERY)) @@ -88,11 +88,11 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { PreparedQuery cached = get(id); if (cached != null) return null; // implies that it is already cached - - PreparedQuery newEntry = new PreparedQueryImpl(id, query); + + PreparedQuery newEntry = new PreparedQueryImpl(id, query); return cache(newEntry); } - + public Map getMapView() { lock(false); try { @@ -104,7 +104,7 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { unlock(false); } } - + /** * Cache the given query keyed by its identifier. Does not cache if the * identifier matches any exclusion pattern or has been marked as @@ -140,20 +140,20 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { unlock(false); } } - + public PreparedQuery initialize(String key, Object result) { PreparedQuery pq = get(key); if (pq == null) return null; - + Exclusion exclusion = pq.initialize(result); if (exclusion != null) { markUncachable(key, exclusion); return null; - } + } return pq; } - + public boolean invalidate(String id) { lock(false); try { @@ -168,7 +168,7 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { unlock(false); } } - + public PreparedQuery get(String id) { lock(true); try { @@ -177,7 +177,7 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { unlock(true); } } - + public Boolean isCachable(String id) { lock(true); try { @@ -190,12 +190,12 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { unlock(true); } } - + public PreparedQuery markUncachable(String id, Exclusion exclusion) { lock(false); try { if (_uncachables.put(id, exclusion) == null) { - if (_log != null && _log.isTraceEnabled()) + if (_log != null && _log.isTraceEnabled()) _log.trace(_loc.get("prepared-query-uncache", id, exclusion)); } PreparedQuery pq = _delegate.remove(id); @@ -207,11 +207,11 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { unlock(false); } } - + public Exclusion isExcluded(String id) { return getMatchedExclusionPattern(id); } - + public void setExcludes(String excludes) { lock(false); try { @@ -228,7 +228,7 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { public List getExcludes() { return Collections.unmodifiableList(_exclusionPatterns); } - + /** * Adds a pattern for exclusion. Any query cached currently whose identifier * matches the given pattern will be marked invalidated as a side-effect. @@ -248,9 +248,9 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { unlock(false); } } - + /** - * Removes a pattern for exclusion. Any query identifier marked as not + * Removes a pattern for exclusion. Any query identifier marked as not * cachable due to the given pattern will now be removed from the list of * uncachables as a side-effect. */ @@ -269,11 +269,11 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { unlock(false); } } - + public QueryStatistics getStatistics() { return _stats; } - + /** * Gets the pattern that matches the given identifier. */ @@ -283,9 +283,9 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { return pattern; return null; } - + /** - * Gets the keys of the given map whose values match the given pattern. + * Gets the keys of the given map whose values match the given pattern. */ private Collection getMatchedKeys(String pattern, Map map) { List result = new ArrayList(); @@ -297,9 +297,9 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { } return result; } - + /** - * Gets the elements of the given list which match the given pattern. + * Gets the elements of the given list which match the given pattern. */ private Collection getMatchedKeys(String pattern, Collection coll) { List result = new ArrayList(); @@ -314,7 +314,7 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { /** * Note: Care needs to be taken so that a read lock is never held while requesting a write lock. This will * result in a deadlock. - * + * * @param readOnly * - If true, a read lock will be acquired. Else a write lock will be acquired. */ @@ -337,28 +337,28 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { _writeLock.unlock(); } } - + boolean matches(String pattern, String target) { - return target != null && (target.equals(pattern) + return target != null && (target.equals(pattern) || target.matches(pattern)); } - + boolean isHinted(FetchConfiguration fetch, String hint) { if (fetch == null) return false; Object result = fetch.getHint(hint); return result != null && "true".equalsIgnoreCase(result.toString()); } - + public void clear() { _delegate.clear(); _stats.clear(); } - + public void setEnableStatistics(boolean enable){ _statsEnabled = enable; } - + public boolean getEnableStatistics(){ return _statsEnabled; } @@ -385,7 +385,7 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { _stats = _statsEnabled ? new QueryStatistics.Default() : new QueryStatistics.None(); } - + /** * An immutable abstract pattern for exclusion. * @@ -394,11 +394,11 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { private final boolean _strong; private final String _pattern; private final String _reason; - + private static Localizer _loc = Localizer.forPackage(PreparedQueryCacheImpl.class); private static String STRONG = _loc.get("strong-exclusion").getMessage(); private static String WEAK = _loc.get("weak-exclusion").getMessage(); - + public ExclusionPattern(boolean strong, String pattern, String reason) { super(); this._strong = strong; @@ -421,7 +421,7 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { public boolean matches(String id) { return _pattern != null && (_pattern.equals(id) || _pattern.matches(id)); } - + /** * Equals by strength and pattern (not by reason). */ @@ -432,16 +432,16 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { if (!(other instanceof Exclusion)) return false; Exclusion that = (Exclusion)other; - return this._strong == that.isStrong() + return this._strong == that.isStrong() && Objects.equals(this._pattern, that.getPattern()); } - + @Override public int hashCode() { - return (_strong ? 1 : 0) + return (_strong ? 1 : 0) + (_pattern == null ? 0 : _pattern.hashCode()); } - + public String toString() { StringBuilder buf = new StringBuilder(); buf.append(" ").append(_strong ? STRONG : WEAK).append(". "); @@ -450,7 +450,7 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { return buf.toString(); } } - + /** * Strong exclusion. * @@ -461,7 +461,7 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { super(true, pattern, reason); } } - + /** * Weak exclusion. * diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java index e94531ff7..44d994025 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -58,23 +58,23 @@ import org.apache.openjpa.util.UserException; * Implements {@link PreparedQuery} for SQL queries. * PreparedQuery holds the post-compilation and post-execution state of a kernel Query. * The post-execution internal state of a query is appended as a user object - * to the user-visible result to maintain the API contract. - * + * to the user-visible result to maintain the API contract. + * * @author Pinaki Poddar * */ public class PreparedQueryImpl implements PreparedQuery { - private static Localizer _loc = + private static Localizer _loc = Localizer.forPackage(PreparedQueryImpl.class); private final String _id; private String _sql; private boolean _initialized; - + // Post-compilation state of an executable query, populated on construction private Class _candidate; private boolean _subclasses; - + // post-execution state of a query private QueryExpressions[] _exps; private Class[] _projTypes; @@ -86,20 +86,20 @@ public class PreparedQueryImpl implements PreparedQuery { /** * Construct. - * + * * @param id an identifier for this query to be used as cache key - * @param compiled a compiled query + * @param compiled a compiled query */ public PreparedQueryImpl(String id, Query compiled) { this(id, null, compiled); } - + /** * Construct. - * + * * @param id an identifier for this query to be used as cache key - * @param corresponding data store language query string - * @param compiled a compiled query + * @param corresponding data store language query string + * @param compiled a compiled query */ public PreparedQueryImpl(String id, String sql, Query compiled) { this._id = id; @@ -109,43 +109,43 @@ public class PreparedQueryImpl implements PreparedQuery { _subclasses = compiled.hasSubclasses(); } } - + public String getIdentifier() { return _id; } - + public String getLanguage() { return QueryLanguages.LANG_PREPARED_SQL; } - + /** - * Get the original query string which is same as the identifier of this + * Get the original query string which is same as the identifier of this * receiver. */ public String getOriginalQuery() { return getIdentifier(); } - + public String getTargetQuery() { return _sql; } - + void setTargetQuery(String sql) { _sql = sql; } - + public boolean isInitialized() { return _initialized; } - + public QueryExpressions[] getQueryExpressions() { return _exps; } - + public Class[] getProjectionTypes() { return _projTypes; } - + /** * Pours the post-compilation state held by this receiver to the given * query. @@ -159,10 +159,10 @@ public class PreparedQueryImpl implements PreparedQuery { * Initialize this receiver with post-execution result. * The input argument is processed only if it is a {@link ResultList} with * an attached {@link SelectResultObjectProvider} as its - * {@link ResultList#getUserObject() user object}. - * - * @return an exclusion if can not be initialized for some reason. - * null if initialization is successful. + * {@link ResultList#getUserObject() user object}. + * + * @return an exclusion if can not be initialized for some reason. + * null if initialization is successful. */ public Exclusion initialize(Object result) { if (isInitialized()) @@ -172,7 +172,7 @@ public class PreparedQueryImpl implements PreparedQuery { if (selector == null) return new PreparedQueryCacheImpl.StrongExclusion(_id, ((Localizer.Message)extract[1]).getMessage()); if (selector == null || selector.hasMultipleSelects() - || ((selector instanceof Union) + || ((selector instanceof Union) && (((Union)selector).getSelects().length != 1))) return new PreparedQueryCacheImpl.StrongExclusion(_id, _loc.get("exclude-multi-select", _id).getMessage()); select = extractImplementation(selector); @@ -182,25 +182,25 @@ public class PreparedQueryImpl implements PreparedQuery { if (buffer == null) return new PreparedQueryCacheImpl.StrongExclusion(_id, _loc.get("exclude-no-sql", _id).getMessage());; if (isUsingFieldStrategy()) - return new PreparedQueryCacheImpl.StrongExclusion(_id, + return new PreparedQueryCacheImpl.StrongExclusion(_id, _loc.get("exclude-user-strategy", _id).getMessage());; - + if (isPaginated()) - return new PreparedQueryCacheImpl.StrongExclusion(_id, + return new PreparedQueryCacheImpl.StrongExclusion(_id, _loc.get("exclude-pagination", _id).getMessage());; setTargetQuery(buffer.getSQL()); setParameters(buffer.getParameters()); setUserParameterPositions(buffer.getUserParameters()); _initialized = true; - + return null; } - + /** * Extract the underlying SelectExecutor from the given argument, if possible. - * - * @return two objects in an array. The element at index 0 is SelectExecutor, + * + * @return two objects in an array. The element at index 0 is SelectExecutor, * if it can be extracted. The element at index 1 is the reason why it can * not be extracted. */ @@ -239,23 +239,23 @@ public class PreparedQueryImpl implements PreparedQuery { } if (provider instanceof SelectResultObjectProvider) { return new Object[]{((SelectResultObjectProvider)provider).getSelect(), null}; - } + } return new Object[]{null, _loc.get("exclude-not-select-rop", _id, provider.getClass().getName())}; } - + private SelectImpl extractImplementation(SelectExecutor selector) { if (selector == null) return null; - if (selector instanceof SelectImpl) + if (selector instanceof SelectImpl) return (SelectImpl)selector; if (selector instanceof LogicalUnion.UnionSelect) return ((LogicalUnion.UnionSelect)selector).getDelegate(); - if (selector instanceof Union) + if (selector instanceof Union) return extractImplementation(((Union)selector).getSelects()[0]); - + return null; } - + private boolean isUsingExternalizedParameter(QueryExpressions exp) { if (exp == null) return false; @@ -268,15 +268,15 @@ public class PreparedQueryImpl implements PreparedQuery { } return false; } - + private boolean isPaginated() { if (select instanceof SelectImpl) { - if (((SelectImpl)select).getStartIndex() != 0 || + if (((SelectImpl)select).getStartIndex() != 0 || ((SelectImpl)select).getEndIndex() != Long.MAX_VALUE) return true; } return false; - } + } private boolean isUsingFieldStrategy() { for (int i = 0; i < _exps.length; i++) { if (isUsingFieldStrategy(_exps[i])) { @@ -298,32 +298,32 @@ public class PreparedQueryImpl implements PreparedQuery { } return false; } - + /** * Merge the given user parameters with its own parameter. The given map - * must be compatible with the user parameters extracted during - * {@link #initialize(Object) initialization}. - * + * must be compatible with the user parameters extracted during + * {@link #initialize(Object) initialization}. + * * @return 0-based parameter index mapped to corresponding values. - * + * */ public Map reparametrize(Map user, Broker broker) { if (!isInitialized()) throw new InternalException("reparameterize() on uninitialized."); if (user == null || user.isEmpty()) { if (!_userParamPositions.isEmpty()) { - throw new UserException(_loc.get("uparam-null", + throw new UserException(_loc.get("uparam-null", _userParamPositions.keySet(), this)); } else { return _template; } } if (!_userParamPositions.keySet().equals(user.keySet())) { - throw new UserException(_loc.get("uparam-mismatch", + throw new UserException(_loc.get("uparam-mismatch", _userParamPositions.keySet(), user.keySet(), this)); } Map result = new HashMap(_template); - + Set> userSet = user.entrySet(); for (Map.Entry userEntry : userSet) { Object key = userEntry.getKey(); @@ -334,7 +334,7 @@ public class PreparedQueryImpl implements PreparedQuery { if (ImplHelper.isManageable(val)) { setPersistenceCapableParameter(result, val, indices, broker); } else if (val instanceof Collection) { - setCollectionValuedParameter(result, (Collection)val, indices, + setCollectionValuedParameter(result, (Collection)val, indices, key, broker); } else { for (int j : indices) { @@ -344,30 +344,30 @@ public class PreparedQueryImpl implements PreparedQuery { } else { val = ((Enum)val).name(); } - } + } result.put(j, val); } } } return result; } - + /** * Calculate primary key identity value(s) of the given manageable instance * and fill in the given map. - * + * * @param values a map of integer parameter index to parameter value * @param pc a manageable instance * @param indices the indices of the column values * @param broker used to obtain the primary key values */ - private void setPersistenceCapableParameter(Map result, + private void setPersistenceCapableParameter(Map result, Object pc, Integer[] indices, Broker broker) { JDBCStore store = (JDBCStore)broker.getStoreManager() .getInnermostDelegate(); MappingRepository repos = store.getConfiguration() .getMappingRepositoryInstance(); - ClassMapping mapping = repos.getMapping(pc.getClass(), + ClassMapping mapping = repos.getMapping(pc.getClass(), broker.getClassLoader(), true); Column[] pks = mapping.getPrimaryKeyColumns(); Object cols = mapping.toDataStoreValue(pc, pks, store); @@ -375,7 +375,7 @@ public class PreparedQueryImpl implements PreparedQuery { Object[] array = (Object[])cols; int n = array.length; if (n > indices.length || indices.length%n != 0) - throw new UserException(_loc.get("uparam-pc-key", + throw new UserException(_loc.get("uparam-pc-key", pc.getClass(), n, Arrays.toString(indices))); int k = 0; for (int j : indices) { @@ -386,15 +386,15 @@ public class PreparedQueryImpl implements PreparedQuery { for (int j : indices) { result.put(j, cols); } - } + } } - - private void setCollectionValuedParameter(Map result, + + private void setCollectionValuedParameter(Map result, Collection values, Integer[] indices, Object param, Broker broker) { int n = values.size(); Object[] array = values.toArray(); if (n == 0 || n > indices.length || indices.length%n != 0) { - throw new UserException(_loc.get("uparam-coll-size", param, values, + throw new UserException(_loc.get("uparam-coll-size", param, values, Arrays.toString(indices))); } int k = 0; @@ -406,12 +406,12 @@ public class PreparedQueryImpl implements PreparedQuery { result.put(j, val); k++; } - + } /** * Marks the positions and keys of user parameters. - * - * @param list even elements are numbers representing the position of a + * + * @param list even elements are numbers representing the position of a * user parameter in the _param list. Odd elements are the user parameter * key. A user parameter key may appear more than once. */ @@ -429,7 +429,7 @@ public class PreparedQueryImpl implements PreparedQuery { _userParamPositions.put(key, positions.toArray(new Integer[positions.size()])); } } - + void setParameters(List list) { Map tmp = new HashMap(); for (int i = 0; list != null && i < list.size(); i++) { @@ -437,13 +437,13 @@ public class PreparedQueryImpl implements PreparedQuery { } _template = Collections.unmodifiableMap(tmp); } - + SelectImpl getSelect() { return select; } - + public String toString() { - return "PreparedQuery: [" + getOriginalQuery() + "] --> [" + + return "PreparedQuery: [" + getOriginalQuery() + "] --> [" + getTargetQuery() + "]"; } } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedResultObjectProvider.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedResultObjectProvider.java index accf616c5..927b6a127 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedResultObjectProvider.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedResultObjectProvider.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -27,7 +27,7 @@ import org.apache.openjpa.jdbc.sql.SelectExecutor; /** * A Select-oriented Result Object Provider whose Select has been executed * outside its own scope. - * + * * @author Pinaki Poddar * */ @@ -41,12 +41,12 @@ public class PreparedResultObjectProvider extends InstanceResultObjectProvider { * @param res the result of the given select */ public PreparedResultObjectProvider(SelectExecutor sel, - ClassMapping mapping, JDBCStore store, JDBCFetchConfiguration fetch, + ClassMapping mapping, JDBCStore store, JDBCFetchConfiguration fetch, Result res) { super(sel, mapping, store, fetch); _res = res; } - + public void open() throws SQLException { // do nothing } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedSQLStoreQuery.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedSQLStoreQuery.java index 6d3b83d01..7b25d3fed 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedSQLStoreQuery.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedSQLStoreQuery.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -44,7 +44,7 @@ import org.apache.openjpa.util.InternalException; /** * A executor for Prepared SQL Query. - * + * * @author Pinaki Poddar * */ @@ -54,12 +54,12 @@ public class PreparedSQLStoreQuery extends SQLStoreQuery { public PreparedSQLStoreQuery(JDBCStore store) { super(store); } - + public Executor newDataStoreExecutor(ClassMetaData meta, boolean subclasses) { return new PreparedSQLExecutor(this, meta); } - + public boolean setQuery(Object query) { if (query instanceof PreparedQueryImpl == false) { throw new InternalException(query.getClass() + " not recognized"); @@ -67,7 +67,7 @@ public class PreparedSQLStoreQuery extends SQLStoreQuery { _cached = (PreparedQueryImpl)query; return true; } - + PreparedQueryImpl getPreparedQuery() { return _cached; } @@ -80,16 +80,16 @@ public class PreparedSQLStoreQuery extends SQLStoreQuery { public static class PreparedSQLExecutor extends AbstractExpressionExecutor { private final ClassMetaData _meta; private final PreparedSQLStoreQuery _query; - + public PreparedSQLExecutor(PreparedSQLStoreQuery q, ClassMetaData candidate) { _meta = candidate; _query = q; } - + public QueryExpressions[] getQueryExpressions() { return _query.getPreparedQuery().getQueryExpressions(); } - + public Class[] getProjectionTypes(StoreQuery q) { return _query.getPreparedQuery().getProjectionTypes(); } @@ -116,17 +116,17 @@ public class PreparedSQLStoreQuery extends SQLStoreQuery { dict.setTimeouts(stmnt, fetch, false); ResultSet rs = stmnt.executeQuery(); - + SelectImpl cachedSelect = pq.getSelect(); Result res = cachedSelect.getEagerResult(conn, stmnt, rs, store, fetch, false, null); - + if (getQueryExpressions()[0].projections.length > 0) { ExpContext ctx = new ExpContext(store, params, fetch); QueryExpressionsState state = (QueryExpressionsState)getQueryExpressions()[0].state; - rop = new PreparedProjectionResultObjectProvider(cachedSelect, getQueryExpressions(), + rop = new PreparedProjectionResultObjectProvider(cachedSelect, getQueryExpressions(), new QueryExpressionsState[]{state}, ctx, res); } else if (q.getContext().getCandidateType() != null) { - rop = new PreparedResultObjectProvider(cachedSelect, + rop = new PreparedResultObjectProvider(cachedSelect, (ClassMapping) _meta, store, fetch, res); } else { rop = new SQLProjectionResultObjectProvider(store, fetch, @@ -143,13 +143,13 @@ public class PreparedSQLStoreQuery extends SQLStoreQuery { rop = new RangeResultObjectProvider(rop, range.start,range.end); return rop; } - + /** - * Convert given userParams to an array whose ordering matches as + * Convert given userParams to an array whose ordering matches as * per expected during executeXXX() methods. * The given userParams is already re-parameterized, so this method have * to merely copy the given Map values. - * + * * @see PreparedQueryImpl#reparametrize(Map, org.apache.openjpa.kernel.Broker) */ public synchronized Object[] toParameterArray(StoreQuery q, Map userParams) { diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManager.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManager.java index ae53d835e..a36c95a28 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManager.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManager.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManagerImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManagerImpl.java index 2b641bc39..030b1ac69 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManagerImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManagerImpl.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -53,7 +53,7 @@ import org.apache.openjpa.util.OptimisticException; * * @author Abe White */ -public class PreparedStatementManagerImpl +public class PreparedStatementManagerImpl implements PreparedStatementManager { private final static Localizer _loc = Localizer @@ -101,7 +101,7 @@ public class PreparedStatementManagerImpl } /** - * Flush the given row immediately. + * Flush the given row immediately. */ protected void flushAndUpdate(RowImpl row) throws SQLException { @@ -151,11 +151,11 @@ public class PreparedStatementManagerImpl } } } - + private boolean hasGeneratedKey(ClassMapping meta) { FieldMapping[] pks = meta.getPrimaryKeyFieldMappings(); for (int i = 0; i < pks.length; i++) { - ClassMapping pkMeta = pks[i].getTypeMapping(); + ClassMapping pkMeta = pks[i].getTypeMapping(); if (pkMeta != null) { return hasGeneratedKey(pkMeta); } else if (pks[i].getValueStrategy() == ValueStrategies.AUTOASSIGN) @@ -164,14 +164,14 @@ public class PreparedStatementManagerImpl return false; } - /** + /** * This method will only be called when there is auto assign columns. * If database supports getGeneratedKeys, the keys will be obtained - * from the result set associated with the stmnt. If not, a separate - * sql to select the key will be issued from DBDictionary. + * from the result set associated with the stmnt. If not, a separate + * sql to select the key will be issued from DBDictionary. */ - protected List populateAutoAssignCols(PreparedStatement stmnt, - Column[] autoAssign, DBIdentifier[] autoAssignColNames, RowImpl row) + protected List populateAutoAssignCols(PreparedStatement stmnt, + Column[] autoAssign, DBIdentifier[] autoAssignColNames, RowImpl row) throws SQLException { List vals = null; if (_dict.supportsGetGeneratedKeys) { @@ -182,27 +182,27 @@ public class PreparedStatementManagerImpl return vals; } - protected List populateAutoAssignCols(PreparedStatement stmnt, - Column[] autoAssign, String[] autoAssignColNames, RowImpl row) + protected List populateAutoAssignCols(PreparedStatement stmnt, + Column[] autoAssign, String[] autoAssignColNames, RowImpl row) throws SQLException { - return populateAutoAssignCols(stmnt, autoAssign, + return populateAutoAssignCols(stmnt, autoAssign, DBIdentifier.toArray(autoAssignColNames, DBIdentifierType.COLUMN), row); } - + protected void setObjectId(List vals, Column[] autoAssign, - String[] autoAssignColNames, RowImpl row) + String[] autoAssignColNames, RowImpl row) throws SQLException{ setObjectId(vals, autoAssign, DBIdentifier.toArray(autoAssignColNames, DBIdentifierType.COLUMN), row); } - + protected void setObjectId(List vals, Column[] autoAssign, - DBIdentifier[] autoAssignColNames, RowImpl row) + DBIdentifier[] autoAssignColNames, RowImpl row) throws SQLException{ OpenJPAStateManager sm = row.getPrimaryKey(); ClassMapping mapping = (ClassMapping) sm.getMetaData(); Object val = null; for (int i = 0; i < autoAssign.length; i++) { - if (_dict.supportsGetGeneratedKeys && vals != null && + if (_dict.supportsGetGeneratedKeys && vals != null && vals.size() > 0) val = vals.get(i); else @@ -218,14 +218,14 @@ public class PreparedStatementManagerImpl * This method will only be called when the database supports * getGeneratedKeys. */ - protected List getGeneratedKeys(PreparedStatement stmnt, - String[] autoAssignColNames) + protected List getGeneratedKeys(PreparedStatement stmnt, + String[] autoAssignColNames) throws SQLException { return getGeneratedKeys(stmnt, DBIdentifier.toArray(autoAssignColNames, DBIdentifierType.COLUMN)); } - protected List getGeneratedKeys(PreparedStatement stmnt, - DBIdentifier[] autoAssignColNames) + protected List getGeneratedKeys(PreparedStatement stmnt, + DBIdentifier[] autoAssignColNames) throws SQLException { ResultSet rs = stmnt.getGeneratedKeys(); List vals = new ArrayList(); @@ -258,41 +258,41 @@ public class PreparedStatementManagerImpl public void flush() { } - + /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of executing update. */ - protected int executeUpdate(PreparedStatement stmnt, String sql, + protected int executeUpdate(PreparedStatement stmnt, String sql, RowImpl row) throws SQLException { return stmnt.executeUpdate(); } /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of preparing statement. */ - protected PreparedStatement prepareStatement(String sql) + protected PreparedStatement prepareStatement(String sql) throws SQLException { return prepareStatement(sql, null); - } + } /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of preparing statement. */ - protected PreparedStatement prepareStatement(String sql, + protected PreparedStatement prepareStatement(String sql, String[] autoAssignColNames) throws SQLException { // pass in AutoAssignColumn names - if (autoAssignColNames != null && _dict.supportsGetGeneratedKeys) + if (autoAssignColNames != null && _dict.supportsGetGeneratedKeys) return _conn.prepareStatement(sql, autoAssignColNames); else return _conn.prepareStatement(sql); } - + /** - * Provided the JDBC log category is logging warnings, this method will - * log any SQL warnings that result from the execution of a SQL statement. + * Provided the JDBC log category is logging warnings, this method will + * log any SQL warnings that result from the execution of a SQL statement. */ protected void logSQLWarnings(PreparedStatement stmt) { logSQLWarnings((Statement)stmt); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ProjectionResultObjectProvider.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ProjectionResultObjectProvider.java index 56e04ebdd..054d3824b 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ProjectionResultObjectProvider.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ProjectionResultObjectProvider.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -45,9 +45,9 @@ class ProjectionResultObjectProvider * @param states the query expression states * @param ctx the query execution context */ - public ProjectionResultObjectProvider(SelectExecutor sel, + public ProjectionResultObjectProvider(SelectExecutor sel, QueryExpressions exps, QueryExpressionsState state, ExpContext ctx) { - this(sel, new QueryExpressions[]{ exps }, + this(sel, new QueryExpressions[]{ exps }, new QueryExpressionsState[]{ state }, ctx); } @@ -59,7 +59,7 @@ class ProjectionResultObjectProvider * @param states the query expression states * @param ctx the query execution context */ - public ProjectionResultObjectProvider(SelectExecutor sel, + public ProjectionResultObjectProvider(SelectExecutor sel, QueryExpressions[] exps, QueryExpressionsState[] state, ExpContext ctx){ super(sel, ctx.store, ctx.fetch); _exps = exps; @@ -75,7 +75,7 @@ class ProjectionResultObjectProvider int idx = res.indexOf(); Object[] arr = new Object[_exps[idx].projections.length]; for (int i = 0; i < _exps[idx].projections.length; i++) - arr[i] = ((Val) _exps[idx].projections[i]).load(_ctx, + arr[i] = ((Val) _exps[idx].projections[i]).load(_ctx, _state[idx].projections[i], res); return arr; } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLProjectionResultObjectProvider.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLProjectionResultObjectProvider.java index fb18c5df8..bf4f2db35 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLProjectionResultObjectProvider.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLProjectionResultObjectProvider.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java index f6950ceaf..7216dfa1a 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -129,10 +129,10 @@ public class SQLStoreQuery } public int getOperation(StoreQuery q) { - return _select ? OP_SELECT : + return _select ? OP_SELECT : (q.getContext().getCandidateType() != null || q.getContext().getResultType() != null - || q.getContext().getResultMappingName() != null + || q.getContext().getResultMappingName() != null || q.getContext().getResultMappingScope() != null) ? OP_SELECT : OP_UPDATE; } @@ -144,7 +144,7 @@ public class SQLStoreQuery List paramList = new ArrayList(Arrays.asList(params)); SQLBuffer buf = new SQLBuffer(dict).append(sql); - + // we need to make sure we have an active store connection store.getContext().beginStore(); Connection conn = store.getConnection(); @@ -157,15 +157,15 @@ public class SQLStoreQuery stmnt = prepareCall(conn, buf); else stmnt = prepareStatement(conn, buf); - + buf.setParameters(paramList); if (stmnt != null) buf.setParameters(stmnt); dict.setTimeouts(stmnt, fetch, true); - - int count = executeUpdate(store, conn, stmnt, buf); - + + int count = executeUpdate(store, conn, stmnt, buf); + return count; } catch (SQLException se) { throw SQLExceptions.getStore(se, dict); @@ -212,13 +212,13 @@ public class SQLStoreQuery stmnt = prepareCall(conn, buf, fetch, -1, -1); int index = 0; - for (Iterator i = paramList.iterator(); i.hasNext() && + for (Iterator i = paramList.iterator(); i.hasNext() && stmnt != null;) dict.setUnknown(stmnt, ++index, i.next(), null); dict.setTimeouts(stmnt, fetch, false); ResultSet rs = executeQuery(store, conn, stmnt, buf, paramList); - ResultSetResult res = stmnt != null ? + ResultSetResult res = stmnt != null ? new ResultSetResult(conn, stmnt, rs, store) : new ResultSetResult(conn, rs, dict); if (_resultMapping != null) @@ -250,22 +250,22 @@ public class SQLStoreQuery public boolean isPacking(StoreQuery q) { return q.getContext().getCandidateType() == null; } - + /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of preparing call statement. */ protected PreparedStatement prepareCall(Connection conn, SQLBuffer buf) throws SQLException { - return buf.prepareCall(conn); + return buf.prepareCall(conn); } - + /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of executing update. */ - protected int executeUpdate(JDBCStore store, Connection conn, - PreparedStatement stmnt, SQLBuffer buf) + protected int executeUpdate(JDBCStore store, Connection conn, + PreparedStatement stmnt, SQLBuffer buf) throws SQLException { int count = 0; if (_call && stmnt.execute() == false) { @@ -277,38 +277,38 @@ public class SQLStoreQuery } return count; } - + /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of preparing call statement. */ protected PreparedStatement prepareCall(Connection conn, SQLBuffer buf, JDBCFetchConfiguration fetch, int rsType, int rsConcur) throws SQLException { - return buf.prepareCall(conn, fetch, rsType, rsConcur); + return buf.prepareCall(conn, fetch, rsType, rsConcur); } /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of preparing statement. */ - protected PreparedStatement prepareStatement(Connection conn, + protected PreparedStatement prepareStatement(Connection conn, SQLBuffer buf) throws SQLException { return buf.prepareStatement(conn); } - + /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of preparing statement. */ - protected PreparedStatement prepareStatement(Connection conn, + protected PreparedStatement prepareStatement(Connection conn, SQLBuffer buf, JDBCFetchConfiguration fetch, int rsType, int rsConcur) throws SQLException { return buf.prepareStatement(conn, fetch, rsType, rsConcur); } - + /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of executing query. */ protected ResultSet executeQuery(JDBCStore store, Connection conn, @@ -316,17 +316,17 @@ public class SQLStoreQuery throws SQLException { return stmnt.executeQuery(); } - + /** * The given query is parsed to find the parameter tokens of the form * ?n which is different than ? tokens in * actual SQL parameter tokens. These ?n style tokens - * are replaced in the query string by ? tokens. - * - * During the token parsing, the ordering of the tokens is recorded. + * are replaced in the query string by ? tokens. + * + * During the token parsing, the ordering of the tokens is recorded. * The given userParam must contain parameter keys as Integer and - * the same Integers must appear in the tokens. - * + * the same Integers must appear in the tokens. + * */ public Object[] toParameterArray(StoreQuery q, Map userParams) { if (userParams == null || userParams.isEmpty()) @@ -338,12 +338,12 @@ public class SQLStoreQuery } catch (IOException ex) { throw new UserException(ex.getLocalizedMessage()); } - + Object[] result = new Object[paramOrder.size()]; int idx = 0; for (Integer key : paramOrder) { - if (!userParams.containsKey(key)) - throw new UserException(_loc.get("uparam-missing", + if (!userParams.containsKey(key)) + throw new UserException(_loc.get("uparam-missing", key, sql, userParams)); result[idx++] = userParams.get(key); } @@ -352,7 +352,7 @@ public class SQLStoreQuery return result; } } - + /** * Utility method to substitute '?num' for parameters in the given SQL * statement, and fill-in the order of the parameter tokens @@ -399,10 +399,10 @@ public class SQLStoreQuery // // StreamTokenizer can not differentiate the last quoted token as in ^.*'.*$ and ^.*',*'$ // // need to check the last quote ends with "'" and process accordingly. // if(endsWithQuote) { -// buf.append('\''); +// buf.append('\''); // } else if (tok.nextToken() != StreamTokenizer.TT_EOF) { // tok.pushBack(); -// buf.append('\''); +// buf.append('\''); // } break; default: diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SelectResultObjectProvider.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SelectResultObjectProvider.java index 004912bb5..9ab647291 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SelectResultObjectProvider.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SelectResultObjectProvider.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/StoredProcedureQuery.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/StoredProcedureQuery.java index 4993e35e8..71d0a32db 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/StoredProcedureQuery.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/StoredProcedureQuery.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/TableJDBCSeq.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/TableJDBCSeq.java index 96543970a..53d907b58 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/TableJDBCSeq.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/TableJDBCSeq.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -78,7 +78,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { public static final String ACTION_GET = "get"; public static final String ACTION_SET = "set"; public static final String DEFAULT_TABLE = "OPENJPA_SEQUENCE_TABLE"; - + private static final Localizer _loc = Localizer.forPackage (TableJDBCSeq.class); @@ -96,7 +96,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { private Column _seqColumn = null; private Column _pkColumn = null; - + /** * The sequence table name. Defaults to OPENJPA_SEQUENCE_TABLE. * By default, the table will be placed in the first schema listed in your @@ -187,10 +187,10 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { public void setAllocate(int alloc) { _alloc = alloc; } - + /** - * Return the number as the initial number for the - * GeneratedValue.TABLE strategy to start with. + * Return the number as the initial number for the + * GeneratedValue.TABLE strategy to start with. * @return an initial number */ public int getInitialValue() { @@ -199,23 +199,23 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { /** * Set the initial number in the table for the GeneratedValue.TABLE - * strategy to use as initial number. + * strategy to use as initial number. * @param intValue. The initial number */ public void setInitialValue(int intValue) { _intValue = intValue; } - + /** * Sets the names of the columns on which a unique constraint is set. * @param columnsNames are passed as a single String concatenated with - * a '|' character. This method parses it back to array of Strings. + * a '|' character. This method parses it back to array of Strings. */ public void setUniqueColumns(String columnNames) { _uniqueColumnNames = (StringUtil.isEmpty(columnNames)) ? null : DBIdentifier.split(columnNames, DBIdentifierType.COLUMN, IdentifierUtil.BAR); } - + public String getUniqueColumns() { return Normalizer.joinNames(DBIdentifier.toStringArray(_uniqueColumnNames), IdentifierUtil.BAR); } @@ -243,13 +243,13 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { public void endConfiguration() { buildTable(); } - + public void addSchema(ClassMapping mapping, SchemaGroup group) { // Since the table is created by openjpa internally // we can create the table for each schema within the PU // in here. - + Schema[] schemas = group.getSchemas(); for (int i = 0; i < schemas.length; i++) { QualifiedDBIdentifier path = QualifiedDBIdentifier.getPath(_table); @@ -266,7 +266,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { if (schema == null) { schema = group.addSchema(schemaName); } - + Table copy = schema.importTable(_pkColumn.getTable()); // importTable() does not import unique constraints Unique[] uniques = _pkColumn.getTable().getUniques(); @@ -345,9 +345,9 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { * Return the appropriate status object for the given class, or null * if cannot handle the given class. The mapping may be null. */ - protected Status getStatus(ClassMapping mapping) { - Status status = (Status) _stat.get(mapping); - if (status == null){ + protected Status getStatus(ClassMapping mapping) { + Status status = (Status) _stat.get(mapping); + if (status == null){ status = new Status(); Status tStatus = _stat.putIfAbsent(mapping, status); // This can happen if another thread calls .put(..) sometime after our call to get. Return @@ -392,7 +392,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { else { tableName = _table; } - + if (DBIdentifier.isEmpty(schemaName)) { schemaName = Schemas.getNewTableSchemaIdentifier(_conf); } @@ -410,7 +410,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { (_seqColumnName, table)); _seqColumn.setType(dict.getPreferredType(Types.BIGINT)); _seqColumn.setJavaType(JavaTypes.LONG); - + if (_uniqueColumnNames != null) { DBIdentifier uniqueName = _uniqueConstraintName; if (DBIdentifier.isEmpty(uniqueName)) { @@ -426,7 +426,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { u.addColumn(col); } } - + } /** @@ -445,7 +445,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { _conf.getManagedRuntimeInstance().doNonTransactionalWork( runnable); } - catch(NotSupportedException nse) { + catch(NotSupportedException nse) { SQLException sqlEx = new SQLException( nse.getLocalizedMessage()); sqlEx.initCause(nse); @@ -456,16 +456,16 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { } } catch (RuntimeException re) { Throwable e = re.getCause(); - if(e instanceof SQLException ) + if(e instanceof SQLException ) throw (SQLException) e; - else + else throw re; } } /** * Inserts the initial sequence column into the database. - * + * * @param mapping * ClassMapping for the class whose sequence column will be * updated @@ -474,7 +474,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { */ private void insertSequence(ClassMapping mapping, Connection conn) throws SQLException { - + if (_log.isTraceEnabled()) _log.trace(_loc.get("insert-seq")); @@ -491,7 +491,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { append(") VALUES ("). appendValue(pk, _pkColumn).append(", "). appendValue(_intValue, _seqColumn).append(")"); - + boolean wasAuto = conn.getAutoCommit(); if (!wasAuto && !suspendInJTA()) conn.setAutoCommit(true); @@ -511,13 +511,13 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { /** * Get the current sequence value. - * + * * @param mapping * ClassMapping of the entity whose sequence value will be * obtained. * @param conn * Connection used issue SQL statements. - * + * * @return The current sequence value, or SEQUENCE_NOT_FOUND * if the sequence could not be found. */ @@ -551,7 +551,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { } finally { if (rs != null) try { rs.close(); } catch (SQLException se) {} - if (stmnt != null) + if (stmnt != null) try { stmnt.close(); } catch (SQLException se) {} } } @@ -573,7 +573,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { throw new InvalidStateException(_loc.get("bad-seq-type", getClass(), mapping)); - DBDictionary dict = _conf.getDBDictionaryInstance(); + DBDictionary dict = _conf.getDBDictionaryInstance(); SQLBuffer where = new SQLBuffer(dict).append(_pkColumn).append(" = "). appendValue(pk, _pkColumn); @@ -606,14 +606,14 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { updates = executeUpdate(_conf, conn, stmnt, upd, RowImpl.ACTION_UPDATE); } finally { - if (rs != null) + if (rs != null) try { rs.close(); } catch (SQLException se) {} if (stmnt != null) try { stmnt.close(); } catch (SQLException se) {} } } - // setup new sequence range + // setup new sequence range synchronized (stat) { if (updateStatSeq && stat.seq < cur) stat.seq = cur; @@ -624,7 +624,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { } /** * Resolve a fully qualified table name - * + * * @param class * mapping to get the schema name * @deprecated @@ -635,14 +635,14 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { /** * Resolve a fully qualified table name - * + * * @param class * mapping to get the schema name */ public DBIdentifier resolveTableIdentifier(ClassMapping mapping, Table table) { DBIdentifier sName = mapping.getTable().getSchemaIdentifier(); DBIdentifier tableName = DBIdentifier.NULL; - + //OPENJPA-2650: Don't use a schema name if the user has requested, //via useSchemaName, to not use one. if (!_conf.getDBDictionaryInstance().useSchemaName){ @@ -657,7 +657,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { return tableName; } - + /** * Creates the sequence table in the DB. */ @@ -812,35 +812,35 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { } /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of preparing statement. */ protected PreparedStatement prepareStatement(Connection conn, SQLBuffer buf) throws SQLException { return buf.prepareStatement(conn); } - + /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of executing update. */ - protected int executeUpdate(JDBCConfiguration conf, Connection conn, + protected int executeUpdate(JDBCConfiguration conf, Connection conn, PreparedStatement stmnt, SQLBuffer buf, int opcode) throws SQLException { return stmnt.executeUpdate(); } - + /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of executing query. */ protected ResultSet executeQuery(JDBCConfiguration conf, Connection conn, PreparedStatement stmnt, SQLBuffer buf) throws SQLException { return stmnt.executeQuery(); } - + /** - * This method is to provide override for non-JDBC or JDBC-like + * This method is to provide override for non-JDBC or JDBC-like * implementation of getting sequence from the result set. */ protected long getSequence(ResultSet rs, DBDictionary dict) @@ -889,7 +889,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { /** * This method actually obtains the current sequence value. - * + * * @throws RuntimeException * any SQLExceptions that occur when obtaining the sequence * value are wrapped in a runtime exception to avoid @@ -901,14 +901,14 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { SQLException err = null; try { // Try to use the store's connection. - - conn = getConnection(store); + + conn = getConnection(store); boolean sequenceSet = setSequence(mapping, stat, alloc, updateStatSeq, conn); closeConnection(conn); if (!sequenceSet) { - // insert a new sequence column. Prefer connection2 / non-jta-data-source when inserting a + // insert a new sequence column. Prefer connection2 / non-jta-data-source when inserting a // sequence column regardless of Seq.type. conn = _conf.getDataSource2(store.getContext()).getConnection(); try { @@ -921,7 +921,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { "seqence. ", e); } } - + conn.close(); // now we should be able to update using the connection per @@ -960,7 +960,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { /** * This method actually obtains the current sequence value. - * + * * @throws RuntimeException * any SQLExceptions that occur when obtaining the sequence * value are wrapped in a runtime exception to avoid diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/UpdateManager.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/UpdateManager.java index 1e372731e..6850ab132 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/UpdateManager.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/UpdateManager.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ValueTableJDBCSeq.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ValueTableJDBCSeq.java index 982e423e5..ce70697c8 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ValueTableJDBCSeq.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ValueTableJDBCSeq.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/XROP.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/XROP.java index f1e5cf325..58df050c7 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/XROP.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/XROP.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel; @@ -136,7 +136,7 @@ public class XROP implements BatchedResultObjectProvider { } /** - * Gets the update count, provided the current result of the statement is not a result set. + * Gets the update count, provided the current result of the statement is not a result set. */ @Override public int getUpdateCount() { diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Abs.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Abs.java index 9e7f8039b..78d130c7c 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Abs.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Abs.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/AbstractVal.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/AbstractVal.java index fcbc2f3f0..6de17642e 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/AbstractVal.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/AbstractVal.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -48,44 +48,44 @@ abstract class AbstractVal return false; } - public Object toDataStoreValue(Select sel, ExpContext ctx, ExpState state, + public Object toDataStoreValue(Select sel, ExpContext ctx, ExpState state, Object val) { return val; } - public void appendIsEmpty(Select sel, ExpContext ctx, ExpState state, + public void appendIsEmpty(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { sql.append(FALSE); } - public void appendIsNotEmpty(Select sel, ExpContext ctx, ExpState state, + public void appendIsNotEmpty(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql){ sql.append(TRUE); } - public void appendIsNull(Select sel, ExpContext ctx, ExpState state, + public void appendIsNull(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { appendTo(sel, ctx, state, sql, 0); sql.append(" IS ").appendValue(null); } - public void appendIsNotNull(Select sel, ExpContext ctx, ExpState state, + public void appendIsNotNull(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { appendTo(sel, ctx, state, sql, 0); sql.append(" IS NOT ").appendValue(null); } - public void appendIndex(Select sel, ExpContext ctx, ExpState state, + public void appendIndex(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { sql.append("1"); } - public void appendType(Select sel, ExpContext ctx, ExpState state, + public void appendType(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { sql.append("1"); } - public void appendSize(Select sel, ExpContext ctx, ExpState state, + public void appendSize(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { sql.append("1"); } @@ -114,9 +114,9 @@ abstract class AbstractVal public Path getPath() { return null; } - + public String getName() { return null; - } + } } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Aggregate.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Aggregate.java index 717814d62..47e6a9949 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Aggregate.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Aggregate.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -96,13 +96,13 @@ class Aggregate return _arg.initialize(sel, ctx, JOIN_REL); } - public void select(Select sel, ExpContext ctx, ExpState state, + public void select(Select sel, ExpContext ctx, ExpState state, boolean pks) { sel.select(newSQLBuffer(sel, ctx, state), this); sel.setAggregate(true); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { if (_arg != null) _arg.selectColumns(sel, ctx, state, true); @@ -112,7 +112,7 @@ class Aggregate sel.groupBy(newSQLBuffer(sel, ctx, state)); } - public void orderBy(Select sel, ExpContext ctx, ExpState state, + public void orderBy(Select sel, ExpContext ctx, ExpState state, boolean asc) { sel.orderBy(newSQLBuffer(sel, ctx, state), asc, false, getSelectAs()); @@ -127,11 +127,11 @@ class Aggregate public Object load(ExpContext ctx, ExpState state, Result res) throws SQLException { - return Filters.convert(res.getObject(this, JavaSQLTypes.JDBC_DEFAULT, + return Filters.convert(res.getObject(this, JavaSQLTypes.JDBC_DEFAULT, null), getType()); } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { if (_arg != null) _arg.calculateValue(sel, ctx, state, null, null); @@ -141,9 +141,9 @@ class Aggregate return 1; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { - _listener.appendTo(sql, getArgs(sel, ctx, state), _candidate, + _listener.appendTo(sql, getArgs(sel, ctx, state), _candidate, ctx.store); sel.append(sql, state.joins); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/All.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/All.java index f90f42535..e99aede46 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/All.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/All.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/AndExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/AndExpression.java index a4c1349f6..776a66646 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/AndExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/AndExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -49,7 +49,7 @@ class AndExpression return new BinaryOpExpState(sel.and(s1.joins, s2.joins), s1, s2); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { BinaryOpExpState bstate = (BinaryOpExpState) state; boolean paren1 = _exp1 instanceof OrExpression; @@ -68,7 +68,7 @@ class AndExpression sel.append(buf, state.joins); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { BinaryOpExpState bstate = (BinaryOpExpState) state; _exp1.selectColumns(sel, ctx, bstate.state1, pks); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Any.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Any.java index 45a04fce9..26f88200e 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Any.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Any.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Args.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Args.java index ed9520d64..c7353ccd8 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Args.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Args.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -49,7 +49,7 @@ public class Args public Args(Val val1, Val val2) { this(new Val[]{val1, val2}); } - + public Args (Val... values) { List list = new ArrayList(); if (values != null) { @@ -67,13 +67,13 @@ public class Args /** * Return a filter value for each argument. */ - public FilterValue[] newFilterValues(Select sel, ExpContext ctx, + public FilterValue[] newFilterValues(Select sel, ExpContext ctx, ExpState state) { - ArgsExpState astate = (ArgsExpState) state; + ArgsExpState astate = (ArgsExpState) state; FilterValue[] filts = new FilterValue[_args.length]; for (int i = 0; i < _args.length; i++) - filts[i] = new FilterValueImpl(sel, ctx, astate.states[i], - _args[i]); + filts[i] = new FilterValueImpl(sel, ctx, astate.states[i], + _args[i]); return filts; } @@ -129,7 +129,7 @@ public class Args */ private static class ArgsExpState extends ExpState { - + public ExpState[] states; public ArgsExpState(Joins joins, ExpState[] states) { @@ -138,11 +138,11 @@ public class Args } } - public void select(Select sel, ExpContext ctx, ExpState state, + public void select(Select sel, ExpContext ctx, ExpState state, boolean pks) { } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { ArgsExpState astate = (ArgsExpState) state; for (int i = 0; i < _args.length; i++) @@ -152,7 +152,7 @@ public class Args public void groupBy(Select sel, ExpContext ctx, ExpState state) { } - public void orderBy(Select sel, ExpContext ctx, ExpState state, + public void orderBy(Select sel, ExpContext ctx, ExpState state, boolean asc) { } @@ -160,7 +160,7 @@ public class Args return null; } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { ArgsExpState astate = (ArgsExpState) state; for (int i = 0; i < _args.length; i++) @@ -174,7 +174,7 @@ public class Args public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { appendTo(sel, ctx, state, sql, index, null); } - + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index, String operator) { ArgsExpState astate = (ArgsExpState) state; for (int i = 0; i < _args.length; i++) { @@ -187,23 +187,23 @@ public class Args } } - public void appendIsEmpty(Select sel, ExpContext ctx, ExpState state, + public void appendIsEmpty(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { } - public void appendIsNotEmpty(Select sel, ExpContext ctx, ExpState state, + public void appendIsNotEmpty(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql){ } - public void appendSize(Select sel, ExpContext ctx, ExpState state, + public void appendSize(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { } - public void appendIsNull(Select sel, ExpContext ctx, ExpState state, + public void appendIsNull(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { } - public void appendIsNotNull(Select sel, ExpContext ctx, ExpState state, + public void appendIsNotNull(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Avg.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Avg.java index 841e7785c..22624d8ea 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Avg.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Avg.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/BinaryOpExpState.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/BinaryOpExpState.java index e99409b81..0575f0c27 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/BinaryOpExpState.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/BinaryOpExpState.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -22,10 +22,10 @@ import org.apache.openjpa.jdbc.sql.Joins; /** * Expression tree state for a binary operator. - * + * * @author Abe White */ -class BinaryOpExpState +class BinaryOpExpState extends ExpState { /** diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/BindVariableAndExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/BindVariableAndExpression.java index d931a22de..2f5eecd84 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/BindVariableAndExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/BindVariableAndExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -49,7 +49,7 @@ class BindVariableAndExpression return new BinaryOpExpState(sel.and(s1.joins, s2.joins), s1, s2); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { boolean or = _exp instanceof OrExpression; if (or) @@ -59,7 +59,7 @@ class BindVariableAndExpression buf.append(")"); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { _exp.selectColumns(sel, ctx, ((BinaryOpExpState) state).state2, pks); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/BindVariableExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/BindVariableExpression.java index 101d88040..40f4a6f12 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/BindVariableExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/BindVariableExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -58,12 +58,12 @@ class BindVariableExpression return _var.initialize(sel, ctx, 0); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { buf.append("1 = 1"); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CoalesceExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CoalesceExpression.java index fe66cdf81..6174189e7 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CoalesceExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CoalesceExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -82,19 +82,19 @@ public class CoalesceExpression private static class CoalesceExpState extends ExpState { - + public ExpState[] states; - + public CoalesceExpState(Joins joins, ExpState[] states) { super(joins); this.states = states; } } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf, int index) { CoalesceExpState cstate = (CoalesceExpState) state; - + buf.append(" COALESCE("); // MySQL does not like space before bracket for (int i = 0; i < _vals.length; i++) { @@ -106,7 +106,7 @@ public class CoalesceExpression buf.append(")"); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { CoalesceExpState cstate = (CoalesceExpState) state; @@ -128,7 +128,7 @@ public class CoalesceExpression public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { CoalesceExpState cstate = (CoalesceExpState) state; - for (int i = 0; i < _vals.length; i++) + for (int i = 0; i < _vals.length; i++) _vals[i].calculateValue(sel, ctx, cstate.states[i], other, otherState); } @@ -167,25 +167,25 @@ public class CoalesceExpression } public void setImplicitType(Class type) { - _cast = type; + _cast = type; } public void setMetaData(ClassMetaData meta) { _meta = meta; } - + public void setOtherPath(Value other) { this.other = other; } - + public Value getOtherPath() { return other; } - + public void setOtherState(ExpState otherState) { this.otherState = otherState; } - + public ExpState getOtherState() { return otherState; } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CollectionParam.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CollectionParam.java index 5c39c5b82..87827741d 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CollectionParam.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CollectionParam.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -119,7 +119,7 @@ public class CollectionParam public ClassMapping[] mapping = null; public Discriminator[] disc = null; public Object discValue[] = null; - + ParamExpState(Object params) { if (params instanceof Collection) size = ((Collection) params).size(); @@ -136,9 +136,9 @@ public class CollectionParam discValue[i] = null; } } - } + } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { super.calculateValue(sel, ctx, state, other, otherState); ParamExpState pstate = (ParamExpState) state; @@ -179,12 +179,12 @@ public class CollectionParam } } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { ParamExpState pstate = (ParamExpState) state; for (int i = 0; i < pstate.size; i++) { if (pstate.otherLength[i] > 1) - sql.appendValue(((Object[]) pstate.sqlValue[i])[index], + sql.appendValue(((Object[]) pstate.sqlValue[i])[index], pstate.getColumn(index), this); else if (pstate.cols != null) sql.appendValue(pstate.sqlValue[i], pstate.getColumn(index), diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CompareEqualExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CompareEqualExpression.java index efe1ba3fd..8b2c50f30 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CompareEqualExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CompareEqualExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -83,7 +83,7 @@ abstract class CompareEqualExpression flags1 = flags1 | Val.CMP_EQUAL; flags2 = flags2 | Val.CMP_EQUAL; } - + if (s1 == null) s1 = _val1.initialize(sel, ctx, flags1); if (s2 == null) @@ -91,7 +91,7 @@ abstract class CompareEqualExpression return new BinaryOpExpState(sel.and(s1.joins, s2.joins), s1, s2); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.calculateValue(sel, ctx, bstate.state1, _val2, bstate.state2); @@ -110,7 +110,7 @@ abstract class CompareEqualExpression sel.append(buf, state.joins); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.selectColumns(sel, ctx, bstate.state1, true); @@ -120,8 +120,8 @@ abstract class CompareEqualExpression /** * Append the SQL for the comparison. */ - protected abstract void appendTo(Select sel, ExpContext ctx, - BinaryOpExpState state, SQLBuffer buf, boolean val1Null, + protected abstract void appendTo(Select sel, ExpContext ctx, + BinaryOpExpState state, SQLBuffer buf, boolean val1Null, boolean val2Null); /** diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CompareExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CompareExpression.java index cddcd8b76..2fb53245f 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CompareExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CompareExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -63,7 +63,7 @@ class CompareExpression return new BinaryOpExpState(sel.and(s1.joins, s2.joins), s1, s2); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.calculateValue(sel, ctx, bstate.state1, _val2, bstate.state2); @@ -89,7 +89,7 @@ class CompareExpression sel.append(buf, state.joins); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.selectColumns(sel, ctx, bstate.state1, true); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Concat.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Concat.java index 77be847fc..661551da5 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Concat.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Concat.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -79,12 +79,12 @@ public class Concat return new BinaryOpExpState(sel.and(s1.joins, s2.joins), s1, s2); } - public void select(Select sel, ExpContext ctx, ExpState state, + public void select(Select sel, ExpContext ctx, ExpState state, boolean pks) { sel.select(newSQLBuffer(sel, ctx, state), this); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.selectColumns(sel, ctx, bstate.state1, true); @@ -95,7 +95,7 @@ public class Concat sel.groupBy(newSQLBuffer(sel, ctx, state)); } - public void orderBy(Select sel, ExpContext ctx, ExpState state, + public void orderBy(Select sel, ExpContext ctx, ExpState state, boolean asc) { sel.orderBy(newSQLBuffer(sel, ctx, state), asc, false, getSelectAs()); } @@ -107,13 +107,13 @@ public class Concat return buf; } - public Object load(ExpContext ctx, ExpState state, Result res) + public Object load(ExpContext ctx, ExpState state, Result res) throws SQLException { return Filters.convert(res.getObject(this, JavaSQLTypes.JDBC_DEFAULT, null), getType()); } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.calculateValue(sel, ctx, bstate.state1, null, null); @@ -124,7 +124,7 @@ public class Concat return 1; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.calculateValue(sel, ctx, bstate.state1, null, null); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Const.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Const.java index e2fc0de47..5b4b75624 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Const.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Const.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -101,14 +101,14 @@ abstract class Const } } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { if (other instanceof PCPath) ((ConstExpState) state).cols = ((PCPath) other). getColumns(otherState); } - public void select(Select sel, ExpContext ctx, ExpState state, + public void select(Select sel, ExpContext ctx, ExpState state, boolean pks) { sel.select(newSQLBuffer(sel, ctx, state), this); } @@ -120,7 +120,7 @@ abstract class Const return buf; } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { } @@ -128,7 +128,7 @@ abstract class Const sel.groupBy(newSQLBuffer(sel, ctx, state)); } - public void orderBy(Select sel, ExpContext ctx, ExpState state, + public void orderBy(Select sel, ExpContext ctx, ExpState state, boolean asc) { sel.orderBy(newSQLBuffer(sel, ctx, state), asc, false, getSelectAs()); } @@ -142,7 +142,7 @@ abstract class Const return 1; } - public void appendIsEmpty(Select sel, ExpContext ctx, ExpState state, + public void appendIsEmpty(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { Object obj = getValue(ctx, state); if (obj instanceof Collection && ((Collection) obj).isEmpty()) @@ -153,7 +153,7 @@ abstract class Const sql.append(FALSE); } - public void appendIsNotEmpty(Select sel, ExpContext ctx, ExpState state, + public void appendIsNotEmpty(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql){ Object obj = getValue(ctx, state); if (obj instanceof Collection && ((Collection) obj).isEmpty()) @@ -164,7 +164,7 @@ abstract class Const sql.append(TRUE); } - public void appendSize(Select sel, ExpContext ctx, ExpState state, + public void appendSize(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { Object obj = getValue(ctx, state); if (obj instanceof Collection) @@ -175,7 +175,7 @@ abstract class Const sql.append("1"); } - public void appendIsNull(Select sel, ExpContext ctx, ExpState state, + public void appendIsNull(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { if (isSQLValueNull(sel, ctx, state)) sql.append(TRUE); @@ -183,7 +183,7 @@ abstract class Const sql.append(FALSE); } - public void appendIsNotNull(Select sel, ExpContext ctx, ExpState state, + public void appendIsNotNull(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { if (!isSQLValueNull(sel, ctx, state)) sql.append(TRUE); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ConstGetObjectId.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ConstGetObjectId.java index 28b8d2152..12bc4cac3 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ConstGetObjectId.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ConstGetObjectId.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -56,7 +56,7 @@ class ConstGetObjectId } public Object getValue(ExpContext ctx, ExpState state) { - return ctx.store.getContext().getObjectId(_constant.getValue(ctx, + return ctx.store.getContext().getObjectId(_constant.getValue(ctx, ((ConstGetObjectIdExpState) state).constantState)); } @@ -68,12 +68,12 @@ class ConstGetObjectId return ((ConstGetObjectIdExpState) state).sqlValue; } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { super.calculateValue(sel, ctx, state, other, otherState); ConstGetObjectIdExpState cstate = (ConstGetObjectIdExpState) state; _constant.calculateValue(sel, ctx, cstate.constantState, null, null); - Object oid = ctx.store.getContext().getObjectId(_constant.getValue(ctx, + Object oid = ctx.store.getContext().getObjectId(_constant.getValue(ctx, cstate.constantState)); if (other != null) { cstate.sqlValue = other.toDataStoreValue(sel, ctx, otherState, oid); @@ -82,11 +82,11 @@ class ConstGetObjectId cstate.sqlValue = oid; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { ConstGetObjectIdExpState cstate = (ConstGetObjectIdExpState) state; if (cstate.otherLength > 1) - sql.appendValue(((Object[]) cstate.sqlValue)[index], + sql.appendValue(((Object[]) cstate.sqlValue)[index], cstate.getColumn(index)); else sql.appendValue(cstate.sqlValue, cstate.getColumn(index)); @@ -95,7 +95,7 @@ class ConstGetObjectId /** * Expression state. */ - private static class ConstGetObjectIdExpState + private static class ConstGetObjectIdExpState extends ConstExpState { public final ExpState constantState; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ConstInstanceofExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ConstInstanceofExpression.java index ca2a98045..f022f4cd1 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ConstInstanceofExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ConstInstanceofExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -48,7 +48,7 @@ class ConstInstanceofExpression return _const.initialize(sel, ctx, 0); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { _const.calculateValue(sel, ctx, state, null, null); if (_cls.isInstance(_const.getValue(ctx, state))) @@ -57,7 +57,7 @@ class ConstInstanceofExpression buf.append("1 <> 1"); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { _const.selectColumns(sel, ctx, state, pks); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ConstPath.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ConstPath.java index 174459464..b1984e0f6 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ConstPath.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ConstPath.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -107,7 +107,7 @@ class ConstPath return new ConstPathExpState(_constant.initialize(sel, ctx, 0)); } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { super.calculateValue(sel, ctx, state, other, otherState); ConstPathExpState cstate = (ConstPathExpState) state; @@ -170,18 +170,18 @@ class ConstPath cstate.value = null; if (other != null) { - cstate.sqlValue = other.toDataStoreValue(sel, ctx, otherState, + cstate.sqlValue = other.toDataStoreValue(sel, ctx, otherState, cstate.value); cstate.otherLength = other.length(sel, ctx, otherState); } else cstate.sqlValue = cstate.value; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { ConstPathExpState cstate = (ConstPathExpState) state; if (cstate.otherLength > 1) - sql.appendValue(((Object[]) cstate.sqlValue)[index], + sql.appendValue(((Object[]) cstate.sqlValue)[index], cstate.getColumn(index)); else sql.appendValue(cstate.sqlValue, cstate.getColumn(index)); @@ -196,7 +196,7 @@ class ConstPath /** * Expression state. */ - private static class ConstPathExpState + private static class ConstPathExpState extends ConstExpState { public final ExpState constantState; @@ -208,7 +208,7 @@ class ConstPath this.constantState = constantState; } } - + public void get(FieldMetaData fmd, XMLMetaData meta) { } @@ -221,11 +221,11 @@ class ConstPath public void setSchemaAlias(String schemaAlias) { } - + public String getSchemaAlias() { return null; } - + public void setSubqueryContext(Context conext, String correlationVar) { } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ContainsExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ContainsExpression.java index 429bc4c28..15252c83c 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ContainsExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ContainsExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ContainsKeyExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ContainsKeyExpression.java index 78f70443b..4ee06678a 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ContainsKeyExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ContainsKeyExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Count.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Count.java index 023d2dc91..1b8ccd3ae 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Count.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Count.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -32,7 +32,7 @@ class Count private boolean isCountMultiColumns = false; private boolean isCountDistinct = false; - + /** * Constructor. Provide the value to operate on. */ @@ -52,7 +52,7 @@ class Count isCountMultiColumns = true; } } - + return expState; } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CurrentDate.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CurrentDate.java index 0f782d9bf..1c3601cb0 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CurrentDate.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/CurrentDate.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -60,7 +60,7 @@ class CurrentDate throw new InternalException(); } } - + public Object getValue(Object[] params) { try { return _type.getConstructor(long.class).newInstance(System.currentTimeMillis()); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/DatastoreFunction.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/DatastoreFunction.java index 49586d1d3..f8b233435 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/DatastoreFunction.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/DatastoreFunction.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -24,14 +24,14 @@ import org.apache.openjpa.kernel.exps.Arguments; /** * A unary operator that executes a datastore specific function with zero or more arguments. - * + * * @author Pinaki Poddar * */ @SuppressWarnings("serial") public class DatastoreFunction extends UnaryOp { private final String _functionName; - + public DatastoreFunction(String name, Class resultType, Arguments args) { super((Val)args); _functionName = name; @@ -43,16 +43,16 @@ public class DatastoreFunction extends UnaryOp { return _functionName; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { Args args = (Args) getValue(); if (!ctx.store.getDBDictionary().requiresCastForMathFunctions || args.getValues().length == 1) { super.appendTo(sel, ctx, state, sql, index); } else { sql.append(getOperator()); - sql.append("("); + sql.append("("); args.appendTo(sel, ctx, state, sql, 0, getOperator()); sql.append(")"); - } + } } } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Distinct.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Distinct.java index 486a940c7..c06179548 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Distinct.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Distinct.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -43,20 +43,20 @@ class Distinct } @Override - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { Val val = getValue(); if (val instanceof PCPath) { boolean noParen = getNoParen(); sql.append(getOperator()); sql.append(noParen ? " " : "("); - ((PCPath)val).appendTo(sel, ctx, state, sql); + ((PCPath)val).appendTo(sel, ctx, state, sql); sql.addCastForParam(getOperator(), val); if (!noParen) sql.append(")"); - + } else super.appendTo(sel, ctx, state, sql, index); } - + } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/EmptyExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/EmptyExpression.java index 505cf6ee3..020917791 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/EmptyExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/EmptyExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -36,11 +36,11 @@ class EmptyExpression return ExpState.NULL; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/EndsWithExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/EndsWithExpression.java index 4f66cd355..5ad521d4f 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/EndsWithExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/EndsWithExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -55,7 +55,7 @@ class EndsWithExpression return new BinaryOpExpState(sel.and(s1.joins, s2.joins), s1, s2); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.calculateValue(sel, ctx, bstate.state1, _val2, bstate.state2); @@ -71,7 +71,7 @@ class EndsWithExpression post = func.substring(idx + 3); } - if (_val1 instanceof Const && ((Const) _val1).getValue(ctx, + if (_val1 instanceof Const && ((Const) _val1).getValue(ctx, bstate.state1) == null) buf.append("1 <> 1"); else if (_val2 instanceof Const) { @@ -94,9 +94,9 @@ class EndsWithExpression // if we can't use LIKE, we have to take the substring of the // first value and compare it to the second dict.assertSupport(pre != null, "StringLengthFunction"); - dict.substring(buf, + dict.substring(buf, new FilterValueImpl(sel, ctx, bstate.state1, _val1), - new StringLengthDifferenceFilterValue(sel, ctx, bstate, pre, + new StringLengthDifferenceFilterValue(sel, ctx, bstate, pre, post), null); buf.append(" = "); _val2.appendTo(sel, ctx, bstate.state2, buf, 0); @@ -105,7 +105,7 @@ class EndsWithExpression sel.append(buf, state.joins); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.selectColumns(sel, ctx, bstate.state1, true); @@ -131,7 +131,7 @@ class EndsWithExpression private final String _pre; private final String _post; - public StringLengthDifferenceFilterValue(Select sel, ExpContext ctx, + public StringLengthDifferenceFilterValue(Select sel, ExpContext ctx, BinaryOpExpState state, String pre, String post) { _sel = sel; _ctx = ctx; @@ -195,11 +195,11 @@ class EndsWithExpression public FieldMapping getFieldMapping() { return null; } - + public PCPath getXPath() { return null; } - + public XMLMetaData getXmlMapping() { return null; } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/EqualExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/EqualExpression.java index 84a3970f8..60d8abbdb 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/EqualExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/EqualExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -38,7 +38,7 @@ class EqualExpression super(val1, val2); } - public void appendTo(Select sel, ExpContext ctx, BinaryOpExpState bstate, + public void appendTo(Select sel, ExpContext ctx, BinaryOpExpState bstate, SQLBuffer buf, boolean val1Null, boolean val2Null) { if (val1Null && val2Null) buf.append("1 = 1"); @@ -58,7 +58,7 @@ class EqualExpression } else { Val val1 = getValue1(); Val val2 = getValue2(); - if (val1.length(sel, ctx, bstate.state1) == 1 + if (val1.length(sel, ctx, bstate.state1) == 1 && val2.length(sel, ctx, bstate.state2) == 1) { ctx.store.getDBDictionary().comparison(buf, "=", new FilterValueImpl(sel, ctx, bstate.state1, val1), diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/EqualTypeExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/EqualTypeExpression.java index afff6bb10..2b1c6d9c3 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/EqualTypeExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/EqualTypeExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -54,7 +54,7 @@ class EqualTypeExpression return sub; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { Val val1 = getValue1(); Val val2 = getValue2(); @@ -66,7 +66,7 @@ class EqualTypeExpression super.appendTo(sel, ctx, state, buf); } - public void appendTo(Select sel, ExpContext ctx, BinaryOpExpState bstate, + public void appendTo(Select sel, ExpContext ctx, BinaryOpExpState bstate, SQLBuffer buf, boolean val1Null, boolean val2Null) { if (val1Null && val2Null) buf.append("1 = 1"); @@ -86,23 +86,23 @@ class EqualTypeExpression } else { Val val1 = getValue1(); Val val2 = getValue2(); - if (val1.length(sel, ctx, bstate.state1) == 1 + if (val1.length(sel, ctx, bstate.state1) == 1 && val2.length(sel, ctx, bstate.state2) == 1) { ClassMapping sub = getSubClassMapping(val1, val2, ctx); if (ctx.isVerticalStrat) { processVerticalTypeAppend(sel, val1, val2, ctx, buf); return; } - + String op = "="; - if (sel.getTablePerClassMeta() != null && sub != sel.getTablePerClassMeta()) + if (sel.getTablePerClassMeta() != null && sub != sel.getTablePerClassMeta()) op = "<>"; ctx.store.getDBDictionary().comparison(buf, op, new FilterValueImpl(sel, ctx, bstate.state1, val1), new FilterValueImpl(sel, ctx, bstate.state2, val2)); } else { - int len = java.lang.Math.min(val1.length(sel, ctx, + int len = java.lang.Math.min(val1.length(sel, ctx, bstate.state1), val2.length(sel, ctx, bstate.state2)); for (int i = 0; i < len; i++) { if (i > 0) @@ -115,8 +115,8 @@ class EqualTypeExpression } } } - - void processVerticalTypeAppend(Select sel, Val val1, Val val2, ExpContext ctx, + + void processVerticalTypeAppend(Select sel, Val val1, Val val2, ExpContext ctx, SQLBuffer buf) { ClassMapping sub = getSubClassMapping(val1, val2, ctx); List selectFrom = sel.getJoinedTableClassMeta(); @@ -129,7 +129,7 @@ class EqualTypeExpression if (sub.isVerticalStrategy()) { ClassMetaData[] subs = cm1.getPCSubclassMetaDatas(); for (int i = 0; i < subs.length; i++) { - if (!Modifier.isAbstract(subs[i].getDescribedType().getModifiers()) && subs[i] == sub + if (!Modifier.isAbstract(subs[i].getDescribedType().getModifiers()) && subs[i] == sub && !selectFrom.contains(subs[i])) selectFrom.add(subs[i]); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Exp.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Exp.java index add1fb7a2..152faf368 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Exp.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Exp.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -48,12 +48,12 @@ interface Exp * Append the SQL for this expression to the given buffer. The SQL * should optionally include any joins this expression needs. */ - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf); /** * Select just the columns for this expression. */ - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ExpContext.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ExpContext.java index 3b372bfa8..0fa41891d 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ExpContext.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ExpContext.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -24,7 +24,7 @@ import org.apache.openjpa.jdbc.meta.ClassMapping; /** * Expression tree context. - * + * * @author Abe White */ public class ExpContext { @@ -42,16 +42,16 @@ public class ExpContext { /** * Fetch configuration. */ - public JDBCFetchConfiguration fetch; + public JDBCFetchConfiguration fetch; public ClassMapping tpcMeta = null; - + public boolean isVerticalStrat = false; public ExpContext() { } - public ExpContext(JDBCStore store, Object[] params, + public ExpContext(JDBCStore store, Object[] params, JDBCFetchConfiguration fetch) { this.store = store; this.params = params; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ExpState.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ExpState.java index 9ae3b8cdb..790a56227 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ExpState.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ExpState.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -22,7 +22,7 @@ import org.apache.openjpa.jdbc.sql.Joins; /** * Expression tree state. - * + * * @author Abe White */ public class ExpState { diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Extension.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Extension.java index 85780e009..b192a1bc7 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Extension.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Extension.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -108,7 +108,7 @@ class Extension argState = _arg.initialize(sel, ctx, JOIN_REL); Joins j1 = (targetState == null) ? null : targetState.joins; Joins j2 = (argState == null) ? null : argState.joins; - return new ExtensionExpState(sel.and(j1, j2), targetState, + return new ExtensionExpState(sel.and(j1, j2), targetState, argState); } @@ -129,12 +129,12 @@ class Extension } } - public void select(Select sel, ExpContext ctx, ExpState state, + public void select(Select sel, ExpContext ctx, ExpState state, boolean pks) { sel.select(newSQLBuffer(sel, ctx, state), this); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { ExtensionExpState estate = (ExtensionExpState) state; if (_target != null) @@ -147,7 +147,7 @@ class Extension sel.groupBy(newSQLBuffer(sel, ctx, state)); } - public void orderBy(Select sel, ExpContext ctx, ExpState state, + public void orderBy(Select sel, ExpContext ctx, ExpState state, boolean asc) { sel.orderBy(newSQLBuffer(sel, ctx, state), asc, false, getSelectAs()); } @@ -159,13 +159,13 @@ class Extension return buf; } - public Object load(ExpContext ctx, ExpState state, Result res) + public Object load(ExpContext ctx, ExpState state, Result res) throws SQLException { return Filters.convert(res.getObject(this, JavaSQLTypes.JDBC_DEFAULT, null), getType()); } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { ExtensionExpState estate = (ExtensionExpState) state; if (_target != null) @@ -178,7 +178,7 @@ class Extension return 1; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { ExtensionExpState estate = (ExtensionExpState) state; FilterValue target = (_target == null) ? null @@ -215,7 +215,7 @@ class Extension return initialize(sel, ctx, 0); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { calculateValue(sel, ctx, state, null, null); appendTo(sel, ctx, state, sql, 0); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/FilterValue.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/FilterValue.java index daf2c33ac..472ea0550 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/FilterValue.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/FilterValue.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -104,13 +104,13 @@ public interface FilterValue { * return null. */ public FieldMapping getFieldMapping(); - + /** * If this is an XPath, return it, * else return null; */ public PCPath getXPath(); - + /** * If this is an XPath, return XML mapping metadata, * else return null; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/FilterValueImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/FilterValueImpl.java index 6ca988d4d..bb6df0a48 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/FilterValueImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/FilterValueImpl.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -39,7 +39,7 @@ class FilterValueImpl private final ExpState _state; private final Val _val; - public FilterValueImpl(Select sel, ExpContext ctx, ExpState state, + public FilterValueImpl(Select sel, ExpContext ctx, ExpState state, Val val) { _sel = sel; _ctx = ctx; @@ -84,7 +84,7 @@ class FilterValueImpl } public Object getSQLValue() { - return (isConstant()) ? ((Const) _val).getSQLValue(_sel, _ctx, _state) + return (isConstant()) ? ((Const) _val).getSQLValue(_sel, _ctx, _state) : null; } @@ -99,14 +99,14 @@ class FilterValueImpl public FieldMapping getFieldMapping() { return (isPath()) ? ((PCPath) _val).getFieldMapping(_state) : null; } - + public PCPath getXPath() { if (isPath() && ((PCPath) _val).isXPath()) return (PCPath) _val; else return null; } - + public XMLMetaData getXmlMapping() { return (getXPath() == null) ? null : getXPath().getXmlMapping(); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/GeneralCaseExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/GeneralCaseExpression.java index 0f4c61a6a..35fdb92e2 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/GeneralCaseExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/GeneralCaseExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -95,16 +95,16 @@ public class GeneralCaseExpression private static class GeneralCaseExpState extends ExpState { - + public ExpState[] states; - + public GeneralCaseExpState(Joins joins, ExpState[] states) { super(joins); this.states = states; } } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf, int index) { GeneralCaseExpState cstate = (GeneralCaseExpState) state; @@ -119,7 +119,7 @@ public class GeneralCaseExpression buf.append(" END "); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { GeneralCaseExpState cstate = (GeneralCaseExpState) state; int i = 0; @@ -143,12 +143,12 @@ public class GeneralCaseExpression public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { GeneralCaseExpState gstate = (GeneralCaseExpState) state; - for (int i = 0; i < _exp.length; i++) { + for (int i = 0; i < _exp.length; i++) { BinaryOpExpState bstate = (BinaryOpExpState) gstate.states[i]; ((WhenCondition) _exp[i]).getVal().calculateValue(sel, ctx, bstate.state2, other, otherState); } - _val.calculateValue(sel, ctx, gstate.states[_exp.length], other, + _val.calculateValue(sel, ctx, gstate.states[_exp.length], other, otherState); } @@ -187,7 +187,7 @@ public class GeneralCaseExpression } public void setImplicitType(Class type) { - _cast = type; + _cast = type; } public void setMetaData(ClassMetaData meta) { @@ -196,15 +196,15 @@ public class GeneralCaseExpression public void setOtherPath(Value other) { this.other = other; } - + public Value getOtherPath() { return other; } - + public void setOtherState(ExpState otherState) { this.otherState = otherState; } - + public ExpState getOtherState() { return otherState; } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/GetColumn.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/GetColumn.java index 9d50f235f..ea157e253 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/GetColumn.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/GetColumn.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/GetMapValue.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/GetMapValue.java index fac53599f..7a22403fd 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/GetMapValue.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/GetMapValue.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -96,7 +96,7 @@ class GetMapValue public final ExpState mapState; public final ExpState keyState; - public GetMapValueExpState(Joins joins, ExpState mapState, + public GetMapValueExpState(Joins joins, ExpState mapState, ExpState keyState) { super(joins); this.mapState = mapState; @@ -104,14 +104,14 @@ class GetMapValue } } - public Object toDataStoreValue(Select sel, ExpContext ctx, ExpState state, + public Object toDataStoreValue(Select sel, ExpContext ctx, ExpState state, Object val) { GetMapValueExpState gstate = (GetMapValueExpState) state; return _map.toDataStoreValue(sel, ctx, gstate.mapState, val); } - public void select(Select sel, ExpContext ctx, ExpState state, + public void select(Select sel, ExpContext ctx, ExpState state, boolean pks) { sel.select(newSQLBuffer(sel, ctx, state).append(" AS ").append(_alias), this); @@ -128,7 +128,7 @@ class GetMapValue sel.groupBy(newSQLBuffer(sel, ctx, state)); } - public void orderBy(Select sel, ExpContext ctx, ExpState state, + public void orderBy(Select sel, ExpContext ctx, ExpState state, boolean asc) { sel.orderBy(_alias, asc, false); } @@ -146,7 +146,7 @@ class GetMapValue JavaSQLTypes.JDBC_DEFAULT, null), getType()); } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { GetMapValueExpState gstate = (GetMapValueExpState) state; _map.calculateValue(sel, ctx, gstate.mapState, null, null); @@ -157,7 +157,7 @@ class GetMapValue return 1; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { if (!(_map instanceof PCPath)) throw new UnsupportedOperationException(); @@ -191,7 +191,7 @@ class GetMapValue sql.append(" WHERE "); // add in the joins - ContainerFieldStrategy.appendUnaliasedJoin(sql, sel, null, + ContainerFieldStrategy.appendUnaliasedJoin(sql, sel, null, ctx.store.getDBDictionary(), field, fk); sql.append(" AND "); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/GetObjectId.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/GetObjectId.java index 534334501..96a591a41 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/GetObjectId.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/GetObjectId.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -91,7 +91,7 @@ class GetObjectId return state; } - public Object toDataStoreValue(Select sel, ExpContext ctx, ExpState state, + public Object toDataStoreValue(Select sel, ExpContext ctx, ExpState state, Object val) { // if datastore identity, try to convert to a long value ClassMapping mapping = _path.getClassMapping(state); @@ -128,12 +128,12 @@ class GetObjectId return vals; } - public void select(Select sel, ExpContext ctx, ExpState state, + public void select(Select sel, ExpContext ctx, ExpState state, boolean pks) { selectColumns(sel, ctx, state, true); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { _path.selectColumns(sel, ctx, state, true); } @@ -142,7 +142,7 @@ class GetObjectId _path.groupBy(sel, ctx, state); } - public void orderBy(Select sel, ExpContext ctx, ExpState state, + public void orderBy(Select sel, ExpContext ctx, ExpState state, boolean asc) { _path.orderBy(sel, ctx, state, asc); } @@ -152,7 +152,7 @@ class GetObjectId return _path.load(ctx, state, res, true); } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { _path.calculateValue(sel, ctx, state, null, null); } @@ -161,7 +161,7 @@ class GetObjectId return _path.length(sel, ctx, state); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { _path.appendTo(sel, ctx, state, sql, index); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/HasContainsExpressionVisitor.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/HasContainsExpressionVisitor.java index e177c4449..e16380c93 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/HasContainsExpressionVisitor.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/HasContainsExpressionVisitor.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -23,10 +23,10 @@ import org.apache.openjpa.kernel.exps.Expression; /** * Determines whether the visited expressions include a "contains" expression. - * + * * @author Abe White */ -class HasContainsExpressionVisitor +class HasContainsExpressionVisitor extends AbstractExpressionVisitor { private boolean _found = false; @@ -41,7 +41,7 @@ class HasContainsExpressionVisitor public void enter(Expression exp) { if (!_found) - _found = exp instanceof ContainsExpression + _found = exp instanceof ContainsExpression || exp instanceof BindVariableAndExpression; } -} +} diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InExpression.java index 700b3c029..c308960df 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -82,7 +82,7 @@ class InExpression public final ExpState constantState; public final ExpState valueState; - public InExpState(Joins joins, ExpState constantState, + public InExpState(Joins joins, ExpState constantState, ExpState valueState) { super(joins); this.constantState = constantState; @@ -90,9 +90,9 @@ class InExpression } } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { - InExpState istate = (InExpState) state; + InExpState istate = (InExpState) state; if (_val instanceof Type) _const.calculateValue(sel, ctx, istate.constantState, _val, istate.valueState); @@ -105,7 +105,7 @@ class InExpression if (coll != null) { list = new ArrayList(coll.size()); for (Iterator itr = coll.iterator(); itr.hasNext();) - list.add(_val.toDataStoreValue(sel, ctx, istate.valueState, + list.add(_val.toDataStoreValue(sel, ctx, istate.valueState, itr.next())); } @@ -125,10 +125,10 @@ class InExpression } /** - * Based on the inClauseLimit of the DBDictionary, create the needed IN + * Based on the inClauseLimit of the DBDictionary, create the needed IN * clauses */ - private void createInContains(Select sel, ExpContext ctx, ExpState state, + private void createInContains(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf, List list, Column[] cols) { int inClauseLimit = ctx.store.getDBDictionary().inClauseLimit; @@ -149,14 +149,14 @@ class InExpression /** * Construct an IN clause with the value of the given collection. */ - private void inContains(Select sel, ExpContext ctx, ExpState state, + private void inContains(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf, Collection coll, Column[] cols) { _val.appendTo(sel, ctx, state, buf, 0); buf.append(" IN ("); Column col = (cols != null && cols.length == 1) ? cols[0] : null; for (Iterator itr = coll.iterator(); itr.hasNext();) { - buf.appendValue(itr.next(), col, _const instanceof Parameter + buf.appendValue(itr.next(), col, _const instanceof Parameter ? (Parameter)_const : null); if (itr.hasNext()) buf.append(", "); @@ -168,7 +168,7 @@ class InExpression * If the value to test is a compound key, we can't use IN, * so create a clause like '(a = b AND c = d) OR (e = f AND g = h) ...' */ - private void orContains(Select sel, ExpContext ctx, ExpState state, + private void orContains(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf, Collection coll, Column[] cols) { if (coll.size() > 1) buf.append("("); @@ -201,9 +201,9 @@ class InExpression buf.append(")"); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { - InExpState istate = (InExpState) state; + InExpState istate = (InExpState) state; _const.selectColumns(sel, ctx, istate.constantState, true); _val.selectColumns(sel, ctx, istate.valueState, true); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InKeyExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InKeyExpression.java index 94bb4dc43..09a47bcdf 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InKeyExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InKeyExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InSubQExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InSubQExpression.java index 95bcea6ef..85eadd514 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InSubQExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InSubQExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -59,7 +59,7 @@ class InSubQExpression public final ExpState subqState; public final ExpState valueState; - public InSubQExpState(Joins joins, ExpState subqState, + public InSubQExpState(Joins joins, ExpState subqState, ExpState valueState) { super(joins); this.subqState = subqState; @@ -67,7 +67,7 @@ class InSubQExpression } } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { InSubQExpState istate = (InSubQExpState) state; _sub.calculateValue(sel, ctx, istate.subqState, null, null); @@ -77,7 +77,7 @@ class InSubQExpression _sub.appendTo(sel, ctx, istate.valueState, buf, 0); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { InSubQExpState istate = (InSubQExpState) state; _sub.selectColumns(sel, ctx, istate.subqState, pks); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InValueExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InValueExpression.java index fd37e796f..38eb9c526 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InValueExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InValueExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Index.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Index.java index ddea63eb1..b5f6a7684 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Index.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Index.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -39,7 +39,7 @@ class Index return initializeValue(sel, ctx, NULL_CMP); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { getValue().calculateValue(sel, ctx, state, null, null); getValue().appendIndex(sel, ctx, state, sql); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/IndexOf.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/IndexOf.java index 5f0a5fd16..8266751cb 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/IndexOf.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/IndexOf.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -80,12 +80,12 @@ public class IndexOf return new BinaryOpExpState(sel.and(s1.joins, s2.joins), s1, s2); } - public void select(Select sel, ExpContext ctx, ExpState state, + public void select(Select sel, ExpContext ctx, ExpState state, boolean pks) { sel.select(newSQLBuffer(sel, ctx, state), this); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.selectColumns(sel, ctx, bstate.state1, true); @@ -96,7 +96,7 @@ public class IndexOf sel.groupBy(newSQLBuffer(sel, ctx, state)); } - public void orderBy(Select sel, ExpContext ctx, ExpState state, + public void orderBy(Select sel, ExpContext ctx, ExpState state, boolean asc) { sel.orderBy(newSQLBuffer(sel, ctx, state), asc, false, getSelectAs()); } @@ -108,13 +108,13 @@ public class IndexOf return buf; } - public Object load(ExpContext ctx, ExpState state, Result res) + public Object load(ExpContext ctx, ExpState state, Result res) throws SQLException { - return Filters.convert(res.getObject(this, JavaSQLTypes.JDBC_DEFAULT, + return Filters.convert(res.getObject(this, JavaSQLTypes.JDBC_DEFAULT, null), getType()); } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.calculateValue(sel, ctx, bstate.state1, null, null); @@ -125,14 +125,14 @@ public class IndexOf return 1; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { BinaryOpExpState bstate = (BinaryOpExpState) state; FilterValue str = new FilterValueImpl(sel, ctx, bstate.state1, _val1); FilterValue search; FilterValue start = null; if (_val2 instanceof Args) { - FilterValue[] filts = ((Args) _val2).newFilterValues(sel, ctx, + FilterValue[] filts = ((Args) _val2).newFilterValues(sel, ctx, bstate.state2); search = filts[0]; start = filts[1]; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InstanceofExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InstanceofExpression.java index 430461641..33a05ae9b 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InstanceofExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/InstanceofExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -77,8 +77,8 @@ class InstanceofExpression // if the path represents a relation, get its class indicator and // make sure it's joined down to its base type - Discriminator discrim = (relMapping == null - || !relMapping.getDescribedType().isAssignableFrom(_cls)) + Discriminator discrim = (relMapping == null + || !relMapping.getDescribedType().isAssignableFrom(_cls)) ? null : relMapping.getDiscriminator(); ClassMapping mapping = null; Joins joins = pathState.joins; @@ -123,7 +123,7 @@ class InstanceofExpression public final Discriminator discrim; public final Class rel; - public InstanceofExpState(Joins joins, ExpState pathState, + public InstanceofExpState(Joins joins, ExpState pathState, ClassMapping mapping, Discriminator discrim, Class rel) { super(joins); this.pathState = pathState; @@ -133,7 +133,7 @@ class InstanceofExpression } } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { // if no class indicator or a final class, just append true or false // depending on whether the cast matches the expected type @@ -152,7 +152,7 @@ class InstanceofExpression sel.append(sql, istate.joins); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { InstanceofExpState istate = (InstanceofExpState) state; if (istate.discrim != null) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/IsEmptyExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/IsEmptyExpression.java index 1601c0cf9..0ab9dc50f 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/IsEmptyExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/IsEmptyExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -45,14 +45,14 @@ class IsEmptyExpression return _val.initialize(sel, ctx, Val.NULL_CMP); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { _val.calculateValue(sel, ctx, state, null, null); _val.appendIsEmpty(sel, ctx, state, buf); sel.append(buf, state.joins); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { _val.selectColumns(sel, ctx, state, true); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/IsNotEmptyExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/IsNotEmptyExpression.java index 2dc7ba200..226f322bb 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/IsNotEmptyExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/IsNotEmptyExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -45,14 +45,14 @@ class IsNotEmptyExpression return _val.initialize(sel, ctx, Val.NULL_CMP); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { _val.calculateValue(sel, ctx, state, null, null); _val.appendIsNotEmpty(sel, ctx, state, buf); sel.append(buf, state.joins); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { _val.selectColumns(sel, ctx, state, true); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCAggregateListener.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCAggregateListener.java index 4e6d836cd..f73db264d 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCAggregateListener.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCAggregateListener.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCExpressionFactory.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCExpressionFactory.java index 8a283cea2..eb9bec413 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCExpressionFactory.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCExpressionFactory.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -57,7 +57,7 @@ public class JDBCExpressionFactory private final ClassMapping _type; private final SelectConstructor _cons = new SelectConstructor(); private int _getMapValueAlias = 0; - + private boolean _isBooleanLiteralAsNumeric = true; /** @@ -70,7 +70,7 @@ public class JDBCExpressionFactory public void setBooleanLiteralAsNumeric(boolean isBooleanLiteralAsNumeric) { _isBooleanLiteralAsNumeric = isBooleanLiteralAsNumeric; } - + /** * Use to create SQL select. */ @@ -111,13 +111,13 @@ public class JDBCExpressionFactory val.getMetaData().getPCSubclasses().length > 0)) throw new UserException(_loc. get("invalid-type-argument", path.last() != null ? path.getPCPathString() : path.getSchemaAlias())); - + if (disc.getColumns().length == 0) { if (disc.getStrategy() instanceof NoneDiscriminatorStrategy) { // limited support for table per class inheritance hierarchy if (path.last() != null) throw new UserException(_loc. - get("type-argument-unsupported", path.last().getName())); + get("type-argument-unsupported", path.last().getName())); if (isNotEqual) { if (param != null && param instanceof Null) throw new UserException(_loc. @@ -129,7 +129,7 @@ public class JDBCExpressionFactory } if (param != null && param instanceof CollectionParam) throw new UserException(_loc. - get("collection-param-unsupported")); + get("collection-param-unsupported")); } } @@ -220,7 +220,7 @@ public class JDBCExpressionFactory } public Expression not(Expression exp) { - if (!(exp instanceof IsNotEmptyExpression) && + if (!(exp instanceof IsNotEmptyExpression) && !(exp instanceof InSubQExpression) && HasContainsExpressionVisitor.hasContains(exp)) return new NotContainsExpression((Exp) exp); @@ -275,10 +275,10 @@ public class JDBCExpressionFactory if (!(v2 instanceof Const)) throw new UserException(_loc.get("const-only", "matches")); if (esc == null && _type.getMappingRepository(). - getDBDictionary().requiresSearchStringEscapeForLike == true) { + getDBDictionary().requiresSearchStringEscapeForLike == true) { esc = _type.getMappingRepository(). getDBDictionary().searchStringEscape; - } + } return new MatchesExpression((Val) v1, (Const) v2, single, multi, esc); } @@ -351,7 +351,7 @@ public class JDBCExpressionFactory public Arguments newArgumentList(Value v1, Value v2) { return new Args((Val) v1, (Val) v2); } - + public Arguments newArgumentList(Value... vs) { if (vs == null) return new Args(null); @@ -497,7 +497,7 @@ public class JDBCExpressionFactory } public Value getMapValue(Value map, Value arg) { - return new GetMapValue((Val) map, (Val) arg, + return new GetMapValue((Val) map, (Val) arg, "gmv" + _getMapValueAlias++); } @@ -505,7 +505,7 @@ public class JDBCExpressionFactory if (val instanceof Lit) { Lit lit = (Lit) val; StringBuilder value = new StringBuilder(); - int pType = lit.getParseType(); + int pType = lit.getParseType(); if (pType == Literal.TYPE_SQ_STRING || pType == Literal.TYPE_STRING) value.append("'").append(lit.getValue().toString()).append("'"); @@ -569,17 +569,17 @@ public class JDBCExpressionFactory val2 = getLiteralRawString(val2); return new NullIfExpression((Val) val1, (Val) val2); } - + public Value newFunction(String functionName, Class resultType, Value... args) { return new DatastoreFunction(functionName, resultType, newArgumentList(args)); } - + public boolean isVerticalType(Value val) { if (!(val instanceof Type)) return false; ClassMapping cm = (ClassMapping)((Type)val).getMetaData(); - String strat = cm.getMappingInfo().getHierarchyStrategy(); - if (strat != null && strat.equals(VerticalClassStrategy.ALIAS)) + String strat = cm.getMappingInfo().getHierarchyStrategy(); + if (strat != null && strat.equals(VerticalClassStrategy.ALIAS)) return true; return false; } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCFilterListener.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCFilterListener.java index f461e9f85..e86656528 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCFilterListener.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCFilterListener.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCPath.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCPath.java index 18eaef270..b57360fcf 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCPath.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCPath.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCStringContains.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCStringContains.java index 337c67278..1d528cc1e 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCStringContains.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCStringContains.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCWildcardMatch.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCWildcardMatch.java index eb29d6f96..040c9af0d 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCWildcardMatch.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCWildcardMatch.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Lit.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Lit.java index 4444ad246..904f956dd 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Lit.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Lit.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -64,7 +64,7 @@ public class Lit return _ptype; } - public Object getValue() { + public Object getValue() { return _val; } @@ -75,11 +75,11 @@ public class Lit public Object getValue(Object[] params) { return getValue(); } - + public boolean isRaw() { return _isRaw; } - + public void setRaw(boolean isRaw) { _isRaw = isRaw; } @@ -99,10 +99,10 @@ public class Lit extends ConstExpState { public Object sqlValue; - public int otherLength; - } + public int otherLength; + } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { super.calculateValue(sel, ctx, state, other, otherState); LitExpState lstate = (LitExpState) state; @@ -113,7 +113,7 @@ public class Lit lstate.sqlValue = _val; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { LitExpState lstate = (LitExpState) state; if (lstate.otherLength > 1) { @@ -122,7 +122,7 @@ public class Lit return; } else if (_isRaw) { int parseType = getParseType(); - if (parseType == Literal.TYPE_ENUM) { + if (parseType == Literal.TYPE_ENUM) { StringBuilder value = new StringBuilder(); boolean isOrdinal = false; if (lstate.sqlValue instanceof Integer) @@ -145,7 +145,7 @@ public class Lit } Object useLiteral = ctx.fetch.getHint(QueryHints.HINT_USE_LITERAL_IN_SQL); // useLiteral = true; - boolean useParamToken = useLiteral != null ? !(Boolean)useLiteral : true; + boolean useParamToken = useLiteral != null ? !(Boolean)useLiteral : true; sql.appendValue(lstate.sqlValue, lstate.getColumn(index), null, useParamToken); } } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MapEntry.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MapEntry.java index 7f5aff399..ebdcd3b02 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MapEntry.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MapEntry.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -57,7 +57,7 @@ public class MapEntry extends ExpState { public ExpState key; public ExpState val; - + EntryExpState(ExpState key, ExpState val) { this.key = key; this.val = val; @@ -125,7 +125,7 @@ public class MapEntry } public void setMetaData(ClassMetaData meta) { - _meta = meta; + _meta = meta; } private static class Entry implements Map.Entry { diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MapKey.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MapKey.java index 56260abfc..7dee92674 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MapKey.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MapKey.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -54,7 +54,7 @@ public class MapKey extends ExpState { public ExpState key; public ExpState val; - + KeyExpState(ExpState key) { this.key = key; } @@ -122,13 +122,13 @@ public class MapKey } public void setMetaData(ClassMetaData meta) { - _meta = meta; + _meta = meta; } - public Object toDataStoreValue(Select sel, ExpContext ctx, ExpState state, + public Object toDataStoreValue(Select sel, ExpContext ctx, ExpState state, Object val) { KeyExpState estate = (KeyExpState) state; - return _key.toDataStoreValue(sel, ctx, + return _key.toDataStoreValue(sel, ctx, estate.key, val); } } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MatchesExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MatchesExpression.java index 472795b75..9c3cda2a5 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MatchesExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MatchesExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -61,7 +61,7 @@ class MatchesExpression return new BinaryOpExpState(sel.and(s1.joins, s2.joins), s1, s2); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val.calculateValue(sel, ctx, bstate.state1, _const, bstate.state2); @@ -103,25 +103,25 @@ class MatchesExpression // with '%' and '.' with '_' str = replaceEscape(str, _multi, "%", _escape); str = replaceEscape(str, _single, "_", _escape); - buf.append(" LIKE ").appendValue(str, col, + buf.append(" LIKE ").appendValue(str, col, _const instanceof Parameter ? (Parameter)_const : null); // escape out characters by using the database's escape sequence DBDictionary dict = ctx.store.getDBDictionary(); if (_escape != null) { - if (_escape.equals("\\")) + if (_escape.equals("\\")) buf.append(" ESCAPE '").append(dict.searchStringEscape).append("'"); else buf.append(" ESCAPE '").append(_escape).append("'"); } - + } sel.append(buf, state.joins); } - /** - * Perform a string replacement with simplistic escape handing. - * + /** + * Perform a string replacement with simplistic escape handing. + * * @param str the source string * @param from the string to find * @param to the string to replace @@ -151,7 +151,7 @@ class MatchesExpression return repbuf.toString(); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val.selectColumns(sel, ctx, bstate.state1, true); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Math.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Math.java index 282c1f64c..bf413ebc7 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Math.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Math.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -95,12 +95,12 @@ public class Math return new BinaryOpExpState(sel.and(s1.joins, s2.joins), s1, s2); } - public void select(Select sel, ExpContext ctx, ExpState state, + public void select(Select sel, ExpContext ctx, ExpState state, boolean pks) { sel.select(newSQLBuffer(sel, ctx, state), this); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.selectColumns(sel, ctx, bstate.state1, true); @@ -111,7 +111,7 @@ public class Math sel.groupBy(newSQLBuffer(sel, ctx, state)); } - public void orderBy(Select sel, ExpContext ctx, ExpState state, + public void orderBy(Select sel, ExpContext ctx, ExpState state, boolean asc) { sel.orderBy(newSQLBuffer(sel, ctx, state), asc, false, getSelectAs()); } @@ -125,11 +125,11 @@ public class Math public Object load(ExpContext ctx, ExpState state, Result res) throws SQLException { - return Filters.convert(res.getObject(this, JavaSQLTypes.JDBC_DEFAULT, + return Filters.convert(res.getObject(this, JavaSQLTypes.JDBC_DEFAULT, null), getType()); } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.calculateValue(sel, ctx, bstate.state1, _val2, bstate.state2); @@ -140,7 +140,7 @@ public class Math return 1; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { BinaryOpExpState bstate = (BinaryOpExpState) state; ctx.store.getDBDictionary().mathFunction(sql, _op, diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Max.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Max.java index 0cccfab90..91b4a884c 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Max.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Max.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Min.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Min.java index 97c7de0ae..c21df54cb 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Min.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Min.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NotContainsExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NotContainsExpression.java index 5c2c97a78..199058862 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NotContainsExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NotContainsExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -52,7 +52,7 @@ class NotContainsExpression */ private static class NotContainsExpState extends ExpState { - + public final Map contains; public NotContainsExpState(Map contains) { @@ -60,7 +60,7 @@ class NotContainsExpression } } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { DBDictionary dict = ctx.store.getDBDictionary(); dict.assertSupport(dict.supportsSubselect, "SupportsSubselect"); @@ -71,7 +71,7 @@ class NotContainsExpression sub.setContext(sel.ctx()); // the context select should still belong to parent sub.ctx().setSelect(sel); - ExpState estate = _exp.initialize(sub, ctx, ((NotContainsExpState) + ExpState estate = _exp.initialize(sub, ctx, ((NotContainsExpState) state).contains); sub.where(sub.and(null, estate.joins)); @@ -84,9 +84,9 @@ class NotContainsExpression buf.appendCount(sub, ctx.fetch); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { - ExpState estate = _exp.initialize(sel, ctx, ((NotContainsExpState) + ExpState estate = _exp.initialize(sel, ctx, ((NotContainsExpState) state).contains); _exp.selectColumns(sel, ctx, estate, true); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NotEqualExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NotEqualExpression.java index 41cc89da6..90cb7dea3 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NotEqualExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NotEqualExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -36,7 +36,7 @@ class NotEqualExpression super(val1, val2); } - public void appendTo(Select sel, ExpContext ctx, BinaryOpExpState bstate, + public void appendTo(Select sel, ExpContext ctx, BinaryOpExpState bstate, SQLBuffer buf, boolean val1Null, boolean val2Null) { if (val1Null && val2Null) buf.append("1 <> 1"); @@ -56,13 +56,13 @@ class NotEqualExpression } else { Val val1 = getValue1(); Val val2 = getValue2(); - if (val1.length(sel, ctx, bstate.state1) == 1 + if (val1.length(sel, ctx, bstate.state1) == 1 && val2.length(sel, ctx, bstate.state2) == 1) { ctx.store.getDBDictionary().comparison(buf, "<>", new FilterValueImpl(sel, ctx, bstate.state1, val1), new FilterValueImpl(sel, ctx, bstate.state2, val2)); } else { - int len = java.lang.Math.max(val1.length(sel, ctx, + int len = java.lang.Math.max(val1.length(sel, ctx, bstate.state1), val2.length(sel, ctx, bstate.state2)); buf.append("("); for (int i = 0; i < len; i++) { diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NotEqualTypeExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NotEqualTypeExpression.java index 802a88a8e..110c8b4e6 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NotEqualTypeExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NotEqualTypeExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -54,7 +54,7 @@ class NotEqualTypeExpression return sub; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { Val val1 = getValue1(); Val val2 = getValue2(); @@ -63,11 +63,11 @@ class NotEqualTypeExpression appendTo(sel, ctx, (BinaryOpExpState)state, buf, false, false); return; } - + super.appendTo(sel, ctx, state, buf); } - - public void appendTo(Select sel, ExpContext ctx, BinaryOpExpState bstate, + + public void appendTo(Select sel, ExpContext ctx, BinaryOpExpState bstate, SQLBuffer buf, boolean val1Null, boolean val2Null) { if (val1Null && val2Null) buf.append("1 <> 1"); @@ -87,25 +87,25 @@ class NotEqualTypeExpression } else { Val val1 = getValue1(); Val val2 = getValue2(); - if (val1.length(sel, ctx, bstate.state1) == 1 + if (val1.length(sel, ctx, bstate.state1) == 1 && val2.length(sel, ctx, bstate.state2) == 1) { ClassMapping sub = getSubClassMapping(val1, val2, ctx); if (ctx.isVerticalStrat) { processVerticalTypeAppend(sel, val1, val2, ctx, buf); return; } - + String op; if (sub != sel.getTablePerClassMeta()) op = "="; else op = "<>"; - + ctx.store.getDBDictionary().comparison(buf, op, new FilterValueImpl(sel, ctx, bstate.state1, val1), new FilterValueImpl(sel, ctx, bstate.state2, val2)); } else { - int len = java.lang.Math.max(val1.length(sel, ctx, + int len = java.lang.Math.max(val1.length(sel, ctx, bstate.state1), val2.length(sel, ctx, bstate.state2)); buf.append("("); for (int i = 0; i < len; i++) { @@ -119,8 +119,8 @@ class NotEqualTypeExpression } } } - - void processVerticalTypeAppend(Select sel, Val val1, Val val2, ExpContext ctx, + + void processVerticalTypeAppend(Select sel, Val val1, Val val2, ExpContext ctx, SQLBuffer buf) { ClassMapping sub = getSubClassMapping(val1, val2, ctx); ClassMapping cm1 = (ClassMapping)((val1 instanceof Type) ? val1.getMetaData() : @@ -138,14 +138,14 @@ class NotEqualTypeExpression selectFrom = new ArrayList(); sel.setJoinedTableClassMeta(selectFrom); } - + for (int i = 0; i < subs.length; i++) { - if (!Modifier.isAbstract(subs[i].getDescribedType().getModifiers()) && + if (!Modifier.isAbstract(subs[i].getDescribedType().getModifiers()) && !selectFrom.contains(subs[i])) selectFrom.add(subs[i]); } buf.append("1=1"); return; } - } + } } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NotExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NotExpression.java index 913d0b9e0..2eb04ff37 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NotExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NotExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -42,7 +42,7 @@ class NotExpression _exp = exp; } - public ExpState initialize(Select sel, ExpContext ctx, Map contains) { + public ExpState initialize(Select sel, ExpContext ctx, Map contains) { ExpState state = _exp.initialize(sel, ctx, contains); return new NotExpState(sel.or(state.joins, null), state); } @@ -50,7 +50,7 @@ class NotExpression /** * Expression state. */ - private static class NotExpState + private static class NotExpState extends ExpState { public final ExpState state; @@ -61,14 +61,14 @@ class NotExpression } } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { buf.append("NOT ("); _exp.appendTo(sel, ctx, ((NotExpState) state).state, buf); buf.append(")"); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { _exp.selectColumns(sel, ctx, ((NotExpState) state).state, pks); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Null.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Null.java index 2fd52fd5b..16f495989 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Null.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Null.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -40,11 +40,11 @@ public class Null return null; } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { sql.appendValue(null); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NullIfExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NullIfExpression.java index 6bb29a745..9ed28afdf 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NullIfExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NullIfExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -78,10 +78,10 @@ public class NullIfExpression return new BinaryOpExpState(sel.and(s1.joins, s2.joins), s1, s2); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf, int index) { BinaryOpExpState bstate = (BinaryOpExpState) state; - + buf.append(" NULLIF("); // MySQL does not like space before bracket _val1.appendTo(sel, ctx, bstate.state1, buf, 0); @@ -91,7 +91,7 @@ public class NullIfExpression buf.append(")"); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.selectColumns(sel, ctx, bstate.state1, true); @@ -151,28 +151,28 @@ public class NullIfExpression } public void setImplicitType(Class type) { - _cast = type; + _cast = type; } public void setMetaData(ClassMetaData meta) { _meta = meta; } - + public void setOtherPath(Value other) { this.other = other; } - + public Value getOtherPath() { return other; } - + public void setOtherState(ExpState otherState) { this.otherState = otherState; } - + public ExpState getOtherState() { return otherState; } - + } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NullableAggregateUnaryOp.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NullableAggregateUnaryOp.java index b69c0187f..cb67b2688 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NullableAggregateUnaryOp.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/NullableAggregateUnaryOp.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/OrExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/OrExpression.java index bfbd4af79..7e302d6fe 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/OrExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/OrExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -71,7 +71,7 @@ class OrExpression return ret; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { BinaryOpExpState bstate = (BinaryOpExpState) state; boolean paren = bstate.joins != null && !bstate.joins.isEmpty(); @@ -87,7 +87,7 @@ class OrExpression sel.append(buf, bstate.joins); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { BinaryOpExpState bstate = (BinaryOpExpState) state; _exp1.selectColumns(sel, ctx, bstate.state1, pks); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java index 26b8c1cec..4591f52ce 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -139,14 +139,14 @@ public class PCPath extends CandidatePath implements JDBCPath { } public void setSchemaAlias(String schemaAlias) { - if (_schemaAlias == null) + if (_schemaAlias == null) _schemaAlias = schemaAlias; } public String getSchemaAlias() { return _schemaAlias; } - + public void setSubqueryContext(Context context, String correlationVar) { Action action = lastFieldAction(); if (action == null) @@ -154,7 +154,7 @@ public class PCPath extends CandidatePath implements JDBCPath { action.context = context; _correlationVar = correlationVar; } - + /** * Set the path as a binding of the given variable. */ @@ -191,8 +191,8 @@ public class PCPath extends CandidatePath implements JDBCPath { if (last != null && last.op == Action.VAR && ((String)last.data).equals(last.var)) { _cid = true; return; - } - + } + // treat it just like a unique variable Action action = new Action(); action.op = Action.VAR; @@ -214,23 +214,23 @@ public class PCPath extends CandidatePath implements JDBCPath { public boolean isKey() { return _key; } - + public boolean isXPath() { return _type == XPATH; } - + public String getXPath() { StringBuilder xpath = new StringBuilder(); Action action; Iterator itr = _actions.iterator(); - + // Skip variable actions since they are not part of the xpath // until we reach the first xpath action. // The first xpath action maps to the root of an xml document. - do - action = (Action) itr.next(); + do + action = (Action) itr.next(); while (action.op != Action.GET_XPATH); - + // Skip XmlRootElement: // We can't rely on the accuracy of the name of the root element, // because it could be set to some default by JAXB XML Binding. @@ -247,7 +247,7 @@ public class PCPath extends CandidatePath implements JDBCPath { } return xpath.toString(); } - + public String getPCPathString() { if (_actions == null) return (_varName == null) ? "" : _varName + "."; @@ -260,7 +260,7 @@ public class PCPath extends CandidatePath implements JDBCPath { path.append(action.data); else if (action.op == Action.UNBOUND_VAR) path.append(((Variable) action.data).getName()); - else + else path.append(((FieldMapping) action.data).getName()); path.append('.'); } @@ -307,10 +307,10 @@ public class PCPath extends CandidatePath implements JDBCPath { if (_key || (_keyPath && pstate.field.getKey() != null && !pstate.field.getKey().isEmbedded())) { - if (!pstate.joinedRel + if (!pstate.joinedRel && pstate.field.getKey().getValueMappedBy() != null) joinRelation(pstate, _key, false, false); - else if (pstate.joinedRel + else if (pstate.joinedRel && pstate.field.getKey().getTypeCode() == JavaTypes.PC) return pstate.field.getKeyMapping().getTypeMapping(). getPrimaryKeyColumns(); @@ -354,7 +354,7 @@ public class PCPath extends CandidatePath implements JDBCPath { if (_actions == null) return false; Action action = (Action) _actions.getLast(); - return action.op == Action.UNBOUND_VAR || action.op == Action.VAR; + return action.op == Action.UNBOUND_VAR || action.op == Action.VAR; } public void get(FieldMetaData field, boolean nullTraversal) { @@ -369,7 +369,7 @@ public class PCPath extends CandidatePath implements JDBCPath { _cast = null; _key = false; } - + public void get(FieldMetaData fmd, XMLMetaData meta) { if (_actions == null) _actions = new LinkedList(); @@ -382,7 +382,7 @@ public class PCPath extends CandidatePath implements JDBCPath { _type = XPATH; _xmlfield = fmd; } - + public void get(XMLMetaData meta, String name) { Action action = new Action(); action.op = Action.GET_XPATH; @@ -392,7 +392,7 @@ public class PCPath extends CandidatePath implements JDBCPath { _key = false; _type = XPATH; } - + public XMLMetaData getXmlMapping() { Action act = (Action) _actions.getLast(); if (act != null) @@ -448,7 +448,7 @@ public class PCPath extends CandidatePath implements JDBCPath { if (isXPath()) return (Action) _actions.getLast(); - + ListIterator itr = _actions.listIterator(_actions.size()); Action prev; while (itr.hasPrevious()) { @@ -515,7 +515,7 @@ public class PCPath extends CandidatePath implements JDBCPath { Action prevaction = null; boolean isCorrelatedPath = false; boolean fromParentRootInSubselect = navigateFromParentRootInSubselect(sel); - + while (itr != null && itr.hasNext()) { action = (Action) itr.next(); @@ -526,7 +526,7 @@ public class PCPath extends CandidatePath implements JDBCPath { sel.ctx().getVariable(action.var) == null) { isCorrelatedPath = true; pstate.joins = pstate.joins.setCorrelatedVariable(action.var); - } else + } else pstate.joins = pstate.joins.setVariable((String) action.data); } else if (action.op == Action.SUBQUERY) { @@ -539,13 +539,13 @@ public class PCPath extends CandidatePath implements JDBCPath { if (rel == null) throw new IllegalArgumentException(_loc.get( "invalid-unbound-var", var.getName()).toString()); - + if (sel.getParent() != null && action.var != null && sel.ctx().getVariable(action.var) == null) { //System.out.println("Correlated action var="+action.var); isCorrelatedPath = true; pstate.joins = pstate.joins.setCorrelatedVariable(var.getName()); - } else + } else pstate.joins = pstate.joins.setVariable(var.getName()); pstate.joins = pstate.joins.crossJoin(_candidate.getTable(), @@ -567,13 +567,13 @@ public class PCPath extends CandidatePath implements JDBCPath { pstate.cmpfield = field; break; } - + if (fromParentRootInSubselect) { isCorrelatedPath = true; pstate.joins = pstate.joins.setCorrelatedVariable(_schemaAlias); pstate.joins.setJoinContext(null); } - + rel = traverseField(pstate, key, forceOuter || ctx.store.getDBDictionary().fullResultCollectionInOrderByRelation, false); } @@ -582,7 +582,7 @@ public class PCPath extends CandidatePath implements JDBCPath { // the key rather than value key = action.op == Action.GET_KEY; forceOuter |= action.op == Action.GET_OUTER; - + if (key && itr.hasNext()) _keyPath = true; @@ -590,9 +590,9 @@ public class PCPath extends CandidatePath implements JDBCPath { pstate.field = field; owner = pstate.field.getDefiningMapping(); - if (pstate.field.getManagement() + if (pstate.field.getManagement() != FieldMapping.MANAGE_PERSISTENT) - throw new UserException(_loc.get("non-pers-field", + throw new UserException(_loc.get("non-pers-field", pstate.field)); // find the most-derived type between the declared relation @@ -646,17 +646,17 @@ public class PCPath extends CandidatePath implements JDBCPath { pstate.joins.moveJoinsToParent(); } pstate.joins.setJoinContext(null); - + if (_actions == null) { String subqAlias = findSubqAlias(sel); pstate.joins = pstate.joins.setSubselect(subqAlias); pstate.joins.setCorrelatedVariable(_schemaAlias); checkObjectPathInheritanceTypeJoined(pstate); } - + return pstate; } - + private String findSubqAlias(Select sel) { Select pSel = sel.getParent(); if (pSel == null) @@ -672,7 +672,7 @@ public class PCPath extends CandidatePath implements JDBCPath { /** * When a PCPath is in subselect, and it is simply a navigation * from the parent root, the joins involved in this PCPath - * must happen in the main select. + * must happen in the main select. */ private boolean navigateFromParentRootInSubselect(Select sel) { if (sel.getParent() == null) @@ -683,18 +683,18 @@ public class PCPath extends CandidatePath implements JDBCPath { boolean startsWithSubquery = false; while (itr != null && itr.hasNext()) { Action action = (Action) itr.next(); - if (action.op == Action.VAR) + if (action.op == Action.VAR) hasVar = true; else if (action.op == Action.SUBQUERY) startsWithSubquery = true; } return !hasVar && !startsWithSubquery && sel.ctx().getSchema(_schemaAlias) == null; } - + /** * Return whether the given source field joins to the given target field. */ - private static boolean isJoinedField(FieldMapping src, boolean key, + private static boolean isJoinedField(FieldMapping src, boolean key, FieldMapping target) { ValueMapping vm; switch (src.getTypeCode()) { @@ -712,11 +712,11 @@ public class PCPath extends CandidatePath implements JDBCPath { return false; ForeignKey fk = vm.getForeignKey(); if (fk == null) - return false; - + return false; + // foreign key must join to target columns Column[] rels = fk.getColumns(); - Column[] pks = target.getColumns(); + Column[] pks = target.getColumns(); if (rels.length != pks.length) return false; for (int i = 0; i < rels.length; i++) @@ -724,7 +724,7 @@ public class PCPath extends CandidatePath implements JDBCPath { return false; return true; } - + protected Object eval(Object candidate, Object orig, StoreContext ctx, Object[] params) { if (_actions == null) @@ -775,7 +775,7 @@ public class PCPath extends CandidatePath implements JDBCPath { public Column[] cols = null; public boolean joinedRel = false; public boolean isEmbedElementColl = false; - + public PathExpState(Joins joins) { super(joins); } @@ -787,7 +787,7 @@ public class PCPath extends CandidatePath implements JDBCPath { * @param last whether this is the last field in the path * @return the mapping of the related type, or null */ - private ClassMapping traverseField(PathExpState pstate, boolean key, + private ClassMapping traverseField(PathExpState pstate, boolean key, boolean forceOuter, boolean last) { if (pstate.field == null) return null; @@ -813,12 +813,12 @@ public class PCPath extends CandidatePath implements JDBCPath { /** * Join into the relation represented by the current field, if any. */ - private void joinRelation(PathExpState pstate, boolean key, + private void joinRelation(PathExpState pstate, boolean key, boolean forceOuter, boolean traverse) { if (pstate.field == null) return; if (key) - pstate.joins = pstate.field.joinKeyRelation(pstate.joins, + pstate.joins = pstate.field.joinKeyRelation(pstate.joins, forceOuter, traverse); else pstate.joins = pstate.field.joinRelation(pstate.joins, forceOuter, @@ -826,10 +826,10 @@ public class PCPath extends CandidatePath implements JDBCPath { pstate.joinedRel = true; } - public Object toDataStoreValue(Select sel, ExpContext ctx, ExpState state, + public Object toDataStoreValue(Select sel, ExpContext ctx, ExpState state, Object val) { PathExpState pstate = (PathExpState) state; - FieldMapping field = (pstate.cmpfield != null) ? pstate.cmpfield + FieldMapping field = (pstate.cmpfield != null) ? pstate.cmpfield : pstate.field; if (isXPath()) return val; @@ -846,12 +846,12 @@ public class PCPath extends CandidatePath implements JDBCPath { ctx.store); } - public void select(Select sel, ExpContext ctx, ExpState state, + public void select(Select sel, ExpContext ctx, ExpState state, boolean pks) { selectColumns(sel, ctx, state, pks); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { sel.setSchemaAlias(_schemaAlias); ClassMapping mapping = getClassMapping(state); @@ -884,12 +884,12 @@ public class PCPath extends CandidatePath implements JDBCPath { else { int subs = (_type == UNBOUND_VAR) ? Select.SUBS_JOINABLE : Select.SUBS_ANY_JOINABLE; - sel.groupBy(mapping, subs, ctx.store, ctx.fetch, + sel.groupBy(mapping, subs, ctx.store, ctx.fetch, sel.outer(pstate.joins)); } } - public void orderBy(Select sel, ExpContext ctx, ExpState state, + public void orderBy(Select sel, ExpContext ctx, ExpState state, boolean asc) { sel.orderBy(getColumns(state), asc, sel.outer(state.joins), false); } @@ -903,10 +903,10 @@ public class PCPath extends CandidatePath implements JDBCPath { throws SQLException { ClassMapping mapping = getClassMapping(state); PathExpState pstate = (PathExpState) state; - if (mapping != null && (pstate.field == null + if (mapping != null && (pstate.field == null || !pstate.field.isEmbedded())) { if (pks) - return mapping.getObjectId(ctx.store, res, null, true, + return mapping.getObjectId(ctx.store, res, null, true, pstate.joins); if (_key && pstate.field.getKey().isEmbedded()) return loadEmbeddedMapKey(ctx, state, res); @@ -924,11 +924,11 @@ public class PCPath extends CandidatePath implements JDBCPath { } else { ret = pstate.field.loadProjection(ctx.store, ctx.fetch, res, pstate.joins); } - + if (pstate.field.isExternalized()) { - ret = pstate.field.getFieldValue(ret, ctx.store.getContext()); + ret = pstate.field.getFieldValue(ret, ctx.store.getContext()); } - + if (_cast != null) ret = Filters.convert(ret, _cast); return ret; @@ -961,7 +961,7 @@ public class PCPath extends CandidatePath implements JDBCPath { pstate.joins); } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { // we don't create the SQL b/c it forces the Select to cache aliases // for the tables we use, and these aliases might not ever be used if @@ -979,7 +979,7 @@ public class PCPath extends CandidatePath implements JDBCPath { return getColumns(state).length; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { Column[] cols = getColumns(state); for (int i = 0; i < cols.length; i++) { @@ -988,13 +988,13 @@ public class PCPath extends CandidatePath implements JDBCPath { sql.append(", "); } } - - public void appendTo(Select sel, ExpContext ctx, ExpState state, + + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { Column col = getColumns(state)[index]; appendTo(sel, state, sql, col); } - + public void appendTo(Select sel, ExpState state, SQLBuffer sql, Column col) { if (sel != null) sel.setSchemaAlias(_schemaAlias); @@ -1010,7 +1010,7 @@ public class PCPath extends CandidatePath implements JDBCPath { sql.append(sel.getColumnAlias(col, state.joins)); } - public void appendIsEmpty(Select sel, ExpContext ctx, ExpState state, + public void appendIsEmpty(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { PathExpState pstate = (PathExpState) state; if (pstate.field == null) @@ -1019,7 +1019,7 @@ public class PCPath extends CandidatePath implements JDBCPath { pstate.field.appendIsEmpty(sql, sel, pstate.joins); } - public void appendIsNotEmpty(Select sel, ExpContext ctx, ExpState state, + public void appendIsNotEmpty(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { PathExpState pstate = (PathExpState) state; if (pstate.field == null) @@ -1028,7 +1028,7 @@ public class PCPath extends CandidatePath implements JDBCPath { pstate.field.appendIsNotEmpty(sql, sel, pstate.joins); } - public void appendIndex(Select sel, ExpContext ctx, ExpState state, + public void appendIndex(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { PathExpState pstate = (PathExpState) state; if (pstate.field == null) @@ -1037,7 +1037,7 @@ public class PCPath extends CandidatePath implements JDBCPath { pstate.field.appendIndex(sql, sel, pstate.joins); } - public void appendType(Select sel, ExpContext ctx, ExpState state, + public void appendType(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { Discriminator disc = null; ClassMapping sup = _class; @@ -1064,7 +1064,7 @@ public class PCPath extends CandidatePath implements JDBCPath { } } - public void appendSize(Select sel, ExpContext ctx, ExpState state, + public void appendSize(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { PathExpState pstate = (PathExpState) state; if (pstate.field == null) @@ -1073,7 +1073,7 @@ public class PCPath extends CandidatePath implements JDBCPath { pstate.field.appendSize(sql, sel, pstate.joins); } - public void appendIsNull(Select sel, ExpContext ctx, ExpState state, + public void appendIsNull(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { PathExpState pstate = (PathExpState) state; if (pstate.field == null) @@ -1082,7 +1082,7 @@ public class PCPath extends CandidatePath implements JDBCPath { pstate.field.appendIsNull(sql, sel, pstate.joins); } - public void appendIsNotNull(Select sel, ExpContext ctx, ExpState state, + public void appendIsNotNull(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { PathExpState pstate = (PathExpState) state; if (pstate.field == null) @@ -1090,9 +1090,9 @@ public class PCPath extends CandidatePath implements JDBCPath { else pstate.field.appendIsNotNull(sql, sel, pstate.joins); } - + public boolean isSubqueryPath() { - if (_actions != null && _actions.size() == 1 && + if (_actions != null && _actions.size() == 1 && ((Action)_actions.get(0)).op == Action.SUBQUERY) return true; return false; @@ -1113,7 +1113,7 @@ public class PCPath extends CandidatePath implements JDBCPath { return Objects.equals(_candidate, path._candidate) && Objects.equals(_actions, path._actions); } - + public int getId() { return Val.VAL; } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Param.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Param.java index 3cb0bea83..05a539991 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Param.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Param.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -114,9 +114,9 @@ public class Param public ClassMapping mapping = null; public Discriminator disc = null; public Object discValue = null; - } + } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { super.calculateValue(sel, ctx, state, other, otherState); Object val = getValue(ctx.params); @@ -142,11 +142,11 @@ public class Param pstate.sqlValue = val; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { ParamExpState pstate = (ParamExpState) state; if (pstate.otherLength > 1) - sql.appendValue(((Object[]) pstate.sqlValue)[index], + sql.appendValue(((Object[]) pstate.sqlValue)[index], pstate.getColumn(index), this); else if (pstate.cols != null) sql.appendValue(pstate.sqlValue, pstate.getColumn(index), this); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/QueryExpressionsState.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/QueryExpressionsState.java index d8d2cf209..c5bd76833 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/QueryExpressionsState.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/QueryExpressionsState.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SQLEmbed.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SQLEmbed.java index 7fbb66545..6a59d1980 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SQLEmbed.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SQLEmbed.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SQLExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SQLExpression.java index d74e213c3..44af0f6fb 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SQLExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SQLExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SQLValue.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SQLValue.java index 234c21b01..ad872117e 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SQLValue.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SQLValue.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SelectConstructor.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SelectConstructor.java index 78fb87fe9..7244411ab 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SelectConstructor.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SelectConstructor.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -67,11 +67,11 @@ public class SelectConstructor /** * Evaluate the expression, returning a new select and filling in any * associated expression state. Use {@link #select} to then select the data. - * + * * @param ctx fill with execution context * @param state will be filled with expression state */ - public Select evaluate(ExpContext ctx, Select parent, String alias, + public Select evaluate(ExpContext ctx, Select parent, String alias, QueryExpressions exps, QueryExpressionsState state) { // already know that this query is equivalent to an extent? Select sel; @@ -90,7 +90,7 @@ public class SelectConstructor // no ordering or projections, we return null to signify that this // query should be treated like an extent Select inner = sel.getFromSelect(); - SQLBuffer where = buildWhere((inner != null) ? inner : sel, ctx, + SQLBuffer where = buildWhere((inner != null) ? inner : sel, ctx, state.filter, exps.filter); if (where == null && exps.projections.length == 0 && exps.ordering.length == 0 @@ -118,7 +118,7 @@ public class SelectConstructor } for (int i = 0; i < exps.grouping.length; i++) ((Val) exps.grouping[i]).groupBy(sel, ctx, state.grouping[i]); - + if (exps.projections.length == 1) { Val val = (Val) exps.projections[0]; if (val instanceof Count && ((Count)val).isCountDistinctMultiCols()) { @@ -129,7 +129,7 @@ public class SelectConstructor sel.setExpectedResultCount(0, true); sel = newSel; } - } + } return sel; } @@ -192,7 +192,7 @@ public class SelectConstructor boolean agg = exps.isAggregate(); boolean candidate = ProjectionExpressionVisitor. hasCandidateProjections(exps.projections); - if (agg || (candidate + if (agg || (candidate && (exps.distinct & exps.DISTINCT_TRUE) == 0)) { DBDictionary dict = ctx.store.getDBDictionary(); dict.assertSupport(dict.supportsSubselect, @@ -206,10 +206,10 @@ public class SelectConstructor sel.setFromSelect(inner); // auto-distincting happens to get unique candidate instances - // back; don't auto-distinct if the user isn't selecting + // back; don't auto-distinct if the user isn't selecting // candidate data - } else if (!candidate - && (exps.distinct & exps.DISTINCT_TRUE) == 0) + } else if (!candidate + && (exps.distinct & exps.DISTINCT_TRUE) == 0) sel.setDistinct(false); } } @@ -219,7 +219,7 @@ public class SelectConstructor /** * Initialize all expressions. */ - private void initialize(Select sel, ExpContext ctx, QueryExpressions exps, + private void initialize(Select sel, ExpContext ctx, QueryExpressions exps, QueryExpressionsState state) { Map contains = null; if (HasContainsExpressionVisitor.hasContains(exps.filter) @@ -248,9 +248,9 @@ public class SelectConstructor if (!ctx.store.getDBDictionary().supportsParameterInSelect && resultVal instanceof Lit) { ((Lit)resultVal).setRaw(true); } - // have to join through to related type for pc object + // have to join through to related type for pc object // projections; this ensures that we have all our joins cached - state.projections[i] = resultVal.initialize(sel, ctx, + state.projections[i] = resultVal.initialize(sel, ctx, Val.JOIN_REL | Val.FORCE_OUTER); if (exps.projections.length > 1 && resultVal instanceof Count) { if (((Count)resultVal).isCountDistinctMultiCols()) @@ -279,17 +279,17 @@ public class SelectConstructor Val orderVal; for (int i = 0; i < exps.ordering.length; i++) { orderVal = (Val) exps.ordering[i]; - if (contains(orderVal, exps.grouping)) + if (contains(orderVal, exps.grouping)) state.ordering[i] = orderVal.initialize(sel, ctx, Val.JOIN_REL); else state.ordering[i] = orderVal.initialize(sel, ctx, 0); - + joins = sel.and(joins, state.ordering[i].joins); } } sel.where(joins); } - + private boolean contains(Val orderVal, Value[] grouping) { for (int i = 0; i < grouping.length; i++) { Val groupVal = (Val) grouping[i]; @@ -302,7 +302,7 @@ public class SelectConstructor /** * Create the where sql. */ - private SQLBuffer buildWhere(Select sel, ExpContext ctx, ExpState state, + private SQLBuffer buildWhere(Select sel, ExpContext ctx, ExpState state, Expression filter) { // create where buffer SQLBuffer where = new SQLBuffer(ctx.store.getDBDictionary()); @@ -350,7 +350,7 @@ public class SelectConstructor if (sel.getParent() != null) throw new UnsupportedException(_loc.get("count-distinct-multi-col-subselect-unsupported")); } - } + } // if we have an inner select, we need to select the candidate // class' pk columns to guarantee unique instances @@ -371,10 +371,10 @@ public class SelectConstructor val.select(sel, ctx, state.projections[i], pks); } - // make sure having columns are selected since it is required by + // make sure having columns are selected since it is required by // some DBs. put them last so they don't affect result processing if (exps.having != null && inner != null) - ((Exp) exps.having).selectColumns(inner, ctx, state.having, + ((Exp) exps.having).selectColumns(inner, ctx, state.having, true); } @@ -391,7 +391,7 @@ public class SelectConstructor // this isn't a projection or a subq then they will already be added if (exps.projections.length > 0 || sel.getParent() != null) { ctx.store.loadSubclasses(mapping); - mapping.getDiscriminator().addClassConditions((inner != null) + mapping.getDiscriminator().addClassConditions((inner != null) ? inner : sel, subclasses, joins); } } @@ -418,7 +418,7 @@ public class SelectConstructor public void enter(Value val) { if (!_candidate) { _candidate = (_level == 0 && val instanceof Constant) - || (val instanceof PCPath + || (val instanceof PCPath && !((PCPath) val).isVariablePath()); } _level++; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SimpleCaseExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SimpleCaseExpression.java index 34b33cb9f..836e68d37 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SimpleCaseExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SimpleCaseExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -107,9 +107,9 @@ public class SimpleCaseExpression private static class SimpleCaseExpState extends ExpState { - + public ExpState[] states; - + public SimpleCaseExpState(Joins joins, ExpState[] states) { super(joins); this.states = states; @@ -150,7 +150,7 @@ public class SimpleCaseExpression public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { SimpleCaseExpState cstate = (SimpleCaseExpState) state; - + _caseOperand.selectColumns(sel, ctx, cstate.states[0], pks); for (int i = 0; i < _exp.length; i++) _exp[i].selectColumns(sel, ctx, cstate.states[i+1], pks); @@ -221,7 +221,7 @@ public class SimpleCaseExpression } public void setImplicitType(Class type) { - _cast = type; + _cast = type; } public void setMetaData(ClassMetaData meta) { @@ -230,15 +230,15 @@ public class SimpleCaseExpression public void setOtherPath(Value other) { this.other = other; } - + public Value getOtherPath() { return other; } - + public void setOtherState(ExpState otherState) { this.otherState = otherState; } - + public ExpState getOtherState() { return otherState; } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Size.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Size.java index 9a4b666d9..e81970859 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Size.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Size.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -39,7 +39,7 @@ class Size return initializeValue(sel, ctx, NULL_CMP); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { getValue().calculateValue(sel, ctx, state, null, null); getValue().appendSize(sel, ctx, state, sql); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Sqrt.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Sqrt.java index 1fe57961c..a7732df88 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Sqrt.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Sqrt.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StartsWithExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StartsWithExpression.java index 3f1ae6803..412e4940d 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StartsWithExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StartsWithExpression.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -55,13 +55,13 @@ class StartsWithExpression return new BinaryOpExpState(sel.and(s1.joins, s2.joins), s1, s2); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.calculateValue(sel, ctx, bstate.state1, _val2, bstate.state2); _val2.calculateValue(sel, ctx, bstate.state2, _val1, bstate.state1); - if (_val1 instanceof Const + if (_val1 instanceof Const && ((Const) _val1).getValue(ctx, bstate.state1) == null) buf.append("1 <> 1"); else if (_val2 instanceof Const) { @@ -105,7 +105,7 @@ class StartsWithExpression sel.append(buf, state.joins); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.selectColumns(sel, ctx, bstate.state1, true); @@ -184,11 +184,11 @@ class StartsWithExpression public FieldMapping getFieldMapping() { return null; } - + public PCPath getXPath() { return null; } - + public XMLMetaData getXmlMapping() { return null; } @@ -211,7 +211,7 @@ class StartsWithExpression private final String _pre; private final String _post; - public StringLengthFilterValue(Select sel, ExpContext ctx, + public StringLengthFilterValue(Select sel, ExpContext ctx, ExpState state, String pre, String post){ _sel = sel; _ctx = ctx; @@ -273,11 +273,11 @@ class StartsWithExpression public FieldMapping getFieldMapping() { return null; } - + public PCPath getXPath() { return null; } - + public XMLMetaData getXmlMapping() { return null; } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StringFunction.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StringFunction.java index 7580b8743..021f8b3fe 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StringFunction.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StringFunction.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -69,12 +69,12 @@ abstract class StringFunction return _val.initialize(sel, ctx, flags); } - public void select(Select sel, ExpContext ctx, ExpState state, + public void select(Select sel, ExpContext ctx, ExpState state, boolean pks) { sel.select(newSQLBuffer(sel, ctx, state), this); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { _val.selectColumns(sel, ctx, state, true); } @@ -83,7 +83,7 @@ abstract class StringFunction sel.groupBy(newSQLBuffer(sel, ctx, state)); } - public void orderBy(Select sel, ExpContext ctx, ExpState state, + public void orderBy(Select sel, ExpContext ctx, ExpState state, boolean asc) { sel.orderBy(newSQLBuffer(sel, ctx, state), asc, false, getSelectAs()); } @@ -101,7 +101,7 @@ abstract class StringFunction JavaSQLTypes.JDBC_DEFAULT, null), getType()); } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { _val.calculateValue(sel, ctx, state, null, null); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StringLength.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StringLength.java index 02535edfe..5ef9771ba 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StringLength.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StringLength.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -49,13 +49,13 @@ public class StringLength _cast = type; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf, int index) { DBDictionary dict = ctx.store.getDBDictionary(); String func = dict.stringLengthFunction; dict.assertSupport(func != null, "StringLengthFunction"); func = dict.getCastFunction(getValue(), func); - + int idx = func.indexOf("{0}"); buf.append(func.substring(0, idx)); getValue().appendTo(sel, ctx, state, buf, index); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SubQ.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SubQ.java index 477e132bd..408274ab2 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SubQ.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SubQ.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -77,7 +77,7 @@ public class SubQ public ClassMapping getCandidate() { return _candidate; } - + public boolean getSubs() { return _subs; } @@ -85,7 +85,7 @@ public class SubQ public void setSubqAlias(String subqAlias) { _subqAlias = subqAlias; } - + public String getSubqAlias() { return _subqAlias; } @@ -132,23 +132,23 @@ public class SubQ return ExpState.NULL; } - public Object toDataStoreValue(Select sel, ExpContext ctx, ExpState state, + public Object toDataStoreValue(Select sel, ExpContext ctx, ExpState state, Object val) { if (_exps.projections.length == 0) return _candidate.toDataStoreValue(val, _candidate.getPrimaryKeyColumns(), ctx.store); if (_exps.projections.length == 1) - return ((Val) _exps.projections[0]).toDataStoreValue(sel, ctx, + return ((Val) _exps.projections[0]).toDataStoreValue(sel, ctx, state, val); return val; } - public void select(Select sel, ExpContext ctx, ExpState state, + public void select(Select sel, ExpContext ctx, ExpState state, boolean pks) { selectColumns(sel, ctx, state, pks); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { sel.select(newSQLBuffer(sel, ctx, state), this); } @@ -157,7 +157,7 @@ public class SubQ sel.groupBy(newSQLBuffer(sel, ctx, state)); } - public void orderBy(Select sel, ExpContext ctx, ExpState state, + public void orderBy(Select sel, ExpContext ctx, ExpState state, boolean asc) { sel.orderBy(newSQLBuffer(sel, ctx, state), asc, false, getSelectAs()); } @@ -168,13 +168,13 @@ public class SubQ return buf; } - public Object load(ExpContext ctx, ExpState state, Result res) + public Object load(ExpContext ctx, ExpState state, Result res) throws SQLException { return Filters.convert(res.getObject(this, JavaSQLTypes.JDBC_DEFAULT, null), getType()); } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { Value[] projs = _exps.projections; for (int i = 0; i < projs.length; i++) { @@ -198,16 +198,16 @@ public class SubQ return 1; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { appendTo(sel, ctx, state, sql, index, false); } - private void appendTo(Select sel, ExpContext ctx, ExpState state, + private void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index, boolean size) { QueryExpressionsState substate = new QueryExpressionsState(); Select sub = _cons.evaluate(ctx, sel, _subqAlias, _exps, substate); - _cons.select(sub, ctx, _candidate, _subs, _exps, substate, + _cons.select(sub, ctx, _candidate, _subs, _exps, substate, JDBCFetchConfiguration.EAGER_NONE); if (size) @@ -216,19 +216,19 @@ public class SubQ sql.append(sub, ctx.fetch); } - public void appendIsEmpty(Select sel, ExpContext ctx, ExpState state, + public void appendIsEmpty(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { sql.append("NOT EXISTS "); appendTo(sel, ctx, state, sql, 0); } - public void appendIsNotEmpty(Select sel, ExpContext ctx, ExpState state, + public void appendIsNotEmpty(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { sql.append("EXISTS "); appendTo(sel, ctx, state, sql, 0); } - public void appendSize(Select sel, ExpContext ctx, ExpState state, + public void appendSize(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql) { appendTo(sel, ctx, state, sql, 0, true); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Substring.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Substring.java index 38f4173a3..e6d01e373 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Substring.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Substring.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -77,12 +77,12 @@ public class Substring return new BinaryOpExpState(sel.and(s1.joins, s2.joins), s1, s2); } - public void select(Select sel, ExpContext ctx, ExpState state, + public void select(Select sel, ExpContext ctx, ExpState state, boolean pks) { sel.select(newSQLBuffer(sel, ctx, state), this); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.selectColumns(sel, ctx, bstate.state1, true); @@ -93,7 +93,7 @@ public class Substring sel.groupBy(newSQLBuffer(sel, ctx, state)); } - public void orderBy(Select sel, ExpContext ctx, ExpState state, + public void orderBy(Select sel, ExpContext ctx, ExpState state, boolean asc) { sel.orderBy(newSQLBuffer(sel, ctx, state), asc, false, getSelectAs()); } @@ -111,7 +111,7 @@ public class Substring JavaSQLTypes.JDBC_DEFAULT, null), getType()); } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.calculateValue(sel, ctx, bstate.state1, null, null); @@ -122,14 +122,14 @@ public class Substring return 1; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { BinaryOpExpState bstate = (BinaryOpExpState) state; FilterValue str = new FilterValueImpl(sel, ctx, bstate.state1, _val1); FilterValue start; FilterValue length = null; if (_val2 instanceof Args) { - FilterValue[] filts = ((Args) _val2).newFilterValues(sel, ctx, + FilterValue[] filts = ((Args) _val2).newFilterValues(sel, ctx, bstate.state2); start = filts[0]; length = filts[1]; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Sum.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Sum.java index 292547efa..c7dc1f4b2 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Sum.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Sum.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ToLowerCase.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ToLowerCase.java index 82fce7277..873144e65 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ToLowerCase.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ToLowerCase.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -37,7 +37,7 @@ public class ToLowerCase super(val); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf, int index) { DBDictionary dict = ctx.store.getDBDictionary(); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ToUpperCase.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ToUpperCase.java index 3914ff1e4..fa2a57d1f 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ToUpperCase.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ToUpperCase.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -37,7 +37,7 @@ public class ToUpperCase super(val); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf, int index) { DBDictionary dict = ctx.store.getDBDictionary(); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Trim.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Trim.java index ac4acf984..7f20728e2 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Trim.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Trim.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -83,7 +83,7 @@ public class Trim public ExpState initialize(Select sel, ExpContext ctx, int flags) { ExpState valueState = _val.initialize(sel, ctx, 0); ExpState charState = _trimChar.initialize(sel, ctx, 0); - return new TrimExpState(sel.and(valueState.joins, charState.joins), + return new TrimExpState(sel.and(valueState.joins, charState.joins), valueState, charState); } @@ -96,7 +96,7 @@ public class Trim public final ExpState valueState; public final ExpState charState; - public TrimExpState(Joins joins, ExpState valueState, + public TrimExpState(Joins joins, ExpState valueState, ExpState charState) { super(joins); this.valueState = valueState; @@ -104,12 +104,12 @@ public class Trim } } - public void select(Select sel, ExpContext ctx, ExpState state, + public void select(Select sel, ExpContext ctx, ExpState state, boolean pks) { sel.select(newSQLBuffer(sel, ctx, state), this); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { TrimExpState tstate = (TrimExpState) state; _val.selectColumns(sel, ctx, tstate.valueState, true); @@ -120,7 +120,7 @@ public class Trim sel.groupBy(newSQLBuffer(sel, ctx, state)); } - public void orderBy(Select sel, ExpContext ctx, ExpState state, + public void orderBy(Select sel, ExpContext ctx, ExpState state, boolean asc) { sel.orderBy(newSQLBuffer(sel, ctx, state), asc, false, getSelectAs()); } @@ -138,7 +138,7 @@ public class Trim JavaSQLTypes.JDBC_DEFAULT, null), getType()); } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { TrimExpState tstate = (TrimExpState) state; _val.calculateValue(sel, ctx, tstate.valueState, null, null); @@ -149,7 +149,7 @@ public class Trim return 1; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { DBDictionary dict = ctx.store.getDBDictionary(); String func; @@ -162,9 +162,9 @@ public class Trim } else { func = dict.trimTrailingFunction; dict.assertSupport(func != null, "TrimTrailingFunction"); - } + } func = dict.getCastFunction(_val, func); - + int fromPart = func.indexOf("{0}"); int charPart = func.indexOf("{1}"); if (charPart == -1) @@ -180,7 +180,7 @@ public class Trim sql.append(part1); if (fromPart < charPart) _val.appendTo(sel, ctx, tstate.valueState, sql, 0); - else + else _trimChar.appendTo(sel, ctx, tstate.charState, sql, 0); sql.append(part2); @@ -195,7 +195,7 @@ public class Trim // where to specify the trim char (denoted by "{1}"), // we do not have the ability to trim off non-whitespace // characters; throw an exception when we attempt to do so - if (!(_trimChar instanceof Const) || String.valueOf(((Const) + if (!(_trimChar instanceof Const) || String.valueOf(((Const) _trimChar).getValue(ctx,tstate.charState)).trim().length() != 0) dict.assertSupport(false, "TrimNonWhitespaceCharacters"); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Type.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Type.java index fb7021e10..18e3e41b6 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Type.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Type.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -36,7 +36,7 @@ import org.apache.openjpa.util.InternalException; */ class Type extends UnaryOp { - + Discriminator _disc = null; public Type(Val val) { @@ -67,12 +67,12 @@ class Type return type.getClass(); } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { super.calculateValue(sel, ctx, state, null, null); } - public void select(Select sel, ExpContext ctx, ExpState state, + public void select(Select sel, ExpContext ctx, ExpState state, boolean pks) { if (_disc != null && _disc.getColumns().length > 0) sel.select(_disc.getColumns(), state.joins); @@ -80,7 +80,7 @@ class Type getValue().select(sel, ctx, state, pks); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { getValue().calculateValue(sel, ctx, state, null, null); getValue().appendType(sel, ctx, state, sql); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/TypeLit.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/TypeLit.java index 4e47ed3db..d95e7b904 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/TypeLit.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/TypeLit.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -58,7 +58,7 @@ public class TypeLit return _ptype; } - public Object getValue() { + public Object getValue() { return _val; } @@ -81,13 +81,13 @@ public class TypeLit extends ConstExpState { public Object sqlValue; - public int otherLength; + public int otherLength; public ClassMapping mapping = null; public Discriminator disc = null; public Object discValue = null; - } + } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { super.calculateValue(sel, ctx, state, other, otherState); LitExpState lstate = (LitExpState) state; @@ -99,14 +99,14 @@ public class TypeLit lstate.joins); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { LitExpState lstate = (LitExpState) state; if (lstate.otherLength > 1) - sql.appendValue(((Object[]) lstate.sqlValue)[index], + sql.appendValue(((Object[]) lstate.sqlValue)[index], lstate.getColumn(index)); else { - if (lstate.discValue != null) + if (lstate.discValue != null) sql.append(getDiscriminator(lstate)); else sql.append("1"); @@ -122,6 +122,6 @@ public class TypeLit case JavaTypes.STRING: default: return disc.insert(0, "'").append("'").toString(); - } + } } } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/UnaryOp.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/UnaryOp.java index 46a01e942..dfafbbbbb 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/UnaryOp.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/UnaryOp.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -47,7 +47,7 @@ abstract class UnaryOp public UnaryOp(Val val) { _val = val; } - + public UnaryOp(Val val, boolean noParen) { _val = val; _noParen = noParen; @@ -74,7 +74,7 @@ abstract class UnaryOp public void setImplicitType(Class type) { _cast = type; } - + public boolean getNoParen() { return _noParen; } @@ -87,14 +87,14 @@ abstract class UnaryOp return _val.initialize(sel, ctx, flags); } - public void select(Select sel, ExpContext ctx, ExpState state, + public void select(Select sel, ExpContext ctx, ExpState state, boolean pks) { sel.select(newSQLBuffer(sel, ctx, state), this); if (isAggregate()) sel.setAggregate(true); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { _val.selectColumns(sel, ctx, state, true); } @@ -103,7 +103,7 @@ abstract class UnaryOp sel.groupBy(newSQLBuffer(sel, ctx, state)); } - public void orderBy(Select sel, ExpContext ctx, ExpState state, + public void orderBy(Select sel, ExpContext ctx, ExpState state, boolean asc) { sel.orderBy(newSQLBuffer(sel, ctx, state), asc, false, getSelectAs()); } @@ -130,7 +130,7 @@ abstract class UnaryOp return Filters.convert(value, type); } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { _val.calculateValue(sel, ctx, state, null, null); } @@ -139,12 +139,12 @@ abstract class UnaryOp return 1; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { sql.append(getOperator()); sql.append(_noParen ? " " : "("); _val.appendTo(sel, ctx, state, sql, 0); - + // OPENJPA-2149: If _val (Val) is an 'Arg', we need to get the Val[] // from it, and the single element it contains because the // 'addCastForParam' method gets the 'type' from the Val it receives. @@ -176,7 +176,7 @@ abstract class UnaryOp _val.acceptVisit(visitor); visitor.exit(this); } - + // OPENJPA-1794 protected boolean nullableValue(ExpContext ctx, ExpState state) { return false; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Val.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Val.java index b287cbc63..779ffae14 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Val.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Val.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -42,19 +42,19 @@ public interface Val /** * Initialization flag indicating to join into any relation path. */ - public final int JOIN_REL = 2 << 1; + public final int JOIN_REL = 2 << 1; /** - * Initialization flag indicating to force an outer join into any relation + * Initialization flag indicating to force an outer join into any relation * path. */ - public final int FORCE_OUTER = 2 << 2; + public final int FORCE_OUTER = 2 << 2; /** - * Initialization flag indicating to this value is for compare/equal + * Initialization flag indicating to this value is for compare/equal * path. */ - public final int CMP_EQUAL = 2 << 3; + public final int CMP_EQUAL = 2 << 3; public final int VAL = 0; public final int MATH_VAL = 1; @@ -78,7 +78,7 @@ public interface Val /** * Initialize the value. This method should recursively initialize any - * sub-values. + * sub-values. */ public ExpState initialize(Select sel, ExpContext ctx, int flags); @@ -86,7 +86,7 @@ public interface Val * Return the datastore value of the given object in the context of this * value. */ - public Object toDataStoreValue(Select sel, ExpContext ctx, ExpState state, + public Object toDataStoreValue(Select sel, ExpContext ctx, ExpState state, Object val); /** @@ -97,7 +97,7 @@ public interface Val /** * Select just the columns for this value. */ - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks); /** @@ -108,7 +108,7 @@ public interface Val /** * Order by this value. */ - public void orderBy(Select sel, ExpContext ctx, ExpState state, + public void orderBy(Select sel, ExpContext ctx, ExpState state, boolean asc); /** @@ -123,7 +123,7 @@ public interface Val * * @param other the value being compared to, or null if not a comparison */ - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState); /** @@ -134,52 +134,52 @@ public interface Val /** * Append the indexth SQL element to the given buffer. */ - public void appendTo(Select sel, ExpContext ctx, ExpState state, - SQLBuffer sql, + public void appendTo(Select sel, ExpContext ctx, ExpState state, + SQLBuffer sql, int index); /** * Append the SQL testing whether this value is empty to the given buffer. */ - public void appendIsEmpty(Select sel, ExpContext ctx, ExpState state, + public void appendIsEmpty(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql); /** * Append the SQL testing whether this value is not empty to * the given buffer. */ - public void appendIsNotEmpty(Select sel, ExpContext ctx, ExpState state, + public void appendIsNotEmpty(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql); /** * Append the SQL checking the index of this value. */ - public void appendIndex(Select sel, ExpContext ctx, ExpState state, + public void appendIndex(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql); /** * Append the SQL checking the type of this value. */ - public void appendType(Select sel, ExpContext ctx, ExpState state, + public void appendType(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql); /** * Append the SQL checking the size of this value. */ - public void appendSize(Select sel, ExpContext ctx, ExpState state, + public void appendSize(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql); /** * Append the SQL testing whether this value is null to the given buffer. */ - public void appendIsNull(Select sel, ExpContext ctx, ExpState state, + public void appendIsNull(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql); /** * Append the SQL testing whether this value is not null to the given * buffer. */ - public void appendIsNotNull(Select sel, ExpContext ctx, ExpState state, + public void appendIsNotNull(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql); public int getId(); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Variable.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Variable.java index a65ad355e..71eee97aa 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Variable.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Variable.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -121,18 +121,18 @@ class Variable return ExpState.NULL; } - public void select(Select sel, ExpContext ctx, ExpState state, + public void select(Select sel, ExpContext ctx, ExpState state, boolean pks) { } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { } public void groupBy(Select sel, ExpContext ctx, ExpState state) { } - public void orderBy(Select sel, ExpContext ctx, ExpState state, + public void orderBy(Select sel, ExpContext ctx, ExpState state, boolean asc) { } @@ -141,7 +141,7 @@ class Variable return null; } - public void calculateValue(Select sel, ExpContext ctx, ExpState state, + public void calculateValue(Select sel, ExpContext ctx, ExpState state, Val other, ExpState otherState) { if (_path != null) _path.calculateValue(sel, ctx, state, other, otherState); @@ -151,27 +151,27 @@ class Variable return 0; } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer sql, int index) { } - public void appendIsEmpty(Select sel, ExpContext ctx, ExpState state, + public void appendIsEmpty(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { } - public void appendIsNotEmpty(Select sel, ExpContext ctx, ExpState state, + public void appendIsNotEmpty(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { } - public void appendSize(Select sel, ExpContext ctx, ExpState state, + public void appendSize(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { } - public void appendIsNull(Select sel, ExpContext ctx, ExpState state, + public void appendIsNull(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { } - public void appendIsNotNull(Select sel, ExpContext ctx, ExpState state, + public void appendIsNotNull(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/WhenCondition.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/WhenCondition.java index cc3215248..d5f4d6fb7 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/WhenCondition.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/WhenCondition.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -61,7 +61,7 @@ public class WhenCondition return new BinaryOpExpState(sel.and(s1.joins, s2.joins), s1, s2); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { BinaryOpExpState bstate = (BinaryOpExpState) state; @@ -73,7 +73,7 @@ public class WhenCondition } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { BinaryOpExpState bstate = (BinaryOpExpState) state; _exp.selectColumns(sel, ctx, bstate.state1, pks); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/WhenScalar.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/WhenScalar.java index 4522de01e..46371f0cf 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/WhenScalar.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/WhenScalar.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.kernel.exps; @@ -61,7 +61,7 @@ public class WhenScalar return new BinaryOpExpState(sel.and(s1.joins, s2.joins), s1, s2); } - public void appendTo(Select sel, ExpContext ctx, ExpState state, + public void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.appendTo(sel, ctx, bstate.state1, buf, 0); @@ -69,7 +69,7 @@ public class WhenScalar _val2.appendTo(sel, ctx, bstate.state2, buf, 0); } - public void selectColumns(Select sel, ExpContext ctx, ExpState state, + public void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks) { BinaryOpExpState bstate = (BinaryOpExpState) state; _val1.selectColumns(sel, ctx, bstate.state1, pks); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/package.html b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/package.html index d23684d14..4276e24c6 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/package.html +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/package.html @@ -6,15 +6,15 @@ 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. + under the License. --> diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/package.html b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/package.html index a4157d2c2..9bc2056d2 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/package.html +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/package.html @@ -6,15 +6,15 @@ 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. + under the License. --> diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMapping.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMapping.java index c5768faab..af0d64a08 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMapping.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMapping.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; @@ -181,7 +181,7 @@ public class ClassMapping join = assertJoinable(pks[i]); fm = getFieldMapping(join.getFieldIndex()); pkIdx = fm.getPrimaryKeyIndex(); - canReadDiscriminator &= isSelfReference(fk, join.getColumns()); + canReadDiscriminator &= isSelfReference(fk, join.getColumns()); // could have already set value with previous multi-column joinable if (vals[pkIdx] == null) { res.startDataRequest(fm); @@ -198,7 +198,7 @@ public class ClassMapping // the oid data is loaded by the base type, but if discriminator data // is present, make sure to use it to construct the actual oid instance // so that we get the correct app id class, etc - + // Discriminator refers to the row but the vals[] may hold data that // refer to another row. Then there is little point reading the disc // value @@ -209,21 +209,21 @@ public class ClassMapping try { Class dtype = cls.getDiscriminator().getClass(store, cls, res); if (dtype != cls.getDescribedType()) - dcls = cls.getMappingRepository().getMapping(dtype, - store.getContext().getClassLoader(), true); + dcls = cls.getMappingRepository().getMapping(dtype, + store.getContext().getClassLoader(), true); } catch (Exception e) { // intentionally ignored } - res.endDataRequest(); + res.endDataRequest(); } Object oid = ApplicationIds.fromPKValues(vals, dcls); if (oid instanceof OpenJPAId) { - ((OpenJPAId) oid).setManagedInstanceType(dcls.getDescribedType(), + ((OpenJPAId) oid).setManagedInstanceType(dcls.getDescribedType(), subs); } return oid; } - + boolean isSelfReference(ForeignKey fk, Column[] cols) { if (fk == null) return true; @@ -259,15 +259,15 @@ public class ClassMapping // columns in the Embeddable are greater than 1, we are dealing with a composite primary // key, and as such 'ret' will be an instance of the embeddable, NOT the individual PK values. // Given this, we need to dig deeper and get the individual values of the embeddable key. - // On the other hand, if the embeddable only contains one column, 'ret' will be the value of + // On the other hand, if the embeddable only contains one column, 'ret' will be the value of // that column and as such no further digging is necessary. FieldMapping[] fmsPK = this.getPrimaryKeyFieldMappings(); List fms = getFieldMappings(cols, true); - // Note that if we are dealing with an embeddable that is an EmbeddableId, the fms.size will + // Note that if we are dealing with an embeddable that is an EmbeddableId, the fms.size will // always be 1 (since an EmbeddableId is slightly opaque, we don't have an fms for each field). - // If on the other hand we are dealing with an embeddable that is an @IdClass, fms.size will be the - // number columns in the @IdClass. Furthermore, when dealing with @IdClass, 'ret' will already + // If on the other hand we are dealing with an embeddable that is an @IdClass, fms.size will be the + // number columns in the @IdClass. Furthermore, when dealing with @IdClass, 'ret' will already // properly contain the column values, therefore no further processing is needed. if (fmsPK.length > 0 && fmsPK[0].isEmbedded() && cols.length > 1 && fms.size() == 1) { // OK, we know this PK is an embeddable. So get the individual field values. @@ -299,7 +299,7 @@ public class ClassMapping } return ret; } - + /** * Return the joinable for the given column, or throw an exception if * none is available. @@ -862,21 +862,21 @@ public class ClassMapping boolean fill = getMappingRepository().getMappingDefaults(). defaultMissingInfo(); ForeignKey fk = fms[i].getForeignKey(); - if (fill && fk != null && - fk.getPrimaryKeyColumns().length == 0) { - // set resolve mode to force this field mapping to be - // resolved again. The need to resolve again occurs when + if (fill && fk != null && + fk.getPrimaryKeyColumns().length == 0) { + // set resolve mode to force this field mapping to be + // resolved again. The need to resolve again occurs when // a primary key is a relation field with the foreign key // annotation. In this situation, this primary key field - // mapping is resolved during the call to + // mapping is resolved during the call to // resolveNonRelationMapping. Since it is a relation - // field, the foreign key will be constructed. However, - // the primary key of the parent entity may not have been + // field, the foreign key will be constructed. However, + // the primary key of the parent entity may not have been // resolved yet, resulting in missing information in the fk - fms[i].setResolve(MODE_META); + fms[i].setResolve(MODE_META); if (fms[i].getStrategy() != null) fms[i].getStrategy().map(false); - } + } fms[i].resolve(MODE_MAPPING); } } @@ -895,10 +895,10 @@ public class ClassMapping } } // once columns are resolved, resolve unique constraints as they need - // the columns be resolved + // the columns be resolved _info.getUniques(this, true); } - + /** * Resolve non-relation field mappings so that when we do relation * mappings they can rely on them for joins. @@ -921,7 +921,7 @@ public class ClassMapping fms[i].resolve(MODE_MAPPING); _discrim.resolve(MODE_MAPPING); - _version.resolve(MODE_MAPPING); + _version.resolve(MODE_MAPPING); } protected void initializeMapping() { @@ -1050,16 +1050,16 @@ public class ClassMapping throws SQLException { return assertStrategy().customLoad(sm, store, fetch, result); } - + private ClassStrategy assertStrategy() { if (_strategy == null) throw new InternalException(); return _strategy; } - + /** * Find the field mappings that correspond to the given columns. - * + * * @return null if no columns are given or no field mapping uses the given * columns. */ @@ -1078,16 +1078,16 @@ public class ClassMapping } return result; } - + /** * Looks up in reverse to find the list of field mappings that include the * given column. Costly. - * - * @return null if no field mappings carry this column. + * + * @return null if no field mappings carry this column. */ private List hasColumn(Column c, boolean prime) { List result = null; - FieldMapping[] fms = (prime) ? + FieldMapping[] fms = (prime) ? getPrimaryKeyFieldMappings() : getFieldMappings(); for (FieldMapping fm : fms) { Column[] cols = fm.getColumns(); @@ -1099,22 +1099,22 @@ public class ClassMapping } return result; } - + boolean contains(Column[] cols, Column c) { for (Column col : cols) if (col == c) return true; return false; } - + /** * Gets the field values of the given instance for the given columns. * The given columns are used to identify the fields by a reverse lookup. - * - * @return a single object or an array of objects based on number of + * + * @return a single object or an array of objects based on number of * fields the given columns represent. */ - private Object getValueFromUnmanagedInstance(Object obj, Column[] cols, + private Object getValueFromUnmanagedInstance(Object obj, Column[] cols, boolean prime) { List fms = getFieldMappings(cols, prime); if (fms == null) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMappingInfo.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMappingInfo.java index a22a4b9a1..d4427c726 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMappingInfo.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMappingInfo.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; @@ -70,9 +70,9 @@ public class ClassMappingInfo private File _file = null; private int _srcType = SRC_OTHER; private String[] _comments = null; - private int _lineNum = 0; - private int _colNum = 0; - + private int _lineNum = 0; + private int _colNum = 0; + // Unique constraints indexed by primary or secondary table name private Map> _uniques; @@ -261,9 +261,9 @@ public class ClassMappingInfo } return cols; } - + /** - * Adds a Secondary table of given name to this mapping. A secondary table + * Adds a Secondary table of given name to this mapping. A secondary table * must be known before unique constraints are added to a Secondary table. * @deprecated */ @@ -292,12 +292,12 @@ public class ClassMappingInfo _seconds = new LinkedHashMap>(); _seconds.put(tableName, cols); } - + /** * Return the named table for the given class. * @deprecated */ - public Table getTable(final ClassMapping cls, String tableName, + public Table getTable(final ClassMapping cls, String tableName, boolean adapt) { return getTable(cls, DBIdentifier.newTable(tableName), adapt); } @@ -305,7 +305,7 @@ public class ClassMappingInfo /** * Return the named table for the given class. */ - public Table getTable(final ClassMapping cls, DBIdentifier tableName, + public Table getTable(final ClassMapping cls, DBIdentifier tableName, boolean adapt) { Table t = createTable(cls, new TableDefaults() { @@ -325,14 +325,14 @@ public class ClassMappingInfo : cls.getTypeAlias()); return t; } - + /** * Return the primary table for the given class. */ public Table getTable(final ClassMapping cls, boolean adapt) { return getTable(cls, _tableName, adapt); } - + /** * Return the datastore identity columns for the given class, based on the * given templates. @@ -400,7 +400,7 @@ public class ClassMappingInfo : cls.getStrategy().getAlias(); if (strat != null && (cls.getPCSuperclass() != null || !FullClassStrategy.ALIAS.equals(strat))) - setStrategy(strat); + setStrategy(strat); } public boolean hasSchemaComponents() { @@ -442,10 +442,10 @@ public class ClassMappingInfo } } - + /** * Add a unique constraint for the given table. - * @param table must be primary table or secondary table name added a + * @param table must be primary table or secondary table name added a * priori to this receiver. * @param unique the unique constraint. null means no-op. * @deprecated @@ -456,15 +456,15 @@ public class ClassMappingInfo /** * Add a unique constraint for the given table. - * @param table must be primary table or secondary table name added a + * @param table must be primary table or secondary table name added a * priori to this receiver. * @param unique the unique constraint. null means no-op. */ public void addUnique(DBIdentifier table, Unique unique) { if (!DBIdentifier.equal(_tableName, table) && (_seconds == null || !_seconds.containsKey(table))) { - throw new UserException(_loc.get("unique-no-table", - new Object[]{table, _className, _tableName, + throw new UserException(_loc.get("unique-no-table", + new Object[]{table, _className, _tableName, ((_seconds == null) ? "" : _seconds.keySet())})); } if (unique == null) @@ -481,7 +481,7 @@ public class ClassMappingInfo uniques.add(unique); } } - + /** * Get the unique constraints of the given primary or secondary table. * @deprecated @@ -494,17 +494,17 @@ public class ClassMappingInfo * Get the unique constraints of the given primary or secondary table. */ public Unique[] getUniques(DBIdentifier table) { - if (_uniques == null || _uniques.isEmpty() + if (_uniques == null || _uniques.isEmpty() || _uniques.containsKey(table)) return new Unique[0]; List uniques = _uniques.get(table); return uniques.toArray(new Unique[uniques.size()]); } - + /** - * Get all the unique constraints associated with both the primary and/or + * Get all the unique constraints associated with both the primary and/or * secondary tables. - * + * */ public Unique[] getUniques(MetaDataContext cm, boolean adapt) { if (_uniques == null || _uniques.isEmpty()) @@ -520,22 +520,22 @@ public class ClassMappingInfo DBIdentifier columnName = templateColumns[i].getIdentifier(); if (!table.containsColumn(columnName)) { throw new UserException(_loc.get( - "unique-missing-column", - new Object[]{cm, columnName, tableName, + "unique-missing-column", + new Object[]{cm, columnName, tableName, Arrays.toString(table.getColumnNames())})); } Column uniqueColumn = table.getColumn(columnName); uniqueColumns[i] = uniqueColumn; } - Unique unique = createUnique(cm, "unique", template, + Unique unique = createUnique(cm, "unique", template, uniqueColumns, adapt); if (unique != null) result.add(unique); } } return result.toArray(new Unique[result.size()]); - } - + } + public File getSourceFile() { return _file; } @@ -564,7 +564,7 @@ public class ClassMappingInfo public void setComments(String[] comments) { _comments = comments; } - + public int getLineNumber() { return _lineNum; } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassStrategy.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassStrategy.java index e36c5df18..dc011daa8 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassStrategy.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassStrategy.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/DelegatingJoinable.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/DelegatingJoinable.java index 03f86aedb..f9694426e 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/DelegatingJoinable.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/DelegatingJoinable.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; @@ -92,7 +92,7 @@ public class DelegatingJoinable return _join.getFieldIndex(); } - public Object getPrimaryKeyValue(Result res, Column[] cols, ForeignKey fk, + public Object getPrimaryKeyValue(Result res, Column[] cols, ForeignKey fk, JDBCStore store, Joins joins) throws SQLException { return _join.getPrimaryKeyValue(res, cols, fk, store, joins); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Discriminator.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Discriminator.java index e2776658c..a01448e7c 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Discriminator.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Discriminator.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; @@ -65,8 +65,8 @@ public class Discriminator private Index _idx = null; private boolean _subsLoaded = false; private Object _value = null; - - private int _javaType = -1; + + private int _javaType = -1; /** * Constructor. Supply owning mapping. @@ -402,7 +402,7 @@ public class Discriminator return assertStrategy().hasClassConditions(base, subs); } - public SQLBuffer getClassConditions(Select sel, Joins joins, + public SQLBuffer getClassConditions(Select sel, Joins joins, ClassMapping base, boolean subs) { return assertStrategy().getClassConditions(sel, joins, base, subs); } @@ -416,16 +416,16 @@ public class Discriminator public String toString() { return _mapping + ""; } - + public void setJavaType(int javaType) { _javaType = javaType; } - + public int getJavaType() { if (_javaType == -1) { ClassMapping superMapping = _mapping.getPCSuperclassMapping(); - if (superMapping != null && + if (superMapping != null && superMapping.getDiscriminator() != null) { _javaType = superMapping.getDiscriminator().getJavaType(); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/DiscriminatorMappingInfo.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/DiscriminatorMappingInfo.java index b86c01cda..9cbbbd55a 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/DiscriminatorMappingInfo.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/DiscriminatorMappingInfo.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; @@ -43,7 +43,7 @@ public class DiscriminatorMappingInfo extends MappingInfo { private String _value = null; - + /** * Raw discriminator value string. */ @@ -68,14 +68,14 @@ public class DiscriminatorMappingInfo return discrim.getMappingRepository().getMappingDefaults(). getDiscriminatorValue(discrim, adapt); } - - switch(discrim.getJavaType()) { + + switch(discrim.getJavaType()) { case JavaTypes.INT: return Integer.valueOf(_value); case JavaTypes.CHAR: return Character.valueOf(_value.charAt(_value.indexOf('\'')+1)); case JavaTypes.STRING: - default: + default: return _value; } } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/DiscriminatorStrategy.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/DiscriminatorStrategy.java index 24245d89b..09c3871e1 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/DiscriminatorStrategy.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/DiscriminatorStrategy.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; @@ -70,9 +70,9 @@ public interface DiscriminatorStrategy /** * Return SQL to limit the classes selected as much as possible to the - * given base class, and optionally its subclasses. The select and joins + * given base class, and optionally its subclasses. The select and joins * instances are supplied in order to get column aliases. */ - public SQLBuffer getClassConditions(Select sel, Joins joins, + public SQLBuffer getClassConditions(Select sel, Joins joins, ClassMapping base, boolean subs); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Embeddable.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Embeddable.java index 26b6ce1d9..d5fc19fae 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Embeddable.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Embeddable.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/FieldMapping.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/FieldMapping.java index 27326437e..50362ad0b 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/FieldMapping.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/FieldMapping.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; @@ -63,7 +63,7 @@ import org.apache.openjpa.util.ObjectId; public class FieldMapping extends FieldMetaData implements ValueMapping, FieldStrategy { - + private static final long serialVersionUID = 142185362294762433L; private static final Localizer _loc = Localizer.forPackage @@ -85,20 +85,20 @@ public class FieldMapping private Unique[] _joinTableUniques; // Unique constraints on JoinTable private Boolean _bidirectionalJoinTableOwner = null; private Boolean _bidirectionalJoinTableNonOwner = null; - + private Boolean _bi_MTo1_JT = null; private Boolean _uni_1ToM_FK = null; private Boolean _uni_MTo1_JT = null; private Boolean _uni_1To1_JT = null; private Boolean _bi_1To1_JT = null; - + private FieldMapping _bi_1ToM_JT_Field = null; private FieldMapping _bi_MTo1_JT_Field = null; private ForeignKey _bi_1ToM_Join_FK = null; private ForeignKey _bi_1ToM_Elem_FK = null; - + private boolean _hasMapsIdCols = false; - + /** * Constructor. */ @@ -166,23 +166,23 @@ public class FieldMapping return _fk.getTable(); if (_val.getForeignKey() != null) return _val.getForeignKey().getTable(); - + // if this is a map of bi-directional relation, - // the column of this field should be in the table + // the column of this field should be in the table // of the entity that is the value of the map if (_val.getDeclaredTypeCode() == JavaTypes.MAP) { ClassMapping meta = _elem.getDeclaredTypeMapping(); if (meta != null) return meta.getTable(); } - + ValueMappingImpl vm = (ValueMappingImpl)getDefiningMapping(). getEmbeddingMetaData(); if (vm != null && vm.getValueMappedBy() != null) { return vm.getFieldMapping().getElementMapping(). getDeclaredTypeMapping().getTable(); } - + return getDefiningMapping().getTable(); } @@ -231,11 +231,11 @@ public class FieldMapping public Unique[] getJoinTableUniques() { return _joinTableUniques; } - + public void setJoinTableUniques(Unique[] unqs) { _joinTableUniques = unqs; } - + /** * Index on join foreign key columns. */ @@ -578,7 +578,7 @@ public class FieldMapping if(table != null && table.equals(getDefiningMapping().getTable())) { // Don't create a join if the field's table is the same as the - // class's table. + // class's table. table = null; } @@ -633,7 +633,7 @@ public class FieldMapping return; if (!mappedByIdFields.contains(this)) return; - if (!isMappedById()) + if (!isMappedById()) return; PersistenceCapable pc = (PersistenceCapable)sm. fetchObject(getIndex()); @@ -646,21 +646,21 @@ public class FieldMapping return; setPKValue((StateManagerImpl)sm, pkVal); sm.setObjectId( - ApplicationIds.create(sm.getPersistenceCapable(), + ApplicationIds.create(sm.getPersistenceCapable(), sm.getMetaData())); } } - + private Object getPKValue(StateManagerImpl pkSm) { ClassMetaData pkMeta = pkSm.getMetaData(); FieldMetaData[] fmds = pkMeta.getPrimaryKeyFields(); // MappedById is for single value primary key or embeddable id if (fmds.length == 0) return null; - else + else return ApplicationIds.getKey(pkSm.getObjectId(), pkMeta); } - + private void setPKValue(StateManagerImpl sm, Object pkVal) { ClassMetaData meta = sm.getMetaData(); FieldMetaData[] fmds = meta.getPrimaryKeyFields(); @@ -669,15 +669,15 @@ public class FieldMapping Strategy strat = ((FieldMapping)fmds[0]).getStrategy(); // single value primary key - if (strat instanceof PrimitiveFieldStrategy) + if (strat instanceof PrimitiveFieldStrategy) ((PrimitiveFieldStrategy)strat).setAutoAssignedValue(sm, null, null, pkVal); else { //composite key String mappedByIdFieldName = getMappedByIdValue(); - if (mappedByIdFieldName != null && + if (mappedByIdFieldName != null && mappedByIdFieldName.length() > 0) { - //The name of the attribute within the composite key to which + //The name of the attribute within the composite key to which //the relationship attribute corresponds. Object target = ((ObjectId)sm.getObjectId()).getId(); if (target == null) @@ -688,11 +688,11 @@ public class FieldMapping sm.storeObjectField(fmds[0].getIndex(), pkVal); } } - - public void setMappedByIdValue(Object target, + + public void setMappedByIdValue(Object target, Object val, String mappedByIdFieldName) { - Reflection.set(target, - Reflection.findField(target.getClass(), mappedByIdFieldName, true), + Reflection.set(target, + Reflection.findField(target.getClass(), mappedByIdFieldName, true), val); } @@ -1124,7 +1124,7 @@ public class FieldMapping throws SQLException { _val.setForeignKey(row, sm); } - + public void setForeignKey(Row row, OpenJPAStateManager sm, int targetNumber) throws SQLException { _val.setForeignKey(row, sm, targetNumber); @@ -1189,38 +1189,38 @@ public class FieldMapping public void copyMappingInfo(ValueMapping vm) { _val.copyMappingInfo(vm); } - + /** * Affirms if this field is the owning side of a bidirectional relation - * with a join table. Evaluated only once and the result cached for + * with a join table. Evaluated only once and the result cached for * subsequent call. Hence must be called after resolution. */ public boolean isBidirectionalJoinTableMappingOwner() { if (_bidirectionalJoinTableOwner != null) return _bidirectionalJoinTableOwner.booleanValue(); - + _bidirectionalJoinTableOwner = false; ForeignKey fk = getForeignKey(); - if (fk != null) + if (fk != null) return false; ForeignKey jfk = getJoinForeignKey(); - if (jfk == null) + if (jfk == null) return false; FieldMapping mappedBy = getValueMappedByMapping(); - if (mappedBy != null) + if (mappedBy != null) return false; ValueMapping elem = getElementMapping(); - if (elem == null) + if (elem == null) return false; ClassMapping relType = elem.getDeclaredTypeMapping(); - if (relType == null) + if (relType == null) return false; FieldMapping[] relFmds = relType.getFieldMappings(); for (int i=0; i cols) { if (cols.isEmpty()) { ClassMapping mapping; - if (field.isEmbedded() && + if (field.isEmbedded() && field.getDeclaringMapping().getEmbeddingMapping() != null) { mapping = field.getDeclaringMapping().getEmbeddingMapping() .getFieldMapping().getDeclaringMapping(); @@ -212,7 +212,7 @@ public class FieldMappingInfo return createForeignKey(field, "join", cols, def, table, cls, cls, false, adapt); } - + private ClassMapping getDefiningMapping(FieldMapping field) { ClassMapping clm = field.getDefiningMapping(); ValueMappingImpl value = (ValueMappingImpl)clm.getEmbeddingMetaData(); @@ -221,7 +221,7 @@ public class FieldMappingInfo FieldMapping field1 = value.getFieldMapping(); return getDefiningMapping(field1); } - + /** * Unique constraint on the field join. */ @@ -237,7 +237,7 @@ public class FieldMappingInfo getJoinUnique(field, fk.getTable(), fk.getColumns()); return createUnique(field, "join", unq, fk.getColumns(), adapt); } - + /** * Add Unique Constraint to the Join Table. */ @@ -246,16 +246,16 @@ public class FieldMappingInfo _joinTableUniques = new ArrayList(); _joinTableUniques.add(u); } - + /** * Get the unique constraints associated with the Sequence table. */ - public Unique[] getJoinTableUniques(FieldMapping field, boolean def, + public Unique[] getJoinTableUniques(FieldMapping field, boolean def, boolean adapt) { return getUniques(field, _joinTableUniques, def, adapt); - } - - private Unique[] getUniques(FieldMapping field, List uniques, + } + + private Unique[] getUniques(FieldMapping field, List uniques, boolean def, boolean adapt) { if (uniques == null || uniques.isEmpty()) return new Unique[0]; @@ -269,14 +269,14 @@ public class FieldMappingInfo Column uniqueColumn = table.getColumn(columnName); uniqueColumns[i] = uniqueColumn; } - Unique unique = createUnique(field, "unique", template, + Unique unique = createUnique(field, "unique", template, uniqueColumns, adapt); if (unique != null) result.add(unique); } return result.toArray(new Unique[result.size()]); - } - + } + /** * Index on the field join. */ @@ -326,7 +326,7 @@ public class FieldMappingInfo } else { tmplate.setIdentifier(DBIdentifier.newColumn("ordr", delimit)); } - + tmplate.setJavaType(JavaTypes.INT); if (!def.populateOrderColumns(field, table, new Column[]{ tmplate }) && _orderCol == null) @@ -395,7 +395,7 @@ public class FieldMappingInfo else _orderCol = null; } - + /** * Sets internal constraint information to match given mapped constraint. */ diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/FieldStrategy.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/FieldStrategy.java index e62c790a6..575c950ed 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/FieldStrategy.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/FieldStrategy.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JDBCColumnOrder.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JDBCColumnOrder.java index 7db657476..afd50ba54 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JDBCColumnOrder.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JDBCColumnOrder.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JDBCOrder.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JDBCOrder.java index e9a14373e..0dd83e151 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JDBCOrder.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JDBCOrder.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; @@ -44,7 +44,7 @@ interface JDBCOrder * we're selecting */ public void order(Select sel, ClassMapping elem, Joins joins); - + public DBIdentifier getIdentifier(); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JDBCRelatedFieldOrder.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JDBCRelatedFieldOrder.java index f336a463c..ee1a8202a 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JDBCRelatedFieldOrder.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JDBCRelatedFieldOrder.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; @@ -83,7 +83,7 @@ class JDBCRelatedFieldOrder } sel.orderBy(fm.getColumns(), _asc, joins, false); } - + private FieldMapping getOrderByField(ClassMapping elem, FieldMapping fm) { ClassMapping owner = (ClassMapping)_fm.getDefiningMetaData(); if (owner.getDescribedType() == elem.getDescribedType()) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JDBCValueOrder.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JDBCValueOrder.java index 6719a83a8..2f8332616 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JDBCValueOrder.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JDBCValueOrder.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JavaSQLTypes.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JavaSQLTypes.java index 165061e72..60296a24d 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JavaSQLTypes.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JavaSQLTypes.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Joinable.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Joinable.java index e2142b442..003455a89 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Joinable.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Joinable.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; @@ -42,7 +42,7 @@ import org.apache.openjpa.kernel.OpenJPAStateManager; * * @author Abe White */ -public interface Joinable +public interface Joinable extends Serializable { /** diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingDefaults.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingDefaults.java index 70b68f00d..3cbfc4c68 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingDefaults.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingDefaults.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingDefaultsImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingDefaultsImpl.java index e5028a857..f30095ddc 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingDefaultsImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingDefaultsImpl.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; @@ -457,11 +457,11 @@ public class MappingDefaultsImpl public void setNullIndicatorColumnName(String nullIndName) { setNullIndicatorColumnIdentifier(DBIdentifier.newColumn(nullIndName)); } - + public void setNullIndicatorColumnIdentifier(DBIdentifier nullIndName) { _nullIndName = nullIndName; } - + public boolean defaultMissingInfo() { return _defMissing; } @@ -519,12 +519,12 @@ public class MappingDefaultsImpl } /** - * Provides a default value for the given Discriminator. - * + * Provides a default value for the given Discriminator. + * *

    * The type of the object returned relies on the javaType field being set on * the Discriminator which is provided. - *

  • Total of <%= items.size() %> Book<%= items.size() == 0 ? "" : "s" %> + Total of <%= items.size() %> Book<%= items.size() == 0 ? "" : "s" %> in Order <%= order.getId() %>
    TitlePriceTitlePrice QuantityCostCost
    Selected <%= books.size() %> Book<%= books.size() == 1 ? "" : "s" %>
    ISBNTitlePriceAuthorsISBNTitlePriceAuthors Add to Cart
    <%= book.getTitle() %> <%= JSPUtility.format(book.getPrice()) %> <%= namesOf(book.getAuthors()) %> ">
    + *
    * @@ -534,10 +534,10 @@ public class MappingDefaultsImpl * * *
    JavaType * Default value *
    {@link JavaTypes#STRING}The entity name
    - * + * * @param disc The discriminator that needs a default value - * @param adapt - * + * @param adapt + * * @return A new object containing the generated Discriminator value. */ public Object getDiscriminatorValue(Discriminator disc, boolean adapt) { @@ -546,14 +546,14 @@ public class MappingDefaultsImpl // WARNING: CHANGING THIS WILL INVALIDATE EXISTING DATA IF DEFAULTING // MISSING MAPPING INFO - + String alias = ClassUtil.getClassName(disc.getClassMapping().getTypeAlias()); - + switch (disc.getJavaType()) { case JavaTypes.INT: return Integer.valueOf(alias.hashCode()); case JavaTypes.CHAR: - return Character.valueOf(alias.charAt(0)); + return Character.valueOf(alias.charAt(0)); case JavaTypes.STRING: default: return alias; @@ -746,7 +746,7 @@ public class MappingDefaultsImpl Table foreign, boolean inverse) { return getForeignKey(vm, DBIdentifier.newForeignKey(name), local, foreign, inverse); } - + public ForeignKey getForeignKey(ValueMapping vm, DBIdentifier name, Table local, Table foreign, boolean inverse) { if (_fkAction == ForeignKey.ACTION_NONE) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java index 4bf62f983..51b2a10f5 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; @@ -103,9 +103,9 @@ public abstract class MappingInfo } return _cols; } - + /** - * Gets the columns whose table name matches the given table name. + * Gets the columns whose table name matches the given table name. * @deprecated */ public List getColumns(String tableName) { @@ -113,15 +113,15 @@ public abstract class MappingInfo } /** - * Gets the columns whose table name matches the given table name. + * Gets the columns whose table name matches the given table name. */ public List getColumns(DBIdentifier tableName) { - if (_cols == null) + if (_cols == null) return Collections.emptyList(); List result = new ArrayList(); for (Column col : _cols) { - if (DBIdentifier.equal(col.getTableIdentifier(), - tableName)) + if (DBIdentifier.equal(col.getTableIdentifier(), + tableName)) result.add(col); } return result; @@ -162,7 +162,7 @@ public abstract class MappingInfo _canIdx = indexable; } - /** + /** * Affirms if this instance represents an implicit relation. For example, a * relation expressed as the value of primary key of the related class and * not as object reference. @@ -172,14 +172,14 @@ public abstract class MappingInfo public boolean isImplicitRelation() { return _implicitRelation; } - + /** * Sets a marker to imply a logical relation that can not have any physical * manifest in the database. For example, a relation expressed as the value * of primary key of the related class and not as object reference. * Populated from @ForeignKey(implicit=true) annotation. * The mutator can only transit from false to true but not vice versa. - * + * * @since 1.3.0 */ public void setImplicitRelation(boolean flag) { @@ -443,7 +443,7 @@ public abstract class MappingInfo /** * Assert that the user did not try to place a foreign key on this mapping - * or placed an implicit foreign key. + * or placed an implicit foreign key. */ public void assertNoForeignKey(MetaDataContext context, boolean die) { if (_fk == null || isImplicitRelation()) @@ -489,7 +489,7 @@ public abstract class MappingInfo */ public Table createTable(MetaDataContext context, TableDefaults def, String schemaName, String given, boolean adapt) { - return createTable(context, def, DBIdentifier.newSchema(schemaName), + return createTable(context, def, DBIdentifier.newSchema(schemaName), DBIdentifier.newTable(given), adapt); } @@ -574,10 +574,10 @@ public abstract class MappingInfo // n columns because we don't know which of the n columns the info // applies to List given = getColumns(); - + if (context instanceof FieldMapping && ((FieldMapping)context).hasMapsIdCols()) given = ((FieldMapping)context).getValueInfo().getMapsIdColumns(); - + boolean fill = ((MappingRepository) context.getRepository()). getMappingDefaults().defaultMissingInfo(); if ((!given.isEmpty() || (!adapt && !fill)) @@ -606,10 +606,10 @@ public abstract class MappingInfo } return cols; } - + boolean canMerge(List given, Column[] templates, boolean adapt, boolean fill) { - return !((!given.isEmpty() || (!adapt && !fill)) + return !((!given.isEmpty() || (!adapt && !fill)) && given.size() != templates.length); } @@ -682,13 +682,13 @@ public abstract class MappingInfo // find existing column Column col = table.getColumn(colName); if (col == null && !adapt) { - // + // // See if column name has already been validated in a dynamic table. // If so then want to use that validated column name instead. This // should seldom if ever occur as long as the database dictionaries - // are kept up-to-date. - // - if ((colName.getName().length() > dict.maxColumnNameLength) || + // are kept up-to-date. + // + if ((colName.getName().length() > dict.maxColumnNameLength) || dict.getInvalidColumnWordSet().contains(DBIdentifier.toUpper(colName).getName()) && !(table.getClass().getName().contains("DynamicTable"))) { colName=dict.getValidColumnName(colName, new Table()); @@ -719,7 +719,7 @@ public abstract class MappingInfo dict.getJDBCType(tmplate.getJavaType(), size == -1, precis, scale, tmplate.isXML()); } - + boolean ttype = true; int otype = type; String typeName = tmplate.getTypeName(); @@ -737,7 +737,7 @@ public abstract class MappingInfo // the expected column type if (given.getType() != Types.OTHER) { ttype = false; - if (compat && !given.isCompatible(type, typeName, size, + if (compat && !given.isCompatible(type, typeName, size, decimals)) { Log log = repos.getLog(); if (log.isWarnEnabled()) @@ -776,7 +776,7 @@ public abstract class MappingInfo if (col == null) { col = table.addColumn(colName); col.setType(type); - } else if ((compat || !ttype) && !col.isCompatible(type, typeName, + } else if ((compat || !ttype) && !col.isCompatible(type, typeName, size, decimals)) { // if existing column isn't compatible with desired type, die if // can't adapt, else warn and change the existing column type @@ -1057,12 +1057,12 @@ public abstract class MappingInfo context, dict.platform)); deferred = false; } - + if (DBIdentifier.isEmpty(name)) { name = cols[0].getIdentifier(); name = repos.getDBDictionary().getValidUniqueName(name, table); } - + Unique unq = table.addUnique(name); unq.setDeferred(deferred); unq.setColumns(cols); @@ -1461,9 +1461,9 @@ public abstract class MappingInfo } else if ("null".equalsIgnoreCase(targetNameStr)) constant = true; else { - QualifiedDBIdentifier path = QualifiedDBIdentifier.getPath(targetName); + QualifiedDBIdentifier path = QualifiedDBIdentifier.getPath(targetName); fullTarget = (!DBIdentifier.isNull(path.getObjectTableName())); - if (!DBIdentifier.isNull(path.getObjectTableName()) && + if (!DBIdentifier.isNull(path.getObjectTableName()) && DBIdentifier.isEmpty(path.getObjectTableName())) { // allow use of '.' without prefix to mean "use expected // local table", but ignore if we're already inversed @@ -1539,7 +1539,7 @@ public abstract class MappingInfo Column tmplate = new Column(); tmplate.setIdentifier(name); if (!constant) { - Column tcol = foreign.getColumn(targetName, false); + Column tcol = foreign.getColumn(targetName, false); if (tcol == null) { String schemaCase = rel.getMappingRepository().getDBDictionary().schemaCase; if (DBDictionary.SCHEMA_CASE_LOWER.equals(schemaCase)) { @@ -1678,7 +1678,7 @@ public abstract class MappingInfo _unq.setIdentifier(unq.getIdentifier()); _unq.setDeferred(unq.isDeferred()); } - + /** * Sets internal constraint and column information to match given mapped * constraint. @@ -1835,16 +1835,16 @@ public abstract class MappingInfo return copy; } - /** + /** * Return whether the given column belongs to a foreign key. - */ - private static boolean isForeignKey(Column col) - { + */ + private static boolean isForeignKey(Column col) + { if (col.getTable() == null) return false; ForeignKey[] fks = col.getTable().getForeignKeys(); - for (int i = 0; i < fks.length; i++) - if (fks[i].containsColumn(col) + for (int i = 0; i < fks.length; i++) + if (fks[i].containsColumn(col) || fks[i].containsConstantColumn(col)) return true; return false; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java index ff1d90dff..4e4c74bbd 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; @@ -111,14 +111,14 @@ public class MappingRepository extends MetaDataRepository { private transient DBDictionary _dict = null; private transient MappingDefaults _defaults = null; - + // object->queryresultmapping - private Map _results = new HashMap(); + private Map _results = new HashMap(); private SchemaGroup _schema = null; private StrategyInstaller _installer = null; /** - * Default constructor. Configure via + * Default constructor. Configure via * {@link org.apache.openjpa.lib.conf.Configurable}. */ public MappingRepository() { @@ -390,8 +390,8 @@ public class MappingRepository extends MetaDataRepository { ClassMapping sup = mapping.getPCSuperclassMapping(); if (sup != null && (mapping.getResolve() & MODE_MAPPING) != 0) return; - - // if this mapping is not for a managed interface, ensure that if + + // if this mapping is not for a managed interface, ensure that if // we have an inheritance hierarchy there is a default strategy // applied to the root class if (!mapping.getDescribedType().isInterface() && @@ -399,10 +399,10 @@ public class MappingRepository extends MetaDataRepository { // if an inheritance strategy has not been set on this mapping // determine if needs one and if so, set it if (!hasInheritanceStrategy(mapping)) { - ClassMapping baseMapping = findBaseClassMapping(mapping); + ClassMapping baseMapping = findBaseClassMapping(mapping); if (baseMapping != null) setDefaultInheritanceStrategy(baseMapping); - } + } } // define superclass fields after mapping class, so we can tell whether @@ -546,7 +546,7 @@ public class MappingRepository extends MetaDataRepository { AccessController.doPrivileged( J2DoPrivHelper.getClassLoaderAction( ClassStrategy.class)), false); - ClassStrategy strategy = + ClassStrategy strategy = (ClassStrategy) AccessController.doPrivileged( J2DoPrivHelper.newInstanceAction(strat)); Configurations.configureInstance(strategy, getConfiguration(), @@ -780,7 +780,7 @@ public class MappingRepository extends MetaDataRepository { return instantiateClassStrategy((String) strat, cls); if (strat != null) return (ClassStrategy) strat; - + // see if there is a declared hierarchy strategy ClassStrategy hstrat = null; for (ClassMapping base = cls; base != null && hstrat == null;) { @@ -795,7 +795,7 @@ public class MappingRepository extends MetaDataRepository { && !cls.isManagedInterface() && Modifier.isAbstract(cls.getDescribedType().getModifiers())) return NoneClassStrategy.getInstance(); - + ClassMapping sup = cls.getMappedPCSuperclassMapping(); if (sup == null) return new FullClassStrategy(); @@ -955,7 +955,7 @@ public class MappingRepository extends MetaDataRepository { if (ehandler == null) ehandler = defaultHandler(elem); if (ehandler != null) - return handlerCollectionStrategy(field, ehandler, + return handlerCollectionStrategy(field, ehandler, installHandlers); if (elem.getTypeCode() == JavaTypes.PC && !elem.isSerialized() && !elem.isEmbeddedPC()) { @@ -973,10 +973,10 @@ public class MappingRepository extends MetaDataRepository { ValueHandler vhandler = namedHandler(val); if (vhandler == null) vhandler = defaultHandler(val); - boolean krel = khandler == null + boolean krel = khandler == null && key.getTypeCode() == JavaTypes.PC && !key.isSerialized() && !key.isEmbeddedPC(); - boolean vrel = vhandler == null + boolean vrel = vhandler == null && val.getTypeCode() == JavaTypes.PC && !val.isSerialized() && !val.isEmbeddedPC(); if (vrel && key.getValueMappedBy() != null) { @@ -1006,7 +1006,7 @@ public class MappingRepository extends MetaDataRepository { * Return the collection strategy for the given element handler, or null * if none. */ - protected FieldStrategy handlerCollectionStrategy(FieldMapping field, + protected FieldStrategy handlerCollectionStrategy(FieldMapping field, ValueHandler ehandler, boolean installHandlers) { // TODO: JPA 2.0 should ignore this flag and not to serialize if (getConfiguration().getCompatibilityInstance() @@ -1021,8 +1021,8 @@ public class MappingRepository extends MetaDataRepository { * Return the map strategy for the given key and value handlers / relations, * or null if none. */ - protected FieldStrategy handlerMapStrategy(FieldMapping field, - ValueHandler khandler, ValueHandler vhandler, boolean krel, + protected FieldStrategy handlerMapStrategy(FieldMapping field, + ValueHandler khandler, ValueHandler vhandler, boolean krel, boolean vrel, boolean installHandlers) { // TODO: JPA 2.0 should ignore this flag and not to serialize if (getConfiguration().getCompatibilityInstance() @@ -1049,7 +1049,7 @@ public class MappingRepository extends MetaDataRepository { FieldMapping mapped = field.getMappedByMapping(); if (mapped != null) { //bi-/M-1/JoinTable ==> join table strategy - if (isBiMTo1JT(field)) + if (isBiMTo1JT(field)) return false; if (mapped.getTypeCode() == JavaTypes.PC || mapped.getTypeCode() == JavaTypes.PC_UNTYPED) return true; @@ -1067,23 +1067,23 @@ public class MappingRepository extends MetaDataRepository { ValueMapping elem = field.getElementMapping(); boolean useInverseKeyMapping = DBIdentifier.isNull(info.getTableIdentifier()) && info.getColumns().isEmpty() && !elem.getValueInfo().getColumns().isEmpty(); - + // JPA 2.0: non-default mapping: uni-/1-M/JoinColumn ==> foreign key strategy if (isUni1ToMFK(field)) { return true; } return useInverseKeyMapping; } - + public boolean isNonDefaultMappingAllowed() { OpenJPAConfiguration conf = getConfiguration(); return getMetaDataFactory().getDefaults().isNonDefaultMappingAllowed(conf); } - + public boolean isUniMTo1JT(FieldMapping field) { - if (isNonDefaultMappingAllowed() && + if (isNonDefaultMappingAllowed() && field.getAssociationType() == FieldMetaData.MANY_TO_ONE && - hasJoinTable(field) && + hasJoinTable(field) && !isBidirectional(field)) { List cols = field.getElementMapping().getValueInfo().getColumns(); if (cols != null && cols.size() > 0) { @@ -1095,9 +1095,9 @@ public class MappingRepository extends MetaDataRepository { } public boolean isUni1To1JT(FieldMapping field) { - if (isNonDefaultMappingAllowed() && - field.getAssociationType() == FieldMetaData.ONE_TO_ONE && - hasJoinTable(field) && + if (isNonDefaultMappingAllowed() && + field.getAssociationType() == FieldMetaData.ONE_TO_ONE && + hasJoinTable(field) && !isBidirectional(field)) { List cols = field.getElementMapping().getValueInfo().getColumns(); if (cols != null && cols.size() > 0) { @@ -1109,9 +1109,9 @@ public class MappingRepository extends MetaDataRepository { } public boolean isBi1To1JT(FieldMapping field) { - if (isNonDefaultMappingAllowed() && - field.getAssociationType() == FieldMetaData.ONE_TO_ONE && - hasJoinTable(field) && + if (isNonDefaultMappingAllowed() && + field.getAssociationType() == FieldMetaData.ONE_TO_ONE && + hasJoinTable(field) && isBidirectional(field)) { List cols = field.getElementMapping().getValueInfo().getColumns(); if (cols != null && cols.size() > 0) { @@ -1121,9 +1121,9 @@ public class MappingRepository extends MetaDataRepository { } return false; } - + public boolean isUni1ToMFK(FieldMapping field) { - if (isNonDefaultMappingAllowed() && + if (isNonDefaultMappingAllowed() && field.getAssociationType() == FieldMetaData.ONE_TO_MANY && hasJoinColumn(field) && !isBidirectional(field)) { @@ -1132,7 +1132,7 @@ public class MappingRepository extends MetaDataRepository { } return false; } - + public boolean isBiMTo1JT(FieldMapping field) { FieldMapping mapped = field.getMappedByMapping(); if (isNonDefaultMappingAllowed()) { @@ -1161,7 +1161,7 @@ public class MappingRepository extends MetaDataRepository { ClassMapping inverse = field.getValueMapping().getTypeMapping(); FieldMapping[] fmds = inverse.getFieldMappings(); for (int i = 0; i < fmds.length; i++) { - if (field == fmds[i].getMappedByMapping()) + if (field == fmds[i].getMappedByMapping()) return fmds[i]; } } @@ -1186,12 +1186,12 @@ public class MappingRepository extends MetaDataRepository { } return null; } - + public boolean hasJoinColumn(FieldMapping field) { boolean hasJoinColumn = (field.getValueInfo().getColumns().size() > 0 ? true : false); return hasJoinColumn; } - + public boolean hasJoinTable(FieldMapping field) { boolean hasJoinTable = !DBIdentifier.isNull(field.getMappingInfo().getTableIdentifier()) ? true : false; return hasJoinTable; @@ -1200,18 +1200,18 @@ public class MappingRepository extends MetaDataRepository { public boolean isBidirectional(FieldMapping field) { if (field.getMappedByMapping() != null) return true; int assoType = field.getAssociationType(); - if (assoType == FieldMetaData.ONE_TO_ONE || + if (assoType == FieldMetaData.ONE_TO_ONE || assoType == FieldMetaData.MANY_TO_ONE) { ClassMapping inverse = field.getValueMapping().getTypeMapping(); FieldMapping[] fmds = inverse.getFieldMappings(); for (int i = 0; i < fmds.length; i++) { - if (field == fmds[i].getMappedByMapping()) + if (field == fmds[i].getMappedByMapping()) return true; } } return false; } - + /** * Check the given value against mapped strategies. */ @@ -1281,7 +1281,7 @@ public class MappingRepository extends MetaDataRepository { val, name), e); } } - + /** * Determine the default handler to use for the given value. Does * not take into account the named handler, if any. @@ -1305,7 +1305,7 @@ public class MappingRepository extends MetaDataRepository { if (handler instanceof ValueHandler) return (ValueHandler) handler; - if (val.getType() == byte[].class + if (val.getType() == byte[].class || val.getType() == Byte[].class) { if (_dict.maxEmbeddedBlobSize != -1) warnMaxEmbedded(val, _dict.maxEmbeddedBlobSize); @@ -1348,7 +1348,7 @@ public class MappingRepository extends MetaDataRepository { return ImmutableValueHandler.getInstance(); case JavaTypes.PC: if (!val.getTypeMapping().isMapped() - && useUntypedPCHandler(val)) + && useUntypedPCHandler(val)) return UntypedPCValueHandler.getInstance(); break; case JavaTypes.PC_UNTYPED: @@ -1512,7 +1512,7 @@ public class MappingRepository extends MetaDataRepository { throw new UserException(_loc.get("version-type-unsupported", vfield, vfield.getDeclaredType())); } } - + public void endConfiguration() { super.endConfiguration(); @@ -1524,15 +1524,15 @@ public class MappingRepository extends MetaDataRepository { ((Configurable) _schema).setConfiguration(conf); ((Configurable) _schema).startConfiguration(); ((Configurable) _schema).endConfiguration(); - } + } } - + /** * Finds the base class mapping for the specified mapping. Loads all * persistent types if necessary, since all persistent subclasses of this * mapping may not have been resolved before this method is called. */ - protected ClassMapping findBaseClassMapping(ClassMapping mapping) { + protected ClassMapping findBaseClassMapping(ClassMapping mapping) { ClassMapping baseMapping = null; ClassMapping sup = mapping.getPCSuperclassMapping(); if (sup == null) { @@ -1541,20 +1541,20 @@ public class MappingRepository extends MetaDataRepository { if (mapping.getPCSubclasses().length > 0) baseMapping = mapping; else { - // persistent subclasses may not have been resolved yet. - // run through the persistent types to see if any of them + // persistent subclasses may not have been resolved yet. + // run through the persistent types to see if any of them // or their superclass is a subclass of this class. - Collection> classes = loadPersistentTypes(false, + Collection> classes = loadPersistentTypes(false, mapping.getEnvClassLoader()); Class cls; for (Iterator> itr = classes.iterator(); itr.hasNext();) { cls = itr.next(); Class supcl = cls.getSuperclass(); - while (supcl != null && + while (supcl != null && !supcl.getClass().equals(java.lang.Object.class)) { if (!supcl.isInterface() && supcl.equals(mapping.getDescribedType())) { - baseMapping = mapping; + baseMapping = mapping; break; } supcl = supcl.getSuperclass(); @@ -1566,7 +1566,7 @@ public class MappingRepository extends MetaDataRepository { // if the superclass is not a managed interface, find the root // superclass and get its mapping info ClassMapping supcm = sup; - while (supcm != null && + while (supcm != null && !supcm.getDescribedType().isInterface() && !supcm.isEmbeddedOnly()) { ClassMapping supcm2 = supcm.getPCSuperclassMapping(); @@ -1577,7 +1577,7 @@ public class MappingRepository extends MetaDataRepository { } return baseMapping; } - + /** * If an inheritance strategy has not been set on this mapping, set it * to the default (flat). This method should be called before strategies @@ -1586,9 +1586,9 @@ public class MappingRepository extends MetaDataRepository { protected void setDefaultInheritanceStrategy(ClassMapping mapping) { ClassMappingInfo info = mapping.getMappingInfo(); if (info != null && info.getHierarchyStrategy() == null) - info.setHierarchyStrategy(FlatClassStrategy.ALIAS); - } - + info.setHierarchyStrategy(FlatClassStrategy.ALIAS); + } + /** * Determines whether an inhertance strategy has been set on the * specified mapping. @@ -1597,6 +1597,6 @@ public class MappingRepository extends MetaDataRepository { ClassMappingInfo info = mapping.getMappingInfo(); if (info != null && info.getHierarchyStrategy() != null) return true; - return false; + return false; } } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingStrategyInstaller.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingStrategyInstaller.java index ce8f29a44..6347b3762 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingStrategyInstaller.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingStrategyInstaller.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingTool.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingTool.java index e1540e2a3..36bc46430 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingTool.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingTool.java @@ -14,7 +14,7 @@ * "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. + * under the License. */ package org.apache.openjpa.jdbc.meta; @@ -170,7 +170,7 @@ public class MappingTool _mode = MODE_MAPPING; _loader = loader; - + _dict = _conf.getDBDictionaryInstance(); } @@ -321,7 +321,7 @@ public class MappingTool public boolean getIgnoreErrors() { return _ignoreErrors; } - + /** * If true, rollback will be performed before each DDL statement is executed. Defaults to true. */ @@ -435,7 +435,7 @@ public class MappingTool DynamicSchemaFactory factory = new DynamicSchemaFactory(); factory.setConfiguration(_conf); _schema = factory; - } else if (_readSchema + } else if (_readSchema || contains(_schemaActions,SchemaTool.ACTION_RETAIN) || contains(_schemaActions,SchemaTool.ACTION_REFRESH)) { _schema = (SchemaGroup) newSchemaTool(null).getDBSchemaGroup(). @@ -488,12 +488,12 @@ public class MappingTool public void record() { record(null); } - + public void record(MappingTool.Flags flags) { MappingRepository repos = getRepository(); MetaDataFactory io = repos.getMetaDataFactory(); ClassMapping[] mappings; - + if (!ACTION_DROP.equals(_action)) mappings = repos.getMappings(); else if (_dropMap != null) @@ -748,7 +748,7 @@ public class MappingTool ClassMapping mapping = repos.getMapping(cls, null, false); if (mapping != null) return mapping; - if (!validate || cls.isInterface() + if (!validate || cls.isInterface() || repos.getPersistenceAware(cls) != null) return null; throw new MetaDataException(_loc.get("no-meta", cls, cls.getClassLoader())); @@ -874,8 +874,8 @@ public class MappingTool //////// /** - * Usage: java org.apache.openjpa.jdbc.meta.MappingTool [option]* - * [-action/-a <refresh | add | buildSchema | drop | validate | import + * Usage: java org.apache.openjpa.jdbc.meta.MappingTool [option]* + * [-action/-a <refresh | add | buildSchema | drop | validate | import * | export>] <class name | .java file | .class file | .jdo file>* * Where the following options are recognized. *