/*
* FinTP - Financial Transactions Processing Application
* Copyright (C) 2013 Business Information Systems (Allevo) S.R.L.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>
* or contact Allevo at : 031281 Bucuresti, 23C Calea Vitan, Romania,
* phone +40212554577, office@allevo.ro <mailto:office@allevo.ro>, www.allevo.ro.
*/
package ro.allevo.fintpws.model.messagesViews;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Transient;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
/**
* @author remus
* @version $Revision: 1.0 $ The persistent class for the MT202VIEW database
* view.
*/
@Entity
public class Mt202View extends MtView implements Serializable{
/*
* TODO: try to use only one query, investigate how to specify time stamp
* type in order to use one named query ELECT m FROM Mt202View m WHERE
* m.insertdate < :at OR :an = NULL
*/
/**
*
*/
private static final long serialVersionUID = -854041260242708438L;
@Id
private String guid;
private String msgtype;
private String sender;
private String receiver;
private String trn;
private Timestamp insertdate;
private BigDecimal amount;
private String currency;
private String valuedate;
private String service;
private String queuename;
private String payload;
public String getGuid() {
return guid;
}
public void setGuid(String guid) {
this.guid = guid;
}
public String getMsgtype() {
return msgtype;
}
public void setMsgtype(String msgtype) {
this.msgtype = msgtype;
}
public String getSender() {
return sender;
}
public void setSender(String sender) {
this.sender = sender;
}
public String getReceiver() {
return receiver;
}
public void setReceiver(String receiver) {
this.receiver = receiver;
}
public String getTrn() {
return trn;
}
public void setTrn(String trn) {
this.trn = trn;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public String getService() {
return service;
}
public void setService(String service) {
this.service = service;
}
public String getQueuename() {
return queuename;
}
public void setQueuename(String queuename) {
this.queuename = queuename;
}
public String getPayload() {
return payload;
}
public void setPayload(String payload) {
this.payload = payload;
}
public Timestamp getInsertdate() {
return insertdate;
}
public void setInsertdate(Timestamp insertdate) {
this.insertdate = insertdate;
}
public String getValuedate() {
return valuedate;
}
public void setValuedate(String valuedate) {
this.valuedate = valuedate;
}
@Override
@Transient
public JSONObject toJSON() throws JSONException {
JSONObject entityAsJson = new JSONObject();
entityAsJson.put("guid", getGuid()).put("messagetype", getMsgtype())
.put("sender", getSender()).put("receiver", getReceiver())
.put("trn", getTrn()).put("valuedate", getValuedate())
.put("insertdate", getInsertdate()).put("amount", getAmount())
.put("currency", getCurrency()).put("service", getService())
.put("queuename", getQueuename()).put("payload", getPayload());
return entityAsJson;
}
}