Skip to content

Commit

Permalink
Fix checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
wederbn committed Nov 20, 2023
1 parent 6e3193a commit c21c1f9
Showing 1 changed file with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1732,7 +1732,6 @@ public ServiceTemplateId completeNextRequirement(ServiceTemplateId id, List<QNam
TServiceTemplate serviceTemplate = repository.getElement(id);
TTopologyTemplate topologyTemplate = serviceTemplate.getTopologyTemplate();


// create wrapper service template
ServiceTemplateId matchedServiceTemplateId = new ServiceTemplateId(
id.getNamespace().getDecoded(),
Expand Down Expand Up @@ -1762,12 +1761,10 @@ public ServiceTemplateId completeNextRequirement(ServiceTemplateId id, List<QNam
return matchedServiceTemplateId;
}

public TTopologyTemplate getMatchingTopology(TServiceTemplate serviceTemplate, List<QName> blacklist, Map<String, String> policies) throws
SplittingException {
public TTopologyTemplate getMatchingTopology(TServiceTemplate serviceTemplate, List<QName> blacklist, Map<String, String> policies) throws SplittingException {
ProviderRepository repository = new ProviderRepository();
List<TNodeTemplate> lowLevelNodeTemplates = getNodeTemplatesWithoutOutgoingHostedOnRelationships(serviceTemplate);
List<TNodeTemplate> nodesToCheck = new ArrayList<>();


//Find lowest level nodes with open requirements which means they can be hosted by an other component
for (TNodeTemplate nodeTemplateCandidate : lowLevelNodeTemplates) {
Expand Down Expand Up @@ -1812,12 +1809,12 @@ public TTopologyTemplate getMatchingTopology(TServiceTemplate serviceTemplate, L
//get NodeType of NodeTemplate
TNodeType matchingType = nodeTypes.get(nt.getType());

if (matchingType.getTags() == null){
if (matchingType.getTags() == null) {
return true;
}
// check if NodeType has given Tag -> If it does have the tag it must be set as desrcibed by the policy, otherwise it is ignored
List<TTag> filteredTagList = matchingType.getTags().stream().filter(tag -> tag.getName().equalsIgnoreCase(entry.getKey())).toList();
if (filteredTagList.size() > 0){
if (filteredTagList.size() > 0) {
return entry.getValue().equalsIgnoreCase(filteredTagList.get(0).getValue());
}
return true;
Expand All @@ -1829,16 +1826,15 @@ public TTopologyTemplate getMatchingTopology(TServiceTemplate serviceTemplate, L
// check if suitable nodetemplate already exists in topology, if so reuse it instead of creating new one.
assert topologyToComplete != null;
boolean suitableNodeTemplateAlreadyExists = false;
for( TNodeTemplate nt: topologyToComplete.getNodeTemplates()){
if (nt.getType().equals(selectedTemplate.getType())){
for (TNodeTemplate nt: topologyToComplete.getNodeTemplates()) {
if (nt.getType().equals(selectedTemplate.getType())) {
selectedTemplate = nt;
suitableNodeTemplateAlreadyExists = true;
}
}
if (!suitableNodeTemplateAlreadyExists){
if (!suitableNodeTemplateAlreadyExists) {
topologyToComplete.addNodeTemplate(selectedTemplate);
}


TRelationshipTemplate newHostedOnRelationship = new TRelationshipTemplate();
String id = UUID.randomUUID().toString();
Expand Down Expand Up @@ -1874,6 +1870,4 @@ public TTopologyTemplate getMatchingTopology(TServiceTemplate serviceTemplate, L
}
return topologyToComplete;
}


}

0 comments on commit c21c1f9

Please sign in to comment.