import static org.onap.cps.ncmp.api.impl.utils.CmHandleQueryConditions.HAS_ALL_MODULES;
import static org.onap.cps.ncmp.api.impl.utils.CmHandleQueryConditions.HAS_ALL_PROPERTIES;
import static org.onap.cps.ncmp.api.impl.utils.CmHandleQueryConditions.WITH_CPS_PATH;
+import static org.onap.cps.ncmp.api.impl.utils.CmHandleQueryConditions.WITH_TRUST_LEVEL;
import static org.onap.cps.ncmp.api.impl.utils.RestQueryParametersValidator.validateCpsPathConditionProperties;
import static org.onap.cps.ncmp.api.impl.utils.RestQueryParametersValidator.validateModuleNameConditionProperties;
import static org.onap.cps.ncmp.api.impl.utils.YangDataConverter.convertYangModelCmHandleToNcmpServiceCmHandle;
return executeQueries(cmHandleQueryServiceParameters,
this::executeCpsPathQuery,
this::queryCmHandlesByPublicProperties,
- this::executeModuleNameQuery);
+ this::executeModuleNameQuery,
+ this::queryCmHandlesByTrustLevel);
}
@Override
getPropertyPairs(cmHandleQueryServiceParameters.getCmHandleQueryParameters(),
InventoryQueryConditions.HAS_ALL_ADDITIONAL_PROPERTIES.getName());
- return privatePropertyQueryPairs.isEmpty()
- ? NO_QUERY_TO_EXECUTE
- : cmHandleQueries.queryCmHandleAdditionalProperties(privatePropertyQueryPairs);
+ if (privatePropertyQueryPairs.isEmpty()) {
+ return NO_QUERY_TO_EXECUTE;
+ }
+ return cmHandleQueries.queryCmHandleAdditionalProperties(privatePropertyQueryPairs);
}
private Collection<String> queryCmHandlesByPublicProperties(
getPropertyPairs(cmHandleQueryServiceParameters.getCmHandleQueryParameters(),
HAS_ALL_PROPERTIES.getConditionName());
- return publicPropertyQueryPairs.isEmpty()
- ? NO_QUERY_TO_EXECUTE
- : cmHandleQueries.queryCmHandlePublicProperties(publicPropertyQueryPairs);
+ if (publicPropertyQueryPairs.isEmpty()) {
+ return NO_QUERY_TO_EXECUTE;
+ }
+ return cmHandleQueries.queryCmHandlePublicProperties(publicPropertyQueryPairs);
+ }
+
+ private Collection<String> queryCmHandlesByTrustLevel(final CmHandleQueryServiceParameters
+ cmHandleQueryServiceParameters) {
+
+ final Map<String, String> trustLevelPropertyQueryPairs =
+ getPropertyPairs(cmHandleQueryServiceParameters.getCmHandleQueryParameters(),
+ WITH_TRUST_LEVEL.getConditionName());
+
+ if (trustLevelPropertyQueryPairs.isEmpty()) {
+ return NO_QUERY_TO_EXECUTE;
+ }
+ return cmHandleQueries.queryCmHandlesByTrustLevel(trustLevelPropertyQueryPairs);
}
private Collection<String> executeModuleNameQuery(
}
try {
cpsPathQueryResult = collectCmHandleIdsFromDataNodes(
- cmHandleQueries.queryCmHandleDataNodesByCpsPath(cpsPathCondition.get("cpsPath"), OMIT_DESCENDANTS));
+ cmHandleQueries.queryCmHandleAncestorsByCpsPath(
+ cpsPathCondition.get("cpsPath"), OMIT_DESCENDANTS));
} catch (final PathParsingException pathParsingException) {
throw new DataValidationException(pathParsingException.getMessage(), pathParsingException.getDetails(),
pathParsingException);