Rev 2262 | 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 ProductSearch extends Event{private String query;private Long categoryId;private Long totalResults;public ProductSearch(String[] eventFileds) {super(eventFileds);query = eventFileds[5].trim();categoryId = Long.parseLong(eventFileds[6].trim());totalResults = Long.parseLong(eventFileds[7].trim());}public ProductSearch(EventType eType, String sessionId, long userId,String email, String[] logData) {super(eType, sessionId, userId, email);query = logData[0].trim();categoryId = Long.parseLong(logData[1].trim());totalResults = Long.parseLong(logData[2].trim());}public String toString() {StringBuilder sb = new StringBuilder();sb.append(eventType.name() + ", ");sb.append("userEmail : " + userEmail);sb.append(" query : " + query);sb.append(" CategoryId : " + categoryId);sb.append(" totalResults : " + totalResults);sb.append(" time : " + time);sb.append(" session : " + sessionId);return sb.toString();}@Overridepublic JSONObject getLogDataInJson() {JSONObject logDataInJson = new JSONObject();try {logDataInJson.put("query", query);logDataInJson.put("categoryId_long", categoryId);logDataInJson.put("totalResults_long", totalResults);} catch (JSONException e) {e.printStackTrace();}return logDataInJson;}public String getQuery() {return query;}public void setQuery(String query) {this.query = query;}public Long getCategoryId() {return categoryId;}public void setCategoryId(Long categoryId) {this.categoryId = categoryId;}public Long getTotalResult() {return totalResults;}public void setTotalResult(Long totalResult) {this.totalResults = totalResult;}}