db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcai...@apache.org
Subject svn commit: r582405 [2/2] - /db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/
Date Fri, 05 Oct 2007 21:38:27 GMT
Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppInsurance.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppInsurance.java?rev=582405&view=auto
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppInsurance.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppInsurance.java Fri Oct  5 14:38:26 2007
@@ -0,0 +1,302 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.companyAnnotatedJPA;
+
+import javax.persistence.*;
+
+import java.io.Serializable;
+
+import java.util.Comparator;
+import org.apache.jdo.tck.pc.company.IEmployee;
+
+import org.apache.jdo.tck.pc.company.IInsurance;
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents an insurance carrier selection for a particular
+ * <code>JPAAppEmployee</code>.
+ */
+@Entity
+@Table(name="insuranceplans")
+@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
+@DiscriminatorColumn(discriminatorType=DiscriminatorType.STRING,
+        name="DISCRIMINATOR")
+public class JPAAppInsurance 
+    implements IInsurance, Serializable, Comparable, Comparator, DeepEquality  {
+
+    @Id
+    @Column(name="INSID")
+    private long     insid;
+    @Column(name="CARRIER")
+    private String   carrier;
+    @Column(name="EMPLOYEE")
+    private JPAAppEmployee employee;
+
+    /** This is the JDO-required no-args constructor. */
+    protected JPAAppInsurance() {}
+
+    /**
+     * Construct an <code>JPAAppInsurance</code> instance.
+     * 
+     * 
+     * @param insid The insurance instance identifier.
+     * @param carrier The insurance carrier.
+     */
+    protected JPAAppInsurance(long insid, String carrier) {
+        this.insid = insid;
+        this.carrier = carrier;
+    }
+
+    /**
+     * Construct an <code>JPAAppInsurance</code> instance.
+     * 
+     * 
+     * @param insid The insurance instance identifier.
+     * @param carrier The insurance carrier.
+     * @param employee The employee associated with this insurance.
+     */
+    protected JPAAppInsurance(long insid, String carrier, IEmployee employee) {
+        this.insid = insid;
+        this.carrier = carrier;
+        this.employee = (JPAAppEmployee)employee;
+    }
+
+    /**
+     * Get the insurance ID.
+     * @return the insurance ID.
+     */
+    public long getInsid() {
+        return insid;
+    }
+
+    /**
+     * Set the insurance ID.
+     * @param id The insurance ID value.
+     */
+    public void setInsid(long id) {
+        if (this.insid != 0) 
+            throw new IllegalStateException("Id is already set.");
+        this.insid = id;
+    }
+
+    /**
+     * Get the insurance carrier.
+     * @return The insurance carrier.
+     */
+    public String getCarrier() {
+        return carrier;
+    }
+
+    /**
+     * Set the insurance carrier.
+     * @param carrier The insurance carrier.
+     */
+    public void setCarrier(String carrier) {
+        this.carrier = carrier;
+    }
+    
+    /**
+     * Get the associated employee.
+     * @return The employee for this insurance.
+     */
+    public IEmployee getEmployee() {
+        return employee;
+    }
+
+    /**
+     * Set the associated employee.
+     * @param employee The associated employee.
+     */
+    public void setEmployee(IEmployee employee) {
+        this.employee = (JPAAppEmployee)employee;
+    }
+
+    /**
+     * Returns a String representation of a <code>JPAAppInsurance</code> object.
+     * 
+     * 
+     * @return a String representation of a <code>JPAAppInsurance</code> object.
+     */
+    public String toString() {
+        return "JPAAppInsurance(" + 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(insid);
+        rc.append(", carrier ").append(carrier);
+        return rc.toString();
+    }
+
+    /** 
+     * Returns <code>true</code> if all the fields of this instance are
+     * deep equal to the coresponding fields of the other Object.
+     * @param other the object with which to compare.
+     * @param helper EqualityHelper to keep track of instances that have
+     * already been processed. 
+     * @return <code>true</code> if all the fields are deep equal;
+     * <code>false</code> otherwise.  
+     * @throws ClassCastException if the specified instances' type prevents
+     * it from being compared to this instance. 
+     */
+    public boolean deepCompareFields(Object other, 
+                                     EqualityHelper helper) {
+        JPAAppInsurance otherIns = (JPAAppInsurance)other;
+        String where = "JPAAppInsurance<" + insid + ">";
+        return
+            helper.equals(insid, otherIns.getInsid(), where + ".insid") &
+            helper.equals(carrier, otherIns.getCarrier(), where + ".carrier") &
+            helper.deepEquals(employee, otherIns.getEmployee(), where + ".employee");
+    }
+    
+    /** 
+     * 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((JPAAppInsurance)o);
+    }
+
+    /** 
+     * Compare two instances. This is a method in Comparator.
+     */
+    public int compare(Object o1, Object o2) {
+        return compare((JPAAppInsurance)o1, (JPAAppInsurance)o2);
+    }
+
+    /** 
+     * Compares this object with the specified Insurance 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 Insurance 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
+     * Insurance object. 
+     */
+    public int compareTo(JPAAppInsurance other) {
+        return compare(this, other);
+    }
+
+    /**
+     * Compares its two IInsurance 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 IInsurance object to be compared. 
+     * @param o2 the second IInsurance 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(JPAAppInsurance o1, JPAAppInsurance o2) {
+        return EqualityHelper.compare(o1.getInsid(), o2.getInsid());
+    }
+    
+    /** 
+     * Indicates whether some other object is "equal to" this one.
+     * @param obj the object with which to compare.
+     * @return <code>true</code> if this object is the same as the obj
+     * argument; <code>false</code> otherwise. 
+     */
+    public boolean equals(Object obj) {
+        if (obj instanceof JPAAppInsurance) {
+            return compareTo((JPAAppInsurance)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)insid;
+    }
+
+    /**
+     * This class is used to represent the application
+     * identifier for the <code>Insurance</code> class.
+     */
+    public static class Oid implements Serializable, Comparable 
+    {
+        /**
+         * This field represents the application identifier for the
+         * <code>Insurance</code> class. It must match the field in the
+         * <code>Insurance</code> class in both name and type. 
+         */
+        public long insid;
+        
+        /**
+         * The required public no-args constructor.
+         */
+        public Oid() { }
+
+        /**
+         * Initialize with an insurance identifier.
+         * @param insid the insurance ID.
+         */
+        public Oid(long insid) {
+            this.insid = insid;
+        }
+        
+        public Oid(String s) { insid = Long.parseLong(justTheId(s)); }
+
+        public String toString() { return this.getClass().getName() + ": "  + insid;}
+
+
+        /** */
+        public boolean equals(java.lang.Object obj) {
+            if( obj==null || !this.getClass().equals(obj.getClass()) )
+                return( false );
+            Oid o=(Oid) obj;
+            if( this.insid!=o.insid ) return( false );
+            return( true );
+        }
+
+        /** */
+        public int hashCode() {
+            return( (int) insid );
+        }
+        
+        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( insid < other.insid ) return -1;
+            if( insid > other.insid ) return 1;
+            return 0;
+        }
+
+    }
+
+}
+

