Exemplo n.º 1
0
  private String unirMapeos(LinkedHashMap<String, String> mapa, Object[] descripciones) {

    // mapa(llave,punto)
    // descripciones en el mismo orden que el mapeo
    String comillas = "\"";
    StringBuilder builder = new StringBuilder();

    Iterator<String> iterador = mapa.keySet().iterator();

    int indice = 0;

    while (iterador.hasNext()) {
      String llave = iterador.next();

      String puntaje = mapa.get(llave);

      String descripcion =
          descripciones[indice].toString().equals("null") ? "" : descripciones[indice].toString();

      builder.append(comillas + descripcion + comillas + "," + comillas + puntaje + comillas + ",");

      indice++;
    }
    return builder.toString();
  }
Exemplo n.º 2
0
  public void selectNext() {
    Iterator i = new SelectionIterator(this);

    if (m_actives.size() == 1) {
      boolean isFound = false;

      // loop the iterator in reverse order of drawing
      while (i.hasNext()) {
        GlyphObject object = (GlyphObject) i.next();

        if (m_actives.isSelected(object)) {
          isFound = true;
          continue;
        } // if

        if (!isFound) {
          continue;
        } // if

        m_actives.unselectAll();
        m_actives.addActive(object);
        return;
      } // while i
    } // if

    i = new SelectionIterator(this);
    if (i.hasNext()) {
      GlyphObject object = (GlyphObject) i.next();
      m_actives.unselectAll();
      m_actives.addActive(object);
      return;
    } // if
  }
Exemplo n.º 3
0
  /**
   * This will invoke the <code>startElement</code> callback in the <code>ContentHandler</code>.
   *
   * @param element <code>Element</code> used in callbacks.
   * @param nsAtts <code>List</code> of namespaces to declare with the element or <code>null</code>.
   */
  private void startElement(Element element, Attributes nsAtts) throws JDOMException {
    String namespaceURI = element.getNamespaceURI();
    String localName = element.getName();
    String rawName = element.getQualifiedName();

    // Allocate attribute list.
    AttributesImpl atts = (nsAtts != null) ? new AttributesImpl(nsAtts) : new AttributesImpl();

    List attributes = element.getAttributes();
    Iterator i = attributes.iterator();
    while (i.hasNext()) {
      Attribute a = (Attribute) i.next();
      atts.addAttribute(
          a.getNamespaceURI(),
          a.getName(),
          a.getQualifiedName(),
          getAttributeTypeName(a.getAttributeType()),
          a.getValue());
    }

    try {
      contentHandler.startElement(namespaceURI, localName, rawName, atts);
    } catch (SAXException se) {
      throw new JDOMException("Exception in startElement", se);
    }
  }
Exemplo n.º 4
0
 public void display(Graphics2D g, AffineTransform a_trans) {
   Iterator i = createIterator();
   while (i.hasNext()) {
     GlyphObject object = (GlyphObject) i.next();
     object.display(g, a_trans);
   } // while
 }
  private QueryResult gatherResultInfoForSelectQuery(
      String queryString, int queryNr, boolean sorted, Document doc, String[] rows) {
    Element root = doc.getRootElement();

    // Get head information
    Element child =
        root.getChild("head", Namespace.getNamespace("http://www.w3.org/2005/sparql-results#"));

    // Get result rows (<head>)
    List headChildren =
        child.getChildren(
            "variable", Namespace.getNamespace("http://www.w3.org/2005/sparql-results#"));

    Iterator it = headChildren.iterator();
    ArrayList<String> headList = new ArrayList<String>();
    while (it.hasNext()) {
      headList.add(((Element) it.next()).getAttributeValue("name"));
    }

    List resultChildren =
        root.getChild("results", Namespace.getNamespace("http://www.w3.org/2005/sparql-results#"))
            .getChildren(
                "result", Namespace.getNamespace("http://www.w3.org/2005/sparql-results#"));
    int nrResults = resultChildren.size();

    QueryResult queryResult = new QueryResult(queryNr, queryString, nrResults, sorted, headList);

    it = resultChildren.iterator();
    while (it.hasNext()) {
      Element resultElement = (Element) it.next();
      String result = "";

      // get the row values and paste it together to one String
      for (int i = 0; i < rows.length; i++) {
        List bindings =
            resultElement.getChildren(
                "binding", Namespace.getNamespace("http://www.w3.org/2005/sparql-results#"));
        String rowName = rows[i];
        for (int j = 0; j < bindings.size(); j++) {
          Element binding = (Element) bindings.get(j);
          if (binding.getAttributeValue("name").equals(rowName))
            if (result.equals(""))
              result +=
                  rowName + ": " + ((Element) binding.getChildren().get(0)).getTextNormalize();
            else
              result +=
                  "\n"
                      + rowName
                      + ": "
                      + ((Element) binding.getChildren().get(0)).getTextNormalize();
        }
      }

      queryResult.addResult(result);
    }
    return queryResult;
  }
