blob: 496de4aabb2b04207c726aa452613ddb94748748 [file] [log] [blame]
/*
* Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0,
* or the Eclipse Distribution License v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
// Contributors:
// Oracle - initial API and implementation from Oracle TopLink
package org.eclipse.persistence.testing.oxm.mappings.namespaces;
import java.util.ArrayList;
import java.util.List;
public class Team {
List employees;
String teamName;
Object teamLeader;
Project project;
public Team() {
employees = new ArrayList();
}
public void setEmployees(List employees) {
this.employees = employees;
}
public List getEmployees() {
return employees;
}
public void setTeamName(String teamName) {
this.teamName = teamName;
}
public String getTeamName() {
return teamName;
}
public boolean equals(Object o) {
try {
Team team = (Team)o;
if (!this.getTeamName().equals(team.getTeamName())) {
return false;
}
if((getTeamLeader()== null && team.getTeamLeader()!=null)|| (team.getTeamLeader()==null && getTeamLeader()!= null))
{
return false;
}
if(getTeamLeader()!=null && (!getTeamLeader().equals(team.getTeamLeader())))
{
return false;
}
if (team.getEmployees().size() != getEmployees().size()) {
return false;
}
if ((!team.getEmployees().containsAll(getEmployees())) || (!getEmployees().containsAll(team.getEmployees()))) {
return false;
}
} catch (ClassCastException e) {
return false;
}
return true;
}
public String toString() {
String string = "Team- name:";
string += this.getTeamName();
if(getTeamLeader()!= null)
{
string += "Leader:" +getTeamLeader().toString();
}
for (int i = 0; i < getEmployees().size(); i++) {
string = " " + getEmployees().get(i).toString();
}
return string;
}
public void setTeamLeader(Object teamLeader)
{
this.teamLeader = teamLeader;
}
public Object getTeamLeader()
{
return teamLeader;
}
}