Rev 2418 | Rev 3077 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package in.shop2020.datalogger.event;import in.shop2020.datalogger.EventType;import org.json.JSONException;import org.json.JSONObject;public class ProductView extends Event{private String productName;private String productId;public ProductView(String[] eventFileds) {super(eventFileds);productName = eventFileds[5].trim();if (eventFileds.length > 6) {productName = eventFileds[6].trim();}}public ProductView(EventType eType, String sessionId, long userId, String email, String[] logData) {super(eType, sessionId, userId, email);productName = logData[0].trim();productId = logData[1].trim();}public String toString() {StringBuilder sb = new StringBuilder();sb.append(eventType.name() + ", ");sb.append("userEmail : " + userEmail);sb.append(" productName : " + productName);sb.append(" time : " + time);sb.append(" session : " + sessionId);return sb.toString();}@Overridepublic JSONObject getLogDataInJson() {JSONObject logDataInJson = new JSONObject();try {logDataInJson.put("productName", productName);logDataInJson.put("productId_long", productId);} catch (JSONException e) {e.printStackTrace();}return logDataInJson;}public String getProductName() {return productName;}public void setProductName(String productName) {this.productName = productName;}}