Return-Path: Delivered-To: apmail-db-jdo-commits-archive@www.apache.org Received: (qmail 9073 invoked from network); 19 Sep 2006 22:30:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Sep 2006 22:30:14 -0000 Received: (qmail 21571 invoked by uid 500); 19 Sep 2006 22:30:14 -0000 Mailing-List: contact jdo-commits-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-commits@db.apache.org Received: (qmail 21560 invoked by uid 99); 19 Sep 2006 22:30:14 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Sep 2006 15:30:14 -0700 X-ASF-Spam-Status: No, hits=-9.8 required=5.0 tests=ALL_TRUSTED,NO_REAL_NAME Received: from ([140.211.166.113:57093] helo=eris.apache.org) by idunn.apache.osuosl.org (ecelerity 2.1 r(10620)) with ESMTP id CE/7D-28275-B6F60154 for ; Tue, 19 Sep 2006 15:30:03 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id C6F9C1A981A; Tue, 19 Sep 2006 15:30:00 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r447999 [1/2] - in /db/jdo/trunk/tck20: ./ src/conf/ src/java/org/apache/jdo/tck/mapping/ src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/ src/jdo/applicationidentity/org/apache/jdo/tck/pc/companyListWithoutJoin/ src/jdo/datastoreiden... Date: Tue, 19 Sep 2006 22:29:58 -0000 To: jdo-commits@db.apache.org From: mcaisse@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20060919223000.C6F9C1A981A@eris.apache.org> X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: mcaisse Date: Tue Sep 19 15:29:56 2006 New Revision: 447999 URL: http://svn.apache.org/viewvc?view=rev&rev=447999 Log: JDO-193 Add files for mapping a List field without a join table. Also, fix a problem in jdo metadata for companyMapWithoutJoin. Added: db/jdo/trunk/tck20/src/conf/companyListWithoutJoin.conf db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTestList.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Company.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactory.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryAbstractImpl.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryConcreteClass.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryPMClass.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryPMInterface.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryRegistry.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Department.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Employee.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/FullTimeEmployee.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/ICompany.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IDepartment.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IEmployee.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IFullTimeEmployee.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IPartTimeEmployee.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IPerson.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/PartTimeEmployee.java db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Person.java db/jdo/trunk/tck20/src/jdo/applicationidentity/org/apache/jdo/tck/pc/companyListWithoutJoin/ db/jdo/trunk/tck20/src/jdo/applicationidentity/org/apache/jdo/tck/pc/companyListWithoutJoin/package.jdo db/jdo/trunk/tck20/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/companyListWithoutJoin/ db/jdo/trunk/tck20/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/companyListWithoutJoin/package.jdo db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/companyListWithoutJoin/ db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/companyListWithoutJoin/package-standard10.orm db/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/companyListWithoutJoin/ db/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/companyListWithoutJoin/package-standard10.orm db/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema10.sql db/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema10.sql db/jdo/trunk/tck20/src/testdata/org/apache/jdo/tck/pc/companyListWithoutJoin/ db/jdo/trunk/tck20/src/testdata/org/apache/jdo/tck/pc/companyListWithoutJoin/companyListWithoutJoin.xml Modified: db/jdo/trunk/tck20/project.properties db/jdo/trunk/tck20/src/conf/configurations.list db/jdo/trunk/tck20/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package.jdo Modified: db/jdo/trunk/tck20/project.properties URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/project.properties?view=diff&rev=447999&r1=447998&r2=447999 ============================================================================== --- db/jdo/trunk/tck20/project.properties (original) +++ db/jdo/trunk/tck20/project.properties Tue Sep 19 15:29:56 2006 @@ -128,6 +128,20 @@ org/apache/jdo/tck/pc/companyMapWithoutJoin/IFullTimeEmployee.java \ org/apache/jdo/tck/pc/companyMapWithoutJoin/IInsurance.java \ org/apache/jdo/tck/pc/companyMapWithoutJoin/IPartTimeEmployee.java \ + org/apache/jdo/tck/pc/companyListWithoutJoin/Company.java \ + org/apache/jdo/tck/pc/companyListWithoutJoin/Department.java \ + org/apache/jdo/tck/pc/companyListWithoutJoin/Person.java \ + org/apache/jdo/tck/pc/companyListWithoutJoin/Employee.java \ + org/apache/jdo/tck/pc/companyListWithoutJoin/FullTimeEmployee.java \ + org/apache/jdo/tck/pc/companyListWithoutJoin/Insurance.java \ + org/apache/jdo/tck/pc/companyListWithoutJoin/PartTimeEmployee.java \ + org/apache/jdo/tck/pc/companyListWithoutJoin/ICompany.java \ + org/apache/jdo/tck/pc/companyListWithoutJoin/IDepartment.java \ + org/apache/jdo/tck/pc/companyListWithoutJoin/IPerson.java \ + org/apache/jdo/tck/pc/companyListWithoutJoin/IEmployee.java \ + org/apache/jdo/tck/pc/companyListWithoutJoin/IFullTimeEmployee.java \ + org/apache/jdo/tck/pc/companyListWithoutJoin/IInsurance.java \ + org/apache/jdo/tck/pc/companyListWithoutJoin/IPartTimeEmployee.java \ org/apache/jdo/tck/pc/fieldtypes/AllTypes.java \ org/apache/jdo/tck/pc/fieldtypes/ArrayCollections.java \ org/apache/jdo/tck/pc/fieldtypes/ArrayListCollections.java \ @@ -256,6 +270,18 @@ org/apache/jdo/tck/pc/companyMapWithoutJoin/IEmployee.class \ org/apache/jdo/tck/pc/companyMapWithoutJoin/IFullTimeEmployee.class \ org/apache/jdo/tck/pc/companyMapWithoutJoin/IPartTimeEmployee.class \ + org/apache/jdo/tck/pc/companyListWithoutJoin/Company.class \ + org/apache/jdo/tck/pc/companyListWithoutJoin/Department.class \ + org/apache/jdo/tck/pc/companyListWithoutJoin/Person.class \ + org/apache/jdo/tck/pc/companyListWithoutJoin/Employee.class \ + org/apache/jdo/tck/pc/companyListWithoutJoin/FullTimeEmployee.class \ + org/apache/jdo/tck/pc/companyListWithoutJoin/PartTimeEmployee.class \ + org/apache/jdo/tck/pc/companyListWithoutJoin/ICompany.class \ + org/apache/jdo/tck/pc/companyListWithoutJoin/IDepartment.class \ + org/apache/jdo/tck/pc/companyListWithoutJoin/IPerson.class \ + org/apache/jdo/tck/pc/companyListWithoutJoin/IEmployee.class \ + org/apache/jdo/tck/pc/companyListWithoutJoin/IFullTimeEmployee.class \ + org/apache/jdo/tck/pc/companyListWithoutJoin/IPartTimeEmployee.class \ org/apache/jdo/tck/pc/fieldtypes/AllTypes.class \ org/apache/jdo/tck/pc/fieldtypes/ArrayCollections.class \ org/apache/jdo/tck/pc/fieldtypes/ArrayListCollections.class \ @@ -383,6 +409,7 @@ org/apache/jdo/tck/api/instancecallbacks/package.jdo \ org/apache/jdo/tck/pc/company/package.jdo \ org/apache/jdo/tck/pc/companyMapWithoutJoin/package.jdo \ + org/apache/jdo/tck/pc/companyListWithoutJoin/package.jdo \ org/apache/jdo/tck/pc/fieldtypes/AllTypes.jdo \ org/apache/jdo/tck/pc/fieldtypes/ArrayCollections.jdo \ org/apache/jdo/tck/pc/fieldtypes/ArrayListCollections.jdo \ Added: db/jdo/trunk/tck20/src/conf/companyListWithoutJoin.conf URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/conf/companyListWithoutJoin.conf?view=auto&rev=447999 ============================================================================== --- db/jdo/trunk/tck20/src/conf/companyListWithoutJoin.conf (added) +++ db/jdo/trunk/tck20/src/conf/companyListWithoutJoin.conf Tue Sep 19 15:29:56 2006 @@ -0,0 +1,7 @@ +jdo.tck.description = Completeness test with companyListWithoutJoin model. +jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyListWithoutJoin.CompanyFactoryPMClass +jdo.tck.testdata = org/apache/jdo/tck/pc/companyListWithoutJoin/companyListWithoutJoin.xml +jdo.tck.standarddata = +jdo.tck.mapping = 10 +jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTestList +jdo.tck.requiredOptions = Modified: db/jdo/trunk/tck20/src/conf/configurations.list URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/conf/configurations.list?view=diff&rev=447999&r1=447998&r2=447999 ============================================================================== --- db/jdo/trunk/tck20/src/conf/configurations.list (original) +++ db/jdo/trunk/tck20/src/conf/configurations.list Tue Sep 19 15:29:56 2006 @@ -20,6 +20,7 @@ companyM-MRelationships.conf \ companyAllRelationships.conf \ companyMapWithoutJoin.conf \ + companyListWithoutJoin.conf \ companyPMClass.conf \ companyPMInterface.conf \ inheritance1.conf \ Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTestList.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTestList.java?view=auto&rev=447999 ============================================================================== --- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTestList.java (added) +++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTestList.java Tue Sep 19 15:29:56 2006 @@ -0,0 +1,128 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.mapping; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.companyListWithoutJoin.CompanyFactoryRegistry; +import org.apache.jdo.tck.pc.companyListWithoutJoin.CompanyModelReader; +import org.apache.jdo.tck.util.BatchTestRunner; +import org.apache.jdo.tck.util.DeepEquality; +import org.apache.jdo.tck.util.EqualityHelper; + +//import org.springframework.beans.factory.xml.XmlBeanFactory; + +/** + *Title:Completeness Test List + *
+ *Keywords: mapping + *
+ *Assertion ID: A18.[not identified] + *
+ *Assertion Description: + */ + +public class CompletenessTestList extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A18-[not identified] failed: "; + + /** */ + private final boolean isTestToBePerformed = isTestToBePerformed(); + + /** */ + protected List rootOids; + + /** */ + protected final String inputFilename = System.getProperty("jdo.tck.testdata"); + + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(CompletenessTestList.class); + } + + /** + * @see JDO_Test#localSetUp() + */ + protected void localSetUp() { + if (isTestToBePerformed) { + getPM(); + CompanyFactoryRegistry.registerFactory(pm); + CompanyModelReader reader = new CompanyModelReader(inputFilename); + addTearDownClass(reader.getTearDownClassesFromFactory()); + // persist test data + pm.currentTransaction().begin(); + List rootList = reader.getRootList(); + pm.makePersistentAll(rootList); + rootOids = new ArrayList(); + for (Iterator i = rootList.iterator(); i.hasNext(); ) { + Object pc = i.next(); + rootOids.add(pm.getObjectId(pc)); + } + pm.currentTransaction().commit(); + cleanupPM(); + } + } + + /** */ + public void test() { + if (isTestToBePerformed) { + // register the default factory + CompanyFactoryRegistry.registerFactory(); + // get new obj graph to compare persistent graph with + CompanyModelReader reader = new CompanyModelReader(inputFilename); + List rootList = reader.getRootList(); + + getPM(); + pm.currentTransaction().begin(); + // compare persisted and new + int size = rootList.size(); + StringBuffer msg = new StringBuffer(); + for (int i = 0; i < size; i++) { + DeepEquality expected = (DeepEquality) rootList.get(i); + Object oid = rootOids.get(i); + Object persisted = pm.getObjectById(oid); + EqualityHelper equalityHelper = new EqualityHelper(); + if (!expected.deepCompareFields(persisted, equalityHelper)) { + if (msg.length() > 0) { + msg.append("\n"); + } + msg.append("Expected this instance:\n " + + expected + "\n" + + "Got persistent instance:" + "\n " + + persisted + "\n" + + "Detailed list of differences follows...\n"); + msg.append(equalityHelper.getUnequalBuffer()); + } + } + pm.currentTransaction().commit(); + // fail test if at least one of the instances is not the expected one + if (msg.length() > 0) { + fail("CompletenessTestList failed; see list of failures below:", + msg.toString()); + } + } + } +} Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Company.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Company.java?view=auto&rev=447999 ============================================================================== --- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Company.java (added) +++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Company.java Tue Sep 19 15:29:56 2006 @@ -0,0 +1,331 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.companyListWithoutJoin; + +import java.io.Serializable; +import java.io.ObjectInputStream; +import java.io.IOException; + +import java.text.SimpleDateFormat; + +import java.util.Collections; +import java.util.Comparator; +import java.util.Set; +import java.util.HashSet; +import java.util.Date; + +import org.apache.jdo.tck.util.DeepEquality; +import org.apache.jdo.tck.util.EqualityHelper; + +/** + * This class represents information about a company. + */ +public class Company + implements ICompany, Serializable, Comparable, Comparator, DeepEquality { + + private long companyid; + private String name; + private Date founded; + private transient Set departments = new HashSet(); // element type is Department + + protected static SimpleDateFormat formatter = + new SimpleDateFormat("d/MMM/yyyy"); + + /** This is the JDO-required no-args constructor. The TCK relies on + * this constructor for testing PersistenceManager.newInstance(PCClass). + */ + public Company() {} + + /** + * Initialize the Company instance. + * @param companyid The company id. + * @param name The company name. + * @param founded The date the company was founded. + */ + public Company(long companyid, String name, Date founded) { + this.companyid = companyid; + this.name = name; + this.founded = founded; + } + + /** + * Get the company id. + * @return The company id. + */ + public long getCompanyid() { + return companyid; + } + + /** + * Set the id associated with this object. + * @param id the id. + */ + public void setCompanyid(long id) { + if (this.companyid != 0) + throw new IllegalStateException("Id is already set."); + this.companyid = id; + } + + /** + * Get the name of the company. + * @return The name of the company. + */ + public String getName() { + return name; + } + + /** + * Set the name of the company. + * @param name The value to use for the name of the company. + */ + public void setName(String name) { + this.name = name; + } + + /** + * Get the date that the company was founded. + * @return The date the company was founded. + */ + public Date getFounded() { + return founded; + } + + /** + * Set the date that the company was founded. + * @param founded The date to set that the company was founded. + */ + public void setFounded(Date founded) { + this.founded = founded; + } + + /** + * Get the departments contained in the company. + * @return An unmodifiable Set that contains all the + * Departments of the company. + */ + public Set getDepartments() { + return Collections.unmodifiableSet(departments); + } + + /** + * Add a Department instance to the company. + * @param dept The Department instance to add. + */ + public void addDepartment(Department dept) { + departments.add(dept); + } + + /** + * Remove a Department instance from the company. + * @param dept The Department instance to remove. + */ + public void removeDepartment(Department dept) { + departments.remove(dept); + } + + /** + * Initialize the set of Departments in the company to the + * parameter. + * @param departments The set of Departments for the + * company. + */ + public void setDepartments(Set departments) { + // workaround: create a new HashSet, because fostore does not + // support LinkedHashSet + this.departments = + (departments != null) ? new HashSet(departments) : null; + } + + /** Serialization support: initialize transient fields. */ + private void readObject(ObjectInputStream in) + throws IOException, ClassNotFoundException { + in.defaultReadObject(); + departments = new HashSet(); + } + + /** + * Returns a String representation of a Company object. + * @return a String representation of a Company object. + */ + public String toString() { + return "Company(" + getFieldRepr()+ ")"; + } + + /** + * Returns a String representation of the non-relationship fields. + * @return a String representation of the non-relationship fields. + */ + protected String getFieldRepr() { + StringBuffer rc = new StringBuffer(); + rc.append(companyid); + rc.append(", name ").append(name); + rc.append(", founded ").append(formatter.format(founded)); + return rc.toString(); + } + + /** + * Returns true if all the fields of this instance are + * deep equal to the coresponding fields of the specified Person. + * @param other the object with which to compare. + * @param helper EqualityHelper to keep track of instances that have + * already been processed. + * @return true if all the fields are deep equal; + * false otherwise. + * @throws ClassCastException if the specified instances' type prevents + * it from being compared to this instance. + */ + public boolean deepCompareFields(Object other, + EqualityHelper helper) { + ICompany otherCompany = (ICompany)other; + String where = "Company<" + companyid + ">"; + return + helper.equals(companyid, otherCompany.getCompanyid(), where + ".companyid") & + helper.equals(name, otherCompany.getName(), where + ".name") & + helper.equals(founded, otherCompany.getFounded(), where + ".founded") & + helper.deepEquals(departments, otherCompany.getDepartments(), where + ".departments"); + } + + /** + * Compares this object with the specified object for order. Returns a + * negative integer, zero, or a positive integer as this object is less + * than, equal to, or greater than the specified object. + * @param o The Object to be compared. + * @return a negative integer, zero, or a positive integer as this + * object is less than, equal to, or greater than the specified object. + * @throws ClassCastException - if the specified object's type prevents + * it from being compared to this Object. + */ + public int compareTo(Object o) { + return compareTo((ICompany)o); + } + + /** + * Compare two instances. This is a method in Comparator. + */ + public int compare(Object o1, Object o2) { + return compare((ICompany)o1, (ICompany)o2); + } + + /** + * Compares this object with the specified Company object for + * order. Returns a negative integer, zero, or a positive integer as + * this object is less than, equal to, or greater than the specified + * object. + * @param other The Company object to be compared. + * @return a negative integer, zero, or a positive integer as this + * object is less than, equal to, or greater than the specified Company + * object. + */ + public int compareTo(ICompany other) { + return compare(this, other); + } + + /** + * Compares its two ICompany arguments for order. Returns a negative + * integer, zero, or a positive integer as the first argument is less + * than, equal to, or greater than the second. + * @param o1 the first ICompany object to be compared. + * @param o2 the second ICompany object to be compared. + * @return a negative integer, zero, or a positive integer as the first + * object is less than, equal to, or greater than the second object. + */ + public static int compare(ICompany o1, ICompany o2) { + return EqualityHelper.compare(o1.getCompanyid(), o2.getCompanyid()); + } + + /** + * Indicates whether some other object is "equal to" this one. + * @param obj the object with which to compare. + * @return true if this object is the same as the obj + * argument; false otherwise. + */ + public boolean equals(Object obj) { + if (obj instanceof ICompany) { + return compareTo((ICompany)obj) == 0; + } + return false; + } + + /** + * Returns a hash code value for the object. + * @return a hash code value for this object. + */ + public int hashCode() { + return (int)companyid; + } + + /** + * The class to be used as the application identifier + * for the Company class. It consists of both the company + * name and the date that the company was founded. + */ + public static class Oid implements Serializable, Comparable { + + /** + * This field is part of the identifier and should match in name + * and type with a field in the Company class. + */ + public long companyid; + + /** The required public no-arg constructor. */ + public Oid() { } + + /** + * Initialize the identifier. + * @param companyid The id of the company. + */ + public Oid(long companyid) { + this.companyid = companyid; + } + + public Oid(String s) { companyid = Long.parseLong(justTheId(s)); } + + public String toString() { return this.getClass().getName() + ": " + companyid;} + + + /** */ + public boolean equals(Object obj) { + if (obj==null || !this.getClass().equals(obj.getClass())) + return false; + Oid o = (Oid) obj; + if (this.companyid != o.companyid) + return false; + return true; + } + + /** */ + public int hashCode() { + return (int)companyid; + } + + protected static String justTheId(String str) { + return str.substring(str.indexOf(':') + 1); + } + + /** */ + public int compareTo(Object obj) { + // may throw ClassCastException which the user must handle + Oid other = (Oid) obj; + if( companyid < other.companyid ) return -1; + if( companyid > other.companyid ) return 1; + return 0; + } + + } + +} + Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactory.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactory.java?view=auto&rev=447999 ============================================================================== --- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactory.java (added) +++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactory.java Tue Sep 19 15:29:56 2006 @@ -0,0 +1,45 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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. + */ + +/* + * CompanyFactory.java + * + */ + +package org.apache.jdo.tck.pc.companyListWithoutJoin; + +import java.math.BigDecimal; + +import java.util.Date; + +/** + * This interface is implemented by a factory class that can create + * Company model instances. The factory instance is registered with + * CompanyFactoryRegistry. + */ +public interface CompanyFactory { + ICompany newCompany(long companyid, String name, Date founded); + IDepartment newDepartment(long deptid, String name); + IDepartment newDepartment(long deptid, + String name, ICompany company); + IFullTimeEmployee newFullTimeEmployee(long personid, + String first, String last, String middle, + Date born, Date hired, double sal); + IPartTimeEmployee newPartTimeEmployee(long personid, + String first, String last, String middle, + Date born, Date hired, double wage); + Class[] getTearDownClasses(); +} Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryAbstractImpl.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryAbstractImpl.java?view=auto&rev=447999 ============================================================================== --- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryAbstractImpl.java (added) +++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryAbstractImpl.java Tue Sep 19 15:29:56 2006 @@ -0,0 +1,109 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.companyListWithoutJoin; + +import javax.jdo.PersistenceManager; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/* + * This class provides an implementation of CompanyFactory that sets all + * of the properties of the instance and defines abstract methods to + * construct the instance itself. It is intended to be subclassed by + * classes that implement only the methods to construct the instance. + */ +public abstract class CompanyFactoryAbstractImpl implements CompanyFactory { + + protected PersistenceManager pm; + + /** Logger */ + protected Log logger = + LogFactory.getFactory().getInstance("org.apache.jdo.tck"); + + /** true if debug logging is enabled. */ + protected boolean debug = logger.isDebugEnabled(); + + /** Creates a new instance of CompanyFactoryAbstractImpl */ + public CompanyFactoryAbstractImpl(PersistenceManager pm) { + this.pm = pm; + } + + abstract ICompany newCompany(); + abstract IDepartment newDepartment(); + abstract IFullTimeEmployee newFullTimeEmployee(); + abstract IPartTimeEmployee newPartTimeEmployee(); + + public ICompany newCompany(long companyid, String name, + java.util.Date founded) { + ICompany result = newCompany(); + if (debug) logger.debug("newCompany returned" + result); + result.setCompanyid(companyid); + result.setName(name); + result.setFounded(founded); + return result; + } + + public IDepartment newDepartment(long deptid, String name) { + IDepartment result = newDepartment(); + if (debug) logger.debug("newDepartment returned" + result); + result.setDeptid(deptid); + result.setName(name); + return result; + } + + + public IDepartment newDepartment(long deptid, String name, ICompany company) { + IDepartment result = newDepartment(); + if (debug) logger.debug("newDepartment returned" + result); + result.setDeptid(deptid); + result.setName(name); + result.setCompany(company); + return result; + } + + public IFullTimeEmployee newFullTimeEmployee(long personid, String first, + String last, String middle, java.util.Date born, + java.util.Date hired, double sal) { + IFullTimeEmployee result = newFullTimeEmployee(); + if (debug) logger.debug("newFullTimeEmployee returned" + result); + result.setPersonid(personid); + result.setFirstname(first); + result.setLastname(last); + result.setMiddlename(middle); + result.setBirthdate(born); + result.setHiredate(hired); + result.setSalary(sal); + return result; + } + + public IPartTimeEmployee newPartTimeEmployee(long personid, String first, + String last, String middle, java.util.Date born, + java.util.Date hired, double wage) { + IPartTimeEmployee result = newPartTimeEmployee(); + if (debug) logger.debug("newPartTimeEmployee returned" + result); + result.setPersonid(personid); + result.setFirstname(first); + result.setLastname(last); + result.setMiddlename(middle); + result.setBirthdate(born); + result.setHiredate(hired); + result.setWage(wage); + return result; + } + +} Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryConcreteClass.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryConcreteClass.java?view=auto&rev=447999 ============================================================================== --- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryConcreteClass.java (added) +++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryConcreteClass.java Tue Sep 19 15:29:56 2006 @@ -0,0 +1,81 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.companyListWithoutJoin; + +import java.math.BigDecimal; + +import java.util.Date; + +import javax.jdo.PersistenceManager; + +/* + * This class is the company factory that uses constructors of the + * concrete classes. + */ +public class CompanyFactoryConcreteClass implements CompanyFactory { + + /** */ + public static final Class[] tearDownClasses = new Class[] { + PartTimeEmployee.class, FullTimeEmployee.class, + Department.class, Company.class + }; + + public CompanyFactoryConcreteClass(PersistenceManager pm) { + } + + public CompanyFactoryConcreteClass() { + } + + public ICompany newCompany(long companyid, + String name, Date founded) { + return new Company(companyid, name, founded); + } + + public IDepartment newDepartment(long deptid, String name) { + return new Department(deptid, name); + } + + public IDepartment newDepartment(long deptid, + String name, ICompany company) { + return new Department(deptid, name, company); + } + + public IFullTimeEmployee newFullTimeEmployee(long personid, + String first, String last, String middle, + Date born, Date hired, double sal) { + return new FullTimeEmployee(personid, first, last, middle, + born, hired, sal); + } + + public IPartTimeEmployee newPartTimeEmployee(long personid, + String first, String last, String middle, + Date born, Date hired, double wage) { + return new PartTimeEmployee(personid, first, last, middle, + born, hired, wage); + } + + public IPerson newPerson(long personid, + String firstname, String lastname, String middlename, + Date birthdate) { + return new Person(personid, firstname, lastname, middlename, + birthdate); + } + + public Class[] getTearDownClasses() { + return tearDownClasses; + } +} Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryPMClass.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryPMClass.java?view=auto&rev=447999 ============================================================================== --- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryPMClass.java (added) +++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryPMClass.java Tue Sep 19 15:29:56 2006 @@ -0,0 +1,62 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.companyListWithoutJoin; + +import javax.jdo.PersistenceManager; + +/* + * CompanyFactoryPMInterface.java + * + * This class uses the PersistenceManager.newInstance method with the concrete + * class as a parameter. + */ +public class CompanyFactoryPMClass + extends CompanyFactoryAbstractImpl { + + /** */ + public static final Class[] tearDownClasses = new Class[] { + PartTimeEmployee.class, FullTimeEmployee.class, + Department.class, Company.class + }; + + /** + * Creates a new instance of CompanyFactoryPMClass + */ + public CompanyFactoryPMClass(PersistenceManager pm) { + super(pm); + } + + ICompany newCompany() { + return (ICompany)pm.newInstance(Company.class); + } + + IDepartment newDepartment() { + return (IDepartment)pm.newInstance(Department.class); + } + + IFullTimeEmployee newFullTimeEmployee() { + return (IFullTimeEmployee)pm.newInstance(FullTimeEmployee.class); + } + + IPartTimeEmployee newPartTimeEmployee() { + return (IPartTimeEmployee)pm.newInstance(PartTimeEmployee.class); + } + + public Class[] getTearDownClasses() { + return tearDownClasses; + } +} Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryPMInterface.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryPMInterface.java?view=auto&rev=447999 ============================================================================== --- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryPMInterface.java (added) +++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryPMInterface.java Tue Sep 19 15:29:56 2006 @@ -0,0 +1,62 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.companyListWithoutJoin; + +import javax.jdo.PersistenceManager; + +/* + * CompanyFactoryPMInterface.java + * + * Created on August 29, 2005, 9:56 PM + * + */ +public class CompanyFactoryPMInterface + extends CompanyFactoryAbstractImpl { + + /** */ + public static final Class[] tearDownClasses = new Class[] { + IPartTimeEmployee.class, IFullTimeEmployee.class, + IDepartment.class, ICompany.class + }; + + /** + * Creates a new instance of CompanyFactoryPMInterface + */ + public CompanyFactoryPMInterface(PersistenceManager pm) { + super(pm); + } + + ICompany newCompany() { + return (ICompany)pm.newInstance(ICompany.class); + } + + IDepartment newDepartment() { + return (IDepartment)pm.newInstance(IDepartment.class); + } + + IFullTimeEmployee newFullTimeEmployee() { + return (IFullTimeEmployee)pm.newInstance(IFullTimeEmployee.class); + } + + IPartTimeEmployee newPartTimeEmployee() { + return (IPartTimeEmployee)pm.newInstance(IPartTimeEmployee.class); + } + + public Class[] getTearDownClasses() { + return tearDownClasses; + } +} Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryRegistry.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryRegistry.java?view=auto&rev=447999 ============================================================================== --- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryRegistry.java (added) +++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyFactoryRegistry.java Tue Sep 19 15:29:56 2006 @@ -0,0 +1,139 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.companyListWithoutJoin; + +import java.lang.reflect.Constructor; + +import java.math.BigDecimal; + +import java.util.Date; + +import javax.jdo.PersistenceManager; + +/* + * This is the registry for company factories. It is used for the + * CompletenessTest to create instances from input xml test data files. + * Factory instances that implement CompanyFactory interface are + * registered (using the singleton pattern). + *

