TimecardEmbeddable.java
// license-header java merge-point
//
// Attention: Generated code! Do not modify by hand!
// Generated by EntityEmbeddable.vsl in andromda-ejb3-cartridge on 09/18/2014 12:09:10.
//
package org.andromda.timetracker.domain;
import java.io.Serializable;
import java.util.Date;
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.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
/**
* <p>
* TODO: Model Documentation for org.andromda.timetracker.domain.Timecard
* </p>
*
* Autogenerated POJO EJB mapped super class for Timecard 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 TimecardEmbeddable
implements Serializable{
private static final long serialVersionUID = 7573880213879125840L;
// ----------- 4 Attribute Definitions ------------
protected TimecardStatus status;
protected Date startDate;
protected String comments;
protected Long timecardId;
// --------- 2 Relationship Definitions -----------
protected User submitter;
protected User approver;
// ---- Manageable Display Attributes (Transient) -----
// -------- 4 Attribute Accessors ----------
/**
* <p>
* TODO: Model Documentation for status
* </p>
* Get the status property.
* @return TimecardStatus The value of status
*/
@Column(name="STATUS", nullable=false, insertable=true, updatable=true, columnDefinition="VARCHAR(20)")
@Enumerated(EnumType.STRING)
@NotNull(message="status is required")
public TimecardStatus getStatus()
{
return this.status;
}
/**
* <p>
* TODO: Model Documentation for status
* </p>
* Set the status property.
* @param value the new value
*/
public void setStatus(TimecardStatus value)
{
this.status = value;
}
/**
* <p>
* TODO: Model Documentation for startDate
* </p>
* Get the startDate property.
* @return Date The value of startDate
*/
@Column(name="START_DATE", nullable=false, insertable=true, updatable=true)
@Temporal(TemporalType.TIMESTAMP)
@NotNull(message="startDate is required")
public Date getStartDate()
{
return this.startDate;
}
/**
* <p>
* TODO: Model Documentation for startDate
* </p>
* Set the startDate property.
* @param value the new value
*/
public void setStartDate(Date value)
{
this.startDate = value;
}
/**
* <p>
* TODO: Model Documentation for comments
* </p>
* Get the comments property.
* @return String The value of comments
*/
@Column(name="COMMENTS", nullable=false, insertable=true, updatable=true)
@NotNull(message="comments is required")
public String getComments()
{
return this.comments;
}
/**
* <p>
* TODO: Model Documentation for comments
* </p>
* Set the comments property.
* @param value the new value
*/
public void setComments(String value)
{
this.comments = value;
}
/**
* <p>
* TODO: Model Documentation for timecardId
* </p>
* Get the timecardId property.
* @return Long The value of timecardId
*/
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="TIMECARD_ID", nullable=false, insertable=true, updatable=true)
public Long getTimecardId()
{
return this.timecardId;
}
/**
* <p>
* TODO: Model Documentation for timecardId
* </p>
* Set the timecardId property.
* @param value the new value
*/
public void setTimecardId(Long value)
{
this.timecardId = value;
}
// ------------- 2 Relations ------------------
/**
* <p>
* TODO: Model Documentation for submitter
* </p>
* Get the submitter
* @return User
*/
@ManyToOne(optional=false)
@JoinColumn(name="SUBMITTER_FK", insertable=true, updatable=true)
public User getSubmitter()
{
return this.submitter;
}
/**
* <p>
* TODO: Model Documentation for submitter
* </p>
* Set the submitter
* @param submitterIn
*/
public void setSubmitter(User submitterIn)
{
this.submitter = submitterIn;
}
/**
* <p>
* TODO: Model Documentation for approver
* </p>
* Get the approver
* @return User
*/
@ManyToOne()
@JoinColumn(name="APPROVER_FK", insertable=true, updatable=true)
public User getApprover()
{
return this.approver;
}
/**
* <p>
* TODO: Model Documentation for approver
* </p>
* Set the approver
* @param approverIn
*/
public void setApprover(User approverIn)
{
this.approver = approverIn;
}
// --------------- Constructors -----------------
/**
* Default empty no-arg constructor
*/
public TimecardEmbeddable()
{
// Default empty constructor
}
/**
* Constructor with all updatable Entity attributes except auto incremented identifiers.
*
* @param status TimecardStatus value for the status property required=true lower=1
* @param startDate Date value for the startDate property required=true lower=1
* @param comments String value for the comments property required=true lower=1
*/
public TimecardEmbeddable(TimecardStatus status, Date startDate, String comments)
{
this.status = status;
this.startDate = startDate;
this.comments = comments;
}
/**
* Constructor with all Entity attribute values and CMR relations.
*
* @param status TimecardStatus value for the status property
* @param startDate Date value for the startDate property
* @param comments String value for the comments property
* @param submitter User value for the submitter relation
* @param approver User value for the approver relation
*/
public TimecardEmbeddable(TimecardStatus status, Date startDate, String comments, User submitter, User approver)
{
// 3 updatableAttributes
setStatus(status);
setStartDate(startDate);
setComments(comments);
// 2 relations
setSubmitter(submitter);
setApprover(approver);
}
/**
* Constructor with required Entity attribute values and required CMR relations.
*
* @param status TimecardStatus value for the status property
* @param startDate Date value for the startDate property
* @param comments String value for the comments property
* @param submitter User value for the submitter relation
*/
public TimecardEmbeddable(TimecardStatus status, Date startDate, String comments, User submitter)
{
// 3 requiredAttributes
setStatus(status);
setStartDate(startDate);
setComments(comments);
// 1 required association relations
setSubmitter(submitter);
}
// -------- 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 TimecardEmbeddable))
{
return false;
}
final TimecardEmbeddable that = (TimecardEmbeddable)object;
if (this.getTimecardId() == null || that.getTimecardId() == null || !this.getTimecardId().equals(that.getTimecardId()))
{
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 + (getTimecardId() == null ? 0 : getTimecardId().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("TimecardEmbeddable(");
sb.append(" status=").append(getStatus());
sb.append(" startDate=").append(getStartDate());
sb.append(" comments=").append(getComments());
sb.append(" timecardId=").append(getTimecardId());
sb.append(" submitter=").append(getSubmitter());
sb.append(" approver=").append(getApprover());
sb.append(")");
return sb.toString();
}
}