AccidentDoc.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;
import java.util.Date;

/**
 * <p>
 * Document that describes a car accident that has happened.
 * </p>
 */
// HibernateEntity.vsl annotations merge-point
public abstract class AccidentDoc
    implements Serializable, Comparable<AccidentDoc>
{
    /**
     * The serial version UID of this class. Needed for serialization.
     */
    private static final long serialVersionUID = 4037710021259280483L;

    // Generate 4 attributes
    private Date accidentDate;

    /**
     * <p>
     * TODO: Model Documentation for accidentDate
     * </p>
     * @return this.accidentDate Date
     */
    public Date getAccidentDate()
    {
        return this.accidentDate;
    }

    /**
     * <p>
     * TODO: Model Documentation for accidentDate
     * </p>
     * @param accidentDateIn Date
     */
    public void setAccidentDate(Date accidentDateIn)
    {
        this.accidentDate = accidentDateIn;
    }

    private String fileId;

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

    /**
     * <p>
     * TODO: Model Documentation for fileId
     * </p>
     * @param fileIdIn String
     */
    public void setFileId(String fileIdIn)
    {
        this.fileId = fileIdIn;
    }

    private boolean guilty;

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

    /**
     * <p>
     * TODO: Model Documentation for guilty
     * </p>
     * @param guiltyIn boolean
     */
    public void setGuilty(boolean guiltyIn)
    {
        this.guilty = guiltyIn;
    }

    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 2 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;
    }

    private PartnerInAccident partnerInAccident;

    /**
     * <p>
     * TODO: Model Documentation for partnerInAccident
     * </p>
     * @return this.partnerInAccident PartnerInAccident
     */
    public PartnerInAccident getPartnerInAccident()
    {
        return this.partnerInAccident;
    }

    /**
     * <p>
     * TODO: Model Documentation for partnerInAccident
     * </p>
     * @param partnerInAccidentIn PartnerInAccident
     */
    public void setPartnerInAccident(PartnerInAccident partnerInAccidentIn)
    {
        this.partnerInAccident = partnerInAccidentIn;
    }

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


        /**
         * Constructs a new instance of {@link AccidentDoc}, taking all possible properties
         * (except the identifier(s))as arguments.
         * @param accidentDate Date
         * @param fileId String
         * @param guilty boolean
         * @param contract Contract
         * @param partnerInAccident PartnerInAccident
         * @return newInstance AccidentDoc
         */
        public static AccidentDoc newInstance(Date accidentDate, String fileId, boolean guilty, Contract contract, PartnerInAccident partnerInAccident)
        {
            final AccidentDoc entity = new AccidentDocImpl();
            entity.setAccidentDate(accidentDate);
            entity.setFileId(fileId);
            entity.setGuilty(guilty);
            entity.setContract(contract);
            entity.setPartnerInAccident(partnerInAccident);
            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(AccidentDoc other)
    {
        int cmp = 0;
        if (this.getId() != null)
        {
            cmp = this.getId().compareTo(other.getId());
        }
        else
        {
            if (this.getAccidentDate() != null)
            {
                cmp = (cmp != 0 ? cmp : this.getAccidentDate().compareTo(other.getAccidentDate()));
            }
            if (this.getFileId() != null)
            {
                cmp = (cmp != 0 ? cmp : this.getFileId().compareTo(other.getFileId()));
            }
        }
        return cmp;
    }
// HibernateEntity.vsl merge-point
}