Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Open Networking Laboratory |
| 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; |
| 20 | import org.onosproject.yangutils.parser.ParsableDataType; |
| 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 | /** |
| 43 | * Maintains the information about the revision. |
| 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 | /** |
| 63 | * Default constructor. |
| 64 | */ |
| 65 | public YangRevision() { |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Get the revision date. |
| 70 | * |
| 71 | * @return the revision date |
| 72 | */ |
| 73 | public String getRevDate() { |
| 74 | return revDate; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Set the revision date. |
| 79 | * |
| 80 | * @param revDate the revision date to set |
| 81 | */ |
| 82 | public void setRevDate(String revDate) { |
| 83 | this.revDate = revDate; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Get the description. |
| 88 | * |
| 89 | * @return the description. |
| 90 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 91 | @Override |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 92 | public String getDescription() { |
| 93 | return description; |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Set the description. |
| 98 | * |
| 99 | * @param description set the description. |
| 100 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 101 | @Override |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 102 | public void setDescription(String description) { |
| 103 | this.description = description; |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * Get the textual reference. |
| 108 | * |
| 109 | * @return the reference. |
| 110 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 111 | @Override |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 112 | public String getReference() { |
| 113 | return reference; |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * Set the textual reference. |
| 118 | * |
| 119 | * @param reference the reference to set. |
| 120 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 121 | @Override |
Vinod Kumar S | ae41bea | 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 | * |
| 129 | * @return returns REVISION_DATA. |
| 130 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 131 | @Override |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 132 | public ParsableDataType getParsableDataType() { |
| 133 | return ParsableDataType.REVISION_DATA; |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * Validate the data on entering the corresponding parse tree node. |
| 138 | * |
| 139 | * @throws DataModelException a violation of data model rules. |
| 140 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 141 | @Override |
Vinod Kumar S | ae41bea | 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 | /** |
| 148 | * Validate the data on exiting the corresponding parse tree node. |
| 149 | * |
| 150 | * @throws DataModelException a violation of data model rules. |
| 151 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 152 | @Override |
Vinod Kumar S | ae41bea | 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 | } |