Package com.appspot.plucial.controller.task

Source Code of com.appspot.plucial.controller.task.AllActivitysBotController

package com.appspot.plucial.controller.task;

import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;

import com.appspot.plucial.model.UserModel;
import com.appspot.plucial.service.UserService;
import com.google.appengine.api.taskqueue.Queue;
import com.google.appengine.api.taskqueue.QueueFactory;
import com.google.appengine.api.taskqueue.TaskOptions.Builder;

public class AllActivitysBotController extends Controller {

    @Override
    public Navigation run() throws Exception {

        String userId = asString("user");
        UserModel userModel = UserService.getOrNull(userId);

        if(userModel.getRefreshToken() != null && !userModel.isActivityBotPerformingFlg()) {

            // 実行中フラグをtrueにする
            userModel.setActivityBotPerformingFlg(true);
            UserService.put(userModel);

            Queue queue = QueueFactory.getQueue("all-activitys-bot");
            queue.add(Builder.withUrl("/task/allActivitysBotTask").param("user", userModel.getKey().getName()));

        }

        return null;

    }
}
TOP

Related Classes of com.appspot.plucial.controller.task.AllActivitysBotController

TOP
Copyright © 2018 www.massapi.com. 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.