2 * Copyright (c) 2014 Cisco 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.controller.cluster.datastore.modification;
11 import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
12 import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages;
13 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
17 * DeleteModification store all the parameters required to delete a path from the data tree
19 public class DeleteModification extends AbstractModification {
20 public DeleteModification(YangInstanceIdentifier path) {
25 public void apply(DOMStoreWriteTransaction transaction) {
26 transaction.delete(path);
29 @Override public Object toSerializable() {
30 return PersistentMessages.Modification.newBuilder()
31 .setType(this.getClass().toString())
32 .setPath(InstanceIdentifierUtils.toSerializable(this.path))
36 public static DeleteModification fromSerializable(Object serializable){
37 PersistentMessages.Modification o = (PersistentMessages.Modification) serializable;
38 return new DeleteModification(InstanceIdentifierUtils.fromSerializable(o.getPath()));