DecisionItem.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;
import java.io.Serializable;
/**
* <p>
* TODO: Model Documentation for DecisionItem
* </p>
*/
// HibernateEntity.vsl annotations merge-point
public abstract class DecisionItem
implements Serializable, Comparable<DecisionItem>
{
/**
* The serial version UID of this class. Needed for serialization.
*/
private static final long serialVersionUID = -5103951470166603162L;
// Generate 2 attributes
private boolean rootItem;
/**
* <p>
* Indicates if item is the root of the decision tree. Only one item can have "true" for this
* attribute.
* </p>
* @return this.rootItem boolean
*/
public boolean isRootItem()
{
return this.rootItem;
}
/**
* <p>
* Indicates if item is the root of the decision tree. Only one item can have "true" for this
* attribute.
* </p>
* @param rootItemIn boolean
*/
public void setRootItem(boolean rootItemIn)
{
this.rootItem = rootItemIn;
}
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 DecisionItem yesSuccessor;
/**
* <p>
* TODO: Model Documentation for yesSuccessor
* </p>
* @return this.yesSuccessor DecisionItem
*/
public DecisionItem getYesSuccessor()
{
return this.yesSuccessor;
}
/**
* <p>
* TODO: Model Documentation for yesSuccessor
* </p>
* @param yesSuccessorIn DecisionItem
*/
public void setYesSuccessor(DecisionItem yesSuccessorIn)
{
this.yesSuccessor = yesSuccessorIn;
}
private DecisionItem noSuccessor;
/**
* <p>
* TODO: Model Documentation for noSuccessor
* </p>
* @return this.noSuccessor DecisionItem
*/
public DecisionItem getNoSuccessor()
{
return this.noSuccessor;
}
/**
* <p>
* TODO: Model Documentation for noSuccessor
* </p>
* @param noSuccessorIn DecisionItem
*/
public void setNoSuccessor(DecisionItem noSuccessorIn)
{
this.noSuccessor = noSuccessorIn;
}
// Generate 1 businessOperations
/**
* <p>
* Abstract. Realized by Animal and Question.
* </p>
* @return String
* @throws DecisionException
*/
public abstract String getPrompt()
throws DecisionException;
/**
* Returns <code>true</code> if the argument is an DecisionItem 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 DecisionItem))
{
return false;
}
final DecisionItem that = (DecisionItem)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;
}
/**
* @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(DecisionItem other)
{
int cmp = 0;
if (this.getId() != null)
{
cmp = this.getId().compareTo(other.getId());
}
else
{
}
return cmp;
}
// HibernateEntity.vsl merge-point
}