Several registration methods are available. The default factory, + * which creates instances by construction, is automatically + * registered during class initialization. The default factory can + * also be registered by using the no-args method registerFactory(). + *

Non-default factories can be registered using the registerFactory + * method taking the factory as an argument. Non-default factories that + * have a single constructor argument PersistenceManager can be + * registered using either the method that explicitly names the class, + * or with the method that takes the class name from a system property. + */ +public class CompanyFactoryRegistry { + + /** The system property for factory name + */ + final static String FACTORY_PROPERTY_NAME = + "jdo.tck.mapping.companyfactory"; + + /** The factory name if the system property is not set. + */ + final static String DEFAULT_FACTORY_CLASS_NAME = + "org.apache.jdo.tck.pc.company.CompanyFactoryConcreteClass"; + + /** + * The default factory class name + */ + final static String FACTORY_CLASS_NAME; + + static { + String prop = System.getProperty(FACTORY_PROPERTY_NAME); + if ((prop == null) || (prop.length() == 0)) + prop = DEFAULT_FACTORY_CLASS_NAME; + FACTORY_CLASS_NAME = prop; + } + + /** + * This is the default company factory singleton. This is statically + * loaded regardless of the setting of the system property. + */ + final static CompanyFactory SINGLETON = new CompanyFactoryConcreteClass(); + + /** + * This is the currently registered factory. + */ + static CompanyFactory instance = SINGLETON; + + /** + * Creates a new instance of CompanyFactoryRegistry + */ + private CompanyFactoryRegistry() { + } + + /** + * Get the currently registered factory. + * @return the factory + */ + public static CompanyFactory getInstance() { + return instance; + } + + /** Register the default factory. + */ + public static void registerFactory() { + instance = SINGLETON; + } + + /** Register a factory using the default factory name from the + * system property. The factory must be available in the current + * class path and have a public constructor + * taking a PersistenceManager as a parameter. + * @param pm the PersistenceManager + */ + public static void registerFactory(PersistenceManager pm) { + registerFactory(FACTORY_CLASS_NAME, pm); + } + + /** Register a factory using the specified factoryName + * parameter. The factory class must be loadable by the current context + * classloader and have a public constructor + * taking a PersistenceManager as a parameter. + * @param factoryClassName the fully-qualified class name of the factory + * @param pm the PersistenceManager + */ + public static void registerFactory(String factoryClassName, + PersistenceManager pm) { + CompanyFactory factory = null; + try { + if (factoryClassName != null) { + Class factoryClass = Class.forName(factoryClassName); + Constructor ctor = factoryClass.getConstructor(new Class[] + {PersistenceManager.class}); + factory = (CompanyFactory) + ctor.newInstance(new Object[]{pm}); + } + registerFactory(factory); + } catch (Exception ex) { + throw new RuntimeException ("Unable to construct CompanyFactory " + + factoryClassName, ex); + } + } + + /** Register the factory. + * @param factory the factory + */ + public static void registerFactory(CompanyFactory factory) { + instance = factory!=null?factory:SINGLETON; + } + +} Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java?view=auto&rev=447999 ============================================================================== --- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java (added) +++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java Tue Sep 19 15:29:56 2006 @@ -0,0 +1,196 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.companyListWithoutJoin; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Locale; +import java.util.TimeZone; + +import org.apache.jdo.tck.util.ConversionHelper; +import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.propertyeditors.CustomDateEditor; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.InputStreamResource; + +/** + * Utility class to create a graph of company model instances from an xml + * representation. + * + * @author Michael Bouschen + */ +public class CompanyModelReader extends XmlBeanFactory { + + /** The format of date values in the xml representation */ + public static final String DATE_PATTERN = "d/MMM/yyyy"; + + /** The name of the root list bean. */ + public static final String ROOT_LIST_NAME = "root"; + + /** The bean-factory name in the xml input files. + */ + public static final String BEAN_FACTORY_NAME = "companyFactory"; + + /** The company factory instance. */ + private CompanyFactory companyFactory; + + /** + * Create a CompanyModelReader for the specified resourceName. + * @param resourceName the name of the resource + */ + public CompanyModelReader(String resourceName) { + // Use the class loader of the Company class to find the resource + this(resourceName, Company.class.getClassLoader()); + } + + /** + * Create a CompanyModelReader for the specified resourceName. + * @param resourceName the name of the resource + */ + public CompanyModelReader(String resourceName, ClassLoader classLoader) { + super(new ClassPathResource(resourceName, classLoader)); + configureFactory(); + } + + /** + * Create a CompanyModelReader for the specified InputStream. + * @param stream the input stream + */ + public CompanyModelReader(InputStream stream) { + super(new InputStreamResource(stream)); + configureFactory(); + } + + /** + * Returns a list of root objects. The method expects to find a bean + * called "root" of type list in the xml and returns it. + * @return a list of root instances + */ + public List getRootList() { + return (List)getBean(ROOT_LIST_NAME); + } + + /** + * Configure the CompanyModelReader, e.g. register CustomEditor classes + * to convert the string representation of a property into an instance + * of the right type. + */ + private void configureFactory() { + SimpleDateFormat formatter = new SimpleDateFormat(DATE_PATTERN, Locale.US); + formatter.setTimeZone(TimeZone.getTimeZone("America/New_York")); + CustomDateEditor dateEditor = + new CustomDateEditor(formatter, true); + registerCustomEditor(Date.class, dateEditor); + companyFactory = CompanyFactoryRegistry.getInstance(); + addSingleton(BEAN_FACTORY_NAME, companyFactory); + } + + // Convenience methods + + /** + * Convenience method returning a Company instance for the specified + * name. The method returns null if there is no Company + * bean with the specified name. + * @param name the name of the bean to return. + * @return the instance of the bean or null if there no + * Company bean. + */ + public Company getCompany(String name) { + return (Company)getBean(name, Company.class); + } + + /** + * Convenience method returning a Department instance for the specified + * name. The method returns null if there is no Department + * bean with the specified name. + * @param name the name of the bean to return. + * @return the instance of the bean or null if there no + * Department bean. + */ + public Department getDepartment(String name) { + return (Department)getBean(name, Department.class); + } + + /** + * Convenience method returning an Employee instance for the specified + * name. The method returns null if there is no Employee + * bean with the specified name. + * @param name the name of the bean to return. + * @return the instance of the bean or null if there no + * Employee bean. + */ + public Employee getEmployee(String name) { + return (Employee)getBean(name, Employee.class); + } + + /** + * Convenience method returning a FullTimeEmployee instance for the + * specified name. The method returns null if there is no + * FullTimeEmployee bean with the specified name. + * @param name the name of the bean to return. + * @return the instance of the bean or null if there no + * FullTimeEmployee bean. + */ + public FullTimeEmployee getFullTimeEmployee(String name) { + return (FullTimeEmployee)getBean(name, FullTimeEmployee.class); + } + + /** + * Convenience method returning a PartTimeEmployee instance for the + * specified name. The method returns null if there is no + * PartTimeEmployee bean with the specified name. + * @param name the name of the bean to return. + * @return the instance of the bean or null if there no + * PartTimeEmployee bean. + */ + public PartTimeEmployee getPartTimeEmployee(String name) { + return (PartTimeEmployee)getBean(name, PartTimeEmployee.class); + } + + /** + * Convenience method returning a Person instance for the specified + * name. The method returns null if there is no Person + * bean with the specified name. + * @param name the name of the bean to return. + * @return the instance of the bean or null if there no + * Person bean. + */ + public Person getPerson(String name) { + return (Person)getBean(name, Person.class); + } + + /** + * @return Returns the tearDownClasses. + */ + public Class[] getTearDownClassesFromFactory() { + return companyFactory.getTearDownClasses(); + } + + /** + * @return Returns the tearDownClasses. + */ + public static Class[] getTearDownClasses() { + return CompanyFactoryConcreteClass.tearDownClasses; + } + + public static Date stringToUtilDate(String value) { + return ConversionHelper.toUtilDate(DATE_PATTERN, "America/New_York", Locale.US, value); + } +} + Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Department.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Department.java?view=auto&rev=447999 ============================================================================== --- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Department.java (added) +++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Department.java Tue Sep 19 15:29:56 2006 @@ -0,0 +1,341 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.companyListWithoutJoin; + +import java.io.Serializable; +import java.io.ObjectInputStream; +import java.io.IOException; + +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import org.apache.jdo.tck.util.DeepEquality; +import org.apache.jdo.tck.util.EqualityHelper; + +/** + * This class represents a department within a company. + */ +public class Department + implements IDepartment, Serializable, Comparable, Comparator, DeepEquality { + + public static final int RECOMMENDED_NO_OF_EMPS = 2; + + private long deptid; + private String name; + private Company company; + private List employees; + + /** This is the JDO-required no-args constructor. The TCK relies on + * this constructor for testing PersistenceManager.newInstance(PCClass). + */ + public Department() {} + + /** + * Construct a Department instance. + * @param deptid The department id. + * @param name The name of the department. + */ + public Department(long deptid, String name) { + this.deptid = deptid; + this.name = name; + } + + /** + * Construct a Department instance. + * @param deptid The department id. + * @param name The name of the department. + * @param company The company that the department is associated with. + */ + public Department(long deptid, String name, ICompany company) { + this.deptid = deptid; + this.name = name; + this.company = (Company)company; + } + + /** + * Construct a Department instance. + * @param deptid The department id. + * @param name The name of the department. + * @param company The company that the department is associated with. + * @param employees List of employees + */ + public Department(long deptid, String name, Company company, + List employees) { + this.deptid = deptid; + this.name = name; + this.company = (Company)company; + this.employees = employees; + } + + /** + * Set the id associated with this object. + * @param id the id. + */ + public void setDeptid(long id) { + if (this.deptid != 0) + throw new IllegalStateException("Id is already set."); + this.deptid = id; + } + + /** + * Get the department id. + * @return The department id. + */ + public long getDeptid() { + return deptid; + } + + /** + * Get the name of the department. + * @return The name of the department. + */ + public String getName() { + return name; + } + + /** + * Set the name of the department. + * @param name The name to set for the department. + */ + public void setName(String name) { + this.name = name; + } + + /** + * Get the company associated with the department. + * @return The company. + */ + public ICompany getCompany() { + return company; + } + + /** + * Set the company for the department. + * @param company The company to associate with the department. + */ + public void setCompany(ICompany company) { + this.company = (Company)company; + } + + /** + * Get the employees in the department as an unmodifiable set. + ******************* FIX?? + * @return The set of employees in the department, as an unmodifiable + * set. + */ + public List getEmployees() { + return employees; + } + + /** + * Add an employee to the department. + * @param emp The employee to add to the department. + */ + public void addEmployee(Employee emp) { + employees.add(emp); + } + + /** + * Remove an employee from the department. + * @param emp The employee to remove from the department. + */ + public void removeEmployee(int index) { + employees.remove(index); + } + + /** + * Set the employees to be in this department. + * @param employees The employees for this department. + */ + public void setEmployees(List employees) { + this.employees = employees; + } + + /** + * Returns true if all the fields of this instance are + * deep equal to the coresponding fields of the other Department. + * @param other the object with which to compare. + * @param helper EqualityHelper to keep track of instances that have + * already been processed. + * @return true if all the fields are deep equal; + * false otherwise. + * @throws ClassCastException if the specified instances' type prevents + * it from being compared to this instance. + */ + public boolean deepCompareFields(Object other, + EqualityHelper helper) { + IDepartment otherDept = (IDepartment)other; + String where = "Department<" + deptid + ">"; + return + helper.equals(deptid, otherDept.getDeptid(), where + ".deptid") & + helper.equals(name, otherDept.getName(), where + ".name") & + helper.deepEquals(employees, otherDept.getEmployees(), where + ".employees") & + helper.deepEquals(company, otherDept.getCompany(), where + ".company") ; + } + + /** + * Returns a String representation of a Department object. + * @return a String representation of a Department object. + */ + public String toString() { + return "Department(" + getFieldRepr()+ ")"; + } + + /** + * Returns a String representation of the non-relationship fields. + * @return a String representation of the non-relationship fields. + */ + protected String getFieldRepr() { + StringBuffer rc = new StringBuffer(); + rc.append(deptid); + rc.append(", name ").append(name); + return rc.toString(); + } + + /** + * Compares this object with the specified object for order. Returns a + * negative integer, zero, or a positive integer as this object is less + * than, equal to, or greater than the specified object. + * @param o The Object to be compared. + * @return a negative integer, zero, or a positive integer as this + * object is less than, equal to, or greater than the specified object. + * @throws ClassCastException - if the specified object's type prevents + * it from being compared to this Object. + */ + public int compareTo(Object o) { + return compareTo((IDepartment)o); + } + + /** + * Compare two instances. This is a method in Comparator. + */ + public int compare(Object o1, Object o2) { + return compare((IDepartment)o1, (IDepartment)o2); + } + + /** + * Compares this object with the specified Department object for + * order. Returns a negative integer, zero, or a positive integer as + * this object is less than, equal to, or greater than the specified + * object. + * @param other The Department object to be compared. + * @return a negative integer, zero, or a positive integer as this + * object is less than, equal to, or greater than the specified + * Department object. + */ + public int compareTo(IDepartment other) { + return compare(this, other); + } + + /** + * Compares its two IDepartment arguments for order. Returns a negative + * integer, zero, or a positive integer as the first argument is less + * than, equal to, or greater than the second. + * @param o1 the first IDepartment object to be compared. + * @param o2 the second IDepartment object to be compared. + * @return a negative integer, zero, or a positive integer as the first + * object is less than, equal to, or greater than the second object. + */ + public static int compare(IDepartment o1, IDepartment o2) { + return EqualityHelper.compare(o1.getDeptid(), o2.getDeptid()); + } + + /** + * Indicates whether some other object is "equal to" this one. + * @param obj the object with which to compare. + * @return true if this object is the same as the obj + * argument; false otherwise. + */ + public boolean equals(Object obj) { + if (obj instanceof IDepartment) { + return compareTo((IDepartment)obj) == 0; + } + return false; + } + + /** + * Returns a hash code value for the object. + * @return a hash code value for this object. + */ + public int hashCode() { + return (int)deptid; + } + + /** + * The application identity class associated with the + * Department class. + */ + public static class Oid implements Serializable, Comparable { + + /** + * This field represents the application identifier field + * for the Department class. + * It must match in name and type with the field in the + * Department class. + */ + public long deptid; + + /** + * The required public, no-arg constructor. + */ + public Oid() { } + + /** + * A constructor to initialize the identifier field. + * @param deptid the deptid of the Department. + */ + public Oid(long deptid) { + this.deptid = deptid; + } + + public Oid(String s) { deptid = Long.parseLong(justTheId(s)); } + + public String toString() { return this.getClass().getName() + ": " + deptid;} + + + /** */ + public boolean equals(java.lang.Object obj) { + if( obj==null || !this.getClass().equals(obj.getClass()) ) + return( false ); + Oid o = (Oid) obj; + if( this.deptid != o.deptid ) return( false ); + return( true ); + } + + /** */ + public int hashCode() { + return( (int) deptid ); + } + + protected static String justTheId(String str) { + return str.substring(str.indexOf(':') + 1); + } + + /** */ + public int compareTo(Object obj) { + // may throw ClassCastException which the user must handle + Oid other = (Oid) obj; + if( deptid < other.deptid ) return -1; + if( deptid > other.deptid ) return 1; + return 0; + } + + } + +} + Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Employee.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Employee.java?view=auto&rev=447999 ============================================================================== --- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Employee.java (added) +++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Employee.java Tue Sep 19 15:29:56 2006 @@ -0,0 +1,335 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.companyListWithoutJoin; + +import java.io.ObjectInputStream; +import java.io.IOException; + +import java.util.Collections; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; + +import org.apache.jdo.tck.util.DeepEquality; +import org.apache.jdo.tck.util.EqualityHelper; + +/** + * This class represents an employee. + */ +public abstract class Employee extends Person implements IEmployee { + + private Date hiredate; + private double weeklyhours; + private Department department; + private Department fundingDept; + private Employee manager; + private Employee mentor; + private Employee protege; + private Employee hradvisor; + private transient Set team = new HashSet(); // element-type is Employee + private transient Set hradvisees = new HashSet(); // element-type is Employee + + /** This is the JDO-required no-args constructor */ + protected Employee() {} + + /** + * Construct an Employee instance. + * @param personid The identifier for the person. + * @param firstname The first name of the employee. + * @param lastname The last name of the employee. + * @param middlename The middle name of the employee. + * @param birthdate The birth date of the employee. + * @param hiredate The date that the employee was hired. + */ + public Employee(long personid, String firstname, String lastname, + String middlename, Date birthdate, + Date hiredate) { + super(personid, firstname, lastname, middlename, birthdate); + this.hiredate = hiredate; + } + + /** + * Get the date that the employee was hired. + * @return The date the employee was hired. + */ + public Date getHiredate() { + return hiredate; + } + + /** + * Set the date that the employee was hired. + * @param hiredate The date the employee was hired. + */ + public void setHiredate(Date hiredate) { + this.hiredate = hiredate; + } + + /** + * Get the weekly hours of the employee. + * @return The number of hours per week that the employee works. + */ + public double getWeeklyhours() { + return weeklyhours; + } + + /** + * Set the number of hours per week that the employee works. + * @param weeklyhours The number of hours per week that the employee + * works. + */ + public void setWeeklyhours(double weeklyhours) { + this.weeklyhours = weeklyhours; + } + + /** + * Get the employee's department. + * @return The department associated with the employee. + */ + public IDepartment getDepartment() { + return department; + } + + /** + * Set the employee's department. + * @param department The department. + */ + public void setDepartment(IDepartment department) { + this.department = (Department)department; + } + + /** + * Get the employee's funding department. + * @return The funding department associated with the employee. + */ + public IDepartment getFundingDept() { + return fundingDept; + } + + /** + * Set the employee's funding department. + * @param department The funding department. + */ + public void setFundingDept(IDepartment department) { + this.fundingDept = (Department)department; + } + + /** + * Get the employee's manager. + * @return The employee's manager. + */ + public IEmployee getManager() { + return manager; + } + + /** + * Set the employee's manager. + * @param manager The employee's manager. + */ + public void setManager(IEmployee manager) { + this.manager = (Employee)manager; + } + + /** + * Get the employee's team. + * @return The set of Employees on this employee's team, + * returned as an unmodifiable set. + */ + public Set getTeam() { + return Collections.unmodifiableSet(team); + } + + /** + * Add an Employee to this employee's team. + * This method sets both sides of the relationship, modifying + * this employees team to include parameter emp and modifying + * emp to set its manager attribute to this object. + * @param emp The Employee to add to the team. + */ + public void addToTeam(Employee emp) { + team.add(emp); + emp.manager = this; + } + + /** + * Remove an Employee from this employee's team. + * This method will also set the emp manager to null. + * @param emp The Employee to remove from the team. + */ + public void removeFromTeam(Employee emp) { + team.remove(emp); + emp.manager = null; + } + + /** + * Set the employee's team. + * @param team The set of Employees. + */ + public void setTeam(Set team) { + // workaround: create a new HashSet, because fostore does not + // support LinkedHashSet + this.team = (team != null) ? new HashSet(team) : null; + } + + /** + * Set the mentor for this employee. + * @param mentor The mentor for this employee. + */ + public void setMentor(IEmployee mentor) { + this.mentor = (Employee)mentor; + } + + /** + * Get the mentor for this employee. + * @return The mentor. + */ + public IEmployee getMentor() { + return mentor; + } + + /** + * Set the protege for this employee. + * @param protege The protege for this employee. + */ + public void setProtege(IEmployee protege) { + this.protege = (Employee)protege; + } + + /** + * Get the protege of this employee. + * @return The protege of this employee. + */ + public IEmployee getProtege() { + return protege; + } + + /** + * Set the HR advisor for this employee. + * @param hradvisor The hradvisor for this employee. + */ + public void setHradvisor(IEmployee hradvisor) { + this.hradvisor = (Employee)hradvisor; + } + + /** + * Get the HR advisor for the employee. + * @return The HR advisor. + */ + public IEmployee getHradvisor() { + return hradvisor; + } + + /** + * Get the HR advisees of this HR advisor. + * @return An unmodifiable Set containing the + * Employees that are HR advisees of this employee. + */ + public Set getHradvisees() { + return Collections.unmodifiableSet(hradvisees); + } + + /** + * Add an Employee as an advisee of this HR advisor. + * This method also sets the emp hradvisor to reference + * this object. In other words, both sides of the relationship are + * set. + * @param emp The employee to add as an advisee. + */ + public void addAdvisee(Employee emp) { + hradvisees.add(emp); + emp.hradvisor = this; + } + + /** + * Remove an Employee as an advisee of this HR advisor. + * This method also sets the emp hradvisor to null. + * In other words, both sides of the relationship are set. + * @param emp The employee to add as an HR advisee. + */ + public void removeAdvisee(Employee emp) { + hradvisees.remove(emp); + emp.hradvisor = null; + } + + /** + * Set the HR advisees of this HR advisor. + * @param hradvisees The Employees that are HR advisees of + * this employee. + */ + public void setHradvisees(Set hradvisees) { + // workaround: create a new HashSet, because fostore does not + // support LinkedHashSet + this.hradvisees = (hradvisees != null) ? new HashSet(hradvisees) : null; + } + + /** Serialization support: initialize transient fields. */ + private void readObject(ObjectInputStream in) + throws IOException, ClassNotFoundException { + in.defaultReadObject(); + team = new HashSet(); + hradvisees = new HashSet(); + } + + /** + * Return a String representation of a Employee object. + * @return a String representation of a Employee object. + */ + public String toString() { + return "Employee(" + getFieldRepr() + ")"; + } + + /** + * Returns a String representation of the non-relationship fields. + * @return a String representation of the non-relationship fields. + */ + protected String getFieldRepr() { + StringBuffer rc = new StringBuffer(); + rc.append(super.getFieldRepr()); + rc.append(", hired ").append(formatter.format(hiredate)); + rc.append(", weeklyhours ").append(weeklyhours); + return rc.toString(); + } + + /** + * Returns true if all the fields of this instance are + * deep equal to the corresponding fields of the specified Employee. + * @param other the object with which to compare. + * @param helper EqualityHelper to keep track of instances that have + * already been processed. + * @return true if all the fields are deep equal; + * false otherwise. + * @throws ClassCastException if the specified instances' type prevents + * it from being compared to this instance. + */ + public boolean deepCompareFields(Object other, + EqualityHelper helper) { + IEmployee otherEmp = (IEmployee)other; + String where = "Employee<" + getPersonid() + ">"; + return super.deepCompareFields(otherEmp, helper) & + helper.equals(hiredate, otherEmp.getHiredate(), where + ".hiredate") & + helper.closeEnough(weeklyhours, otherEmp.getWeeklyhours(), where + ".weeklyhours") & + helper.deepEquals(department, otherEmp.getDepartment(), where + ".department") & + helper.deepEquals(fundingDept, otherEmp.getFundingDept(), where + ".fundingDept") & + helper.deepEquals(manager, otherEmp.getManager(), where + ".manager") & + helper.deepEquals(mentor, otherEmp.getMentor(), where + ".mentor") & + helper.deepEquals(protege, otherEmp.getProtege(), where + ".protege") & + helper.deepEquals(hradvisor, otherEmp.getHradvisor(), where + ".hradvisor") & + helper.deepEquals(team, otherEmp.getTeam(), where + ".team") & + helper.deepEquals(hradvisees, otherEmp.getHradvisees(), where + ".hradvisees"); + } + +} + Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/FullTimeEmployee.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/FullTimeEmployee.java?view=auto&rev=447999 ============================================================================== --- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/FullTimeEmployee.java (added) +++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/FullTimeEmployee.java Tue Sep 19 15:29:56 2006 @@ -0,0 +1,108 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.companyListWithoutJoin; + +import java.util.Date; + +import org.apache.jdo.tck.util.DeepEquality; +import org.apache.jdo.tck.util.EqualityHelper; + +/** + * This class represents a full-time employee. + */ +public class FullTimeEmployee extends Employee implements IFullTimeEmployee { + + private double salary; + + /** This is the JDO-required no-args constructor. The TCK relies on + * this constructor for testing PersistenceManager.newInstance(PCClass). + */ + public FullTimeEmployee() {} + + /** + * Construct a full-time employee. + * @param personid The person identifier. + * @param first The person's first name. + * @param last The person's last name. + * @param middle The person's middle name. + * @param born The person's birthdate. + * @param hired The date that the person was hired. + * @param sal The salary of the full-time employee. + */ + public FullTimeEmployee(long personid, String first, String last, + String middle, Date born, + Date hired, double sal) { + super(personid, first, last, middle, born, hired); + salary = sal; + } + + /** + * Get the salary of the full time employee. + * @return The salary of the full time employee. + */ + public double getSalary() { + return salary; + } + + /** + * Set the salary for the full-time employee. + * @param salary The salary to set for the full-time employee. + */ + public void setSalary(double salary) { + this.salary = salary; + } + + /** + * Return a String representation of a FullTimeEmployee object. + * @return a String representation of a FullTimeEmployee object. + */ + public String toString() { + return "FullTimeEmployee(" + getFieldRepr() + ")"; + } + + /** + * Returns a String representation of the non-relationship fields. + * @return a String representation of the non-relationship fields. + */ + public String getFieldRepr() { + StringBuffer rc = new StringBuffer(); + rc.append(super.getFieldRepr()); + rc.append(", $").append(salary); + return rc.toString(); + } + + /** + * Returns true if all the fields of this instance are + * deep equal to the coresponding fields of the specified + * FullTimeEmployee. + * @param other the object with which to compare. + * @param helper EqualityHelper to keep track of instances that have + * already been processed. + * @return true if all the fields are deep equal; + * false otherwise. + * @throws ClassCastException if the specified instances' type prevents + * it from being compared to this instance. + */ + public boolean deepCompareFields(Object other, + EqualityHelper helper) { + IFullTimeEmployee otherEmp = (IFullTimeEmployee)other; + String where = "FullTimeEmployee<" + getPersonid() + ">"; + return super.deepCompareFields(otherEmp, helper) & + helper.closeEnough(salary, otherEmp.getSalary(), where + ".salary"); + } + +} Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/ICompany.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/ICompany.java?view=auto&rev=447999 ============================================================================== --- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/ICompany.java (added) +++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/ICompany.java Tue Sep 19 15:29:56 2006 @@ -0,0 +1,38 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.companyListWithoutJoin; + +import java.util.Date; +import java.util.Set; + +/** + * This interface represents the persistent state of Company. + * Javadoc was deliberately omitted because it would distract from + * the purpose of the interface. + */ +public interface ICompany { + + long getCompanyid(); + Set getDepartments(); + Date getFounded(); + String getName(); + + void setCompanyid(long id); + void setDepartments(Set depts); + void setFounded(Date date); + void setName(String string); +} Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IDepartment.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IDepartment.java?view=auto&rev=447999 ============================================================================== --- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IDepartment.java (added) +++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IDepartment.java Tue Sep 19 15:29:56 2006 @@ -0,0 +1,37 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.companyListWithoutJoin; + +import java.util.List; + +/** + * This interface represents the persistent state of Department. + * Javadoc was deliberately omitted because it would distract from + * the purpose of the interface. + */ +public interface IDepartment { + + long getDeptid(); + String getName(); + ICompany getCompany(); + List getEmployees(); + + void setDeptid(long deptid); + void setName(String name); + void setCompany(ICompany company); + void setEmployees(List employees); +} Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IEmployee.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IEmployee.java?view=auto&rev=447999 ============================================================================== --- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IEmployee.java (added) +++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IEmployee.java Tue Sep 19 15:29:56 2006 @@ -0,0 +1,51 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.companyListWithoutJoin; + +import java.util.Date; +import java.util.Set; + +/** + * This interface represents the persistent state of Employee. + * Javadoc was deliberately omitted because it would distract from + * the purpose of the interface. + */ +public interface IEmployee extends IPerson { + + Date getHiredate(); + double getWeeklyhours(); + IDepartment getDepartment(); + IDepartment getFundingDept(); + IEmployee getManager(); + Set getTeam(); + IEmployee getMentor(); + IEmployee getProtege(); + IEmployee getHradvisor(); + Set getHradvisees(); + + void setHiredate(Date hiredate); + void setWeeklyhours(double weeklyhours); + void setDepartment(IDepartment department); + void setFundingDept(IDepartment department); + void setManager(IEmployee manager); + void setTeam(Set team); + void setMentor(IEmployee mentor); + void setProtege(IEmployee protege); + void setHradvisor(IEmployee hradvisor); + void setHradvisees(Set hradvisees); + +} Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IFullTimeEmployee.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IFullTimeEmployee.java?view=auto&rev=447999 ============================================================================== --- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IFullTimeEmployee.java (added) +++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IFullTimeEmployee.java Tue Sep 19 15:29:56 2006 @@ -0,0 +1,28 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.companyListWithoutJoin; + +/** + * This interface represents the persistent state of FullTimeEmployee. + * Javadoc was deliberately omitted because it would distract from + * the purpose of the interface. + */ +public interface IFullTimeEmployee extends IEmployee { + + double getSalary(); + void setSalary(double salary); +}