Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 0f7908b | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Vinod Kumar S | 5a39e01 | 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 org.onosproject.yangutils.datamodel.exceptions.DataModelException; |
Gaurav Agrawal | ab7c4bd | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 19 | import org.onosproject.yangutils.linker.exceptions.LinkerException; |
| 20 | import org.onosproject.yangutils.linker.impl.Resolvable; |
| 21 | import org.onosproject.yangutils.linker.impl.ResolvableStatus; |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 22 | import org.onosproject.yangutils.parser.Parsable; |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 23 | import org.onosproject.yangutils.utils.YangConstructType; |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 24 | |
janani b | 06eca9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 25 | import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil; |
Vinod Kumar S | 9aacac5 | 2016-04-20 13:02:58 +0530 | [diff] [blame] | 26 | import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getParentNodeInGenCode; |
| 27 | |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 28 | /*- |
| 29 | * Reference RFC 6020. |
| 30 | * |
| 31 | * The "uses" statement is used to reference a "grouping" definition. It takes |
| 32 | * one argument, which is the name of the grouping. |
| 33 | * |
| 34 | * The effect of a "uses" reference to a grouping is that the nodes defined by |
| 35 | * the grouping are copied into the current schema tree, and then updated |
| 36 | * according to the "refine" and "augment" statements. |
| 37 | * |
| 38 | * The identifiers defined in the grouping are not bound to a namespace until |
| 39 | * the contents of the grouping are added to the schema tree via a "uses" |
| 40 | * statement that does not appear inside a "grouping" statement, at which point |
| 41 | * they are bound to the namespace of the current module. |
| 42 | * |
| 43 | * The uses's sub-statements |
| 44 | * |
| 45 | * +--------------+---------+-------------+------------------+ |
| 46 | * | substatement | section | cardinality |data model mapping| |
| 47 | * +--------------+---------+-------------+------------------+ |
| 48 | * | augment | 7.15 | 0..1 | -child nodes | |
| 49 | * | description | 7.19.3 | 0..1 | -string | |
| 50 | * | if-feature | 7.18.2 | 0..n | -TODO | |
| 51 | * | refine | 7.12.2 | 0..1 | -TODO | |
| 52 | * | reference | 7.19.4 | 0..1 | -string | |
| 53 | * | status | 7.19.2 | 0..1 | -YangStatus | |
| 54 | * | when | 7.19.5 | 0..1 | -TODO | |
| 55 | * +--------------+---------+-------------+------------------+ |
| 56 | */ |
Vinod Kumar S | f677daf | 2016-04-15 18:08:57 +0530 | [diff] [blame] | 57 | |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 58 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 59 | * Represents data model node to maintain information defined in YANG uses. |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 60 | */ |
Vinod Kumar S | f677daf | 2016-04-15 18:08:57 +0530 | [diff] [blame] | 61 | public class YangUses |
| 62 | extends YangNode |
janani b | 06eca9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 63 | implements YangCommonInfo, Parsable, Resolvable, CollisionDetector { |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 64 | |
| 65 | /** |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 66 | * YANG node identifier. |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 67 | */ |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 68 | private YangNodeIdentifier nodeIdentifier; |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 69 | |
| 70 | /** |
Gaurav Agrawal | f6ccc97 | 2016-03-25 11:25:36 +0530 | [diff] [blame] | 71 | * Referred group. |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 72 | */ |
| 73 | private YangGrouping refGroup; |
| 74 | |
| 75 | /** |
Gaurav Agrawal | f6ccc97 | 2016-03-25 11:25:36 +0530 | [diff] [blame] | 76 | * Description of YANG uses. |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 77 | */ |
| 78 | private String description; |
| 79 | |
| 80 | /** |
| 81 | * YANG reference. |
| 82 | */ |
| 83 | private String reference; |
| 84 | |
| 85 | /** |
Gaurav Agrawal | f6ccc97 | 2016-03-25 11:25:36 +0530 | [diff] [blame] | 86 | * Status of YANG uses. |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 87 | */ |
| 88 | private YangStatusType status; |
| 89 | |
| 90 | /** |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 91 | * Status of resolution. If completely resolved enum value is "RESOLVED", |
| 92 | * if not enum value is "UNRESOLVED", in case reference of grouping/typedef |
| 93 | * is added to uses/type but it's not resolved value of enum should be |
Vinod Kumar S | f677daf | 2016-04-15 18:08:57 +0530 | [diff] [blame] | 94 | * "INTRA_FILE_RESOLVED". |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 95 | */ |
| 96 | private ResolvableStatus resolvableStatus; |
| 97 | |
| 98 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 99 | * Creates an YANG uses node. |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 100 | */ |
| 101 | public YangUses() { |
| 102 | super(YangNodeType.USES_NODE); |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 103 | nodeIdentifier = new YangNodeIdentifier(); |
| 104 | resolvableStatus = ResolvableStatus.UNRESOLVED; |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 105 | } |
| 106 | |
| 107 | /** |
Gaurav Agrawal | f6ccc97 | 2016-03-25 11:25:36 +0530 | [diff] [blame] | 108 | * Returns the referred group. |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 109 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 110 | * @return the referred group |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 111 | */ |
| 112 | public YangGrouping getRefGroup() { |
| 113 | return refGroup; |
| 114 | } |
| 115 | |
| 116 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 117 | * Sets the referred group. |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 118 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 119 | * @param refGroup the referred group |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 120 | */ |
| 121 | public void setRefGroup(YangGrouping refGroup) { |
| 122 | this.refGroup = refGroup; |
| 123 | } |
| 124 | |
| 125 | /** |
Gaurav Agrawal | f6ccc97 | 2016-03-25 11:25:36 +0530 | [diff] [blame] | 126 | * Returns the description. |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 127 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 128 | * @return the description |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 129 | */ |
Bharat saraswal | 5e3c45c | 2016-02-22 22:15:21 +0530 | [diff] [blame] | 130 | @Override |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 131 | public String getDescription() { |
| 132 | return description; |
| 133 | } |
| 134 | |
| 135 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 136 | * Sets the description. |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 137 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 138 | * @param description set the description |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 139 | */ |
Bharat saraswal | 5e3c45c | 2016-02-22 22:15:21 +0530 | [diff] [blame] | 140 | @Override |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 141 | public void setDescription(String description) { |
| 142 | this.description = description; |
| 143 | } |
| 144 | |
| 145 | /** |
Gaurav Agrawal | f6ccc97 | 2016-03-25 11:25:36 +0530 | [diff] [blame] | 146 | * Returns the textual reference. |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 147 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 148 | * @return the reference |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 149 | */ |
Bharat saraswal | 5e3c45c | 2016-02-22 22:15:21 +0530 | [diff] [blame] | 150 | @Override |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 151 | public String getReference() { |
| 152 | return reference; |
| 153 | } |
| 154 | |
| 155 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 156 | * Sets the textual reference. |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 157 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 158 | * @param reference the reference to set |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 159 | */ |
Bharat saraswal | 5e3c45c | 2016-02-22 22:15:21 +0530 | [diff] [blame] | 160 | @Override |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 161 | public void setReference(String reference) { |
| 162 | this.reference = reference; |
| 163 | } |
| 164 | |
| 165 | /** |
Gaurav Agrawal | f6ccc97 | 2016-03-25 11:25:36 +0530 | [diff] [blame] | 166 | * Returns the status. |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 167 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 168 | * @return the status |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 169 | */ |
Bharat saraswal | 5e3c45c | 2016-02-22 22:15:21 +0530 | [diff] [blame] | 170 | @Override |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 171 | public YangStatusType getStatus() { |
| 172 | return status; |
| 173 | } |
| 174 | |
| 175 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 176 | * Sets the status. |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 177 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 178 | * @param status the status to set |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 179 | */ |
Bharat saraswal | 5e3c45c | 2016-02-22 22:15:21 +0530 | [diff] [blame] | 180 | @Override |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 181 | public void setStatus(YangStatusType status) { |
| 182 | this.status = status; |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * Returns the type of the data. |
| 187 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 188 | * @return returns USES_DATA |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 189 | */ |
Bharat saraswal | 5e3c45c | 2016-02-22 22:15:21 +0530 | [diff] [blame] | 190 | @Override |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 191 | public YangConstructType getYangConstructType() { |
| 192 | return YangConstructType.USES_DATA; |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 196 | * Validates the data on entering the corresponding parse tree node. |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 197 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 198 | * @throws DataModelException a violation of data model rules |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 199 | */ |
Bharat saraswal | 5e3c45c | 2016-02-22 22:15:21 +0530 | [diff] [blame] | 200 | @Override |
Vinod Kumar S | f677daf | 2016-04-15 18:08:57 +0530 | [diff] [blame] | 201 | public void validateDataOnEntry() |
| 202 | throws DataModelException { |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 203 | // TODO auto-generated method stub, to be implemented by parser |
| 204 | } |
| 205 | |
| 206 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 207 | * Validates the data on exiting the corresponding parse tree node. |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 208 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 209 | * @throws DataModelException a violation of data model rules |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 210 | */ |
Bharat saraswal | 5e3c45c | 2016-02-22 22:15:21 +0530 | [diff] [blame] | 211 | @Override |
Vinod Kumar S | f677daf | 2016-04-15 18:08:57 +0530 | [diff] [blame] | 212 | public void validateDataOnExit() |
| 213 | throws DataModelException { |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 214 | // TODO auto-generated method stub, to be implemented by parser |
| 215 | } |
| 216 | |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 217 | @Override |
| 218 | public String getName() { |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 219 | return nodeIdentifier.getName(); |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 220 | } |
| 221 | |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 222 | @Override |
| 223 | public void setName(String name) { |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 224 | nodeIdentifier.setName(name); |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 225 | } |
| 226 | |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 227 | /** |
| 228 | * Returns node identifier. |
| 229 | * |
| 230 | * @return node identifier |
| 231 | */ |
| 232 | public YangNodeIdentifier getNodeIdentifier() { |
| 233 | return nodeIdentifier; |
| 234 | } |
| 235 | |
| 236 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 237 | * Sets node identifier. |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 238 | * |
| 239 | * @param nodeIdentifier the node identifier |
| 240 | */ |
| 241 | public void setNodeIdentifier(YangNodeIdentifier nodeIdentifier) { |
| 242 | this.nodeIdentifier = nodeIdentifier; |
| 243 | } |
| 244 | |
| 245 | /** |
| 246 | * Returns prefix associated with uses. |
| 247 | * |
| 248 | * @return prefix associated with uses |
| 249 | */ |
| 250 | public String getPrefix() { |
| 251 | return nodeIdentifier.getPrefix(); |
| 252 | } |
| 253 | |
| 254 | /** |
| 255 | * Get prefix associated with uses. |
| 256 | * |
| 257 | * @param prefix prefix associated with uses |
| 258 | */ |
| 259 | public void setPrefix(String prefix) { |
| 260 | nodeIdentifier.setPrefix(prefix); |
| 261 | } |
| 262 | |
| 263 | @Override |
Vinod Kumar S | 9aacac5 | 2016-04-20 13:02:58 +0530 | [diff] [blame] | 264 | public void resolve() |
Gaurav Agrawal | ab7c4bd | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 265 | throws LinkerException { |
Vinod Kumar S | 9aacac5 | 2016-04-20 13:02:58 +0530 | [diff] [blame] | 266 | |
| 267 | YangGrouping referredGrouping = getRefGroup(); |
| 268 | |
| 269 | if (referredGrouping == null) { |
Gaurav Agrawal | ab7c4bd | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 270 | throw new LinkerException("Linker Exception: YANG uses linker error, cannot resolve uses"); |
Vinod Kumar S | 9aacac5 | 2016-04-20 13:02:58 +0530 | [diff] [blame] | 271 | } |
| 272 | |
| 273 | YangNode usesParentNode = getParentNodeInGenCode(this); |
janani b | 06eca9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 274 | if ((!(usesParentNode instanceof YangLeavesHolder)) |
| 275 | || (!(usesParentNode instanceof CollisionDetector))) { |
Gaurav Agrawal | ab7c4bd | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 276 | throw new LinkerException("Linker Exception: YANG uses holder construct is wrong"); |
Vinod Kumar S | 9aacac5 | 2016-04-20 13:02:58 +0530 | [diff] [blame] | 277 | } |
| 278 | |
| 279 | YangLeavesHolder usesParentLeavesHolder = (YangLeavesHolder) usesParentNode; |
| 280 | if (referredGrouping.getListOfLeaf() != null) { |
| 281 | for (YangLeaf leaf : referredGrouping.getListOfLeaf()) { |
Gaurav Agrawal | ab7c4bd | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 282 | try { |
| 283 | ((CollisionDetector) usesParentLeavesHolder).detectCollidingChild(leaf.getName(), |
| 284 | YangConstructType.LEAF_DATA); |
| 285 | } catch (DataModelException e) { |
| 286 | throw new LinkerException(e.getMessage()); |
| 287 | } |
Vinod Kumar S | 9aacac5 | 2016-04-20 13:02:58 +0530 | [diff] [blame] | 288 | usesParentLeavesHolder.addLeaf(leaf); |
| 289 | } |
| 290 | } |
| 291 | if (referredGrouping.getListOfLeafList() != null) { |
| 292 | for (YangLeafList leafList : referredGrouping.getListOfLeafList()) { |
Gaurav Agrawal | ab7c4bd | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 293 | try { |
| 294 | ((CollisionDetector) usesParentLeavesHolder).detectCollidingChild(leafList.getName(), |
| 295 | YangConstructType.LEAF_LIST_DATA); |
| 296 | } catch (DataModelException e) { |
| 297 | throw new LinkerException(e.getMessage()); |
| 298 | } |
Vinod Kumar S | 9aacac5 | 2016-04-20 13:02:58 +0530 | [diff] [blame] | 299 | usesParentLeavesHolder.addLeafList(leafList); |
| 300 | } |
| 301 | } |
| 302 | |
Gaurav Agrawal | ab7c4bd | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 303 | try { |
| 304 | YangNode.cloneSubTree(getRefGroup(), usesParentNode); |
| 305 | } catch (DataModelException e) { |
| 306 | throw new LinkerException(e.getMessage()); |
| 307 | } |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 308 | } |
| 309 | |
| 310 | @Override |
| 311 | public ResolvableStatus getResolvableStatus() { |
| 312 | return resolvableStatus; |
| 313 | } |
| 314 | |
| 315 | @Override |
| 316 | public void setResolvableStatus(ResolvableStatus resolvableStatus) { |
| 317 | this.resolvableStatus = resolvableStatus; |
| 318 | } |
janani b | 06eca9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 319 | |
| 320 | @Override |
| 321 | public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException { |
| 322 | detectCollidingChildUtil(identifierName, dataType, this); |
| 323 | } |
| 324 | |
| 325 | @Override |
| 326 | public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException { |
| 327 | |
| 328 | if (getName().equals(identifierName)) { |
| 329 | throw new DataModelException("YANG file error: Duplicate input identifier detected, same as uses \"" |
| 330 | + getName() + "\""); |
| 331 | } |
| 332 | } |
| 333 | |
Vinod Kumar S | 5a39e01 | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 334 | } |