Rev 3073 | 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 Long itemId;public ProductView(String[] eventFileds) {super(eventFileds);productName = eventFileds[5].trim();if (eventFileds.length > 6) {itemId = Long.parseLong(eventFileds[6].trim());}}public ProductView(EventType eType, String sessionId, long userId, String email, String[] logData) {super(eType, sessionId, userId, email);productName = logData[0].trim();itemId = Long.parseLong(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("itemId_long", itemId);} catch (JSONException e) {e.printStackTrace();}return logDataInJson;}public String getProductName() {return productName;}public void setProductName(String productName) {this.productName = productName;}}