Classes in this File | Line Coverage | Branch Coverage | Complexity | |||||||
Data |
|
| 1.0;1 |
1 | /* |
|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
|
3 | * contributor license agreements. See the NOTICE file distributed with |
|
4 | * this work for additional information regarding copyright ownership. |
|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
6 | * (the "License"); you may not use this file except in compliance with |
|
7 | * the License. You may obtain a copy of the License at |
|
8 | * |
|
9 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
10 | * |
|
11 | * Unless required by applicable law or agreed to in writing, software |
|
12 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 | * See the License for the specific language governing permissions and |
|
15 | * limitations under the License. |
|
16 | */ |
|
17 | package org.apache.commons.scxml.model; |
|
18 | ||
19 | import java.io.Serializable; |
|
20 | import java.util.Map; |
|
21 | ||
22 | import org.w3c.dom.Node; |
|
23 | ||
24 | /** |
|
25 | * The class in this SCXML object model that corresponds to the SCXML |
|
26 | * <data> child element of the <datamodel> element. |
|
27 | * |
|
28 | */ |
|
29 | public class Data implements NamespacePrefixesHolder, Serializable { |
|
30 | ||
31 | /** |
|
32 | * Serial version UID. |
|
33 | */ |
|
34 | private static final long serialVersionUID = 1L; |
|
35 | ||
36 | /** |
|
37 | * The name of this data instance, that is used as its identifier. |
|
38 | */ |
|
39 | private String name; |
|
40 | ||
41 | /** |
|
42 | * The URL to get the XML data tree from. |
|
43 | */ |
|
44 | private String src; |
|
45 | ||
46 | /** |
|
47 | * The expression that evaluates to the value of this data instance. |
|
48 | */ |
|
49 | private String expr; |
|
50 | ||
51 | /** |
|
52 | * The child XML data tree, parsed as a Node, cloned per execution |
|
53 | * instance. |
|
54 | */ |
|
55 | private Node node; |
|
56 | ||
57 | /** |
|
58 | * The current XML namespaces in the SCXML document for this action node, |
|
59 | * preserved for deferred XPath evaluation. Easier than to scrape node |
|
60 | * above, given the Builtin API. |
|
61 | */ |
|
62 | private Map namespaces; |
|
63 | ||
64 | /** |
|
65 | * Constructor. |
|
66 | */ |
|
67 | 64 | public Data() { |
68 | 64 | this.name = null; |
69 | 64 | this.src = null; |
70 | 64 | this.expr = null; |
71 | 64 | this.node = null; |
72 | 64 | } |
73 | ||
74 | /** |
|
75 | * Get the name. |
|
76 | * |
|
77 | * @return String The name. |
|
78 | */ |
|
79 | public final String getName() { |
|
80 | 48 | return name; |
81 | } |
|
82 | ||
83 | /** |
|
84 | * Set the name. |
|
85 | * |
|
86 | * @param name The name. |
|
87 | */ |
|
88 | public final void setName(final String name) { |
|
89 | 64 | this.name = name; |
90 | 64 | } |
91 | ||
92 | /** |
|
93 | * Get the URL where the XML data tree resides. |
|
94 | * |
|
95 | * @return String The URL. |
|
96 | */ |
|
97 | public final String getSrc() { |
|
98 | 48 | return src; |
99 | } |
|
100 | ||
101 | /** |
|
102 | * Set the URL where the XML data tree resides. |
|
103 | * |
|
104 | * @param src The source URL. |
|
105 | */ |
|
106 | public final void setSrc(final String src) { |
|
107 | 0 | this.src = src; |
108 | 0 | } |
109 | ||
110 | /** |
|
111 | * Get the expression that evaluates to the value of this data instance. |
|
112 | * |
|
113 | * @return String The expression. |
|
114 | */ |
|
115 | public final String getExpr() { |
|
116 | 52 | return expr; |
117 | } |
|
118 | ||
119 | /** |
|
120 | * Set the expression that evaluates to the value of this data instance. |
|
121 | * |
|
122 | * @param expr The expression. |
|
123 | */ |
|
124 | public final void setExpr(final String expr) { |
|
125 | 4 | this.expr = expr; |
126 | 4 | } |
127 | ||
128 | /** |
|
129 | * Get the XML data tree. |
|
130 | * |
|
131 | * @return Node The XML data tree, parsed as a <code>Node</code>. |
|
132 | */ |
|
133 | public final Node getNode() { |
|
134 | 48 | return node; |
135 | } |
|
136 | ||
137 | /** |
|
138 | * Set the XML data tree. |
|
139 | * |
|
140 | * @param node The XML data tree, parsed as a <code>Node</code>. |
|
141 | */ |
|
142 | public final void setNode(final Node node) { |
|
143 | 60 | this.node = node; |
144 | 60 | } |
145 | ||
146 | /** |
|
147 | * Get the XML namespaces at this action node in the SCXML document. |
|
148 | * |
|
149 | * @return Returns the map of namespaces. |
|
150 | */ |
|
151 | public final Map getNamespaces() { |
|
152 | 4 | return namespaces; |
153 | } |
|
154 | ||
155 | /** |
|
156 | * Set the XML namespaces at this action node in the SCXML document. |
|
157 | * |
|
158 | * @param namespaces The document namespaces. |
|
159 | */ |
|
160 | public final void setNamespaces(final Map namespaces) { |
|
161 | 64 | this.namespaces = namespaces; |
162 | 64 | } |
163 | ||
164 | } |
|
165 |