Package com.appspot.plucial.exception

Examples of com.appspot.plucial.exception.DataInvalidException


        model.setPublicFlg(true);

        // アクティビティタイプ(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 {
                throw new DataInvalidException();
            }

            // 添付情報の表示名
            if(attachment.getDisplayName() != null && !attachment.getDisplayName().isEmpty()) {
                model.setAttachmentsDisplayName(new Text(attachment.getDisplayName()));
View Full Code Here


//                        System.out.println(Utils.differenceDays(baseDate, published));
//                    }

                    // 今日のアクティビティのみを取込む
                    if(Utils.differenceDays(baseDate, published) != 0) {
                        throw new DataInvalidException();
                    }

                    try {

                        ActivityModel oldModel = ActivityService.getActivity(activity.getId());
View Full Code Here

                        }else {
                            // 最後まで取り込みが完了しているユーザーで、
                            // 存在するアクティビティに到着した場合は処理を終了する。
                            if(userModel.isInputActivityLastFinishFlg()) {
                                throw new DataInvalidException();
                            }
                        }
                }

                // 次のページのトークンが null になると、最終ページに到達したことがわかります。
View Full Code Here

TOP

Related Classes of com.appspot.plucial.exception.DataInvalidException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.