Administrator.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.admins;

import java.io.Serializable;

/**
 * <p>
 * Represents a user who has the right to create new customers, cars, etc.
 * </p>
 */
// HibernateEntity.vsl annotations merge-point
public abstract class Administrator
    implements Serializable, Comparable<Administrator>
{
    /**
     * The serial version UID of this class. Needed for serialization.
     */
    private static final long serialVersionUID = -64443486394617980L;

    // Generate 4 attributes
    private String name;

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

    /**
     * <p>
     * TODO: Model Documentation for name
     * </p>
     * @param nameIn String
     */
    public void setName(String nameIn)
    {
        this.name = nameIn;
    }

    private String password;

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

    /**
     * <p>
     * TODO: Model Documentation for password
     * </p>
     * @param passwordIn String
     */
    public void setPassword(String passwordIn)
    {
        this.password = passwordIn;
    }

    private String accountNo;

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

    /**
     * <p>
     * TODO: Model Documentation for accountNo
     * </p>
     * @param accountNoIn String
     */
    public void setAccountNo(String accountNoIn)
    {
        this.accountNo = accountNoIn;
    }

    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 businessOperations
    /**
     * <p>
     * TODO: Model Documentation for create
     * </p>
     * @param id <p>
TODO: Model Documentation for id
</p>
     * @param name <p>
TODO: Model Documentation for name
</p>
     * @param accountNo <p>
TODO: Model Documentation for accountNo
</p>
     * @param password <p>
TODO: Model Documentation for password
</p>
     * @return Administrator
     * @throws AdminException
     */
    public abstract Administrator create(long id, String name, String accountNo, String password)
        throws AdminException;

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


        /**
         * Constructs a new instance of {@link Administrator}, taking all possible properties
         * (except the identifier(s))as arguments.
         * @param name String
         * @param password String
         * @param accountNo String
         * @return newInstance Administrator
         */
        public static Administrator newInstance(String name, String password, String accountNo)
        {
            final Administrator entity = new AdministratorImpl();
            entity.setName(name);
            entity.setPassword(password);
            entity.setAccountNo(accountNo);
            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(Administrator other)
    {
        int cmp = 0;
        if (this.getId() != null)
        {
            cmp = this.getId().compareTo(other.getId());
        }
        else
        {
            if (this.getName() != null)
            {
                cmp = (cmp != 0 ? cmp : this.getName().compareTo(other.getName()));
            }
            if (this.getPassword() != null)
            {
                cmp = (cmp != 0 ? cmp : this.getPassword().compareTo(other.getPassword()));
            }
            if (this.getAccountNo() != null)
            {
                cmp = (cmp != 0 ? cmp : this.getAccountNo().compareTo(other.getAccountNo()));
            }
        }
        return cmp;
    }
// HibernateEntity.vsl merge-point
}