Package org.encuestame.utils.enums

Examples of org.encuestame.utils.enums.TypeSearchResult


            HttpServletRequest request, HttpServletResponse response)
            throws JsonGenerationException, JsonMappingException, IOException {
        try {
            final Map<String, Object> jsonResponse = new HashMap<String, Object>();
            final HashTagStatsBean tagStatsBean = new HashTagStatsBean();
            final TypeSearchResult filterType = TypeSearchResult.getTypeSearchResult(filter);
            final SearchPeriods searchPeriod = SearchPeriods.getPeriodString(period);
            if (filterType == null) {
                throw new EnMeNoResultsFoundException("type not found");
            } else {
                if (filterType.equals(TypeSearchResult.HASHTAGRATED)) {
                    // hits /period
                    tagStatsBean.setTotalHits(getStatisticsService().getHashTagHitsbyName(tagName,
                            filterType, request, searchPeriod));
                    tagStatsBean.getTotalHits().setTypeSearchResult(TypeSearchResult.HITS);
                    // social network use /period
View Full Code Here


            @RequestParam(value = "filter", required = false) String filter,
            HttpServletRequest request, HttpServletResponse response)
            throws JsonGenerationException, JsonMappingException, IOException {
        try {
            final Map<String, Object> jsonResponse = new HashMap<String, Object>();
             final TypeSearchResult filterType = TypeSearchResult
                        .getTypeSearchResult(filter);
            final GenericStatsBean genericStatsBean =  getFrontService().retrieveGenericStats(
                    itemId, filterType, request);
            jsonResponse.put("generic", genericStatsBean);
            setItemResponse(jsonResponse);
View Full Code Here

            @RequestParam(value = "period", required = false) String period,
            @RequestParam(value = "filter", required = true) String filter,
            HttpServletRequest request, HttpServletResponse response) {
        try {
            List<HashTagDetailStats> tagStats = new ArrayList<HashTagDetailStats>();
            final TypeSearchResult filterType = TypeSearchResult
                    .getTypeSearchResult(filter);
            //final SearchPeriods periodSearch = SearchPeriods.getPeriodString(period);
            final Map<String, Object> jsonResponse = new HashMap<String, Object>();
            final SearchPeriods searchPeriods = SearchPeriods.getPeriodString(period);
            if (searchPeriods == null) {
                setError("Period not valid", response);
            } else {
                if (filterType.equals(TypeSearchResult.HASHTAG)) {
                    tagStats = getStatisticsService().getTotalUsagebyHashtagAndDateRangeGraph(tagName,
                                    searchPeriods, request);
                } else if (filterType.equals(TypeSearchResult.SOCIALNETWORK)) {
                    tagStats = getStatisticsService()
                            .getTotalSocialLinksbyHashTagUsageAndDateRangeGraph(tagName,
                                    searchPeriods, request);
                } else if (filterType.equals(TypeSearchResult.HITS)) {
                    tagStats = getStatisticsService()
                            .getTotalHitsUsagebyHashTagAndDateRangeGraph(tagName,
                                    searchPeriods, request);
                } else if (filterType.equals(TypeSearchResult.VOTES)) {
                    tagStats = getStatisticsService()
                            .getTotalVotesbyHashTagUsageAndDateRangeGraph(tagName,
                                    searchPeriods, request);
                }
                jsonResponse.put("statsByRange", tagStats);
View Full Code Here

            @PathVariable final String action,
            @PathVariable final String type,
            HttpServletRequest request, HttpServletResponse response)
            throws JsonGenerationException, JsonMappingException, IOException {
        try {
            final TypeSearchResult typeItem = TypeSearchResult.getTypeSearchResult(type);
            log.debug("***************/api/survey/hashtag/{type}/{action}.json************");
            if (typeItem.equals(TypeSearchResult.TWEETPOLL)) {
                if ("remove".equals(action)) {
                    setSuccesResponse();
                    getTweetPollService().removeHashtagFromTweetPoll(null, null);
                } else if ("add".equals(action)) {
                     final Map<String, Object> jsonResponse = new HashMap<String, Object>();
                    final HashTagBean bean = ConvertDomainBean
                            .convertHashTagDomain(getTweetPollService()
                                    .addHashtagToTweetPoll(
                                            getTweetPollService()
                                                    .getTweetPollById(id),
                                            new HashTagBean(hashtag)));
                    log.debug("New TweetPoll HT Bean: "+bean);
                    if (bean.getHashTagName().isEmpty()) {
                        setFailedResponse();
                    } else {
                        jsonResponse.put("hashtag", bean);
                        setItemResponse(jsonResponse);
                    }
                }
            } else if (typeItem.equals(TypeSearchResult.POLL)) {
                if ("remove".equals(action)) {
                    log.debug("Remove option has been disabled");
                    setSuccesResponse();
                } else if ("add".equals(action)) {
                    final Map<String, Object> jsonResponse = new HashMap<String, Object>();
                    final HashTagBean bean = ConvertDomainBean
                            .convertHashTagDomain(getPollService()
                                    .addHashTagToPoll(
                                            getPollService().getPollById(id),
                                            new HashTagBean(hashtag)));
                    log.debug("New TweetPoll HT Bean: " + bean);
                    if (bean.getHashTagName().isEmpty()) {
                        setFailedResponse();
                    } else {
                        jsonResponse.put("hashtag", bean);
                        setItemResponse(jsonResponse);
                    }
                    setSuccesResponse();
                }
            } else if (typeItem.equals(TypeSearchResult.SURVEY)) {
                //TODO: no yet.
                 setSuccesResponse();
            }
            log.debug("***************/api/survey/hashtag/{type}/{action}.json************");
        } catch (Exception e) {
View Full Code Here

    /**
     * Test type search result options enum.
     */
    @Test
    public void testTypeSearchResultOptions(){
         final TypeSearchResult tweetPollOption = TypeSearchResult.getTypeSearchResult("TWEETPOLL");
         assertEquals("Should be equals", "TWEETPOLL", tweetPollOption.toString());

         final TypeSearchResult profilePollOption = TypeSearchResult.getTypeSearchResult("PROFILE");
         assertEquals("Should be equals", "PROFILE", profilePollOption.toString());

         final TypeSearchResult pollOption = TypeSearchResult.getTypeSearchResult("POLL");
         assertEquals("Should be equals", "POLL", pollOption.toString());

         final TypeSearchResult surveyOption = TypeSearchResult.getTypeSearchResult("SURVEY");
         assertEquals("Should be equals", "SURVEY", surveyOption.toString());

         final TypeSearchResult attachmentOption = TypeSearchResult.getTypeSearchResult("ATTACHMENT");
         assertEquals("Should be equals", "ATTACHMENT", attachmentOption.toString());

         final TypeSearchResult questionOption = TypeSearchResult.getTypeSearchResult("QUESTION");
         assertEquals("Should be equals", "QUESTION", questionOption.toString());

         final TypeSearchResult hashTagOption = TypeSearchResult.getTypeSearchResult("HASHTAG");
         assertEquals("Should be equals", "HASHTAG", hashTagOption.toString());

    }
View Full Code Here

        boolean set = false;
        String slug = "";
        /*
         * is possible refactor this part? ..
         */
        TypeSearchResult type = null;
        if (commentDomain.getPoll() != null && !set) {
            type = TypeSearchResult.POLL;
            id = commentDomain.getPoll().getPollId();
            commentBean.setType(TypeSearchResult.POLL);
            set = true;
View Full Code Here

TOP

Related Classes of org.encuestame.utils.enums.TypeSearchResult

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.