2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright © 2018 IBM
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.ccsdk.sli.plugins.yangserializers.pnserializer;
25 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
28 * Representation of leaf list holder node which will hold multi instance leaf
29 * node in properties data tree.
31 public class LeafListHolderNode extends HolderNode<LeafListHolderChild> implements DataNodeChild {
33 private static final String node = " holder node";
36 * Creates an instance of LeafListHolderNode.
38 * @param name name of the leaf-list node
39 * @param namespace namespace of the leaf-list node
40 * @param uri uri of the leaf-list node
41 * @param parent parent node of the leaf-list
42 * @param appInfo application info
43 * @param nodeType node type
45 public LeafListHolderNode(String name, Namespace namespace,
46 String uri, PropertiesNode parent,
47 Object appInfo, NodeType nodeType) {
48 super(name, namespace, uri, parent, appInfo, nodeType);
52 public PropertiesNode addChild(String name, Namespace namespace,
53 NodeType type, String value,
55 Object appInfo) throws SvcLogicException {
56 throw new SvcLogicException("Leaf cannot be child of leaf-list" +
61 public PropertiesNode addChild(String name, Namespace namespace,
63 Object appInfo) throws SvcLogicException {
64 throw new SvcLogicException("Container cannot be child of leaf-list" +
69 public PropertiesNode addChild(String index, String name,
72 Object appInfo) throws SvcLogicException {
73 throw new SvcLogicException("List cannot be child of leaf-list" +
78 public PropertiesNode addChild(String index, String name,
79 Namespace namespace, NodeType type,
80 String value, Namespace valueNs,
81 Object appInfo) throws SvcLogicException {
82 LeafNode node = ((LeafNode) children().get(index));
84 index = String.valueOf(children().size());
86 String uri = this.uri() + "[" + index + "]";
87 node = (node != null) ? node : new LeafNode(name, namespace, uri,
88 this, appInfo, type, value);
89 node.valueNs(valueNs);
90 children().put(index, node);