Rev 3106 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
/****/package in.shop2020.crm.domain;import java.text.ParseException;import java.util.Date;/*** Domain class for tickets in CRM. Many other fields of ticket are tracked via activity.* Especially the ones that can change through the lifetime of a ticket. A ticket should* be thought of as a series of activities.** @author mandeep*/public class Ticket {private long id;private long customerId;private Date openDate;private Date closeDate;private long creatorId;private String subject;// additional receipient of email notifications of the ticketprivate long receipientId;// Fields from user communicationprivate long orderId;private String airwayBillNo;private String productName;/*** Converts thrift ticket object representation to our domain object** @param tticket* @return* @throws ParseException*/public static Ticket create(in.shop2020.crm.Ticket tticket)throws ParseException {Ticket ticket = new Ticket();ticket.id = tticket.getId();ticket.customerId = tticket.getCustomerId();ticket.receipientId = tticket.getReceipientId();ticket.creatorId = tticket.getCreatorId();if (tticket.isSetOpenDate()) {ticket.openDate = new Date(tticket.getOpenDate());}// Trying to set close date as null in database!if (tticket.isSetCloseDate() && tticket.getCloseDate() != 0) {ticket.closeDate = new Date(tticket.getCloseDate());}ticket.subject = tticket.getSubject();ticket.orderId = tticket.getOrderId();ticket.airwayBillNo = tticket.getAirwayBillNo();ticket.productName = tticket.getProductName();return ticket;}/*** Converts this object to its corresponding thrift representation.* @return*/public in.shop2020.crm.Ticket getThriftTicket() {in.shop2020.crm.Ticket tticket = new in.shop2020.crm.Ticket();tticket.setId(id);tticket.setCustomerId(customerId);tticket.setCreatorId(creatorId);tticket.setReceipientId(receipientId);tticket.setSubject(subject);tticket.setOrderId(orderId);tticket.setAirwayBillNo(airwayBillNo);tticket.setProductName(productName);if (openDate != null) {tticket.setOpenDate(openDate.getTime());}if (closeDate != null) {tticket.setCloseDate(closeDate.getTime());}return tticket;}public long getId() {return id;}public void setId(long id) {this.id = id;}public long getCustomerId() {return customerId;}public void setCustomerId(long customerId) {this.customerId = customerId;}public Date getOpenDate() {return openDate;}public void setOpenDate(Date openDate) {this.openDate = openDate;}public Date getCloseDate() {return closeDate;}public void setCloseDate(Date closeDate) {this.closeDate = closeDate;}public long getReceipientId() {return receipientId;}public void setReceipientId(long receipientId) {this.receipientId = receipientId;}public long getCreatorId() {return creatorId;}public void setCreatorId(long creatorId) {this.creatorId = creatorId;}public String getSubject() {return subject;}public void setSubject(String subject) {this.subject = subject;}public long getOrderId() {return orderId;}public void setOrderId(long orderId) {this.orderId = orderId;}public String getAirwayBillNo() {return airwayBillNo;}public void setAirwayBillNo(String airwayBillNo) {this.airwayBillNo = airwayBillNo;}public String getProductName() {return productName;}public void setProductName(String productName) {this.productName = productName;}}