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;
25 import java.util.List;
27 import lombok.AccessLevel;
32 @Setter(AccessLevel.PACKAGE)
33 public class CpsPathQuery {
35 private String xpathPrefix;
36 private String normalizedParentPath;
37 private String normalizedXpath;
38 private List<String> containerNames;
39 private CpsPathPrefixType cpsPathPrefixType = ABSOLUTE;
40 private String descendantName;
41 private Map<String, Object> leavesData;
42 private String ancestorSchemaNodeIdentifier = "";
43 private String textFunctionConditionLeafName;
44 private String textFunctionConditionValue;
47 * Returns a cps path query.
49 * @param cpsPathSource cps path
50 * @return a CpsPathQuery object.
52 public static CpsPathQuery createFrom(final String cpsPathSource) {
53 return CpsPathUtil.getCpsPathQuery(cpsPathSource);
57 * Has ancestor axis been included in cpsPath.
59 * @return boolean value.
61 public boolean hasAncestorAxis() {
62 return !(ancestorSchemaNodeIdentifier.isEmpty());
66 * Have leaf value conditions been included in cpsPath.
68 * @return boolean value.
70 public boolean hasLeafConditions() {
71 return leavesData != null;
75 * Has text function condition been included in cpsPath.
77 * @return boolean value.
79 public boolean hasTextFunctionCondition() {
80 return textFunctionConditionLeafName != null;