Subversion Repositories SmartDukaan

Rev

Rev 2418 | Rev 3077 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2418 Rev 3073
Line 6... Line 6...
6
import org.json.JSONObject;
6
import org.json.JSONObject;
7
 
7
 
8
public class ProductView extends Event{
8
public class ProductView extends Event{
9
    
9
    
10
    private String productName;
10
    private String productName;
-
 
11
    private String productId;
11
 
12
 
12
    public ProductView(String[] eventFileds) {
13
    public ProductView(String[] eventFileds) {
13
        super(eventFileds);
14
        super(eventFileds);
14
        productName = eventFileds[5].trim();
15
        productName = eventFileds[5].trim();
-
 
16
        if (eventFileds.length > 6) {
-
 
17
            productName = eventFileds[6].trim();
-
 
18
        }
15
    }
19
    }
16
    
20
    
17
    public ProductView(EventType eType, String sessionId, long userId, String email, String[] logData) {
21
    public ProductView(EventType eType, String sessionId, long userId, String email, String[] logData) {
18
        super(eType, sessionId, userId, email);
22
        super(eType, sessionId, userId, email);
19
        productName = logData[0].trim();
23
        productName = logData[0].trim();
-
 
24
        productId = logData[1].trim();
20
    }
25
    }
21
 
26
 
22
    public String toString() {
27
    public String toString() {
23
        StringBuilder sb = new StringBuilder();
28
        StringBuilder sb = new StringBuilder();
24
        sb.append(eventType.name() + ", ");
29
        sb.append(eventType.name() + ", ");
Line 33... Line 38...
33
    @Override
38
    @Override
34
    public JSONObject getLogDataInJson() {
39
    public JSONObject getLogDataInJson() {
35
        JSONObject logDataInJson = new JSONObject();
40
        JSONObject logDataInJson = new JSONObject();
36
        try {
41
        try {
37
            logDataInJson.put("productName", productName);
42
            logDataInJson.put("productName", productName);
-
 
43
            logDataInJson.put("productId_long", productId);
38
        } catch (JSONException e) {
44
        } catch (JSONException e) {
39
            e.printStackTrace();
45
            e.printStackTrace();
40
        }
46
        }
41
        return logDataInJson;
47
        return logDataInJson;
42
    }
48
    }