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 mb...@apache.org on 2005/05/22 20:40:21 UTC
svn commit: r171355 [15/31] - in /incubator/jdo/trunk/fostore20: ./ src/
src/conf/ src/java/ src/java/org/ src/java/org/apache/
src/java/org/apache/jdo/ src/java/org/apache/jdo/impl/
src/java/org/apache/jdo/impl/fostore/ test/ test/conf/ test/fsuid2/
test/fsuid2/org/ test/fsuid2/org/apache/ test/fsuid2/org/apache/jdo/
test/fsuid2/org/apache/jdo/pc/ test/java/ test/java/org/
test/java/org/apache/ test/java/org/apache/jdo/
test/java/org/apache/jdo/impl/ test/java/org/apache/jdo/impl/fostore/
test/java/org/apache/jdo/pc/ test/java/org/apache/jdo/pc/appid/
test/java/org/apache/jdo/pc/empdept/
test/java/org/apache/jdo/pc/serializable/
test/java/org/apache/jdo/pc/xempdept/ test/java/org/apache/jdo/test/
test/java/org/apache/jdo/test/query/ test/java/org/apache/jdo/test/util/
test/jdo/ test/jdo/org/ test/jdo/org/apache/ test/jdo/org/apache/jdo/
test/jdo/org/apache/jdo/pc/ test/jdo/org/apache/jdo/pc/appid/
test/jdo/org/apache/jdo/pc/empdept/ test/jdo/org/apache/jdo/pc/serializable/
test/jdo/org/apache/jdo/pc/xempdept/
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/empdept/PCPartTimeEmployee.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/empdept/PCPartTimeEmployee.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/empdept/PCPartTimeEmployee.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/empdept/PCPartTimeEmployee.java Sun May 22 11:40:13 2005
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * PCPartTimeEmployee.java
+ *
+ * Created on May 22, 2001, 9:35 AM
+ */
+
+package org.apache.jdo.pc.empdept;
+
+/**
+ *
+ * @author clr
+ * @version
+ */
+public class PCPartTimeEmployee extends PCEmployee {
+
+ public double wage;
+
+ /** Creates new PCPartTimeEmployee */
+ public PCPartTimeEmployee() {
+ }
+ public PCPartTimeEmployee(
+ String _first,
+ String _last,
+ java.util.Date _born,
+ long _empid,
+ java.util.Date _hired,
+ double _wage ) {
+ super (_first, _last, _born, _empid, _hired, null, null, null, null, null);
+ wage = _wage;
+ }
+
+ public double getWage() {
+ return wage;
+ }
+
+ public void setWage(double wage) {
+ this.wage = wage;
+ }
+
+ public String toString() {
+ StringBuffer rc = new StringBuffer("PCPartTimeEmployee: ");
+// rc.append(lastname);
+// rc.append(", " + firstname);
+ rc.append(super.toString());
+// rc.append(", id=" + empid);
+// rc.append(", born " + formatter.format(birthdate));
+// rc.append(", hired " + formatter.format(hiredate));
+ rc.append(" $" + wage);
+// String mgrName = "none";
+// if (null != manager) {
+// mgrName = manager.getLastname();
+// }
+// rc.append(" manager: " + mgrName);
+// rc.append(" dept: " + department.getName());
+// int numEmps = 0;
+// if (null != employees) {
+// numEmps = employees.size();
+// }
+// rc.append(" emps: " + numEmps);
+// rc.append(" insurance: " + insurance.getCarrier());
+ return rc.toString();
+ }
+
+}
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/empdept/PCPerson.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/empdept/PCPerson.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/empdept/PCPerson.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/empdept/PCPerson.java Sun May 22 11:40:13 2005
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * PCPerson.java
+ *
+ * Created on May 22, 2001, 9:34 AM
+ */
+
+package org.apache.jdo.pc.empdept;
+
+import java.text.SimpleDateFormat;
+import java.util.TimeZone;
+import java.util.Locale;
+
+/**
+ *
+ * @author clr
+ * @version
+ */
+public class PCPerson implements java.io.Serializable{
+
+ public String firstname;
+
+ public String lastname;
+
+ public java.util.Date birthdate;
+
+ protected static SimpleDateFormat formatter;
+
+ static {
+ formatter = new SimpleDateFormat("d/MMM/yyyy", Locale.US);
+ formatter.setTimeZone(TimeZone.getTimeZone("America/New_York"));
+ }
+
+ /** Creates new PCPerson */
+
+ public PCPerson() {
+ }
+
+ public PCPerson(String firstname, String lastname, java.util.Date birthdate) {
+ this.firstname = firstname;
+ this.lastname = lastname;
+ this.birthdate = birthdate;
+ }
+
+ public String getLastname() {
+ return lastname;
+ }
+
+ public void setLastname(String lastname) {
+ this. lastname = lastname;
+ }
+
+ public String getFirstname() {
+ return firstname;
+ }
+
+ public void setFirstname(String firstname) {
+ this. firstname = firstname;
+ }
+
+ public java.util.Date getBirthdate() {
+ return birthdate;
+ }
+
+ public void setBirthdate(java.util.Date birthdate) {
+ this. birthdate = birthdate;
+ }
+
+
+ public String toString() {
+ StringBuffer rc = new StringBuffer("PCPerson: ");
+ rc.append(getLastname());
+ rc.append(", " + getFirstname());
+// rc.append(", id=" + empid);
+ rc.append(", born " + formatter.format(getBirthdate()));
+// rc.append(", hired " + formatter.format(hiredate));
+// rc.append(" $" + salary);
+// String mgrName = "none";
+// if (null != manager) {
+// mgrName = manager.getLastname();
+// }
+// rc.append(" manager: " + mgrName);
+// rc.append(" dept: " + department.getName());
+// int numEmps = 0;
+// if (null != employees) {
+// numEmps = employees.size();
+// }
+// rc.append(" emps: " + numEmps);
+// rc.append(" insurance: " + insurance.getCarrier());
+ return rc.toString();
+ }
+}
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/empdept/PCProject.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/empdept/PCProject.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/empdept/PCProject.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/empdept/PCProject.java Sun May 22 11:40:13 2005
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.empdept;
+
+import java.util.HashSet;
+
+/**
+* A sample project class, generated from an SQL schema.
+*/
+public class PCProject implements java.io.Serializable{
+ public long projid;
+
+ public String name;
+
+ public java.util.HashSet employees;
+
+ public String toString() {
+ return "PCProject: " + name + ", id=" + projid +
+ ", emps: " + employees.size();
+ }
+
+ public PCProject() {
+ }
+
+ public PCProject(long _projid, String _name) {
+ projid = _projid;
+ name = _name;
+ }
+
+ public long getProjid() {
+ return projid;
+ }
+
+ public void setProjid(long projid) {
+ this. projid = projid;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this. name = name;
+ }
+
+ public java.util.HashSet getEmployees() {
+ return employees;
+ }
+
+ public void setEmployees(java.util.HashSet employees) {
+ this. employees = employees;
+ }
+
+ public static class Oid {
+ public long projid;
+
+ public Oid() {
+ }
+
+ 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() {
+ int hashCode=0;
+ hashCode += projid;
+ return( hashCode );
+ }
+
+
+}
+}
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCClass1.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCClass1.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCClass1.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCClass1.java Sun May 22 11:40:13 2005
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.serializable;
+
+import java.io.Serializable;
+
+/**
+ * A pc class has no persistence-capable superclass, implements
+ * java.io.Serializable, but does not provide an implementation of methods
+ * writeObject or writeReplace.
+ *
+ * The enhancer should add the following methods to the pc class:
+ * protected final void jdoPreSerialize() {
+ * final javax.jdo.spi.StateManager sm = this.jdoStateManager;
+ * if (sm != null) { sm.preSerialize(this); }
+ * }
+ * private void writeObject(java.io.ObjectOutputStream out)
+ * throws java.io.IOException {
+ * jdoPreSerialize();
+ * out.defaultWriteObject();
+ * }
+ *
+ * @author Michael Bouschen
+ */
+public class PCClass1
+ implements Serializable
+{
+ private int s01;
+ private transient int t02;
+
+ public PCClass1()
+ {
+ this(Integer.MIN_VALUE, Integer.MIN_VALUE);
+ }
+ public PCClass1(int s01, int t02)
+ {
+ this.s01 = s01;
+ this.t02 = t02;
+ }
+
+ public int getS01() { return s01; }
+ public void setS01(int value) { this.s01 = value; }
+
+ public int getT02() { return t02; }
+ public void setT02(int value) { this.t02 = value; }
+
+ public boolean equals(Object obj) {
+ if (obj==null || !(obj instanceof PCClass1)) return false;
+ PCClass1 o = (PCClass1)obj;
+ if (this.s01 != o.s01) return false;
+ if (this.t02 != o.t02) return false;
+ return true;
+ }
+
+ public String toString()
+ {
+ StringBuffer repr = new StringBuffer();
+ addFieldRepr(repr);
+ return "PCClass1(" + repr.toString() + ")";
+ }
+
+ protected void addFieldRepr(StringBuffer repr)
+ {
+ repr.append("s01="); repr.append(s01);
+ repr.append(", t02="); repr.append(t02);
+ }
+
+}
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCClass2A.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCClass2A.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCClass2A.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCClass2A.java Sun May 22 11:40:13 2005
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.serializable;
+
+import java.io.Serializable;
+import java.io.ObjectOutputStream;
+import java.io.IOException;
+
+/**
+ * A pc class has no persistence-capable superclass, implements
+ * java.io.Serializable and provides an implementation of method
+ * writeObject.
+ *
+ * The enhancer should add a method jdoPreSerialize
+ * protected final void jdoPreSerialize() {
+ * final javax.jdo.spi.StateManager sm = this.jdoStateManager;
+ * if (sm != null) { sm.preSerialize(this); }
+ * }
+ * and should add a call of method jdoPreSerialize() to the existing
+ * method writeObject. It needs to be the first statement of writeObject.
+ *
+ * @author Michael Bouschen
+ */
+public class PCClass2A
+ implements Serializable
+{
+ private int s01;
+ private transient int t02;
+
+ public PCClass2A()
+ {
+ this(Integer.MIN_VALUE, Integer.MIN_VALUE);
+ }
+ public PCClass2A(int s01, int t02)
+ {
+ this.s01 = s01;
+ this.t02 = t02;
+ }
+
+ public int getS01() { return s01; }
+ public void setS01(int value) { this.s01 = value; }
+
+ public int getT02() { return t02; }
+ public void setT02(int value) { this.t02 = value; }
+
+ public boolean equals(Object obj) {
+ if (obj==null || !(obj instanceof PCClass2A)) return false;
+ PCClass2A o = (PCClass2A)obj;
+ if (this.s01 != o.s01) return false;
+ if (this.t02 != o.t02) return false;
+ return true;
+ }
+
+ public String toString()
+ {
+ StringBuffer repr = new StringBuffer();
+ addFieldRepr(repr);
+ return "PCClass2A(" + repr.toString() + ")";
+ }
+
+ protected void addFieldRepr(StringBuffer repr)
+ {
+ repr.append("s01="); repr.append(s01);
+ repr.append(", t02="); repr.append(t02);
+ }
+
+ // --- implement writeObject ---
+
+ private void writeObject(ObjectOutputStream out)
+ throws IOException
+ {
+ out.defaultWriteObject();
+ }
+}
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCClass2B.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCClass2B.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCClass2B.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCClass2B.java Sun May 22 11:40:13 2005
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.serializable;
+
+import java.io.Serializable;
+import java.io.ObjectStreamException;
+
+/**
+ * A pc class has no persistence-capable superclass, implements
+ * java.io.Serializable and provides an implementation of method
+ * writeReplace.
+ *
+ * The enhancer should add a method jdoPreSerialize
+ * protected final void jdoPreSerialize() {
+ * final javax.jdo.spi.StateManager sm = this.jdoStateManager;
+ * if (sm != null) { sm.preSerialize(this); }
+ * }
+ * and should add a call of method jdoPreSerialize() to the existing
+ * method writeReplace. It needs to be the first statement of writeReplace.
+ *
+ * @author Michael Bouschen
+ */
+public class PCClass2B
+ implements Serializable
+{
+ private int s01;
+ private transient int t02;
+
+ public PCClass2B()
+ {
+ this(Integer.MIN_VALUE, Integer.MIN_VALUE);
+ }
+ public PCClass2B(int s01, int t02)
+ {
+ this.s01 = s01;
+ this.t02 = t02;
+ }
+
+ public int getS01() { return s01; }
+ public void setS01(int value) { this.s01 = value; }
+
+ public int getT02() { return t02; }
+ public void setT02(int value) { this.t02 = value; }
+
+ public boolean equals(Object obj) {
+ if (obj==null || !(obj instanceof PCClass2B)) return false;
+ PCClass2B o = (PCClass2B)obj;
+ if (this.s01 != o.s01) return false;
+ if (this.t02 != o.t02) return false;
+ return true;
+ }
+
+ public String toString()
+ {
+ StringBuffer repr = new StringBuffer();
+ addFieldRepr(repr);
+ return "PCClass2B(" + repr.toString() + ")";
+ }
+
+ protected void addFieldRepr(StringBuffer repr)
+ {
+ repr.append("s01="); repr.append(s01);
+ repr.append(", t02="); repr.append(t02);
+ }
+ // --- implement writeReplace ---
+
+ private Object writeReplace()
+ throws ObjectStreamException
+ {
+ return this;
+ }
+}
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCSub3.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCSub3.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCSub3.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCSub3.java Sun May 22 11:40:13 2005
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.serializable;
+
+/**
+ * There is the following inheritance hierarchy:
+ * PCSuper <- Transient <- PCSub.
+ * PCSuper and PCSub are pc classes, Transient is a non-pc class.
+ * PCSuper does not implement java.io.Serializable, but Transient does.
+ * PCSub automatically implement java.io.Serializable, because its super
+ * class implements the interface.
+ * PCSub does not provide an implementation of method writeObject or
+ * writeReplace.
+ *
+ * The enhancer should add a method jdoPreSerialize to the PCSuper and
+ * should add a method writeObject to PCSub3:
+ * private void writeObject(java.io.ObjectOutputStream out)
+ * throws java.io.IOException {
+ * jdoPreSerialize();
+ * out.defaultWriteObject();
+ * }
+ *
+ * @author Michael Bouschen
+ */
+public class PCSub3
+ extends Transient
+{
+ private String s03;
+ private transient String t04;
+
+ public PCSub3()
+ {
+ this(Integer.MIN_VALUE, Integer.MIN_VALUE, "empty", "empty");
+ }
+ public PCSub3(int s01, int t02, String s03, String t04)
+ {
+ super(s01, t02);
+ this.s03 = s03;
+ this.t04 = t04;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj==null || !(obj instanceof PCSub3)) return false;
+ PCSub3 o = (PCSub3)obj;
+ if (this.getS01() != o.getS01()) return false;
+ if (this.getT02() != o.getT02()) return false;
+ if (!stringEquals(this.s03, o.s03)) return false;
+ if (!stringEquals(this.t04, o.t04)) return false;
+ return true;
+ }
+
+ private boolean stringEquals(String s1, String s2)
+ {
+ return (s1 == null) ? (s2 == null) : s1.equals(s2);
+ }
+
+ public String toString()
+ {
+ StringBuffer repr = new StringBuffer();
+ addFieldRepr(repr);
+ return "PCSub3(" + repr.toString() + ")";
+ }
+
+ protected void addFieldRepr(StringBuffer repr)
+ {
+ super.addFieldRepr(repr);
+ repr.append(", s03="); repr.append(s03);
+ repr.append(", t04="); repr.append(t04);
+ }
+
+
+}
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCSub4A.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCSub4A.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCSub4A.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCSub4A.java Sun May 22 11:40:13 2005
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.serializable;
+
+import java.io.Serializable;
+import java.io.ObjectOutputStream;
+import java.io.IOException;
+
+/**
+ * There is the following inheritance hierarchy:
+ * PCSuper <- Transient <- PCSub.
+ * PCSuper and PCSub are pc classes, Transient is a non-pc class.
+ * PCSuper does not implement java.io.Serializable, but Transient does.
+ * PCSub automatically implement java.io.Serializable, because its super
+ * class implements the interface.
+ * PCSub provides an implementation of method writeObject.
+ *
+ * The enhancer should add a method jdoPreSerialize to the PCSuper and
+ * should add a call of method jdoPreSerialize() to the existing method
+ * writeObject. It needs to be the first statement of writeObject.
+ *
+ * @author Michael Bouschen
+ */
+public class PCSub4A
+ extends Transient
+{
+ private String s03;
+ private transient String t04;
+
+ public PCSub4A()
+ {
+ this(Integer.MIN_VALUE, Integer.MIN_VALUE, "empty", "empty");
+ }
+ public PCSub4A(int s01, int t02, String s03, String t04)
+ {
+ super(s01, t02);
+ this.s03 = s03;
+ this.t04 = t04;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj==null || !(obj instanceof PCSub4A)) return false;
+ PCSub4A o = (PCSub4A)obj;
+ if (this.getS01() != o.getS01()) return false;
+ if (this.getT02() != o.getT02()) return false;
+ if (!stringEquals(this.s03, o.s03)) return false;
+ if (!stringEquals(this.t04, o.t04)) return false;
+ return true;
+ }
+
+ private boolean stringEquals(String s1, String s2)
+ {
+ return (s1 == null) ? (s2 == null) : s1.equals(s2);
+ }
+
+ public String toString()
+ {
+ StringBuffer repr = new StringBuffer();
+ addFieldRepr(repr);
+ return "PCSub4A(" + repr.toString() + ")";
+ }
+
+ protected void addFieldRepr(StringBuffer repr)
+ {
+ super.addFieldRepr(repr);
+ repr.append(", s03="); repr.append(s03);
+ repr.append(", t04="); repr.append(t04);
+ }
+
+ // --- implement writeObject ---
+
+ private void writeObject(ObjectOutputStream out)
+ throws IOException
+ {
+ out.defaultWriteObject();
+ }
+}
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCSub4B.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCSub4B.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCSub4B.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCSub4B.java Sun May 22 11:40:13 2005
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.serializable;
+
+import java.io.Serializable;
+import java.io.ObjectStreamException;
+
+/**
+ * There is the following inheritance hierarchy:
+ * PCSuper <- Transient <- PCSub.
+ * PCSuper and PCSub are pc classes, Transient is a non-pc class.
+ * PCSuper does not implement java.io.Serializable, but Transient does.
+ * PCSub automatically implement java.io.Serializable, because its super
+ * class implements the interface.
+ * PCSub provides an implementation of method writeReplace.
+ *
+ * The enhancer should add a method jdoPreSerialize to the PCSuper and
+ * should add a call of method jdoPreSerialize() to the existing method
+ * writeObject. It needs to be the first statement of writeReplace.
+ *
+ * @author Michael Bouschen
+ */
+public class PCSub4B
+ extends Transient
+{
+ private String s03;
+ private transient String t04;
+
+ public PCSub4B()
+ {
+ this(Integer.MIN_VALUE, Integer.MIN_VALUE, "empty", "empty");
+ }
+ public PCSub4B(int s01, int t02, String s03, String t04)
+ {
+ super(s01, t02);
+ this.s03 = s03;
+ this.t04 = t04;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj==null || !(obj instanceof PCSub4B)) return false;
+ PCSub4B o = (PCSub4B)obj;
+ if (this.getS01() != o.getS01()) return false;
+ if (this.getT02() != o.getT02()) return false;
+ if (!stringEquals(this.s03, o.s03)) return false;
+ if (!stringEquals(this.t04, o.t04)) return false;
+ return true;
+ }
+
+ private boolean stringEquals(String s1, String s2)
+ {
+ return (s1 == null) ? (s2 == null) : s1.equals(s2);
+ }
+
+ public String toString()
+ {
+ StringBuffer repr = new StringBuffer();
+ addFieldRepr(repr);
+ return "PCSub4B(" + repr.toString() + ")";
+ }
+
+ protected void addFieldRepr(StringBuffer repr)
+ {
+ super.addFieldRepr(repr);
+ repr.append(", s03="); repr.append(s03);
+ repr.append(", t04="); repr.append(t04);
+ }
+
+ // --- implement writeReplace ---
+
+ private Object writeReplace()
+ throws ObjectStreamException
+ {
+ return this;
+ }
+}
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCSuper.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCSuper.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCSuper.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/PCSuper.java Sun May 22 11:40:13 2005
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.serializable;
+
+/**
+ * A persistence capable class that does not implement
+ * java.io.Serializable, used as superclass for other pc classes: PCSub3,
+ * PCSub4A, PCSub4B.
+ *
+ * The enhancer should add a method jdoPreSerialize:
+ * protected final void jdoPreSerialize() {
+ * final javax.jdo.spi.StateManager sm = this.jdoStateManager;
+ * if (sm != null) { sm.preSerialize(this); }
+ * }
+ *
+ * @author Michael Bouschen
+ */
+public class PCSuper
+{
+ private int s01;
+ private transient int t02;
+
+ public PCSuper()
+ {
+ this(Integer.MIN_VALUE, Integer.MIN_VALUE);
+ }
+ public PCSuper(int s01, int t02)
+ {
+ this.s01 = s01;
+ this.t02 = t02;
+ }
+
+ public int getS01() { return s01; }
+ public void setS01(int value) { this.s01 = value; }
+
+ public int getT02() { return t02; }
+ public void setT02(int value) { this.t02 = value; }
+
+ public String toString()
+ {
+ StringBuffer repr = new StringBuffer();
+ addFieldRepr(repr);
+ return "PCSuper(" + repr.toString() + ")";
+ }
+
+ protected void addFieldRepr(StringBuffer repr)
+ {
+ repr.append("s01="); repr.append(s01);
+ repr.append(", t02="); repr.append(t02);
+ }
+}
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/Readme.txt
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/Readme.txt?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/Readme.txt (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/Readme.txt Sun May 22 11:40:13 2005
@@ -0,0 +1,57 @@
+Test scenarios with serializable.
+
+(1) A pc class has no persistence-capable superclass, implements
+java.io.Serializable, but does not provide an implementation of method
+writeObject or writeReplace.
+
+The enhancer should add the following methods to the pc class:
+- protected final void jdoPreSerialize() {
+ final javax.jdo.spi.StateManager sm = this.jdoStateManager;
+ if (sm != null) { sm.preSerialize(this); }
+ }
+- private void writeObject(java.io.ObjectOutputStream out)
+ throws java.io.IOException {
+ jdoPreSerialize();
+ out.defaultWriteObject();
+ }
+
+(2A) A pc class has no persistence-capable superclass, implements
+java.io.Serializable and provides an implementation of method writeObject.
+
+The enhancer should add a method jdoPreSerialize (code see above) and
+should add a call of method jdoPreSerialize() to the existing
+method writeObject. It needs to be the first statement of writeObject.
+
+(2B) A pc class has no persistence-capable superclass, implements
+java.io.Serializable and provides an implementation of method writeReplace.
+
+The enhancer should add a method jdoPreSerialize (code see above) and
+should add a call of method jdoPreSerialize() to the existing
+method writeReplace. It needs to be the first statement of writeReplace.
+
+(3) There is the following inheritance hierarchy:
+PCSuper <- Transient <- PCSub
+- PCSuper and PCSub are pc classes, Transient is a non-pc class.
+- PCSuper does not implement java.io.Serializable, but Transient does.
+ PCSub automatically implement java.io.Serializable, because its super
+ class implements the interface.
+- PCSub does not provide an implementation of method writeObject.
+
+The enhancer should add a method jdoPreSerialize (code see above) to
+PCSuper and should add a method writeObject (code see above) to PCSub.
+
+(4A) The same inheritance hierarchy as in (3) the only difference is that
+PCSub provides an implementation of method writeObject.
+
+The enhancer should add a method jdoPreSerialize (code see above) to
+PCSuper and should add a call of method jdoPreSerialize() to the
+existing method writeObject. It needs to be the first statement of
+writeObject.
+
+(4B) The same inheritance hierarchy as in (3) the only difference is that
+PCSub provides an implementation of method writeReplace.
+
+The enhancer should add a method jdoPreSerialize (code see above) and
+should add a call of method jdoPreSerialize() to the existing
+method writeReplace. It needs to be the first statement of writeReplace.
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/Transient.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/Transient.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/Transient.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/serializable/Transient.java Sun May 22 11:40:13 2005
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.serializable;
+
+/**
+ * Transient class in the following inheritance hierarchy:
+ * PCSuper <- Transient <- PCSub. It implements java.io.Serializable.
+ *
+ * @author Michael Bouschen
+ */
+public class Transient
+ extends PCSuper
+ implements java.io.Serializable
+{
+ public Transient() { super(); }
+ public Transient(int s01, int t02) { super(s01, t02); }
+
+}
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Company.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Company.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Company.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Company.java Sun May 22 11:40:13 2005
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.xempdept;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.HashSet;
+
+public class Company implements Serializable, Identifiable {
+
+ private String name;
+ private Date founded;
+ private String address;
+ private HashSet departments;
+
+ public Object getOid() {
+ Oid oid = new Oid();
+ oid.name = this.name;
+ oid.founded = this.founded;
+ return oid;
+ }
+
+ public String toString() {
+ return "Company(" + name +
+ ", founded=" + founded +
+ ", address=" + address +
+ ", departments: " + ((departments == null) ? 0 : departments.size()) +
+ ")";
+ }
+
+ public Company() {
+ }
+
+ public Company(String name,
+ Date founded,
+ String address,
+ HashSet departments) {
+ this.name = name;
+ this.founded = founded;
+ this.address = address;
+ this.departments = departments;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Date getFounded() {
+ return founded;
+ }
+
+ public void setFounded(java.util.Date founded) {
+ this.founded = founded;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public HashSet getDepartments() {
+ return departments;
+ }
+
+ public void setDepartments(HashSet departments) {
+ this.departments = departments;
+ }
+
+ public static class Oid implements Serializable, Comparable {
+
+ public String name;
+
+ public java.util.Date founded;
+
+ public Oid() {
+ }
+
+ public boolean equals(java.lang.Object obj) {
+ if( obj==null ||
+ !this.getClass().equals(obj.getClass()) ) return( false );
+ Oid o=(Oid) obj;
+ if( (this.name!=o.name) &&
+ (this.name==null || !this.name.equals(o.name)) )
+ return( false );
+ if( (this.founded!=o.founded) &&
+ (this.founded==null || !this.founded.equals(o.founded)) )
+ return( false );
+ return( true );
+ }
+
+ public int hashCode() {
+ int hashCode=0;
+ if( name!=null )
+ hashCode += name.hashCode();
+ if( founded!=null )
+ hashCode += founded.hashCode();
+ return( hashCode );
+ }
+
+ public int compareTo(Object o) {
+ if (o == null)
+ throw new ClassCastException();
+ if (o == this)
+ return 0;
+ // WARNING: this only compares the names
+ String thisName = name;
+ String otherName = ((Oid)o).name;
+ if (thisName == null)
+ return (otherName == null) ? 0 : -1;
+ if (otherName == null)
+ return 1;
+ return thisName.compareTo(otherName);
+ }
+
+ }
+
+}
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Department.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Department.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Department.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Department.java Sun May 22 11:40:13 2005
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.xempdept;
+
+import java.io.Serializable;
+import java.util.HashSet;
+
+public class Department implements Serializable, Identifiable {
+
+ private long deptid;
+ private String name;
+ private Company company;
+ private HashSet employees;
+
+ public Object getOid() {
+ Oid oid = new Oid();
+ oid.deptid = this.deptid;
+ return oid;
+ }
+
+ public String toString() {
+ return "Department(" + name +
+ ", id=" + deptid +
+ ", employees=" + ((employees == null) ? 0 : employees.size()) +
+ ", company=" + ((company == null) ? "null" : company.getName()) +
+ ")";
+ }
+
+ public Department() {
+ }
+
+ public Department(long deptid,
+ String name,
+ Company company,
+ HashSet employees) {
+ this.deptid = deptid;
+ this.name = name;
+ this.company = company;
+ this.employees = employees;
+ }
+
+ public long getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(long deptid) {
+ this.deptid = deptid;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Company getCompany() {
+ return company;
+ }
+
+ public void setCompany(Company company) {
+ this.company = company;
+ }
+
+ public java.util.HashSet getEmployees() {
+ return employees;
+ }
+
+ public void setEmployees(HashSet employees) {
+ this.employees = employees;
+ }
+
+ public static class Oid implements Serializable, Comparable {
+
+ public long deptid;
+
+ public Oid() {
+ }
+
+ 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() {
+ int hashCode=0;
+ hashCode += deptid;
+ return( hashCode );
+ }
+
+ public int compareTo(Object o) {
+ if (o == null)
+ throw new ClassCastException();
+ if (o == this)
+ return 0;
+ long otherDeptid = ((Oid)o).deptid;
+ if (deptid == otherDeptid)
+ return 0;
+ else if (deptid < otherDeptid)
+ return -1;
+ return 1;
+ }
+
+ }
+
+}
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Employee.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Employee.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Employee.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Employee.java Sun May 22 11:40:13 2005
@@ -0,0 +1,259 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.xempdept;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Date;
+
+public class Employee
+ extends Person
+ implements Serializable, Identifiable
+{
+ private long empid;
+ private Date hiredate;
+ private double weeklyhours;
+ private char discriminator;
+ private HashSet reviewedProjects;
+ private HashSet projects;
+ private Insurance insurance;
+ private Department department;
+ private Employee manager;
+ private HashSet team;
+ private Employee mentor;
+ private Employee protege;
+ private Employee hradvisor;
+ private HashSet hradvisees;
+
+ public Object getOid()
+ {
+ Oid oid = new Oid();
+ oid.empid = this.empid;
+ return oid;
+ }
+
+ public String toString()
+ {
+ StringBuffer repr = new StringBuffer();
+ addFieldRepr(repr);
+ return "Employee(" + repr.toString() + ")";
+ }
+
+ public Employee() {}
+
+ public Employee(long empid,
+ String lastname,
+ String firstname,
+ Date hiredate,
+ Date birthdate,
+ double weeklyhours,
+ char discriminator,
+ HashSet reviewedProjects,
+ HashSet projects,
+ Insurance insurance,
+ Department department,
+ Employee manager,
+ HashSet team,
+ Employee mentor,
+ Employee protege,
+ Employee hradvisor,
+ HashSet hradvisees)
+ {
+ super(lastname, firstname, birthdate);
+ this.empid = empid;
+ this.hiredate = hiredate;
+ this.weeklyhours = weeklyhours;
+ this.discriminator = discriminator;
+ this.reviewedProjects = reviewedProjects;
+ this.projects = projects;
+ this.insurance = insurance;
+ this.department = department;
+ this.manager = manager;
+ this.team = team;
+ this.mentor = mentor;
+ this.protege = protege;
+ this.hradvisor = hradvisor;
+ this.hradvisees = hradvisees;
+ }
+
+ public long getEmpid() {
+ return empid;
+ }
+
+ public void setEmpid(long empid) {
+ this.empid = empid;
+ }
+
+ public Date getHiredate() {
+ return hiredate;
+ }
+
+ public void setHiredate(Date hiredate) {
+ this.hiredate = hiredate;
+ }
+
+ public double getWeeklyhours() {
+ return weeklyhours;
+ }
+
+ public void setWeeklyhours(double weeklyhours) {
+ this.weeklyhours = weeklyhours;
+ }
+
+ public char getDiscriminator() {
+ return discriminator;
+ }
+
+ public void setDiscriminator(char discriminator) {
+ this.discriminator = discriminator;
+ }
+
+ public HashSet getReviewedProjects() {
+ return reviewedProjects;
+ }
+
+ public void setReviewedProjects(HashSet reviewedProjects) {
+ this.reviewedProjects = reviewedProjects;
+ }
+
+ public HashSet getProjects() {
+ return projects;
+ }
+
+ public void setProjects(HashSet projects) {
+ this.projects = projects;
+ }
+
+ public Insurance getInsurance() {
+ return insurance;
+ }
+
+ public void setInsurance(Insurance insurance) {
+ this.insurance = insurance;
+ }
+
+ public Department getDepartment() {
+ return department;
+ }
+
+ public void setDepartment(Department department) {
+ this.department = department;
+ }
+
+ public Employee getManager() {
+ return manager;
+ }
+
+ public void setManager(Employee manager) {
+ this.manager = manager;
+ }
+
+ public HashSet getTeam() {
+ return team;
+ }
+
+ public void setTeam(HashSet team) {
+ this.team = team;
+ }
+
+ public Employee getMentor() {
+ return mentor;
+ }
+
+ public void setMentor(Employee mentor) {
+ this.mentor = mentor;
+ }
+
+ public Employee getProtege() {
+ return protege;
+ }
+
+ public void setProtege(Employee protege) {
+ this.protege = protege;
+ }
+
+ public Employee getHradvisor() {
+ return hradvisor;
+ }
+
+ public void setHradvisor(Employee hradvisor) {
+ this.hradvisor = hradvisor;
+ }
+
+ public HashSet getHradvisees() {
+ return hradvisees;
+ }
+
+ public void setHradvisees(HashSet hradvisees) {
+ this.hradvisees = hradvisees;
+ }
+
+ protected void addFieldRepr(StringBuffer repr)
+ {
+ super.addFieldRepr(repr);
+ repr.append(", empid="); repr.append(empid);
+ repr.append(", hiredate="); repr.append(hiredate);
+ repr.append(", weeklyhours="); repr.append(weeklyhours);
+ repr.append(", reviewedProjects="); repr.append(((reviewedProjects==null) ? 0 : reviewedProjects.size()));
+ repr.append(", projects="); repr.append(((projects==null) ? 0 : projects.size()));
+ repr.append(", insurance="); repr.append(((insurance==null) ? "null" : insurance.getCarrier()));
+ repr.append(", department="); repr.append(((department==null) ? "null" : department.getName()));
+ repr.append(", manager="); repr.append(((manager==null) ? "null" : manager.getLastname()));
+ repr.append(", team="); repr.append(((team==null) ? 0 : team.size()));
+ repr.append(", mentor="); repr.append(((mentor==null) ? "null" : mentor.getLastname()));
+ repr.append(", protege="); repr.append(((protege==null) ? "null" : protege.getLastname()));
+ repr.append(", hradvisor="); repr.append(((hradvisor==null) ? "null" : hradvisor.getLastname()));
+ repr.append(", hradvisees="); repr.append(((hradvisees ==null) ? 0 : hradvisees.size()));
+ }
+
+ public static class Oid implements Serializable, Comparable {
+
+ public long empid;
+
+ public Oid() {
+ }
+
+ public boolean equals(java.lang.Object obj) {
+ if( obj==null ||
+ !this.getClass().equals(obj.getClass()) ) return( false );
+ Oid o=(Oid) obj;
+ if( this.empid!=o.empid ) return( false );
+ return( true );
+ }
+
+ public int hashCode() {
+ int hashCode=0;
+ hashCode += empid;
+ return( hashCode );
+ }
+
+ public int compareTo(Object o) {
+ if (o == null)
+ throw new ClassCastException();
+ if (o == this)
+ return 0;
+ long otherEmpid = ((Oid)o).empid;
+ if (empid == otherEmpid)
+ return 0;
+ else if (empid < otherEmpid)
+ return -1;
+ return 1;
+ }
+ }
+
+}
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/FullTimeEmployee.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/FullTimeEmployee.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/FullTimeEmployee.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/FullTimeEmployee.java Sun May 22 11:40:13 2005
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.xempdept;
+
+import java.util.HashSet;
+import java.util.Date;
+
+public class FullTimeEmployee
+ extends Employee
+{
+ private double salary;
+
+ public String toString()
+ {
+ StringBuffer repr = new StringBuffer();
+ addFieldRepr(repr);
+ return "FullTimeEmployee(" + repr.toString() + ")";
+ }
+
+ public FullTimeEmployee() {}
+
+ public FullTimeEmployee(long empid,
+ String lastname,
+ String firstname,
+ Date hiredate,
+ Date birthdate,
+ double weeklyhours,
+ char discriminator,
+ HashSet reviewedProjects,
+ HashSet projects,
+ Insurance insurance,
+ Department department,
+ Employee manager,
+ HashSet team,
+ Employee mentor,
+ Employee protege,
+ Employee hradvisor,
+ HashSet hradvisees,
+ double salary)
+ {
+ super(empid, lastname, firstname, hiredate, birthdate, weeklyhours,
+ discriminator, reviewedProjects, projects, insurance, department,
+ manager, team, mentor, protege, hradvisor, hradvisees);
+ this.salary = salary;
+ }
+
+ public double getSalary()
+ {
+ return salary;
+ }
+
+ public void setSalary(double salary)
+ {
+ this.salary = salary;
+ }
+
+ protected void addFieldRepr(StringBuffer repr)
+ {
+ super.addFieldRepr(repr);
+ repr.append(", salary="); repr.append(salary);
+ }
+}
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Identifiable.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Identifiable.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Identifiable.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Identifiable.java Sun May 22 11:40:13 2005
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.xempdept;
+
+public interface Identifiable
+{
+ public Object getOid();
+}
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Insurance.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Insurance.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Insurance.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Insurance.java Sun May 22 11:40:13 2005
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.xempdept;
+
+import java.io.Serializable;
+import java.util.HashSet;
+
+public class Insurance implements Serializable, Identifiable {
+
+ private long insid;
+ private String carrier;
+ private Employee employee;
+
+ public Object getOid() {
+ Oid oid = new Oid();
+ oid.insid = this.insid;
+ return oid;
+ }
+
+ public String toString() {
+ return "Insurance(" + carrier +
+ ", insid=" + insid +
+ ", employee=" + ((employee==null) ? "null" : employee.getLastname()) +
+ ")";
+ }
+
+ public Insurance() {
+ }
+
+ public Insurance(long insid,
+ String carrier,
+ Employee employee) {
+ this.insid = insid;
+ this.carrier = carrier;
+ this.employee = employee;
+ }
+
+ public long getInsid() {
+ return insid;
+ }
+
+ public void setInsid(long insid) {
+ this.insid = insid;
+ }
+
+ public String getCarrier() {
+ return carrier;
+ }
+
+ public void setCarrier(String carrier) {
+ this.carrier = carrier;
+ }
+
+ public Employee getEmployee() {
+ return employee;
+ }
+
+ public void setEmployee(Employee employee) {
+ this.employee = employee;
+ }
+
+ public static class Oid implements Serializable, Comparable {
+
+ public long insid;
+
+ public Oid() {
+ }
+
+ public boolean equals(java.lang.Object obj) {
+ if( obj==null ||
+ !this.getClass().equals(obj.getClass()) ) return( false );
+ Oid o=(Oid) obj;
+ if( this.insid!=o.insid ) return( false );
+ return( true );
+ }
+
+ public int hashCode() {
+ int hashCode=0;
+ hashCode += insid;
+ return( hashCode );
+ }
+
+ public int compareTo(Object o) {
+ if (o == null)
+ throw new ClassCastException();
+ if (o == this)
+ return 0;
+ long otherInsid = ((Oid)o).insid;
+ if (insid == otherInsid)
+ return 0;
+ else if (insid < otherInsid)
+ return -1;
+ return 1;
+ }
+ }
+
+}
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/PartTimeEmployee.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/PartTimeEmployee.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/PartTimeEmployee.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/PartTimeEmployee.java Sun May 22 11:40:13 2005
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.xempdept;
+
+import java.util.HashSet;
+import java.util.Date;
+
+public class PartTimeEmployee
+ extends Employee
+{
+ private double wage;
+
+ public String toString()
+ {
+ StringBuffer repr = new StringBuffer();
+ addFieldRepr(repr);
+ return "PartTimeEmployee(" + repr.toString() + ")";
+ }
+
+ public PartTimeEmployee() {}
+
+ public PartTimeEmployee(long empid,
+ String lastname,
+ String firstname,
+ Date hiredate,
+ Date birthdate,
+ double weeklyhours,
+ char discriminator,
+ HashSet reviewedProjects,
+ HashSet projects,
+ Insurance insurance,
+ Department department,
+ Employee manager,
+ HashSet team,
+ Employee mentor,
+ Employee protege,
+ Employee hradvisor,
+ HashSet hradvisees,
+ double wage)
+ {
+ super(empid, lastname, firstname, hiredate, birthdate, weeklyhours,
+ discriminator, reviewedProjects, projects, insurance, department,
+ manager, team, mentor, protege, hradvisor, hradvisees);
+ this.wage = wage;
+ }
+
+ public double getWage()
+ {
+ return wage;
+ }
+
+ public void setWage(double wage)
+ {
+ this.wage = wage;
+ }
+
+ protected void addFieldRepr(StringBuffer repr)
+ {
+ super.addFieldRepr(repr);
+ repr.append(", wage="); repr.append(wage);
+ }
+}
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Person.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Person.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Person.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Person.java Sun May 22 11:40:13 2005
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.xempdept;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public abstract class Person
+ implements Serializable
+{
+ private String lastname;
+ private String firstname;
+ private Date birthdate;
+
+ public Person() {}
+
+ public Person(String lastname,
+ String firstname,
+ Date birthdate)
+ {
+ this.lastname = lastname;
+ this.firstname = firstname;
+ this.birthdate = birthdate;
+ }
+
+ public String getLastname() {
+ return lastname;
+ }
+
+ public void setLastname(String lastname) {
+ this.lastname = lastname;
+ }
+
+ public String getFirstname() {
+ return firstname;
+ }
+
+ public void setFirstname(String firstname) {
+ this.firstname = firstname;
+ }
+
+ public Date getBirthdate() {
+ return birthdate;
+ }
+
+ public void setBirthdate(Date birthdate) {
+ this.birthdate = birthdate;
+ }
+
+ protected void addFieldRepr(StringBuffer repr)
+ {
+ repr.append("firstname="); repr.append(firstname);
+ repr.append(", lastname="); repr.append(lastname);
+ repr.append(", birthdate="); repr.append(birthdate);
+ }
+}
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/PrimitiveTypes.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/PrimitiveTypes.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/PrimitiveTypes.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/PrimitiveTypes.java Sun May 22 11:40:13 2005
@@ -0,0 +1,321 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.xempdept;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Date;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+public class PrimitiveTypes implements Serializable, Identifiable {
+
+ private long id;
+ private boolean booleanNotNull;
+ private Boolean booleanNull;
+ private byte byteNotNull;
+ private Byte byteNull;
+ private short shortNotNull;
+ private Short shortNull;
+ private int intNotNull;
+ private Integer intNull;
+ private long longNotNull;
+ private Long longNull;
+ private float floatNotNull;
+ private Float floatNull;
+ private double doubleNotNull;
+ private Double doubleNull;
+ private char charNotNull;
+ private Character charNull;
+ private Date dateNull;
+ private String stringNull;
+ private BigDecimal bigDecimal;
+ private BigInteger bigInteger;
+ private Long PrimitiveTypes;
+
+ public Object getOid() {
+ Oid oid = new Oid();
+ oid.id = this.id;
+ return oid;
+ }
+
+ public String toString() {
+ return "PrimitiveTypes(" + id + ")";
+ }
+
+ public PrimitiveTypes() {
+ }
+
+ public PrimitiveTypes(long id,
+ boolean booleanNotNull,
+ Boolean booleanNull,
+ byte byteNotNull,
+ Byte byteNull,
+ short shortNotNull,
+ Short shortNull,
+ int intNotNull,
+ Integer intNull,
+ long longNotNull,
+ Long longNull,
+ float floatNotNull,
+ Float floatNull,
+ double doubleNotNull,
+ Double doubleNull,
+ char charNotNull,
+ Character charNull,
+ Date dateNull,
+ String stringNull,
+ BigDecimal bigDecimal,
+ BigInteger bigInteger,
+ Long PrimitiveTypes) {
+ this.id = id;
+ this.booleanNotNull = booleanNotNull;
+ this.booleanNull = booleanNull;
+ this.byteNotNull = byteNotNull;
+ this.byteNull = byteNull;
+ this.shortNotNull = shortNotNull;
+ this.shortNull = shortNull;
+ this.intNotNull = intNotNull;
+ this.intNull = intNull;
+ this.longNotNull = longNotNull;
+ this.longNull =longNull;
+ this.floatNotNull = floatNotNull;
+ this.floatNull =floatNull;
+ this.doubleNotNull = doubleNotNull;
+ this.doubleNull = doubleNull;
+ this.charNotNull = charNotNull;
+ this.charNull = charNull;
+ this.dateNull = dateNull;
+ this.stringNull = stringNull;
+ this.bigDecimal = bigDecimal;
+ this.bigInteger = bigInteger;
+ this.PrimitiveTypes = PrimitiveTypes;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public boolean getBooleanNotNull() {
+ return booleanNotNull;
+ }
+
+ public void setBooleanNotNull(boolean booleanNotNull) {
+ this.booleanNotNull = booleanNotNull;
+ }
+
+ public Boolean getBooleanNull() {
+ return booleanNull;
+ }
+
+ public void setBooleanNull(Boolean booleanNull) {
+ this.booleanNull = booleanNull;
+ }
+
+ public byte getByteNotNull() {
+ return byteNotNull;
+ }
+
+ public void setByteNotNull(byte byteNotNull) {
+ this.byteNotNull = byteNotNull;
+ }
+
+ public Byte getByteNull() {
+ return byteNull;
+ }
+
+ public void setByteNull(Byte byteNull) {
+ this.byteNull = byteNull;
+ }
+
+ public short getShortNotNull() {
+ return shortNotNull;
+ }
+
+ public void setShortNotNull(short shortNotNull) {
+ this.shortNotNull = shortNotNull;
+ }
+
+ public Short getShortNull() {
+ return shortNull;
+ }
+
+ public void setShortNull(Short shortNull) {
+ this.shortNull = shortNull;
+ }
+
+ public int getIntNotNull() {
+ return intNotNull;
+ }
+
+ public void setIntNotNull(int intNotNull) {
+ this.intNotNull = intNotNull;
+ }
+
+ public Integer getIntNull() {
+ return intNull;
+ }
+
+ public void setIntNull(Integer intNull) {
+ this.intNull = intNull;
+ }
+
+ public long getLongNotNull() {
+ return longNotNull;
+ }
+
+ public void setLongNotNull(long longNotNull) {
+ this.longNotNull = longNotNull;
+ }
+
+ public Long getLongNull() {
+ return longNull;
+ }
+
+ public void setLongNull(Long longNull) {
+ this.longNull = longNull;
+ }
+
+ public float getFloatNotNull() {
+ return floatNotNull;
+ }
+
+ public void setFloatNotNull(float floatNotNull) {
+ this.floatNotNull = floatNotNull;
+ }
+
+ public Float getFloatNull() {
+ return floatNull;
+ }
+
+ public void setFloatNull(Float floatNull) {
+ this.floatNull = floatNull;
+ }
+
+ public double getDoubleNotNull() {
+ return doubleNotNull;
+ }
+
+ public void setDoubleNotNull(double doubleNotNull) {
+ this.doubleNotNull = doubleNotNull;
+ }
+
+ public Double getDoubleNull() {
+ return doubleNull;
+ }
+
+ public void setDoubleNull(Double doubleNull) {
+ this.doubleNull = doubleNull;
+ }
+
+ public char getCharNotNull() {
+ return charNotNull;
+ }
+
+ public void setCharNotNull(char charNotNull) {
+ this.charNotNull = charNotNull;
+ }
+
+ public Character getCharNull() {
+ return charNull;
+ }
+
+ public void setCharNull(Character charNull) {
+ this.charNull = charNull;
+ }
+
+ public Date getDateNull() {
+ return dateNull;
+ }
+
+ public void setDateNull(Date dateNull) {
+ this.dateNull = dateNull;
+ }
+
+ public String getStringNull() {
+ return stringNull;
+ }
+
+ public void setStringNull(String stringNull) {
+ this.stringNull = stringNull;
+ }
+
+ public BigDecimal getBigDecimal() {
+ return bigDecimal;
+ }
+
+ public void setBigDecimal(BigDecimal bigDecimal) {
+ this.bigDecimal = bigDecimal;
+ }
+
+ public BigInteger getBigInteger() {
+ return bigInteger;
+ }
+
+ public void setBigInteger(BigInteger bigInteger) {
+ this.bigInteger = bigInteger;
+ }
+
+ public Long getPrimitiveTypes() {
+ return PrimitiveTypes;
+ }
+
+ public void setPrimitiveTypes(Long primitiveTypes) {
+ this.PrimitiveTypes = PrimitiveTypes;
+ }
+
+ public static class Oid implements Serializable, Comparable {
+
+ public long id;
+
+ public Oid() {
+ }
+
+ public boolean equals(java.lang.Object obj) {
+ if( obj==null ||
+ !this.getClass().equals(obj.getClass()) ) return( false );
+ Oid o=(Oid) obj;
+ if( this.id!=o.id ) return( false );
+ return( true );
+ }
+
+ public int hashCode() {
+ int hashCode=0;
+ hashCode += id;
+ return( hashCode );
+ }
+
+ public int compareTo(Object o) {
+ if (o == null)
+ throw new ClassCastException();
+ if (o == this)
+ return 0;
+ long otherId = ((Oid)o).id;
+ if (id == otherId)
+ return 0;
+ else if (id < otherId)
+ return -1;
+ return 1;
+ }
+ }
+
+}
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Project.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Project.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Project.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/Project.java Sun May 22 11:40:13 2005
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.pc.xempdept;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.math.BigDecimal;
+
+public class Project implements Serializable, Identifiable {
+
+ private long projid;
+ private String name;
+ private BigDecimal budget;
+ private HashSet reviewers;
+ private HashSet employees;
+
+ public Object getOid() {
+ Oid oid = new Oid();
+ oid.projid = this.projid;
+ return oid;
+ }
+
+ public String toString() {
+ return "Project(" + name +
+ ", projid=" + projid +
+ ", budget=" + budget +
+ ", reviewers=" + ((reviewers==null) ? 0 : reviewers.size()) +
+ ", employees=" + ((employees==null) ? 0 : employees.size()) +
+ ")";
+ }
+
+ public Project() {
+ }
+
+ public Project(long projid,
+ String name,
+ BigDecimal budget,
+ HashSet reviewers,
+ HashSet employees) {
+ this.projid = projid;
+ this.name = name;
+ this.budget = budget;
+ this.reviewers = reviewers;
+ this.employees = employees;
+ }
+
+ public long getProjid() {
+ return projid;
+ }
+
+ public void setProjid(long projid) {
+ this.projid = projid;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public BigDecimal getBudget() {
+ return budget;
+ }
+
+ public void setBudget(BigDecimal budget) {
+ this.budget = budget;
+ }
+
+ public HashSet getReviewers() {
+ return reviewers;
+ }
+
+ public void setReviewers(HashSet reviewers) {
+ this.reviewers = reviewers;
+ }
+
+ public HashSet getEmployees() {
+ return employees;
+ }
+
+ public void setEmployees(HashSet employees) {
+ this.employees = employees;
+ }
+
+ public static class Oid implements Serializable, Comparable {
+
+ public long projid;
+
+ public Oid() {
+ }
+
+ 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() {
+ int hashCode=0;
+ hashCode += projid;
+ return( hashCode );
+ }
+
+ public int compareTo(Object o) {
+ if (o == null)
+ throw new ClassCastException();
+ if (o == this)
+ return 0;
+ long otherProjid = ((Oid)o).projid;
+ if (projid == otherProjid)
+ return 0;
+ else if (projid < otherProjid)
+ return -1;
+ return 1;
+ }
+
+ }
+
+}
+
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/xempdept.jpg
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/xempdept.jpg?rev=171355&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/xempdept/xempdept.jpg
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/test/EmpDeptSupport.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/test/EmpDeptSupport.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/test/EmpDeptSupport.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/test/EmpDeptSupport.java Sun May 22 11:40:13 2005
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.test;
+
+import java.util.*;
+
+import javax.jdo.*;
+
+import org.apache.jdo.test.util.AbstractTest;
+
+import org.apache.jdo.pc.empdept.PCDepartment;
+import org.apache.jdo.pc.empdept.PCEmployee;
+import org.apache.jdo.pc.empdept.PCFullTimeEmployee;
+import org.apache.jdo.pc.empdept.PCInsurance;
+import org.apache.jdo.pc.empdept.PCPartTimeEmployee;
+import org.apache.jdo.pc.empdept.PCProject;
+
+/**
+* This class is the superclass for test classes Test_Inheritance and
+* Test_StringOID and provides common code.
+*
+* @author Michael Bouschen
+*/
+class EmpDeptSupport extends AbstractTest {
+
+ protected HashSet persistentInstances = new HashSet (9);
+
+ // We override this from AbstractTest and insert our own objects.
+ // Use Test_Extent to read them back.
+ protected void insertObjects() {
+ PersistenceManager pm = null;
+ Transaction tx = null;
+ try {
+ pm = pmf.getPersistenceManager();
+ tx = pm.currentTransaction();
+ tx.begin();
+ createObjects(pm);
+ checkObjects(pm);
+ tx.commit();
+ }
+ finally {
+ if (tx != null && tx.isActive())
+ tx.rollback();
+ if (pm != null && !pm.isClosed())
+ pm.close();
+ }
+ }
+
+ protected void createObjects(PersistenceManager pm) {
+ // Create and set up employees. Scott is Ed's manager. Ed is
+ // Scott's sole employee.
+ //
+ HashSet h;
+
+ GregorianCalendar born =
+ new GregorianCalendar(TimeZone.getTimeZone("America/New_York"));
+ GregorianCalendar hired =
+ new GregorianCalendar(TimeZone.getTimeZone("America/New_York"));
+
+ born.set(1969, 7, 20);
+ hired.set(1982, 5, 5);
+ PCEmployee scott =
+ new PCFullTimeEmployee(
+ "Scott", "McNealy", born.getTime(),
+ 1L, hired.getTime(),
+ 200000.0);
+ born.set(1960, 4, 8);
+ hired.set(1985, 2, 3);
+ PCEmployee ed =
+ new PCPartTimeEmployee(
+ "Ed", "Zander", born.getTime(),
+ 100L, hired.getTime(),
+ 400000.0);
+
+ ed.setManager(scott);
+
+ h = new HashSet();
+ h.add(ed);
+ scott.setEmployees(h);
+
+ // Set up their departments.
+ PCDepartment board =
+ new PCDepartment(100L, "board");
+ h = new HashSet();
+ h.add(scott);
+ board.setEmployees(h);
+ scott.setDepartment(board);
+
+ PCDepartment emg =
+ new PCDepartment(200L, "emg");
+ h = new HashSet();
+ h.add(ed);
+ emg.setEmployees(h);
+ ed.setDepartment(emg);
+
+ // Insure these guys
+ PCInsurance scottIns = new PCInsurance(1000, "Aetna", scott);
+ PCInsurance edIns = new PCInsurance(1001, "BlueCross", ed);
+ scott.setInsurance(scottIns);
+ ed.setInsurance(edIns);
+
+ // Give them some projects to work on. Scott works on both; Ed only
+ // on one.
+ PCProject solaris = new PCProject(1L, "Solaris");
+ PCProject sparc = new PCProject(2L, "Sparc");
+ h = new HashSet();
+ h.add(scott);
+ h.add(ed);
+ solaris.setEmployees(h); // Solaris is worked on by Scott and Ed
+
+ h = new HashSet();
+ h.add(scott);
+ sparc.setEmployees(h); // Sparc is worked on by Scott
+
+ h = new HashSet();
+ h.add(solaris);
+ h.add(sparc);
+ scott.setProjects(h); // Scott works on Solaris and Sparc
+
+ h = new HashSet();
+ h.add(solaris);
+ ed.setProjects(h); // Ed works on Solaris
+
+ // Show what we've got
+ if (debug) {
+ logger.debug("Before insert: ");
+ logger.debug(scott.toString());
+ logger.debug(ed.toString());
+ logger.debug(board.toString());
+ logger.debug(emg.toString());
+ logger.debug(scottIns.toString());
+ logger.debug(edIns.toString());
+ logger.debug(solaris.toString());
+ logger.debug(sparc.toString());
+ }
+
+ // Make it all persistent. If reachability were implemented, we'd
+ // only have to make scott and ed persistent, as everything else is
+ // reachable from them.
+ pm.makePersistent(scott);
+ persistentInstances.add(scott);
+ pm.makePersistent(ed);
+ persistentInstances.add(ed);
+ pm.makePersistent(board);
+ persistentInstances.add(board);
+ pm.makePersistent(emg);
+ persistentInstances.add(emg);
+ pm.makePersistent(scottIns);
+ persistentInstances.add(scottIns);
+ pm.makePersistent(edIns);
+ persistentInstances.add(edIns);
+ pm.makePersistent(solaris);
+ persistentInstances.add(solaris);
+ pm.makePersistent(sparc);
+ persistentInstances.add(sparc);
+ }
+
+ /** This method can be overridden by a subclass to perform special checks.
+ */
+ protected void checkObjects(PersistenceManager pm) {
+ }
+
+}
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/test/Point.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/test/Point.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/test/Point.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/test/Point.java Sun May 22 11:40:13 2005
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.test;
+
+import org.apache.jdo.test.util.Util;
+
+/**
+* A simple class with two fields
+*
+* @author Dave Bristor
+*/
+public class Point {
+ public int x;
+ public Integer y;
+
+ public Point() { }
+
+ public Point(int x, int y) {
+ this.x = x;
+ this.y = new Integer(y);
+ }
+
+ public Point(int x, Integer y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ public String toString() {
+ String rc = null;
+ try {
+ rc = Util.getClassName(this) + name();
+ } catch (NullPointerException ex) {
+ rc = "NPE getting Point's values";
+ }
+ return rc;
+ }
+
+ void setX(int x) {
+ this.x = x;
+ }
+
+ public int getX() {
+ return x;
+ }
+
+ void setY(Integer y) {
+ this.y = y;
+ }
+
+ public Integer getY() {
+ return y;
+ }
+
+ public String name() {
+ return " x: " + getX() + ", y: " + getY().intValue();
+ }
+}