Examples of TweetPoll


Examples of org.encuestame.persistence.domain.tweetpoll.TweetPoll

     *
     */
    @Test
    public void testGetFrontendItems() throws ServletException, IOException{
        final Question question = createQuestion("abcdefg", "pattern");
        final TweetPoll tp = createTweetPollPublicated(Boolean.TRUE, Boolean.TRUE, new Date(), getSpringSecurityLoggedUserAccount(), question);
        final Poll poll = createPoll(new Date(), question, getSpringSecurityLoggedUserAccount(), Boolean.TRUE, Boolean.TRUE);
        tp.setRelevance(50L);
        poll.setRelevance(30L);
        getTweetPoll().saveOrUpdate(tp);
        getPollDao().saveOrUpdate(poll);
        initService("/api/common/frontend/stream.json", MethodJson.GET);
        setParameter("period", "all");
View Full Code Here

Examples of org.encuestame.persistence.domain.tweetpoll.TweetPoll

            //FUTURE: Add SEARCHPERIODS Filter.
            final Map<String, Object> jsonResponse = new HashMap<String, Object>();
            final TypeSearchResult searchResult = TypeSearchResult.getTypeSearchResult(type);
            // by tweetpoll
            if (TypeSearchResult.TWEETPOLL.equals(searchResult) && !id.isEmpty()) {
                final TweetPoll tweetPoll = getTweetPollService().getTweetPollById(Long.valueOf(id), null);
                jsonResponse.put("links", getTweetPollService()
                        .getTweetPollLinks(tweetPoll, null, null, TypeSearchResult.getTypeSearchResult(type)));

            // by poll
            } else if (TypeSearchResult.POLL.equals(searchResult) && !id.isEmpty()) {
View Full Code Here

Examples of org.encuestame.persistence.domain.tweetpoll.TweetPoll

            model.put("typeItem", typeItem.toString().toLowerCase());
            model.put("itemId", itemId);
            model.put("class_type", TypeSearchResult.getCSSClass(typeItem));
            model.put("domain_config", WidgetUtil.getDomain(request, true));
            if (TypeSearchResult.TWEETPOLL.equals(typeItem)) {
                final TweetPoll tp = getTweetPollService().getTweetPollById(itemId);
                model.put("url", EnMeUtils.createTweetPollUrlAccess(domain, tp));
            } else if (TypeSearchResult.POLL.equals(typeItem)) {
                final Poll poll = getPollService().getPollById(itemId);
                model.put("url", EnMeUtils.createUrlPollAccess(domain, poll));
            } else if (TypeSearchResult.TWEETPOLLRESULT.equals(typeItem)) {
                final TweetPoll tp = getTweetPollService().getTweetPollById(itemId);
                model.put("url", EnMeUtils.createTweetPollUrlAccess(domain, tp));
            } else if (TypeSearchResult.POLLRESULT.equals(typeItem)) {
                final Poll poll = getPollService().getPollById(itemId);
                model.put("url", EnMeUtils.createUrlPollAccess(domain, poll));
            } else if (TypeSearchResult.HASHTAG.equals(typeItem)) {
View Full Code Here

Examples of org.encuestame.persistence.domain.tweetpoll.TweetPoll

            model.put("domain_config", domain);
            response.setContentType("text/javascript; charset=UTF-8");
            if (TypeSearchResult.TWEETPOLL.equals(typeItem)) {
                // generate tweetpoll body
                // generate tweetpoll body
                final TweetPoll tweetPoll = getTweetPollService().getTweetPollById(pollId);
                model.put("tp", tweetPoll);
                model.put("editorOwner", tweetPoll.getEditorOwner());
                model.put("votes", tweetPoll.getLikeVote());
                model.put("hits", tweetPoll.getHits());
                model.put("date_published", EnMeUtils.formatDate(tweetPoll.getCreateDate(), "HH:mm - d MMMM yyyy"));
                model.put("owner_picture", domain + "/picture/profile/" + tweetPoll.getEditorOwner().getUsername() + "/thumbnail");
                model.put("owner_profile_url", domain + "/profile/" + tweetPoll.getEditorOwner().getUsername());
                StringBuffer buffer = new StringBuffer();
                String q = tweetPoll.getQuestion().getQuestion();
                final List<TweetPollSwitch> answers = getTweetPollService().getTweetPollSwitch(tweetPoll);
                final Set<HashTag> hashTags = tweetPoll.getHashTags();
                buffer.append(EnMeUtils.generateBodyTweetPollasHtml(domain, tweetPoll, q,answers, hashTags));
                model.put("body_text", buffer.toString());
                model.put("url_tpoll", domain +
                        "/tweetpoll/" + tweetPoll.getTweetPollId() + "/" + tweetPoll.getQuestion().getSlugQuestion());
                text = VelocityEngineUtils.mergeTemplateIntoString(
                        velocityEngine, HTML_TEMPLATES + "/tweetpoll_form.vm", "utf-8", model);
            } else if (TypeSearchResult.TWEETPOLLRESULT.equals(typeItem)) {
                final TweetPoll tpoll = getTweetPollService().getTweetPollById(pollId);
                final TweetPollDetailBean tpollDetail = getTweetPollService().getTweetPollDetailInfo(pollId);
                model.put("owner_picture", domain + "/picture/profile/" + tpoll.getEditorOwner().getUsername() + "/thumbnail");
                model.put("editorOwner", tpoll.getEditorOwner());
                model.put("question", tpoll.getQuestion());
                model.put("url", EnMeUtils.createTweetPollUrlAccess(domain, tpoll));
                model.put("answersList", tpollDetail.getResults());
                model.put("date_published", EnMeUtils.formatDate(tpoll.getCreateDate(), "HH:mm - d MMMM yyyy"));
                text = VelocityEngineUtils.mergeTemplateIntoString(
                        velocityEngine, HTML_TEMPLATES + "/tweetpoll_votes.vm", "utf-8", model);
                embebedBody.setAditionalInfo(tpollDetail.getResults());
            } else if (TypeSearchResult.POLL.equals(typeItem)) {
                // generate poll body
View Full Code Here

Examples of org.encuestame.persistence.domain.tweetpoll.TweetPoll

            @RequestParam(value = "answers", required = false) final Long[] answers,
            HttpServletRequest request, HttpServletResponse response,
            final UserAccount user)
            throws JsonGenerationException, JsonMappingException, IOException {
        try {
            final TweetPoll tweetPoll = createTweetPoll(question, hashtags, user);
            final Map<String, Object> jsonResponse = new HashMap<String, Object>();
            jsonResponse.put("tweetPoll", tweetPoll);
            setItemResponse(jsonResponse);
        } catch (EnMeExpcetion e) {
            log.error(e);
View Full Code Here

Examples of org.encuestame.persistence.domain.tweetpoll.TweetPoll

         log.debug("tweetpoll answer"+answer);
         log.debug("tweetpoll answerId"+answerId);
         log.debug("tweetpoll shortUrl"+shortUrl);
        final Map<String, Object> jsonResponse = new HashMap<String, Object>();
        try {
            final TweetPoll tweetPoll = getTweetPollService().getTweetPollById(
                    tweetPollId);
            log.debug("tweetpoll"+tweetPoll.getTweetPollId());
            if(!tweetPoll.getPublishTweetPoll()){
            log.debug("action ANSWER--->"+type);
            if ("add".equals(type)) {
                if ((answer.isEmpty()) || (answer == null)) {
                       throw new EnmeFailOperation("Answer can not valid");
                } else {
View Full Code Here

Examples of org.encuestame.persistence.domain.tweetpoll.TweetPoll

            final Map<String, Object> jsonResponse = new HashMap<String, Object>();
            if (tweetPollId == null && question != null && !question.isEmpty()) {
                  final TweetPollBean tweetPollBean = this.fillTweetPoll(
                          options, question, user, null);
                  //new tweetpoll domain.
                  final TweetPoll tp = createTweetPoll(tweetPollBean);
                  //retrieve answers stored.
                  final TweetPollBean tpB = ConvertDomainBean.convertTweetPollToBean(tp);
                  log.debug("Tweetpoll Created --->" + tpB.toString());
                  jsonResponse.put("tweetPoll", tpB);
             } else if (tweetPollId != null && question != null) {
View Full Code Here

Examples of org.encuestame.persistence.domain.tweetpoll.TweetPoll

            @RequestParam(value = "twitterAccounts", required = false) final Long[] twitterAccountsId,
            HttpServletRequest request,
            HttpServletResponse response)
            throws JsonGenerationException, JsonMappingException, IOException {
        try {
            final TweetPoll tweetPoll = getTweetPollService().getTweetPollById(tweetPollId);
            if (tweetPoll == null) {
                setError("can not publish your tweetpoll", response);
            } else {
                if (twitterAccountsId.length == 0) {
                    throw new EnMeNoResultsFoundException("social accoutns are required to publish");
                }
                 //build text to tweet.
                 final String tweetText = getTweetPollService().generateTweetPollContent(tweetPoll);
                 log.debug("tweet text "+tweetText);
                 //check real lenght if execed limit required.
                final List<SocialAccountBean> accountBeans = new ArrayList<SocialAccountBean>();
                //convert accounts id to real social accounts objects.
                for (int row = 0; row < twitterAccountsId.length; row++) {
                    final SocialAccountBean socialAccount = new SocialAccountBean();
                    socialAccount.setAccountId(twitterAccountsId[row]);
                    accountBeans.add(socialAccount);
                }
                log.debug("Accounts:{" + accountBeans.size());
                // multi publish social account.
                final List<TweetPollSavedPublishedStatus> results = getTweetPollService()
                        .publishMultiplesOnSocialAccounts(accountBeans,
                                tweetPoll, tweetText, TypeSearchResult.TWEETPOLL, null,  null);
                tweetPoll.setPublishTweetPoll(Boolean.TRUE);
                getTweetPollService().saveOrUpdateTweetPoll(tweetPoll);
                final Map<String, Object> jsonResponse = new HashMap<String, Object>();
                jsonResponse.put("socialPublish", ConvertDomainToJson.convertTweetPollStatusToJson(results));
                setItemResponse(jsonResponse);
                //create notification for each TweetPollSavedPublished
View Full Code Here

Examples of org.encuestame.persistence.domain.tweetpoll.TweetPoll

    ModelMap getRemoveTweet(
            @PathVariable Long id,
            HttpServletRequest request, HttpServletResponse response)
            throws JsonGenerationException, JsonMappingException, IOException {
        try {
        final TweetPoll tpoll = getTweetPollService().getTweetPollById(id);
            getTweetPollService().removeTweetPoll(tpoll);
            setSuccesResponse();
        } catch (Exception e) {
            setError(e.getMessage(), response);
        }
View Full Code Here

Examples of org.encuestame.persistence.domain.tweetpoll.TweetPoll

   * @throws IOException
   */
  @Test
  public void testRetrieveHashTagUsebyGeoLoc() throws ServletException,
      IOException {
    final TweetPoll tp2 = this.createPublishedTweetPoll(
        this.userAcc.getAccount(),
        createQuestion("What is your favorite television show?",
            this.userAcc.getAccount()), new Date());

    tp2.setLocationLatitude(40.4167F);
    tp2.setLocationLongitude(-3.70325F);
    tp2.getHashTags().add(this.tag);
    getTweetPoll().saveOrUpdate(tp2);

    assertNotNull(tp2);

    final JSONArray geoHashtagItems = this.setJsonParameters(
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.