Bug 1411-4: MDSAL Binding2 Generator Impl
[mdsal.git] / binding2 / mdsal-binding2-generator-impl / src / main / twirl / org / opendaylight / mdsal / binding2 / yangTemplateWriteUsesNodes.scala.txt
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
9 @**********************************************************
10 * Twirl YangTemplate for generating yang snippets.        *
11 * Twirl is transformed to Scala and compiled. Then,       *
12 * it can be called from Java with particular input        *
13 * parameters to render desired output code.               *
14 *                                                         *
15 * Note: we should introduce our own format instead of txt *
16 ***********************************************************@
17
18 @import org.opendaylight.yangtools.yang.model.api.DataSchemaNode
19 @import org.opendaylight.yangtools.yang.model.api.UsesNode
20
21 @(usesNodes: Set[_ <: UsesNode])
22 @if(usesNodes != null) {
23     @for(usesNode <- usesNodes) {
24         @if(usesNode != null) {
25             uses @{usesNode.getGroupingPath().getLastComponent().getLocalName()}
26             @if(usesNode.getRefines().isEmpty()) {
27                 ;
28             } else {
29                 {
30                 @for(path <- usesNode.getRefines().keySet()) {
31                     refine @{path.getLastComponent()} {
32                     @if(usesNode.getRefines().get(path).isInstanceOf[DataSchemaNode]) {
33                             @yangTemplateWriteDataSchemaNode(usesNode.getRefines().get(path).asInstanceOf[DataSchemaNode])
34                         }
35                     }
36                 }
37                 }
38             }
39         }
40     }
41 }