PersonPK.java
// license-header java merge-point
/* Autogenerated by AndroMDA EntityCompositePK.vsl in andromda-ejb3-cartridge on 08/08/2014 12:21:04 - do not edit */
package org.andromda.demo.ejb3.rental;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Embeddable;
/**
* Composite primary key class for Person entity bean.
* <p>
* TODO: Model Documentation for org.andromda.demo.ejb3.rental.Person
* </p>
*/
@Embeddable
public class PersonPK
implements Serializable, Comparable<PersonPK>
{
private static final long serialVersionUID = 1L;
private Long id;
private String tag;
/**
* Get the id property.
* <p>
* TODO: Model Documentation for id
* </p>
* @return Long The value of id
* owning=$property.otherEnd.owning optional=$property.optional $property.otherEnd.fulyQualifiedName many2One=$property.many2One target=$property.otherEnd.many2One
*/
@Column(name="ID", nullable=false)
public Long getId()
{
return this.id;
}
/**
* Set the id property.
* @param value the new value
*/
public void setId(Long value)
{
this.id = value;
}
/**
* Get the tag property.
* <p>
* TODO: Model Documentation for tag
* </p>
* @return String The value of tag
* owning=$property.otherEnd.owning optional=$property.optional $property.otherEnd.fulyQualifiedName many2One=$property.many2One target=$property.otherEnd.many2One
*/
@Column(name="TAG", nullable=false)
public String getTag()
{
return this.tag;
}
/**
* Set the tag property.
* @param value the new value
*/
public void setTag(String value)
{
this.tag = value;
}
/**
* Default empty constructor
*/
public PersonPK()
{
// default empty constructor
}
/**
* Implementation for the main constructor with all POJO identifier properties.
*
* @param id Value for the id property true
* @param tag Value for the tag property false
*/
public PersonPK(Long id, String tag)
{
setId(id);
setTag(tag);
}
/**
* Returns a hash code value for the object
* @return int The hash code value
* @see Object#hashCode
*/
@Override
public int hashCode()
{
int result = 0;
result = 37*result + ((this.id != null) ? this.id.hashCode() : 0);
result = 37*result + ((this.tag != null) ? this.tag.hashCode() : 0);
return result;
}
/**
* Indicates if the argument is of the same type and all values are equal.
* @param object The target object to compare with
* @return boolean True if both objects a 'equal'
* @see Object#equals(Object)
*/
@Override
public boolean equals(Object object)
{
if (object == null)
{
return false;
}
if (object == this)
{
return true;
}
if (!(object instanceof PersonPK))
{
return false;
}
PersonPK pk = (PersonPK)object;
return
pk.id == this.id
&& pk.tag.equals(this.tag);
}
/**
* @see Comparable#compareTo
*/
@Override
public int compareTo(PersonPK o)
{
int cmp = 0;
if (this.getId() != null)
{
cmp = this.getId().compareTo(o.getId());
}
if (this.getTag() != null)
{
cmp = (cmp != 0 ? cmp : this.getTag().compareTo(o.getTag()));
}
return cmp;
}
/**
* Returns a String representation of the composite key object
* @return String Textual representation of the object displaying name/value pairs for all properties
* @see Object#toString
*/
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("PersonPK(");
sb.append(" id=").append(getId());
sb.append(" tag=").append(getTag());
sb.append(")");
return sb.toString();
}
}