diff options
author | Manzon, Inna (im453s) <im453s@intl.att.com> | 2018-12-25 17:41:33 +0200 |
---|---|---|
committer | Manzon, Inna (im453s) <im453s@intl.att.com> | 2019-01-10 18:27:17 +0200 |
commit | e10154ff631cf86a978899db8533e86bbc0e658e (patch) | |
tree | 57dc73699b599acd1b16d82ae7f6add448505e44 /src/main/java/org/onap | |
parent | 67f39f670bd700878d11759ef5f0a91e674261f8 (diff) |
SDC Tosca Parser getEntity API1.4.12
Change-Id: I7cb1acfcfacd3c58eae52995523b1e55e7302144
Issue-ID: SDC-1967
Signed-off-by: Manzon, Inna (im453s) <im453s@intl.att.com>
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/impl/QueryProcessor.java | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/main/java/org/onap/sdc/tosca/parser/impl/QueryProcessor.java b/src/main/java/org/onap/sdc/tosca/parser/impl/QueryProcessor.java index 42b499b..8ca730c 100644 --- a/src/main/java/org/onap/sdc/tosca/parser/impl/QueryProcessor.java +++ b/src/main/java/org/onap/sdc/tosca/parser/impl/QueryProcessor.java @@ -92,31 +92,33 @@ class QueryProcessor { return topologyTemplateQuery.getNodeTemplateType() == SdcTypes.SERVICE; } - private List<NodeTemplate> getInternalTopologyTemplates(List<NodeTemplate> nodeTemplateList, boolean searchTypeOnly) { + private List<NodeTemplate> getInternalTopologyTemplates(List<NodeTemplate> nodeTemplateList, boolean isRecursive) { return nodeTemplateList .stream() - .map(child->getTopologyTemplatesByQuery(child, searchTypeOnly)) + .map(child->getTopologyTemplatesByQuery(child, isRecursive)) .flatMap(List::stream) .collect(Collectors.toList()); } - private List<NodeTemplate> getTopologyTemplatesByQuery(NodeTemplate current, boolean searchTypeOnly) { + private List<NodeTemplate> getTopologyTemplatesByQuery(NodeTemplate current, boolean isRecursive) { List<NodeTemplate> topologyTemplateList = Lists.newArrayList(); - boolean isTopologyTemplateFound = searchTypeOnly ? - topologyTemplateQuery.isSameSdcType(current.getMetaData()) : topologyTemplateQuery.isMatchingSearchCriteria(current); + boolean isTopologyTemplateFound = isRecursive ? + SdcTypes.isComplex(current.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)) + : topologyTemplateQuery.isMatchingSearchCriteria(current); if (isTopologyTemplateFound) { topologyTemplateList.add(current); - if (!isServiceSearch()) { + if (!isRecursive) { //recursion stop condition return topologyTemplateList; } } - if (SdcTypes.isComplex(current.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)) && current.getSubMappingToscaTemplate() != null) { - //search the node template inside a given topology template + if (SdcTypes.isComplex(current.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)) && + current.getSubMappingToscaTemplate() != null) { + //search the node template inside a given topology template topologyTemplateList.addAll(current.getSubMappingToscaTemplate().getNodeTemplates() .stream() - .map(nt->getTopologyTemplatesByQuery(nt, searchTypeOnly)) + .map(nt->getTopologyTemplatesByQuery(nt, isRecursive)) .flatMap(List::stream) .collect(Collectors.toList())); } |