Exemplo n.º 6
0
  /** Fills <tt>m</tt> with statements from <tt>s</tt> and returns it. */
  public static Model toModel(Set s, Model m) throws ModelException {

    Iterator it = s.iterator();
    while (it.hasNext()) {
      Object o = it.next();
      if (o instanceof Statement) m.add((Statement) o);
    }
    return m;
  }
Exemplo n.º 7
0
 private void addDefaultValues(Map attributes, Map mappings) {
   if (mappings == null) return;
   Iterator i = mappings.entrySet().iterator();
   while (i.hasNext()) {
     Map.Entry e = (Map.Entry) i.next();
     TagMap.AttributeMapping m = (TagMap.AttributeMapping) e.getValue();
     if (null != m && null != m.getDefaultValue() && null == attributes.get(m.getPropertyName()))
       attributes.put(m.getPropertyName(), m.getDefaultValue());
   }
 }
Exemplo n.º 8
0
 /**
  * This will take the supplied <code>{@link Element}</code> and transfer its namespaces to the
  * global namespace storage.
  *
  * @param element <code>Element</code> to read namespaces from.
  */
 private void transferNamespaces(Element element) {
   Iterator i = declaredNamespaces.iterator();
   while (i.hasNext()) {
     Namespace ns = (Namespace) i.next();
     if (ns != element.getNamespace()) {
       element.addNamespaceDeclaration(ns);
     }
   }
   declaredNamespaces.clear();
 }
  public ActionDescriptor getAction(int id) {
    // check global actions
    for (Iterator iterator = globalActions.iterator(); iterator.hasNext(); ) {
      ActionDescriptor actionDescriptor = (ActionDescriptor) iterator.next();

      if (actionDescriptor.getId() == id) {
        return actionDescriptor;
      }
    }

    // check steps
    for (Iterator iterator = steps.iterator(); iterator.hasNext(); ) {
      StepDescriptor stepDescriptor = (StepDescriptor) iterator.next();
      ActionDescriptor actionDescriptor = stepDescriptor.getAction(id);

      if (actionDescriptor != null) {
        return actionDescriptor;
      }
    }

    // check initial actions, which we now must have unique id's
    for (Iterator iterator = initialActions.iterator(); iterator.hasNext(); ) {
      ActionDescriptor actionDescriptor = (ActionDescriptor) iterator.next();

      if (actionDescriptor.getId() == id) {
        return actionDescriptor;
      }
    }

    return null;
  }
  public StepDescriptor getStep(int id) {
    for (Iterator iterator = steps.iterator(); iterator.hasNext(); ) {
      StepDescriptor step = (StepDescriptor) iterator.next();

      if (step.getId() == id) {
        return step;
      }
    }

    return null;
  }
  public JoinDescriptor getJoin(int id) {
    for (Iterator iterator = joins.iterator(); iterator.hasNext(); ) {
      JoinDescriptor joinDescriptor = (JoinDescriptor) iterator.next();

      if (joinDescriptor.getId() == id) {
        return joinDescriptor;
      }
    }

    return null;
  }
  public SplitDescriptor getSplit(int id) {
    for (Iterator iterator = splits.iterator(); iterator.hasNext(); ) {
      SplitDescriptor splitDescriptor = (SplitDescriptor) iterator.next();

      if (splitDescriptor.getId() == id) {
        return splitDescriptor;
      }
    }

    return null;
  }
