Package org.apache.commons.scxml2.model

Examples of org.apache.commons.scxml2.model.Assign


     */
    private static void readAssign(final XMLStreamReader reader, final Configuration configuration,
                                   final Executable executable, final ActionsContainer parent)
            throws XMLStreamException, ModelException {

        Assign assign = new Assign();
        assign.setExpr(readAV(reader, ATTR_EXPR));
        assign.setName(readAV(reader, ATTR_NAME));
        if (assign.getName() != null && assign.getName().trim().length() > 0) {
            // if 'non-standard' name attribute is defined, don't require location (as per the spec. 20130831)
            assign.setLocation(readAV(reader, ATTR_LOCATION));
        }
        else {
            assign.setLocation(readRequiredAV(reader, ELEM_ASSIGN, ATTR_LOCATION));
        }
        assign.setSrc(readAV(reader, ATTR_SRC));
        assign.setPathResolver(configuration.pathResolver);
        readNamespaces(configuration, assign);
        assign.setParent(executable);
        if (parent != null) {
            parent.addAction(assign);
        } else {
            executable.addAction(assign);
        }
View Full Code Here


        if (actions == null) {
            return;
        }
        for (Action a : actions) {
            if (a instanceof Assign) {
                Assign asn = (Assign) a;
                writer.writeStartElement(XMLNS_SCXML, ELEM_ASSIGN);
                writeAV(writer, ATTR_LOCATION, asn.getLocation());
                writeAV(writer, ATTR_NAME, asn.getName());
                writeAV(writer, ATTR_SRC, asn.getSrc());
                writeAV(writer, ATTR_EXPR, escapeXML(asn.getExpr()));
                writer.writeEndElement();
            } else if (a instanceof Send) {
                writeSend(writer, (Send) a);
            } else if (a instanceof Cancel) {
                Cancel c = (Cancel) a;
View Full Code Here

     */
    private static void readCancel(final XMLStreamReader reader, final Configuration configuration,
                                   final Executable executable, final ActionsContainer parent)
            throws XMLStreamException {

        Cancel cancel = new Cancel();
        readNamespaces(configuration, cancel);
        cancel.setParent(executable);
        if (parent != null) {
            parent.addAction(cancel);
        } else {
            executable.addAction(cancel);
        }
View Full Code Here

                            readVar(reader, configuration, executable, parent);
                        } else {
                            reportIgnoredElement(reader, configuration, end, nsURI, name);
                        }
                    } else { // custom action
                        CustomAction customAction = null;
                        if (!configuration.customActions.isEmpty()) {
                            for (CustomAction ca : configuration.customActions) {
                                if (ca.getNamespaceURI().equals(nsURI) && ca.getLocalName().equals(name)) {
                                    customAction = ca;
                                }
View Full Code Here

     * @throws XMLStreamException An exception processing the underlying {@link XMLStreamReader}.
     */
    private static void readData(final XMLStreamReader reader, final Configuration configuration, final Datamodel dm)
            throws XMLStreamException, ModelException {

        Data datum = new Data();
        datum.setId(readRequiredAV(reader, ELEM_DATA, ATTR_ID));
        datum.setExpr(readAV(reader, ATTR_EXPR));
        readNamespaces(configuration, datum);
        datum.setNode(readNode(reader, configuration, XMLNS_SCXML, ELEM_DATA, new String[] {"id"}));
        dm.addData(datum);
    }
View Full Code Here

        contexts.clear();
        histories.clear();
        currentStatus.clear();

        // Clone root datamodel
        Datamodel rootdm = stateMachine.getDatamodel();
        cloneDatamodel(rootdm, getRootContext(), evaluator, errorReporter);
        initialized = true;
    }
View Full Code Here

                context = evaluator.newContext(getGlobalContext());
            } else {
                context = evaluator.newContext(getContext(parent));
            }
            if (state instanceof TransitionalState) {
                Datamodel datamodel = ((TransitionalState)state).getDatamodel();
                cloneDatamodel(datamodel, context, evaluator, errorReporter);
            }
            contexts.put(state, context);
        }
        return context;
View Full Code Here

     */
    private static void readDatamodel(final XMLStreamReader reader, final Configuration configuration,
                                      final SCXML scxml, final TransitionalState parent)
            throws XMLStreamException, ModelException {

        Datamodel dm = new Datamodel();

        loop : while (reader.hasNext()) {
            String name, nsURI;
            switch (reader.next()) {
                case XMLStreamConstants.START_ELEMENT:
View Full Code Here

     */
    private static void readElse(final XMLStreamReader reader, final Configuration configuration,
                                 final Executable executable, final If iff)
            throws XMLStreamException {

        Else els = new Else();
        readNamespaces(configuration, els);
        els.setParent(executable);
        iff.addAction(els);
    }
View Full Code Here

     */
    private static void readElseIf(final XMLStreamReader reader, final Configuration configuration,
                                   final Executable executable, final If iff)
            throws XMLStreamException, ModelException {

        ElseIf elseif = new ElseIf();
        elseif.setCond(readRequiredAV(reader, ELEM_ELSEIF, ATTR_COND));
        readNamespaces(configuration, elseif);
        elseif.setParent(executable);
        iff.addAction(elseif);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.scxml2.model.Assign

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.