Examples of UserModel


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

     */
    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

    @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;
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{
            // アクティビティの取得
            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>";
            nBody += "</div>";
            nBody += "</en-note>";

            note.setContent(nBody);
            if(userModel.getEvernoteNotebookId() != null) {
                note.setNotebookGuid(userModel.getEvernoteNotebookId());
            }

            noteStoreClient.createNote(note);

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

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

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

        if(userModel == null) {

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

            // 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()
                );

            // ユーザー数のキャッシュをクリア
            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

    @Override
    protected Navigation run() throws Exception {

        // アクセス承認
        try {
            UserModel userModel = getLoginUser();
            return execute(userModel);

        }catch(UserLoginException e) {
            if(isSmartPhone()) {
                return forward("/user_sp/no_login.jsp");
View Full Code Here

Examples of com.appspot.plucial.model.UserModel

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

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

        return userModel;
    }
View Full Code Here

Examples of com.commafeed.frontend.model.UserModel

  @Path("/profile")
  @GET
  @UnitOfWork
  @ApiOperation(value = "Retrieve user's profile", response = UserModel.class)
  public Response get(@SecurityCheck User user) {
    UserModel userModel = new UserModel();
    userModel.setId(user.getId());
    userModel.setName(user.getName());
    userModel.setEmail(user.getEmail());
    userModel.setEnabled(!user.isDisabled());
    userModel.setApiKey(user.getApiKey());
    for (UserRole role : userRoleDAO.findAll(user)) {
      if (role.getRole() == Role.ADMIN) {
        userModel.setAdmin(true);
      }
    }
    return Response.ok(userModel).build();
  }
View Full Code Here

Examples of com.gitblit.models.UserModel

    @Test
    public void testAuthenticate() throws Exception {
      IAuthenticationManager auth = newAuthenticationManager();

      UserModel user = new UserModel("sunnyjim");
    user.password = "password";
    users.updateUserModel(user);

    assertNotNull(auth.authenticate(user.username, user.password.toCharArray()));
    user.disabled = true;
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.