Examples of UserModel


Examples of com.andrewnatoli.jbug.controlpanel.user.UserModel

    /**
     * Assemble the GUI
     */
    protected void buildGUI(boolean isNewIssue) {
        System.out.println("Preparing issue view");
        author = new UserModel(issue.getUser_id());
        setLayout(new GridLayout(3,1));
        setPreferredSize(new Dimension(600, 300));

        /*
            Top row elements
View Full Code Here

Examples of com.appspot.plucial.model.UserModel

        if (!tokenInfo.getIssuedTo().equals(Constants.GOOGLE_PROJECT_CLIENT_ID)) {
            throw new Exception();
        }

        // ユーザー情報の取得
        UserModel userModel = UserService.getOrNull(tokenInfo.getUserId());

        if(userModel == null) {

            // ユーザー制限チェック
            List<UserModel> userList =  UserService.getAllUserList();
            if(userList.size() > 1000) {
                throw new UserMaxLimitException();
            }

            // ---------------------------------------------------------
            // ユーザー登録
            // ---------------------------------------------------------

            // Google Plus APIを使ってユーザー情報を取得する
            Plus plus = new Plus.Builder(TRANSPORT, JSON_FACTORY, credential)
            .setApplicationName(Constants.GOOGLE_APPLICATION_NAME)
            .build();
            Person person = plus.people().get("me").execute();

            userModel = UserService.put(
                tokenInfo.getUserId(),
                tokenInfo.getEmail(),
                person.getUrl(),
                person.getDisplayName(),
                person.getImage(),
                person.getTagline(),
                person.getBraggingRights(),
                person.getAboutMe(),
                person.getCover(),
                credential.getAccessToken(),
                credential.getRefreshToken()
                );

            // URLS登録
            if(person.getUrls() != null && person.getUrls().size() > 0) {
                List<Urls> urlsList = person.getUrls();

                for(Urls urls: urlsList) {
                    UserUrlsService.put(userModel, urls.getValue(), urls.getType(), urls.getLabel());
                }
            }

            // ユーザー数のキャッシュをクリア
            UserService.clearUserCountAndListMemcache();

        }else {
            // ---------------------------------------------------------
            // ユーザーログイン
            // ---------------------------------------------------------
            // ログインユーザーのアクセストークンとリフレッシュトークンを更新
            userModel.setAccessToken(credential.getAccessToken());
            if(credential.getRefreshToken() != null) {
                userModel.setRefreshToken(credential.getRefreshToken());
            }
            UserService.put(userModel);
        }

        // ユーザー情報をセッションに入れる
View Full Code Here

Examples of com.appspot.plucial.model.UserModel

public abstract class PubBaseController extends Controller {

    @Override
    protected Navigation run() throws Exception {

        UserModel acsessUserModel = null;
        UserModel loginUserModel = null;

        try {
            // アクセスしているページのユーザー情報を取得
            acsessUserModel = getAccessUserModel();
            S3QueryResultList<DateModel> dateModelList = DateService.getDateModelList(acsessUserModel, null);
View Full Code Here

Examples of com.appspot.plucial.model.UserModel

    protected static final JacksonFactory JSON_FACTORY = new JacksonFactory();

    @Override
    public Navigation run() throws Exception {

        UserModel userModel = null;

        try{
            userModel = getUser();
        }catch(Exception e) {
            return null;
View Full Code Here

Examples of com.appspot.plucial.model.UserModel

     */
    private UserModel getAccessUserModel() throws NoContentsException {

        String userId = asString("user");

        UserModel userModel = UserService.getOrNull(userId);

        if(userModel == null) throw new NoContentsException();

        return userModel;
    }
View Full Code Here

Examples of com.appspot.plucial.model.UserModel

     */
    public UserModel getUser() throws Exception {

        String userId = asString("user");

        UserModel userModel = UserService.getOrNull(userId);

        if(userModel == null) throw new Exception();

        return userModel;
    }
View Full Code Here

Examples of com.appspot.plucial.model.UserModel

     * @return
     * @throws Exception
     */
    private UserModel getLoginUserModel() throws UserLoginException {
        // セッションに含まれるステート
        UserModel userModel = sessionScope("userModel");

        if(userModel == null) throw new UserLoginException();

        return userModel;
    }
View Full Code Here

Examples of com.appspot.plucial.model.UserModel

     * @return
     */
    public static UserModel getOrNull(String userID) {

        Key key = createKey(userID);
        UserModel model = Memcache.get(key.toString());
        if(model != null) return model;

        model = userModelDao.getOrNull(key);
        if(model != null) Memcache.put(model.getKey().toString(), model);

        return model;
    }
View Full Code Here

Examples of com.appspot.plucial.model.UserModel

            String aboutMe,
            Cover cover,
            String accessToken,
            String refreshToken) {

        UserModel userModel = new UserModel();

        Key key = createKey(userId);

        userModel.setKey(key);

        // email
        if(email != null && !email.isEmpty()) {
            userModel.setEmail(email);
        }

        // url
        if(url != null && !url.isEmpty()) {
            userModel.setUrl(new Text(url));
        }

        // 表示名
        if(displayName != null && !displayName.isEmpty()) {
            userModel.setDisplayName(displayName);
        }

        // 写真
        if(userImage != null && !userImage.isEmpty()) {
            userModel.setImageUrl(new Text(userImage.getUrl()));
        }

        // キャッチ
        if(tagline != null && !tagline.isEmpty()) {
            userModel.setTagline(new Text(tagline));
        }

        // 特技
        if(braggingRights != null && !braggingRights.isEmpty()) {
            userModel.setBraggingRights(new Text(braggingRights));
        }

        // About Me
        if(aboutMe != null && !aboutMe.isEmpty()) {
            userModel.setAboutMe(new Text(aboutMe));
        }

        // 背景画像url
        if(cover != null && cover.getCoverPhoto() != null && cover.getCoverPhoto().getUrl() != null && !cover.getCoverPhoto().getUrl().isEmpty()) {
            userModel.setCoverPhotoUrl(new Text(cover.getCoverPhoto().getUrl()));
        }

        // アクセストークン
        if(userImage != null && !accessToken.isEmpty()) {
            userModel.setAccessToken(accessToken);
        }

        // リフレッシュトークン
        if(refreshToken != null && !refreshToken.isEmpty()) {
            userModel.setRefreshToken(refreshToken);
        }

        // 新しいユーザーをまず(0〜9)グループに割り当てる
        Random rnd = new Random();
        userModel.setGroup(rnd.nextInt(10));

        // チェック日を設定
        userModel.setUpdateCheckDate(new Date());

        return put(userModel);
    }
View Full Code Here

Examples of com.appspot.plucial.model.UserModel

    protected static final JacksonFactory JSON_FACTORY = new JacksonFactory();

    @Override
    public Navigation run() throws Exception {

        UserModel userModel = null;

        try{
            userModel = getUser();
        }catch(Exception e) {
            return null;
        };

        // タスクは成功するまで実行されるため、失敗時は例外をキャッチして再実行をさせない
        try{
            getActivitys(userModel);

        }catch(TokenResponseException te) {

            logger.severe("User Token error:" + userModel.getKey().getId());

        }catch(Exception e) {
            logger.severe(e.toString());

        }finally {
            // Task実行完了に変更
            userModel.setActivityBotPerformingFlg(false);
            userModel.setInputActivityLastFinishFlg(true);
            UserService.put(userModel);
        }

        return null;
    }
View Full Code Here
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.