Package edu.hawaii.ics.csdl.jupiter.file.preference

Examples of edu.hawaii.ics.csdl.jupiter.file.preference.General


   * @param preference The preference object to populate with the general information.
   * @throws XMLStreamException Thrown if there is an error reading from the reader.
   */
  private static void parseGeneral(XMLStreamReader reader, Preference preference)
      throws XMLStreamException {
    General general = new General();

    boolean endFound = false;
    while (!endFound) {
      if (reader.hasNext()) {
        int eventType = reader.next();

        if (eventType == XMLStreamConstants.START_ELEMENT) {
          QName elementQName = reader.getName();
          String elementName = elementQName.toString();
          if (ELEMENT_UPDATE_URL.equals(elementName)) {
            eventType = reader.next(); // we need the CHARACTERS event
            if (eventType == XMLStreamConstants.CHARACTERS) {
              String updateUrl = reader.getText();
              general.setUpdateUrl(updateUrl);
            }
          }
          else if (ELEMENT_ENABLE_UPDATE.equals(elementName)) {
            eventType = reader.next(); // we need the CHARACTERS event
            if (eventType == XMLStreamConstants.CHARACTERS) {
              String enableUpdate = reader.getText();
              general.setEnableUpdate(Boolean.valueOf(enableUpdate));
            }
          }
          else if (ELEMENT_ENABLE_FILTER.equals(elementName)) {
            eventType = reader.next(); // we need the CHARACTERS event
            if (eventType == XMLStreamConstants.CHARACTERS) {
              String enableFilter = reader.getText();
              general.setEnableFilter(Boolean.valueOf(enableFilter));
            }
          }
        }
        else if (eventType == XMLStreamConstants.END_ELEMENT) {
          if (ELEMENT_GENERAL.equals(reader.getName().toString())) {
View Full Code Here


  public static void writePreference(XMLStreamWriter writer, Preference preference)
      throws XMLStreamException {
    writer.writeStartElement(ELEMENT_PREFERENCE);
   
    writer.writeStartElement(ELEMENT_GENERAL);
    General general = preference.getGeneral();
   
    writer.writeStartElement(ELEMENT_UPDATE_URL);
    writer.writeCharacters(general.getUpdateUrl());
    writer.writeEndElement(); // UpdateUrl
   
    writer.writeStartElement(ELEMENT_ENABLE_UPDATE);
    writer.writeCharacters(String.valueOf(general.isEnableUpdate()));
    writer.writeEndElement(); // EnableUpdate

    writer.writeStartElement(ELEMENT_ENABLE_FILTER);
    writer.writeCharacters(String.valueOf(general.isEnableFilter()));
    writer.writeEndElement(); // EnableFilter
   
    writer.writeEndElement(); // General
   
    writer.writeStartElement(ELEMENT_VIEW);
View Full Code Here

TOP

Related Classes of edu.hawaii.ics.csdl.jupiter.file.preference.General

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.