Exemplo n.º 13
0
  public static void replaceResources(Collection src, Collection dest, NodeFactory f, Map o2n)
      throws ModelException {

    Iterator it = src.iterator();

    while (it.hasNext()) {

      Statement st = (Statement) it.next();
      dest.add(replaceResources(st, f, o2n));
    }
  }
  public ActionDescriptor getInitialAction(int id) {
    for (Iterator iterator = initialActions.iterator(); iterator.hasNext(); ) {
      ActionDescriptor actionDescriptor = (ActionDescriptor) iterator.next();

      if (actionDescriptor.getId() == id) {
        return actionDescriptor;
      }
    }

    return null;
  }
Exemplo n.º 15
0
  // returns list of statements
  protected static void replaceMultSPO(
      Statement st, NodeFactory f, Map o2n, Collection result, RDFNode toReplace, int position)
      throws ModelException {

    Collection replacements;

    if (toReplace instanceof Statement) {

      List l = new ArrayList();
      replaceMult((Statement) toReplace, f, o2n, l);

      if (l.size() == 1 && toReplace == l.get(0)) {
        result.add(st);
        return; // keep the same
      } else replacements = l;

    } else {

      Object ro = o2n.get(toReplace);

      if (ro instanceof Collection) replacements = (Collection) ro;
      else if (ro != null) {

        replacements = new ArrayList();
        replacements.add(ro);

      } else { // no replacement needed

        result.add(st); // keep the same statement
        return;
      }
    }

    for (Iterator it = replacements.iterator(); it.hasNext(); ) {

      Statement rs = null;
      Object rr = it.next();

      switch (position) {
        case 0:
          rs = f.createStatement((Resource) rr, st.predicate(), st.object());
          break;
        case 1:
          rs = f.createStatement(st.subject(), (Resource) rr, st.object());
          break;
        case 2:
          rs = f.createStatement(st.subject(), st.predicate(), (RDFNode) rr);
          break;
      }
      result.add(rs);
    }
  }
Exemplo n.º 16
0
  /**
   * Convert dom4j attributes to SAX attributes.
   *
   * @param element dom4j Element
   * @return SAX Attributes
   */
  public static Attributes getSAXAttributes(Element element) {
    final AttributesImpl result = new AttributesImpl();
    for (Iterator i = element.attributeIterator(); i.hasNext(); ) {
      final org.dom4j.Attribute attribute = (org.dom4j.Attribute) i.next();

      result.addAttribute(
          attribute.getNamespaceURI(),
          attribute.getName(),
          attribute.getQualifiedName(),
          ContentHandlerHelper.CDATA,
          attribute.getValue());
    }
    return result;
  }
Exemplo n.º 17
0
  /**
   * This will invoke the callbacks for the content of an element.
   *
   * @param content element content as a <code>List</code> of nodes.
   * @param namespaces <code>List</code> stack of Namespaces in scope.
   */
  private void elementContent(List content, NamespaceStack namespaces) throws JDOMException {
    for (Iterator i = content.iterator(); i.hasNext(); ) {
      Object obj = i.next();

      if (obj instanceof Content) {
        this.elementContent((Content) obj, namespaces);
      } else {
        // Not a valid element child. This could happen with
        // application-provided lists which may contain non
        // JDOM objects.
        handleError(new JDOMException("Invalid element content: " + obj));
      }
    }
  }
Exemplo n.º 18
0
 private void checkForRequiredAttributes(String tagName, Map attributes, Map mappings)
     throws ParserException {
   if (mappings == null) return;
   Iterator i = mappings.entrySet().iterator();
   while (i.hasNext()) {
     Map.Entry e = (Map.Entry) i.next();
     TagMap.AttributeMapping m = (TagMap.AttributeMapping) e.getValue();
     if (null != m && m.getRequired())
       if (null == mappings || null == attributes.get(m.getPropertyName()))
         throw new ParserException(
             "An attribute that maps to property name: "
                 + m.getPropertyName()
                 + " is required and was not specified for tag:"
                 + tagName
                 + "!");
   }
 }
Exemplo n.º 19
0
  /**
   * converts this glyph into Shape. It could be called for root's preview mode or by include
   * invoke. Pushing either this GlyphFile or DIncludeInvoke should be handled before this.
   */
  public Shape toShape(AffineTransform a_trans) {

    int ppem = k_defaultPixelSize;

    GeneralPath retval = new GeneralPath();
    Iterator i = createIterator();
    while (i.hasNext()) {
      GlyphObject object = (GlyphObject) i.next();

      if (object instanceof EContourPoint || object instanceof EHint) {
        continue;
      } // if

      retval.append(object.toShape(a_trans, ppem), false);
    } // if

    return retval;
  }
