org.apache.jdo.tck.pc.company
Class Project

java.lang.Object
  extended byorg.apache.jdo.tck.pc.company.Project
All Implemented Interfaces:
java.lang.Comparable, java.util.Comparator, DeepEquality, IProject, java.io.Serializable

public class Project
extends java.lang.Object
implements IProject, java.io.Serializable, java.lang.Comparable, java.util.Comparator, DeepEquality

This class represents a project, a budgeted task with one or more employees working on it.

See Also:
Serialized Form

Nested Class Summary
static class Project.Oid
          This class is used to represent the application identity for the Project class.
 
Constructor Summary
Project()
          This is the JDO-required no-args constructor.
Project(long projid, java.lang.String name, java.math.BigDecimal budget)
          Initialize a project.
 
Method Summary
 void addMember(Employee emp)
          Add a new member to the project.
 void addReviewer(Employee emp)
          Add a reviewer to the project.
static int compare(IProject o1, IProject o2)
          Compares its two IProject arguments for order.
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compare two instances.
 int compareTo(IProject other)
          Compares this object with the specified Project object for order.
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 boolean deepCompareFields(java.lang.Object other, EqualityHelper helper)
          Returns true if all the fields of this instance are deep equal to the coresponding fields of the specified Person.
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 java.math.BigDecimal getBudget()
          Get the project's budget.
protected  java.lang.String getFieldRepr()
          Returns a String representation of the non-relationship fields.
 java.util.Set getMembers()
          Get the project members.
 java.lang.String getName()
          Get the name of the project.
 long getProjid()
          Get the project ID.
 java.util.Set getReviewers()
          Get the reviewers associated with this project.
 int hashCode()
          Returns a hash code value for the object.
 void removeMember(Employee emp)
          Remove a member from the project.
 void removeReviewer(Employee emp)
          Remove a reviewer from the project.
 void setBudget(java.math.BigDecimal budget)
          Set the project's budget.
 void setMembers(java.util.Set employees)
          Set the members of the project.
 void setName(java.lang.String name)
          Set the name of the project.
 void setProjid(long id)
          Set the id associated with this object.
 void setReviewers(java.util.Set reviewers)
          Set the reviewers associated with this project.
 java.lang.String toString()
          Returns a String representation of a Project object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Project

public Project()
This is the JDO-required no-args constructor. The TCK relies on this constructor for testing PersistenceManager.newInstance(PCClass).


Project

public Project(long projid,
               java.lang.String name,
               java.math.BigDecimal budget)
Initialize a project.

Parameters:
projid - The project identifier.
name - The name of the project.
budget - The budget for the project.
Method Detail

setProjid

public void setProjid(long id)
Set the id associated with this object.

Specified by:
setProjid in interface IProject
Parameters:
id - the id.

getProjid

public long getProjid()
Get the project ID.

Specified by:
getProjid in interface IProject
Returns:
The project ID.

getName

public java.lang.String getName()
Get the name of the project.

Specified by:
getName in interface IProject
Returns:
The name of the project.

setName

public void setName(java.lang.String name)
Set the name of the project.

Specified by:
setName in interface IProject
Parameters:
name - The name of the project.

getBudget

public java.math.BigDecimal getBudget()
Get the project's budget.

Specified by:
getBudget in interface IProject
Returns:
The project's budget.

setBudget

public void setBudget(java.math.BigDecimal budget)
Set the project's budget.

Specified by:
setBudget in interface IProject
Parameters:
budget - The project's budget.

getReviewers

public java.util.Set getReviewers()
Get the reviewers associated with this project.

Specified by:
getReviewers in interface IProject

addReviewer

public void addReviewer(Employee emp)
Add a reviewer to the project.

Parameters:
emp - The employee to add as a reviewer.

removeReviewer

public void removeReviewer(Employee emp)
Remove a reviewer from the project.

Parameters:
emp - The employee to remove as a reviewer of this project.

setReviewers

public void setReviewers(java.util.Set reviewers)
Set the reviewers associated with this project.

Specified by:
setReviewers in interface IProject
Parameters:
reviewers - The set of reviewers to associate with this project.

getMembers

public java.util.Set getMembers()
Get the project members.

Specified by:
getMembers in interface IProject
Returns:
The members of the project is returned as an unmodifiable set of Employees.

addMember

public void addMember(Employee emp)
Add a new member to the project.

Parameters:
emp - The employee to add to the project.

removeMember

public void removeMember(Employee emp)
Remove a member from the project.

Parameters:
emp - The employee to remove from the project.

setMembers

public void setMembers(java.util.Set employees)
Set the members of the project.

Specified by:
setMembers in interface IProject
Parameters:
employees - The set of employees to be the members of this project.

toString

public java.lang.String toString()
Returns a String representation of a Project object.

Returns:
a String representation of a Project object.

getFieldRepr

protected java.lang.String getFieldRepr()
Returns a String representation of the non-relationship fields.

Returns:
a String representation of the non-relationship fields.

deepCompareFields

public boolean deepCompareFields(java.lang.Object other,
                                 EqualityHelper helper)
Returns true if all the fields of this instance are deep equal to the coresponding fields of the specified Person.

Specified by:
deepCompareFields in interface DeepEquality
Parameters:
other - the object with which to compare.
helper - EqualityHelper to keep track of instances that have already been processed.
Returns:
true if all the fields are deep equal; false otherwise.
Throws:
java.lang.ClassCastException - if the specified instances' type prevents it from being compared to this instance.

compareTo

public int compareTo(java.lang.Object o)
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.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - The Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
java.lang.ClassCastException - - if the specified object's type prevents it from being compared to this Object.

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Compare two instances. This is a method in Comparator.

Specified by:
compare in interface java.util.Comparator

compareTo

public int compareTo(IProject other)
Compares this object with the specified Project 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.

Parameters:
other - The Project object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified Project object.

compare

public static int compare(IProject o1,
                          IProject o2)
Compares its two IProject arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

Parameters:
o1 - the first IProject object to be compared.
o2 - the second IProject object to be compared.
Returns:
a negative integer, zero, or a positive integer as the first object is less than, equal to, or greater than the second object.

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.

Specified by:
equals in interface java.util.Comparator
Parameters:
obj - the object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

hashCode

public int hashCode()
Returns a hash code value for the object.

Returns:
a hash code value for this object.


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.