/* * DbItemVersion.java * * Created on June 13, 2007, 9:21 PM * * */ package org.webonweb.runtime.impl.repository.db.jpa; import java.io.Serializable; import java.math.BigInteger; import java.util.Collection; import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * Entity class DbItemVersion * * @author girix */ @Entity @Table(name = "ITEM_VERSION") @NamedQueries( { @NamedQuery(name = "DbItemVersion.findById", query = "SELECT d FROM DbItemVersion d WHERE d.id = :id"), @NamedQuery(name = "DbItemVersion.findByVersionNumber", query = "SELECT d FROM DbItemVersion d WHERE d.versionNumber = :versionNumber"), @NamedQuery(name = "DbItemVersion.findByCreationTimestamp", query = "SELECT d FROM DbItemVersion d WHERE d.creationTimestamp = :creationTimestamp"), @NamedQuery(name = "DbItemVersion.findByComment", query = "SELECT d FROM DbItemVersion d WHERE d.comment = :comment"), @NamedQuery(name = "DbItemVersion.findByOnline", query = "SELECT d FROM DbItemVersion d WHERE d.online = :online"), @NamedQuery(name = "DbItemVersion.findByStatus", query = "SELECT d FROM DbItemVersion d WHERE d.status = :status") }) public class DbItemVersion implements Serializable { @Id @Column(name = "ID", nullable = false) @GeneratedValue(strategy=GenerationType.IDENTITY) private BigInteger id; @Column(name = "VERSION_NUMBER", nullable = false) private int versionNumber; @Column(name = "CREATION_TIMESTAMP", insertable=false, updatable=false) @Temporal(TemporalType.TIMESTAMP) private Date creationTimestamp; @Column(name = "COMMENT") private String comment; @Column(name = "ONLINE", nullable = false) private String online; @Column(name = "STATUS", nullable = false) private String status; @JoinColumn(name = "ITEM_ID", referencedColumnName = "ID") @ManyToOne private DbItem itemId; @JoinColumn(name = "CREATOR", referencedColumnName = "ID") @ManyToOne private DbWowUser creator; @OneToMany(cascade={CascadeType.REMOVE,CascadeType.PERSIST}, mappedBy = "draftOf") private Collection dbItemDraftCollection; @OneToMany(mappedBy = "itemVersion") private Collection dbServiceDataCollection; /** Creates a new instance of DbItemVersion */ public DbItemVersion() { } /** * Creates a new instance of DbItemVersion with the specified values. * @param id the id of the DbItemVersion */ public DbItemVersion(BigInteger id) { this.id = id; } /** * Creates a new instance of DbItemVersion with the specified values. * @param id the id of the DbItemVersion * @param versionNumber the versionNumber of the DbItemVersion * @param online the online of the DbItemVersion * @param status the status of the DbItemVersion */ public DbItemVersion(BigInteger id, int versionNumber, String online, String status) { this.id = id; this.versionNumber = versionNumber; this.online = online; this.status = status; } /** * Gets the id of this DbItemVersion. * @return the id */ public BigInteger getId() { return this.id; } /** * Sets the id of this DbItemVersion to the specified value. * @param id the new id */ public void setId(BigInteger id) { this.id = id; } /** * Gets the versionNumber of this DbItemVersion. * @return the versionNumber */ public int getVersionNumber() { return this.versionNumber; } /** * Sets the versionNumber of this DbItemVersion to the specified value. * @param versionNumber the new versionNumber */ public void setVersionNumber(int versionNumber) { this.versionNumber = versionNumber; } /** * Gets the creationTimestamp of this DbItemVersion. * @return the creationTimestamp */ public Date getCreationTimestamp() { return this.creationTimestamp; } /** * Sets the creationTimestamp of this DbItemVersion to the specified value. * @param creationTimestamp the new creationTimestamp */ public void setCreationTimestamp(Date creationTimestamp) { this.creationTimestamp = creationTimestamp; } /** * Gets the comment of this DbItemVersion. * @return the comment */ public String getComment() { return this.comment; } /** * Sets the comment of this DbItemVersion to the specified value. * @param comment the new comment */ public void setComment(String comment) { this.comment = comment; } /** * Gets the online of this DbItemVersion. * @return the online */ public String getOnline() { return this.online; } /** * Sets the online of this DbItemVersion to the specified value. * @param online the new online */ public void setOnline(String online) { this.online = online; } /** * Gets the status of this DbItemVersion. * @return the status */ public String getStatus() { return this.status; } /** * Sets the status of this DbItemVersion to the specified value. * @param status the new status */ public void setStatus(String status) { this.status = status; } /** * Gets the itemId of this DbItemVersion. * @return the itemId */ public DbItem getItemId() { return this.itemId; } /** * Sets the itemId of this DbItemVersion to the specified value. * @param itemId the new itemId */ public void setItemId(DbItem itemId) { this.itemId = itemId; } /** * Gets the creator of this DbItemVersion. * @return the creator */ public DbWowUser getCreator() { return this.creator; } /** * Sets the creator of this DbItemVersion to the specified value. * @param creator the new creator */ public void setCreator(DbWowUser creator) { this.creator = creator; } /** * Gets the dbItemDraftCollection of this DbItemVersion. * @return the dbItemDraftCollection */ public Collection getDbItemDraftCollection() { return this.dbItemDraftCollection; } /** * Sets the dbItemDraftCollection of this DbItemVersion to the specified value. * @param dbItemDraftCollection the new dbItemDraftCollection */ public void setDbItemDraftCollection(Collection dbItemDraftCollection) { this.dbItemDraftCollection = dbItemDraftCollection; } /** * Gets the dbServiceDataCollection of this DbItemVersion. * @return the dbServiceDataCollection */ public Collection getDbServiceDataCollection() { return this.dbServiceDataCollection; } /** * Sets the dbServiceDataCollection of this DbItemVersion to the specified value. * @param dbServiceDataCollection the new dbServiceDataCollection */ public void setDbServiceDataCollection(Collection dbServiceDataCollection) { this.dbServiceDataCollection = dbServiceDataCollection; } /** * Returns a hash code value for the object. This implementation computes * a hash code value based on the id fields in this object. * @return a hash code value for this object. */ @Override public int hashCode() { int hash = 0; hash += (this.id != null ? this.id.hashCode() : 0); return hash; } /** * Determines whether another object is equal to this DbItemVersion. The result is * true if and only if the argument is not null and is a DbItemVersion object that * has the same id field values as this object. * @param object the reference object with which to compare * @return true if this object is the same as the argument; * false otherwise. */ @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof DbItemVersion)) { return false; } DbItemVersion other = (DbItemVersion)object; if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) return false; return true; } /** * Returns a string representation of the object. This implementation constructs * that representation based on the id fields. * @return a string representation of the object. */ @Override public String toString() { return "org.webonweb.runtime.impl.repository.db.jpa.DbItemVersion[id=" + id + "]"; } }