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.util.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 private static final long serialVersionUID = 1L;
22 public DeleteModification(YangInstanceIdentifier path) {
27 public void apply(DOMStoreWriteTransaction transaction) {
28 transaction.delete(path);
32 public Object toSerializable() {
33 return PersistentMessages.Modification.newBuilder().setType(this.getClass().toString())
34 .setPath(InstanceIdentifierUtils.toSerializable(this.path)).build();
37 public static DeleteModification fromSerializable(Object serializable) {
38 PersistentMessages.Modification o = (PersistentMessages.Modification) serializable;
39 return new DeleteModification(InstanceIdentifierUtils.fromSerializable(o.getPath()));