The following document contains the results of PMD's CPD 5.1.2.
File | Line |
---|---|
info/magnolia/module/rssaggregator/command/LaunchSingleRSSCommand.java | 249 |
info/magnolia/module/rssaggregator/importhandler/RSSFeedImportHandler.java | 327 |
Node entryNode = NodeUtil.createPath(channelNode, nodeName, NodeTypes.Content.NAME); entryNode.setProperty("author", entry.getAuthor() == null ? "" : entry.getAuthor()); entryNode.setProperty("channelTitle", PropertyUtil.getString(channelNode, "title")); final SyndContent description = entry.getDescription(); String descriptionString; if (description != null && StringUtils.isNotBlank(description.getValue())) { descriptionString = description.getValue(); } else { descriptionString = getEntryContent(entry); } entryNode.setProperty("description", descriptionString); entryNode.setProperty("content", getEntryContent(entry)); entryNode.setProperty("link", entry.getLink()); Date publishedDate = entry.getPublishedDate(); if (publishedDate == null) { publishedDate = new Date(); } entryNode.setProperty("pubDate", publishedDate.getTime()); entryNode.setProperty("title", entry.getTitle()); createCategoriesNode(entry, entryNode); return entryNode; } protected String getEntryContent(SyndEntry entry) { String entryContent = ""; if (entry != null && entry.getContents().size() > 0) { @SuppressWarnings("unchecked") final List<SyndContent> contents = entry.getContents(); for (SyndContent content : contents) { if (StringUtils.equalsIgnoreCase("html", content.getType()) && StringUtils.isNotBlank(content.getType())) { entryContent = content.getValue(); break; } } } return entryContent; } |
File | Line |
---|---|
info/magnolia/module/rssaggregator/command/LaunchSingleRSSCommand.java | 204 |
info/magnolia/module/rssaggregator/importhandler/RSSFeedImportHandler.java | 256 |
List<Node> filterNodes = NodeUtil.asList(NodeUtil.getNodes(filtersNode, NodeTypes.ContentNode.NAME)); for (Node n : filterNodes) { FilterPredicate filterPredicate = filterPredicateMapper.map(n); if (filterPredicate == null) { continue; } filters.add(filterPredicate); } return new AggregateFilter(filters); } @SuppressWarnings("unchecked") protected Node saveFeedChannel(FeedChannel feedChannel, AggregateFilter aggregateFilter, Node dataNode) throws RepositoryException { Node channelNode = recreateFeedChannelNode(feedChannel, dataNode); List<SyndEntry> entries = feedChannel.getFeed().getEntries(); int size = entries.size(); for (int i = 0; i < size; i++) { SyndEntry entry = entries.get(i); String entryName = format("entry-%s", i); if (aggregateFilter.include(entry)) { createFeedChannelEntryNode(entry, entryName, channelNode); } } return channelNode; } protected Node recreateFeedChannelNode(FeedChannel feedChannel, Node dataNode) throws RepositoryException { String channelName = feedChannel.getName(); if (dataNode.hasNode(channelName)) { String absPath = dataNode.getNode(channelName).getPath(); dataNode.getSession().removeItem(absPath); } Node channelNode = NodeUtil.createPath(dataNode, channelName, NodeTypes.Content.NAME); |
File | Line |
---|---|
info/magnolia/module/rssaggregator/command/LaunchSingleRSSCommand.java | 151 |
info/magnolia/module/rssaggregator/importhandler/RSSFeedImportHandler.java | 180 |
newAggregateContentUUIDs.add(aggregateNode.getIdentifier()); AggregateFilter aggregateFilter = loadAggregateFilter(aggregateNode); for (FeedChannel channel : aggregateFeed.getChannels()) { if (channel.hasFeed()) { saveFeedChannel(channel, aggregateFilter, dataNode); } } } return newAggregateContentUUIDs; } protected Node loadSingleAggregateNode(Node parentNode, String aggregateNodeName) throws RepositoryException { NodeIterator nodeIterator = parentNode.getNodes(aggregateNodeName); Collection<Node> aggregateNodes = new ArrayList<Node>(); while (nodeIterator.hasNext()) { Node currentNode = nodeIterator.nextNode(); if (NodeUtil.isNodeType(currentNode, RSSAggregatorNodeTypes.RSSAggregator.NAME)) { aggregateNodes.add(currentNode); } } int size = aggregateNodes.size(); if (size > 1) { throw new IllegalStateException(format( "Expected content node '%s' to have at most 1 child named '%s' of item type '%s', but found %s", parentNode, aggregateNodeName, RSSAggregatorNodeTypes.RSSAggregator.NAME, size)); } if (aggregateNodes.isEmpty()) { return null; } return aggregateNodes.iterator().next(); } |
File | Line |
---|---|
info/magnolia/module/rssaggregator/command/LaunchSingleRSSCommand.java | 237 |
info/magnolia/module/rssaggregator/importhandler/RSSFeedImportHandler.java | 306 |
Node channelNode = NodeUtil.createPath(dataNode, channelName, NodeTypes.Content.NAME); SyndFeed feed = feedChannel.getFeed(); channelNode.setProperty("description", feed.getDescription()); // 'My Blog' channelNode.setProperty("link", feed.getLink()); // 'http://domain.com' channelNode.setProperty("rss", feedChannel.getUrl()); // 'http://domain.com/channel.rss' channelNode.setProperty("title", !isEmpty(feedChannel.getTitle()) ? feedChannel.getTitle() : feed.getTitle()); channelNode.setProperty("type", feed.getFeedType()); // 'rss_2.0' return channelNode; } protected Node createFeedChannelEntryNode(SyndEntry entry, String nodeName, Node channelNode) throws RepositoryException { Node entryNode = NodeUtil.createPath(channelNode, nodeName, NodeTypes.Content.NAME); |
File | Line |
---|---|
info/magnolia/module/rssaggregator/setup/RSSAggregatorVersionHandler.java | 110 |
info/magnolia/module/rssaggregator/setup/RSSAggregatorVersionHandler.java | 126 |
register(DeltaBuilder.update("1.4.3", "") .addTask(new ArrayDelegateTask("Bootstrap missing components", new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/templates/components/combinedFeedsParagraph", new CheckAndModifyPropertyValueTask("Change templateScript", "Change templateScript of combinedFeedsParagraphs", RepositoryConstants.CONFIG, "/modules/rssaggregator/templates/components/combinedFeedsParagraph", "templateScript", "/info/magnolia/module/rssaggregator/paragraphs/combinedFeed.ftl", "/rssaggregator/components/combinedFeed.ftl"), new BootstrapSingleResource("Bootstrap component", "Bootstrap combinedFeedsParagraph", "/mgnl-bootstrap/rssaggregator/templates/components/config.modules.rssaggregator.templates.components.combinedFeedsParagraph.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING)), new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/templates/components/feedListParagraph", new CheckAndModifyPropertyValueTask("Change templateScript", "Change templateScript of feedListParagraph", RepositoryConstants.CONFIG, "/modules/rssaggregator/templates/components/feedListParagraph", "templateScript", "/info/magnolia/module/rssaggregator/paragraphs/feedList.ftl", "/rssaggregator/components/feedList.ftl"), new BootstrapSingleResource("Bootstrap component", "Bootstrap feedListParagraph", "/mgnl-bootstrap/rssaggregator/templates/components/config.modules.rssaggregator.templates.components.feedListParagraph.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING)))) |