CarAccessory.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.inventory;
import java.io.Serializable;
/**
* <p>
* Represents an accessory to a car (e.g. a satellite navgation system).
* </p>
*/
// HibernateEntity.vsl annotations merge-point
public abstract class CarAccessory
implements Serializable, Comparable<CarAccessory>
{
/**
* The serial version UID of this class. Needed for serialization.
*/
private static final long serialVersionUID = -4933620793753812647L;
// Generate 2 attributes
private String inventoryNo;
/**
* <p>
* TODO: Model Documentation for inventoryNo
* </p>
* @return this.inventoryNo String
*/
public String getInventoryNo()
{
return this.inventoryNo;
}
/**
* <p>
* TODO: Model Documentation for inventoryNo
* </p>
* @param inventoryNoIn String
*/
public void setInventoryNo(String inventoryNoIn)
{
this.inventoryNo = inventoryNoIn;
}
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 2 associations
private Car car;
/**
* <p>
* TODO: Model Documentation for car
* </p>
* @return this.car Car
*/
public Car getCar()
{
return this.car;
}
/**
* <p>
* TODO: Model Documentation for car
* </p>
* @param carIn Car
*/
public void setCar(Car carIn)
{
this.car = carIn;
}
private CarAccessoryType carAccessoryType;
/**
* <p>
* TODO: Model Documentation for carAccessoryType
* </p>
* @return this.carAccessoryType CarAccessoryType
*/
public CarAccessoryType getCarAccessoryType()
{
return this.carAccessoryType;
}
/**
* <p>
* TODO: Model Documentation for carAccessoryType
* </p>
* @param carAccessoryTypeIn CarAccessoryType
*/
public void setCarAccessoryType(CarAccessoryType carAccessoryTypeIn)
{
this.carAccessoryType = carAccessoryTypeIn;
}
/**
* Returns <code>true</code> if the argument is an CarAccessory 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 CarAccessory))
{
return false;
}
final CarAccessory that = (CarAccessory)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 CarAccessory}.
*/
public static final class Factory
{
/**
* Constructs a new instance of {@link CarAccessory}.
* @return new CarAccessoryImpl()
*/
public static CarAccessory newInstance()
{
return new CarAccessoryImpl();
}
/**
* Constructs a new instance of {@link CarAccessory}, taking all possible properties
* (except the identifier(s))as arguments.
* @param inventoryNo String
* @param car Car
* @param carAccessoryType CarAccessoryType
* @return newInstance CarAccessory
*/
public static CarAccessory newInstance(String inventoryNo, Car car, CarAccessoryType carAccessoryType)
{
final CarAccessory entity = new CarAccessoryImpl();
entity.setInventoryNo(inventoryNo);
entity.setCar(car);
entity.setCarAccessoryType(carAccessoryType);
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(CarAccessory other)
{
int cmp = 0;
if (this.getId() != null)
{
cmp = this.getId().compareTo(other.getId());
}
else
{
if (this.getInventoryNo() != null)
{
cmp = (cmp != 0 ? cmp : this.getInventoryNo().compareTo(other.getInventoryNo()));
}
}
return cmp;
}
// HibernateEntity.vsl merge-point
}