Propchange: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppInsurance.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppMedicalInsurance.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppMedicalInsurance.java?rev=582405&view=auto
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppMedicalInsurance.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppMedicalInsurance.java Fri Oct  5 14:38:26 2007
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.companyAnnotatedJPA;
+
+import javax.persistence.*;
+
+import org.apache.jdo.tck.pc.company.IEmployee;
+import org.apache.jdo.tck.pc.company.IMedicalInsurance;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents a dental insurance carrier selection for a
+ * particular <code>Employee</code>.
+ */
+@Entity
+public class JPAAppMedicalInsurance extends JPAAppInsurance implements IMedicalInsurance {
+
+    @Column(name="PLANTYPE")
+    private String planType; // possible values: "PPO", "EPO", "NPO" 
+
+    /** This is the JDO-required no-args constructor. The TCK relies on
+     * this constructor for testing PersistenceManager.newInstance(PCClass).
+     */
+    public JPAAppMedicalInsurance() {}
+
+    /**
+     * Construct a <code>JPAAppMedicalInsurance</code> instance.
+     * 
+     * 
+     * @param insid The insurance instance identifier.
+     * @param carrier The insurance carrier.
+     * @param planType The planType.
+     */
+    public JPAAppMedicalInsurance(long insid, String carrier, 
+                            String planType)
+    {
+        super(insid, carrier);
+        this.planType = planType;
+    }
+
+    /**
+     * Construct a <code>JPAAppMedicalInsurance</code> instance.
+     * 
+     * 
+     * @param insid The insurance instance identifier.
+     * @param carrier The insurance carrier.
+     * @param employee The employee associated with this insurance.
+     * @param planType The planType.
+     */
+    public JPAAppMedicalInsurance(long insid, String carrier, 
+                            IEmployee employee, String planType)
+    {
+        super(insid, carrier, (JPAAppEmployee)employee);
+        this.planType = planType;
+    }
+
+    /**
+     * Get the insurance planType.
+     * @return The insurance planType.
+     */
+    public String getPlanType() {
+        return planType;
+    }
+
+    /**
+     * Set the insurance planType.
+     * @param planType The insurance planType.
+     */
+    public void setPlanType(String planType) {
+        this.planType = planType;
+    }
+
+    /**
+     * Returns a String representation of a <code>JPAAppMedicalInsurance</code>
+     * object.
+     * 
+     * 
+     * @return a String representation of a <code>JPAAppMedicalInsurance</code>
+     * object.
+     */
+    public String toString() {
+        return "JPAMedicalInsurance(" + 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(", planType ").append(planType);
+        return rc.toString();
+    }
+
+    /** 
+     * Returns <code>true</code> if all the fields of this instance are
+     * deep equal to the coresponding fields of the other Object.
+     * @param other the object with which to compare.
+     * @param helper EqualityHelper to keep track of instances that have
+     * already been processed. 
+     * @return <code>true</code> if all the fields are deep equal;
+     * <code>false</code> otherwise.  
+     * @throws ClassCastException if the specified instances' type prevents
+     * it from being compared to this instance. 
+     */
+    public boolean deepCompareFields(Object other, 
+                                     EqualityHelper helper) {
+        JPAAppMedicalInsurance otherIns = (JPAAppMedicalInsurance)other;
+        String where = "JPAAppMedicalInsurance<" + getInsid() + ">";
+        return super.deepCompareFields(otherIns, helper) &
+            helper.equals(planType, otherIns.getPlanType(), where + ".planType");
+    }
+}
+

