Adjust to yangtools-2.0.0 changes
[mdsal.git] / binding2 / mdsal-binding2-generator-impl / src / main / twirl / org / opendaylight / mdsal / binding / javav2 / generator / impl / yangTemplateWriteAction.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
16 @import org.opendaylight.yangtools.yang.model.api.ActionDefinition
17 @import org.opendaylight.yangtools.yang.model.api.Module
18 @import org.opendaylight.yangtools.yang.model.api.Status
19
20 @(action: ActionDefinition, module: Module)
21 action @{action.getQName().getLocalName()} {
22     @if(action.getDescription().isPresent()) {
23         "@{action.getDescription().get()}";
24     }
25     @if(action.getGroupings() != null && !action.getGroupings().isEmpty()) {
26         @yangTemplateWriteGroupingDefs(action.getGroupings(), module)
27     }
28     @if(action.getInput() != null && action.getInput().getChildNodes != null && !action.getInput().getChildNodes().isEmpty()) {
29         input {
30             @yangTemplateWriteDataSchemaNodes(action.getInput().getChildNodes, module)
31         }
32     }
33     @if(action.getOutput() != null && action.getOutput().getChildNodes != null && !action.getOutput().getChildNodes().isEmpty()) {
34         output {
35             @yangTemplateWriteDataSchemaNodes(action.getOutput().getChildNodes, module)
36         }
37     }
38     @if(action.getReference().isPresent()) {
39         reference "@{action.getReference().get()}";
40     }
41     @if(action.getStatus() != Status.CURRENT) {
42         status @{action.getStatus()};
43     }
44 }