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

Examples of edu.hawaii.ics.csdl.jupiter.file.property.FieldItems


   * @throws XMLStreamException Thrown if there is an error writing to the stream.
   */
  public static void writeFieldItems(XMLStreamWriter writer, Review review)
      throws XMLStreamException {
    writer.writeStartElement(PropertyConstraints.ELEMENT_FIELD_ITEMS);
    FieldItems fieldItems = review.getFieldItems();
    List<FieldItem> fieldItemList = fieldItems.getFieldItem();
    for (FieldItem fieldItem : fieldItemList) {
      writer.writeStartElement(PropertyConstraints.ELEMENT_FIELD_ITEM);
      writer.writeAttribute(PropertyConstraints.ATTRIBUTE_ID, fieldItem.getId());
      writer.writeAttribute(PropertyConstraints.ATTRIBUTE_DEFAULT, fieldItem.getDefault());

View Full Code Here


        }
        else if (PropertyConstraints.ELEMENT_FILES.equals(elementName)) {
          StaxPropertyXmlUtil.parseFiles(reader, review);
        }
        else if (PropertyConstraints.ELEMENT_FIELD_ITEMS.equals(elementName)) {
          review.setFieldItems(new FieldItems());
        }
        else if (PropertyConstraints.ELEMENT_FIELD_ITEM.equals(elementName)) {
          StaxPropertyXmlUtil.parseFieldItem(reader, review);
        }
        else if (PropertyConstraints.ELEMENT_FILTERS.equals(elementName)) {
View Full Code Here

   * @param reader The XML stream reader to read from.
   * @param review The review to add the files to.
   */
  private static void parseFieldItem(XMLStreamReader reader, Review review)
      throws XMLStreamException {
    FieldItems fieldItems = review.getFieldItems();
    if (fieldItems == null) {
      fieldItems = new FieldItems();
      review.setFieldItems(fieldItems);
    }
   
    String id = reader.getAttributeValue(null, PropertyConstraints.ATTRIBUTE_ID);
    String defaultValue = reader
        .getAttributeValue(null, PropertyConstraints.ATTRIBUTE_DEFAULT);

    FieldItem fieldItem = new FieldItem();
    fieldItem.setId(id);
    fieldItem.setDefault(defaultValue);

    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 (PropertyConstraints.ELEMENT_ENTRY.equals(elementName)) {
            // this is an entry for field item
            String name = reader.getAttributeValue(null, PropertyConstraints.ATTRIBUTE_NAME);

            FieldItem.Entry entry = new FieldItem.Entry();
            entry.setName(name);

            fieldItem.getEntry().add(entry);
          }
        }
        else if (eventType == XMLStreamConstants.END_ELEMENT) {
          QName elementQName = reader.getName();

          if (PropertyConstraints.ELEMENT_FIELD_ITEM.equals(elementQName.toString())) {
            // this is the end of the field item
            endFound = true;
          }
        }
      }
    }
    fieldItems.getFieldItem().add(fieldItem);
  }
View Full Code Here

        copiedFiles.getEntry().add(copiedFilesEntry);
      }
      copiedReview.setFiles(copiedFiles);
    }

    FieldItems fieldItems = review.getFieldItems();
    if (fieldItems != null) {
      FieldItems copiedFieldItems = new FieldItems();
      List<FieldItem> fieldItemList = fieldItems.getFieldItem();
      for (FieldItem fieldItem : fieldItemList) {
        FieldItem copiedFieldItem = new FieldItem();
        copiedFieldItem.setDefault(fieldItem.getDefault());
        copiedFieldItem.setId(fieldItem.getId());

        List<FieldItem.Entry> entryList = fieldItem.getEntry();
        for (FieldItem.Entry entry : entryList) {
          FieldItem.Entry copiedFieldItemEntry = new FieldItem.Entry();
          copiedFieldItemEntry.setName(entry.getName());
          copiedFieldItem.getEntry().add(copiedFieldItemEntry);
        }
        copiedFieldItems.getFieldItem().add(copiedFieldItem);
      }
      copiedReview.setFieldItems(copiedFieldItems);
    }

    Filters filters = review.getFilters();
View Full Code Here

TOP

Related Classes of edu.hawaii.ics.csdl.jupiter.file.property.FieldItems

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.