Propchange: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppMedicalInsurance.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppPartTimeEmployee.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppPartTimeEmployee.java?rev=582405&view=auto
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppPartTimeEmployee.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppPartTimeEmployee.java Fri Oct  5 14:38:26 2007
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.companyAnnotatedJPA;
+
+import javax.persistence.*;
+
+import java.util.Date;
+
+import org.apache.jdo.tck.pc.company.IPartTimeEmployee;
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents a part-time employee.
+ */
+@Entity
+public class JPAAppPartTimeEmployee extends JPAAppEmployee 
+        implements IPartTimeEmployee {
+
+    @Column(name="WAGE")
+    private double wage;
+
+    /** This is the JDO-required no-args constructor. The TCK relies on
+     * this constructor for testing PersistenceManager.newInstance(PCClass).
+     */
+    public JPAAppPartTimeEmployee() {}
+
+    /**
+     * Construct a part-time employee.
+     * @param personid The identifier for the person.
+     * @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 the person was hired.
+     * @param wage The person's wage.
+     */
+    public JPAAppPartTimeEmployee(long personid, String first, String last,
+                            String middle, Date born,
+                            Date hired, double wage ) {
+        super(personid, first, last, middle, born, hired);
+        this.wage = wage;
+    }
+
+    /**
+     * Construct a part-time employee.
+     * @param personid The identifier for the person.
+     * @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 addr The person's address.
+     * @param hired The date the person was hired.
+     * @param wage The person's wage.
+     */
+    public JPAAppPartTimeEmployee(long personid, String first, String last,
+                            String middle, Date born, JPAAppAddress addr, 
+                            Date hired, double wage ) {
+        super(personid, first, last, middle, born, addr, hired);
+        this.wage = wage;
+    }
+
+    /**
+     * Get the wage of the part-time employee.
+     * @return The wage of the part-time employee.
+     */
+    public double getWage() {
+        return wage;
+    }
+
+    /**
+     * Set the wage of the part-time employee.
+     * @param wage The wage of the part-time employee.
+     */
+    public void setWage(double wage) {
+        this.wage = wage;
+    }
+
+    /**
+     * Returns a String representation of a <code>JPAAppPartTimeEmployee</code> object.
+     * 
+     * 
+     * @return a String representation of a <code>JPAAppPartTimeEmployee</code> object.
+     */
+    public String toString() {
+        return "JPAPartTimeEmployee(" + 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(", $" + wage);
+        return rc.toString();
+    }
+
+    /**
+     * 
+     * Returns <code>true</code> if all the fields of this instance are
+     * deep equal to the coresponding fields of the specified
+     * JPAAppPartTimeEmployee. 
+     * 
+     * 
+     * @param other the object with which to compare.
+     * @param helper EqualityHelper to keep track of instances that have
+     * already been processed.
+     * @return <code>true</code> if all the fields are deep equal;
+     * <code>false</code> otherwise.
+     * @throws ClassCastException if the specified instances' type prevents
+     * it from being compared to this instance.
+     */
+    public boolean deepCompareFields(Object other, 
+                                        EqualityHelper helper) {
+        JPAAppPartTimeEmployee otherEmp = (JPAAppPartTimeEmployee)other;
+        String where = "JPAPartTimeEmployee<" + getPersonid() + ">";
+        return super.deepCompareFields(otherEmp, helper) &
+            helper.closeEnough(wage, otherEmp.getWage(), where + ".wage");
+    }
+}