Exemplo n.º 20
0
  private void nameLengthStatistics() {
    Iterator i = Person.iterator();
    Person p;
    int l = Person.getMaxNameLength();
    int lengthTable[] = new int[l + 1];
    int j;

    System.out.println();
    // System.out.println("Name length: Number of persons");
    while (i.hasNext()) {
      p = (Person) i.next();
      lengthTable[p.getName().length()]++;
    }
    for (j = 1; j <= l; j++) {
      System.out.print(j + ": " + lengthTable[j] + "  ");
      if (j % 5 == 0) System.out.println();
    }
    System.out.println();
  }
Exemplo n.º 21
0
  private static void addMetadataSet(SolrInputDocument doc, Collection<DcsMetadata> set)
      throws IOException {
    if (set == null || set.size() == 0) {
      return;
    }

    for (DcsMetadata md : set) {
      setadd(doc, MetadataField.SCHEMA, md.getSchemaUri());
      setadd(doc, MetadataField.TEXT, md.getMetadata());

      if (md.getMetadata() == null) {
        continue;
      }

      try {
        Reader in = new StringReader(md.getMetadata());
        addXml(doc, "ext_", MetadataField.SEARCH_TEXT.solrName(), new InputSource(in));
        in.close();

        // Index FGDC
        String metadata = md.getMetadata();

        if (metadata.contains("<metadata>")) // fgdc - change the check
        {
          FgdcMapping mapping = new FgdcMapping();
          Map<Enum, String> fgdcElements = mapping.map(metadata);

          Iterator it = fgdcElements.entrySet().iterator();
          while (it.hasNext()) {
            Map.Entry pair = (Map.Entry) it.next();
            add(doc, (SeadSolrField.FgdcField) pair.getKey(), pair.getValue());
            it.remove(); // avoids a ConcurrentModificationException
          }
        }

        in.close();
      } catch (SAXException e) {
        throw new IOException(e);
      }
    }
  }
  /**
   * Remove an action from this workflow completely.
   *
   * <p>This method will check global actions and all steps.
   *
   * @return true if the action was successfully removed, false if it was not found
   */
  public boolean removeAction(ActionDescriptor actionToRemove) {
    // global actions
    for (Iterator iterator = getGlobalActions().iterator(); iterator.hasNext(); ) {
      ActionDescriptor actionDescriptor = (ActionDescriptor) iterator.next();

      if (actionDescriptor.getId() == actionToRemove.getId()) {
        getGlobalActions().remove(actionDescriptor);

        return true;
      }
    }

    // steps
    for (Iterator iterator = getSteps().iterator(); iterator.hasNext(); ) {
      StepDescriptor stepDescriptor = (StepDescriptor) iterator.next();
      ActionDescriptor actionDescriptor = stepDescriptor.getAction(actionToRemove.getId());

      if (actionDescriptor != null) {
        stepDescriptor.getActions().remove(actionDescriptor);

        return true;
      }
    }

    return false;
  }
Exemplo n.º 23
0
  /**
   * This will output the <code>JDOM Document</code>, firing off the SAX events that have been
   * registered.
   *
   * @param document <code>JDOM Document</code> to output.
   * @throws JDOMException if any error occurred.
   */
  public void output(Document document) throws JDOMException {
    if (document == null) {
      return;
    }

    // contentHandler.setDocumentLocator()
    documentLocator(document);

    // contentHandler.startDocument()
    startDocument();

    // Fire DTD events
    if (this.reportDtdEvents) {
      dtdEvents(document);
    }

    // Handle root element, as well as any root level
    // processing instructions and comments
    Iterator i = document.getContent().iterator();
    while (i.hasNext()) {
      Object obj = i.next();

      // update locator
      locator.setNode(obj);

      if (obj instanceof Element) {
        // process root element and its content
        element(document.getRootElement(), new NamespaceStack());
      } else if (obj instanceof ProcessingInstruction) {
        // contentHandler.processingInstruction()
        processingInstruction((ProcessingInstruction) obj);
      } else if (obj instanceof Comment) {
        // lexicalHandler.comment()
        comment(((Comment) obj).getText());
      }
    }

    // contentHandler.endDocument()
    endDocument();
  }
