CarAccessoryType.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;
import java.util.Collection;
import java.util.HashSet;
/**
* <p>
* Represents the type of an accessory. Several car accessories can belong to the same type.
* </p>
*/
// HibernateEntity.vsl annotations merge-point
public abstract class CarAccessoryType
implements Serializable, Comparable<CarAccessoryType>
{
/**
* The serial version UID of this class. Needed for serialization.
*/
private static final long serialVersionUID = 499981815922242899L;
// Generate 4 attributes
private String manufacter;
/**
* <p>
* TODO: Model Documentation for manufacter
* </p>
* @return this.manufacter String
*/
public String getManufacter()
{
return this.manufacter;
}
/**
* <p>
* TODO: Model Documentation for manufacter
* </p>
* @param manufacterIn String
*/
public void setManufacter(String manufacterIn)
{
this.manufacter = manufacterIn;
}
private String identifier;
/**
* <p>
* TODO: Model Documentation for identifier
* </p>
* @return this.identifier String
*/
public String getIdentifier()
{
return this.identifier;
}
/**
* <p>
* TODO: Model Documentation for identifier
* </p>
* @param identifierIn String
*/
public void setIdentifier(String identifierIn)
{
this.identifier = identifierIn;
}
private String orderNo;
/**
* <p>
* TODO: Model Documentation for orderNo
* </p>
* @return this.orderNo String
*/
public String getOrderNo()
{
return this.orderNo;
}
/**
* <p>
* TODO: Model Documentation for orderNo
* </p>
* @param orderNoIn String
*/
public void setOrderNo(String orderNoIn)
{
this.orderNo = orderNoIn;
}
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 Collection<CarAccessory> carAccessories = new HashSet<CarAccessory>();
/**
* <p>
* TODO: Model Documentation for carAccessories
* </p>
* @return this.carAccessories Collection<CarAccessory>
*/
public Collection<CarAccessory> getCarAccessories()
{
return this.carAccessories;
}
/**
* <p>
* TODO: Model Documentation for carAccessories
* </p>
* @param carAccessoriesIn Collection<CarAccessory>
*/
public void setCarAccessories(Collection<CarAccessory> carAccessoriesIn)
{
this.carAccessories = carAccessoriesIn;
}
/**
* <p>
* TODO: Model Documentation for carAccessories
* </p>
* @param elementToAdd CarAccessory
* @return <tt>true</tt> if this collection changed as a result of the
* call
*/
public boolean addCarAccessories(CarAccessory elementToAdd)
{
return this.carAccessories.add(elementToAdd);
}
/**
* <p>
* TODO: Model Documentation for carAccessories
* </p>
* @param elementToRemove CarAccessory
* @return <tt>true</tt> if this collection changed as a result of the
* call
*/
public boolean removeCarAccessories(CarAccessory elementToRemove)
{
return this.carAccessories.remove(elementToRemove);
}
/**
* Returns <code>true</code> if the argument is an CarAccessoryType 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 CarAccessoryType))
{
return false;
}
final CarAccessoryType that = (CarAccessoryType)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 CarAccessoryType}.
*/
public static final class Factory
{
/**
* Constructs a new instance of {@link CarAccessoryType}.
* @return new CarAccessoryTypeImpl()
*/
public static CarAccessoryType newInstance()
{
return new CarAccessoryTypeImpl();
}
/**
* Constructs a new instance of {@link CarAccessoryType}, taking all required and/or
* read-only properties as arguments, except for identifiers.
* @param manufacter String
* @param identifier String
* @param orderNo String
* @return newInstance
*/
public static CarAccessoryType newInstance(String manufacter, String identifier, String orderNo)
{
final CarAccessoryType entity = new CarAccessoryTypeImpl();
entity.setManufacter(manufacter);
entity.setIdentifier(identifier);
entity.setOrderNo(orderNo);
return entity;
}
/**
* Constructs a new instance of {@link CarAccessoryType}, taking all possible properties
* (except the identifier(s))as arguments.
* @param manufacter String
* @param identifier String
* @param orderNo String
* @param carAccessories Collection<CarAccessory>
* @return newInstance CarAccessoryType
*/
public static CarAccessoryType newInstance(String manufacter, String identifier, String orderNo, Collection<CarAccessory> carAccessories)
{
final CarAccessoryType entity = new CarAccessoryTypeImpl();
entity.setManufacter(manufacter);
entity.setIdentifier(identifier);
entity.setOrderNo(orderNo);
entity.setCarAccessories(carAccessories);
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(CarAccessoryType other)
{
int cmp = 0;
if (this.getId() != null)
{
cmp = this.getId().compareTo(other.getId());
}
else
{
if (this.getManufacter() != null)
{
cmp = (cmp != 0 ? cmp : this.getManufacter().compareTo(other.getManufacter()));
}
if (this.getIdentifier() != null)
{
cmp = (cmp != 0 ? cmp : this.getIdentifier().compareTo(other.getIdentifier()));
}
if (this.getOrderNo() != null)
{
cmp = (cmp != 0 ? cmp : this.getOrderNo().compareTo(other.getOrderNo()));
}
}
return cmp;
}
// HibernateEntity.vsl merge-point
}