}
}
}
private DoubanEventEntryObj generateEventEntryObj(String title, EventType type, String content, boolean inviteOnly, boolean canInvite, Date startTime, Date endTime, String where) {
DoubanEventEntryObj entry = new DoubanEventEntryObj();
if (title != null && title.length() > 0) {
entry.setTitle(title);
} else {
return null;
}
if (content != null && content.length() > 0) {
entry.setContent(content);
} else {
return null;
}
if (type == null) {
return null;
}
String typeStr = "http://www.douban.com/2007#event." + type.getValue();
//<category scheme="http://www.douban.com/2007#kind" term="http://www.douban.com/2007#event.music"/>
DoubanCategoryObj cat = new DoubanCategoryObj();
cat.setScheme("http://www.douban.com/2007#kind");
cat.setTerm(typeStr);
entry.setCategory(cat);
DoubanAttributeObj inviteOnlyAtt = new DoubanAttributeObj();
inviteOnlyAtt.setName("invite_only");
DoubanAttributeObj canInviteAtt = new DoubanAttributeObj();
canInviteAtt.setName("can_invite");
if (inviteOnly) {
inviteOnlyAtt.setValue("yes");
} else {
inviteOnlyAtt.setValue("no");
}
if (canInvite) {
canInviteAtt.setValue("yes");
} else {
canInviteAtt.setValue("no");
}
List<DoubanAttributeObj> atts = new ArrayList<DoubanAttributeObj>();
atts.add(canInviteAtt);
atts.add(inviteOnlyAtt);
entry.setAttrs(atts);
if (startTime.after(endTime)) {
return null;
}
String startTimeStr = Converters.convertDateToStringInRFC3339(startTime);
String endTimeStr = Converters.convertDateToStringInRFC3339(endTime);
DoubanWhenObj when = new DoubanWhenObj();
when.setStartTime(startTimeStr);
when.setEndTime(endTimeStr);
entry.setWhen(when);
DoubanWhereObj whereObj = new DoubanWhereObj();
whereObj.setValue(where);
entry.setWhere(whereObj);
return entry;
}