RentalCarEmbeddable.java
// license-header java merge-point
//
// Attention: Generated code! Do not modify by hand!
// Generated by EntityEmbeddable.vsl in andromda-ejb3-cartridge on 08/08/2014 12:21:03.
//
package org.andromda.demo.ejb3.rental;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* <p>
* TODO: Model Documentation for org.andromda.demo.ejb3.rental.RentalCar
* </p>
*
* Autogenerated POJO EJB mapped super class for RentalCar containing the
* bulk of the entity implementation.
*
* This is a mapped super class and autogenerated by AndroMDA using the EJB3
* cartridge.
*
* DO NOT MODIFY this class.
*/
@MappedSuperclass
public abstract class RentalCarEmbeddable
implements Serializable{
private static final long serialVersionUID = -1685771601926983114L;
// ----------- 4 Attribute Definitions ------------
protected String serial;
protected String name;
protected CarType type;
protected Long rentalCarId;
// --------- 1 Relationship Definitions -----------
protected Person owner;
// ---- Manageable Display Attributes (Transient) -----
// -------- 4 Attribute Accessors ----------
/**
* <p>
* TODO: Model Documentation for serial
* </p>
* Get the serial property.
* @return String The value of serial
*/
@Column(name="SERIAL", nullable=false, insertable=true, updatable=true, length=20)
@NotNull(message="serial is required")
@Size(max=20)
public String getSerial()
{
return this.serial;
}
/**
* <p>
* TODO: Model Documentation for serial
* </p>
* Set the serial property.
* @param value the new value
*/
public void setSerial(String value)
{
this.serial = value;
}
/**
* <p>
* TODO: Model Documentation for name
* </p>
* Get the name property.
* @return String The value of name
*/
@Column(name="NAME", nullable=false, insertable=true, updatable=true, length=50)
@NotNull(message="name is required")
@Size(max=50)
public String getName()
{
return this.name;
}
/**
* <p>
* TODO: Model Documentation for name
* </p>
* Set the name property.
* @param value the new value
*/
public void setName(String value)
{
this.name = value;
}
/**
* <p>
* TODO: Model Documentation for type
* </p>
* Get the type property.
* @return CarType The value of type
*/
@Column(name="TYPE", nullable=false, insertable=true, updatable=true, columnDefinition="VARCHAR(20)")
@Enumerated(EnumType.STRING)
@NotNull(message="type is required")
public CarType getType()
{
return this.type;
}
/**
* <p>
* TODO: Model Documentation for type
* </p>
* Set the type property.
* @param value the new value
*/
public void setType(CarType value)
{
this.type = value;
}
/**
* <p>
* TODO: Model Documentation for rentalCarId
* </p>
* Get the rentalCarId property.
* @return Long The value of rentalCarId
*/
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="RENTAL_CAR_ID", nullable=false, insertable=true, updatable=true)
public Long getRentalCarId()
{
return this.rentalCarId;
}
/**
* <p>
* TODO: Model Documentation for rentalCarId
* </p>
* Set the rentalCarId property.
* @param value the new value
*/
public void setRentalCarId(Long value)
{
this.rentalCarId = value;
}
// ------------- 1 Relations ------------------
/**
* <p>
* TODO: Model Documentation for owner
* </p>
* Get the owner
* @return Person
*/
@ManyToOne(optional=false)
// Order of the JoinColumns is EXTREMELY important - must match the order in the FK definition
@JoinColumns
({
@JoinColumn(name="RENTAL_CARS_ID_FK", referencedColumnName="ID"),
@JoinColumn(name="RENTAL_CARS_TAG_FK", referencedColumnName="TAG")
})
public Person getOwner()
{
return this.owner;
}
/**
* <p>
* TODO: Model Documentation for owner
* </p>
* Set the owner
* @param ownerIn
*/
public void setOwner(Person ownerIn)
{
this.owner = ownerIn;
}
// --------------- Constructors -----------------
/**
* Default empty no-arg constructor
*/
public RentalCarEmbeddable()
{
// Default empty constructor
}
/**
* Constructor with all updatable Entity attributes except auto incremented identifiers.
*
* @param serial String value for the serial property required=true lower=1
* @param name String value for the name property required=true lower=1
* @param type CarType value for the type property required=true lower=1
*/
public RentalCarEmbeddable(String serial, String name, CarType type)
{
this.serial = serial;
this.name = name;
this.type = type;
}
/**
* Constructor with all Entity attribute values and CMR relations.
*
* @param serial String value for the serial property
* @param name String value for the name property
* @param type CarType value for the type property
* @param owner Person value for the owner relation
*/
public RentalCarEmbeddable(String serial, String name, CarType type, Person owner)
{
// 3 updatableAttributes
setSerial(serial);
setName(name);
setType(type);
// 1 relations
setOwner(owner);
}
// -------- Common Methods -----------
/**
* Indicates if the argument is of the same type and all values are equal.
* @param object The target object to compare with
* @return boolean True if both objects a 'equal'
* @see Object#equals(Object)
*/
@Override
public boolean equals(Object object)
{
if (null == object)
{
return false;
}
if (this == object)
{
return true;
}
if (!(object instanceof RentalCarEmbeddable))
{
return false;
}
final RentalCarEmbeddable that = (RentalCarEmbeddable)object;
if (this.getRentalCarId() == null || that.getRentalCarId() == null || !this.getRentalCarId().equals(that.getRentalCarId()))
{
return false;
}
return true;
}
/**
* Returns a hash code value for the object
* @return int The hash code value
* @see Object#hashCode
*/
@Override
public int hashCode()
{
int hashCode = 0;
hashCode = 29 * hashCode + (getRentalCarId() == null ? 0 : getRentalCarId().hashCode());
return hashCode;
}
/**
* Returns a String representation of the object
* @return String Textual representation of the object displaying name/value pairs for all attributes
* @see Object#toString
*/
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("RentalCarEmbeddable(");
sb.append(" serial=").append(getSerial());
sb.append(" name=").append(getName());
sb.append(" type=").append(getType());
sb.append(" rentalCarId=").append(getRentalCarId());
sb.append(" owner=").append(getOwner());
sb.append(")");
return sb.toString();
}
}