// アクティビティタイプ(post or share)
if(!activity.getVerb().equals(Constants.GOOGLE_ACTIVITY_VERB_TYPE_POST)
&& !activity.getVerb().equals(Constants.GOOGLE_ACTIVITY_VERB_TYPE_SHARE)) {
throw new DataInvalidException();
}else {
model.setVerb(new Category(activity.getVerb()));
}
// タイトル
if(activity.getTitle() != null && !activity.getTitle().trim().isEmpty()) {
String title = activity.getTitle();
model.setTitle(new Text(title));
}
// 公開日
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(activity.getPublished().getValue());
calendar.add(Calendar.HOUR, 9);
model.setPublished(calendar.getTime());
// 更新日
model.setUpdated(new Date(activity.getUpdated().getValue()));
// URL
model.setUrl(new Text(activity.getUrl()));
// コンテントの設定
if(activity.getObject().getContent() != null
&& !activity.getObject().getContent().trim().isEmpty()) {
String content = activity.getObject().getContent();
model.setContent(new Text(content));
}
// -------------------------------------------------------
// 添付情報の設定
// -------------------------------------------------------
List<Attachments> attachmentsList = activity.getObject().getAttachments();
if(attachmentsList != null && attachmentsList.size() > 0) {
// 添付情報の一つ目のみを対象とする
Attachments attachment = attachmentsList.get(0);
if(attachment.getObjectType() == null) {
throw new DataInvalidException();
}
// 添付フラグをTrueに設定
model.setAttachmentsFlg(true);
// 添付情報のタイプ
if(attachment.getObjectType() != null) {
if(attachment.getObjectType().equals(Constants.GOOGLE_ACTIVITY_ATTACHMENTS_TYPE_PHOTO)
|| attachment.getObjectType().equals(Constants.GOOGLE_ACTIVITY_ATTACHMENTS_TYPE_VIDEO)
|| attachment.getObjectType().equals(Constants.GOOGLE_ACTIVITY_ATTACHMENTS_TYPE_ARTICLE)
|| attachment.getObjectType().equals(Constants.GOOGLE_ACTIVITY_ATTACHMENTS_TYPE_ALBUM)) {
model.setAttachmentsType(new Category(attachment.getObjectType()));
}else {
throw new DataInvalidException();
}
}else {