2 * Copyright (c) 2016 Ericsson Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.openflowplugin.applications.notification.supplier.impl.helper;
11 import java.util.Collection;
12 import javax.annotation.Nonnull;
13 import javax.annotation.Nullable;
14 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
15 import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
16 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
17 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
18 import org.opendaylight.yangtools.yang.binding.Augmentation;
19 import org.opendaylight.yangtools.yang.binding.ChildOf;
20 import org.opendaylight.yangtools.yang.binding.DataObject;
21 import org.opendaylight.yangtools.yang.binding.Identifiable;
22 import org.opendaylight.yangtools.yang.binding.Identifier;
23 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
26 * Created by eshuvka on 6/7/2016.
28 public class TestData<T extends DataObject> implements DataTreeModification<T> {
30 private final DataTreeIdentifier<T> path;
31 private final DataObjectModification<T> rootNode;
33 public TestData(final InstanceIdentifier<T> path, final T dataBefore, final T dataAfter,
34 DataObjectModification.ModificationType modType) {
35 this.path = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, path);
36 this.rootNode = new Test(dataBefore, dataAfter, modType);
41 public DataTreeIdentifier<T> getRootPath() {
47 public DataObjectModification<T> getRootNode() {
51 class Test<T extends DataObject> implements DataObjectModification<T> {
53 private final T dataObjBefore;
54 private final T dataObjAfter;
55 private final ModificationType modification;
57 Test(final T dataBefore, final T dataAfter, ModificationType modType) {
58 dataObjBefore = dataBefore;
59 dataObjAfter = dataAfter;
60 modification = modType;
64 public InstanceIdentifier.PathArgument getIdentifier() {
70 public Class<T> getDataType() {
76 public ModificationType getModificationType() {
82 public T getDataBefore() {
88 public T getDataAfter() {
94 public Collection<DataObjectModification<? extends DataObject>> getModifiedChildren() {
100 public <C extends ChildOf<? super T>> DataObjectModification<C> getModifiedChildContainer(
101 @Nonnull Class<C> theClass) {
107 public <C extends Augmentation<T> & DataObject> DataObjectModification<C> getModifiedAugmentation(
108 @Nonnull Class<C> theClass) {
113 public <C extends Identifiable<K> & ChildOf<? super T>, K extends Identifier<C>> DataObjectModification<C>
114 getModifiedChildListItem(@Nonnull Class<C> theClass, @Nonnull K listKey) {
120 public DataObjectModification<? extends DataObject> getModifiedChild(
121 InstanceIdentifier.PathArgument pathArgument) {