Question.java

// license-header java merge-point
//
// Attention: Generated code! Do not modify by hand!
// Generated by hibernate/HibernateEntity.vsl in andromda-hibernate-cartridge.
//
package org.andromda.samples.animalquiz.decisiontree;

/**
 * <p>
 * TODO: Model Documentation for Question
 * </p>
 */
// HibernateEntity.vsl annotations merge-point
public abstract class Question
    extends DecisionItemImpl
{
    /**
     * The serial version UID of this class. Needed for serialization.
     */
    private static final long serialVersionUID = 4520599785776894585L;

    // Generate 1 attributes
    private String promptString;

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

    /**
     * <p>
     * TODO: Model Documentation for promptString
     * </p>
     * @param promptStringIn String
     */
    public void setPromptString(String promptStringIn)
    {
        this.promptString = promptStringIn;
    }

    // Generate 1 businessOperations
    /**
     * <p>
     * TODO: Model Documentation for getPrompt
     * </p>
     * @return String
     */
    public abstract String getPrompt();

    /**
     * This entity does not have any identifiers
     * but since it extends the <code>DecisionItemImpl</code> class
     * it will simply delegate the call up there.
     *
     * @see DecisionItem#equals(Object)
     */
    @Override
    public boolean equals(Object object)
    {
        return super.equals(object);
    }

    /**
     * This entity does not have any identifiers
     * but since it extends the <code>DecisionItemImpl</code> class
     * it will simply delegate the call up there.
     *
     * @see DecisionItem#hashCode()
     */
    @Override
    public int hashCode()
    {
        return super.hashCode();
    }

    /**
     * Constructs new instances of {@link Question}.
     */
    public static final class Factory
    {
        /**
         * Constructs a new instance of {@link Question}.
         * @return new QuestionImpl()
         */
        public static Question newInstance()
        {
            return new QuestionImpl();
        }

        /**
         * Constructs a new instance of {@link Question}, taking all required and/or
         * read-only properties as arguments, except for identifiers.
         * @param rootItem boolean
         * @return newInstance
         */
        public static Question newInstance(boolean rootItem)
        {
            final Question entity = new QuestionImpl();
            entity.setRootItem(rootItem);
            return entity;
        }

        /**
         * Constructs a new instance of {@link Question}, taking all possible properties
         * (except the identifier(s))as arguments.
         * @param promptString String
         * @param rootItem boolean
         * @param yesSuccessor DecisionItem
         * @param noSuccessor DecisionItem
         * @return newInstance Question
         */
        public static Question newInstance(String promptString, boolean rootItem, DecisionItem yesSuccessor, DecisionItem noSuccessor)
        {
            final Question entity = new QuestionImpl();
            entity.setPromptString(promptString);
            entity.setRootItem(rootItem);
            entity.setYesSuccessor(yesSuccessor);
            entity.setNoSuccessor(noSuccessor);
            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
     */
    public int compareTo(Question other)
    {
        int cmp = 0;
        if (this.getId() != null)
        {
            cmp = this.getId().compareTo(other.getId());
        }
        else
        {
            if (this.getPromptString() != null)
            {
                cmp = (cmp != 0 ? cmp : this.getPromptString().compareTo(other.getPromptString()));
            }
        }
        return cmp;
    }
// HibernateEntity.vsl merge-point
}