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); } } }
private Category parseCategory(final String baseURI, final Element eCategory) { final Category category = new Category(); final String term = getAttributeValue(eCategory, "term"); if (term != null) { category.setTerm(term); } final String scheme = getAttributeValue(eCategory, "scheme"); if (scheme != null) { category.setScheme(scheme); if (isRelativeURI(scheme)) { category.setSchemeResolved(resolveURI(baseURI, eCategory, scheme)); } } final String label = getAttributeValue(eCategory, "label"); if (label != null) { category.setLabel(label); } return category; }
com.rometools.rome.feed.atom.Category category = (com.rometools.rome.feed.atom.Category) obj; ObjectNode catNode = factory.objectNode(); if (category.getLabel() != null) { catNode.put("label", category.getLabel()); if (category.getScheme() != null) { catNode.put("scheme", category.getScheme()); if (category.getSchemeResolved() != null) { catNode.put("schemeResolved", category.getSchemeResolved()); if (category.getTerm() != null ) { catNode.put("term", category.getTerm());
Category atomCat = new Category(); atomCat.setScheme(RollerAtomService.getWeblogCategoryScheme(entry.getWebsite())); atomCat.setTerm(entry.getCategory().getName()); categories.add(atomCat); tmp.addAll(entry.getTags()); for (WeblogEntryTag tag : tmp) { Category newcat = new Category(); newcat.setTerm(tag.getName()); categories.add(newcat);
if (categories != null && categories.size() > 0) { for (Category cat : categories) { if (cat.getScheme() != null && cat.getScheme().equals( RollerAtomService.getWeblogCategoryScheme(rollerEntry.getWebsite()))) { String catString = cat.getTerm(); if (catString != null) { WeblogCategory rollerCat = if (categories != null && categories.size() > 0) { for (Category cat : categories) { if (cat.getScheme() == null) { buff.append(" ").append(cat.getTerm());
for (final Category category : categories) { final SyndCategory syndCategory = new SyndCategoryImpl(); syndCategory.setName(category.getTerm()); syndCategory.setTaxonomyUri(category.getSchemeResolved());
/** * Get list of one Categories object containing categories allowed by collection. * * @param inline True if Categories object should contain collection of in-line Categories * objects or false if it should set the Href for out-of-line categories. */ public List<Categories> getCategories(final boolean inline) { final Categories cats = new Categories(); cats.setFixed(true); cats.setScheme(contextURI + "/" + handle + "/" + singular); if (inline) { for (final String catName : catNames) { final Category cat = new Category(); cat.setTerm(catName); cats.addCategory(cat); } } else { cats.setHref(getCategoriesURI()); } return Collections.singletonList(cats); }
for (final Category category : categories) { final SyndCategory syndCategory = new SyndCategoryImpl(); syndCategory.setName(category.getTerm()); syndCategory.setTaxonomyUri(category.getSchemeResolved());
private Category parseCategory(final String baseURI, final Element eCategory) { final Category category = new Category(); final String term = getAttributeValue(eCategory, "term"); if (term != null) { category.setTerm(term); } final String scheme = getAttributeValue(eCategory, "scheme"); if (scheme != null) { category.setScheme(scheme); if (isRelativeURI(scheme)) { category.setSchemeResolved(resolveURI(baseURI, eCategory, scheme)); } } final String label = getAttributeValue(eCategory, "label"); if (label != null) { category.setLabel(label); } return category; }
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 void parseCategoriesElement(final Element catsElem) { if (catsElem.getAttribute("href", AtomService.ATOM_PROTOCOL) != null) { setHref(catsElem.getAttribute("href", AtomService.ATOM_PROTOCOL).getValue()); } if (catsElem.getAttribute("fixed", AtomService.ATOM_PROTOCOL) != null) { if ("yes".equals(catsElem.getAttribute("fixed", AtomService.ATOM_PROTOCOL).getValue())) { setFixed(true); } } if (catsElem.getAttribute("scheme", AtomService.ATOM_PROTOCOL) != null) { setScheme(catsElem.getAttribute("scheme", AtomService.ATOM_PROTOCOL).getValue()); } // Loop to parse <atom:category> elemenents to Category objects final List<Element> catElems = catsElem.getChildren("category", AtomService.ATOM_FORMAT); for (final Element catElem : catElems) { final Category cat = new Category(); cat.setTerm(catElem.getAttributeValue("term", AtomService.ATOM_FORMAT)); cat.setLabel(catElem.getAttributeValue("label", AtomService.ATOM_FORMAT)); cat.setScheme(catElem.getAttributeValue("scheme", AtomService.ATOM_FORMAT)); addCategory(cat); } }
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; }
final List<com.rometools.rome.feed.atom.Category> romeCats = new ArrayList<com.rometools.rome.feed.atom.Category>(); for (final Category cat : categories) { final com.rometools.rome.feed.atom.Category romeCategory = new com.rometools.rome.feed.atom.Category(); romeCategory.setTerm(cat.getId()); romeCategory.setScheme(cat.getUrl()); romeCategory.setLabel(cat.getName()); romeCats.add(romeCategory);
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; }