Merge "Fix for messags at the boot up time This commit proposes following two sets...
[controller.git] / opendaylight / sal / yang-prototype / yang / yang-model-util / src / main / java / org / opendaylight / controller / model / util / Identityref.java
1 /*\r
2   * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
3   *\r
4   * This program and the accompanying materials are made available under the\r
5   * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6   * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7   */\r
8 package org.opendaylight.controller.model.util;\r
9 \r
10 import java.util.Collections;\r
11 import java.util.List;\r
12 \r
13 import org.opendaylight.controller.model.api.type.IdentityTypeDefinition;\r
14 import org.opendaylight.controller.model.api.type.IdentityrefTypeDefinition;\r
15 import org.opendaylight.controller.yang.common.QName;\r
16 import org.opendaylight.controller.yang.model.api.RevisionAwareXPath;\r
17 import org.opendaylight.controller.yang.model.api.SchemaPath;\r
18 import org.opendaylight.controller.yang.model.api.Status;\r
19 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;\r
20 \r
21 /**\r
22  * The <code>default</code> implementation of Identityref Type Definition interface.\r
23  *\r
24  * @see IdentityrefTypeDefinition\r
25  */\r
26 public class Identityref implements IdentityrefTypeDefinition {\r
27 \r
28     private final QName name = BaseTypes.constructQName("identityref");\r
29     private final SchemaPath path = BaseTypes.schemaPath(name);\r
30     private final String description = "The identityref type is used to reference an existing identity.";\r
31     private final String reference = "https://tools.ietf.org/html/rfc6020#section-9.10";\r
32 \r
33     private final IdentityTypeDefinition identity;\r
34     private final RevisionAwareXPath xpath;\r
35 \r
36     private String units = "";\r
37 \r
38     public Identityref(RevisionAwareXPath xpath, IdentityTypeDefinition identity) {\r
39         super();\r
40         this.identity = identity;\r
41         this.xpath = xpath;\r
42     }\r
43     \r
44     public Identityref(RevisionAwareXPath xpath) {\r
45         super();\r
46         this.xpath = xpath;\r
47         this.identity = null;\r
48     }\r
49 \r
50     /*\r
51      * (non-Javadoc)\r
52      * \r
53      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()\r
54      */\r
55     @Override\r
56     public IdentityTypeDefinition getBaseType() {\r
57         return identity;\r
58     }\r
59 \r
60     /*\r
61      * (non-Javadoc)\r
62      * \r
63      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getUnits()\r
64      */\r
65     @Override\r
66     public String getUnits() {\r
67         return units;\r
68     }\r
69 \r
70     /*\r
71      * (non-Javadoc)\r
72      * \r
73      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()\r
74      */\r
75     @Override\r
76     public Object getDefaultValue() {\r
77         return identity;\r
78     }\r
79 \r
80     /*\r
81      * (non-Javadoc)\r
82      * \r
83      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getQName()\r
84      */\r
85     @Override\r
86     public QName getQName() {\r
87         return name;\r
88     }\r
89 \r
90     /*\r
91      * (non-Javadoc)\r
92      * \r
93      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getPath()\r
94      */\r
95     @Override\r
96     public SchemaPath getPath() {\r
97         return path;\r
98     }\r
99 \r
100     /*\r
101      * (non-Javadoc)\r
102      * \r
103      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getDescription()\r
104      */\r
105     @Override\r
106     public String getDescription() {\r
107         return description;\r
108     }\r
109 \r
110     /*\r
111      * (non-Javadoc)\r
112      * \r
113      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getReference()\r
114      */\r
115     @Override\r
116     public String getReference() {\r
117         return reference;\r
118     }\r
119 \r
120     /*\r
121      * (non-Javadoc)\r
122      * \r
123      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getStatus()\r
124      */\r
125     @Override\r
126     public Status getStatus() {\r
127         return Status.CURRENT;\r
128     }\r
129 \r
130     @Override\r
131     public List<UnknownSchemaNode> getUnknownSchemaNodes() {\r
132         return Collections.emptyList();\r
133     }\r
134 \r
135     /*\r
136      * (non-Javadoc)\r
137      * \r
138      * @see\r
139      * org.opendaylight.controller.yang.model.base.type.api.IdentityrefTypeDefinition#getIdentityName\r
140      * ()\r
141      */\r
142     @Override\r
143     public IdentityTypeDefinition getIdentity() {\r
144         return identity;\r
145     }\r
146     \r
147     @Override\r
148     public RevisionAwareXPath getPathStatement() {\r
149         return xpath;\r
150     }\r
151     \r
152     \r
153 }\r