Return-Path: X-Original-To: apmail-db-jdo-commits-archive@www.apache.org Delivered-To: apmail-db-jdo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 426AE5A79 for ; Tue, 10 May 2011 20:23:57 +0000 (UTC) Received: (qmail 2499 invoked by uid 500); 10 May 2011 20:23:57 -0000 Mailing-List: contact jdo-commits-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-commits@db.apache.org Received: (qmail 2491 invoked by uid 99); 10 May 2011 20:23:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 May 2011 20:23:56 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 May 2011 20:23:52 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 568BB23889C5; Tue, 10 May 2011 20:23:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1101633 - in /db/jdo/trunk/tck/src: java/org/apache/jdo/tck/pc/companyAnnotatedFC/ orm/applicationidentity/org/apache/jdo/tck/pc/company/ orm/datastoreidentity/org/apache/jdo/tck/pc/company/ sql/derby/applicationidentity/ sql/derby/datasto... Date: Tue, 10 May 2011 20:23:30 -0000 To: jdo-commits@db.apache.org From: mbo@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110510202330.568BB23889C5@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mbo Date: Tue May 10 20:23:29 2011 New Revision: 1101633 URL: http://svn.apache.org/viewvc?rev=1101633&view=rev Log: MeetingRomm class in package companyAnnotatedFC Added: db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppMeetingRoom.java db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSMeetingRoom.java Modified: db/jdo/trunk/tck/src/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-standard.orm db/jdo/trunk/tck/src/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-standard.orm db/jdo/trunk/tck/src/sql/derby/applicationidentity/schema.sql db/jdo/trunk/tck/src/sql/derby/datastoreidentity/schema.sql Added: db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppMeetingRoom.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppMeetingRoom.java?rev=1101633&view=auto ============================================================================== --- db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppMeetingRoom.java (added) +++ db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppMeetingRoom.java Tue May 10 20:23:29 2011 @@ -0,0 +1,261 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.company; + +import javax.jdo.annotations.*; + +import java.io.Serializable; +import java.util.Comparator; + +import org.apache.jdo.tck.util.DeepEquality; +import org.apache.jdo.tck.util.EqualityHelper; + +/** + * This class represents a meeting room. + */ +@PersistenceCapable(identityType=IdentityType.APPLICATION,table="meetingrooms") +@Inheritance(strategy=InheritanceStrategy.NEW_TABLE) +@Discriminator(strategy=DiscriminatorStrategy.CLASS_NAME, + column="DISCRIMINATOR") +public class FCAppMeetingRoom + implements IMeetingRoom, Serializable, Comparable, Comparator, DeepEquality { + + @Persistent(primaryKey="true") + @Column(name="ID") + private long roomid; + @Column(name="NAME", jdbcType="VARCHAR") + private String name; + + /** This is the JDO-required no-args constructor. The TCK relies on + * this constructor for testing PersistenceManager.newInstance(PCClass). + */ + public FCAppMeetingRoom() {} + + /** + * This constructor initializes the FCAppMeetingRoom components. + * @param roomid The room ID. + * @param name The name of the room + */ + public FCAppMeetingRoom(long roomid, String name) + { + this.roomid = roomid; + this.name = name; + } + + /** + * Get the room id associated with this object. + * @return the room id. + */ + public long getRoomid() { + return roomid; + } + + /** + * Set the id associated with this object. + * @param id the id. + */ + public void setRoomid(long id) { + if (this.roomid != 0) + throw new IllegalStateException("Id is already set."); + this.roomid = id; + } + + /** + * Get the name of the meeting room. + * @return The name of the meeting room. + */ + public String getName() { + return name; + } + + /** + * Set the name of the meeting room. + * @param name The name. + */ + public void setName(String name) { + this.name = name; + } + + /** + * Returns a String representation of a Address object. + * @return a String representation of a FCAppMeetingRoom object. + */ + public String toString() { + return "FCAppMeetingRoom(" + getFieldRepr() + ")"; + } + + /** + * Returns a String representation of the non-relationship fields. + * @return a String representation of the non-relationship fields. + */ + protected String getFieldRepr() { + StringBuffer rc = new StringBuffer(); + rc.append(roomid); + rc.append(", name ").append(name); + return rc.toString(); + } + + /** + * Returns true if all the fields of this instance are + * deep equal to the coresponding fields of the specified Person. + * @param other the object with which to compare. + * @param helper EqualityHelper to keep track of instances that have + * already been processed. + * @return true if all the fields are deep equal; + * false otherwise. + * @throws ClassCastException if the specified instances' type prevents + * it from being compared to this instance. + */ + public boolean deepCompareFields(Object other, + EqualityHelper helper) { + IMeetingRoom otherMeetingRoom = (IMeetingRoom)other; + String where = "FCAppMeetingRoom<" + roomid + ">"; + return + helper.equals(roomid, otherMeetingRoom.getRoomid(), where + ".roomid") & + helper.equals(name, otherMeetingRoom.getName(), where + ".name"); + } + + /** + * Compares this object with the specified object for order. Returns a + * negative integer, zero, or a positive integer as this object is less + * than, equal to, or greater than the specified object. + * @param o The Object to be compared. + * @return a negative integer, zero, or a positive integer as this + * object is less than, equal to, or greater than the specified object. + * @throws ClassCastException - if the specified object's type prevents + * it from being compared to this Object. + */ + public int compareTo(Object o) { + return compareTo((IMeetingRoom)o); + } + + /** + * Compare two instances. This is a method in Comparator. + */ + public int compare(Object o1, Object o2) { + return compare((IMeetingRoom)o1, (IMeetingRoom)o2); + } + + /** + * Compares this object with the specified FCAppMeetingRoom object for + * order. Returns a negative integer, zero, or a positive integer as + * this object is less than, equal to, or greater than the specified + * object. + * @param other The MeetingRoom object to be compared. + * @return a negative integer, zero, or a positive integer as this + * object is less than, equal to, or greater than the specified MeetingRoom + * object. + */ + public int compareTo(IMeetingRoom other) { + return compare(this, other); + } + + /** + * Compares its two IMeetingRoom arguments for order. Returns a negative + * integer, zero, or a positive integer as the first argument is less + * than, equal to, or greater than the second. + * @param o1 the first IMeetingRoom object to be compared. + * @param o2 the second IMeetingRoom object to be compared. + * @return a negative integer, zero, or a positive integer as the first + * object is less than, equal to, or greater than the second object. + */ + public static int compare(IMeetingRoom o1, IMeetingRoom o2) { + return EqualityHelper.compare(o1.getRoomid(), o2.getRoomid()); + } + + /** + * Indicates whether some other object is "equal to" this one. + * @param obj the object with which to compare. + * @return true if this object is the same as the obj + * argument; false otherwise. + */ + public boolean equals(Object obj) { + if (obj instanceof IMeetingRoom) { + return compareTo((IMeetingRoom)obj) == 0; + } + return false; + } + + /** + * Returns a hash code value for the object. + * @return a hash code value for this object. + */ + public int hashCode() { + return (int)roomid; + } + + /** + * This class is used to represent the application identifier + * for the FCAppMeetingRoom class. + */ + public static class Oid implements Serializable, Comparable { + + /** + * This is the identifier field for FCAppMeetingRoom and must + * correspond in type and name to the field in + * FCAppMeetingRoom. + */ + public long roomid; + + /** The required public, no-arg constructor. */ + public Oid() + { + roomid = 0; + } + + /** + * A constructor to initialize the identifier field. + * @param roomid the id of the FCAppMeetingRoom. + */ + public Oid(long roomid) { + this.roomid = roomid; + } + + public Oid(String s) { roomid = Long.parseLong(justTheId(s)); } + + public String toString() { return this.getClass().getName() + ": " + roomid;} + + + /** */ + public boolean equals(java.lang.Object obj) { + if( obj==null || !this.getClass().equals(obj.getClass()) ) + return( false ); + Oid o = (Oid) obj; + if( this.roomid != o.roomid ) return( false ); + return( true ); + } + + /** */ + public int hashCode() { + return( (int) roomid ); + } + + protected static String justTheId(String str) { + return str.substring(str.indexOf(':') + 1); + } + + /** */ + public int compareTo(Object obj) { + // may throw ClassCastException which the user must handle + Oid other = (Oid) obj; + if( roomid < other.roomid ) return -1; + if( roomid > other.roomid ) return 1; + return 0; + } + } +} Added: db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSMeetingRoom.java URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSMeetingRoom.java?rev=1101633&view=auto ============================================================================== --- db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSMeetingRoom.java (added) +++ db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSMeetingRoom.java Tue May 10 20:23:29 2011 @@ -0,0 +1,262 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.company; + +import javax.jdo.annotations.*; + +import java.io.Serializable; +import java.util.Comparator; + +import org.apache.jdo.tck.util.DeepEquality; +import org.apache.jdo.tck.util.EqualityHelper; + +/** + * This class represents a meeting room. + */ +@PersistenceCapable(table="meetingrooms") +@Inheritance(strategy=InheritanceStrategy.NEW_TABLE) +@Discriminator(strategy=DiscriminatorStrategy.CLASS_NAME, + column="DISCRIMINATOR") +@DatastoreIdentity(strategy=IdGeneratorStrategy.IDENTITY, + column="DATASTORE_IDENTITY") +public class FCDSMeetingRoom + implements IMeetingRoom, Serializable, Comparable, Comparator, DeepEquality { + + @Column(name="ID") + private long roomid; + @Column(name="NAME", jdbcType="VARCHAR") + private String name; + + /** This is the JDO-required no-args constructor. The TCK relies on + * this constructor for testing PersistenceManager.newInstance(PCClass). + */ + public FCDSMeetingRoom() {} + + /** + * This constructor initializes the FCDSMeetingRoom components. + * @param roomid The room ID. + * @param name The name of the room + */ + public FCDSMeetingRoom(long roomid, String name) + { + this.roomid = roomid; + this.name = name; + } + + /** + * Get the room id associated with this object. + * @return the room id. + */ + public long getRoomid() { + return roomid; + } + + /** + * Set the id associated with this object. + * @param id the id. + */ + public void setRoomid(long id) { + if (this.roomid != 0) + throw new IllegalStateException("Id is already set."); + this.roomid = id; + } + + /** + * Get the name of the meeting room. + * @return The name of the meeting room. + */ + public String getName() { + return name; + } + + /** + * Set the name of the meeting room. + * @param name The name. + */ + public void setName(String name) { + this.name = name; + } + + /** + * Returns a String representation of a Address object. + * @return a String representation of a FCDSMeetingRoom object. + */ + public String toString() { + return "FCDSMeetingRoom(" + getFieldRepr() + ")"; + } + + /** + * Returns a String representation of the non-relationship fields. + * @return a String representation of the non-relationship fields. + */ + protected String getFieldRepr() { + StringBuffer rc = new StringBuffer(); + rc.append(roomid); + rc.append(", name ").append(name); + return rc.toString(); + } + + /** + * Returns true if all the fields of this instance are + * deep equal to the coresponding fields of the specified Person. + * @param other the object with which to compare. + * @param helper EqualityHelper to keep track of instances that have + * already been processed. + * @return true if all the fields are deep equal; + * false otherwise. + * @throws ClassCastException if the specified instances' type prevents + * it from being compared to this instance. + */ + public boolean deepCompareFields(Object other, + EqualityHelper helper) { + IMeetingRoom otherMeetingRoom = (IMeetingRoom)other; + String where = "FCDSMeetingRoom<" + roomid + ">"; + return + helper.equals(roomid, otherMeetingRoom.getRoomid(), where + ".roomid") & + helper.equals(name, otherMeetingRoom.getName(), where + ".name"); + } + + /** + * Compares this object with the specified object for order. Returns a + * negative integer, zero, or a positive integer as this object is less + * than, equal to, or greater than the specified object. + * @param o The Object to be compared. + * @return a negative integer, zero, or a positive integer as this + * object is less than, equal to, or greater than the specified object. + * @throws ClassCastException - if the specified object's type prevents + * it from being compared to this Object. + */ + public int compareTo(Object o) { + return compareTo((IMeetingRoom)o); + } + + /** + * Compare two instances. This is a method in Comparator. + */ + public int compare(Object o1, Object o2) { + return compare((IMeetingRoom)o1, (IMeetingRoom)o2); + } + + /** + * Compares this object with the specified FCDSMeetingRoom object for + * order. Returns a negative integer, zero, or a positive integer as + * this object is less than, equal to, or greater than the specified + * object. + * @param other The MeetingRoom object to be compared. + * @return a negative integer, zero, or a positive integer as this + * object is less than, equal to, or greater than the specified MeetingRoom + * object. + */ + public int compareTo(IMeetingRoom other) { + return compare(this, other); + } + + /** + * Compares its two IMeetingRoom arguments for order. Returns a negative + * integer, zero, or a positive integer as the first argument is less + * than, equal to, or greater than the second. + * @param o1 the first IMeetingRoom object to be compared. + * @param o2 the second IMeetingRoom object to be compared. + * @return a negative integer, zero, or a positive integer as the first + * object is less than, equal to, or greater than the second object. + */ + public static int compare(IMeetingRoom o1, IMeetingRoom o2) { + return EqualityHelper.compare(o1.getRoomid(), o2.getRoomid()); + } + + /** + * Indicates whether some other object is "equal to" this one. + * @param obj the object with which to compare. + * @return true if this object is the same as the obj + * argument; false otherwise. + */ + public boolean equals(Object obj) { + if (obj instanceof IMeetingRoom) { + return compareTo((IMeetingRoom)obj) == 0; + } + return false; + } + + /** + * Returns a hash code value for the object. + * @return a hash code value for this object. + */ + public int hashCode() { + return (int)roomid; + } + + /** + * This class is used to represent the application identifier + * for the FCDSMeetingRoom class. + */ + public static class Oid implements Serializable, Comparable { + + /** + * This is the identifier field for FCDSMeetingRoom and must + * correspond in type and name to the field in + * FCDSMeetingRoom. + */ + public long roomid; + + /** The required public, no-arg constructor. */ + public Oid() + { + roomid = 0; + } + + /** + * A constructor to initialize the identifier field. + * @param roomid the id of the FCDSMeetingRoom. + */ + public Oid(long roomid) { + this.roomid = roomid; + } + + public Oid(String s) { roomid = Long.parseLong(justTheId(s)); } + + public String toString() { return this.getClass().getName() + ": " + roomid;} + + + /** */ + public boolean equals(java.lang.Object obj) { + if( obj==null || !this.getClass().equals(obj.getClass()) ) + return( false ); + Oid o = (Oid) obj; + if( this.roomid != o.roomid ) return( false ); + return( true ); + } + + /** */ + public int hashCode() { + return( (int) roomid ); + } + + protected static String justTheId(String str) { + return str.substring(str.indexOf(':') + 1); + } + + /** */ + public int compareTo(Object obj) { + // may throw ClassCastException which the user must handle + Oid other = (Oid) obj; + if( roomid < other.roomid ) return -1; + if( roomid > other.roomid ) return 1; + return 0; + } + } +} Modified: db/jdo/trunk/tck/src/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-standard.orm URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-standard.orm?rev=1101633&r1=1101632&r2=1101633&view=diff ============================================================================== --- db/jdo/trunk/tck/src/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-standard.orm (original) +++ db/jdo/trunk/tck/src/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-standard.orm Tue May 10 20:23:29 2011 @@ -48,6 +48,9 @@ has application identity. + + + Modified: db/jdo/trunk/tck/src/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-standard.orm URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-standard.orm?rev=1101633&r1=1101632&r2=1101633&view=diff ============================================================================== --- db/jdo/trunk/tck/src/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-standard.orm (original) +++ db/jdo/trunk/tck/src/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-standard.orm Tue May 10 20:23:29 2011 @@ -62,6 +62,9 @@ has datastore identity. + + + Modified: db/jdo/trunk/tck/src/sql/derby/applicationidentity/schema.sql URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/sql/derby/applicationidentity/schema.sql?rev=1101633&r1=1101632&r2=1101633&view=diff ============================================================================== --- db/jdo/trunk/tck/src/sql/derby/applicationidentity/schema.sql (original) +++ db/jdo/trunk/tck/src/sql/derby/applicationidentity/schema.sql Tue May 10 20:23:29 2011 @@ -266,6 +266,7 @@ CREATE TABLE department_rooms ( CREATE TABLE meetingrooms ( ID INTEGER NOT NULL, NAME VARCHAR(32) NOT NULL, + DISCRIMINATOR VARCHAR(255), CONSTRAINT ROOMS_PK PRIMARY KEY (ID) ); Modified: db/jdo/trunk/tck/src/sql/derby/datastoreidentity/schema.sql URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/sql/derby/datastoreidentity/schema.sql?rev=1101633&r1=1101632&r2=1101633&view=diff ============================================================================== --- db/jdo/trunk/tck/src/sql/derby/datastoreidentity/schema.sql (original) +++ db/jdo/trunk/tck/src/sql/derby/datastoreidentity/schema.sql Tue May 10 20:23:29 2011 @@ -195,6 +195,7 @@ CREATE TABLE meetingrooms ( DATASTORE_IDENTITY INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY, ID INTEGER NOT NULL, NAME VARCHAR(32) NOT NULL, + DISCRIMINATOR VARCHAR(255), CONSTRAINT ROOMS_PK PRIMARY KEY (DATASTORE_IDENTITY) );