Subversion Repositories SmartDukaan

Rev

Rev 2262 | Rev 3208 | 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 ShippingAccess extends Event{
    
    private Long cartId;
    
    public ShippingAccess(String[] eventFileds) {
        super(eventFileds);
        cartId = Long.parseLong(eventFileds[5].trim());
    }
    
    public ShippingAccess(EventType eType, String sessionId, long userId, String email, String[] logData) {
        super(eType, sessionId, userId, email);
        cartId = Long.parseLong(logData[0].trim());
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(eventType.name() + ", ");
        sb.append("userEmail : " + userEmail);
        sb.append(" cartId : " + cartId);
        sb.append(" time : " + time);
        sb.append(" session : " + sessionId);
        
        return sb.toString();
    }
    
    @Override
    public JSONObject getLogDataInJson() {
        JSONObject logDataInJson = new JSONObject();
        try {
            logDataInJson.put("cartId_long", cartId);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return logDataInJson;
    }

    public Long getCartId() {
        return cartId;
    }

    public void setCartId(Long cartId) {
        this.cartId = cartId;
    }
}