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

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


   * Gets the map of the String phase name - FilterPhase instance.
   *
   * @return the map of the String phase name - FilterPhase instance.
   */
  public Map<String, FilterPhase> getPhaseNameToFilterPhaseMap() {
    Filters filters = this.review.getFilters();
    List<Phase> phases = filters.getPhase();
    Map<String, FilterPhase> phaseNameFilterPhaseMap = new TreeMap<String, FilterPhase>();
    for (Phase phase : phases) {
      String phaseNameKey = phase.getName();
      FilterPhase filterPhase = getFilterPhase(phaseNameKey);
      phaseNameFilterPhaseMap.put(ReviewI18n.getString(phaseNameKey), filterPhase);
View Full Code Here


   * @throws XMLStreamException Thrown if there is an error writing to the stream.
   */
  public static void writeFilters(XMLStreamWriter writer, Review review)
      throws XMLStreamException {
    writer.writeStartElement(PropertyConstraints.ELEMENT_FILTERS);
    Filters filters = review.getFilters();
    List<Phase> phases = filters.getPhase();
    for (Phase phase : phases) {
      writer.writeStartElement(PropertyConstraints.ELEMENT_PHASE);
      writer.writeAttribute(PropertyConstraints.ATTRIBUTE_NAME, phase.getName());
      writer.writeAttribute(PropertyConstraints.ATTRIBUTE_ENABLED, phase.isEnabled()
          .toString());
View Full Code Here

        }
        else if (PropertyConstraints.ELEMENT_FIELD_ITEM.equals(elementName)) {
          StaxPropertyXmlUtil.parseFieldItem(reader, review);
        }
        else if (PropertyConstraints.ELEMENT_FILTERS.equals(elementName)) {
          review.setFilters(new Filters());
        }
        else if (PropertyConstraints.ELEMENT_PHASE.equals(elementName)) {
          StaxPropertyXmlUtil.parsePhase(reader, review);
        }
      }
View Full Code Here

   * @param reader The XML stream reader to read from.
   * @param review The review to add the phase to.
   */
  private static void parsePhase(XMLStreamReader reader, Review review)
      throws XMLStreamException {
    Filters filters = review.getFilters();
    if (filters == null) {
      filters = new Filters();
      review.setFilters(filters);
    }
   
    String name = reader.getAttributeValue(null, PropertyConstraints.ATTRIBUTE_NAME);
    String enabled = reader.getAttributeValue(null, PropertyConstraints.ATTRIBUTE_ENABLED);

    Phase phase = new Phase();
    phase.setName(name);
    phase.setEnabled(Boolean.valueOf(enabled));

    boolean endFound = false;

    // parse out all the Filter elements under the Phase
    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_FILTER.equals(elementName)) {
            name = reader.getAttributeValue(null, PropertyConstraints.ATTRIBUTE_NAME);
            String value = reader.getAttributeValue(null, PropertyConstraints.ATTRIBUTE_VALUE);
            enabled = reader.getAttributeValue(null, PropertyConstraints.ATTRIBUTE_ENABLED);

            Filter filter = new Filter();
            filter.setName(name);
            filter.setValue(value);
            filter.setEnabled(Boolean.valueOf(enabled));

            phase.getFilter().add(filter);
          }
        }
        else if (eventType == XMLStreamConstants.END_ELEMENT) {
          QName elementQName = reader.getName();

          if (PropertyConstraints.ELEMENT_PHASE.equals(elementQName.toString())) {
            // this is the end of the phase
            endFound = true;
          }
        }
      }
    }
    filters.getPhase().add(phase);
  }
View Full Code Here

        copiedFieldItems.getFieldItem().add(copiedFieldItem);
      }
      copiedReview.setFieldItems(copiedFieldItems);
    }

    Filters filters = review.getFilters();
    if (filters != null) {
      Filters copiedFilters = new Filters();

      List<Phase> phaseList = filters.getPhase();
      for (Phase phase : phaseList) {
        Phase copiedPhase = new Phase();
        copiedPhase.setName(phase.getName());
        copiedPhase.setEnabled(phase.isEnabled());

        // filter objects
        List<Filter> filterList = phase.getFilter();
        for (Filter filter : filterList) {
          Filter copiedFilter = new Filter();
          copiedFilter.setName(filter.getName());
          copiedFilter.setValue(filter.getValue());
          copiedFilter.setEnabled(filter.isEnabled());
          copiedPhase.getFilter().add(copiedFilter);
        }
        copiedFilters.getPhase().add(copiedPhase);
      }
      copiedReview.setFilters(copiedFilters);
    }

    return copiedReview;
View Full Code Here

TOP

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

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.