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

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

public class Department
extends java.lang.Object
implements IDepartment, java.io.Serializable, java.lang.Comparable, java.util.Comparator, DeepEquality

This class represents a department within a company.

See Also:
Serialized Form

Nested Class Summary
static class Department.Oid
          The application identity class associated with the Department class.
 
Field Summary
static int RECOMMENDED_NO_OF_EMPS
           
 
Constructor Summary
Department()
          This is the JDO-required no-args constructor.
Department(long deptid, java.lang.String name)
          Construct a Department instance.
Department(long deptid, java.lang.String name, ICompany company)
          Construct a Department instance.
Department(long deptid, java.lang.String name, ICompany company, IEmployee employeeOfTheMonth)
          Construct a Department instance.
 
Method Summary
 void addEmployee(Employee emp)
          Add an employee to the department.
 void addFundedEmp(Employee emp)
          Add an employee to the collection of funded employees of this department.
static int compare(IDepartment o1, IDepartment o2)
          Compares its two IDepartment arguments for order.
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compare two instances.
 int compareTo(IDepartment other)
          Compares this object with the specified Department 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 other Department.
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 ICompany getCompany()
          Get the company associated with the department.
 long getDeptid()
          Get the department id.
 IEmployee getEmployeeOfTheMonth()
          Get the employee of the month associated with the department.
 java.util.Set getEmployees()
          Get the employees in the department as an unmodifiable set.
protected  java.lang.String getFieldRepr()
          Returns a String representation of the non-relationship fields.
 java.util.Set getFundedEmps()
          Get the funded employees in the department as an unmodifiable set.
 java.lang.String getName()
          Get the name of the department.
 int hashCode()
          Returns a hash code value for the object.
 void removeEmployee(Employee emp)
          Remove an employee from the department.
 void removeFundedEmp(Employee emp)
          Remove an employee from collection of funded employees of this department.
 void setCompany(ICompany company)
          Set the company for the department.
 void setDeptid(long id)
          Set the id associated with this object.
 void setEmployeeOfTheMonth(IEmployee employeeOfTheMonth)
          Set the employee of the month for the department.
 void setEmployees(java.util.Set employees)
          Set the employees to be in this department.
 void setFundedEmps(java.util.Set employees)
          Set the funded employees to be in this department.
 void setName(java.lang.String name)
          Set the name of the department.
 java.lang.String toString()
          Returns a String representation of a Department object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RECOMMENDED_NO_OF_EMPS

public static final int RECOMMENDED_NO_OF_EMPS
See Also:
Constant Field Values
Constructor Detail

Department

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


Department

public Department(long deptid,
                  java.lang.String name)
Construct a Department instance.

Parameters:
deptid - The department id.
name - The name of the department.

Department

public Department(long deptid,
                  java.lang.String name,
                  ICompany company)
Construct a Department instance.

Parameters:
deptid - The department id.
name - The name of the department.
company - The company that the department is associated with.

Department

public Department(long deptid,
                  java.lang.String name,
                  ICompany company,
                  IEmployee employeeOfTheMonth)
Construct a Department instance.

Parameters:
deptid - The department id.
name - The name of the department.
company - The company that the department is associated with.
employeeOfTheMonth - The employee of the month the department is associated with.
Method Detail

setDeptid

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

Specified by:
setDeptid in interface IDepartment
Parameters:
id - the id.

getDeptid

public long getDeptid()
Get the department id.

Specified by:
getDeptid in interface IDepartment
Returns:
The department id.

getName

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

Specified by:
getName in interface IDepartment
Returns:
The name of the department.

setName

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

Specified by:
setName in interface IDepartment
Parameters:
name - The name to set for the department.

getCompany

public ICompany getCompany()
Get the company associated with the department.

Specified by:
getCompany in interface IDepartment
Returns:
The company.

setCompany

public void setCompany(ICompany company)
Set the company for the department.

Specified by:
setCompany in interface IDepartment
Parameters:
company - The company to associate with the department.

getEmployeeOfTheMonth

public IEmployee getEmployeeOfTheMonth()
Get the employee of the month associated with the department.

Specified by:
getEmployeeOfTheMonth in interface IDepartment
Returns:
The employee of the month.

setEmployeeOfTheMonth

public void setEmployeeOfTheMonth(IEmployee employeeOfTheMonth)
Set the employee of the month for the department.

Specified by:
setEmployeeOfTheMonth in interface IDepartment
Parameters:
employeeOfTheMonth - The employee of the month to associate with the department.

getEmployees

public java.util.Set getEmployees()
Get the employees in the department as an unmodifiable set.

Specified by:
getEmployees in interface IDepartment
Returns:
The set of employees in the department, as an unmodifiable set.

addEmployee

public void addEmployee(Employee emp)
Add an employee to the department.

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

removeEmployee

public void removeEmployee(Employee emp)
Remove an employee from the department.

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

setEmployees

public void setEmployees(java.util.Set employees)
Set the employees to be in this department.

Specified by:
setEmployees in interface IDepartment
Parameters:
employees - The set of employees for this department.

getFundedEmps

public java.util.Set getFundedEmps()
Get the funded employees in the department as an unmodifiable set.

Specified by:
getFundedEmps in interface IDepartment
Returns:
The set of funded employees in the department, as an unmodifiable set.

addFundedEmp

public void addFundedEmp(Employee emp)
Add an employee to the collection of funded employees of this department.

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

removeFundedEmp

public void removeFundedEmp(Employee emp)
Remove an employee from collection of funded employees of this department.

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

setFundedEmps

public void setFundedEmps(java.util.Set employees)
Set the funded employees to be in this department.

Specified by:
setFundedEmps in interface IDepartment
Parameters:
employees - The set of funded employees for this department.

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 other Department.

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.

toString

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

Returns:
a String representation of a Department 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.

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(IDepartment other)
Compares this object with the specified Department object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Parameters:
other - The Department 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 Department object.

compare

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

Parameters:
o1 - the first IDepartment object to be compared.
o2 - the second IDepartment 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.