Пример #1
0
  /**
   * Add/insert the index-th value.
   *
   * @param itemXml the item xml
   * @param xpath
   * @param value
   * @param isInsert
   * @param index the numnber
   * @param identifier set this attribute if not null)
   */
  private void addIndexedEntry(
      Item itemXml, String xpath, String value, boolean isInsert, int index, String identifier) {

    String indexBrackets = "[" + index + "]";
    String thisNode = xpath + indexBrackets;
    String thisNodeIdentity = thisNode + "/@identity";
    if (isInsert) {
      log.debug("Adding entry: " + thisNode);
      itemXml.insertElement(thisNode, xpath, "itemfeedback");
    } else {
      log.debug("Updating entry: " + thisNode);
    }
    try {
      if (value == null) {
        value = "";
      }
      itemXml.update(thisNode, value);
      log.debug("updated value in addIndexedEntry()");
    } catch (Exception ex) {
      log.error("Cannot update value in addIndexedEntry(): " + ex);
    }
  }
Пример #2
0
  /**
   * Set the (one or more) item texts. Valid for single and multiple texts.
   *
   * @todo FIB, MATCHING TEXT
   * @param itemXml
   * @param itemText text to be updated
   */
  public void setItemTexts(ArrayList itemTextList, Item itemXml) {
    String xPath = "assessmentItem/itemBody";
    if (itemTextList.size() < 1) {
      return;
    }

    String text = ((ItemTextIfc) itemTextList.get(0)).getText();
    log.debug("item text: " + text);
    if (itemXml.isFIB()) {
      //      process fib
      //      return;
    }

    if (itemXml.isFIN()) {
      //      process fin
      //      return;
    }

    try {
      itemXml.update(xPath, text);
    } catch (Exception ex) {
      throw new RuntimeException(ex);
    }
  }