Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.yangutils.datamodel; |
| 17 | |
Bharat saraswal | b551aae | 2016-07-14 15:18:20 +0530 | [diff] [blame^] | 18 | import java.util.HashMap; |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 19 | import java.util.LinkedList; |
| 20 | import java.util.List; |
Bharat saraswal | b551aae | 2016-07-14 15:18:20 +0530 | [diff] [blame^] | 21 | import java.util.Map; |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 22 | |
| 23 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 24 | import org.onosproject.yangutils.datamodel.utils.Parsable; |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 25 | import org.onosproject.yangutils.datamodel.utils.ResolvableStatus; |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 26 | import org.onosproject.yangutils.datamodel.utils.YangConstructType; |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 27 | |
Vidyashree Rama | 25bf4d0 | 2016-03-29 14:37:02 +0530 | [diff] [blame] | 28 | import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil; |
| 29 | |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 30 | /*- |
| 31 | * Reference RFC 6020. |
| 32 | * |
| 33 | * The "augment" statement allows a module or submodule to add to the |
| 34 | * schema tree defined in an external module, or the current module and |
| 35 | * its submodules, and to add to the nodes from a grouping in a "uses" |
| 36 | * statement. The argument is a string that identifies a node in the |
| 37 | * schema tree. This node is called the augment's target node. The |
| 38 | * target node MUST be either a container, list, choice, case, input, |
| 39 | * output, or notification node. It is augmented with the nodes defined |
| 40 | * in the sub-statements that follow the "augment" statement. |
| 41 | * |
| 42 | * The argument string is a schema node identifier. |
| 43 | * If the "augment" statement is on the top level in a module or |
| 44 | * submodule, the absolute form of a schema node identifier |
| 45 | * MUST be used. If the "augment" statement is a sub-statement to the |
| 46 | * "uses" statement, the descendant form MUST be used. |
| 47 | * |
| 48 | * If the target node is a container, list, case, input, output, or |
| 49 | * notification node, the "container", "leaf", "list", "leaf-list", |
| 50 | * "uses", and "choice" statements can be used within the "augment" |
| 51 | * statement. |
| 52 | * |
| 53 | * If the target node is a choice node, the "case" statement, or a case |
| 54 | * shorthand statement can be used within the "augment" statement. |
| 55 | * |
| 56 | * If the target node is in another module, then nodes added by the |
| 57 | * augmentation MUST NOT be mandatory nodes. |
| 58 | * |
| 59 | * The "augment" statement MUST NOT add multiple nodes with the same |
| 60 | * name from the same module to the target node. |
| 61 | * The augment's sub-statements |
| 62 | * |
| 63 | * +--------------+---------+-------------+------------------+ |
| 64 | * | substatement | section | cardinality |data model mapping| |
| 65 | * +--------------+---------+-------------+------------------+ |
| 66 | * | anyxml | 7.10 | 0..n |-not supported | |
| 67 | * | case | 7.9.2 | 0..n |-child nodes | |
| 68 | * | choice | 7.9 | 0..n |-child nodes | |
| 69 | * | container | 7.5 | 0..n |-child nodes | |
| 70 | * | description | 7.19.3 | 0..1 |-string | |
Vidyashree Rama | deac28b | 2016-06-20 15:12:43 +0530 | [diff] [blame] | 71 | * | if-feature | 7.18.2 | 0..n |-YangIfFeature | |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 72 | * | leaf | 7.6 | 0..n |-YangLeaf | |
| 73 | * | leaf-list | 7.7 | 0..n |-YangLeafList | |
| 74 | * | list | 7.8 | 0..n |-child nodes | |
| 75 | * | reference | 7.19.4 | 0..1 |-String | |
| 76 | * | status | 7.19.2 | 0..1 |-YangStatus | |
| 77 | * | uses | 7.12 | 0..n |-child nodes | |
Vidyashree Rama | deac28b | 2016-06-20 15:12:43 +0530 | [diff] [blame] | 78 | * | when | 7.19.5 | 0..1 |-YangWhen | |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 79 | * +--------------+---------+-------------+------------------+ |
| 80 | */ |
Vinod Kumar S | d4deb06 | 2016-04-15 18:08:57 +0530 | [diff] [blame] | 81 | |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 82 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 83 | * Representation of data model node to maintain information defined in YANG augment. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 84 | */ |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 85 | public class YangAugment |
| 86 | extends YangNode |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 87 | implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector, YangAugmentedInfo, Resolvable, |
Bharat saraswal | b551aae | 2016-07-14 15:18:20 +0530 | [diff] [blame^] | 88 | YangXPathResolver, YangWhenHolder, YangIfFeatureHolder { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 89 | |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 90 | private static final long serialVersionUID = 806201602L; |
| 91 | |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 92 | /** |
| 93 | * Augment target node. |
| 94 | */ |
Vidyashree Rama | 25bf4d0 | 2016-03-29 14:37:02 +0530 | [diff] [blame] | 95 | private String name; |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 96 | |
| 97 | /** |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 98 | * Description of augment. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 99 | */ |
| 100 | private String description; |
| 101 | |
| 102 | /** |
| 103 | * List of leaves. |
| 104 | */ |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 105 | private List<YangLeaf> listOfLeaf; |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 106 | |
| 107 | /** |
| 108 | * List of leaf-lists. |
| 109 | */ |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 110 | private List<YangLeafList> listOfLeafList; |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 111 | |
| 112 | /** |
Vidyashree Rama | 25bf4d0 | 2016-03-29 14:37:02 +0530 | [diff] [blame] | 113 | * List of node identifiers. |
| 114 | */ |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 115 | private List<YangAtomicPath> targetNode; |
Vidyashree Rama | 25bf4d0 | 2016-03-29 14:37:02 +0530 | [diff] [blame] | 116 | |
| 117 | /** |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 118 | * Reference of the YANG augment. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 119 | */ |
| 120 | private String reference; |
| 121 | |
| 122 | /** |
| 123 | * Status of the node. |
| 124 | */ |
| 125 | private YangStatusType status; |
| 126 | |
| 127 | /** |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 128 | * Resolved augmented node. |
| 129 | */ |
| 130 | private YangNode augmentedNode; |
| 131 | |
| 132 | /** |
Bharat saraswal | b551aae | 2016-07-14 15:18:20 +0530 | [diff] [blame^] | 133 | * All resolved nodes in given xPath. |
| 134 | */ |
| 135 | private Map<YangAtomicPath, YangNode> resolveNodeInPath; |
| 136 | |
| 137 | /** |
| 138 | * Status of resolution. If completely resolved enum value is "RESOLVED", if not enum value is "UNRESOLVED", in case |
| 139 | * reference of grouping/typedef is added to uses/type but it's not resolved value of enum should be |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 140 | * "INTRA_FILE_RESOLVED". |
| 141 | */ |
| 142 | private ResolvableStatus resolvableStatus; |
| 143 | |
| 144 | /** |
Vidyashree Rama | deac28b | 2016-06-20 15:12:43 +0530 | [diff] [blame] | 145 | * When data of the node. |
| 146 | */ |
| 147 | private YangWhen when; |
| 148 | |
| 149 | /** |
| 150 | * List of if-feature. |
| 151 | */ |
| 152 | private List<YangIfFeature> ifFeatureList; |
| 153 | |
| 154 | /** |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 155 | * Create a YANG augment node. |
| 156 | */ |
| 157 | public YangAugment() { |
| 158 | super(YangNodeType.AUGMENT_NODE); |
Bharat saraswal | b551aae | 2016-07-14 15:18:20 +0530 | [diff] [blame^] | 159 | resolveNodeInPath = new HashMap<>(); |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 160 | resolvableStatus = ResolvableStatus.UNRESOLVED; |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 164 | * Returns the augmented node. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 165 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 166 | * @return the augmented node |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 167 | */ |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 168 | public List<YangAtomicPath> getTargetNode() { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 169 | return targetNode; |
| 170 | } |
| 171 | |
| 172 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 173 | * Sets the augmented node. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 174 | * |
Vidyashree Rama | 25bf4d0 | 2016-03-29 14:37:02 +0530 | [diff] [blame] | 175 | * @param nodeIdentifiers the augmented node |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 176 | */ |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 177 | public void setTargetNode(List<YangAtomicPath> nodeIdentifiers) { |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 178 | targetNode = nodeIdentifiers; |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 179 | } |
| 180 | |
| 181 | /** |
Vidyashree Rama | deac28b | 2016-06-20 15:12:43 +0530 | [diff] [blame] | 182 | * Returns the when. |
| 183 | * |
| 184 | * @return the when |
| 185 | */ |
| 186 | @Override |
| 187 | public YangWhen getWhen() { |
| 188 | return when; |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * Sets the when. |
| 193 | * |
| 194 | * @param when the when to set |
| 195 | */ |
| 196 | @Override |
| 197 | public void setWhen(YangWhen when) { |
| 198 | this.when = when; |
| 199 | } |
| 200 | |
| 201 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 202 | * Returns the description. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 203 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 204 | * @return the description |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 205 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 206 | @Override |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 207 | public String getDescription() { |
| 208 | return description; |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * Set the description. |
| 213 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 214 | * @param description set the description |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 215 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 216 | @Override |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 217 | public void setDescription(String description) { |
| 218 | this.description = description; |
| 219 | } |
| 220 | |
Vidyashree Rama | 25bf4d0 | 2016-03-29 14:37:02 +0530 | [diff] [blame] | 221 | @Override |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 222 | public void detectCollidingChild(String identifierName, YangConstructType dataType) |
| 223 | throws DataModelException { |
Vidyashree Rama | 25bf4d0 | 2016-03-29 14:37:02 +0530 | [diff] [blame] | 224 | // Detect colliding child. |
| 225 | detectCollidingChildUtil(identifierName, dataType, this); |
| 226 | } |
| 227 | |
| 228 | @Override |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 229 | public void detectSelfCollision(String identifierName, YangConstructType dataType) |
| 230 | throws DataModelException { |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 231 | if (getName().equals(identifierName)) { |
Vidyashree Rama | 25bf4d0 | 2016-03-29 14:37:02 +0530 | [diff] [blame] | 232 | throw new DataModelException("YANG file error: Duplicate input identifier detected, same as input \"" |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 233 | + getName() + "\""); |
Vidyashree Rama | 25bf4d0 | 2016-03-29 14:37:02 +0530 | [diff] [blame] | 234 | } |
| 235 | } |
| 236 | |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 237 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 238 | * Returns the list of leaves. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 239 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 240 | * @return the list of leaves |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 241 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 242 | @Override |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 243 | public List<YangLeaf> getListOfLeaf() { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 244 | return listOfLeaf; |
| 245 | } |
| 246 | |
| 247 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 248 | * Sets the list of leaves. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 249 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 250 | * @param leafsList the list of leaf to set |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 251 | */ |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 252 | @Override |
| 253 | public void setListOfLeaf(List<YangLeaf> leafsList) { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 254 | listOfLeaf = leafsList; |
| 255 | } |
| 256 | |
| 257 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 258 | * Adds a leaf. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 259 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 260 | * @param leaf the leaf to be added |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 261 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 262 | @Override |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 263 | public void addLeaf(YangLeaf leaf) { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 264 | if (getListOfLeaf() == null) { |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 265 | setListOfLeaf(new LinkedList<YangLeaf>()); |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 266 | } |
| 267 | |
| 268 | getListOfLeaf().add(leaf); |
| 269 | } |
| 270 | |
| 271 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 272 | * Returns the list of leaf-list. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 273 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 274 | * @return the list of leaf-list |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 275 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 276 | @Override |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 277 | public List<YangLeafList> getListOfLeafList() { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 278 | return listOfLeafList; |
| 279 | } |
| 280 | |
| 281 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 282 | * Sets the list of leaf-list. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 283 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 284 | * @param listOfLeafList the list of leaf-list to set |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 285 | */ |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 286 | @Override |
| 287 | public void setListOfLeafList(List<YangLeafList> listOfLeafList) { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 288 | this.listOfLeafList = listOfLeafList; |
| 289 | } |
| 290 | |
| 291 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 292 | * Adds a leaf-list. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 293 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 294 | * @param leafList the leaf-list to be added |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 295 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 296 | @Override |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 297 | public void addLeafList(YangLeafList leafList) { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 298 | if (getListOfLeafList() == null) { |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 299 | setListOfLeafList(new LinkedList<YangLeafList>()); |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 300 | } |
| 301 | |
| 302 | getListOfLeafList().add(leafList); |
| 303 | } |
| 304 | |
| 305 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 306 | * Returns the textual reference. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 307 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 308 | * @return the reference |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 309 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 310 | @Override |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 311 | public String getReference() { |
| 312 | return reference; |
| 313 | } |
| 314 | |
| 315 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 316 | * Sets the textual reference. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 317 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 318 | * @param reference the reference to set |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 319 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 320 | @Override |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 321 | public void setReference(String reference) { |
| 322 | this.reference = reference; |
| 323 | } |
| 324 | |
| 325 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 326 | * Returns the status. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 327 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 328 | * @return the status |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 329 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 330 | @Override |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 331 | public YangStatusType getStatus() { |
| 332 | return status; |
| 333 | } |
| 334 | |
| 335 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 336 | * Sets the status. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 337 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 338 | * @param status the status to set |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 339 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 340 | @Override |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 341 | public void setStatus(YangStatusType status) { |
| 342 | this.status = status; |
| 343 | } |
| 344 | |
| 345 | /** |
| 346 | * Returns the type of the data as belongs-to. |
| 347 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 348 | * @return returns AUGMENT_DATA |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 349 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 350 | @Override |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 351 | public YangConstructType getYangConstructType() { |
| 352 | return YangConstructType.AUGMENT_DATA; |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 353 | } |
| 354 | |
| 355 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 356 | * Validates the data on entering the corresponding parse tree node. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 357 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 358 | * @throws DataModelException a violation of data model rules |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 359 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 360 | @Override |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 361 | public void validateDataOnEntry() |
| 362 | throws DataModelException { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 363 | // TODO auto-generated method stub, to be implemented by parser |
| 364 | } |
| 365 | |
| 366 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 367 | * Validates the data on exiting the corresponding parse tree node. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 368 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 369 | * @throws DataModelException a violation of data model rules |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 370 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 371 | @Override |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 372 | public void validateDataOnExit() |
| 373 | throws DataModelException { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 374 | // TODO auto-generated method stub, to be implemented by parser |
| 375 | } |
| 376 | |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 377 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 378 | * Returns the target nodes name where the augmentation is being done. |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 379 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 380 | * @return target nodes name where the augmentation is being done |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 381 | */ |
| 382 | @Override |
| 383 | public String getName() { |
Vidyashree Rama | 25bf4d0 | 2016-03-29 14:37:02 +0530 | [diff] [blame] | 384 | return name; |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 385 | } |
| 386 | |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 387 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 388 | * Sets the target nodes name where the augmentation is being done. |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 389 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 390 | * @param name target nodes name where the augmentation is being done |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 391 | */ |
| 392 | @Override |
| 393 | public void setName(String name) { |
Vidyashree Rama | 25bf4d0 | 2016-03-29 14:37:02 +0530 | [diff] [blame] | 394 | this.name = name; |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 395 | } |
| 396 | |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 397 | /** |
| 398 | * Returns augmented node. |
| 399 | * |
| 400 | * @return augmented node |
| 401 | */ |
| 402 | public YangNode getAugmentedNode() { |
| 403 | return augmentedNode; |
| 404 | } |
| 405 | |
| 406 | /** |
| 407 | * Sets augmented node. |
| 408 | * |
| 409 | * @param augmentedNode augmented node |
| 410 | */ |
| 411 | public void setAugmentedNode(YangNode augmentedNode) { |
| 412 | this.augmentedNode = augmentedNode; |
| 413 | } |
| 414 | |
Vidyashree Rama | deac28b | 2016-06-20 15:12:43 +0530 | [diff] [blame] | 415 | @Override |
| 416 | public List<YangIfFeature> getIfFeatureList() { |
| 417 | return ifFeatureList; |
| 418 | } |
| 419 | |
| 420 | @Override |
Bharat saraswal | b551aae | 2016-07-14 15:18:20 +0530 | [diff] [blame^] | 421 | public void setIfFeatureList(List<YangIfFeature> ifFeatureList) { |
| 422 | this.ifFeatureList = ifFeatureList; |
| 423 | } |
| 424 | |
| 425 | @Override |
Vidyashree Rama | deac28b | 2016-06-20 15:12:43 +0530 | [diff] [blame] | 426 | public void addIfFeatureList(YangIfFeature ifFeature) { |
| 427 | if (getIfFeatureList() == null) { |
| 428 | setIfFeatureList(new LinkedList<>()); |
| 429 | } |
| 430 | getIfFeatureList().add(ifFeature); |
| 431 | } |
| 432 | |
| 433 | @Override |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 434 | public ResolvableStatus getResolvableStatus() { |
| 435 | return resolvableStatus; |
| 436 | } |
| 437 | |
| 438 | @Override |
| 439 | public void setResolvableStatus(ResolvableStatus resolvableStatus) { |
| 440 | this.resolvableStatus = resolvableStatus; |
| 441 | |
| 442 | } |
| 443 | |
| 444 | @Override |
| 445 | public void resolve() throws DataModelException { |
| 446 | // Resolving of target node is being done in XPathLinker. |
| 447 | } |
Bharat saraswal | b551aae | 2016-07-14 15:18:20 +0530 | [diff] [blame^] | 448 | |
| 449 | /** |
| 450 | * Returns all resolved node in path. |
| 451 | * |
| 452 | * @return all resolved node in path |
| 453 | */ |
| 454 | public Map<YangAtomicPath, YangNode> getResolveNodeInPath() { |
| 455 | return resolveNodeInPath; |
| 456 | } |
| 457 | |
| 458 | /** |
| 459 | * Sets all resolved node in path. |
| 460 | * |
| 461 | * @param resolveNodeInPath all resolved node in path |
| 462 | */ |
| 463 | public void setResolveNodeInPath(Map<YangAtomicPath, YangNode> resolveNodeInPath) { |
| 464 | this.resolveNodeInPath = resolveNodeInPath; |
| 465 | } |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 466 | } |