You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by mc...@apache.org on 2007/07/19 22:52:33 UTC
svn commit: r557767 [1/4] - in
/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc: company/
companyAnnotatedApp/ companyAnnotatedDS/ companyAnnotatedFC/
companyAnnotatedPI/
Author: mcaisse
Date: Thu Jul 19 13:52:29 2007
New Revision: 557767
URL: http://svn.apache.org/viewvc?view=rev&rev=557767
Log: (empty)
Added:
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/CompanyFactoryAnnotatedPMFieldClass.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppAddress.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppCompany.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppDentalInsurance.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppDepartment.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppEmployee.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppFullTimeEmployee.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppInsurance.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppMedicalInsurance.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppPartTimeEmployee.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppPerson.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppProject.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSAddress.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSCompany.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSDentalInsurance.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSDepartment.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSEmployee.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSFullTimeEmployee.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSInsurance.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSMedicalInsurance.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSPartTimeEmployee.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSPerson.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSProject.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/CompanyFactoryAnnotatedPMInterface.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIAppAddress.java
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIAppCompany.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIAppDentalInsurance.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIAppDepartment.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIAppEmployee.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIAppFullTimeEmployee.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIAppInsurance.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIAppMedicalInsurance.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIAppPartTimeEmployee.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIAppPerson.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIAppProject.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIDSAddress.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIDSCompany.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIDSDentalInsurance.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIDSDepartment.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIDSEmployee.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIDSFullTimeEmployee.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIDSInsurance.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIDSMedicalInsurance.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIDSPartTimeEmployee.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIDSPerson.java (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedPI/PIDSProject.java (with props)
Removed:
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryAnnotatedPMFieldClass.java
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryAnnotatedPMInterface.java
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedApp/
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedDS/
Modified:
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryAbstractImpl.java
Modified: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryAbstractImpl.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryAbstractImpl.java?view=diff&rev=557767&r1=557766&r2=557767
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryAbstractImpl.java (original)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryAbstractImpl.java Thu Jul 19 13:52:29 2007
@@ -48,9 +48,9 @@
* String indicating the type of identity used for the current test case.
* The value is either "applicationidentity" or "datastoreidentity".
*/
- protected final String identitytype =
+ public final String identitytype =
System.getProperty("jdo.tck.identitytype");
- boolean isAppIdentity = "applicationidentity".equals(identitytype);
+ public boolean isAppIdentity = "applicationidentity".equals(identitytype);
abstract public IAddress newAddress();
abstract public ICompany newCompany();
Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/CompanyFactoryAnnotatedPMFieldClass.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/CompanyFactoryAnnotatedPMFieldClass.java?view=auto&rev=557767
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/CompanyFactoryAnnotatedPMFieldClass.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/CompanyFactoryAnnotatedPMFieldClass.java Thu Jul 19 13:52:29 2007
@@ -0,0 +1,127 @@
+/*
+ * 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.companyAnnotatedFC;
+
+import javax.jdo.PersistenceManager;
+import org.apache.jdo.tck.pc.company.*;
+
+/*
+ * CompanyFactoryAnnotatedPMFieldClass.java
+ *
+ * This class uses the PersistenceManager.newInstance method with the concrete
+ * class as a parameter.
+ */
+public class CompanyFactoryAnnotatedPMFieldClass
+ extends org.apache.jdo.tck.pc.company.CompanyFactoryAbstractImpl {
+
+ Class addressClass = null;
+ Class dentalInsuranceClass = null;
+ Class medicalInsuranceClass = null;
+ Class partTimeEmployeeClass = null;
+ Class fullTimeEmployeeClass = null;
+ Class projectClass = null;
+ Class departmentClass = null;
+ Class companyClass = null;
+
+ /**
+ * Creates a new instance of CompanyFactoryAnnotatedPMFieldClass
+ */
+ public CompanyFactoryAnnotatedPMFieldClass(PersistenceManager pm) {
+ super(pm);
+ if (isAppIdentity){
+ addressClass =
+ org.apache.jdo.tck.pc.companyAnnotatedFC.FCAppAddress.class;
+ dentalInsuranceClass =
+ org.apache.jdo.tck.pc.companyAnnotatedFC.FCAppDentalInsurance.class;
+ medicalInsuranceClass =
+ org.apache.jdo.tck.pc.companyAnnotatedFC.FCAppMedicalInsurance.class;
+ partTimeEmployeeClass =
+ org.apache.jdo.tck.pc.companyAnnotatedFC.FCAppPartTimeEmployee.class;
+ fullTimeEmployeeClass =
+ org.apache.jdo.tck.pc.companyAnnotatedFC.FCAppFullTimeEmployee.class;
+ projectClass =
+ org.apache.jdo.tck.pc.companyAnnotatedFC.FCAppProject.class;
+ departmentClass =
+ org.apache.jdo.tck.pc.companyAnnotatedFC.FCAppDepartment.class;
+ companyClass =
+ org.apache.jdo.tck.pc.companyAnnotatedFC.FCAppCompany.class;
+ } else { //datastoreidentity
+ addressClass =
+ org.apache.jdo.tck.pc.companyAnnotatedFC.FCDSAddress.class;
+ dentalInsuranceClass =
+ org.apache.jdo.tck.pc.companyAnnotatedFC.FCDSDentalInsurance.class;
+ medicalInsuranceClass =
+ org.apache.jdo.tck.pc.companyAnnotatedFC.FCDSMedicalInsurance.class;
+ partTimeEmployeeClass =
+ org.apache.jdo.tck.pc.companyAnnotatedFC.FCDSPartTimeEmployee.class;
+ fullTimeEmployeeClass =
+ org.apache.jdo.tck.pc.companyAnnotatedFC.FCDSFullTimeEmployee.class;
+ projectClass =
+ org.apache.jdo.tck.pc.companyAnnotatedFC.FCDSProject.class;
+ departmentClass =
+ org.apache.jdo.tck.pc.companyAnnotatedFC.FCDSDepartment.class;
+ companyClass =
+ org.apache.jdo.tck.pc.companyAnnotatedFC.FCDSCompany.class;
+ }
+
+ }
+
+ public Class[] getTearDownClasses() {
+ return new Class[] {
+ dentalInsuranceClass,
+ medicalInsuranceClass,
+ partTimeEmployeeClass,
+ fullTimeEmployeeClass,
+ projectClass,
+ departmentClass,
+ companyClass
+ };
+ }
+
+ public IAddress newAddress() {
+ return (IAddress)pm.newInstance(addressClass);
+ }
+
+ public ICompany newCompany() {
+ return (ICompany)pm.newInstance(companyClass);
+ }
+
+ public IDentalInsurance newDentalInsurance() {
+ return (IDentalInsurance)pm.newInstance(dentalInsuranceClass);
+ }
+
+ public IDepartment newDepartment() {
+ return (IDepartment)pm.newInstance(departmentClass);
+ }
+
+ public IFullTimeEmployee newFullTimeEmployee() {
+ return (IFullTimeEmployee)pm.newInstance(fullTimeEmployeeClass);
+ }
+
+ public IMedicalInsurance newMedicalInsurance() {
+ return (IMedicalInsurance)pm.newInstance(medicalInsuranceClass);
+ }
+
+ public IPartTimeEmployee newPartTimeEmployee() {
+ return (IPartTimeEmployee)pm.newInstance(partTimeEmployeeClass);
+ }
+
+ public IProject newProject() {
+ return (IProject)pm.newInstance(projectClass);
+ }
+}
Propchange: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/CompanyFactoryAnnotatedPMFieldClass.java
------------------------------------------------------------------------------
svn:eol-style = LF
Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppAddress.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppAddress.java?view=auto&rev=557767
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppAddress.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppAddress.java Thu Jul 19 13:52:29 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.companyAnnotatedFC;
+
+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 FCAppAddress
+ 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 FCAppAddress() {}
+
+ /**
+ * This constructor initializes the <code>FCAppAddress</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 FCAppAddress(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) {
+ FCAppAddress otherAddress = (FCAppAddress)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((FCAppAddress)o);
+ }
+
+ /**
+ * Compare two instances. This is a method in Comparator.
+ */
+ public int compare(Object o1, Object o2) {
+ return compare((FCAppAddress)o1, (FCAppAddress)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(FCAppAddress other) {
+ return compare(this, other);
+ }
+
+ /**
+ * Compares its two FCAppAddress 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 firstFCAppAddresss object to be compared.
+ * @param o2 the second FFCPIAddressobject 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(FCAppAddress o1, FCAppAddress 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 FCAppAddress) {
+ return compareTo((FCAppAddress)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/companyAnnotatedFC/FCAppAddress.java
------------------------------------------------------------------------------
svn:eol-style = LF
Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppCompany.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppCompany.java?view=auto&rev=557767
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppCompany.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppCompany.java Thu Jul 19 13:52:29 2007
@@ -0,0 +1,393 @@
+/*
+ * 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.companyAnnotatedFC;
+
+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(identityType=IdentityType.APPLICATION,table="companies")
+@Inheritance(strategy=InheritanceStrategy.NEW_TABLE)
+@Discriminator(strategy=DiscriminatorStrategy.CLASS_NAME,
+ column="DISCRIMINATOR")
+ public class FCAppCompany
+ implements ICompany, Serializable, Comparable, Comparator, DeepEquality {
+
+ @Field(primaryKey="true")
+ @Column(name="ID")
+ private long companyid;
+ @Column(name="NAME", jdbcType="VARCHAR")
+ private String name;
+ @Column(name="FOUNDEDDATE")
+ private Date founded;
+ @Field(persistenceModifier=FieldPersistenceModifier.PERSISTENT)
+ @Embedded(nullIndicatorColumn="COUNTRY",
+ fields={
+ @Field(name="addrid", columns=@Column(name="ADDRID")),
+ @Field(name="street", columns=@Column(name="STREET")),
+ @Field(name="city", columns=@Column(name="CITY")),
+ @Field(name="state", columns=@Column(name="STATE")),
+ @Field(name="zipcode", columns=@Column(name="ZIPCODE")),
+ @Field(name="country", columns=@Column(name="COUNTRY"))
+ })
+ private FCAppAddress address;
+ @Field(persistenceModifier=FieldPersistenceModifier.PERSISTENT,
+ mappedBy="company")
+ @Element(types=org.apache.jdo.tck.pc.companyAnnotatedFC.FCAppDepartment.class)
+ 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 FCAppCompany() {}
+
+ /**
+ *
+ * Initialize the <code>FCAppCompany</code> instance.
+ *
+ * @param companyid The company id.
+ * @param name The company name.
+ * @param founded The date the company was founded.
+ */
+ public FCAppCompany(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 FCAppCompany(long companyid, String name, Date founded, IAddress addr) {
+ this(companyid, name, founded);
+ this.address = (FCAppAddress)addr;
+ }
+
+ /**
+ * Get the company id.
+ * @return The company id.
+ */
+ public long getCompanyid() {
+ return companyid;
+ }
+
+ /**
+ * Set the id associated with this object.
+ * @param id the id.
+ */
+ public void setCompanyid(long id) {
+ if (this.companyid != 0)
+ throw new IllegalStateException("Id is already set.");
+ this.companyid = id;
+ }
+
+ /**
+ * Get the name of the company.
+ * @return The name of the company.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Set the name of the company.
+ * @param name The value to use for the name of the company.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get the date that the company was founded.
+ * @return The date the company was founded.
+ */
+ public Date getFounded() {
+ return founded;
+ }
+
+ /**
+ * Set the date that the company was founded.
+ * @param founded The date to set that the company was founded.
+ */
+ public void setFounded(Date founded) {
+ this.founded = founded;
+ }
+
+ /**
+ * Get the address of the company.
+ * @return The primary address of the company.
+ */
+ 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 = (FCAppAddress)address;
+ }
+
+ /**
+ * Get the departments contained in the company.
+ *
+ * @return An unmodifiable <code>Set</code> that contains all the
+ * <code>FCAppDepartment</code>s of the company.
+ */
+ public Set getDepartments() {
+ return Collections.unmodifiableSet(departments);
+ }
+
+ /**
+ * Add a <code>FCAppDepartment</code> instance to the company.
+ *
+ * @param dept The <code>FCAppDepartment</code> instance to add.
+ */
+ public void addDepartment(FCAppDepartment dept) {
+ departments.add(dept);
+ }
+
+ /**
+ * Remove a <code>FCAppDepartment</code> instance from the company.
+ *
+ * @param dept The <code>FCAppDepartment</code> instance to remove.
+ */
+ public void removeDepartment(FCAppDepartment dept) {
+ departments.remove(dept);
+ }
+
+ /**
+ * Initialize the set of <code>FCAppDepartment</code>s in the company to the
+ * parameter.
+ *
+ * @param departments The set of <code>FCAppDepartment</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) {
+ FCAppCompany otherCompany = (FCAppCompany)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((FCAppCompany)o);
+ }
+
+ /**
+ * Compare two instances. This is a method in Comparator.
+ */
+ public int compare(Object o1, Object o2) {
+ return compare((FCAppCompany)o1, (FCAppCompany)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(FCAppCompany 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(FCAppCompany o1, FCAppCompany 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 FCAppCompany) {
+ return compareTo((FCAppCompany)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/companyAnnotatedFC/FCAppCompany.java
------------------------------------------------------------------------------
svn:eol-style = LF
Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppDentalInsurance.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppDentalInsurance.java?view=auto&rev=557767
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppDentalInsurance.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppDentalInsurance.java Thu Jul 19 13:52:29 2007
@@ -0,0 +1,128 @@
+/*
+ * 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.companyAnnotatedFC;
+
+import javax.jdo.annotations.*;
+
+import java.math.BigDecimal;
+
+import org.apache.jdo.tck.pc.company.IDentalInsurance;
+import org.apache.jdo.tck.pc.company.IEmployee;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents a dental insurance carrier selection for a
+ * particular <code>Employee</code>.
+ */
+@PersistenceCapable(identityType=IdentityType.APPLICATION)
+public class FCAppDentalInsurance extends FCAppInsurance implements IDentalInsurance {
+
+ @Column(name="LIFETIME_ORTHO_BENEFIT")
+ private BigDecimal lifetimeOrthoBenefit;
+
+ /** This is the JDO-required no-args constructor. The TCK relies on
+ * this constructor for testing PersistenceManager.newInstance(PCClass).
+ */
+ public FCAppDentalInsurance() {}
+
+ /**
+ * Construct a <code>DentalInsurance</code> instance.
+ * @param insid The insurance instance identifier.
+ * @param carrier The insurance carrier.
+ * @param lifetimeOrthoBenefit The lifetimeOrthoBenefit.
+ */
+ public FCAppDentalInsurance(long insid, String carrier,
+ BigDecimal lifetimeOrthoBenefit) {
+ super(insid, carrier);
+ this.lifetimeOrthoBenefit = lifetimeOrthoBenefit;
+ }
+
+ /**
+ * Construct a <code>FCAppDentalInsurance</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 FCAppDentalInsurance(long insid, String carrier, IEmployee employee,
+ BigDecimal lifetimeOrthoBenefit) {
+ super(insid, carrier, employee);
+ this.lifetimeOrthoBenefit = lifetimeOrthoBenefit;
+ }
+
+ /**
+ * Get the insurance lifetimeOrthoBenefit.
+ * @return The insurance lifetimeOrthoBenefit.
+ */
+ 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>FCAppDentalInsurance</code>
+ * object.
+ *
+ * @return a String representation of a <code>FCAppDentalInsurance</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) {
+ FCAppDentalInsurance otherIns = (FCAppDentalInsurance)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/companyAnnotatedFC/FCAppDentalInsurance.java
------------------------------------------------------------------------------
svn:eol-style = LF
Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppDepartment.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppDepartment.java?view=auto&rev=557767
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppDepartment.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppDepartment.java Thu Jul 19 13:52:29 2007
@@ -0,0 +1,434 @@
+/*
+ * 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.companyAnnotatedFC;
+
+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(identityType=IdentityType.APPLICATION, table="departments")
+@Inheritance(strategy=InheritanceStrategy.NEW_TABLE)
+@Discriminator(strategy=DiscriminatorStrategy.CLASS_NAME,
+ column="DISCRIMINATOR")
+public class FCAppDepartment
+ implements IDepartment, Serializable, Comparable, Comparator, DeepEquality {
+
+ public static final int RECOMMENDED_NO_OF_EMPS = 2;
+
+ @Field(primaryKey="true")
+ @Column(name="ID")
+ private long deptid;
+ @Column(name="NAME")
+ private String name;
+ @Column(name="COMPANYID")
+ private FCAppCompany company;
+ @Column(name="EMP_OF_THE_MONTH")
+ private FCAppEmployee employeeOfTheMonth;
+ @Field(persistenceModifier=FieldPersistenceModifier.PERSISTENT,
+ mappedBy="department")
+ @Element(types=org.apache.jdo.tck.pc.companyAnnotatedFC.FCAppEmployee.class)
+ private transient Set employees = new HashSet();
+ @Element(types=org.apache.jdo.tck.pc.companyAnnotatedFC.FCAppEmployee.class)
+ @Field(persistenceModifier=FieldPersistenceModifier.PERSISTENT,
+ mappedBy="fundingDept")
+ 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 FCAppDepartment() {}
+
+ /**
+ * Construct a <code>Department</code> instance.
+ * @param deptid The department id.
+ * @param name The name of the department.
+ */
+ public FCAppDepartment(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 FCAppDepartment(long deptid, String name, ICompany company) {
+ this.deptid = deptid;
+ this.name = name;
+ this.company = (FCAppCompany)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 FCAppDepartment(long deptid, String name, ICompany company,
+ IEmployee employeeOfTheMonth) {
+ this.deptid = deptid;
+ this.name = name;
+ this.company = (FCAppCompany)company;
+ this.employeeOfTheMonth = (FCAppEmployee)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.
+ */
+ public long getDeptid() {
+ return deptid;
+ }
+
+ /**
+ * Get the name of the department.
+ * @return The name of the department.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Set the name of the department.
+ * @param name The name to set for the department.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get the company associated with the department.
+ * @return The company.
+ */
+ public ICompany getCompany() {
+ return company;
+ }
+
+ /**
+ * Set the company for the department.
+ * @param company The company to associate with the department.
+ */
+ public void setCompany(ICompany company) {
+ this.company = (FCAppCompany)company;
+ }
+
+ /**
+ * Get the employee of the month associated with the department.
+ * @return The employee 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 = (FCAppEmployee)employeeOfTheMonth;
+ }
+
+ /**
+ * Get the employees in the department as an unmodifiable set.
+ * @return The set of employees in the department, as an unmodifiable
+ * set.
+ */
+ public Set getEmployees() {
+ return Collections.unmodifiableSet(employees);
+ }
+
+ /**
+ * Add an employee to the department.
+ * @param emp The employee to add to the department.
+ */
+ public void addEmployee(FCAppEmployee emp) {
+ employees.add(emp);
+ }
+
+ /**
+ * Remove an employee from the department.
+ * @param emp The employee to remove from the department.
+ */
+ public void removeEmployee(FCAppEmployee 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 as an unmodifiable set.
+ * @return The set of funded employees in the department, as an
+ * unmodifiable set.
+ */
+ public Set getFundedEmps() {
+ return Collections.unmodifiableSet(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(FCAppEmployee 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(FCAppEmployee 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 FCAppDepartment.
+ *
+ * @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) {
+ FCAppDepartment otherDept = (FCAppDepartment)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>FCAppDepartment</code> object.
+ *
+ * @return a String representation of a <code>FCAppDepartment</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((FCAppDepartment)o);
+ }
+
+ /**
+ * Compare two instances. This is a method in Comparator.
+ */
+ public int compare(Object o1, Object o2) {
+ return compare((FCAppDepartment)o1, (FCAppDepartment)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(FCAppDepartment 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(FCAppDepartment o1, FCAppDepartment 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 FCAppDepartment) {
+ return compareTo((FCAppDepartment)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/companyAnnotatedFC/FCAppDepartment.java
------------------------------------------------------------------------------
svn:eol-style = LF
Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppEmployee.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppEmployee.java?view=auto&rev=557767
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppEmployee.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppEmployee.java Thu Jul 19 13:52:29 2007
@@ -0,0 +1,510 @@
+/*
+ * 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.companyAnnotatedFC;
+
+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.IAddress;
+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(identityType=IdentityType.APPLICATION)
+@Inheritance(strategy=InheritanceStrategy.SUPERCLASS_TABLE)
+public abstract class FCAppEmployee extends FCAppPerson implements IEmployee {
+
+ @Column(name="HIREDATE")
+ private Date hiredate;
+ @Column(name="WEEKLYHOURS")
+ private double weeklyhours;
+ @Field(mappedBy="employee")
+ private FCAppDentalInsurance dentalInsurance;
+ @Field(mappedBy="employee")
+ private FCAppMedicalInsurance medicalInsurance;
+ @Column(name="DEPARTMENT")
+ private FCAppDepartment department;
+ @Column(name="FUNDINGDEPT")
+ private FCAppDepartment fundingDept;
+ @Column(name="MANAGER")
+ private FCAppEmployee manager;
+ @Column(name="MENTOR")
+ private FCAppEmployee mentor;
+ @Field(mappedBy="mentor")
+ private FCAppEmployee protege;
+ @Column(name="HRADVISOR")
+ private FCAppEmployee hradvisor;
+ @Field(persistenceModifier=FieldPersistenceModifier.PERSISTENT,
+ mappedBy="reviewers")
+ @Element(types=org.apache.jdo.tck.pc.companyAnnotatedFC.FCAppProject.class)
+ private transient Set reviewedProjects = new HashSet();
+ @Field(persistenceModifier=FieldPersistenceModifier.PERSISTENT,
+ mappedBy="members")
+ @Element(types=org.apache.jdo.tck.pc.companyAnnotatedFC.FCAppProject.class)
+ private transient Set projects = new HashSet();
+ @Field(persistenceModifier=FieldPersistenceModifier.PERSISTENT,
+ mappedBy="manager")
+ @Element(types=org.apache.jdo.tck.pc.companyAnnotatedFC.FCAppEmployee.class)
+ private transient Set team = new HashSet();
+ @Field(persistenceModifier=FieldPersistenceModifier.PERSISTENT,
+ mappedBy="hradvisor")
+ @Element(types=org.apache.jdo.tck.pc.companyAnnotatedFC.FCAppEmployee.class)
+ private transient Set hradvisees = new HashSet();
+
+ /** This is the JDO-required no-args constructor */
+ protected FCAppEmployee() {}
+
+ /**
+ * Construct an <code>FCAppEmployee</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 FCAppEmployee(long personid, String firstname, String lastname,
+ String middlename, Date birthdate,
+ Date hiredate) {
+ super(personid, firstname, lastname, middlename, birthdate);
+ this.hiredate = hiredate;
+ }
+
+ /**
+ * Construct an <code>FCAppEmployee</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 FCAppEmployee(long personid, String firstname, String lastname,
+ String middlename, Date birthdate, IAddress address,
+ Date hiredate) {
+ super(personid, firstname, lastname, middlename, birthdate,
+ (FCAppAddress)address);
+ this.hiredate = hiredate;
+ }
+
+ /**
+ * Get the date that the employee was hired.
+ * @return The date the employee was hired.
+ */
+ public Date getHiredate() {
+ return hiredate;
+ }
+
+ /**
+ * Set the date that the employee was hired.
+ * @param hiredate The date the employee was hired.
+ */
+ public void setHiredate(Date hiredate) {
+ this.hiredate = hiredate;
+ }
+
+ /**
+ * Get the weekly hours of the employee.
+ * @return The number of hours per week that the employee works.
+ */
+ public double getWeeklyhours() {
+ return weeklyhours;
+ }
+
+ /**
+ * Set the number of hours per week that the employee works.
+ * @param weeklyhours The number of hours per week that the employee
+ * works.
+ */
+ public void setWeeklyhours(double weeklyhours) {
+ this.weeklyhours = weeklyhours;
+ }
+
+ /**
+ * Get the reviewed projects.
+ * @return The reviewed projects as an unmodifiable set.
+ */
+ public Set getReviewedProjects() {
+ return Collections.unmodifiableSet(reviewedProjects);
+ }
+
+ /**
+ * Add a reviewed project.
+ * @param project A reviewed project.
+ */
+ public void addReviewedProjects(FCAppProject project) {
+ reviewedProjects.add(project);
+ }
+
+ /**
+ * Remove a reviewed project.
+ * @param project A reviewed project.
+ */
+ public void removeReviewedProject(FCAppProject 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 are returned as an unmodifiable
+ * set.
+ */
+ public Set getProjects() {
+ return Collections.unmodifiableSet(projects);
+ }
+
+ /**
+ * Add a project for the employee.
+ * @param project The project.
+ */
+ public void addProject(FCAppProject project) {
+ projects.add(project);
+ }
+
+ /**
+ * Remove a project from an employee's set of projects.
+ * @param project The project.
+ */
+ public void removeProject(FCAppProject 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.
+ */
+ 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 = (FCAppDentalInsurance)dentalInsurance;
+ }
+ /**
+ * Get the medical insurance of the employee.
+ * @return The employee's medical insurance.
+ */
+ 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 = (FCAppMedicalInsurance)medicalInsurance;
+ }
+
+ /**
+ * Get the employee's department.
+ * @return The department associated with the employee.
+ */
+ public IDepartment getDepartment() {
+ return department;
+ }
+
+ /**
+ * Set the employee's department.
+ * @param department The department.
+ */
+ public void setDepartment(IDepartment department) {
+ this.department = (FCAppDepartment)department;
+ }
+
+ /**
+ * Get the employee's funding department.
+ * @return The funding department associated with the employee.
+ */
+ public IDepartment getFundingDept() {
+ return fundingDept;
+ }
+
+ /**
+ * Set the employee's funding department.
+ * @param department The funding department.
+ */
+ public void setFundingDept(IDepartment department) {
+ this.fundingDept = (FCAppDepartment)department;
+ }
+
+ /**
+ * Get the employee's manager.
+ * @return The employee's manager.
+ */
+ public IEmployee getManager() {
+ return manager;
+ }
+
+ /**
+ * Set the employee's manager.
+ * @param manager The employee's manager.
+ */
+ public void setManager(IEmployee manager) {
+ this.manager = (FCAppEmployee)manager;
+ }
+
+ /**
+ * Get the employee's team.
+ *
+ * @return The set of <code>FCAppEmployee</code>s on this employee's team,
+ * returned as an unmodifiable set.
+ */
+ public Set getTeam() {
+ return Collections.unmodifiableSet(team);
+ }
+
+ /**
+ * Add an <code>FCAppEmployee</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>FCAppEmployee</code> to add to the team.
+ */
+ public void addToTeam(FCAppEmployee emp) {
+ team.add(emp);
+ emp.manager = this;
+ }
+
+ /**
+ * Remove an <code>FCAppEmployee</code> from this employee's team.
+ * This method will also set the <code>emp</code> manager to null.
+ *
+ * @param emp The <code>FCAppEmployee</code> to remove from the team.
+ */
+ public void removeFromTeam(FCAppEmployee emp) {
+ team.remove(emp);
+ emp.manager = null;
+ }
+
+ /**
+ * Set the employee's team.
+ *
+ * @param team The set of <code>FCAppEmployee</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 = (FCAppEmployee)mentor;
+ }
+
+ /**
+ * Get the mentor for this employee.
+ * @return The mentor.
+ */
+ public IEmployee getMentor() {
+ return mentor;
+ }
+
+ /**
+ * Set the protege for this employee.
+ * @param protege The protege for this employee.
+ */
+ public void setProtege(IEmployee protege) {
+ this.protege = (FCAppEmployee)protege;
+ }
+
+ /**
+ * Get the protege of this employee.
+ * @return The protege of this employee.
+ */
+ public IEmployee getProtege() {
+ return protege;
+ }
+
+ /**
+ * Set the HR advisor for this employee.
+ * @param hradvisor The hradvisor for this employee.
+ */
+ public void setHradvisor(IEmployee hradvisor) {
+ this.hradvisor = (FCAppEmployee)hradvisor;
+ }
+
+ /**
+ * Get the HR advisor for the employee.
+ * @return The HR advisor.
+ */
+ public IEmployee getHradvisor() {
+ return hradvisor;
+ }
+
+ /**
+ * Get the HR advisees of this HR advisor.
+ *
+ * @return An unmodifiable <code>Set</code> containing the
+ * <code>FCAppEmployee</code>s that are HR advisees of this employee.
+ */
+ public Set getHradvisees() {
+ return Collections.unmodifiableSet(hradvisees);
+ }
+
+ /**
+ * Add an <code>FCAppEmployee</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(FCAppEmployee emp) {
+ hradvisees.add(emp);
+ emp.hradvisor = this;
+ }
+
+ /**
+ * Remove an <code>FCAppEmployee</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(FCAppEmployee emp) {
+ hradvisees.remove(emp);
+ emp.hradvisor = null;
+ }
+
+ /**
+ * Set the HR advisees of this HR advisor.
+ *
+ * @param hradvisees The <code>FCAppEmployee</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>FCAppEmployee</code> object.
+ *
+ * @return a String representation of a <code>FCAppEmployee</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 FCAppEmployee.
+ *
+ * @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) {
+ FCAppEmployee otherEmp = (FCAppEmployee)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/companyAnnotatedFC/FCAppEmployee.java
------------------------------------------------------------------------------
svn:eol-style = LF
Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppFullTimeEmployee.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppFullTimeEmployee.java?view=auto&rev=557767
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppFullTimeEmployee.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppFullTimeEmployee.java Thu Jul 19 13:52:29 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.companyAnnotatedFC;
+
+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(identityType=IdentityType.APPLICATION)
+@Inheritance(strategy=InheritanceStrategy.SUPERCLASS_TABLE)
+public class FCAppFullTimeEmployee extends FCAppEmployee
+ implements IFullTimeEmployee {
+
+ @Column(name="SALARY")
+ private double salary;
+
+ /** This is the JDO-required no-args constructor. The TCK relies on
+ * this constructor for testing PersistenceManager.newInstance(PCClass).
+ */
+ public FCAppFullTimeEmployee() {}
+
+ /**
+ * 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 FCAppFullTimeEmployee(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 FCAppFullTimeEmployee(long personid, String first, String last,
+ String middle, Date born, IAddress addr,
+ Date hired, double sal) {
+ super(personid, first, last, middle, born, (FCAppAddress)addr, hired);
+ salary = sal;
+ }
+
+ /**
+ * Get the salary of the full time employee.
+ * @return The salary of the full time employee.
+ */
+ public double getSalary() {
+ return salary;
+ }
+
+ /**
+ * Set the salary for the full-time employee.
+ * @param salary The salary to set for the full-time employee.
+ */
+ public void setSalary(double salary) {
+ this.salary = salary;
+ }
+
+ /**
+ * Return a String representation of a <code>FCAppFullTimeEmployee</code> object.
+ *
+ * @return a String representation of a <code>FCAppFullTimeEmployee</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
+ * FCAppFullTimeEmployee.
+ *
+ * @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) {
+ FCAppFullTimeEmployee otherEmp = (FCAppFullTimeEmployee)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/companyAnnotatedFC/FCAppFullTimeEmployee.java
------------------------------------------------------------------------------
svn:eol-style = LF