Bug 5553 - Impl get operations
[netconf.git] / restconf / sal-rest-connector / src / main / java / org / opendaylight / restconf / rest / services / impl / LeafSchemaNodeImpl.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.restconf.rest.services.impl;
9
10 import java.util.List;
11 import org.opendaylight.yangtools.yang.common.QName;
12 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
13 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
14 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
15 import org.opendaylight.yangtools.yang.model.api.Status;
16 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
17 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
18 import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
19
20 /**
21  * Special case only use by GET restconf/operations (since moment of old Yang
22  * parser and old yang model API removal) to build and use fake leaf like child
23  * in container
24  *
25  */
26 class LeafSchemaNodeImpl implements LeafSchemaNode {
27
28     private final SchemaPath path;
29     private final QName qname;
30
31     /**
32      * Base values for fake leaf schema node
33      *
34      * @param basePath
35      *            - schema path
36      * @param qname
37      *            - qname
38      */
39     LeafSchemaNodeImpl(final SchemaPath basePath, final QName qname) {
40         this.path = basePath.createChild(qname);
41         this.qname = qname;
42     }
43
44     @Override
45     public boolean isAugmenting() {
46         return true;
47     }
48
49     @Override
50     public boolean isAddedByUses() {
51         return false;
52     }
53
54     @Override
55     public boolean isConfiguration() {
56         return false;
57     }
58
59     @Override
60     public ConstraintDefinition getConstraints() {
61         throw new UnsupportedOperationException("Not supported.");
62     }
63
64     @Override
65     public QName getQName() {
66         return this.qname;
67     }
68
69     @Override
70     public SchemaPath getPath() {
71         return this.path;
72     }
73
74     @Override
75     public List<UnknownSchemaNode> getUnknownSchemaNodes() {
76         throw new UnsupportedOperationException("Not supported.");
77     }
78
79     @Override
80     public String getDescription() {
81         throw new UnsupportedOperationException("Not supported operations.");
82     }
83
84     @Override
85     public String getReference() {
86         throw new UnsupportedOperationException("Not supported.");
87     }
88
89     @Override
90     public Status getStatus() {
91         throw new UnsupportedOperationException("Not supported.");
92     }
93
94     @Override
95     public TypeDefinition<?> getType() {
96         return BaseTypes.emptyType();
97     }
98
99     @Override
100     public String getDefault() {
101         throw new UnsupportedOperationException("Not supported.");
102     }
103
104     @Override
105     public String getUnits() {
106         throw new UnsupportedOperationException("Not supported.");
107     }
108
109 }