Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +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 | 17711e5 | 2016-02-09 20:02:43 +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; |
| 19 | import org.onosproject.yangutils.parser.Parsable; |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 20 | import org.onosproject.yangutils.utils.YangConstructType; |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 21 | |
| 22 | /* |
| 23 | * Reference:RFC 6020. |
| 24 | * The "revision" statement specifies the editorial revision history of |
| 25 | * the module, including the initial revision. A series of revision |
| 26 | * statements detail the changes in the module's definition. The |
| 27 | * argument is a date string in the format "YYYY-MM-DD", followed by a |
| 28 | * block of sub-statements that holds detailed revision information. A |
| 29 | * module SHOULD have at least one initial "revision" statement. For |
| 30 | * every published editorial change, a new one SHOULD be added in front |
| 31 | * of the revisions sequence, so that all revisions are in reverse |
| 32 | * chronological order. |
| 33 | * The revision's sub-statement |
| 34 | * |
| 35 | * +--------------+---------+-------------+------------------+ |
| 36 | * | substatement | section | cardinality |data model mapping| |
| 37 | * +--------------+---------+-------------+------------------+ |
| 38 | * | description | 7.19.3 | 0..1 |string | |
| 39 | * | reference | 7.19.4 | 0..1 |sring | |
| 40 | * +--------------+---------+-------------+------------------+ |
| 41 | */ |
| 42 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 43 | * Represents the information about the revision. |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 44 | */ |
| 45 | public class YangRevision implements YangDesc, YangReference, Parsable { |
| 46 | |
| 47 | /** |
| 48 | * Revision date. Date string in the format "YYYY-MM-DD" |
| 49 | */ |
| 50 | private String revDate; |
| 51 | |
| 52 | /** |
| 53 | * Description of revision. |
| 54 | */ |
| 55 | private String description; |
| 56 | |
| 57 | /** |
| 58 | * Textual reference for revision. |
| 59 | */ |
| 60 | private String reference; |
| 61 | |
| 62 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 63 | * Creates a YANG revision object. |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 64 | */ |
| 65 | public YangRevision() { |
| 66 | } |
| 67 | |
| 68 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 69 | * Returns the revision date. |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 70 | * |
| 71 | * @return the revision date |
| 72 | */ |
| 73 | public String getRevDate() { |
| 74 | return revDate; |
| 75 | } |
| 76 | |
| 77 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 78 | * Sets the revision date. |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 79 | * |
| 80 | * @param revDate the revision date to set |
| 81 | */ |
| 82 | public void setRevDate(String revDate) { |
| 83 | this.revDate = revDate; |
| 84 | } |
| 85 | |
| 86 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 87 | * Returns the description. |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 88 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 89 | * @return the description |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 90 | */ |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 91 | @Override |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 92 | public String getDescription() { |
| 93 | return description; |
| 94 | } |
| 95 | |
| 96 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 97 | * Sets the description. |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 98 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 99 | * @param description set the description |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 100 | */ |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 101 | @Override |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 102 | public void setDescription(String description) { |
| 103 | this.description = description; |
| 104 | } |
| 105 | |
| 106 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 107 | * Returns the textual reference. |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 108 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 109 | * @return the reference |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 110 | */ |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 111 | @Override |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 112 | public String getReference() { |
| 113 | return reference; |
| 114 | } |
| 115 | |
| 116 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 117 | * Sets the textual reference. |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 118 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 119 | * @param reference the reference to set |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 120 | */ |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 121 | @Override |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 122 | public void setReference(String reference) { |
| 123 | this.reference = reference; |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Returns the type of the parsed data. |
| 128 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 129 | * @return returns REVISION_DATA |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 130 | */ |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 131 | @Override |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 132 | public YangConstructType getYangConstructType() { |
| 133 | return YangConstructType.REVISION_DATA; |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 137 | * Validates the data on entering the corresponding parse tree node. |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 138 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 139 | * @throws DataModelException a violation of data model rules |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 140 | */ |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 141 | @Override |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 142 | public void validateDataOnEntry() throws DataModelException { |
| 143 | // TODO auto-generated method stub, to be implemented by parser |
| 144 | |
| 145 | } |
| 146 | |
| 147 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 148 | * Validates the data on exiting the corresponding parse tree node. |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 149 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 150 | * @throws DataModelException a violation of data model rules |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 151 | */ |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 152 | @Override |
Vinod Kumar S | 17711e5 | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 153 | public void validateDataOnExit() throws DataModelException { |
| 154 | // TODO auto-generated method stub, to be implemented by parser |
| 155 | |
| 156 | } |
| 157 | } |