Exemplo n.º 24
0
  /**
   * This will invoke the <code>ContentHandler.startPrefixMapping</code> callback when a new
   * namespace is encountered in the <code>Document</code>.
   *
   * @param element <code>Element</code> used in callbacks.
   * @param namespaces <code>List</code> stack of Namespaces in scope.
   * @return <code>Attributes</code> declaring the namespaces local to <code>element</code> or
   *     <code>null</code>.
   */
  private Attributes startPrefixMapping(Element element, NamespaceStack namespaces)
      throws JDOMException {
    AttributesImpl nsAtts = null; // The namespaces as xmlns attributes

    Namespace ns = element.getNamespace();
    if (ns != Namespace.XML_NAMESPACE) {
      String prefix = ns.getPrefix();
      String uri = namespaces.getURI(prefix);
      if (!ns.getURI().equals(uri)) {
        namespaces.push(ns);
        nsAtts = this.addNsAttribute(nsAtts, ns);
        try {
          contentHandler.startPrefixMapping(prefix, ns.getURI());
        } catch (SAXException se) {
          throw new JDOMException("Exception in startPrefixMapping", se);
        }
      }
    }

    // Fire additional namespace declarations
    List additionalNamespaces = element.getAdditionalNamespaces();
    if (additionalNamespaces != null) {
      Iterator itr = additionalNamespaces.iterator();
      while (itr.hasNext()) {
        ns = (Namespace) itr.next();
        String prefix = ns.getPrefix();
        String uri = namespaces.getURI(prefix);
        if (!ns.getURI().equals(uri)) {
          namespaces.push(ns);
          nsAtts = this.addNsAttribute(nsAtts, ns);
          try {
            contentHandler.startPrefixMapping(prefix, ns.getURI());
          } catch (SAXException se) {
            throw new JDOMException("Exception in startPrefixMapping", se);
          }
        }
      }
    }
    return nsAtts;
  }
Exemplo n.º 25
0
  private boolean hitObjects(Rectangle2D a_rect, boolean a_isSelectOnlyOne) {
    boolean retval = false;

    Iterator i = new SelectionIterator(this);

    // loop the iterator in reverse order of drawing
    while (i.hasNext()) {
      GlyphObject object = (GlyphObject) i.next();

      if (!object.hit(a_rect, new AffineTransform())) {
        continue;
      } // if

      retval = true;

      if (a_isSelectOnlyOne) {
        return true;
      } // if
    } // while i

    return retval;
  }
Exemplo n.º 26
0
  private void publicationCountStatistics() {
    Iterator i = Person.iterator();
    Person p;
    int l = Person.getMaxPublCount();
    int countTable[] = new int[l + 1];
    int j, n;

    System.out.println();
    System.out.println("Number of publications: Number of persons");
    while (i.hasNext()) {
      p = (Person) i.next();
      countTable[p.getCount()]++;
    }
    n = 0;
    for (j = 1; j <= l; j++) {
      if (countTable[j] == 0) continue;
      n++;
      System.out.print(j + ": " + countTable[j] + "  ");
      if (n % 5 == 0) System.out.println();
    }
    System.out.println();
  }
