X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fstore%2Fimpl%2FOperationWithModification.java;h=780291e70f3b1399be48648a8d2a451a8608a134;hp=eaf01aeecda8d60e0cb7913678b1747665876ce1;hb=8022ea0892ef0499580685b12bc130f29ae8bbbc;hpb=bcd020ecbeeacc97df1717a238d93bacd87bcbfc diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/OperationWithModification.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/OperationWithModification.java index eaf01aeecd..780291e70f 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/OperationWithModification.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/OperationWithModification.java @@ -1,7 +1,15 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.dom.store.impl; import org.opendaylight.controller.md.sal.dom.store.impl.tree.NodeModification; import org.opendaylight.controller.md.sal.dom.store.impl.tree.StoreMetadataNode; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import com.google.common.base.Optional; @@ -10,6 +18,7 @@ import com.google.common.primitives.UnsignedLong; public class OperationWithModification { private final NodeModification modification; + private final ModificationApplyOperation applyOperation; private OperationWithModification(final ModificationApplyOperation op, final NodeModification mod) { @@ -28,8 +37,12 @@ public class OperationWithModification { return this; } - public boolean isApplicable(final Optional data) { - return applyOperation.isApplicable(modification, data); + public NodeModification getModification() { + return modification; + } + + public ModificationApplyOperation getApplyOperation() { + return applyOperation; } public Optional apply(final Optional data, final UnsignedLong subtreeVersion) { @@ -41,4 +54,16 @@ public class OperationWithModification { return new OperationWithModification(operation, modification); } -} \ No newline at end of file + + public void merge(final NormalizedNode data) { + modification.merge(data); + applyOperation.verifyStructure(modification); + + } + + public OperationWithModification forChild(final PathArgument childId) { + NodeModification childMod = modification.modifyChild(childId); + Optional childOp = applyOperation.getChild(childId); + return from(childOp.get(),childMod); + } +}