2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2021-2022 Nordix Foundation
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.cps.cpspath.parser;
23 import static org.onap.cps.cpspath.parser.CpsPathPrefixType.ABSOLUTE;
26 import lombok.AccessLevel;
31 @Setter(AccessLevel.PACKAGE)
32 public class CpsPathQuery {
34 private String xpathPrefix;
35 private String normalizedParentPath;
36 private String normalizedXpath;
37 private CpsPathPrefixType cpsPathPrefixType = ABSOLUTE;
38 private String descendantName;
39 private Map<String, Object> leavesData;
40 private String ancestorSchemaNodeIdentifier = "";
41 private String textFunctionConditionLeafName;
42 private String textFunctionConditionValue;
45 * Returns a cps path query.
47 * @param cpsPathSource cps path
48 * @return a CpsPathQuery object.
50 public static CpsPathQuery createFrom(final String cpsPathSource) {
51 return CpsPathUtil.getCpsPathQuery(cpsPathSource);
55 * Has ancestor axis been included in cpsPath.
57 * @return boolean value.
59 public boolean hasAncestorAxis() {
60 return !(ancestorSchemaNodeIdentifier.isEmpty());
64 * Have leaf value conditions been included in cpsPath.
66 * @return boolean value.
68 public boolean hasLeafConditions() {
69 return leavesData != null;
73 * Has text function condition been included in cpsPath.
75 * @return boolean value.
77 public boolean hasTextFunctionCondition() {
78 return textFunctionConditionLeafName != null;