Examples of Categories


Examples of org.apache.abdera.model.Categories

    public Entry addCategory(Category category) {
        complete();
        Element el = category.getParentElement();
        if (el != null && el instanceof Categories) {
            Categories cats = category.getParentElement();
            category = (Category)category.clone();
            try {
                if (category.getScheme() == null && cats.getScheme() != null)
                    category.setScheme(cats.getScheme().toString());
            } catch (Exception e) {
                // Do nothing, shouldn't happen
            }
        }
        addChild((OMElement)category);
View Full Code Here

Examples of org.apache.abdera.model.Categories

        return this;
    }

    public Categories addCategories(String href) {
        complete();
        Categories cats = ((FOMFactory)factory).newCategories();
        cats.setHref(href);
        addCategories(cats);
        return cats;
    }
View Full Code Here

Examples of org.apache.abdera.model.Categories

        return cats;
    }

    public Categories addCategories(List<Category> categories, boolean fixed, String scheme) {
        complete();
        Categories cats = ((FOMFactory)factory).newCategories();
        cats.setFixed(fixed);
        if (scheme != null)
            cats.setScheme(scheme);
        if (categories != null) {
            for (Category category : categories) {
                cats.addCategory(category);
            }
        }
        addCategories(cats);
        return cats;
    }
View Full Code Here

Examples of org.apache.abdera.model.Categories

    ClientResponse resp = client.get(BASE + "/feed;categories");
    assertNotNull(resp);
    assertEquals(ResponseType.SUCCESS, resp.getType());
    assertTrue(MimeTypeHelper.isMatch(resp.getContentType().toString(), Constants.CAT_MEDIA_TYPE));
    Document<Categories> doc = resp.getDocument();
    Categories cats = doc.getRoot();
    assertEquals(cats.getCategories().size(), 3);
    assertEquals(cats.getCategories().get(0).getTerm(), "foo");
    assertEquals(cats.getCategories().get(1).getTerm(), "bar");
    assertEquals(cats.getCategories().get(2).getTerm(), "baz");
    assertFalse(cats.isFixed());
  }
View Full Code Here

Examples of org.apache.abdera.model.Categories

  public Entry addCategory(Category category) {
    complete();
    Element el = category.getParentElement();
    if (el != null && el instanceof Categories) {
      Categories cats = category.getParentElement();
      category = (Category) category.clone();
      try {
        if (category.getScheme() == null && cats.getScheme() != null)
          category.setScheme(cats.getScheme().toString());
      } catch (Exception e) {
        // Do nothing, shouldn't happen
      }
    }
    addChild((OMElement)category);
View Full Code Here

Examples of org.apache.abdera.model.Categories

 
  public <T extends Source>T addCategory(Category category) {
    complete();
    Element el = category.getParentElement();
    if (el != null && el instanceof Categories) {
      Categories cats = category.getParentElement();
      category = (Category) category.clone();
      try {
        if (category.getScheme() == null && cats.getScheme() != null)
          category.setScheme(cats.getScheme().toString());
      } catch (Exception e) {
        // Do nothing, shouldn't happen
      }
    }
    addChild((OMElement)category);
View Full Code Here

Examples of org.apache.abdera.model.Categories

            if (element instanceof Categories) {
                jstream.startObject();
                writeLanguageFields(element, jstream);
                if (!isSameAsParentBase(element))
                    jstream.writeField("xml:base", element.getResolvedBaseUri());
                Categories categories = (Categories)element;
                jstream.writeField("fixed", categories.isFixed() ? "true" : "false");
                jstream.writeField("scheme", categories.getScheme());
                writeList("categories", categories.getCategories(), jstream);
                writeExtensions((ExtensibleElement)element, jstream);
                jstream.endObject();
            } else if (element instanceof Category) {
                jstream.startObject();
                writeLanguageFields(element, jstream);
View Full Code Here

Examples of org.apache.abdera.model.Categories

        return this;
    }

    public Categories addCategories(String href) {
        complete();
        Categories cats = ((FOMFactory)factory).newCategories();
        cats.setHref(href);
        addCategories(cats);
        return cats;
    }
View Full Code Here

Examples of org.apache.abdera.model.Categories

        return cats;
    }

    public Categories addCategories(List<Category> categories, boolean fixed, String scheme) {
        complete();
        Categories cats = ((FOMFactory)factory).newCategories();
        cats.setFixed(fixed);
        if (scheme != null)
            cats.setScheme(scheme);
        if (categories != null) {
            for (Category category : categories) {
                cats.addCategory(category);
            }
        }
        addCategories(cats);
        return cats;
    }
View Full Code Here

Examples of org.apache.abdera.model.Categories

    public <T extends Source> T addCategory(Category category) {
        complete();
        Element el = category.getParentElement();
        if (el != null && el instanceof Categories) {
            Categories cats = category.getParentElement();
            category = (Category)category.clone();
            try {
                if (category.getScheme() == null && cats.getScheme() != null)
                    category.setScheme(cats.getScheme().toString());
            } catch (Exception e) {
                // Do nothing, shouldn't happen
            }
        }
        addChild((OMElement)category);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.