@Override
  protected void fillVoiceXmlDocument(
      Document document, Element formElement, VoiceXmlDialogueContext dialogueContext)
      throws VoiceXmlDocumentRenderingException {
    addVariableDeclarations(formElement, mVariables);

    Element blockElement = DomUtils.appendNewElement(formElement, BLOCK_ELEMENT);

    if (mScript != null) {
      Element scriptElement = DomUtils.appendNewElement(blockElement, SCRIPT_ELEMENT);
      DomUtils.appendNewText(scriptElement, mScript);
    }

    StringBuffer scriptBuffer = new StringBuffer();

    scriptBuffer.append(RIVR_SCOPE_OBJECT + ".addValueResult({");
    boolean first = true;
    for (VariableDeclaration variableDeclaration : mVariables) {
      if (!first) {
        scriptBuffer.append(", ");
      } else {
        first = false;
      }
      scriptBuffer.append("\"");
      scriptBuffer.append(variableDeclaration.getName());
      scriptBuffer.append("\": ");
      scriptBuffer.append("dialog.");
      scriptBuffer.append(variableDeclaration.getName());
    }
    scriptBuffer.append("});");

    createScript(blockElement, scriptBuffer.toString());
    createGotoSubmit(blockElement);
  }
 public void visit(VariableDeclaration entity) {
   wGetVisitor1().visit(entity.getName());
   wGetVisitor1().visit(entity.getReference());
   wGetVisitor1().visit(entity.getReferenceType());
 }
Beispiel #3
0
 @Override
 public Void visitVariableDeclaration(VariableDeclaration node) {
   visit(node.getName());
   visit(" = ", node.getInitializer());
   return null;
 }
 public String getNameLowerCase() {
   if (nameLowerCase == null) {
     nameLowerCase = variable.getName().toLowerCase();
   }
   return nameLowerCase;
 }
 public String getName() {
   if (cachedToString == null) {
     cachedToString = variable.getName();
   }
   return cachedToString;
 }