Ticket.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.ticket;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * <p>
 * TODO: Model Documentation for org.andromda.demo.ejb3.ticket.Ticket
 * </p>
 *
 * Autogenerated POJO EJB mapped super class for Ticket 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 class Ticket
    implements Serializable{
    private static final long serialVersionUID = -7070456027156814846L;

    // ----------- 3 Attribute Definitions ------------
    protected Integer id;
    protected String event;
    protected String type;

    // -------- 3 Attribute Accessors ----------
    /**
     * <p>
     * TODO: Model Documentation for id
     * </p>
     * Get the id property.
     * @return Integer The value of id
     */
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name="ID", nullable=false, insertable=true, updatable=true)
    public Integer getId()
    {
        return this.id;
    }

    /**
     * <p>
     * TODO: Model Documentation for id
     * </p>
     * Set the id property.
     * @param value the new value
     */
    public void setId(Integer value)
    {
        this.id = value;
    }

    /**
     * <p>
     * TODO: Model Documentation for event
     * </p>
     * Get the event property.
     * @return String The value of event
     */
    @Column(name="EVENT", nullable=false, insertable=true, updatable=true, length=50)
    @NotNull(message="event is required")
    @Size(max=50)
    public String getEvent()
    {
        return this.event;
    }

    /**
     * <p>
     * TODO: Model Documentation for event
     * </p>
     * Set the event property.
     * @param value the new value
     */
    public void setEvent(String value)
    {
        this.event = value;
    }

    /**
     * <p>
     * TODO: Model Documentation for type
     * </p>
     * Get the type property.
     * @return String The value of type
     */
    @Column(name="TYPE", insertable=true, updatable=true, length=10)
    @Size(max=10)
    public String getType()
    {
        return this.type;
    }

    /**
     * <p>
     * TODO: Model Documentation for type
     * </p>
     * Set the type property.
     * @param value the new value
     */
    public void setType(String value)
    {
        this.type = value;
    }


    // ------------- 0 Relations ------------------
    // --------------- Constructors -----------------

    /**
     * Default empty no-arg constructor
     */
    public Ticket()
    {
        // Default empty constructor
    }

    /**
     * Constructor with all updatable Entity attributes except auto incremented identifiers.
     *
     * @param event String value for the event property required=true lower=1
     * @param type String value for the type property required=false lower=0
     */
    public Ticket(String event, String type)
    {
        this.event = event;
        this.type = type;
    }

    /**
     * Constructor with required Entity attributes except auto incremented identifiers.
     *
     * @param event Value for the event property
     */
    public Ticket(String event)
    {
        this.event = event;
    }


    // -------- 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 Ticket))
        {
            return false;
        }
        final Ticket that = (Ticket)object;
        if (this.getId() == null || that.getId() == null || !this.getId().equals(that.getId()))
        {
            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 + (getId() == null ? 0 : getId().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("Ticket(");
        sb.append(" id=").append(getId());
        sb.append(" event=").append(getEvent());
        sb.append(" type=").append(getType());
        sb.append(")");
        return sb.toString();
    }


}