- static EditStrategyType parseStrategy(String currentStrategy, EditStrategyType defaultStrategy) {
- EditStrategyType parsedStrategy = EditStrategyType.valueOf(currentStrategy);
- if (defaultStrategy.isEnforcing()) {
- Preconditions
- .checkArgument(
- parsedStrategy == defaultStrategy,
- "With "
- + defaultStrategy
- + " as "
- + EditConfigXmlParser.DEFAULT_OPERATION_KEY
- + " operations on module elements are not permitted since the default option is restrictive");
+ static EditStrategyType parseStrategy(String currentStrategy, EditStrategyType defaultStrategy) throws OperationNotPermittedException {
+ if (null == currentStrategy || currentStrategy.equals("")){
+ throw new OperationNotPermittedException(String.format("With "
+ + defaultStrategy
+ + " as "
+ + EditConfigXmlParser.DEFAULT_OPERATION_KEY
+ + " operations on module elements are not permitted since the default option is restrictive"),
+ NetconfDocumentedException.ErrorType.application,
+ NetconfDocumentedException.ErrorTag.operation_failed,
+ NetconfDocumentedException.ErrorSeverity.error);