blob: 25e59afa5b8d59aade8499eedbe7aa82e2cf6f64 [file] [log] [blame]
/*
* Copyright (c) 2011, 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:
// Blaise Doughan - 2.3 - initial implementation
// Praba Vijayaratnam - 2.3 - test automation
package org.eclipse.persistence.testing.jaxrs.model;
import org.eclipse.persistence.oxm.annotations.XmlInverseReference;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.OneToOne;
import jakarta.persistence.PrimaryKeyJoinColumn;
import jakarta.persistence.Table;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@Entity
@XmlRootElement
@Table(name = "ADDRESS")
public class Address implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private long id;
private String city;
private String street;
@OneToOne
@PrimaryKeyJoinColumn
private Customer customer;
public Address() {
}
public long getId() {
return this.id;
}
public void setId(long id) {
this.id = id;
}
public String getCity() {
return this.city;
}
public void setCity(String city) {
this.city = city;
}
public String getStreet() {
return this.street;
}
public void setStreet(String street) {
this.street = street;
}
@XmlInverseReference(mappedBy = "address")
public Customer getCustomer() {
return this.customer;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
public boolean equals(Object object) {
if (null == object || object.getClass() != this.getClass()) {
return false;
}
Address test = (Address) object;
if (!equals(id, test.getId())) {
return false;
}
if (!equals(city, test.getCity())) {
return false;
}
if (!equals(street, test.getStreet())) {
return false;
}
if (null == test.getCustomer() && null != customer) {
return false;
}
if (null != test.getCustomer() && null == customer) {
return false;
}
return true;
}
private boolean equals(Object control, Object test) {
if (null == control) {
return null == test;
}
return control.equals(test);
}
}