Package org.encuestame.persistence.domain.security

Examples of org.encuestame.persistence.domain.security.SocialAccount


            final TypeSearchResult type,
            final Poll poll,
            final Survey survey) {
         log.debug("publicMultiplesTweetAccounts tweetPoll" + tweetPoll);
        //get social account
         final SocialAccount socialAccount = getAccountDao().getSocialAccountById(socialAccountId);
         Set<HashTag> hashTags = new HashSet<>();
         log.debug("publishTweetPoll socialTwitterAccounts: {"+socialAccount);
         //create tweet status
         final TweetPollSavedPublishedStatus publishedStatus = new TweetPollSavedPublishedStatus();
         //social provider.
         publishedStatus.setApiType(socialAccount.getAccounType());
         //checking required values.
         if (type.equals(TypeSearchResult.TWEETPOLL)) {
            //adding tweetpoll
             publishedStatus.setTweetPoll(tweetPoll);
             hashTags = tweetPoll.getHashTags();
         } else if(type.equals(TypeSearchResult.POLL)) {
            //adding tweetpoll
             publishedStatus.setPoll(poll);
             hashTags = poll.getHashTags();
         } else if(type.equals(TypeSearchResult.SURVEY)) {
             publishedStatus.setSurvey(survey);
             hashTags = survey.getHashTags();
         } else {
             log.error("Type not defined");
         }

         if (socialAccount != null) {
             log.debug("socialAccount Account NAME:{"+socialAccount.getSocialAccountName());
             //adding social account
             publishedStatus.setSocialAccount(socialAccount);
             try {
                 log.debug("publishTweetPoll Publishing... "+tweetText.length());
                 final TweetPublishedMetadata metadata = publicTweetPoll(tweetText, socialAccount, hashTags);
                 if (metadata == null || metadata.getTweetId() == null) {
                     throw new EnMeFailSendSocialTweetException("status not valid");
                 }//getMessageProperties(propertieId)
                 if (metadata.getTweetId() == null) {
                     log.warn("tweet id is empty");
                 }
                 //store original tweet id.
                 publishedStatus.setTweetId(metadata.getTweetId());
                 //store original publication date.
                 publishedStatus.setPublicationDateTweet(metadata.getDatePublished());
                 //success publish state..
                 publishedStatus.setStatus(Status.SUCCESS);
                 //store original tweet content.
                 publishedStatus.setTweetContent(metadata.getTextTweeted());
                 //create notification
                 //createNotification(NotificationEnum.TWEETPOLL_PUBLISHED, "tweet published", socialAccount.getAccount());
                 createNotification(NotificationEnum.SOCIAL_MESSAGE_PUBLISHED, tweetText, SocialUtils.getSocialTweetPublishedUrl(
                         metadata.getTweetId(), socialAccount.getSocialAccountName(), socialAccount.getAccounType()), Boolean.TRUE);
             } catch (Exception e) {
                 e.printStackTrace();
                 log.error("Error publish tweet:{"+e);
                 //change status to failed
                 publishedStatus.setStatus(Status.FAILED);
View Full Code Here


            tp.setScheduleTweetPoll(Boolean.TRUE);
            getTweetPollDao().saveOrUpdate(tp);
        }
        final String tweetText = generateTweetPollContent(tp);
        for (SocialAccountBean socialBean : bean.getSocialAccounts()) {
            final SocialAccount soc = getAccountDao().getSocialAccountById(socialBean.getAccountId());
            final Schedule schedule = new Schedule();
            schedule.setScheduleDate(tp.getScheduleDate());
            schedule.setTpoll(tp);
            schedule.setTypeSearch(searchResult);
            schedule.setTweetText(tweetText);
View Full Code Here

     */
    public Schedule createTweetPollPublishedStatusScheduled(
            final Date scheduleDate,
            final TypeSearchResult typeSearch,
            final TweetPollSavedPublishedStatus tpollSaved) {
        final SocialAccount socialAccount = tpollSaved.getSocialAccount();
        final Schedule schedule = new Schedule();
        schedule.setScheduleDate(scheduleDate);
        if (typeSearch.equals(TypeSearchResult.TWEETPOLL)) {
            schedule.setTpoll(tpollSaved.getTweetPoll());
            schedule.setTypeSearch(TypeSearchResult.TWEETPOLL);
View Full Code Here

     */
    @Category(InternetTest.class)
    @Test
    @Ignore
    public void testupdateOAuthTokenSocialAccount() throws EnMeExpcetion {
        SocialAccount account = createDefaultSettedSocialAccount(this.userAccount);
        // this.securityService.updateOAuthTokenSocialAccount(account.getId(),
        // "12345", "fakeTokenSecret", this.secUserSecondary.getUsername());
        account = getAccountDao().getSocialAccountById(account.getId());
        assertEquals(account.getSecretToken(), "fakeTokenSecret");
    }
View Full Code Here

            final String secretToken,
            final UserAccount userAccount,
            final String socialProfileUsername,
            final Boolean verified,
            final SocialProvider provider) {
        final SocialAccount socialAccount = new SocialAccount();
        socialAccount.setAccessToken(token);
        socialAccount.setSecretToken(secretToken);
        socialAccount.setAccount(userAccount.getAccount());
        socialAccount.setUserOwner(userAccount);
        long randomNum = 100 + (int)(Math.random()* 4000);
        socialAccount.setSocialProfileId(String.valueOf(randomNum)+RandomStringUtils.randomAlphanumeric(10));
        socialAccount.setVerfied(verified);
        socialAccount.setUserOwner(userAccount);
        socialAccount.setAccounType(provider);
        socialAccount.setSocialAccountName(socialProfileUsername+RandomStringUtils.randomAlphanumeric(10));
        socialAccount.setUpgradedCredentials(new Date());
        socialAccount.setAddedAccount(new Date());
        socialAccount.setEmail("email"+String.valueOf(randomNum));
        socialAccount.setProfileUrl("url"+String.valueOf(randomNum));
        socialAccount.setRealName("real name"+String.valueOf(randomNum));
        socialAccount.setApplicationKey(RandomUtils.nextLong(new Random(50)));
        socialAccount.setRefreshToken("refresh_token_"+RandomStringUtils.randomAlphanumeric(10));
        socialAccount.setType(org.encuestame.utils.social.TypeAuth.OAUTH1);
        getAccountDao().saveOrUpdate(socialAccount);
        return socialAccount;
     }
View Full Code Here

        final TweetPoll tp2 = createPublishedTweetPoll(question, this.secondary);
        tp2.getHashTags().add(hashtag1);
        getTweetPoll().saveOrUpdate(tp2);

        // /
        final SocialAccount socialAccount = createDefaultSettedSocialAccount(this.secondary);
        assertNotNull(socialAccount);
        final String tweetContent = "Tweet content text";

        final TweetPollSavedPublishedStatus tpSaved = createTweetPollSavedPublishedStatus(
                tp, " ", socialAccount, tweetContent);
View Full Code Here

        final TweetPoll tp2 = createPublishedTweetPoll(question, this.secondary);
        tp2.getHashTags().add(hashtag1);
        getTweetPoll().saveOrUpdate(tp2);

        ///
        final SocialAccount socialAccount = createDefaultSettedSocialAccount(this.secondary);
        assertNotNull(socialAccount);
        final String tweetContent = "Tweet content text";
        final TweetPollSavedPublishedStatus tpSaved = createTweetPollSavedPublishedStatus(
                tp, " ", socialAccount, tweetContent);
View Full Code Here

    getTweetPoll().saveOrUpdate(tp2);

    assertNotNull(tp2);

    final SocialAccount socialAccount = createDefaultSettedSocialAccount(this.secondary);
    assertNotNull(socialAccount);
    final String tweetContent = "Tweet content text";

    final TweetPollSavedPublishedStatus tpSaved = createTweetPollSavedPublishedStatus(
        this.initTweetPoll, " ", socialAccount, tweetContent);
View Full Code Here

      UnsupportedEncodingException {

    // Completed - Favourites - Scheduled - Published
    DateTime creationDate = new DateTime();
    creationDate = creationDate.minusHours(3);
    final SocialAccount socialAccount = createDefaultSettedSocialAccount(this.userAccount);

    final List<SocialProvider> providers = new ArrayList<SocialProvider>();
    providers.add(SocialProvider.FACEBOOK);
    providers.add(SocialProvider.LINKEDIN);
    providers.add(SocialProvider.TWITTER);
View Full Code Here

    final TweetPoll tp = createTweetPollPublicated(true, true, new Date(),
        this.userAccount, this.question);
    // Publish Tweetpoll on Social network
    // Social Accounts & Providers
    final SocialAccount socialAccount = createDefaultSettedSocialAccount(this.userAccount);

    final List<SocialProvider> providers = new ArrayList<SocialProvider>();
    providers.add(SocialProvider.FACEBOOK);
    providers.add(SocialProvider.LINKEDIN);
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.security.SocialAccount

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.