Examples of HashTag


Examples of org.encuestame.persistence.domain.HashTag

    @RequestMapping(value = "/tag/{name}", method = RequestMethod.GET)
    public String tagController(ModelMap model, HttpServletRequest request,
            HttpServletResponse response, @PathVariable String name) {
        name = filterValue(name);

        final HashTag tag;
        try {

            tag = getFrontService().getHashTagItem(name);
            if (tag == null) {
                return "404";
            } else {
                try {
                     log.debug("tagController tag =>"+tag);
                     final String IP = getIpClient(request);
                     boolean hashTagVisite = getFrontService().checkPreviousHit(IP, tag.getHashTagId(), TypeSearchResult.HASHTAG);
                     // TODO: Check that previous hash Tag hit has been visited the same day.
                     log.debug("hashTagVisite =>"+hashTagVisite);
                     if (!hashTagVisite) {
                         getFrontService().registerHit(null, null, null, tag, IP, HitCategory.VISIT);
                     }
                } catch (Exception e) {
                    log.warn("Imposible register vote " + "tag id: " + tag.getHashTagId());
                }
                final List<HomeBean> lastPublications = getFrontService()
                        .searchLastPublicationsbyHashTag(tag, null, this.INIT_RESULTS,
                                LIMIT_HASHTAG, "hashtag", request);
                log.debug("tagController tweetPollbyTags =>"+lastPublications.size());
View Full Code Here

Examples of org.encuestame.persistence.domain.HashTag

    public HashTag getHashTag(
            String tagName,
            final Boolean exceptionIfNotFound)
            throws EnMeNoResultsFoundException {
        Assert.notNull(tagName);
        final HashTag hashTag = getHashTagDao().getHashTagByName(
                ValidationUtils.removeNonAlphanumericCharacters(tagName
                        .toLowerCase()));
        log.trace("AService getHashTag - is "+tagName+" on  database ?->"+hashTag);
        if (hashTag == null) {
            //if possible we can't exception to allow create a new with the parameter.
View Full Code Here

Examples of org.encuestame.persistence.domain.HashTag

        UserAccount userAcc= getSpringSecurityLoggedUserAccount();
        //1-  Create Tag, Question and TweetPoll
        final Date creationDate = new Date();

        /* HashTag **/
        final HashTag hashtag1 = createHashTag("romantic");

        /* Question **/
        final Question question = createQuestion("What is your favorite type of movies?", "");

        /* TweetPoll **/
        final TweetPoll myTweetPoll = createPublishedTweetPoll(question, userAcc);

        /* Poll **/
        final Poll myPoll = createPoll(creationDate, question, userAcc, Boolean.TRUE, Boolean.TRUE);

        /* Survey **/
        final Survey mySurvey = createDefaultSurvey(userAcc.getAccount(), "My First Encuestame Survey", creationDate);

        // 2- Add HashTag to TweetPoll, Poll or Survey
        myTweetPoll.getHashTags().add(hashtag1);
        getTweetPoll().saveOrUpdate(myTweetPoll);

        myPoll.getHashTags().add(hashtag1);
        getPollDao().saveOrUpdate(myPoll);

        mySurvey.getHashTags().add(hashtag1);
        getSurveyDaoImp().saveOrUpdate(mySurvey);

        // 3- Create TweetPollSavedPublishedStatus -- Create Social network link.

        //Total Usage by Social Networks
        final SocialAccount socialAccount = createDefaultSettedSocialAccount(getSpringSecurityLoggedUserAccount());
        assertNotNull(socialAccount);
        final String tweetContent = "Tweet content text";
        final TweetPollSavedPublishedStatus tpSaved = createTweetPollSavedPublishedStatus(
                myTweetPoll, " ", socialAccount, tweetContent);

        tpSaved.setApiType(SocialProvider.TWITTER);
        getTweetPoll().saveOrUpdate(tpSaved);
        assertNotNull(tpSaved);


        // Total Usaged by HashTag (TweetPoll, Poll or Survey)
        // Total Usage by HashTag(Hits)
        createHashTagHit(hashtag1, "192.1.1.1");
        createHashTagHit(hashtag1, "192.1.1.2");
        createHashTagHit(hashtag1, "192.1.1.3");
        createHashTagHit(hashtag1, "192.1.1.4");
        createHashTagHit(hashtag1, "192.1.1.5");

        final Long totalHitsbyTag = getFrontEndDao().getTotalHitsbyType(hashtag1.getHashTagId(),
                    TypeSearchResult.HASHTAG, null);
        Assert.assertEquals("Should be equals ", totalHitsbyTag.intValue(), 5);

        // 4- Get total Usage by tweetpoll voted.

View Full Code Here

Examples of org.encuestame.persistence.domain.HashTag

     * @throws IOException
     */
    @Test
    public void testGetHashTagRankingStats() throws ServletException, IOException{
        final Date myDate = new Date();
        final HashTag tag = createHashTag("America", 20L);
        final HashTag tag1 = createHashTag("Europa", 20L);
        final HashTag tag2 = createHashTag("Asia", 20L);
        final HashTag tag3 = createHashTag("Oceania", 20L);
        final HashTag tag4 = createHashTag("Africa", 20L);

        createHashTagRank(tag3, myDate, (double) 90); // Oceania -- 0
        createHashTagRank(tag4, myDate, (double) 70); // Africa -- 1
        createHashTagRank(tag2, myDate, (double) 30); // Asia -- 2
        createHashTagRank(tag, myDate, (double) 20); // America -- 3
View Full Code Here

Examples of org.encuestame.persistence.domain.HashTag

        final JSONObject success = getSucess(response);
        final JSONObject genericStatsData = (JSONObject) success.get("generic");
        Assert.assertEquals(genericStatsData.get("hits").toString(), tweetpoll.getHits().toString());

        // HASHTAG
        final HashTag hashtag = createHashTag("software");
        hashtag.setHits(20L);
        getHashTagDao().saveOrUpdate(hashtag);
        //System.out.println("HASHTAG HITS --->" + hashtag.getHits());
        initService("/api/common/stats/generic.json", MethodJson.GET);
        setParameter("id", hashtag.getHashTag());
        setParameter("filter", "HASHTAG");
        final JSONObject responseHashTag = callJsonService();
        final JSONObject successHashTag = getSucess(responseHashTag);
        final JSONObject genericHashStatsData = (JSONObject) successHashTag.get("generic");

        Assert.assertEquals(genericHashStatsData.get("hits").toString(), hashtag.getHits().toString())
    }
View Full Code Here

Examples of org.encuestame.persistence.domain.HashTag

     * @throws IOException
     */
    @Test
    public void testHashTagStatByRange() throws ServletException, IOException{
      final Calendar myDate = Calendar.getInstance();
      final HashTag hashTag1 = createHashTag("software2")
      
      final Hit hit1 = createHashTagHit(hashTag1, "192.168.1.1");
      final Hit hit2 = createHashTagHit(hashTag1, "192.168.1.2");
      
      hit1.setHitDate(myDate.getTime());
      getTweetPoll().saveOrUpdate(hit1);
    
      myDate.add(Calendar.DATE, -4);
      hit2.setHitDate(myDate.getTime());
      getTweetPoll().saveOrUpdate(hit2);
     
      initService("/api/common/hashtags/stats/button/range.json", MethodJson.GET);
    setParameter("tagName", hashTag1.getHashTag());
    setParameter("period", "7");
    setParameter("filter", "HITS");
    final JSONObject response = callJsonService();
    final JSONObject success = getSucess(response);
    final JSONArray hashTagHitsData = (JSONArray) success.get("statsByRange");
View Full Code Here

Examples of org.encuestame.persistence.domain.HashTag

     *
     * @throws Exception
     */
    @Test
    public void testHashTagController() throws Exception {
        final HashTag hashTag = createHashTag("software", 50L);
        final String ipAddress = "192.168.1.99";
        createHashTagHit(hashTag, ipAddress);
        request = new MockHttpServletRequest(MethodJson.GET.toString(), "/tag/software");
        final ModelAndView mav = handlerAdapter.handle(request, response,
                hashTagController);
View Full Code Here

Examples of org.encuestame.persistence.domain.HashTag

            throws EnMeNoResultsFoundException {
        log.debug("Adding hashtag to Poll --->" + poll.getPollId());
        log.debug("Adding hashTagBean to Poll ---> " + tagBean.getHashTagName());
        tagBean.setHashTagName(ValidationUtils
                .removeNonAlphanumericCharacters(tagBean.getHashTagName()));
        HashTag tag = getHashTag(tagBean.getHashTagName(), Boolean.FALSE);
        if (tag == null) {
            tag = createHashTag(tagBean.getHashTagName().toLowerCase());
            poll.getHashTags().add(tag);
            getPollDao().saveOrUpdate(poll);
            log.debug("Added new hashtag done :" + tag.getHashTagId());
            return tag;
        } else {
            poll.getHashTags().add(tag);
            getPollDao().saveOrUpdate(poll);
            log.debug("Added previous hashtag done :" + tag.getHashTagId());
            return tag;
        }
    }
View Full Code Here

Examples of org.encuestame.persistence.domain.HashTag

     */
    public List<HashTag> retrieveListOfHashTags(final List<HashTagBean> hashtagBeans) throws EnMeNoResultsFoundException{
        log.debug("TPService retrieveListOfHashTags from frontEnd->"+hashtagBeans.size());
        final List<HashTag> tagList = new ArrayList<HashTag>();
        for (HashTagBean unitHashTag : hashtagBeans) {
            HashTag hashTag = getHashTag(unitHashTag.getHashTagName(), false);
            //if is null, create new hashTag.
            if (hashTag == null && unitHashTag.getHashTagName() != null) {
                log.debug("created new hashTag:{"+unitHashTag.getHashTagName().toLowerCase());
                hashTag = createHashTag(unitHashTag.getHashTagName().toLowerCase());
            }
View Full Code Here

Examples of org.encuestame.persistence.domain.HashTag

     * @param unitHashTag new tag
     * @return {@link HashTag}
     * @throws EnMeExpcetion exception.
     */
    public HashTag createHashTag(final HashTagBean unitHashTag) {
        final HashTag tag = createHashTag(unitHashTag.getHashTagName());
        getHashTagDao().saveOrUpdate(tag);
        log.debug("Hash Tag Saved.");
        return tag;
    }
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.