Propchange: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppPartTimeEmployee.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppPerson.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppPerson.java?rev=582405&view=auto
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppPerson.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppPerson.java Fri Oct  5 14:38:26 2007
@@ -0,0 +1,493 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+
+package org.apache.jdo.tck.pc.companyAnnotatedJPA;
+
+import javax.persistence.*;
+
+import java.io.Serializable;
+
+import java.text.SimpleDateFormat;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import org.apache.jdo.tck.pc.company.IAddress;
+
+import org.apache.jdo.tck.pc.company.IPerson;
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents a person.
+ */
+@Entity
+@Table(name="persons")
+@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
+@DiscriminatorColumn(discriminatorType=DiscriminatorType.STRING,
+        name="DISCRIMINATOR")
+public class JPAAppPerson 
+    implements IPerson, Serializable, Comparable, Comparator, DeepEquality  {
+
+    @Id
+    @Column(name="PERSONID")
+    private long    personid;
+    @Column(name="FIRSTNAME")
+    private String  firstname;
+    @Column(name="LASTNAME")
+    private String  lastname;
+    @Basic(optional=true, fetch=FetchType.LAZY)
+    @Column(name="MIDDLENAME")
+    private String  middlename;
+    @Column(name="BIRTHDATE")
+    @Temporal(TemporalType.DATE)
+    private Date    birthdate;
+    @Embedded
+        @AttributeOverrides({
+            @AttributeOverride(name="street",
+                column=@Column(name="STREET")),
+            @AttributeOverride(name="city",
+                column=@Column(name="CITY")),
+            @AttributeOverride(name="state",
+                   column=@Column(name="STATE")),
+            @AttributeOverride(name="zipcode",
+                   column=@Column(name="ZIPCODE")),
+            @AttributeOverride(name="country",
+                   column=@Column(name="COUNTRY"))
+        })
+    private JPAAppAddress address;
+
+    // maps phone number types ("home", "work", "mobile", etc.) 
+    // to phone numbers specified as String
+//    @OneToMany(mappedBy="JPAAppPhoneNumber")
+    @OneToMany
+    @MapKey(name="type")
+    private Map<String, JPAAppPhoneNumber> phoneNumbers = new HashMap();
+    
+    protected static SimpleDateFormat formatter =
+        new SimpleDateFormat("d/MMM/yyyy");
+
+    /** This is the JDO-required no-args constructor. */
+    protected JPAAppPerson() {}
+
+    /**
+     * Construct a <code>JPAAppPerson</code> instance.
+     * 
+     * 
+     * @param personid The person identifier.
+     * @param firstname The person's first name.
+     * @param lastname The person's last name.
+     * @param middlename The person's middle name.
+     * @param birthdate The person's birthdate.
+     */
+    public JPAAppPerson(long personid, String firstname, String lastname, 
+                  String middlename, Date birthdate) {
+        this.personid = personid;
+        this.firstname = firstname;
+        this.lastname = lastname;
+        this.middlename = middlename;
+        this.birthdate = birthdate;
+    }
+
+    /**
+     * Construct a <code>JPAAppPerson</code> instance.
+     * 
+     * 
+     * @param personid The person identifier.
+     * @param firstname The person's first name.
+     * @param lastname The person's last name.
+     * @param middlename The person's middle name.
+     * @param birthdate The person's birthdate.
+     * @param address The person's address.
+     */
+    public JPAAppPerson(long personid, String firstname, String lastname, 
+                  String middlename, Date birthdate, IAddress address) {
+        this(personid, firstname, lastname, middlename, birthdate);
+        this.address = (JPAAppAddress)address;
+    }
+
+    /**
+     * Set the id associated with this object.
+     * @param id the id.
+     */
+    public void setPersonid(long id) {
+        if (this.personid != 0)
+            throw new IllegalStateException("Id is already set.");
+        this.personid = id;
+    }
+
+    /**
+     * Get the person's id.
+     * @return The personid.
+     */
+    public long getPersonid() {
+        return personid;
+    }
+
+    /**
+     * Get the person's last name.
+     * @return The last name.
+     */
+    public String getLastname() {
+        return lastname;
+    }
+
+    /**
+     * Set the person's last name.
+     * @param lastname The last name.
+     */
+    public void setLastname(String lastname) {
+        this.lastname = lastname;
+    }
+
+    /**
+     * Get the person's first name.
+     * @return The first name.
+     */
+    public String getFirstname() {
+        return firstname;
+    }
+
+    /**
+     * Set the person's first name.
+     * @param firstname The first name.
+     */
+    public void setFirstname(String firstname) {
+        this.firstname = firstname;
+    }
+
+    /**
+     * Get the person's middle name.
+     * @return The middle name.
+     */
+    public String getMiddlename() {
+        return middlename;
+    }
+
+    /**
+     * Set the person's middle name.
+     * @param middlename The middle name.
+     */
+    public void setMiddlename(String middlename) {
+        this.middlename = middlename;
+    }
+
+    /**
+     * Get the address.
+     * @return The address.
+     */
+    public IAddress getAddress() {
+        return address;
+    }
+
+    /**
+     * Set the address.
+     * @param address The address.
+     */
+    public void setAddress(IAddress address) {
+        this.address = (JPAAppAddress)address;
+    }
+
+    /**
+     * Get the person's birthdate.
+     * @return The person's birthdate.
+     */
+    public Date getBirthdate() {
+        return birthdate;
+    }
+
+    /**
+     * Set the person's birthdate.
+     * @param birthdate The person's birthdate.
+     */
+    public void setBirthdate(Date birthdate) {
+        this. birthdate = birthdate;
+    }
+
+    /**
+     * Get the map of phone numbers as an unmodifiable map.
+     * @return A Map<String, String> of phone numbers.
+     */
+    public Map getPhoneNumbers() {
+        return (convertString2Phone(phoneNumbers));
+    }
+
+    /**
+     * Get the phone number for the specified phone number type. 
+     * @param type The phone number type ("home", "work", "mobile", etc.).
+     * @return The phone number associated with specified type, or
+     * <code>null</code> if there was no phone number for the type. 
+     */
+    public String getPhoneNumber(String type) {
+        JPAAppPhoneNumber pnum = phoneNumbers.get(type);
+        return pnum.getPhoneNumber();
+    }
+    
+    /**
+     * Associates the specified phone number with the specified type in the
+     * map of phone numbers of this person. 
+     * @param type The phone number type ("home", "work", "mobile", etc.).
+     * @param phoneNumber The phone number 
+     * @return The previous phone number associated with specified type, or
+     * <code>null</code> if there was no phone number for the type. 
+     */
+    public String putPhoneNumber(String type, String phoneNumber) {
+        JPAAppPhoneNumber pnum = phoneNumbers.get(type);
+        String pnumAsString = null;
+        if (pnum != null) {
+            pnumAsString = pnum.getPhoneNumber(); // old val
+        }
+        pnum = phoneNumbers.put(type,
+                new JPAAppPhoneNumber(this, type, phoneNumber));
+        return pnumAsString;
+    }
+
+    /**
+     * Remove a phoneNumber from the map of phone numbers.
+     * @param type The phone number type ("home", "work", "mobile", etc.).
+     * @return The previous phone number associated with specified type, or
+     * <code>null</code> if there was no phone number for the type. 
+     */
+    public String removePhoneNumber(String type) {
+        JPAAppPhoneNumber pnum = phoneNumbers.get(type);
+        if (pnum == null)
+            return null;
+        String pnumAsString = pnum.getPhoneNumber(); // old val
+        pnum = phoneNumbers.remove(type);
+        return pnumAsString;
+    }
+
+    /**
+     * Set the phoneNumber map to be in this person.
+     * @param phoneNumbers A Map<String, String> of phoneNumbers for this person.
+     */
+    public void setPhoneNumbers(Map phoneNumbers) {
+        this.phoneNumbers = (phoneNumbers != null) ? 
+                convertPhone2String(phoneNumbers) : null;
+    }
+    
+    protected HashMap convertPhone2String(Map pnums) {
+        HashMap retval = new HashMap();
+        for (Object objEntry: pnums.entrySet()) {
+            Map.Entry entry = (Map.Entry)objEntry;
+            String key = (String)entry.getKey();
+            String value = (String)entry.getValue();
+            JPAAppPhoneNumber newValue = 
+                    new JPAAppPhoneNumber(this, key, value);
+            retval.put(key, newValue);
+        }
+        return retval;
+    }
+    
+    protected HashMap convertString2Phone(Map pnums) {
+        HashMap retval = new HashMap();
+        for (Object objEntry: pnums.entrySet()) {
+            Map.Entry entry = (Map.Entry)objEntry;
+            String key = (String)entry.getKey();
+            JPAAppPhoneNumber value = (JPAAppPhoneNumber)entry.getValue();
+            String newValue = 
+                    value.getPhoneNumber();
+            retval.put(key, newValue);
+        }
+        return retval;
+    }
+
+    /**
+     * Returns a String representation of a <code>JPAAppPerson</code> object.
+     * 
+     * @return a string representation of a <code>JPAAppPerson</code> object.
+     */
+    public String toString() {
+        return "JPAPerson(" + 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(personid);
+        rc.append(", ").append(lastname);
+        rc.append(", ").append(firstname);
+        rc.append(", born ").append(formatter.format(birthdate));
+        rc.append(", phone ").append(phoneNumbers);
+        return rc.toString();
+    }
+
+    /**
+     * 
+     * Returns <code>true</code> if all the fields of this instance are
+     * deep equal to the coresponding fields of the specified JPAAppPerson.
+     * 
+     * 
+     * @param other the object with which to compare.
+     * @param helper EqualityHelper to keep track of instances that have
+     * already been processed.
+     * @return <code>true</code> if all the fields are deep equal;
+     * <code>false</code> otherwise.
+     * @throws ClassCastException if the specified instances' type prevents
+     * it from being compared to this instance.
+     */
+    public boolean deepCompareFields(Object other, 
+                                     EqualityHelper helper) {
+        JPAAppPerson otherPerson = (JPAAppPerson)other;
+        String where = "JPAPerson<" + personid + ">";
+        return 
+            helper.equals(personid, otherPerson.getPersonid(), where + ".personid") &
+            helper.equals(firstname, otherPerson.getFirstname(), where + ".firstname") &
+            helper.equals(lastname, otherPerson.getLastname(), where + ".lastname") &
+            helper.equals(middlename, otherPerson.getMiddlename(), where + ".middlename") &
+            helper.equals(birthdate, otherPerson.getBirthdate(), where + ".birthdate") &
+            helper.deepEquals(address, otherPerson.getAddress(), where + ".address") &
+            helper.deepEquals(phoneNumbers, otherPerson.getPhoneNumbers(), where + ".phoneNumbers");
+    }
+
+    /** 
+     * 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((JPAAppPerson)o);
+    }
+
+    /** 
+     * Compare two instances. This is a method in Comparator.
+     */
+    public int compare(Object o1, Object o2) {
+        return compare((JPAAppPerson)o1, (JPAAppPerson)o2);
+    }
+
+    /**
+     * 
+     * Compares this object with the specified JPAAppPerson 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 JPAAppPerson 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 JPAAppPerson
+     * object.
+     */
+    public int compareTo(JPAAppPerson other) {
+        return compare(this, other);
+    }
+
+    /**
+     * Compares its two IPerson 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 IPerson object to be compared. 
+     * @param o2 the second IPerson 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(JPAAppPerson o1, JPAAppPerson o2) {
+        return EqualityHelper.compare(o1.getPersonid(), o2.getPersonid());
+    }
+    
+    /** 
+     * Indicates whether some other object is "equal to" this one.
+     * @param obj the object with which to compare.
+     * @return <code>true</code> if this object is the same as the obj
+     * argument; <code>false</code> otherwise. 
+     */
+    public boolean equals(Object obj) {
+        if (obj instanceof JPAAppPerson) {
+            return compareTo((JPAAppPerson)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)personid;
+    }
+    /**
+     * This class is used to represent the application identifier
+     * for the <code>Person</code> class.
+     */
+    public static class Oid implements Serializable, Comparable {
+
+        /**
+         * This field represents the identifier for the <code>Person</code>
+         * class. It must match a field in the <code>Person</code> class in
+         * both name and type. 
+         */
+        public long personid;
+
+        /**
+         * The required public no-arg constructor.
+         */
+        public Oid() { }
+
+        /**
+         * Initialize the identifier.
+         * @param personid The person identifier.
+         */
+        public Oid(long personid) {
+            this.personid = personid;
+        }
+        
+        public Oid(String s) { personid = Long.parseLong(justTheId(s)); }
+
+        public String toString() { return this.getClass().getName() + ": "  + personid;}
+
+        /** */
+        public boolean equals(java.lang.Object obj) {
+            if( obj==null ||
+                !this.getClass().equals(obj.getClass()) ) return( false );
+            Oid o = (Oid) obj;
+            if( this.personid != o.personid ) return( false );
+            return( true );
+        }
+
+        /** */
+        public int hashCode() {
+            return( (int) personid );
+        }
+        
+        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( personid < other.personid ) return -1;
+            if( personid > other.personid ) return 1;
+            return 0;
+        }
+
+    }
+
+}