Exemplo n.º 27
0
  private void applyUpdates() throws SAXException {
    // now handle any updates
    if (updates.size() > 0) {
      try {
        Object upd[];
        Iterator<?> i = updates.iterator();
        while (i.hasNext()) {
          upd = (Object[]) i.next();
          idx = ((Integer) upd[0]).intValue();

          if (!(lastval.equals(upd[1]))) {
            insertValue((String) (upd[1]));
          }
        }

        rs.updateRow();
      } catch (SQLException ex) {
        throw new SAXException(
            MessageFormat.format(
                resBundle.handleGetObject("xmlrch.errupdrow").toString(), ex.getMessage()));
      }
      updates.removeAllElements();
    }
  }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    CFBamXMsgSchemaMessageFormatter schemaFormatter = null;
    try {
      // Common XML Attributes
      String attrId = null;
      String attrTenantId = null;
      String attrScopeId = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RqstTimestampTypeReadByScopeIdx");

      CFBamXMsgRqstHandler xmsgRqstHandler = (CFBamXMsgRqstHandler) getParser();
      if (xmsgRqstHandler == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()");
      }

      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();

      ICFBamSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj();
      if (schemaObj == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()");
      }

      // Extract Attributes
      numAttrs = attrs.getLength();
      for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
        attrLocalName = attrs.getLocalName(idxAttr);
        if (attrLocalName.equals("Id")) {
          if (attrId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("TenantId")) {
          if (attrTenantId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrTenantId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("ScopeId")) {
          if (attrScopeId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrScopeId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("schemaLocation")) {
          // ignored
        } else {
          throw CFLib.getDefaultExceptionFactory()
              .newUnrecognizedAttributeException(
                  getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName);
        }
      }

      // Ensure that required attributes have values
      if ((attrTenantId == null) || (attrTenantId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId");
      }
      if ((attrScopeId == null) || (attrScopeId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "ScopeId");
      }

      // Save named attributes to context
      CFLibXmlCoreContext curContext = getParser().getCurContext();
      // Convert string attributes to native Java types
      // and apply the converted attributes to the editBuff.

      long natTenantId;
      natTenantId = Long.parseLong(attrTenantId);

      long natScopeId;
      natScopeId = Long.parseLong(attrScopeId);

      // Read the objects
      List<ICFBamTimestampTypeObj> list =
          schemaObj.getTimestampTypeTableObj().readTimestampTypeByScopeIdx(natTenantId, natScopeId);
      String responseOpening =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFBamXMsgValueMessageFormatter.formatValueRspnListOpenTag();
      xmsgRqstHandler.appendResponse(responseOpening);
      Iterator<ICFBamTimestampTypeObj> iter = list.iterator();
      ICFBamTimestampTypeObj cur;
      String subxml;
      while (iter.hasNext()) {
        cur = iter.next();
        subxml =
            CFBamXMsgValueMessageFormatter.formatValueRspnDerivedRec("\n\t\t", cur.getValueBuff());
        xmsgRqstHandler.appendResponse(subxml);
      }
      String responseClosing =
          "\n"
              + "\t"
              + CFBamXMsgValueMessageFormatter.formatValueRspnListCloseTag()
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.appendResponse(responseClosing);
    } catch (RuntimeException e) {
      CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
      CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    }
  }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    CFAccXMsgSchemaMessageFormatter schemaFormatter = null;
    try {
      // Common XML Attributes
      String attrId = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RqstProjectBaseReadAll");

      CFAccXMsgRqstHandler xmsgRqstHandler = (CFAccXMsgRqstHandler) getParser();
      if (xmsgRqstHandler == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()");
      }

      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();

      ICFAccSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj();
      if (schemaObj == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()");
      }

      // Extract Attributes
      numAttrs = attrs.getLength();
      for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
        attrLocalName = attrs.getLocalName(idxAttr);
        if (attrLocalName.equals("Id")) {
          if (attrId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("schemaLocation")) {
          // ignored
        } else {
          throw CFLib.getDefaultExceptionFactory()
              .newUnrecognizedAttributeException(
                  getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName);
        }
      }

      // Save named attributes to context
      CFLibXmlCoreContext curContext = getParser().getCurContext();
      // Read the objects and prepare the response XML
      List<ICFInternetProjectBaseObj> list =
          schemaObj.getProjectBaseTableObj().readAllProjectBase(true);
      String responseOpening =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFAccXMsgProjectBaseMessageFormatter.formatProjectBaseRspnListOpenTag();
      xmsgRqstHandler.appendResponse(responseOpening);
      Iterator<ICFInternetProjectBaseObj> iter = list.iterator();
      ICFInternetProjectBaseObj cur;
      String subxml;
      while (iter.hasNext()) {
        cur = iter.next();
        subxml =
            CFAccXMsgProjectBaseMessageFormatter.formatProjectBaseRspnDerivedRec(
                "\n\t\t", cur.getProjectBaseBuff());
        xmsgRqstHandler.appendResponse(subxml);
      }
      String responseClosing =
          "\n"
              + "\t"
              + CFAccXMsgProjectBaseMessageFormatter.formatProjectBaseRspnListCloseTag()
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.appendResponse(responseClosing);
    } catch (RuntimeException e) {
      CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
      CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    }
  }
  public void writeXML(PrintWriter out, int indent) {
    XMLUtil.printIndent(out, indent++);
    out.println("<workflow>");

    Iterator iter = metaAttributes.entrySet().iterator();

    while (iter.hasNext()) {
      Map.Entry entry = (Map.Entry) iter.next();
      XMLUtil.printIndent(out, indent);
      out.print("<meta name=\"");
      out.print(XMLUtil.encode(entry.getKey()));
      out.print("\">");
      out.print(XMLUtil.encode(entry.getValue()));
      out.println("</meta>");
    }

    if (registers.size() > 0) {
      XMLUtil.printIndent(out, indent++);
      out.println("<registers>");

      for (int i = 0; i < registers.size(); i++) {
        RegisterDescriptor register = (RegisterDescriptor) registers.get(i);
        register.writeXML(out, indent);
      }

      XMLUtil.printIndent(out, --indent);
      out.println("</registers>");
    }

    if (timerFunctions.size() > 0) {
      XMLUtil.printIndent(out, indent++);
      out.println("<trigger-functions>");

      Iterator iterator = timerFunctions.entrySet().iterator();

      while (iterator.hasNext()) {
        Map.Entry entry = (Map.Entry) iterator.next();
        XMLUtil.printIndent(out, indent++);
        out.println("<trigger-function id=\"" + entry.getKey() + "\">");

        FunctionDescriptor trigger = (FunctionDescriptor) entry.getValue();
        trigger.writeXML(out, indent);
        XMLUtil.printIndent(out, --indent);
        out.println("</trigger-function>");
      }

      while (iterator.hasNext()) {}

      XMLUtil.printIndent(out, --indent);
      out.println("</trigger-functions>");
    }

    if (getGlobalConditions() != null) {
      XMLUtil.printIndent(out, indent++);
      out.println("<global-conditions>");

      getGlobalConditions().writeXML(out, indent);

      out.println("</global-conditions>");
    }

    XMLUtil.printIndent(out, indent++);
    out.println("<initial-actions>");

    for (int i = 0; i < initialActions.size(); i++) {
      ActionDescriptor action = (ActionDescriptor) initialActions.get(i);
      action.writeXML(out, indent);
    }

    XMLUtil.printIndent(out, --indent);
    out.println("</initial-actions>");

    if (globalActions.size() > 0) {
      XMLUtil.printIndent(out, indent++);
      out.println("<global-actions>");

      for (int i = 0; i < globalActions.size(); i++) {
        ActionDescriptor action = (ActionDescriptor) globalActions.get(i);
        action.writeXML(out, indent);
      }

      XMLUtil.printIndent(out, --indent);
      out.println("</global-actions>");
    }

    if (commonActions.size() > 0) {
      XMLUtil.printIndent(out, indent++);
      out.println("<common-actions>");

      Iterator iterator = getCommonActions().values().iterator();

      while (iterator.hasNext()) {
        ActionDescriptor action = (ActionDescriptor) iterator.next();
        action.writeXML(out, indent);
      }

      XMLUtil.printIndent(out, --indent);
      out.println("</common-actions>");
    }

    XMLUtil.printIndent(out, indent++);
    out.println("<steps>");

    for (int i = 0; i < steps.size(); i++) {
      StepDescriptor step = (StepDescriptor) steps.get(i);
      step.writeXML(out, indent);
    }

    XMLUtil.printIndent(out, --indent);
    out.println("</steps>");

    if (splits.size() > 0) {
      XMLUtil.printIndent(out, indent++);
      out.println("<splits>");

      for (int i = 0; i < splits.size(); i++) {
        SplitDescriptor split = (SplitDescriptor) splits.get(i);
        split.writeXML(out, indent);
      }

      XMLUtil.printIndent(out, --indent);
      out.println("</splits>");
    }

    if (joins.size() > 0) {
      XMLUtil.printIndent(out, indent++);
      out.println("<joins>");

      for (int i = 0; i < joins.size(); i++) {
        JoinDescriptor join = (JoinDescriptor) joins.get(i);
        join.writeXML(out, indent);
      }

      XMLUtil.printIndent(out, --indent);
      out.println("</joins>");
    }

    XMLUtil.printIndent(out, --indent);
    out.println("</workflow>");
  }