Package com.appspot.plucial.model

Examples of com.appspot.plucial.model.ActivityModel


        try {
            while (activities != null) {
                for (Activity activity : activities) {

                        ActivityModel oldModel = ActivityService.getActivity(activity.getId());

                        // 新規アクティビティ
                        if(oldModel == null) {
                            // アクティビティを追加
                            try {
View Full Code Here


        // タスクは成功するまで実行されるため、失敗時は例外をキャッチして再実行をさせない
        try{
            // アクティビティの取得
            String activityId = asString("activityId");

            ActivityModel activityModel = ActivityService.getActivity(activityId);
            if(activityModel == null) return null;

            // 再共有の場合は投稿対象外にする
            if(activityModel.getVerb().getCategory().equals(Constants.GOOGLE_ACTIVITY_VERB_TYPE_SHARE)) {
                return null;
            }

            // Facebook オブジェクトの取得
            Facebook facebook = getFaceBookObject(userModel);


            // メッセージの作成
            String msg = getMessage(activityModel);

            // POST
            if(!activityModel.isAttachmentsFlg()) {
                // 添付がない場合
                if(msg != null) {
                    facebook.postStatusMessage(msg);
                }

            }else if(activityModel.getAttachmentsType().getCategory().equals(Constants.GOOGLE_ACTIVITY_ATTACHMENTS_TYPE_ARTICLE)) {
                // リンク付き投稿の場合
                URL attachmentsUrl = new URL(activityModel.getAttachmentsUrlString());

                if(msg == null) {
                    facebook.postLink(attachmentsUrl);

                }else {
                    facebook.postLink(attachmentsUrl, msg);
                }

            }else if(activityModel.getAttachmentsType() != null
                    && (activityModel.getAttachmentsType().getCategory().equals(Constants.GOOGLE_ACTIVITY_ATTACHMENTS_TYPE_PHOTO)
                    || activityModel.getAttachmentsType().getCategory().equals(Constants.GOOGLE_ACTIVITY_ATTACHMENTS_TYPE_ALBUM))
                      && activityModel.getVerb().getCategory().equals(Constants.GOOGLE_ACTIVITY_VERB_TYPE_POST)) {
                // 写真付き投稿の場合

                Media media = getPhotoMedia(activityModel.getAttachmentsImageUrlString());
                PhotoUpdate photoUpdate = new PhotoUpdate(media);

                if(msg != null) {
                    photoUpdate.setMessage(msg);
                }

                facebook.postPhoto(photoUpdate);


//            }else if(activityModel.getAttachmentsType() != null
//                    &activityModel.getAttachmentsType().getCategory().equals(Constants.GOOGLE_ACTIVITY_ATTACHMENTS_TYPE_ALBUM)
//                      && activityModel.getVerb().getCategory().equals(Constants.GOOGLE_ACTIVITY_VERB_TYPE_POST)) {
//                // アルバム投稿の場合
//
//                AlbumUpdate albumUpdate = new AlbumUpdate("PluCial");
//
//                // メッセージを追加
//                if(msg != null) {
//                    albumUpdate.setMessage(msg);
//                }
//
//                // アルバムを作成
//                String albumId = facebook.createAlbum(albumUpdate);
//
//                // アルバムの写真リストを取得
//                List<AlbumModel> albmList = activityModel.getAlbumModelListRef().getModelList();
//
//                // アルバムに写真の追加
//                for(AlbumModel albumModel: albmList) {
//                    Media media = getPhotoMedia(Utils.changeAlbumUrl(albumModel));
//                    facebook.addAlbumPhoto(albumId, media);
//                }


            }else if(activityModel.getAttachmentsType() != null
                    && activityModel.getAttachmentsType().getCategory().equals(Constants.GOOGLE_ACTIVITY_ATTACHMENTS_TYPE_VIDEO)) {
                // 動画の場合
                URL embedUrl = new URL(activityModel.getEmbedUrlString());

                if(msg == null) {
                    facebook.postLink(embedUrl);

                }else {
View Full Code Here

    @Override
    protected Navigation execute(UserModel userModel) throws Exception {

        String activityId = asString("activity");

        ActivityModel activityModel = ActivityService.getActivity(activityId);

        if(activityModel == null) return redirect("/");

        try {
            ActivityService.delete(userModel, activityModel);
View Full Code Here

        // 対象のアクティビティを取得
        List<ActivityModel> activityList = new ArrayList<ActivityModel>();
        for (ScoredDocument document : results) {
            String activityId = document.getId();
            ActivityModel activityModel = ActivityService.getActivity(activityId);

            try {
                if(updateActivity(activityModel, userModel)) {
                    activityModel = ActivityService.getActivity(activityId);
                }
View Full Code Here

        // タスクは成功するまで実行されるため、失敗時は例外をキャッチして再実行をさせない
        try{
            // アクティビティの取得
            String activityId = asString("activityId");
            ActivityModel activityModel = ActivityService.getActivity(activityId);
            if(activityModel == null) return null;

            // 再共有の場合は投稿対象外にする
            if(activityModel.getVerb().getCategory().equals(Constants.GOOGLE_ACTIVITY_VERB_TYPE_SHARE)) {
                return null;
            }

            // Evernote オブジェクトの取得
            NoteStoreClient noteStoreClient = getNoteStoreClient(userModel);
            Note note = new Note();
            note.setTitle(getNoteTitle(activityModel));

            // ノートBody
            String nBody = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
            nBody += "<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">";
            nBody += "<en-note>";

            nBody += "<div style=\"font-family: 'Helvetica Neue', Helvetica, Arial, 'Liberation Sans', FreeSans, sans-serif; color: rgb(88, 89, 87); font-size: 14px; line-height: 1.5; overflow-y: hidden; background: rgb(230, 230, 230);margin: -20px;\">";
            nBody += "<div style=\"height: 40px;\">&nbsp;</div>";
            nBody += "<div style=\"max-width: 600px;padding: 25px 0px 0px 0px;background-color: #fff;margin: 0 auto;box-shadow: 0 0px 5px rgba(0, 0, 0, 0.2);\">";

            nBody += Utils.removeLinkTags(getNoteContents(activityModel));
            nBody += getNoteAttachmentsContents(activityModel);

            // 下部メニュー
            nBody += "<div style=\"background: #f5f5f5;min-height: 16px;padding: 1px 30px;text-align: center;border-top: 1px solid #ebebeb;margin-top: 20px;\">";
            nBody += "<p style=\"color: #747474;line-height: 1.5em;\">";
            nBody += "<a href=\"" + activityModel.getUrlString() + "\" style=\"text-decoration: none;color: #747474;\" target=\"_blank\">Google+で見る</a>";
            nBody += "</p>";
            nBody += "</div>";

            nBody += "</div>";
            nBody += "<div style=\"height: 40px;\">&nbsp;</div>";
View Full Code Here

TOP

Related Classes of com.appspot.plucial.model.ActivityModel

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.