aboutsummaryrefslogtreecommitdiffstats
path: root/models-pdp/src/main/java/org
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@est.tech>2020-01-23 13:35:07 +0000
committera.sreekumar <ajith.sreekumar@est.tech>2020-01-23 13:35:12 +0000
commit820b0e8e62e3821875ed32c4ab0f0b3183050c8f (patch)
tree2e59b229b4adc6e3cdcc4ea4cd0f8d2d598ac601 /models-pdp/src/main/java/org
parent2a7cbf33a8b53bb83d43bf1adca7e6a8658cb262 (diff)
Handling supported policy type during PdpGroup Update
Change-Id: I62fbfeb80b81f4cc6dc0049bbd4ab9dcc5065773 Issue-ID: POLICY-2023 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
Diffstat (limited to 'models-pdp/src/main/java/org')
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroups.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroups.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroups.java
index 269130b07..6729d7e88 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroups.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroups.java
@@ -85,9 +85,14 @@ public class PdpGroups {
* @return the validation result
*/
public ValidationResult checkForDuplicateGroups(ValidationResult result) {
- List<String> names = groups.stream().map(PdpGroup::getName).collect(Collectors.toList());
- if (groups.size() != new HashSet<>(names).size()) {
- result = new ObjectValidationResult(GROUPS_FIELD, names, ValidationStatus.INVALID, "duplicate group names");
+ if (null == groups) {
+ result.setResult(ValidationStatus.INVALID, "is null");
+ } else {
+ List<String> names = groups.stream().map(PdpGroup::getName).collect(Collectors.toList());
+ if (groups.size() != new HashSet<>(names).size()) {
+ result =
+ new ObjectValidationResult(GROUPS_FIELD, names, ValidationStatus.INVALID, "duplicate group names");
+ }
}
return result;
}
font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
============LICENSE_START=======================================================
org.onap.aai
================================================================================
Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
============LICENSE_END=========================================================