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