/**
* Copyright 2014 Comcast Cable Communications Management, LLC
*
* This file is part of CATS.
*
* CATS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CATS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with CATS. If not, see <http://www.gnu.org/licenses/>.
*/
package com.comcast.cats.keymanager.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
/**
* KeyCodes generated by hbm2java. Added Named queries, additional constructors,
* getters and setters.
*
* @author thusai000
*
*/
@Entity(name = "KeyCodes")
@Table(name = "key_codes", catalog = "keymanager")
@NamedQueries( {
@NamedQuery(name = "KeyCodes.FindByTypeFormat", query = "SELECT kc FROM KeyCodes kc "
+ "WHERE kc.remoteType.remoteTypeName =:remoteType"
+ " AND kc.keyCodeFormat.keyCodeFormatName =:formatName"),
@NamedQuery(name = "KeyCodes.FindByTypeFormatName", query = "SELECT kc FROM KeyCodes kc "
+ "WHERE kc.keyCodeFormat.keyCodeFormatName =:formatName"
+ " AND kc.remoteType.remoteTypeName =:remoteType"
+ " AND kc.keyName =:keyName") })
public class KeyCodes implements java.io.Serializable {
/**
*
*/
private static final long serialVersionUID = -2926316150088015474L;
private Integer keyCodesId;
private RemoteType remoteType;
private KeyCodeFormat keyCodeFormat;
private String keyName;
private String keyCodeValue;
/**
* Default constructor.
*/
public KeyCodes() {
}
/**
* ID auto-generated. Every other field is required when adding a new
* Keycode.
*
* @param remoteType
* @param keyCodeFormat
* @param keyName
* @param keyCodeValue
*/
public KeyCodes(RemoteType remoteType, KeyCodeFormat keyCodeFormat,
String keyName, String keyCodeValue) {
this.remoteType = remoteType;
this.keyCodeFormat = keyCodeFormat;
this.keyName = keyName;
this.keyCodeValue = keyCodeValue;
}
/**
* All parameters passed during construction time.
*
* @param keyCodesId
* @param remoteType
* @param keyCodeFormat
* @param keyName
* @param keyCodeValue
*/
public KeyCodes(int keyCodesId, RemoteType remoteType,
KeyCodeFormat keyCodeFormat, String keyName, String keyCodeValue) {
this.keyCodesId = keyCodesId;
this.remoteType = remoteType;
this.keyCodeFormat = keyCodeFormat;
this.keyName = keyName;
this.keyCodeValue = keyCodeValue;
}
/**
* @return
*/
@Id
@GeneratedValue
@Column(name = "key_codes_id", unique = true, nullable = false)
public Integer getKeyCodesId() {
return this.keyCodesId;
}
/**
* @param keyCodesId
*/
public void setKeyCodesId(Integer keyCodesId) {
this.keyCodesId = keyCodesId;
}
/**
* @return
*/
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "FK_remote_type_id", nullable = false)
public RemoteType getRemoteType() {
return this.remoteType;
}
public void setRemoteType(RemoteType remoteType) {
this.remoteType = remoteType;
}
/**
* @return
*/
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "FK_key_code_format_id", nullable = false)
public KeyCodeFormat getKeyCodeFormat() {
return this.keyCodeFormat;
}
/**
* @param keyCodeFormat
*/
public void setKeyCodeFormat(KeyCodeFormat keyCodeFormat) {
this.keyCodeFormat = keyCodeFormat;
}
/**
* @return
*/
@Column(name = "key_name", nullable = false, length = 45)
public String getKeyName() {
return this.keyName;
}
/**
* @param keyName
*/
public void setKeyName(String keyName) {
this.keyName = keyName;
}
/**
* @return
*/
@Column(name = "key_code_value", nullable = false, length = 1024)
public String getKeyCodeValue() {
return this.keyCodeValue;
}
/**
* @param keyCodeValue
*/
public void setKeyCodeValue(String keyCodeValue) {
this.keyCodeValue = keyCodeValue;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return ("\n" + this.keyCodesId + ": " + this.keyName);
}
}