Package fr.ippon.tatami.web.rest.dto

Examples of fr.ippon.tatami.web.rest.dto.Tag


    @ResponseBody
    @Timed
    public Tag lookupTag(@RequestParam("tag_name") String tagname) {
        User currentUser = authenticationService.getCurrentUser();
        Collection<String> followedTags = userTagRepository.findTags(currentUser.getLogin());
        Tag tag = new Tag();
        tag.setName(tagname);
        if (followedTags.contains(tagname)) {
            tag.setFollowed(true);
        }
        return tag;
    }
View Full Code Here


    public Collection<Tag> getFollowedTags() {
        User currentUser = authenticationService.getCurrentUser();
        Collection<String> followedTags = userTagRepository.findTags(currentUser.getLogin());
        Collection<Tag> tags = new ArrayList<Tag>();
        for (String followedTag : followedTags) {
            Tag tag = new Tag();
            tag.setName(followedTag);
            tag.setFollowed(true);
            tags.add(tag);
        }
        return tags;
    }
View Full Code Here

        String domain = DomainUtil.getDomainFromLogin(currentUser.getLogin());
        List<Trend> trends = trendService.getCurrentTrends(domain);
        Collection<String> followedTags = userTagRepository.findTags(currentUser.getLogin());
        Collection<Tag> tags = new ArrayList<Tag>();
        for (Trend trend : trends) {
            Tag tag = new Tag();
            tag.setName(trend.getTag());
            if (followedTags.contains(trend.getTag())) {
                tag.setFollowed(true);
            }
            tags.add(tag);
        }
        return tags;
    }
View Full Code Here

            } else {
                trends = trendService.getCurrentTrends(domain);
            }

            for (Trend trend : trends) {
                Tag tag = new Tag();
                tag.setName(trend.getTag());
                tag.setTrendingUp(trend.isTrendingUp());
                tags.add(tag);
            }
        } else if (search != null && !search.isEmpty()) {
            String prefix = search.toLowerCase();
            tagNames = trendService.searchTags(domain, prefix, 5);
            for (String tagName : tagNames) {
                Tag tag = new Tag();
                tag.setName(tagName);
                tags.add(tag);
            }
        } else {
            tagNames = userTagRepository.findTags(currentUser.getLogin());
            for (String tagName : tagNames) {
                Tag tag = new Tag();
                tag.setName(tagName);
                tags.add(tag);
            }
        }

        for (Tag tag : tags) {
            if (followedTags.contains(tag.getName())) {
                tag.setFollowed(true);
            }
        }

        return tags;
    }
View Full Code Here

    @ResponseBody
    @Timed
    public Tag getTag(@PathVariable("tag") String tagName) {
        User currentUser = authenticationService.getCurrentUser();
        Collection<String> followedTags = userTagRepository.findTags(currentUser.getLogin());
        Tag tag = new Tag();
        tag.setName(tagName);
        if (followedTags.contains(tagName)) {
            tag.setFollowed(true);
        }
        return tag;
    }
View Full Code Here

        Collection<Tag> tags = new ArrayList<Tag>();

        if (query != null && !query.equals("")) {
            this.log.debug("REST request to find tags starting with : {}", prefix);
            for (String trend : trends) {
                Tag tag = new Tag();
                tag.setName(trend);
                if (followedTags.contains(trend)) {
                    tag.setFollowed(true);
                }
                tags.add(tag);
            }

        }
View Full Code Here

    @Test
    public void shouldFollowTag() {
        mockAuthentication("uuser@ippon.fr");

        Tag tag = new Tag();
        tag.setName("test");
        assertTrue(tagMembershipService.followTag(tag));
        assertTrue(tagMembershipService.unfollowTag(tag));
    }
View Full Code Here

    @Test
    public void shouldNotFollowTagTwice() {
        mockAuthentication("uuser@ippon.fr");

        Tag tag = new Tag();
        tag.setName("test");
        assertTrue(tagMembershipService.followTag(tag));
        assertFalse(tagMembershipService.followTag(tag));
        assertTrue(tagMembershipService.unfollowTag(tag));
    }
View Full Code Here

    @Test
    public void shouldNotUnfollowUnknownTag() {
        mockAuthentication("uuser@ippon.fr");

        Tag tag = new Tag();
        tag.setName("test");
        assertFalse(tagMembershipService.unfollowTag(tag));
    }
View Full Code Here

TOP

Related Classes of fr.ippon.tatami.web.rest.dto.Tag

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.