ReturnDoc.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.contracts;

import java.io.Serializable;

/**
 * <p>
 * The document that describes the return of a car.
 * </p>
 */
// HibernateEntity.vsl annotations merge-point
public abstract class ReturnDoc
    implements Serializable, Comparable<ReturnDoc>
{
    /**
     * The serial version UID of this class. Needed for serialization.
     */
    private static final long serialVersionUID = -1495105589040212490L;

    // Generate 3 attributes
    private boolean returned;

    /**
     * <p>
     * TODO: Model Documentation for returned
     * </p>
     * @return this.returned boolean
     */
    public boolean isReturned()
    {
        return this.returned;
    }

    /**
     * <p>
     * TODO: Model Documentation for returned
     * </p>
     * @param returnedIn boolean
     */
    public void setReturned(boolean returnedIn)
    {
        this.returned = returnedIn;
    }

    private String remarks;

    /**
     * <p>
     * TODO: Model Documentation for remarks
     * </p>
     * @return this.remarks String
     */
    public String getRemarks()
    {
        return this.remarks;
    }

    /**
     * <p>
     * TODO: Model Documentation for remarks
     * </p>
     * @param remarksIn String
     */
    public void setRemarks(String remarksIn)
    {
        this.remarks = remarksIn;
    }

    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 Contract contract;

    /**
     * <p>
     * TODO: Model Documentation for contract
     * </p>
     * @return this.contract Contract
     */
    public Contract getContract()
    {
        return this.contract;
    }

    /**
     * <p>
     * TODO: Model Documentation for contract
     * </p>
     * @param contractIn Contract
     */
    public void setContract(Contract contractIn)
    {
        this.contract = contractIn;
    }

    /**
     * Returns <code>true</code> if the argument is an ReturnDoc 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 ReturnDoc))
        {
            return false;
        }
        final ReturnDoc that = (ReturnDoc)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 ReturnDoc}.
     */
    public static final class Factory
    {
        /**
         * Constructs a new instance of {@link ReturnDoc}.
         * @return new ReturnDocImpl()
         */
        public static ReturnDoc newInstance()
        {
            return new ReturnDocImpl();
        }


        /**
         * Constructs a new instance of {@link ReturnDoc}, taking all possible properties
         * (except the identifier(s))as arguments.
         * @param returned boolean
         * @param remarks String
         * @param contract Contract
         * @return newInstance ReturnDoc
         */
        public static ReturnDoc newInstance(boolean returned, String remarks, Contract contract)
        {
            final ReturnDoc entity = new ReturnDocImpl();
            entity.setReturned(returned);
            entity.setRemarks(remarks);
            entity.setContract(contract);
            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(ReturnDoc other)
    {
        int cmp = 0;
        if (this.getId() != null)
        {
            cmp = this.getId().compareTo(other.getId());
        }
        else
        {
            if (this.getRemarks() != null)
            {
                cmp = (cmp != 0 ? cmp : this.getRemarks().compareTo(other.getRemarks()));
            }
        }
        return cmp;
    }
// HibernateEntity.vsl merge-point
}