Package org.apache.abdera.model

Examples of org.apache.abdera.model.Category


  private List<Category> copyCategoriesWithScheme(
    List<Category> cats)  {
    List<Category> newcats = new ArrayList<Category>();
    IRI scheme = getScheme();
    for (Category cat : cats) {
      Category newcat = (Category) cat.clone();
      if (newcat.getScheme() == null && scheme != null)
        newcat.setScheme(scheme.toString());
      newcats.add(newcat);
    }
    return newcats;
  }
View Full Code Here


    addChild((OMElement)category);
  }

  public Category addCategory(String term) {
    FOMFactory factory = (FOMFactory) this.factory;
    Category category = factory.newCategory(this);
    category.setTerm(term);
    return category;
  }
View Full Code Here

    return category;
  }

  public Category addCategory(String scheme, String term, String label) {
    FOMFactory factory = (FOMFactory) this.factory;
    Category category = factory.newCategory(this);
    category.setTerm(term);
    category.setScheme(scheme);
    category.setLabel(label);
    return category;   
  }
View Full Code Here

     //http://feedvalidator.org/testcases/atom/4.2.2.2/category-scheme-rel-iri.xml
     IRI uri = baseURI.resolve("4.2.2.2/category-scheme-rel-iri.xml");
     Document<Feed> doc = get(uri);
     assertNotNull(doc);
     Entry entry = doc.getRoot().getEntries().get(0);
     Category cat = entry.getCategories().get(0);
     assertEquals(cat.getScheme(), new IRI("mine"));
   }
View Full Code Here

     //http://feedvalidator.org/testcases/atom/4.2.2.3/category-label-escaped-html.xml
     IRI uri = baseURI.resolve("4.2.2.3/category-label-escaped-html.xml");
     Document<Feed> doc = get(uri);
     assertNotNull(doc);
     Entry entry = doc.getRoot().getEntries().get(0);
     Category cat = entry.getCategories().get(0);
     assertEquals(cat.getLabel(), "<b>business</b>");
   }
View Full Code Here

     //http://feedvalidator.org/testcases/atom/4.2.2.3/category-no-label.xml
     IRI uri = baseURI.resolve("4.2.2.3/category-no-label.xml");
     Document<Feed> doc = get(uri);
     assertNotNull(doc);
     Entry entry = doc.getRoot().getEntries().get(0);
     Category cat = entry.getCategories().get(0);
     assertNull(cat.getLabel());
   }
View Full Code Here

        if (entry != null) {
            NativeArray nativeArray = (NativeArray) context.newArray(this, 0);
            List<Category> list = entry.getCategories();
            int size = list.size();
            for (int i = 0; i < size; i++) {
                Category element = (Category) list.get(i);
                nativeArray.put(i, nativeArray, element.getAttributeValue("term"));
            }
            return nativeArray;
        }
        return null;
    }
View Full Code Here

    author.setUri("c");
    assertNotNull(author);
    assertEquals(author.getName(),"a");
    assertEquals(author.getEmail(), "b");
    assertEquals(author.getUri().toString(), "c");
    Category category = factory.newCategory();
    assertNotNull(category);
    category = factory.newCategory();
    category.setScheme("a");
    category.setTerm("b");
    category.setLabel("c");
    assertNotNull(category);
    assertEquals(category.getScheme().toString(), "a");
    assertEquals(category.getTerm(), "b");
    assertEquals(category.getLabel(), "c");
    Collection collection = factory.newCollection();
    assertNotNull(collection);
    Content content = factory.newContent(Content.Type.TEXT);
    assertNotNull(content);
    assertEquals(content.getContentType(), Content.Type.TEXT);
View Full Code Here

    addChild((OMElement)category);
  }

  public Category addCategory(String term) {
    FOMFactory factory = (FOMFactory) this.factory;
    Category category = factory.newCategory(this);
    category.setTerm(term);
    return category;
  }
View Full Code Here

    return category;
  }

  public Category addCategory(String scheme, String term, String label) throws URISyntaxException {
    FOMFactory factory = (FOMFactory) this.factory;
    Category category = factory.newCategory(this);
    category.setTerm(term);
    category.setScheme(scheme);
    category.setLabel(label);
    return category;   
  }
View Full Code Here

TOP

Related Classes of org.apache.abdera.model.Category

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.