db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcai...@apache.org
Subject svn commit: r565841 [3/4] - in /db/jdo/trunk/tck2: ./ src/conf/ src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/
Date Tue, 14 Aug 2007 17:16:10 GMT
Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCAppProject.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCAppProject.java?view=auto&rev=565841
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCAppProject.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCAppProject.java Tue Aug 14 10:16:06 2007
@@ -0,0 +1,396 @@
+/*
+ * 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.companyAnnotatedPC;
+
+import javax.jdo.annotations.*;
+
+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.
+ */
+@PersistenceCapable(identityType=IdentityType.APPLICATION, table="projects")
+@Inheritance(strategy=InheritanceStrategy.NEW_TABLE)
+@Discriminator(strategy=DiscriminatorStrategy.CLASS_NAME,
+        column="DISCRIMINATOR")
+public class PCAppProject 
+    implements IProject, Serializable, Comparable, Comparator, DeepEquality  {
+
+    @NotPersistent()
+    private long _projid;
+    @NotPersistent()
+    private String     _name;
+    @NotPersistent()
+    private BigDecimal _budget;
+    @NotPersistent()
+    private transient Set _reviewers = new HashSet();
+    @NotPersistent()
+    private transient Set _members = new HashSet();
+    
+    /** This is the JDO-required no-args constructor. The TCK relies on
+     * this constructor for testing PersistenceManager.newInstance(PCClass).
+     */
+    public PCAppProject() {}
+
+    /**
+     * Initialize a project.
+     * @param projid The project identifier.
+     * @param name The name of the project.
+     * @param budget The budget for the project.
+     */
+    public PCAppProject(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.
+     */
+
+    @PrimaryKey
+    @Column(name="PROJID")
+    public long getProjid() {
+        return _projid;
+    }
+
+    /**
+     * Get the name of the project.
+     * @return The name of the project.
+     */
+
+    @Column(name="NAME")
+    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.
+     */
+
+    @Column(name="BUDGET", jdbcType="DECIMAL", length=11, scale=2)
+    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.
+     */
+
+    @Persistent(table="project_reviewer")
+    @Element(types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCAppEmployee.class,
+            column="REVIEWER")
+    @Join(column="PROJID", foreignKey="PR_PROJ_FK")
+    public Set getReviewers() {
+        return _reviewers;
+    }
+
+    /**
+     * Add a reviewer to the project.
+     * @param emp The employee to add as a reviewer.
+     */
+    public void addReviewer(PCAppEmployee 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(PCAppEmployee 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.
+     */
+
+    @Persistent(table="project_member")
+    @Element(types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCAppEmployee.class,
+            column="MEMBER", foreignKey="PR_MEMB_FK")
+    @Join(column="PROJID", foreignKey="PR_PROJ_FK")
+    public Set getMembers() {
+        return _members;
+    }
+
+    /**
+     * Add a new member to the project.
+     * @param emp The employee to add to the project.
+     */
+    public void addMember(PCAppEmployee emp) {
+        _members.add(emp);
+    }
+
+    /**
+     * Remove a member from the project.
+     * @param emp The employee to remove from the project.
+     */
+    public void removeMember(PCAppEmployee 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 = (_members != 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>PCAppProject</code> object.
+     * 
+     * 
+     * @return a String representation of a <code>PCAppProject</code> object.
+     */
+    public String toString() {
+        return "FCProject(" + 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) {
+        PCAppProject otherProject = (PCAppProject)other;
+        String where = "FCProject<" + _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((PCAppProject)o);
+    }
+
+    /** 
+     * Compare two instances. This is a method in Comparator.
+     */
+    public int compare(Object o1, Object o2) {
+        return compare((PCAppProject)o1, (PCAppProject)o2);
+    }
+
+    /**
+     * 
+     * Compares this object with the specified PCAppProject 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 PCAppProject 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 F\PFCAppProject object.
+     */
+    public int compareTo(PCAppProject 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(PCAppProject o1, PCAppProject 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 PCAppProject) {
+            return compareTo((PCAppProject)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>PCAppProject</code> class.
+     */
+    public static class Oid implements Serializable, Comparable {
+
+        /**
+         * This field represents the identifier for the
+         * <code>PCAppProject</code> class. It must match a field in the
+         * <code>PCAppProject</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/companyAnnotatedPC/PCAppProject.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSAddress.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSAddress.java?view=auto&rev=565841
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSAddress.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSAddress.java Tue Aug 14 10:16:06 2007
@@ -0,0 +1,347 @@
+/*
+ * 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.companyAnnotatedPC;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+import javax.jdo.annotations.*;
+import org.apache.jdo.tck.pc.company.IAddress;
+
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents a postal address.
+ */
+@PersistenceCapable(embeddedOnly="true", requiresExtent="false")
+public class PCDSAddress 
+    implements IAddress, Serializable, Comparable, Comparator, DeepEquality {
+
+    private long    addrid;
+    private String  street;
+    private String  city;
+    private String  state;
+    private String  zipcode;
+    private String  country;
+
+    /** This is the JDO-required no-args constructor. The TCK relies on
+     * this constructor for testing PersistenceManager.newInstance(PCClass).
+     */
+    public PCDSAddress() {}
+
+    /**
+     * This constructor initializes the <code>PCDSAddress</code> components.
+     * 
+     * 
+     * @param addrid The address ID.
+     * @param street The street address.
+     * @param city The city.
+     * @param state The state.
+     * @param zipcode The zip code.
+     * @param country The zip country.
+     */
+    public PCDSAddress(long addrid, String street, String city, 
+                   String state, String zipcode, String country)
+    {
+        this.addrid = addrid;
+        this.street = street;
+        this.city = city;
+        this.state = state;
+        this.zipcode = zipcode;
+        this.country = country;
+    }
+
+    /**
+     * Get the addrid associated with this object.
+     * @return the addrid.
+     */
+    public long getAddrid() {
+        return addrid;
+    }
+
+    /**
+     * Set the id associated with this object.
+     * @param id the id.
+     */
+    public void setAddrid(long id) {
+        if (this.addrid != 0)
+            throw new IllegalStateException("Id is already set.");
+        this.addrid = id;
+    }
+
+    /** 
+     * Get the street component of the address.
+     * @return The street component of the address.
+     */
+    public String getStreet() {
+        return street;
+    }
+
+    /**
+     * Set the street component of the address.
+     * @param street The street component.
+     */
+    public void setStreet(String street) {
+        this.street = street;
+    }
+
+    /**
+     * Get the city.
+     * @return The city component of the address.
+     */
+    public String getCity() {
+        return city;
+    }
+
+    /**
+     * Set the city component of the address.
+     * @param city The city.
+     */
+    public void setCity(String city) {
+        this.city = city;
+    }
+    
+    /**
+     * Get the state component of the address.
+     * @return The state.
+     */
+    public String getState() {
+        return state;
+    }
+
+    /**
+     * Set the state component of the address.
+     * @param state The state.
+     */
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    /**
+     * Get the zipcode component of the address.
+     * @return The zipcode.
+     */
+    public String getZipcode() {
+        return zipcode;
+    }
+
+    /**
+     * Set the zip code component of the address.
+     * @param zipcode The zipcode.
+     */
+    public void setZipcode(String zipcode) {
+        this.zipcode = zipcode;
+    }
+
+    /**
+     * Get the country component of the address.
+     * @return The country.
+     */
+    public String getCountry() {
+        return country;
+    }
+
+    /**
+     * Set the country component of the address.
+     * @param country The country.
+     */
+    public void setCountry(String country) {
+        this.country = country;
+    }
+
+    /**
+     * Returns a String representation of a <code>Address</code> object.
+     * @return a String representation of a <code>Address</code> object.
+     */
+    public String toString() {
+        return "Address(" + 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(addrid);
+        rc.append(", street ").append(street);
+        rc.append(", city ").append(city);
+        rc.append(", state ").append(state);
+        rc.append(", zipcode ").append(zipcode);
+        rc.append(", country ").append(country);
+        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) {
+        PCDSAddress otherAddress = (PCDSAddress)other;
+        String where = "Address<" + addrid + ">";
+        return
+            helper.equals(addrid, otherAddress.getAddrid(), where + ".addrid") &
+            helper.equals(street, otherAddress.getStreet(), where + ".street") &
+            helper.equals(city, otherAddress.getCity(), where + ".city") &
+            helper.equals(state, otherAddress.getState(), where + ".state") &
+            helper.equals(zipcode, otherAddress.getZipcode(), where + ".zipcode") &
+            helper.equals(country, otherAddress.getCountry(), where + ".country");
+    }
+    
+    /** 
+     * 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((PCDSAddress)o);
+    }
+
+    /** 
+     * Compare two instances. This is a method in Comparator.
+     */
+    public int compare(Object o1, Object o2) {
+        return compare((PCDSAddress)o1, (PCDSAddress)o2);
+    }
+
+    /** 
+     * Compares this object with the specified Address 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 Address 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 Address
+     * object. 
+     */
+    public int compareTo(PCDSAddress other) {
+        return compare(this, other);
+    }
+    
+    /**
+     * Compares its two PCDSAddress 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 PCDSAddress object to be compared.
+     * @param o2 the second PCDSAddressobject 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(PCDSAddress o1, PCDSAddress o2) {
+        return EqualityHelper.compare(o1.getAddrid(), o2.getAddrid());
+    }
+
+    /** 
+     * 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 PCDSAddress) {
+            return compareTo((PCDSAddress)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)addrid;
+    }
+    
+    /**
+     * This class is used to represent the application identifier 
+     * for the <code>Address</code> class.
+     */
+    public static class Oid implements Serializable, Comparable {
+
+        /**
+         * This is the identifier field for <code>Address</code> and must
+         * correspond in type and name to the field in
+         * <code>Address</code>. 
+         */
+        public long addrid;
+        
+        /** The required public, no-arg constructor. */
+        public Oid()
+        {
+            addrid = 0;
+        }
+
+        /**
+         * A constructor to initialize the identifier field.
+         * @param addrid the id of the Address.
+         */
+        public Oid(long addrid) {
+            this.addrid = addrid;
+        }
+        
+        public Oid(String s) { addrid = Long.parseLong(justTheId(s)); }
+
+        public String toString() { return this.getClass().getName() + ": "  + addrid;}
+
+
+        /** */
+        public boolean equals(java.lang.Object obj) {
+            if( obj==null || !this.getClass().equals(obj.getClass()) )
+                return( false );
+            Oid o = (Oid) obj;
+            if( this.addrid != o.addrid ) return( false );
+            return( true );
+        }
+
+        /** */
+        public int hashCode() {
+            return( (int) addrid );
+        }
+        
+        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( addrid < other.addrid ) return -1;
+            if( addrid > other.addrid ) return 1;
+            return 0;
+        }
+
+    }
+
+}

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

Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSCompany.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSCompany.java?view=auto&rev=565841
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSCompany.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSCompany.java Tue Aug 14 10:16:06 2007
@@ -0,0 +1,409 @@
+/*
+ * 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.companyAnnotatedPC;
+
+import javax.jdo.annotations.*;
+
+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.pc.company.IAddress;
+import org.apache.jdo.tck.pc.company.ICompany;
+
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents information about a company.
+ */
+@PersistenceCapable(table="companies")
+@Inheritance(strategy=InheritanceStrategy.NEW_TABLE)
+@Discriminator(strategy=DiscriminatorStrategy.CLASS_NAME,
+        column="DISCRIMINATOR")
+@DatastoreIdentity(strategy=IdGeneratorStrategy.IDENTITY, 
+        column="DATASTORE_IDENTITY")
+public class PCDSCompany 
+    implements ICompany, Serializable, Comparable, Comparator, DeepEquality {
+
+    @NotPersistent()
+    private long        _companyid;
+    @NotPersistent()
+    private String      _name;
+    @NotPersistent()
+    private Date        _founded;
+    @NotPersistent()
+    private PCDSAddress     _address;
+    @NotPersistent()
+    private transient Set _departments = new HashSet();
+
+    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 PCDSCompany() {}
+
+    /**
+     * 
+     * Initialize the <code>PCDSCompany</code> instance.
+     * 
+     * 
+     * @param companyid The company id.
+     * @param name The company name.
+     * @param founded The date the company was founded.
+     */
+    public PCDSCompany(long companyid, String name, Date founded) {
+        this._companyid = companyid;
+        this._name = name;
+        this._founded = founded;
+    }
+
+    /** 
+     * Initialize the <code>Company</code> instance.
+     * @param companyid The company id.
+     * @param name The company name.
+     * @param founded The date the company was founded.
+     * @param addr The company's address.
+     */
+    public PCDSCompany(long companyid, String name, Date founded, IAddress addr) {
+        this(companyid, name, founded);
+        this._address = (PCDSAddress)addr;
+    }
+
+    /**
+     * Get the company id.
+     * @return The company id.
+     */
+
+    @Column(name="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.
+     */
+
+    @Column(name="NAME", jdbcType="VARCHAR")
+    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.
+     */
+
+    @Column(name="FOUNDEDDATE")
+    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 address of the company.
+     * @return The primary address of the company.
+     */
+
+    @Persistent(persistenceModifier=PersistenceModifier.PERSISTENT,
+            types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSAddress.class)
+    @Embedded(nullIndicatorColumn="COUNTRY",
+        members={
+            @Persistent(name="addrid", columns=@Column(name="ADDRID")),
+            @Persistent(name="street", columns=@Column(name="STREET")),
+            @Persistent(name="city", columns=@Column(name="CITY")),
+            @Persistent(name="state", columns=@Column(name="STATE")),
+            @Persistent(name="zipcode", columns=@Column(name="ZIPCODE")),
+            @Persistent(name="country", columns=@Column(name="COUNTRY"))
+    })
+    public IAddress getAddress() {
+        return _address;
+    }
+    
+    /**
+     * Set the primary address for the company.
+     * @param address The address to set for the company.
+     */
+    public void setAddress(IAddress address) {
+        this._address = (PCDSAddress)address;
+    }
+
+    /**
+     * Get the departments contained in the company.
+     * 
+     * 
+     * @return All the <code>PCDSDepartment</code>s of the company.
+     */
+
+    @Persistent(persistenceModifier=PersistenceModifier.PERSISTENT,
+            mappedBy="company")
+    @Element(types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSDepartment.class)
+    public Set getDepartments() {
+        return _departments;
+    }
+
+    /**
+     * Add a <code>PCDSDepartment</code> instance to the company.
+     * 
+     * 
+     * @param dept The <code>PCDSDepartment</code> instance to add.
+     */
+    public void addDepartment(PCDSDepartment dept) {
+        _departments.add(dept);
+    }
+
+    /**
+     * Remove a <code>PCDSDepartment</code> instance from the company.
+     * 
+     * 
+     * @param dept The <code>PCDSDepartment</code> instance to remove.
+     */
+    public void removeDepartment(PCDSDepartment dept) {
+        _departments.remove(dept);
+    }
+
+    /**
+     * Initialize the set of <code>PCDSDepartment</code>s in the company to the 
+     * parameter. 
+     * 
+     * 
+     * @param departments The set of <code>PCDSDepartment</code>s 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 <code>Company</code> object.
+     * @return a String representation of a <code>Company</code> 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 <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) {
+        PCDSCompany otherCompany = (PCDSCompany)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(_address, otherCompany.getAddress(), where + ".address") &
+            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((PCDSCompany)o);
+    }
+
+    /** 
+     * Compare two instances. This is a method in Comparator.
+     */
+    public int compare(Object o1, Object o2) {
+        return compare((PCDSCompany)o1, (PCDSCompany)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(PCDSCompany 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(PCDSCompany o1, PCDSCompany 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 <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 PCDSCompany) {
+            return compareTo((PCDSCompany)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 <code>Company</code> 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 <code>Company</code> 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;
+        }
+        
+    }
+
+}
+

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

Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSDentalInsurance.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSDentalInsurance.java?view=auto&rev=565841
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSDentalInsurance.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSDentalInsurance.java Tue Aug 14 10:16:06 2007
@@ -0,0 +1,132 @@
+/*
+ * 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.companyAnnotatedPC;
+
+import javax.jdo.annotations.*;
+
+import java.math.BigDecimal;
+import org.apache.jdo.tck.pc.company.IDentalInsurance;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents a dental insurance carrier selection for a
+ * particular <code>Employee</code>.
+ */
+@PersistenceCapable
+@DatastoreIdentity(strategy=IdGeneratorStrategy.IDENTITY, column="DATASTORE_IDENTITY")
+public class PCDSDentalInsurance extends PCDSInsurance
+        implements IDentalInsurance {
+
+    @NotPersistent()
+    private BigDecimal _lifetimeOrthoBenefit;
+
+    /** This is the JDO-required no-args constructor. The TCK relies on
+     * this constructor for testing PersistenceManager.newInstance(PCClass).
+     */
+    public PCDSDentalInsurance() {}
+
+    /**
+     * Construct a <code>DentalInsurance</code> instance.
+     * @param insid The insurance instance identifier.
+     * @param carrier The insurance carrier.
+     * @param lifetimeOrthoBenefit The lifetimeOrthoBenefit.
+     */
+    public PCDSDentalInsurance(long insid, String carrier, 
+                           BigDecimal lifetimeOrthoBenefit) {
+        super(insid, carrier);
+        this._lifetimeOrthoBenefit = lifetimeOrthoBenefit;
+    }
+
+    /**
+     * Construct a <code>PCDSDentalInsurance</code> instance.
+     * 
+     * 
+     * @param insid The insurance instance identifier.
+     * @param carrier The insurance carrier.
+     * @param employee The employee associated with this insurance.
+     * @param lifetimeOrthoBenefit The lifetimeOrthoBenefit.
+     */
+    public PCDSDentalInsurance(long insid, String carrier, PCDSEmployee employee,
+                           BigDecimal lifetimeOrthoBenefit) {
+        super(insid, carrier, employee);
+        this._lifetimeOrthoBenefit = lifetimeOrthoBenefit;
+    }
+
+    /**
+     * Get the insurance lifetimeOrthoBenefit.
+     * @return The insurance lifetimeOrthoBenefit.
+     */
+
+    @Column(name="LIFETIME_ORTHO_BENEFIT")
+    public BigDecimal getLifetimeOrthoBenefit() {
+        return _lifetimeOrthoBenefit;
+    }
+
+    /**
+     * Set the insurance lifetimeOrthoBenefit.
+     * @param lifetimeOrthoBenefit The insurance lifetimeOrthoBenefit.
+     */
+    public void setLifetimeOrthoBenefit(BigDecimal lifetimeOrthoBenefit) {
+        this._lifetimeOrthoBenefit = lifetimeOrthoBenefit;
+    }
+
+    /**
+     * Returns a String representation of a <code>PCDSDentalInsurance</code>
+     * object.
+     * 
+     * 
+     * @return a String representation of a <code>PCDSDentalInsurance</code>
+     * object.
+     */
+    public String toString() {
+        return "FCDentalInsurance(" + 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(", lifetimeOrthoBenefit ").append(_lifetimeOrthoBenefit);
+        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) {
+        PCDSDentalInsurance otherIns = (PCDSDentalInsurance)other;
+        String where = "FCDentalInsurance<" + getInsid() + ">";
+        return super.deepCompareFields(otherIns, helper) &
+            helper.equals(_lifetimeOrthoBenefit, 
+                          otherIns.getLifetimeOrthoBenefit(), where + ".lifetimeOrthoBenefit");
+    }
+
+}
+

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

Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSDepartment.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSDepartment.java?view=auto&rev=565841
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSDepartment.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSDepartment.java Tue Aug 14 10:16:06 2007
@@ -0,0 +1,445 @@
+/*
+ * 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.companyAnnotatedPC;
+
+import javax.jdo.annotations.*;
+
+import java.io.Serializable;
+import java.io.ObjectInputStream;
+import java.io.IOException;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Set;
+import org.apache.jdo.tck.pc.company.ICompany;
+import org.apache.jdo.tck.pc.company.IDepartment;
+import org.apache.jdo.tck.pc.company.IEmployee;
+
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents a department within a company.
+ */
+@PersistenceCapable(table="departments")
+@Inheritance(strategy=InheritanceStrategy.NEW_TABLE)
+@Discriminator(strategy=DiscriminatorStrategy.CLASS_NAME,
+        column="DISCRIMINATOR")
+@DatastoreIdentity(strategy=IdGeneratorStrategy.IDENTITY, 
+        column="DATASTORE_IDENTITY")
+public class PCDSDepartment
+    implements IDepartment, Serializable, Comparable, Comparator, DeepEquality {
+
+    public static final int RECOMMENDED_NO_OF_EMPS = 2;
+
+    @NotPersistent()
+    private long _deptid;
+    @NotPersistent()
+    private String  _name;
+    @NotPersistent()
+    private PCDSCompany _company;
+    @NotPersistent()
+    private PCDSEmployee _employeeOfTheMonth;
+    @NotPersistent()
+    private transient Set _employees = new HashSet();
+    @NotPersistent()
+    private transient Set _fundedEmps = new HashSet();
+
+    /** This is the JDO-required no-args constructor. The TCK relies on
+     * this constructor for testing PersistenceManager.newInstance(PCClass).
+     */
+    public PCDSDepartment() {}
+
+    /**
+     * Construct a <code>Department</code> instance.
+     * @param deptid The department id.
+     * @param name The name of the department.
+     */
+    public PCDSDepartment(long deptid, String name) {
+        this._deptid = deptid;
+        this._name = name;
+    }
+
+    /**
+     * Construct a <code>Department</code> instance.
+     * @param deptid The department id.
+     * @param name The name of the department.
+     * @param company The company that the department is associated with. 
+     */
+    public PCDSDepartment(long deptid, String name, ICompany company) {
+        this._deptid = deptid;
+        this._name = name;
+        this._company = (PCDSCompany)company;
+    }
+
+    /**
+     * Construct a <code>Department</code> instance.
+     * @param deptid The department id.
+     * @param name The name of the department.
+     * @param company The company that the department is associated with.
+     * @param employeeOfTheMonth The employee of the month the
+     * department is associated with.
+     */
+    public PCDSDepartment(long deptid, String name, ICompany company, 
+                      IEmployee employeeOfTheMonth) {
+        this._deptid = deptid;
+        this._name = name;
+        this._company = (PCDSCompany)company;
+        this._employeeOfTheMonth = (PCDSEmployee)employeeOfTheMonth;
+    }
+
+    /**
+     * 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.
+     */
+    @Column(name="ID")
+    public long getDeptid() {
+        return _deptid;
+    }
+
+    /**
+     * Get the name of the department.
+     * @return The name of the department.
+     */
+
+    @Column(name="NAME")
+    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.
+     */
+    @Persistent(types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSCompany.class)
+    @Column(name="COMPANYID")
+    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 = (PCDSCompany)company;
+    }
+
+    /**
+     * Get the employee of the month associated with the department.
+     * @return The employee of the month.
+     */
+
+    @Persistent(types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSEmployee.class)
+    @Column(name="EMP_OF_THE_MONTH")
+    public IEmployee getEmployeeOfTheMonth() {
+        return _employeeOfTheMonth;
+    }
+
+    /**
+     * Set the employee of the month for the department.
+     * @param employeeOfTheMonth The employee of the month to
+     * associate with the department. 
+     */
+    public void setEmployeeOfTheMonth(IEmployee employeeOfTheMonth) {
+        this._employeeOfTheMonth = (PCDSEmployee)employeeOfTheMonth;
+    }
+
+    /**
+     * Get the employees in the department.
+     * @return The set of employees in the department. 
+     */
+
+    @Persistent(mappedBy="department")
+    @Element(types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSEmployee.class)
+    public Set getEmployees() {
+        return _employees;
+    }
+
+    /**
+     * Add an employee to the department.
+     * @param emp The employee to add to the department.
+     */
+    public void addEmployee(PCDSEmployee emp) {
+        _employees.add(emp);
+    }
+
+    /**
+     * Remove an employee from the department.
+     * @param emp The employee to remove from the department.
+     */
+    public void removeEmployee(PCDSEmployee emp) {
+        _employees.remove(emp);
+    }
+
+    /**
+     * Set the employees to be in this department.
+     * @param employees The set of employees for this department.
+     */
+    public void setEmployees(Set employees) {
+        // workaround: create a new HashSet, because fostore does not
+        // support LinkedHashSet
+        this._employees = (employees != null) ? new HashSet(employees) : null;
+    }
+
+    /**
+     * Get the funded employees in the department.
+     * @return The set of funded employees in the department. 
+     */
+
+    @Element(types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSEmployee.class)
+    @Persistent(mappedBy="fundingDept")
+    public Set getFundedEmps() {
+        return _fundedEmps;
+    }
+
+    /**
+     * Add an employee to the collection of funded employees of this
+     * department. 
+     * @param emp The employee to add to the department.
+     */
+    public void addFundedEmp(PCDSEmployee emp) {
+        _fundedEmps.add(emp);
+    }
+
+    /**
+     * Remove an employee from collection of funded employees of this
+     * department. 
+     * @param emp The employee to remove from the department.
+     */
+    public void removeFundedEmp(PCDSEmployee emp) {
+        _fundedEmps.remove(emp);
+    }
+
+    /**
+     * Set the funded employees to be in this department.
+     * @param employees The set of funded employees for this department. 
+     */
+    public void setFundedEmps(Set employees) {
+        // workaround: create a new HashSet, because fostore does not
+        // support LinkedHashSet
+        this._fundedEmps = (_fundedEmps != null) ? new HashSet(employees) : null;
+    }
+
+    /** Serialization support: initialize transient fields. */
+    private void readObject(ObjectInputStream in)
+        throws IOException, ClassNotFoundException {
+        in.defaultReadObject();
+        _employees = new HashSet();
+        _fundedEmps = new HashSet();
+    }
+
+    /**
+     * 
+     * Returns <code>true</code> if all the fields of this instance are
+     * deep equal to the coresponding fields of the other PCDSDepartment.
+     * 
+     * 
+     * @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) {
+        PCDSDepartment otherDept = (PCDSDepartment)other;
+        String where = "FCDepartment<" + _deptid + ">";
+        return 
+            helper.equals(_deptid, otherDept.getDeptid(), where + ".deptid") & 
+            helper.equals(_name, otherDept.getName(), where + ".name") &
+            helper.deepEquals(_company, otherDept.getCompany(), where + ".company") &
+            helper.deepEquals(_employeeOfTheMonth, otherDept.getEmployeeOfTheMonth(), where + ".employeeOfTheMonth") &
+            helper.deepEquals(_employees, otherDept.getEmployees(), where + ".employees") &
+            helper.deepEquals(_fundedEmps, otherDept.getFundedEmps(), where + ".fundedEmps");
+    }
+    
+    /**
+     * Returns a String representation of a <code>PCDSDepartment</code> object.
+     * 
+     * 
+     * @return a String representation of a <code>PCDSDepartment</code> object.
+     */
+    public String toString() {
+        return "FCDepartment(" + 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((PCDSDepartment)o);
+    }
+
+    /** 
+     * Compare two instances. This is a method in Comparator.
+     */
+    public int compare(Object o1, Object o2) {
+        return compare((PCDSDepartment)o1, (PCDSDepartment)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(PCDSDepartment 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(PCDSDepartment o1, PCDSDepartment 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 <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 PCDSDepartment) {
+            return compareTo((PCDSDepartment)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
+     * <code>Department</code> class. 
+     */
+    public static class Oid implements Serializable, Comparable {
+
+        /**
+         * This field represents the application identifier field 
+         * for the <code>Department</code> class. 
+         * It must match in name and type with the field in the
+         * <code>Department</code> 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;
+        }
+
+    }
+
+}
+

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

Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSEmployee.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSEmployee.java?view=auto&rev=565841
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSEmployee.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSEmployee.java Tue Aug 14 10:16:06 2007
@@ -0,0 +1,550 @@
+/*
+ * 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.companyAnnotatedPC;
+
+import javax.jdo.annotations.*;
+
+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.pc.company.IDentalInsurance;
+import org.apache.jdo.tck.pc.company.IDepartment;
+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 an employee.
+ */
+@PersistenceCapable
+@Inheritance(strategy=InheritanceStrategy.SUPERCLASS_TABLE)
+@DatastoreIdentity(strategy=IdGeneratorStrategy.IDENTITY, column="DATASTORE_IDENTITY")
+public abstract class PCDSEmployee extends PCDSPerson implements IEmployee {
+
+    @NotPersistent()
+    private Date             _hiredate;
+    @NotPersistent()
+    private double           _weeklyhours;
+    @NotPersistent()
+    private PCDSDentalInsurance  _dentalInsurance;
+    @NotPersistent()
+    private PCDSMedicalInsurance _medicalInsurance;
+    @NotPersistent()
+    private PCDSDepartment       _department;
+    @NotPersistent()
+    private PCDSDepartment       _fundingDept;
+    @NotPersistent()
+    private PCDSEmployee         _manager;
+    @NotPersistent()
+    private PCDSEmployee         _mentor;
+    @NotPersistent()
+    private PCDSEmployee         _protege;
+    @NotPersistent()
+    private PCDSEmployee         _hradvisor;
+    @NotPersistent()
+    private transient Set _reviewedProjects = new HashSet();
+    @NotPersistent()
+    private transient Set _projects = new HashSet();
+    @NotPersistent()
+    private transient Set _team = new HashSet();
+    @NotPersistent()
+    private transient Set _hradvisees = new HashSet();
+
+
+    /** This is the JDO-required no-args constructor */
+    protected PCDSEmployee() {}
+
+    /**
+     * Construct an <code>PCDSEmployee</code> 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 PCDSEmployee(long personid, String firstname, String lastname, 
+                    String middlename, Date birthdate,
+                    Date hiredate) {
+        super(personid, firstname, lastname, middlename, birthdate);
+        this._hiredate = hiredate;
+    }
+
+    /**
+     * Construct an <code>PCDSEmployee</code> 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 address The address of the employee.
+     * @param hiredate The date that the employee was hired.
+     */
+    public PCDSEmployee(long personid, String firstname, String lastname, 
+                    String middlename, Date birthdate, PCDSAddress address,
+                    Date hiredate) {
+        super(personid, firstname, lastname, middlename, birthdate, address);
+        this._hiredate = hiredate;
+    }
+
+    /**
+     * Get the date that the employee was hired.
+     * @return The date the employee was hired.
+     */
+
+    @Column(name="HIREDATE")
+    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.
+     */
+
+    @Column(name="WEEKLYHOURS")
+    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 reviewed projects.
+     * @return The reviewed projects.
+     */
+
+    @Persistent(mappedBy="reviewers")
+    @Element(types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSProject.class)
+    public Set getReviewedProjects() {
+        return _reviewedProjects;
+    }
+
+    /**
+     * Add a reviewed project.
+     * @param project A reviewed project.
+     */
+    public void addReviewedProjects(PCDSProject project) {
+        _reviewedProjects.add(project);
+    }
+
+    /**
+     * Remove a reviewed project.
+     * @param project A reviewed project.
+     */
+    public void removeReviewedProject(PCDSProject project) {
+        _reviewedProjects.remove(project);
+    }
+
+    /**
+     * Set the reviewed projects for the employee.
+     * @param reviewedProjects The set of reviewed projects.
+     */
+    public void setReviewedProjects(Set reviewedProjects) {
+        // workaround: create a new HashSet, because fostore does not
+        // support LinkedHashSet
+        this._reviewedProjects = 
+            (reviewedProjects != null) ? new HashSet(reviewedProjects) : null;
+    }
+
+    /**
+     * Get the employee's projects.
+     * @return The employee's projects. 
+     */
+
+    @Persistent(mappedBy="members")
+    @Element(types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSProject.class)
+    public Set getProjects() {
+        return _projects;
+    }
+
+    /**
+     * Add a project for the employee.
+     * @param project The project.
+     */
+    public void addProject(PCDSProject project) {
+        _projects.add(project);
+    }
+
+    /**
+     * Remove a project from an employee's set of projects.
+     * @param project The project.
+     */
+    public void removeProject(PCDSProject project) {
+        _projects.remove(project);
+    }
+
+    /**
+     * Set the projects for the employee.
+     * @param projects The set of projects of the employee.
+     */
+    public void setProjects(Set projects) {
+        // workaround: create a new HashSet, because fostore does not
+        // support LinkedHashSet
+        this._projects = (projects != null) ? new HashSet(projects) : null;
+    }
+    
+    /**
+     * Get the dental insurance of the employee.
+     * @return The employee's dental insurance.
+     */
+
+    @Persistent(mappedBy="employee",
+        types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCAppDentalInsurance.class)
+    public IDentalInsurance getDentalInsurance() {
+        return _dentalInsurance;
+    }
+
+    /**
+     * Set the dental insurance object for the employee.
+     * @param dentalInsurance The dental insurance object to associate with
+     * the employee. 
+     */
+    public void setDentalInsurance(IDentalInsurance dentalInsurance) {
+        this._dentalInsurance = (PCDSDentalInsurance)dentalInsurance;
+    }
+    
+    /**
+     * Get the medical insurance of the employee.
+     * @return The employee's medical insurance.
+     */
+    @Persistent(mappedBy="employee",
+        types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSMedicalInsurance.class)
+        public IMedicalInsurance getMedicalInsurance() {
+        return _medicalInsurance;
+    }
+
+    /**
+     * Set the medical insurance object for the employee.
+     * @param medicalInsurance The medical insurance object to associate
+     * with the employee. 
+     */
+    public void setMedicalInsurance(IMedicalInsurance medicalInsurance) {
+        this._medicalInsurance = (PCDSMedicalInsurance)medicalInsurance;
+    }
+
+    /**
+     * Get the employee's department.
+     * @return The department associated with the employee.
+     */
+
+    @Persistent(types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSDepartment.class)
+    @Column(name="DEPARTMENT")
+    public IDepartment getDepartment() {
+        return _department;
+    }
+
+    /**
+     * Set the employee's department.
+     * @param department The department.
+     */
+    public void setDepartment(IDepartment department) {
+        this._department = (PCDSDepartment)department;
+    }
+
+    /**
+     * Get the employee's funding department.
+     * @return The funding department associated with the employee.
+     */
+
+    @Persistent(types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSDepartment.class)
+    @Column(name="FUNDINGDEPT")
+    public IDepartment getFundingDept() {
+        return _fundingDept;
+    }
+
+    /**
+     * Set the employee's funding department.
+     * @param department The funding department.
+     */
+    public void setFundingDept(IDepartment department) {
+        this._fundingDept = (PCDSDepartment)department;
+    }
+
+    /**
+     * Get the employee's manager.
+     * @return The employee's manager.
+     */
+
+    @Persistent(types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSEmployee.class)
+    @Column(name="MANAGER")
+    public IEmployee getManager() {
+        return _manager;
+    }
+
+    /**
+     * Set the employee's manager.
+     * @param manager The employee's manager.
+     */
+    public void setManager(IEmployee manager) {
+        this._manager = (PCDSEmployee)manager;
+    }
+
+    /**
+     * Get the employee's team.
+     * 
+     * 
+     * @return The set of <code>PCDSEmployee</code>s on this employee's team.
+     */
+
+    @Persistent(mappedBy="manager")
+    @Element(types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSEmployee.class)
+    public Set getTeam() {
+        return _team;
+    }
+
+    /**
+     * Add an <code>PCDSEmployee</code> 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 <code>PCDSEmployee</code> to add to the team.
+     */
+    public void addToTeam(PCDSEmployee emp) {
+        _team.add(emp);
+        emp._manager = this;
+    }
+
+    /**
+     * Remove an <code>PCDSEmployee</code> from this employee's team.
+     * This method will also set the <code>emp</code> manager to null.
+     * 
+     * 
+     * @param emp The <code>PCDSEmployee</code> to remove from the team.
+     */
+    public void removeFromTeam(PCDSEmployee emp) {
+        _team.remove(emp);
+        emp._manager = null;
+    }
+
+    /**
+     * Set the employee's team.
+     * 
+     * 
+     * @param team The set of <code>PCDSEmployee</code>s.
+     */
+    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 = (PCDSEmployee)mentor;
+    }
+
+    /**
+     * Get the mentor for this employee.
+     * @return The mentor.
+     */
+
+    @Persistent(types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSEmployee.class)
+    @Column(name="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 = (PCDSEmployee)protege;
+    }
+
+    /**
+     * Get the protege of this employee.
+     * @return The protege of this employee.
+     */
+
+    @Persistent(mappedBy="mentor",
+        types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSEmployee.class)
+    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 = (PCDSEmployee)hradvisor;
+    }
+
+    /**
+     * Get the HR advisor for the employee.
+     * @return The HR advisor.
+     */
+
+    @Persistent(types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSEmployee.class)
+    @Column(name="HRADVISOR")
+    public IEmployee getHradvisor() {
+        return _hradvisor;
+    }
+
+    /**
+     * Get the HR advisees of this HR advisor.
+     * 
+     * 
+     * @return The <code>PCDSEmployee</code>s that are HR advisees of this employee.
+     */
+
+    @Persistent(mappedBy="hradvisor")
+    @Element(types=org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSEmployee.class)
+    public Set getHradvisees() {
+        return _hradvisees;
+    }
+
+    /**
+     * Add an <code>PCDSEmployee</code> as an advisee of this HR advisor. 
+     * This method also sets the <code>emp</code> 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(PCDSEmployee emp) {
+        _hradvisees.add(emp);
+        emp._hradvisor = this;
+    }
+
+    /**
+     * Remove an <code>PCDSEmployee</code> as an advisee of this HR advisor.
+     * This method also sets the <code>emp</code> 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(PCDSEmployee emp) {
+        _hradvisees.remove(emp);
+        emp._hradvisor = null;
+    }
+
+    /**
+     * Set the HR advisees of this HR advisor.
+     * 
+     * 
+     * @param hradvisees The <code>PCDSEmployee</code>s 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();
+        _reviewedProjects = new HashSet();
+        _projects = new HashSet();
+        _team = new HashSet();
+        _hradvisees = new HashSet();
+    }
+
+    /**
+     * Return a String representation of a <code>PCDSEmployee</code> object.
+     * 
+     * 
+     * @return a String representation of a <code>PCDSEmployee</code> object.
+     */
+    public String toString() {
+        return "FCEmployee(" + 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 <code>true</code> if all the fields of this instance are
+     * deep equal to the corresponding fields of the specified PCDSEmployee.
+     * 
+     * 
+     * @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) {
+        PCDSEmployee otherEmp = (PCDSEmployee)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(_dentalInsurance, otherEmp.getDentalInsurance(), where + ".dentalInsurance") &
+            helper.deepEquals(_medicalInsurance, otherEmp.getMedicalInsurance(), where + ".medicalInsurance") &
+            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(_reviewedProjects, otherEmp.getReviewedProjects(), where + ".reviewedProjects") &
+            helper.deepEquals(_projects, otherEmp.getProjects(), where + ".projects") &
+            helper.deepEquals(_team, otherEmp.getTeam(), where + ".team") &
+            helper.deepEquals(_hradvisees, otherEmp.getHradvisees(), where + ".hradvisees");
+    }
+
+}
+

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

Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSFullTimeEmployee.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSFullTimeEmployee.java?view=auto&rev=565841
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSFullTimeEmployee.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPC/PCDSFullTimeEmployee.java Tue Aug 14 10:16:06 2007
@@ -0,0 +1,141 @@
+/*
+ * 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.companyAnnotatedPC;
+
+import javax.jdo.annotations.*;
+
+import java.util.Date;
+import org.apache.jdo.tck.pc.company.IAddress;
+import org.apache.jdo.tck.pc.company.IFullTimeEmployee;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents a full-time employee.
+ */
+@PersistenceCapable
+@Inheritance(strategy=InheritanceStrategy.SUPERCLASS_TABLE)
+@DatastoreIdentity(strategy=IdGeneratorStrategy.IDENTITY, column="DATASTORE_IDENTITY")
+public class PCDSFullTimeEmployee extends PCDSEmployee
+        implements IFullTimeEmployee {
+
+    @NotPersistent()
+    private double _salary;
+
+    /** This is the JDO-required no-args constructor. The TCK relies on
+     * this constructor for testing PersistenceManager.newInstance(PCClass).
+     */
+    public PCDSFullTimeEmployee() {}
+
+    /**
+     * 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 PCDSFullTimeEmployee(long personid, String first, String last,
+                            String middle, Date born,
+                            Date hired, double sal) {
+        super(personid, first, last, middle, born, hired);
+        _salary = sal;
+    }
+
+    /**
+     * 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 addr The person's address.
+     * @param hired The date that the person was hired.
+     * @param sal The salary of the full-time employee.
+     */
+    public PCDSFullTimeEmployee(long personid, String first, String last,
+                            String middle, Date born, IAddress addr, 
+                            Date hired, double sal) {
+        super(personid, first, last, middle, born, (PCDSAddress)addr, hired);
+        _salary = sal;
+    }
+
+    /**
+     * Get the salary of the full time employee.
+     * @return The salary of the full time employee.
+     */
+
+    @Column(name="SALARY")
+    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 <code>PCDSFullTimeEmployee</code> object.
+     * 
+     * 
+     * @return a String representation of a <code>PCDSFullTimeEmployee</code> object.
+     */
+    public String toString() {
+        return "FCFullTimeEmployee(" + 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 <code>true</code> if all the fields of this instance are
+     * deep equal to the coresponding fields of the specified
+     * PCDSFullTimeEmployee. 
+     * 
+     * 
+     * @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) {
+        PCDSFullTimeEmployee otherEmp = (PCDSFullTimeEmployee)other;
+        String where = "FCFullTimeEmployee<" + getPersonid() + ">";
+        return super.deepCompareFields(otherEmp, helper) &
+            helper.closeEnough(_salary, otherEmp.getSalary(), where + ".salary");
+    }
+    
+}

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



Mime
View raw message