Propchange: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppPerson.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppPhoneNumber.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppPhoneNumber.java?rev=582405&view=auto
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppPhoneNumber.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppPhoneNumber.java Fri Oct  5 14:38:26 2007
@@ -0,0 +1,211 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+
+package org.apache.jdo.tck.pc.companyAnnotatedJPA;
+
+import javax.persistence.*;
+
+import java.io.Serializable;
+
+/**
+ * This class represents a person.
+ */
+@Entity
+@IdClass(org.apache.jdo.tck.pc.companyAnnotatedJPA.JPAAppPhoneNumber.Oid.class)
+@Table(name="employee_phoneno_type")
+@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
+@DiscriminatorColumn(discriminatorType=DiscriminatorType.STRING,
+        name="DISCRIMINATOR")
+public class JPAAppPhoneNumber implements Serializable {
+
+    @Id
+    @Column(name="PERSONID")
+    private long personid;
+    @Id
+    @Column(name="TYPE")
+    private String  type;
+    @Column(name="PHONENO")
+    private String  phoneNumber;
+    @ManyToOne
+    @JoinColumn(name="PERSONID", insertable=false, updatable=false)
+    private JPAAppPerson person;
+    
+    /** This is the JDO-required no-args constructor. */
+    protected JPAAppPhoneNumber() {}
+
+    /**
+     * Construct a <code>JPAAppPhoneNumber</code> instance.
+     * 
+     * @param phonenumid The phone number identifier.
+     * @param personid The person id
+     * @param type The type of the phone for this number
+     * @param phoneNumber The phone number
+     */
+    public JPAAppPhoneNumber(JPAAppPerson person, String type, String phoneNumber) {
+        this.personid = person.getPersonid();
+        this.person = person;
+        this.type = type;
+        this.phoneNumber = phoneNumber;
+    }
+
+    /**
+     * Set the id associated with this object.
+     * @param id the id.
+     */
+    public void setPersonid(long id) {
+        if (this.personid != 0)
+            throw new IllegalStateException("Id is already set.");
+        this.personid = id;
+    }
+
+    /**
+     * Get the person's id.
+     * @return The personid.
+     */
+    public long getPersonid() {
+        return personid;
+    }
+
+    /**
+     * Get the person's last name.
+     * @return The last name.
+     */
+
+    public String getType() {
+        return type;
+    }
+
+    /**
+     * Set the phone number type
+     * @param type The phone number type
+     */
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    /**
+     * Get the phone number.
+     * @return The phone number.
+     */
+    public String getPhoneNumber() {
+        return phoneNumber;
+    }
+
+    /**
+     * Set the phone number.
+     * @param phone number The phone number.
+     */
+    public void setPhoneNumber(String phoneNumber) {
+        this.phoneNumber = phoneNumber;
+    }
+
+    /**
+     * Returns a String representation of a <code>JPAAppPhoneNumber</code> object.
+     * 
+     * @return a string representation of a <code>JPAAppPhoneNumber</code> object.
+     */
+    public String toString() {
+        return "JPAAppPhoneNumber(" + 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(personid);
+        rc.append(", ").append(type);
+        rc.append(", phone ").append(phoneNumber);
+        return rc.toString();
+    }
+
+    /**
+     * This class is used to represent the application identifier
+     * for the <code>Person</code> class.
+     */
+    public static class Oid implements Serializable, Comparable {
+
+        /**
+         * This field represents the identifier for the <code>Person</code>
+         * class. It must match a field in the <code>Person</code> class in
+         * both name and type. 
+         */
+        public long personid;
+
+        public String type;
+
+        /**
+         * The required public no-arg constructor.
+         */
+        public Oid() { }
+
+        /**
+         * Initialize the identifier.
+         * @param personid The person identifier.
+         */
+        public Oid(long personid, String type) {
+            this.personid = personid;
+            this.type = type;
+        }
+        
+        public Oid(String s) {
+            personid = Long.parseLong(justTheId(s));
+            type = justTheType(s);
+        }
+
+        public String toString() {
+            return this.getClass().getName() + ": "  + personid + " + " + type;
+        }
+
+        /** */
+        public boolean equals(java.lang.Object obj) {
+            if( obj==null ||
+                !this.getClass().equals(obj.getClass()) ) return( false );
+            Oid o = (Oid) obj;
+            if( this.personid != o.personid ) return( false );
+            if( this.type != o.type ) return( false );
+            return( true );
+        }
+
+        /** */
+        public int hashCode() {
+            return( (int) personid + type.hashCode() );
+        }
+        
+        protected static String justTheId(String str) {
+            return str.substring(str.indexOf(':') + 1, str.indexOf('+') - 1);
+        }
+        
+        protected static String justTheType(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( personid < other.personid ) return -1;
+            if( personid > other.personid ) return 1;
+
+            return type.compareTo(other.type);
+        }
+
+    }
+
+}

