Exemplo n.º 1
0
  @Override
  public Object clone() {

    final Outline o = new Outline();
    o.setBreakpoint(isBreakpoint());
    o.setCategories(new ArrayList<String>(getCategories()));
    o.setComment(isComment());
    o.setCreated(created != null ? (Date) created.clone() : null);
    o.setModules(new ArrayList<Module>(getModules()));
    o.setText(getText());
    o.setTitle(getTitle());
    o.setType(getType());

    final ArrayList<Outline> children = new ArrayList<Outline>();
    for (int i = 0; i < getChildren().size(); i++) {
      children.add((Outline) this.children.get(i).clone());
    }
    o.setChildren(children);

    final ArrayList<Attribute> attributes = new ArrayList<Attribute>();
    for (int i = 0; i < getAttributes().size(); i++) {
      attributes.add((Attribute) this.attributes.get(i).clone());
    }
    o.setAttributes(attributes);

    return o;
  }
Exemplo n.º 2
0
 private Outline buildSubscriptionOutline(FeedSubscription sub) {
   Outline outline = new Outline();
   outline.setText(sub.getTitle());
   outline.setTitle(sub.getTitle());
   outline.setType("rss");
   outline.getAttributes().add(new Attribute("xmlUrl", sub.getFeed().getUrl()));
   if (sub.getFeed().getLink() != null) {
     outline.getAttributes().add(new Attribute("htmlUrl", sub.getFeed().getLink()));
   }
   return outline;
 }
Exemplo n.º 3
0
  /**
   * Creates an outline with the given title, xmlUrl and htmlUrl. This is traditionally used for
   * aggregator feed lists and will get a type of "rss".
   *
   * @param title Title of the entry.
   * @param xmlUrl link to XML file.
   * @param htmlUrl link to html page.
   */
  public Outline(final String title, final URL xmlUrl, final URL htmlUrl) {
    super();
    setType("rss");
    setTitle(title);
    setAttributes(new ArrayList<Attribute>());

    if (xmlUrl != null) {
      getAttributes().add(new Attribute("xmlUrl", xmlUrl.toString()));
    }

    if (htmlUrl != null) {
      getAttributes().add(new Attribute("htmlUrl", htmlUrl.toString()));
    }
  }
Exemplo n.º 4
0
  private Outline buildCategoryOutline(
      FeedCategory cat, List<FeedCategory> categories, List<FeedSubscription> subscriptions) {
    Outline outline = new Outline();
    outline.setText(cat.getName());
    outline.setTitle(cat.getName());

    for (FeedCategory child :
        categories
            .stream()
            .filter(c -> c.getParent() != null && c.getParent().getId().equals(cat.getId()))
            .collect(Collectors.toList())) {
      outline.getChildren().add(buildCategoryOutline(child, categories, subscriptions));
    }

    for (FeedSubscription sub :
        subscriptions
            .stream()
            .filter(s -> s.getCategory() != null && s.getCategory().getId().equals(cat.getId()))
            .collect(Collectors.toList())) {
      outline.getChildren().add(buildSubscriptionOutline(sub));
    }
    return outline;
  }