Fix yang module naming
[mdsal.git] / binding2 / mdsal-binding2-java-api-generator / src / main / twirl / org / opendaylight / mdsal / binding / javav2 / java / api / yang / yangTemplateWriteDeviation.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.Deviation
17 @import org.opendaylight.yangtools.yang.model.api.Status
18 @import org.opendaylight.yangtools.yang.model.api.stmt.DeviationEffectiveStatement
19
20 @(deviation: Deviation)
21 deviation @{deviation.asInstanceOf[DeviationEffectiveStatement].getDeclared().rawArgument()} {
22     @if(deviation.getReference().isPresent()) {
23         reference "@{deviation.getReference().get()}";
24     }
25     @if(deviation.getDescription().isPresent()) {
26         description "@{deviation.getDescription().get()}";
27     }
28     @for(deviate <- deviation.getDeviates()) {
29         @if(deviate != null && deviate.getDeviateType() != null ) {
30             @if(deviate.getDeviatedDefault() == null && !deviate.getDeviatedMandatory() && deviate.getDeviatedMaxElements()==null && deviate.getDeviatedMinElements() == null) {
31                 deviate @{deviate.getDeviateType().name()};
32             } else {
33                 deviate  @{deviate.getDeviateType().name().toLowerCase()} {
34                 @if(deviate.getDeviatedDefault() != null) {
35                     default "@{deviate.getDeviatedDefault()}";
36                 }
37                 @if(deviate.getDeviatedMandatory() != null && deviate.getDeviatedMandatory()) {
38                     mandatory true;
39                 }
40                 @if(deviate.getDeviatedMinElements() != null) {
41                     min-elements @{deviate.getDeviatedMinElements()};
42                 }
43                 @if(deviate.getDeviatedMaxElements() != null) {
44                     max-elements @{deviate.getDeviatedMaxElements()};
45                 }
46                 }
47             }
48         }
49     }
50 }