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