2 * Copyright (c) 2019 PANTHEON.tech, s.r.o. 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
8 package org.opendaylight.netconf.api;
10 import java.util.Arrays;
12 public enum ModifyAction {
13 MERGE(true), REPLACE(true), CREATE(false), DELETE(false), REMOVE(false), NONE(true, false);
15 public static ModifyAction fromXmlValue(final String xmlNameOfAction) {
16 switch (xmlNameOfAction) {
30 throw new IllegalArgumentException("Unknown operation " + xmlNameOfAction + " available operations "
31 + Arrays.toString(ModifyAction.values()));
35 private final boolean asDefaultPermitted;
36 private final boolean onElementPermitted;
38 ModifyAction(final boolean asDefaultPermitted, final boolean onElementPermitted) {
39 this.asDefaultPermitted = asDefaultPermitted;
40 this.onElementPermitted = onElementPermitted;
43 ModifyAction(final boolean asDefaultPermitted) {
44 this(asDefaultPermitted, true);
48 * Check if this operation is a candidate for {@code default-operation} argument.
50 * @return True if this operation can be used as {@code default-operation}.
52 public boolean isAsDefaultPermitted() {
53 return asDefaultPermitted;
56 public boolean isOnElementPermitted() {
57 return onElementPermitted;