Rev 3390 | Blame | Compare with Previous | Last modification | View Log | RSS feed
/****/package in.shop2020.crm.domain;import in.shop2020.crm.TicketCategory;import in.shop2020.crm.TicketPriority;import in.shop2020.crm.TicketStatus;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 description;private TicketStatus status;private TicketPriority priority;private TicketCategory category;private Long assigneeId;// Fields from user communicationprivate Long orderId;private String airwayBillNo;private String productName;// fields for unregistered usersprivate String customerEmailId;private String customerMobileNumber;private String customerName;/*** 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.creatorId = tticket.getCreatorId();ticket.category = tticket.getCategory();ticket.priority = tticket.getPriority();ticket.status = tticket.getStatus();ticket.airwayBillNo = tticket.getAirwayBillNo();ticket.productName = tticket.getProductName();if (tticket.isSetDescription()) {ticket.description = tticket.getDescription();}if (tticket.isSetCustomerId()) {ticket.customerId = tticket.getCustomerId();}if (tticket.isSetCustomerEmailId()) {ticket.customerEmailId = tticket.getCustomerEmailId();}if (tticket.isSetAssigneeId()) {ticket.assigneeId = tticket.getAssigneeId();}if (tticket.isSetOpenDate()) {ticket.openDate = new Date(tticket.getOpenDate());}// Trying to set close date as null in database!if (tticket.isSetCloseDate()) {ticket.closeDate = new Date(tticket.getCloseDate());}if (tticket.isSetOrderId()) {ticket.orderId = tticket.getOrderId();}if (tticket.isSetAirwayBillNo()) {ticket.airwayBillNo = tticket.getAirwayBillNo();}if (tticket.isSetProductName()) {ticket.productName = tticket.getProductName();}if (tticket.isSetCustomerMobileNumber()) {ticket.customerMobileNumber = tticket.getCustomerMobileNumber();}if (tticket.isSetCustomerName()) {ticket.customerName = tticket.getCustomerName();}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.setCreatorId(creatorId);tticket.setDescription(description);tticket.setCategory(category);tticket.setPriority(priority);tticket.setStatus(status);tticket.setAirwayBillNo(airwayBillNo);tticket.setProductName(productName);if (customerId != null) {tticket.setCustomerId(customerId);}if (assigneeId != null) {tticket.setAssigneeId(assigneeId);}if (orderId != null) {tticket.setOrderId(orderId);}if (airwayBillNo != null) {tticket.setAirwayBillNo(airwayBillNo);}if (productName != null) {tticket.setProductName(productName);}if (openDate != null) {tticket.setOpenDate(openDate.getTime());}if (closeDate != null) {tticket.setCloseDate(closeDate.getTime());}if (customerEmailId != null) {tticket.setCustomerEmailId(customerEmailId);}if (customerMobileNumber != null) {tticket.setCustomerMobileNumber(customerMobileNumber);}if (customerName != null) {tticket.setCustomerName(customerName);}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 getCreatorId() {return creatorId;}public void setCreatorId(long creatorId) {this.creatorId = creatorId;}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;}public String getDescription() {return description;}public void setDescription(String description) {this.description = description;}public TicketStatus getStatus() {return status;}public void setStatus(TicketStatus status) {this.status = status;}public TicketPriority getPriority() {return priority;}public void setPriority(TicketPriority priority) {this.priority = priority;}public TicketCategory getCategory() {return category;}public void setCategory(TicketCategory category) {this.category = category;}public Long getAssigneeId() {return assigneeId;}public void setAssigneeId(Long assigneeId) {this.assigneeId = assigneeId;}public String getCustomerEmailId() {return customerEmailId;}public void setCustomerEmailId(String customerEmailId) {this.customerEmailId = customerEmailId;}public String getCustomerMobileNumber() {return customerMobileNumber;}public void setCustomerMobileNumber(String customerMobileNumber) {this.customerMobileNumber = customerMobileNumber;}public String getCustomerName() {return customerName;}public void setCustomerName(String customerName) {this.customerName = customerName;}}