Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCPoint.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCPoint.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCPoint.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCPoint.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,108 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.pc; + +import java.io.Serializable; +import java.util.Comparator; +import java.util.Iterator; +import java.util.TreeSet; + +import org.apache.jdo.test.util.Util; + + +/** +* A simple class with two fields +* +* @author Dave Bristor +*/ +public class PCPoint implements Serializable { + public int x; + public Integer y; + + public PCPoint() { } + + public PCPoint(int x, int y) { + this.x = x; + this.y = new Integer(y); + } + + public PCPoint(int x, Integer y) { + this.x = x; + this.y = y; + } + + public boolean equals(Object o) { + if ((o == null) || !(o instanceof PCPoint)) + return false; + PCPoint other = (PCPoint)o; + if (x != other.x) + return false; + if (y == null) + return other.y == null; + else if (other.y == null) + return y == null; + else + return y.intValue() == other.y.intValue(); + } + + public String toString() { + String rc = null; + try { + rc = Util.getClassName(this) + name(); + } catch (NullPointerException ex) { + rc = "NPE getting PCPoint's values"; + } + return rc; + } + + public void setX(int x) { + this.x = x; + } + + public int getX() { + return x; + } + + public void setY(Integer y) { + this.y = y; + } + + public Integer getY() { + return y; + } + + public String name() { + return " x: " + getX() + ", y: " + getY().intValue(); + } + + public static Iterator getSortedIterator(Iterator i) { + TreeSet sorted = new TreeSet(new Comparator() { + public int compare(Object o1, Object o2) { + return (((PCPoint)o1).x - ((PCPoint)o2).x); + } + public boolean equals(Object obj) { + return obj.equals(this); + } + }); + + while(i.hasNext()) { + Object o = i.next(); + sorted.add(o); + } + return sorted.iterator(); + } +}
Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCPoint1.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCPoint1.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCPoint1.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCPoint1.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,74 @@ +/* + * 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; + +import java.io.Serializable; + +import org.apache.jdo.test.util.Util; + + +/** +* A simple class with two fields for application identity +* +* @author Marina Vatkina +*/ +public class PCPoint1 implements Serializable { + public int x; + public Integer y; + + public PCPoint1() { } + + public PCPoint1(int x, int y) { + this.x = x; + this.y = new Integer(y); + } + + public PCPoint1(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 PCPoint1's values"; + } + return rc; + } + + public void setX(int x) { + this.x = x; + } + + public int getX() { + return x; + } + + public void setY(Integer y) { + this.y = y; + } + + public Integer getY() { + return y; + } + + public String name() { + return " x: " + getX() + ", y: " + getY().intValue(); + } +} Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCPoint1Key.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCPoint1Key.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCPoint1Key.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCPoint1Key.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,46 @@ +/* + * 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; + +import java.io.Serializable; + +/** +* A simple key class with one field +* +* @author Marina Vatkina +*/ +public class PCPoint1Key implements Serializable { + public int x; + + static final Class cls = org.apache.jdo.pc.PCPoint1.class; + + public PCPoint1Key() {} + + //public PCPoint1Key(String s) { x = Integer.parseInt(s); } + + public String toString() { return this.getClass().getName() + ": " + x;} + + public int hashCode() { return x ; } + + public boolean equals(Object other) { + if (other instanceof PCPoint1Key) { + PCPoint1Key k = (PCPoint1Key)other; + return k.x == this.x; + } + return false; + } +} Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCPrimitive.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCPrimitive.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCPrimitive.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCPrimitive.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,174 @@ +/* + * 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; + +import org.apache.jdo.test.util.Util; + +/** +* A class that has an instance of each primitive, and of each of Java's +* basic/simple immutable types. For the latter, we also have a null +* equivalent, to be certain that we can store nulls. +* +* @author Dave Bristor +*/ +public class PCPrimitive { + public boolean _boolean; + public char _char; + public byte _byte; + public short _short; + public int _int; + public long _long; + public float _float; + public double _double; + public String _String; + public String _nullString; + public Boolean _Boolean; + public Boolean _nullBoolean; + public Character _Char; + public Character _nullChar; + public Byte _Byte; + public Byte _nullByte; + public Short _Short; + public Short _nullShort; + public Integer _Int; + public Integer _nullInt; + public Long _Long; + public Long _nullLong; + public Float _Float; + public Float _nullFloat; + public Double _Double; + public Double _nullDouble; + public Number _Number; + public Number _nullNumber; + + public PCPrimitive() { } + + // Create a PCPrimitive with "interesting" values. + public void init() { + _boolean = true; + _char = 'z'; + _byte = 0xf; + _short = 10; + _int = 42; + _long = Long.MAX_VALUE; + _float = 6.02e+23f; + _double = Double.MAX_VALUE; + _String = "hello, world"; + _nullString = null; + _Boolean = new Boolean(_boolean); + _nullBoolean = null; + _Char = new Character(_char); + _nullChar = null; + _Byte = new Byte(_byte); + _nullByte = null; + _Short = new Short(_short); + _nullShort = null; + _Int = new Integer(_int); + _nullInt = null; + _Long = new Long(_long); + _nullLong = null; + _Float = new Float(_float); + _nullFloat = null; + _Double = new Double(_double); + _nullDouble = null; + _Number = new Double(_double); + _nullNumber = null; + } + + public boolean equals(Object o) { + boolean rc = false; + if (null != o && o instanceof PCPrimitive) { + PCPrimitive other = (PCPrimitive)o; + rc = + (_boolean == other._boolean) && + (_char == other._char) && + (_short == other._short) && + (_int == other._int) && + (_long == other._long) && + (_float == other._float) && + (_double == other._double) && + _String.equals(other._String) && + (_nullString == other._nullString) && + _Boolean.equals(other._Boolean) && + (_nullBoolean == other._nullBoolean) && + _Char.equals(other._Char) && + (_nullChar == other._nullChar) && + _Byte.equals(other._Byte) && + (_nullByte == other._nullByte) && + _Short.equals(other._Short) && + (_nullShort == other._nullShort) && + _Int.equals(other._Int) && + (_nullInt == other._nullInt) && + _Long.equals(other._Long) && + (_nullLong == other._nullLong) && + _Float.equals(other._Float) && + (_nullFloat == other._nullFloat) && + _Double.equals(other._Double) && + (_nullDouble == other._nullDouble) && + _Number.equals(other._Number) && + (_nullNumber == other._nullNumber); + } + return rc; + } + + public String toString() { + String rc = null; + try { + return Util.getClassName(this) + + "\n_boolean: " + _boolean + + "\n_char: " + _char + + "\n_byte: " + _byte + + "\n_short: " + _short + + "\n_int: " + _int + + "\n_long: " + _long + + "\n_float: " + _float + + "\n_double: " + _double + + + "\n_String: " + _String + + "\n_nullString: " + _nullString + + + "\n_Boolean: " + _Boolean + + "\n_nullBoolean: " + _nullBoolean + + + "\n_Char: " + _Char + + "\n_nullChar: " + _nullChar + + + "\n_Byte: " + _Byte + + "\n_nullByte: " + _nullByte + + + "\n_Short: " + _Short + + "\n_nullShort: " + _nullShort + + + "\n_Int: " + _Int + + "\n_nullInt: " + _nullInt + + + "\n_Long: " + _Long + + "\n_nullLong: " + _nullLong + + + "\n_Float: " + _Float + + "\n_nullFloat: " + _nullFloat + + + "\n_Double: " + _Double + + "\n_nullDouble: " + _nullDouble + + + "\n_Number: " + _Number + + "\n_nullNumber: " + _nullNumber; + } catch (NullPointerException ex) { + return "PCPrimitive has no values"; + } + } +} Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCProject.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCProject.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCProject.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCProject.java Fri Mar 18 17:02:29 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; + +import java.util.HashSet; + +/** +* A sample project class, generated from an SQL schema. +*/ +public class PCProject { + 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/ri11/test/java/org/apache/jdo/pc/PCProject1.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCProject1.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCProject1.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCProject1.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,93 @@ +/* + * 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; + +/** +* A extended project class that differs from PCProject class +* in the type of the relationship field: it is Map of the +* employees. +* +* @author Marina Vatkina +*/ +public class PCProject1 { + public long projid; + + public String name; + + public java.util.Map employees; + + public String toString() { + return "Project: " + name + ", id=" + projid + + ", emps: " + employees.entrySet().size(); + } + + public PCProject1() { + } + + public PCProject1(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.Map getEmployees() { + return employees; + } + + public void setEmployees(java.util.Map 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/ri11/test/java/org/apache/jdo/pc/PCRect.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCRect.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCRect.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCRect.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,64 @@ +/* + * 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; + +import org.apache.jdo.test.util.Util; + +/** +* Test for instances containing instances of a user-defined class. +* +* @author Dave Bristor +*/ +public class PCRect { + public PCPoint upperLeft; + public PCPoint lowerRight; + + public PCRect() { } + + public PCRect(PCPoint ul, PCPoint lr) { + upperLeft = ul; + lowerRight = lr; + } + + public PCPoint getUpperLeft() { + return upperLeft; + } + + public void setUpperLeft(PCPoint upperLeft) { + this.upperLeft = upperLeft; + } + + public PCPoint getLowerRight() { + return lowerRight; + } + + public void setLowerRight(PCPoint lowerRight) { + this.lowerRight = lowerRight; + } + + public String toString() { + String rc = null; + try { + rc = Util.getClassName(this) + + " ul: " + getUpperLeft().name() + + " lr: " + getLowerRight().name(); + } catch (NullPointerException ex) { + rc = "NPE getting PCRect's values"; + } + return rc; + } +} Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCRefArrays.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCRefArrays.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCRefArrays.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCRefArrays.java Fri Mar 18 17:02:29 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; + +import java.lang.reflect.Array; + +import org.apache.jdo.test.util.Util; + + +/** +* Test that arrays can refer to PersistenceCapable instances +* +* @author Dave Bristor +*/ +public class PCRefArrays { + public PCPoint _pcpointArray[]; + + public PCRefArrays() { } + + public void init(PCPoint p1, PCPoint p2) { + _pcpointArray = new PCPoint[] { p1, p2 }; + } + + String stringify(Object arr, String name) { + StringBuffer rc =new StringBuffer("\n").append(name).append(": "); + + if (null == arr) { + rc.append(" __null__"); + } else try { + int length = Array.getLength(arr); + if (0 == length) { + rc.append(" __empty__"); + } else { + for (int i = 0; i < length; i++) { + if (i > 0) { + rc.append(","); + } + rc.append(" " + Array.get(arr, i)); + } + } + } catch (IllegalArgumentException ex) { + throw new RuntimeException("illegal argument: " + arr.getClass().getName()); + } catch (ArrayIndexOutOfBoundsException ex) { + throw new RuntimeException("out of bounds: " + arr.getClass().getName()); + } + + return rc.toString(); + } + + public String toString() { + StringBuffer rc = new StringBuffer(Util.getClassName(this)); + + rc.append(stringify(_pcpointArray, "_pcpointArray")); + + return rc.toString(); + } +} Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCSCO.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCSCO.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCSCO.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCSCO.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,154 @@ +/* + * 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; + +import java.math.BigDecimal; +import java.math.BigInteger; + +import java.util.BitSet; +import java.util.Calendar; +import java.util.Locale; + +import org.apache.jdo.test.util.Util; + +/** +* A class that represents SCO's. For each type of SCO class, provides an +* instance with a value and an instance whose value is null. +* +* @author Dave Bristor +*/ +public class PCSCO { + + public java.util.Date _date; + public java.util.Date _nullDate; + + public java.util.Date _scoDate; + public java.util.Date _nullSCODate; + + public java.sql.Date _sqlDate; + public java.sql.Date _nullSqlDate; + + public BigDecimal _bigDecimal; + public BigDecimal _nullBigDecimal; + + public BigInteger _bigInteger; + public BigInteger _nullBigInteger; + + public BitSet _bitSet; + public BitSet _nullBitSet; + + public Locale _locale; + public Locale _nullLocale; + + public PCSCO() { } + + // Create a Collections with "interesting" values. + public void init() { + _date = Util.moonWalkDate.getTime(); + _nullDate = null; + + _scoDate = null; // No PM => Test_SCO assigns via setSCODate. + _nullSCODate = null; + + _sqlDate = new java.sql.Date(Util.moonWalkDate.getTime().getTime()); + _nullSqlDate = null; + + _bigDecimal = new BigDecimal(3.14159); + _nullBigDecimal = null; + + _bigInteger = new BigInteger("1234567890987654321"); + _nullBigInteger = null; + + _bitSet = new BitSet(); + _bitSet.set(0); _bitSet.set(3); _bitSet.set(5); _bitSet.set(8); + _nullBitSet = null; + + // French spoken in Canada on a Macintosh. + _locale = new Locale("fr", "CA", "MAC"); + _nullLocale = null; + } + + public java.util.Date getSCODate() { + return this._scoDate; + } + + public void setSCODate(java.util.Date scoDate) { + this._scoDate = scoDate; + // Note, this changes the the specified Date to represent the same + // Date as stored in _date + this._scoDate.setTime(_date.getTime()); + } + + public java.sql.Date getSCOSqlDate() { + return this._sqlDate; + } + + public void setSCODate(java.sql.Date sqlDate) { + this._sqlDate = sqlDate; + // Note, this changes the the specified Date to represent the same + // Date as stored in _date + this._sqlDate.setTime(_date.getTime()); + } + + public String toString() { + StringBuffer rc = new StringBuffer(Util.getClassName(this)); + try { + rc.append("\n_date: ").append(Util.longFormatter.format(_date)); + rc.append(" (" + _date.getClass().getName()); + if (_date instanceof org.apache.jdo.sco.SCO) { + org.apache.jdo.sco.SCO _sco = (org.apache.jdo.sco.SCO)_date; + rc.append(", owning field=" + _sco.getFieldName()); + } + rc.append(")"); + rc.append("\n_nullDate: ").append(_nullDate); + + rc.append("\n_scoDate: ").append(Util.longFormatter.format(_scoDate)); + rc.append(" (" + _scoDate.getClass().getName()); + if (_scoDate instanceof org.apache.jdo.sco.SCO) { + org.apache.jdo.sco.SCO _sco = (org.apache.jdo.sco.SCO)_scoDate; + rc.append(", owning field=" + _sco.getFieldName()); + } + rc.append(")"); + rc.append("\n_nullSCODate: ").append(_nullSCODate); + + rc.append("\n_sqlDate: ").append(Util.longFormatter.format(_sqlDate)); + rc.append(" (" + _sqlDate.getClass().getName()); + if (_sqlDate instanceof org.apache.jdo.sco.SCO) { + org.apache.jdo.sco.SCO _sql = (org.apache.jdo.sco.SCO)_sqlDate; + rc.append(", owning field=" + _sql.getFieldName()); + } + rc.append(")"); + rc.append("\n_nullSqlDate: ").append(_nullSqlDate); + + rc.append("\n_bigDecimal: ").append(_bigDecimal.toString()); + rc.append("\n_nullBigDecimal: ").append(_nullBigDecimal); + + rc.append("\n_bigInteger: ").append(_bigInteger.toString()); + rc.append("\n_nullBigInteger: ").append(_nullBigInteger); + + rc.append("\n_bitSet: ").append(_bitSet.toString()); + rc.append("\n_nullBitSet: ").append(_nullBitSet); + + rc.append("\n_locale: ").append(_locale.toString()); + rc.append("\n_nullLocale: ").append(_nullLocale); + + } catch (NullPointerException ex) { + return "SCO has no values"; + } + return rc.toString(); + } +} Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCStroke.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCStroke.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCStroke.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PCStroke.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,52 @@ +/* + * 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; + +import java.util.ArrayList; + +import org.apache.jdo.test.util.Util; + + +/** +* Test for instances containing collection instances of user-defined class. +* +* @author Dave Bristor +*/ +public class PCStroke { + public ArrayList points; + + public PCStroke() { } + + // Create a PCStroke with "interesting" values. + public PCStroke(ArrayList al) { + this.points = al; + } + + public String toString() { + StringBuffer rc = new StringBuffer(Util.getClassName(this) + ":\n"); + int size = points.size(); + if (0 == size) { + rc.append("\tPCStroke has no points"); + } else { + for (int i = 0; i < size; i++) { + rc.append("\t").append((PCPoint)points.get(i)); + rc.append("\n"); + } + } + return rc.toString(); + } +} Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PointFactory.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PointFactory.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PointFactory.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/PointFactory.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,48 @@ +/* + * 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; + +import org.apache.jdo.test.util.Factory; + + +/** +* Provides a means to create objects that are inserted into a database, and +* for verifying that they've been retrieved OK. +* +* @author Dave Bristor +*/ +public class PointFactory implements Factory { + /** + * Returns the class instance of the pc class of this factory. + */ + public Class getPCClass() + { + return PCPoint.class; + } + + public Object create(int index) { + return new PCPoint(index, index); + } + + // Not needed by this implementation. + public void setVerify(int x) { } + + public boolean verify(int i, Object pc) { + PCPoint p = (PCPoint)pc; + return p.x == p.y.intValue(); + } +} Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/ProjectFactory.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/ProjectFactory.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/ProjectFactory.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/ProjectFactory.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,45 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.pc; + +import org.apache.jdo.test.util.Factory; + +/** +* Provides a means to create objects that are inserted into a database, and +* for verifying that they've been retrieved OK. +* +* @author Dave Bristor +*/ +public class ProjectFactory implements Factory { + /** + * Returns the class instance of the pc class of this factory. + */ + public Class getPCClass() + { + return PCProject.class; + } + public Object create(int index) { + return null; // Not needed for current tests. + } + + // Not needed by this implementation. + public void setVerify(int x) { } + + public boolean verify(int i, Object pc) { + return true; + } +} Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/RectFactory.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/RectFactory.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/RectFactory.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/RectFactory.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,52 @@ +/* + * 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; + +import org.apache.jdo.test.util.Factory; + + +/** +* Provides a means to create objects that are inserted into a database, and +* for verifying that they've been retrieved OK. +* +* @author Dave Bristor +*/ +public class RectFactory implements Factory { + /** + * Returns the class instance of the pc class of this factory. + */ + public Class getPCClass() + { + return PCRect.class; + } + + public Object create(int index) { + return new PCRect(new PCPoint(index, index), new PCPoint(index+1, index+1)); + } + + // Not needed by this implementation. + public void setVerify(int x) { } + + public boolean verify(int i, Object pc) { + PCRect r = (PCRect)pc; + return + r.upperLeft.x == i && + r.upperLeft.y != null && r.upperLeft.y.equals(new Integer(i)) && + r.lowerRight.x == i+1 && + r.lowerRight.y != null && r.lowerRight.y.equals(new Integer (i+1)); + } +} Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCDepartment.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCDepartment.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCDepartment.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCDepartment.java Fri Mar 18 17:02:29 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.appid; + +import java.util.HashSet; + +/** +* A sample department class, generated from an SQL schema. +*/ +public class PCDepartment implements java.io.Serializable{ + public long deptid; + + public String name; + + public java.util.HashSet employees; + + public String toString() { + return "Dept: " + name + ", id=" + deptid + + ", emps: " + employees.size(); + } + + public PCDepartment() { + } + + public PCDepartment(long _id, String _name) { + deptid = _id; + name = _name; + } + + 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 java.util.HashSet getEmployees() { + return employees; + } + + public void setEmployees(java.util.HashSet employees) { + this. employees = employees; + } + + public static class Oid { + 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 ); + } + } +} + Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCEmployee.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCEmployee.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCEmployee.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCEmployee.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,224 @@ +/* + * 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.appid; + +import java.util.ArrayList; +import java.text.SimpleDateFormat; +import java.util.TimeZone; + +/** +* A sample employee class, generated from an SQL schema. +*/ +public class PCEmployee extends PCPerson { + + public long empid; + + public java.util.Date hiredate; + + public org.apache.jdo.pc.appid.PCDepartment department; + + public java.util.ArrayList projects; + + public org.apache.jdo.pc.appid.PCEmployee manager; + + public java.util.ArrayList employees; + + public org.apache.jdo.pc.appid.PCInsurance insurance; + + public String toString() { + StringBuffer rc = new StringBuffer("PCEmployee: "); +// 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(" $" + 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(); + } + + public PCEmployee() { + } + + public PCEmployee( + String _first, + String _last, + java.util.Date _born, + long _empid, + java.util.Date _hired) { + super (_first, _last, _born); + empid = _empid; + hiredate = _hired; + } + + public PCEmployee( + String _first, + String _last, + java.util.Date _born, + long _empid, + java.util.Date _hired, + org.apache.jdo.pc.appid.PCDepartment department, + java.util.ArrayList projects, + org.apache.jdo.pc.appid.PCEmployee manager, + java.util.ArrayList employees, + org.apache.jdo.pc.appid.PCInsurance insurance) { + super (_first, _last, _born); + this.empid = _empid; + this.hiredate = _hired; + this.department = department; + this.projects = projects; + this.manager = manager; + this.employees = employees; + this.insurance = insurance; + } + public long getEmpid() { + return empid; + } + + public void setEmpid(long empid) { + this. empid = empid; + } + + public void setEmployees(ArrayList s) { + employees = s; + } + +/* 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 getHiredate() { + return hiredate; + } + + public void setHiredate(java.util.Date hiredate) { + this. hiredate = hiredate; + } + +/* public java.util.Date getBirthdate() { + return birthdate; + } + + public void setBirthdate(java.util.Date birthdate) { + this. birthdate = birthdate; + } + + public double getSalary() { + return salary; + } + + public void setSalary(double salary) { + this. salary = salary; + } +*/ + + public java.util.ArrayList getProjects() { + return projects; + } + + public void setProjects(java.util.ArrayList projects) { + this. projects = projects; + } + + public PCDepartment getDepartment() { + return department; + } + + public void setDepartment(PCDepartment department) { + this. department = department; + } + + public PCEmployee getManager() { + return manager; + } + + public void setManager(PCEmployee manager) { + this. manager = manager; + } + + public java.util.ArrayList getPCEmployees() { + return employees; + } + + public void setPCEmployees(java.util.ArrayList employees) { + this. employees = employees; + } + + public PCInsurance getInsurance() { + return insurance; + } + + public void setInsurance(PCInsurance insurance) { + this. insurance = insurance; + } + + public static class Oid { + public long empid; + + public Oid() { + } + + public Oid(String s) { + empid = Long.parseLong(s); + } + + 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 String toString() { + return String.valueOf(empid); + } + + } +} + Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCFullTimeEmployee.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCFullTimeEmployee.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCFullTimeEmployee.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCFullTimeEmployee.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,81 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * PCFullTimeEmployee.java + * + * Created on May 22, 2001, 9:36 AM + */ + +package org.apache.jdo.pc.appid; + +/** + * + * @author clr + * @version + */ +public class PCFullTimeEmployee extends PCEmployee { + + public double salary; + + /** Creates new PCFullTimeEmployee */ + public PCFullTimeEmployee() { + } + public PCFullTimeEmployee( + String _first, + String _last, + java.util.Date _born, + long _empid, + java.util.Date _hired, + double _sal ) { + super (_first, _last, _born, _empid, _hired, null, null, null, null, null); + salary = _sal; + } + + public double getSalary() { + return salary; + } + + public void setSalary(double salary) { + this.salary = salary; + } + + public String toString() { + StringBuffer rc = new StringBuffer("PCFullTimeEmployee: "); +// 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(" $" + 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/ri11/test/java/org/apache/jdo/pc/appid/PCInsurance.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCInsurance.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCInsurance.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCInsurance.java Fri Mar 18 17:02:29 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.appid; + +import java.util.HashSet; + +/** +* A sample insurance class, generated from an SQL schema. +*/ +public class PCInsurance implements java.io.Serializable{ + public long insid; + + public String carrier; + + public org.apache.jdo.pc.appid.PCEmployee employee; + + public String toString() { + return "Ins: " + carrier + ", id=" + insid + + ", emp " + employee.getLastname(); + } + + public PCInsurance() { + } + + public PCInsurance(long _id, String _carrier, PCEmployee _emp) { + insid = _id; + carrier = _carrier; + employee = _emp; + } + + 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 PCEmployee getEmployee() { + return employee; + } + + public void setEmployee(PCEmployee employee) { + this. employee = employee; + } + + public static class Oid { + 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 ); + } + + +} +} + Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCObjectKey.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCObjectKey.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCObjectKey.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCObjectKey.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,93 @@ +/* + * 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. + */ + +/* + * PCObjectKey.java + * + * Created on April 15, 2003, 5:34 PM + */ + +package org.apache.jdo.pc.appid; + +/** + * + * @author Craig Russell + */ +public class PCObjectKey { + + Integer key; + + /** Creates a new instance of PCObjectKey */ + public PCObjectKey(Integer key) { + this.key = key; + } + + public PCObjectKey(String s) { + if (s != null) { + String number = s.substring(s.indexOf(":") + 1); + if (number != null) { + try { + key = new Integer(number); + } catch (NumberFormatException ex) { + } + } + } + } + + public PCObjectKey() { + this.key = null; + } + + public String toString() { + return "PCObjectKey; key value is:" + (key==null?"null":key.toString()); + } + + public static class Oid { + public Integer key; + + public Oid() { + } + + public Oid(String s) { + if (s != null) { + String number = s.substring(s.indexOf(":") + 1); + if (number != null) { + try { + key = new Integer(number); + } catch (NumberFormatException ex) { + } + } + } + } + + public String toString() { + return "PCObjectKey$Oid; key value is:" + (key==null?"null":key.toString()); + } + + public int hashCode() { return key.hashCode() ; } + + public boolean equals(Object other) { + if (other != null && (other instanceof Oid)) { + Oid k = (Oid)other; + return this.key.equals(k.key); + } + return false; + } + + } + + +} Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCPartTimeEmployee.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCPartTimeEmployee.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCPartTimeEmployee.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCPartTimeEmployee.java Fri Mar 18 17:02:29 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.appid; + +/** + * + * @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/ri11/test/java/org/apache/jdo/pc/appid/PCPerson.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCPerson.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCPerson.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCPerson.java Fri Mar 18 17:02:29 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.appid; + +import java.text.SimpleDateFormat; +import java.util.TimeZone; +import java.util.Locale; + +/** + * + * @author clr + * @version + */ +abstract 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/ri11/test/java/org/apache/jdo/pc/appid/PCPoint.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCPoint.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCPoint.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCPoint.java Fri Mar 18 17:02:29 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.appid; + +/** +* A simple class with two fields for application identity +* +* @author Marina Vatkina +*/ +public class PCPoint { + public int x; + public Integer y; + + public PCPoint() { } + + public PCPoint(int x, int y) { + this.x = x; + this.y = new Integer(y); + } + + public PCPoint(int x, Integer y) { + this.x = x; + this.y = y; + } + + public String toString() { + String rc = null; + try { + rc = org.apache.jdo.test.util.Util.getClassName(this) + name(); + } catch (NullPointerException ex) { + rc = "NPE getting PCPoint's values"; + } + return rc; + } + + public void setX(int x) { + this.x = x; + } + + public int getX() { + return x; + } + + public void setY(Integer y) { + this.y = y; + } + + public Integer getY() { + return y; + } + + public String name() { + return " x: " + getX() + ", y: " + getY().intValue(); + } + + public static class Oid { + public int x; + + public Oid() { + } + + public Oid(String s) { x = Integer.parseInt(s); } + + public String toString() { return this.getClass().getName() + ": " + x;} + + public int hashCode() { return x ; } + + public boolean equals(Object other) { + if (other != null && (other instanceof Oid)) { + Oid k = (Oid)other; + return k.x == this.x; + } + return false; + } + + } +} Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCProject.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCProject.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCProject.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCProject.java Fri Mar 18 17:02:29 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.appid; + +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/ri11/test/java/org/apache/jdo/pc/appid/PCRect.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCRect.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCRect.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/PCRect.java Fri Mar 18 17:02:29 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.appid; + +/** +* Test for instances with application identity containing instances of +* a user-defined class. +* +* @author Marina Vatkina +*/ +public class PCRect { + + private int zid; + + private PCPoint upperLeft; + private PCPoint lowerRight; + + public PCRect() { } + + public PCRect(int zid, PCPoint ul, PCPoint lr) { + this.zid = zid; + upperLeft = ul; + lowerRight = lr; + } + + public PCPoint getUpperLeft() { + return upperLeft; + } + + public PCPoint getLowerRight() { + return lowerRight; + } + + public int getId() { + return zid; + } + + public void setId(int zid) { + this.zid = zid; + } + + public String toString() { + String rc = null; + try { + rc = org.apache.jdo.test.util.Util.getClassName(this) + + " id: " + getId() + + " ul: " + getUpperLeft().name() + + " lr: " + getLowerRight().name(); + } catch (NullPointerException ex) { + rc = "NPE getting PCRect's values"; + } + return rc; + } + + public static class Oid { + public int zid; + + public Oid() { + } + + public Oid(String s) { zid = Integer.parseInt(s); } + + public String toString() { return this.getClass().getName() + ": " + zid;} + + public int hashCode() { return zid ; } + + public boolean equals(Object other) { + if (other != null && (other instanceof Oid)) { + Oid k = (Oid)other; + return k.zid == this.zid; + } + return false; + } + + } + +} Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/appid.jdoproperties URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/appid.jdoproperties?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/appid.jdoproperties (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/appid.jdoproperties Fri Mar 18 17:02:29 2005 @@ -0,0 +1,58 @@ +# Classnames can have the following attributes: +# jdo:{persistent|transactional} +# super: <classname> +# oid: <classname> +# access: {public|protected|package|private} +# Fieldnames can have the following attributes: +# type:<type> +# access: {public|protected|package|private} +# jdo:{persistent|transactional|transient} +# annotation:{key|dfg|mediated} + +org.apache.jdo.pc.appid.PCPoint=jdo:persistent,oid:org.apache.jdo.pc.appid.PCPoint$Oid +org.apache.jdo.pc.appid.PCPoint#x=jdo:persistent,annotation:key +org.apache.jdo.pc.appid.PCPoint#y=jdo:persistent,annotation:mediated + + +org.apache.jdo.pc.appid.PCRect=jdo:persistent,oid:org.apache.jdo.pc.appid.PCRect$Oid +org.apache.jdo.pc.appid.PCRect#zid=jdo:persistent,annotation:key +org.apache.jdo.pc.appid.PCRect#lowerRight=jdo:persistent,annotation:mediated +org.apache.jdo.pc.appid.PCRect#upperLeft=jdo:persistent,annotation:mediated + +org.apache.jdo.pc.appid.PCPerson=jdo:persistent +org.apache.jdo.pc.appid.PCPerson#firstname=jdo:persistent,annotation:mediated +org.apache.jdo.pc.appid.PCPerson#lastname=jdo:persistent,annotation:mediated +org.apache.jdo.pc.appid.PCPerson#birthdate=jdo:persistent,annotation:mediated + +org.apache.jdo.pc.appid.PCEmployee=jdo:persistent,super:org.apache.jdo.pc.appid.PCPerson,oid:org.apache.jdo.pc.appid.PCEmployee$Oid +org.apache.jdo.pc.appid.PCEmployee#empid=jdo:persistent,annotation:key +org.apache.jdo.pc.appid.PCEmployee#hiredate=jdo:persistent,annotation:mediated +org.apache.jdo.pc.appid.PCEmployee#department=jdo:persistent,annotation:mediated +org.apache.jdo.pc.appid.PCEmployee#projects=jdo:persistent,annotation:mediated +org.apache.jdo.pc.appid.PCEmployee#manager=jdo:persistent,annotation:mediated +org.apache.jdo.pc.appid.PCEmployee#employees=jdo:persistent,annotation:mediated +org.apache.jdo.pc.appid.PCEmployee#insurance=jdo:persistent,annotation:mediated + +org.apache.jdo.pc.appid.PCPartTimeEmployee=jdo:persistent,super:org.apache.jdo.pc.appid.PCEmployee +org.apache.jdo.pc.appid.PCPartTimeEmployee#wage=jdo:persistent,annotation:mediated + +org.apache.jdo.pc.appid.PCFullTimeEmployee=jdo:persistent,super:org.apache.jdo.pc.appid.PCEmployee +org.apache.jdo.pc.appid.PCFullTimeEmployee#salary=jdo:persistent,annotation:mediated + +org.apache.jdo.pc.appid.PCDepartment=jdo:persistent,oid:org.apache.jdo.pc.appid.PCDepartment$Oid +org.apache.jdo.pc.appid.PCDepartment#deptid=jdo:persistent,annotation:key +org.apache.jdo.pc.appid.PCDepartment#name=jdo:persistent,annotation:mediated +org.apache.jdo.pc.appid.PCDepartment#employees=jdo:persistent,annotation:mediated + +org.apache.jdo.pc.appid.PCInsurance=jdo:persistent,oid:org.apache.jdo.pc.appid.PCInsurance$Oid +org.apache.jdo.pc.appid.PCInsurance#insid=jdo:persistent,annotation:key +org.apache.jdo.pc.appid.PCInsurance#carrier=jdo:persistent,annotation:mediated +org.apache.jdo.pc.appid.PCInsurance#employee=jdo:persistent,annotation:mediated + +org.apache.jdo.pc.appid.PCProject=jdo:persistent,oid:org.apache.jdo.pc.appid.PCProject$Oid +org.apache.jdo.pc.appid.PCProject#projid=jdo:persistent,annotation:key +org.apache.jdo.pc.appid.PCProject#name=jdo:persistent,annotation:mediated +org.apache.jdo.pc.appid.PCProject#employees=jdo:persistent,annotation:mediated + +org.apache.jdo.pc.appid.PCObjectKey=jdo:persistent,oid:org.apache.jdo.pc.appid.PCObjectKey$Oid +org.apache.jdo.pc.appid.PCObjectKey#key=jdo:persistent,annotation:key Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/package.jdo URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/package.jdo?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/package.jdo (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/appid/package.jdo Fri Mar 18 17:02:29 2005 @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 1.0//EN" "http://java.sun.com/dtd/jdo_1_0.dtd"> +<jdo> + <package name="org.apache.jdo.pc.appid"> + + <!-- This will not be required once the JDOModel is fixed so that + the defaults defined in section 18.4 of the spec are working + --> + <class name="PCPoint" + identity-type="application" objectid-class="org.apache.jdo.pc.appid.PCPoint$Oid"> + <field name="x" persistence-modifier="persistent" primary-key="true"/> + <field name="y" persistence-modifier="persistent"/> + </class> + + + <class name="PCRect" + identity-type="application" objectid-class="org.apache.jdo.pc.appid.PCRect$Oid"> + <field name="zid" persistence-modifier="persistent" primary-key="true"/> + <field name="lowerRight" persistence-modifier="persistent"/> + <field name="upperLeft" persistence-modifier="persistent"/> + </class> + + <class name="PCPerson" + identity-type="application"> + <field name="firstname"/> + <field name="lastname"/> + <field name="birthdate"/> + </class> + + <class name="PCEmployee" + identity-type="application" + objectid-class="org.apache.jdo.pc.appid.PCEmployee$Oid" + persistence-capable-superclass="PCPerson"> + <field name="empid" primary-key="true"/> + <field name="hiredate"/> + <field name="department" persistence-modifier="persistent"/> + <field name="projects"> + <collection element-type="PCProject"/> + </field> + <field name="manager" persistence-modifier="persistent"/> + <field name="employees"> + <collection element-type="PCEmployee"/> + </field> + <field name="insurance" persistence-modifier="persistent"/> + </class> + + <class name="PCPartTimeEmployee" + identity-type="application" + persistence-capable-superclass="PCEmployee"> + <field name="wage"/> + </class> + + <class name="PCFullTimeEmployee" + identity-type="application" + persistence-capable-superclass="PCEmployee"> + <field name="salary"/> + </class> + + <class name="PCDepartment" + identity-type="application" + objectid-class="org.apache.jdo.pc.appid.PCDepartment$Oid"> + <field name="deptid" primary-key="true"/> + <field name="name"/> + <field name="employees"> + <collection element-type="PCEmployee"/> + </field> + </class> + + <class name="PCInsurance" + identity-type="application" + objectid-class="org.apache.jdo.pc.appid.PCInsurance$Oid"> + <field name="insid" primary-key="true"/> + <field name="carrier"/> + <field name="employee" persistence-modifier="persistent"/> + </class> + + <class name="PCProject" + identity-type="application" + objectid-class="org.apache.jdo.pc.appid.PCProject$Oid"> + <field name="projid" primary-key="true"/> + <field name="name"/> + <field name="employees"> + <collection element-type="PCEmployee"/> + </field> + </class> + + <class name="PCObjectKey" + identity-type="application" + objectid-class="org.apache.jdo.pc.appid.PCObjectKey$Oid"> + <field name="key" primary-key="true"/> + </class> + + </package> +</jdo> + Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/empdept/PCDepartment.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/empdept/PCDepartment.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/empdept/PCDepartment.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/empdept/PCDepartment.java Fri Mar 18 17:02:29 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.empdept; + +import java.util.HashSet; + +/** +* A sample department class, generated from an SQL schema. +*/ +public class PCDepartment implements java.io.Serializable{ + public long deptid; + + public String name; + + public java.util.HashSet employees; + + public String toString() { + return "Dept: " + name + ", id=" + deptid + + ", emps: " + employees.size(); + } + + public PCDepartment() { + } + + public PCDepartment(long _id, String _name) { + deptid = _id; + name = _name; + } + + 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 java.util.HashSet getEmployees() { + return employees; + } + + public void setEmployees(java.util.HashSet employees) { + this. employees = employees; + } + + public static class Oid { + 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 ); + } + } +} + Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/empdept/PCEmployee.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/empdept/PCEmployee.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/empdept/PCEmployee.java (added) +++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/pc/empdept/PCEmployee.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,217 @@ +/* + * 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; +import java.text.SimpleDateFormat; +import java.util.TimeZone; + +/** +* A sample employee class, generated from an SQL schema. +*/ +public class PCEmployee extends PCPerson { + + public long empid; + + public java.util.Date hiredate; + + public org.apache.jdo.pc.empdept.PCDepartment department; + + public java.util.HashSet projects; + + public org.apache.jdo.pc.empdept.PCEmployee manager; + + public java.util.HashSet employees; + + public org.apache.jdo.pc.empdept.PCInsurance insurance; + + public String toString() { + StringBuffer rc = new StringBuffer("PCEmployee: "); +// 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(" $" + 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(); + } + + public PCEmployee() { + } + + PCEmployee( + String _first, + String _last, + java.util.Date _born, + long _empid, + java.util.Date _hired) { + super (_first, _last, _born); + empid = _empid; + hiredate = _hired; + } + + PCEmployee( + String _first, + String _last, + java.util.Date _born, + long _empid, + java.util.Date _hired, + org.apache.jdo.pc.empdept.PCDepartment department, + java.util.HashSet projects, + org.apache.jdo.pc.empdept.PCEmployee manager, + java.util.HashSet employees, + org.apache.jdo.pc.empdept.PCInsurance insurance) { + super (_first, _last, _born); + this.empid = _empid; + this.hiredate = _hired; + this.department = department; + this.projects = projects; + this.manager = manager; + this.employees = employees; + this.insurance = insurance; + } + public long getEmpid() { + return empid; + } + + public void setEmpid(long empid) { + this. empid = empid; + } + + public void setEmployees(HashSet s) { + employees = s; + } + +/* 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 getHiredate() { + return hiredate; + } + + public void setHiredate(java.util.Date hiredate) { + this. hiredate = hiredate; + } + +/* public java.util.Date getBirthdate() { + return birthdate; + } + + public void setBirthdate(java.util.Date birthdate) { + this. birthdate = birthdate; + } + + public double getSalary() { + return salary; + } + + public void setSalary(double salary) { + this. salary = salary; + } +*/ + + public java.util.HashSet getProjects() { + return projects; + } + + public void setProjects(java.util.HashSet projects) { + this. projects = projects; + } + + public PCDepartment getDepartment() { + return department; + } + + public void setDepartment(PCDepartment department) { + this. department = department; + } + + public PCEmployee getManager() { + return manager; + } + + public void setManager(PCEmployee manager) { + this. manager = manager; + } + + public java.util.HashSet getPCEmployees() { + return employees; + } + + public void setPCEmployees(java.util.HashSet employees) { + this. employees = employees; + } + + public PCInsurance getInsurance() { + return insurance; + } + + public void setInsurance(PCInsurance insurance) { + this. insurance = insurance; + } + + public static class Oid { + 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 ); + } + + + } +} +