PartnerInAccident.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>
 * Describes the "partner" (as seen from the driver) in the car accident.
 * </p>
 */
// HibernateEntity.vsl annotations merge-point
public abstract class PartnerInAccident
    implements Serializable, Comparable<PartnerInAccident>
{
    /**
     * The serial version UID of this class. Needed for serialization.
     */
    private static final long serialVersionUID = 2619977886075965658L;

    // Generate 5 attributes
    private String driverName;

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

    /**
     * <p>
     * TODO: Model Documentation for driverName
     * </p>
     * @param driverNameIn String
     */
    public void setDriverName(String driverNameIn)
    {
        this.driverName = driverNameIn;
    }

    private String ownerName;

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

    /**
     * <p>
     * TODO: Model Documentation for ownerName
     * </p>
     * @param ownerNameIn String
     */
    public void setOwnerName(String ownerNameIn)
    {
        this.ownerName = ownerNameIn;
    }

    private String ownerAddress;

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

    /**
     * <p>
     * TODO: Model Documentation for ownerAddress
     * </p>
     * @param ownerAddressIn String
     */
    public void setOwnerAddress(String ownerAddressIn)
    {
        this.ownerAddress = ownerAddressIn;
    }

    private String ownersInsuranceNo;

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

    /**
     * <p>
     * TODO: Model Documentation for ownersInsuranceNo
     * </p>
     * @param ownersInsuranceNoIn String
     */
    public void setOwnersInsuranceNo(String ownersInsuranceNoIn)
    {
        this.ownersInsuranceNo = ownersInsuranceNoIn;
    }

    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 AccidentDoc accidentDoc;

    /**
     * <p>
     * TODO: Model Documentation for accidentDoc
     * </p>
     * @return this.accidentDoc AccidentDoc
     */
    public AccidentDoc getAccidentDoc()
    {
        return this.accidentDoc;
    }

    /**
     * <p>
     * TODO: Model Documentation for accidentDoc
     * </p>
     * @param accidentDocIn AccidentDoc
     */
    public void setAccidentDoc(AccidentDoc accidentDocIn)
    {
        this.accidentDoc = accidentDocIn;
    }

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


        /**
         * Constructs a new instance of {@link PartnerInAccident}, taking all possible properties
         * (except the identifier(s))as arguments.
         * @param driverName String
         * @param ownerName String
         * @param ownerAddress String
         * @param ownersInsuranceNo String
         * @param accidentDoc AccidentDoc
         * @return newInstance PartnerInAccident
         */
        public static PartnerInAccident newInstance(String driverName, String ownerName, String ownerAddress, String ownersInsuranceNo, AccidentDoc accidentDoc)
        {
            final PartnerInAccident entity = new PartnerInAccidentImpl();
            entity.setDriverName(driverName);
            entity.setOwnerName(ownerName);
            entity.setOwnerAddress(ownerAddress);
            entity.setOwnersInsuranceNo(ownersInsuranceNo);
            entity.setAccidentDoc(accidentDoc);
            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(PartnerInAccident other)
    {
        int cmp = 0;
        if (this.getId() != null)
        {
            cmp = this.getId().compareTo(other.getId());
        }
        else
        {
            if (this.getDriverName() != null)
            {
                cmp = (cmp != 0 ? cmp : this.getDriverName().compareTo(other.getDriverName()));
            }
            if (this.getOwnerName() != null)
            {
                cmp = (cmp != 0 ? cmp : this.getOwnerName().compareTo(other.getOwnerName()));
            }
            if (this.getOwnerAddress() != null)
            {
                cmp = (cmp != 0 ? cmp : this.getOwnerAddress().compareTo(other.getOwnerAddress()));
            }
            if (this.getOwnersInsuranceNo() != null)
            {
                cmp = (cmp != 0 ? cmp : this.getOwnersInsuranceNo().compareTo(other.getOwnersInsuranceNo()));
            }
        }
        return cmp;
    }
// HibernateEntity.vsl merge-point
}