Package in.partake.model.dto

Examples of in.partake.model.dto.UserTwitterLink


        return false;
    }

    private void markAsUnauthorizedUser(PartakeConnection con, IPartakeDAOs daos, UserEx user) {
        IUserTwitterLinkAccess access = daos.getTwitterLinkageAccess();
        UserTwitterLink linkage = new UserTwitterLink(user.getTwitterLinkage());
        linkage.markAsUnauthorized();

        try {
            // TODO UserExが参照するTwitterLinkageが更新されたため、UserExのキャッシュを破棄あるいは更新する必要がある
            access.put(con, linkage);
        } catch (DAOException ignore) {
View Full Code Here


        long twitterId = PartakeConfiguration.twitterBotId();
        if (twitterId < 0) {
            Logger.info("No bot id.");
            return;
        }
        UserTwitterLink linkage = daos.getTwitterLinkageAccess().findByTwitterId(con, twitterId);
        if (linkage == null) {
            Logger.info("twitter bot does have partake user id. Login using the account once to create the user id.");
            return;
        }
        String userId = linkage.getUserId();
        if (userId == null) {
            Logger.info("twitter bot does have partake user id. Login using the account once to create the user id.");
            return;
        }
View Full Code Here

        IUserTwitterLinkAccess twitterDAO = daos.getTwitterLinkageAccess();

        User user = userAccess.find(con, userId);
        if (user == null) { return null; }

        UserTwitterLink linkage = twitterDAO.findByUserId(con, userId);
        return new UserEx(user, linkage);
    }
View Full Code Here

        Cache.set(Constants.Cache.TWITTER_LOGIN_KEY_PREFIX + sessionId, null);

        MessageCode messageCode = null;
        try {
            ITwitterService twitterService = PartakeApp.getTwitterService();
            UserTwitterLink linkage = twitterService.createTwitterLinkageFromLoginInformation(loginInformation, verifier);

            UserEx user = new VerifyForTwitterActionTransaction(linkage).execute();
            session().put(Constants.Session.USER_ID_KEY, user.getId());

            messageCode = MessageCode.MESSAGE_AUTH_LOGIN;
View Full Code Here

        // Twitter Linkage から User を引いてくる。
        // 対応する user がいない場合は、user を作成して Twitter Linkage を付与する

        try {
            // 1. まず TwitterLinkage をアップデート
            UserTwitterLink twitterLinkage = updateTwitterLinkage(con, daos, twitterLinkageEmbryo);
            // 2. 対応するユーザーを生成
            UserEx user = getUserFromTwitterLinkage(con, daos, twitterLinkage);
            return user;
        } catch (TwitterException e) {
            throw new PartakeException(ServerErrorCode.TWITTER_OAUTH_ERROR, e);
View Full Code Here

            throw new PartakeException(ServerErrorCode.TWITTER_OAUTH_ERROR, e);
        }
    }

    private UserTwitterLink updateTwitterLinkage(PartakeConnection con, IPartakeDAOs daos, UserTwitterLink twitterLinkageEmbryo) throws DAOException, TwitterException {
        UserTwitterLink twitterLinkage = daos.getTwitterLinkageAccess().findByTwitterId(con, twitterLinkageEmbryo.getTwitterId());

        if (twitterLinkage == null || twitterLinkage.getUserId() == null) {
            String userId = daos.getUserAccess().getFreshId(con);
            UUID id = daos.getTwitterLinkageAccess().getFreshId(con);
            twitterLinkageEmbryo.setId(id);
            twitterLinkageEmbryo.setUserId(userId);
        } else {
            twitterLinkageEmbryo.setId(twitterLinkage.getId());
            twitterLinkageEmbryo.setUserId(twitterLinkage.getUserId());
        }

        daos.getTwitterLinkageAccess().put(con, twitterLinkageEmbryo);
        return twitterLinkageEmbryo;
    }
View Full Code Here

        TwitterLoginInformation mockInfo = mock(TwitterLoginInformation.class);
        Mockito.doReturn(mockInfo).when(twitterService).createLoginInformation(Mockito.anyString());
        Mockito.doReturn(mockInfo).when(twitterService).createLoginInformation(null);
        Mockito.doThrow(new TwitterException("MockException")).when(twitterService).createLoginInformation("http://www.example.com/throwException");

        UserTwitterLink twitterLinkage = new UserTwitterLink(
                TestDataProvider.DEFAULT_TWITTER_LINK_ID, TestDataProvider.DEFAULT_TWITTER_ID, TestDataProvider.DEFAULT_USER_ID,
                TestDataProvider.DEFAULT_TWITTER_SCREENNAME, "testUser 1", "accessToken", "accessTokenSecret", "http://www.example.com/");

        Mockito.doReturn(twitterLinkage).when(twitterService).createTwitterLinkageFromLoginInformation((TwitterLoginInformation) Mockito.any(), Mockito.anyString());
View Full Code Here

import org.codehaus.jackson.node.ObjectNode;

class EntityUserTwitterLinkMapper extends Postgres9EntityDataMapper<UserTwitterLink> {
    public UserTwitterLink map(ObjectNode obj) {
        return new UserTwitterLink(obj).freeze();
    }
View Full Code Here

TOP

Related Classes of in.partake.model.dto.UserTwitterLink

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.