@Override public Set<FeedEntry> findTopic(String feId, Integer topicNumber) { Set<FeedEntry> recommendFeedEntry = new TreeSet<>(); List<Topic> topics = new ArrayList<>(); topics = tService.listTopicbyFeedEntry(feId); FeedEntry feed = feDao.getFeedEntry(feId); Integer currentTopicNumber = 0; // Topic keresése aktuális topic alapján for (Topic topic : topics) { List<Topic> listedTopics = tService.listTopicbyTopicName(topic.getTopicName()); for (Topic t : listedTopics) { if (!t.getFeedEntry().equals(feId)) { FeedEntry f = getFeedEntry(t.getFeedEntry()); if (!f.getTitle().equals(feed.getTitle())) { recommendFeedEntry.add(f); currentTopicNumber = currentTopicNumber + 1; } } if (currentTopicNumber.equals(topicNumber)) { break; } } } return recommendFeedEntry; }
@Override public void updateFeedEntry(FeedEntry fe) { FeedEntry feedEntry = feDao.getFeedEntry(fe.getId()); feedEntry.setLabeled(fe.getLabeled()); feedEntry.setTopic(fe.getTopic()); feDao.merge(feedEntry); }