Package com.google.api.services.plus.model.Activity.PlusObject

Examples of com.google.api.services.plus.model.Activity.PlusObject.Attachments


                    // アルバム内の画像を保存
                    List<Attachments> attachmentsList = activity.getObject().getAttachments();
                    if(attachmentsList != null
                            && attachmentsList.size() > 0) {

                        Attachments attachment = attachmentsList.get(0);
                        if(attachment.getThumbnails() != null && attachment.getThumbnails().size() > 0) {

                            for(Thumbnails thumbnails: attachment.getThumbnails()) {
                                if(thumbnails != null && thumbnails.getImage() != null) {
                                    AlbumService.put(newActivityModel, thumbnails.getUrl(), thumbnails.getImage().getUrl(), thumbnails.getImage().getHeight(), thumbnails.getImage().getWidth());
                                }
                            }
                        }
View Full Code Here


        // 添付情報の設定
        // -------------------------------------------------------
        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()));
            }

            // 添付情報のコンテンツ
            if(attachment.getContent() != null && !attachment.getContent().isEmpty()) {
                String content = attachment.getContent();
                model.setAttachmentsContent(new Text(content));
            }

            // 添付情報のURL
            if(attachment.getUrl() != null) {
                model.setAttachmentsUrl(new Text(attachment.getUrl()));
            }

            // 添付情報のイメージURL
            if(attachment.getImage() != null && attachment.getImage().getUrl() != null) {
                model.setAttachmentsImageUrl(new Text(attachment.getImage().getUrl()));
            }

            // 添付情報のFULLイメージURL
            if(attachment.getFullImage() != null && attachment.getFullImage().getUrl() != null) {
                model.setAttachmentsFullImageUrl(new Text(attachment.getFullImage().getUrl()));
            }

            // 動画情報(添付情報は動画の場合)
            if(attachment.getEmbed() != null) {
                if(attachment.getImage() != null && attachment.getImage().getUrl() != null) {
                    model.setAttachmentsImageUrl(new Text(attachment.getImage().getUrl()));
                }

                model.setEmbedType(attachment.getEmbed().getType());
                model.setEmbedUrl(new Text(attachment.getEmbed().getUrl()));
            }

            // アルバムの場合(アクティビティに画像を設定 twtter POSTを簡単にするため)
            if(attachment.getThumbnails() != null && attachment.getThumbnails().size() > 0) {
                Thumbnails thumbnails = attachment.getThumbnails().get(0);
                if(thumbnails != null && thumbnails.getImage() != null) {
                    model.setAttachmentsImageUrl(new Text(thumbnails.getImage().getUrl()));
                }
            }
        }
View Full Code Here

                        // アルバム内の画像を保存
                        List<Attachments> attachmentsList = activity.getObject().getAttachments();
                        if(attachmentsList != null
                                && attachmentsList.size() > 0) {

                            Attachments attachment = attachmentsList.get(0);
                            if(attachment.getThumbnails() != null && attachment.getThumbnails().size() > 0) {

                                for(Thumbnails thumbnails: attachment.getThumbnails()) {
                                    if(thumbnails != null && thumbnails.getImage() != null) {
                                        AlbumService.put(newActivityModel, thumbnails.getUrl(), thumbnails.getImage().getUrl(), thumbnails.getImage().getHeight(), thumbnails.getImage().getWidth());
                                    }
                                }
                            }
View Full Code Here

TOP

Related Classes of com.google.api.services.plus.model.Activity.PlusObject.Attachments

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.