Propchange: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppPhoneNumber.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppProject.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppProject.java?rev=582405&view=auto
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppProject.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppProject.java Fri Oct  5 14:38:26 2007
@@ -0,0 +1,389 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.companyAnnotatedJPA;
+
+import javax.persistence.*;
+
+import java.io.Serializable;
+import java.io.ObjectInputStream;
+import java.io.IOException;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Set;
+import java.util.HashSet;
+import java.math.BigDecimal;
+
+import org.apache.jdo.tck.pc.company.IProject;
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents a project, a budgeted task with one or more
+ * employees working on it.
+ */
+
+@Entity
+@Table(name="projects")
+@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
+@DiscriminatorColumn(discriminatorType=DiscriminatorType.STRING,
+        name="DISCRIMINATOR")
+    public class JPAAppProject 
+    implements IProject, Serializable, Comparable, Comparator, DeepEquality  {
+
+    @Id
+    @Column(name="PROJID")
+    private long projid;
+    @Column(name="NAME")
+    private String     name;
+    @Column(name="BUDGET", length=11, scale=2)
+    private BigDecimal budget;
+    @Column(name="REVIEWER")
+    @ManyToMany(targetEntity=org.apache.jdo.tck.pc.companyAnnotatedJPA.JPAAppEmployee.class)
+    @JoinTable(name="project_reviewer")
+    //@JoinColumn(name="PROJID")
+    private Set reviewers = new HashSet();
+    @Column(name="MEMBER_JPA")
+    @ManyToMany(targetEntity=org.apache.jdo.tck.pc.companyAnnotatedJPA.JPAAppEmployee.class)
+    @JoinTable(name="project_member")
+    //@JoinColumn(name="PROJID")
+    private Set members = new HashSet();
+    
+    /** This is the JDO-required no-args constructor. The TCK relies on
+     * this constructor for testing PersistenceManager.newInstance(PCClass).
+     */
+    public JPAAppProject() {}
+
+    /**
+     * Initialize a project.
+     * @param projid The project identifier.
+     * @param name The name of the project.
+     * @param budget The budget for the project.
+     */
+    public JPAAppProject(long projid, String name, BigDecimal budget) {
+        this.projid = projid;
+        this.name = name;
+        this.budget = budget;
+    }
+
+    /**
+     * Set the id associated with this object.
+     * @param id the id.
+     */
+    public void setProjid(long id) {
+        if (this.projid != 0)
+            throw new IllegalStateException("Id is already set.");
+        this.projid = id;
+    }
+
+    /**
+     * Get the project ID.
+     * @return The project ID.
+     */
+    public long getProjid() {
+        return projid;
+    }
+
+    /**
+     * Get the name of the project.
+     * @return The name of the project.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Set the name of the project.
+     * @param name The name of the project.
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Get the project's budget.
+     * @return The project's budget.
+     */
+    public BigDecimal getBudget() {
+        return budget;
+    }
+
+    /**
+     * Set the project's budget.
+     * @param budget The project's budget.
+     */
+    public void setBudget(BigDecimal budget) {
+        this.budget = budget;
+    }
+
+    /**
+     * Get the reviewers associated with this project.
+     */
+    public Set getReviewers() {
+        return Collections.unmodifiableSet(reviewers);
+    }
+
+    /**
+     * Add a reviewer to the project.
+     * @param emp The employee to add as a reviewer.
+     */
+    public void addReviewer(JPAAppEmployee emp) {
+        reviewers.add(emp);
+    }
+
+    /**
+     * Remove a reviewer from the project.
+     * @param emp The employee to remove as a reviewer of this project.
+     */
+    public void removeReviewer(JPAAppEmployee emp) {
+        reviewers.remove(emp);
+    }
+
+    /**
+     * Set the reviewers associated with this project.
+     * @param reviewers The set of reviewers to associate with this project.
+     */
+    public void setReviewers(Set reviewers) {
+        // workaround: create a new HashSet, because fostore does not
+        // support LinkedHashSet
+        this.reviewers = (reviewers != null) ? new HashSet(reviewers) : null;
+    }
+
+    /**
+     * Get the project members.
+     * 
+     * 
+     * @return The members of the project is returned as an unmodifiable
+     * set of <code>JPAAppEmployee</code>s.
+     */
+    public Set getMembers() {
+        return Collections.unmodifiableSet(members);
+    }
+
+    /**
+     * Add a new member to the project.
+     * @param emp The employee to add to the project.
+     */
+    public void addMember(JPAAppEmployee emp) {
+        members.add(emp);
+    }
+
+    /**
+     * Remove a member from the project.
+     * @param emp The employee to remove from the project.
+     */
+    public void removeMember(JPAAppEmployee emp) {
+        members.remove(emp);
+    }
+
+    /**
+     * Set the members of the project.
+     * @param employees The set of employees to be the members of this
+     * project. 
+     */
+    public void setMembers(Set employees) {
+        // workaround: create a new HashSet, because fostore does not
+        // support LinkedHashSet
+        this.members = (employees != null) ? new HashSet(employees) : null;
+    }
+
+    /** Serialization support: initialize transient fields. */
+    private void readObject(ObjectInputStream in)
+        throws IOException, ClassNotFoundException {
+        in.defaultReadObject();
+        reviewers = new HashSet();
+        members = new HashSet();
+    }
+
+    /**
+     * Returns a String representation of a <code>JPAAppProject</code> object.
+     * 
+     * 
+     * @return a String representation of a <code>JPAAppProject</code> object.
+     */
+    public String toString() {
+        return "JPAProject(" + 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(projid);
+        rc.append(", name ").append(name);
+        rc.append(", budget ").append(budget);
+        return rc.toString();
+    }
+
+    /** 
+     * Returns <code>true</code> 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 <code>true</code> if all the fields are deep equal;
+     * <code>false</code> otherwise.  
+     * @throws ClassCastException if the specified instances' type prevents
+     * it from being compared to this instance. 
+     */
+    public boolean deepCompareFields(Object other, 
+                                     EqualityHelper helper) {
+        JPAAppProject otherProject = (JPAAppProject)other;
+        String where = "JPAProject<" + projid + ">";
+        return 
+            helper.equals(projid, otherProject.getProjid(), where + ".projid") &
+            helper.equals(name, otherProject.getName(), where + ".name") &
+            helper.equals(budget, otherProject.getBudget(), where + ".budget") &
+            helper.deepEquals(reviewers, otherProject.getReviewers(), where + ".reviewers") &
+            helper.deepEquals(members, otherProject.getMembers(), where + ".members");
+    }
+    
+    /** 
+     * 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((JPAAppProject)o);
+    }
+
+    /** 
+     * Compare two instances. This is a method in Comparator.
+     */
+    public int compare(Object o1, Object o2) {
+        return compare((JPAAppProject)o1, (JPAAppProject)o2);
+    }
+
+    /**
+     * 
+     * Compares this object with the specified JPAAppProject 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 JPAAppProject 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 JPAAppProject object.
+     */
+    public int compareTo(JPAAppProject other) {
+        return compare(this, other);
+    }
+
+    /**
+     * Compares its two IProject 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 IProject object to be compared. 
+     * @param o2 the second IProject 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(JPAAppProject o1, JPAAppProject o2) {
+        return EqualityHelper.compare(o1.getProjid(), o2.getProjid());
+    }
+
+    /** 
+     * Indicates whether some other object is "equal to" this one.
+     * @param obj the object with which to compare.
+     * @return <code>true</code> if this object is the same as the obj
+     * argument; <code>false</code> otherwise. 
+     */
+    public boolean equals(Object obj) {
+        if (obj instanceof JPAAppProject) {
+            return compareTo((JPAAppProject)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)projid;
+    }
+
+    /**
+     * This class is used to represent the application identity
+     * for the <code>JPAAppProject</code> class.
+     */
+    public static class Oid implements Serializable, Comparable {
+
+        /**
+         * This field represents the identifier for the
+         * <code>JPAAppProject</code> class. It must match a field in the
+         * <code>JPAAppProject</code> class in both name and type.
+         */
+        public long projid;
+
+        /**
+         * The required public no-arg constructor.
+         */
+        public Oid() { }
+
+        /**
+         * Initialize the application identifier with a project ID.
+         * @param projid The id of the project.
+         */
+        public Oid(long projid) {
+            this.projid = projid;
+        }
+        
+        public Oid(String s) { projid = Long.parseLong(justTheId(s)); }
+
+        public String toString() { return this.getClass().getName() + ": "  + projid;}
+
+        /** */
+        public boolean equals(java.lang.Object obj) {
+            if( obj==null || !this.getClass().equals(obj.getClass()) )
+                return( false );
+            Oid o = (Oid) obj;
+            if( this.projid != o.projid ) return( false );
+            return( true );
+        }
+
+        /** */
+        public int hashCode() {
+            return( (int) projid );
+        }
+        
+        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( projid < other.projid ) return -1;
+            if( projid > other.projid ) return 1;
+            return 0;
+        }
+
+    }
+
+}
+

Propchange: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedJPA/JPAAppProject.java
------------------------------------------------------------------------------
    svn:eol-style = LF



Mime
View raw message