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, DeepEquality, java.io.Serializable

public class Department
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable, 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.
 
Constructor Summary
protected Department()
          This is the JDO-required no-args constructor
  Department(long deptid, java.lang.String name)
          Initialize a Department instance.
  Department(long deptid, java.lang.String name, Company company)
          Initialize a Department instance.
  Department(long deptid, java.lang.String name, Company company, Employee employeeOfTheMonth)
          Initialize 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.
 int compareTo(Department 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(DeepEquality 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.
 Company getCompany()
          Get the company associated with the department.
 long getDeptid()
          Get the department id.
 Employee 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.
 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(Company company)
          Set the company for the department.
 void setEmployeeOfTheMonth(Employee 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.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Department

protected Department()
This is the JDO-required no-args constructor


Department

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

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

Department

public Department(long deptid,
                  java.lang.String name,
                  Company company)
Initialize 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,
                  Company company,
                  Employee employeeOfTheMonth)
Initialize 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

getDeptid

public long getDeptid()
Get the department id.

Returns:
The department id.

getName

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

Returns:
The name of the department.

setName

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

Parameters:
name - The name to set for the department.

getCompany

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

Returns:
The company.

setCompany

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

Parameters:
company - The company to associate with the department.

getEmployeeOfTheMonth

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

Returns:
The employee of the month.

setEmployeeOfTheMonth

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

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.

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.

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.

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.

Parameters:
employees - The set of funded employees for this department.

deepCompareFields

public boolean deepCompareFields(DeepEquality 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.

compareTo

public int compareTo(Department 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.

equals

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

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.