AtomCollection(final AtomBlog blog, final ClientCollection col) { this.blog = blog; clientCollection = col; for (final Object element : col.getCategories()) { final Categories cats = (Categories) element; for (final Object element2 : cats.getCategories()) { final Category cat = (Category) element2; final BlogEntry.Category blogCat = new BlogEntry.Category(cat.getTerm()); blogCat.setName(cat.getLabel()); blogCat.setUrl(cat.getScheme()); getCategories().add(blogCat); } } }
public Element categoriesToElement() { final Categories cats = this; final Element catsElem = new Element("categories", AtomService.ATOM_PROTOCOL); catsElem.setAttribute("fixed", cats.isFixed() ? "yes" : "no", AtomService.ATOM_PROTOCOL); if (cats.getScheme() != null) { catsElem.setAttribute("scheme", cats.getScheme(), AtomService.ATOM_PROTOCOL); } if (cats.getHref() != null) { catsElem.setAttribute("href", cats.getHref(), AtomService.ATOM_PROTOCOL); } else { // Loop to create <atom:category> elements for (final Object element : cats.getCategories()) { final Category cat = (Category) element; final Element catElem = new Element("category", AtomService.ATOM_FORMAT); catElem.setAttribute("term", cat.getTerm(), AtomService.ATOM_FORMAT); if (cat.getScheme() != null) { // optional catElem.setAttribute("scheme", cat.getScheme(), AtomService.ATOM_FORMAT); } if (cat.getLabel() != null) { // optional catElem.setAttribute("label", cat.getLabel(), AtomService.ATOM_FORMAT); } catsElem.addContent(catElem); } } return catsElem; }
protected Element generateCategoryElement(final Category cat) { final Namespace namespace = getFeedNamespace(); final Element catElement = new Element("category", namespace); final String term = cat.getTerm(); if (term != null) { final Attribute termAttribute = new Attribute("term", term); catElement.setAttribute(termAttribute); } final String label = cat.getLabel(); if (label != null) { final Attribute labelAttribute = new Attribute("label", label); catElement.setAttribute(labelAttribute); } final String scheme = cat.getScheme(); if (scheme != null) { final Attribute schemeAttribute = new Attribute("scheme", scheme); catElement.setAttribute(schemeAttribute); } return catElement; }
protected Element generateCategoryElement(final Category cat) { final Namespace namespace = getFeedNamespace(); final Element catElement = new Element("category", namespace); final String term = cat.getTerm(); if (term != null) { final Attribute termAttribute = new Attribute("term", term); catElement.setAttribute(termAttribute); } final String label = cat.getLabel(); if (label != null) { final Attribute labelAttribute = new Attribute("label", label); catElement.setAttribute(labelAttribute); } final String scheme = cat.getScheme(); if (scheme != null) { final Attribute schemeAttribute = new Attribute("scheme", scheme); catElement.setAttribute(schemeAttribute); } return catElement; }
cat.setId(romeCat.getTerm()); cat.setUrl(romeCat.getScheme()); cat.setName(romeCat.getLabel()); cats.add(cat);