/*
* DbApiKeyType.java
*
* Created on September 7, 2007, 11:05 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.webonweb.runtime.impl.repository.db.jpa;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
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.Table;
/**
* Entity class DbApiKeyType
*
* @author chun
*/
@Entity
@Table(name = "API_KEY_TYPE")
@NamedQueries( {
@NamedQuery(name = "DbApiKeyType.findById", query = "SELECT d FROM DbApiKeyType d WHERE d.id = :id"),
@NamedQuery(name = "DbApiKeyType.findByKeyName", query = "SELECT d FROM DbApiKeyType d WHERE d.keyName = :keyName"),
@NamedQuery(name = "DbApiKeyType.findByDefaultValue", query = "SELECT d FROM DbApiKeyType d WHERE d.defaultValue = :defaultValue"),
@NamedQuery(name = "DbApiKeyType.findByDescription", query = "SELECT d FROM DbApiKeyType d WHERE d.description = :description"),
@NamedQuery(name = "DbApiKeyType.findByPrivateView", query = "SELECT d FROM DbApiKeyType d WHERE d.privateView = :privateView")
})
public class DbApiKeyType implements Serializable {
@Id
@Column(name = "ID", nullable = false)
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer id;
@Column(name = "KEY_NAME", nullable = false)
private String keyName;
@Column(name = "DEFAULT_VALUE", nullable = false)
private String defaultValue;
@Column(name = "DESCRIPTION", nullable = false)
private String description;
@Column(name = "PRIVATE_VIEW", nullable = false)
private String privateView;
@JoinColumn(name = "KEY_ISSUER_ID", referencedColumnName = "ID")
@ManyToOne(fetch=FetchType.LAZY)
private DbKeyIssuer keyIssuerId;
@Column(name = "POSITION_INDEX", nullable = false)
private int positionIndex;
/** Creates a new instance of DbApiKeyType */
public DbApiKeyType() {
}
/**
* Creates a new instance of DbApiKeyType with the specified values.
* @param id the id of the DbApiKeyType
*/
public DbApiKeyType(Integer id) {
this.id = id;
}
/**
* Creates a new instance of DbApiKeyType with the specified values.
* @param id the id of the DbApiKeyType
* @param keyName the keyName of the DbApiKeyType
* @param defaultValue the defaultValue of the DbApiKeyType
* @param description the description of the DbApiKeyType
* @param privateView the privateView of the DbApiKeyType
*/
public DbApiKeyType(Integer id, String keyName, String defaultValue, String description, String privateView) {
this.id = id;
this.keyName = keyName;
this.defaultValue = defaultValue;
this.description = description;
this.privateView = privateView;
}
/**
* Gets the id of this DbApiKeyType.
* @return the id
*/
public Integer getId() {
return this.id;
}
/**
* Sets the id of this DbApiKeyType to the specified value.
* @param id the new id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* Gets the keyName of this DbApiKeyType.
* @return the keyName
*/
public String getKeyName() {
return this.keyName;
}
/**
* Sets the keyName of this DbApiKeyType to the specified value.
* @param keyName the new keyName
*/
public void setKeyName(String keyName) {
this.keyName = keyName;
}
/**
* Gets the defaultValue of this DbApiKeyType.
* @return the defaultValue
*/
public String getDefaultValue() {
return this.defaultValue;
}
/**
* Sets the defaultValue of this DbApiKeyType to the specified value.
* @param defaultValue the new defaultValue
*/
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
/**
* Gets the description of this DbApiKeyType.
* @return the description
*/
public String getDescription() {
return this.description;
}
/**
* Sets the description of this DbApiKeyType to the specified value.
* @param description the new description
*/
public void setDescription(String description) {
this.description = description;
}
/**
* Gets the privateView of this DbApiKeyType.
* @return the privateView
*/
public String getPrivateView() {
return this.privateView;
}
/**
* Sets the privateView of this DbApiKeyType to the specified value.
* @param privateView the new privateView
*/
public void setPrivateView(String privateView) {
this.privateView = privateView;
}
/**
* Gets the keyIssuerId of this DbApiKeyType.
* @return the keyIssuerId
*/
public DbKeyIssuer getKeyIssuerId() {
return this.keyIssuerId;
}
/**
* Sets the keyIssuerId of this DbApiKeyType to the specified value.
* @param keyIssuerId the new keyIssuerId
*/
public void setKeyIssuerId(DbKeyIssuer keyIssuerId) {
this.keyIssuerId = keyIssuerId;
}
/**
* Gets the positionIndex of this DbApiKeyType.
* @return the positionIndex
*/
public int getPositionIndex() {
return this.positionIndex;
}
/**
* Sets the positionIndex of this DbApiKeyType to the specified value.
* @param positionIndex the new positionIndex
*/
public void setPositionIndex(int positionIndex) {
this.positionIndex = positionIndex;
}
/**
* 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 DbApiKeyType. The result is
* true
if and only if the argument is not null and is a DbApiKeyType 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 DbApiKeyType)) {
return false;
}
DbApiKeyType other = (DbApiKeyType)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 "jpa.DbApiKeyType[id=" + id + "]";
}
}