+ /**
+ * Validate CPS path condition properties.
+ * @param conditionProperty name of data to be validated
+ */
+ public static boolean validateCpsPathConditionProperties(final Map<String, String> conditionProperty) {
+ if (conditionProperty.isEmpty()) {
+ return true;
+ }
+ if (conditionProperty.size() > 1) {
+ throwDataValidationException("Only one condition property is allowed for the CPS path query.");
+ }
+ if (!conditionProperty.containsKey("cpsPath")) {
+ throwDataValidationException(
+ "Wrong CPS path condition property. - expecting \"cpsPath\" as the condition property.");
+ }
+ final String cpsPath = conditionProperty.get("cpsPath");
+ if (cpsPath.isBlank()) {
+ throwDataValidationException(
+ "Wrong CPS path. - please supply a valid CPS path.");
+ }
+ if (cpsPath.contains("/additional-properties")) {
+ log.debug("{} - Private metadata cannot be queried. Nothing to be returned",
+ cpsPath);
+ return false;
+ }
+ return true;
+ }
+