Examples of CategoriesImpl


Examples of org.apache.olingo.odata2.core.servicedocument.CategoriesImpl

  }

  private CategoriesImpl parseCategories(final XMLStreamReader reader) throws XMLStreamException,
      EntityProviderException {
    reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_APP_2007, FormatXml.APP_CATEGORIES);
    CategoriesImpl categories = new CategoriesImpl();
    String href = reader.getAttributeValue(null, FormatXml.ATOM_HREF);
    String fixed = reader.getAttributeValue(null, FormatXml.APP_CATEGORIES_FIXED);
    categories.setScheme(reader.getAttributeValue(null, FormatXml.APP_CATEGORIES_SCHEME));
    categories.setHref(href);
    if (href == null) {
      for (int i = 0; i < Fixed.values().length; i++) {
        if (Fixed.values()[i].name().equalsIgnoreCase(fixed)) {
          categories.setFixed(Fixed.values()[i]);
        }
      }
      if (categories.getFixed() == null) {
        categories.setFixed(Fixed.NO);
      }
      List<Category> categoriesList = new ArrayList<Category>();
      while (reader.hasNext()
          && !(reader.isEndElement() && Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI())
          && FormatXml.APP_CATEGORIES.equals(reader.getLocalName()))) {
        reader.next();
        if (reader.isStartElement()) {
          currentHandledStartTagName = reader.getLocalName();
          if (FormatXml.ATOM_CATEGORY.equals(currentHandledStartTagName)) {
            categoriesList.add(parseCategory(reader));
          }
        }
      }
      categories.setCategoryList(categoriesList);
    }
    if ((href != null && fixed != null && categories.getScheme() != null) ||
        (href == null && fixed == null && categories.getScheme() == null)) {
      throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE
          .addContent("for the element categories"));
    }
    return categories;
  }
View Full Code Here

Examples of org.apache.olingo.odata2.core.servicedocument.CategoriesImpl

  }

  private CategoriesImpl parseCategories(final XMLStreamReader reader) throws XMLStreamException,
      EntityProviderException {
    reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_APP_2007, FormatXml.APP_CATEGORIES);
    CategoriesImpl categories = new CategoriesImpl();
    String href = reader.getAttributeValue(null, FormatXml.ATOM_HREF);
    String fixed = reader.getAttributeValue(null, FormatXml.APP_CATEGORIES_FIXED);
    categories.setScheme(reader.getAttributeValue(null, FormatXml.APP_CATEGORIES_SCHEME));
    categories.setHref(href);
    if (href == null) {
      for (int i = 0; i < Fixed.values().length; i++) {
        if (Fixed.values()[i].name().equalsIgnoreCase(fixed)) {
          categories.setFixed(Fixed.values()[i]);
        }
      }
      if (categories.getFixed() == null) {
        categories.setFixed(Fixed.NO);
      }
      List<Category> categoriesList = new ArrayList<Category>();
      while (reader.hasNext()
          && !(reader.isEndElement() && Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI())
              && FormatXml.APP_CATEGORIES.equals(reader.getLocalName()))) {
        reader.next();
        if (reader.isStartElement()) {
          currentHandledStartTagName = reader.getLocalName();
          if (FormatXml.ATOM_CATEGORY.equals(currentHandledStartTagName)) {
            categoriesList.add(parseCategory(reader));
          }
        }
      }
      categories.setCategoryList(categoriesList);
    }
    if ((href != null && fixed != null && categories.getScheme() != null) ||
        (href == null && fixed == null && categories.getScheme() == null)) {
      throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE
          .addContent("for the element categories"));
    }
    return categories;
  }
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.