ParseClassName Tour public class Tour extends ParseObject public User

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
@ParseClassName("Tour")
public class Tour extends ParseObject {
public User getTourGuide() {
User tourGuide = null;
try {
tourGuide = (User) ((User) (get(Columns.COLUMN_TOURGUIDE))).fetchIfNeeded();
} catch (ParseException e) {
e.printStackTrace();
}
return tourGuide;
}
public ParseFile getSnapshot() {
return (ParseFile) get(Columns.COLUMN_SNAPSHOT);
}
public Snapshot getSnapshotParsed() {
Snapshot snapshot = new Snapshot();
// Get parseFile as string
ParseFile snapshotFile = getSnapshot();
if (snapshotFile != null) {
String json;
try {
json = new String(snapshotFile.getData());
} catch (ParseException e) {
e.printStackTrace();
return snapshot;
}
// Parsing json string
snapshot = SnapshotUtil.parseSnapshot(json);
}
return snapshot;
}
public String getName() {
return getString(Columns.COLUMN_NAME);
}
public Date getBeginDate() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
Date date = null;
try {
date = dateFormat.parse(getString(Columns.COLUMN_BEGINDATE));
} catch (java.text.ParseException e) {
e.printStackTrace();
}
return date;
}
public int getDuration() {
return getInt(Columns.COLUMN_DURATION);
}
public int getMemberCount() {
return getInt(Columns.COLUMN_MEMBERCOUNT);
}
public String getTravelAgency() {
return getString(Columns.COLUMN_TRAVELAGENCY);
}
public int getSnapshotVersion() {
return getInt(Columns.COLUMN_SNAPSHOTVERSION);
}
public String getTourCode() {
return getString(Columns.COLUMN_TOURCODE);
}
public String getTouristCode() {
return getString(Columns.COLUMN_TOURISTCODE);
}
public class Columns {
public static final String COLUMN_BEGINDATE = "BEGINDATE";
public static final String COLUMN_DURATION = "DURATION";
public static final String COLUMN_MEMBERCOUNT = "MEMBERCOUNT";
public static final String COLUMN_TRAVELAGENCY = "TRAVELAGENCY";
public static final String COLUMN_NAME = "NAME";
public static final String COLUMN_SNAPSHOT = "SNAPSHOT";
public static final String COLUMN_SNAPSHOTVERSION = "SNAPSHOTVERSION";
public static final String COLUMN_TOURCODE = "TOURCODE";
public static final String COLUMN_TOURGUIDE = "TOURGUIDE";
public static final String COLUMN_TOURISTCODE = "TOURISTCODE";
public static final String COLUMN_TOURISTS = "TOURISTS";
}
}