All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jvoicexml.xml.ccxml.Exit Maven / Gradle / Ivy

The newest version!
/*
 * JVoiceXML - A free VoiceXML implementation.
 *
 * Copyright (C) 2005-2018 JVoiceXML group - http://jvoicexml.sourceforge.net
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 *
 */

package org.jvoicexml.xml.ccxml;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;

import org.jvoicexml.xml.XmlNode;
import org.jvoicexml.xml.XmlNodeFactory;
import org.w3c.dom.Node;

/**
 * <exit> ends execution of the CCXML session. All pending
 * events are discarded, and there is no way to restart CCXML execution.
 *
 * @author Steve Doyle
 */
public final class Exit
        extends AbstractCcxmlNode {

    /** Name of the tag. */
    public static final String TAG_NAME = "exit";

    /**
     * A return ECMAScript expression (e.g. 0 or 'oops!'). If this attribute is
     * omitted, the return value is ECMAScript undefined. This value is stored
     * as a property of the exit event.
     */
    public static final String ATTRIBUTE_EXPR = "expr";

    /**
     * A list of one or more whitespace separated CCXML unqualified variable
     * names to be returned. These variable names and their associated values
     * will be set as properties of the exit event.
     */
    public static final String ATTRIBUTE_NAMELIST = "namelist";

    /**
     * Supported attribute names for this node.
     */
    protected static final ArrayList ATTRIBUTE_NAMES;

    /**
     * Set the valid attributes for this node.
     */
    static {
        ATTRIBUTE_NAMES = new java.util.ArrayList();

        ATTRIBUTE_NAMES.add(ATTRIBUTE_EXPR);
        ATTRIBUTE_NAMES.add(ATTRIBUTE_NAMELIST);
    }

    /**
     * Valid child tags for this node.
     */
    private static final Set CHILD_TAGS;

    /**
     * Set the valid child tags for this node.
     */
    static {
        CHILD_TAGS = new java.util.HashSet();

    }

    /**
     * Construct a new exit object without a node.
     * 

* This is necessary for the node factory. *

* * @see CcxmlNodeFactory */ public Exit() { super(null); } /** * Construct a new exit object. * @param node The encapsulated node. */ Exit(final Node node) { super(node); } /** * Constructs a new node. * * @param n * The encapsulated node. * @param factory * The node factory to use. */ private Exit(final Node n, final XmlNodeFactory factory) { super(n, factory); } /** * Get the name of the tag for the derived node. * * @return name of the tag. */ public String getTagName() { return TAG_NAME; } /** * {@inheritDoc} */ public XmlNode newInstance(final Node n, final XmlNodeFactory factory) { return new Exit(n, factory); } /** * Retrieve the expr attribute. * @return Value of the expr attribute. * @see #ATTRIBUTE_EXPR */ public String getExpr() { return getAttribute(ATTRIBUTE_EXPR); } /** * Set the expr attribute. * @param expr Value of the expr attribute. * @see #ATTRIBUTE_EXPR */ public void setExpr(final String expr) { setAttribute(ATTRIBUTE_EXPR, expr); } /** * Retrieve the namelist attribute. * @return Value of the namelist attribute. * @see #ATTRIBUTE_NAMELIST */ public String getNamelist() { return getAttribute(ATTRIBUTE_NAMELIST); } /** * Set the namelist attribute. * @param namelist Value of the namelist attribute. * @see #ATTRIBUTE_NAMELIST */ public void setNamelist(final String namelist) { setAttribute(ATTRIBUTE_NAMELIST, namelist); } /** * {@inheritDoc} */ @Override protected boolean canContainChild(final String tagName) { return CHILD_TAGS.contains(tagName); } /** * {@inheritDoc} */ @Override public Collection getAttributeNames() { return ATTRIBUTE_NAMES; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy