Ejemplo n.º 1
0
  @Override
  protected Element generateOutline(final Outline outline) {
    Element retValue;

    retValue = super.generateOutline(outline);

    if (outline.getCreated() != null) {
      retValue.setAttribute("created", DateParser.formatRFC822(outline.getCreated(), Locale.US));
    }

    return retValue;
  }
Ejemplo n.º 2
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;
  }
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
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;
  }