@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";
}
}