Reservation.java
// license-header java merge-point
//
// Attention: Generated code! Do not modify by hand!
// Generated by hibernate/HibernateEntity.vsl in andromda-hibernate-cartridge on 08/18/2014 15:29:45-0400.
//
package org.andromda.samples.carrental.contracts;
import java.io.Serializable;
import java.util.Date;
import org.andromda.samples.carrental.customers.Customer;
/**
* <p>
* Represents a reservation for a car with a certain comfort class, for a given date.
* </p>
*/
// HibernateEntity.vsl annotations merge-point
public abstract class Reservation
implements Serializable, Comparable<Reservation>
{
/**
* The serial version UID of this class. Needed for serialization.
*/
private static final long serialVersionUID = 3105828508574039516L;
// Generate 3 attributes
private Date reservationDate;
/**
* <p>
* TODO: Model Documentation for reservationDate
* </p>
* @return this.reservationDate Date
*/
public Date getReservationDate()
{
return this.reservationDate;
}
/**
* <p>
* TODO: Model Documentation for reservationDate
* </p>
* @param reservationDateIn Date
*/
public void setReservationDate(Date reservationDateIn)
{
this.reservationDate = reservationDateIn;
}
private String comfortClass;
/**
* <p>
* TODO: Model Documentation for comfortClass
* </p>
* @return this.comfortClass String
*/
public String getComfortClass()
{
return this.comfortClass;
}
/**
* <p>
* TODO: Model Documentation for comfortClass
* </p>
* @param comfortClassIn String
*/
public void setComfortClass(String comfortClassIn)
{
this.comfortClass = comfortClassIn;
}
private Long id;
/**
* <p>
* TODO: Model Documentation for id
* </p>
* @return this.id Long
*/
public Long getId()
{
return this.id;
}
/**
* <p>
* TODO: Model Documentation for id
* </p>
* @param idIn Long
*/
public void setId(Long idIn)
{
this.id = idIn;
}
// Generate 1 associations
private Customer customer;
/**
* <p>
* TODO: Model Documentation for customer
* </p>
* @return this.customer Customer
*/
public Customer getCustomer()
{
return this.customer;
}
/**
* <p>
* TODO: Model Documentation for customer
* </p>
* @param customerIn Customer
*/
public void setCustomer(Customer customerIn)
{
this.customer = customerIn;
}
// Generate 1 businessOperations
/**
* <p>
* TODO: Model Documentation for create
* </p>
* @param id <p>
TODO: Model Documentation for id
</p>
* @param reservationDate <p>
TODO: Model Documentation for reservationDate
</p>
* @param comfortClass <p>
TODO: Model Documentation for comfortClass
</p>
* @return Reservation
*/
public abstract Reservation create(long id, Date reservationDate, String comfortClass);
/**
* Returns <code>true</code> if the argument is an Reservation instance and all identifiers for this entity
* equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
*/
@Override
public boolean equals(Object object)
{
if (this == object)
{
return true;
}
if (!(object instanceof Reservation))
{
return false;
}
final Reservation that = (Reservation)object;
if (this.id == null || that.getId() == null || !this.id.equals(that.getId()))
{
return false;
}
return true;
}
/**
* Returns a hash code based on this entity's identifiers.
*/
@Override
public int hashCode()
{
int hashCode = 0;
hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode());
return hashCode;
}
/**
* Constructs new instances of {@link Reservation}.
*/
public static final class Factory
{
/**
* Constructs a new instance of {@link Reservation}.
* @return new ReservationImpl()
*/
public static Reservation newInstance()
{
return new ReservationImpl();
}
/**
* Constructs a new instance of {@link Reservation}, taking all possible properties
* (except the identifier(s))as arguments.
* @param reservationDate Date
* @param comfortClass String
* @param customer Customer
* @return newInstance Reservation
*/
public static Reservation newInstance(Date reservationDate, String comfortClass, Customer customer)
{
final Reservation entity = new ReservationImpl();
entity.setReservationDate(reservationDate);
entity.setComfortClass(comfortClass);
entity.setCustomer(customer);
return entity;
}
}
/**
* @param other
* @return a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
* @see Comparable#compareTo
*/
@Override
public int compareTo(Reservation other)
{
int cmp = 0;
if (this.getId() != null)
{
cmp = this.getId().compareTo(other.getId());
}
else
{
if (this.getReservationDate() != null)
{
cmp = (cmp != 0 ? cmp : this.getReservationDate().compareTo(other.getReservationDate()));
}
if (this.getComfortClass() != null)
{
cmp = (cmp != 0 ? cmp : this.getComfortClass().compareTo(other.getComfortClass()));
}
}
return cmp;
}
// HibernateEntity.vsl merge-point
}