Search in sources :

Example 1 with ComponentPatternCandidate

use of org.eclipse.winery.topologygraph.matching.patterndetection.ComponentPatternCandidate in project winery by eclipse.

the class ComponentPatternDetection method addRelationMappings.

private void addRelationMappings(ComponentPatternCandidate componentPatternCandidate, OTPatternRefinementModel adaptedPrm) {
    TNodeTemplate detectorElement = componentPatternCandidate.getDetectorElement();
    TNodeTemplate refinementElement = componentPatternCandidate.getRefinementElement();
    OTPatternRefinementModel otherPrm = componentPatternCandidate.getOtherPrm();
    TNodeTemplate otherDetectorElement = componentPatternCandidate.getOtherDetectorElement();
    // Redirect and add Relation Mappings of PDRM_x
    if (otherPrm.getRelationMappings() != null) {
        otherPrm.getRelationMappings().stream().filter(mapping -> mapping.getDetectorElement().getId().equals(otherDetectorElement.getId()) && mapping.getRefinementElement().getType().equals(refinementElement.getType())).forEach(mapping -> {
            mapping.setDetectorElement(detectorElement);
            mapping.setRefinementElement(refinementElement);
            adaptedPrm.getRelationMappings().add(mapping);
        });
    }
}
Also used : TPolicy(org.eclipse.winery.model.tosca.TPolicy) HasPolicies(org.eclipse.winery.model.tosca.HasPolicies) PatternDetectionUtils(org.eclipse.winery.topologygraph.matching.patterndetection.PatternDetectionUtils) TopologyFragmentRefinement(org.eclipse.winery.model.adaptation.substitution.refinement.topologyrefinement.TopologyFragmentRefinement) ServiceTemplateId(org.eclipse.winery.model.ids.definitions.ServiceTemplateId) Set(java.util.Set) RefinementChooser(org.eclipse.winery.model.adaptation.substitution.refinement.RefinementChooser) HashMap(java.util.HashMap) IToscaMatcher(org.eclipse.winery.topologygraph.matching.IToscaMatcher) Collectors(java.util.stream.Collectors) TTopologyTemplate(org.eclipse.winery.model.tosca.TTopologyTemplate) Objects(java.util.Objects) OTPatternRefinementModel(org.eclipse.winery.model.tosca.extensions.OTPatternRefinementModel) ToscaComponentPatternMatcher(org.eclipse.winery.topologygraph.matching.patterndetection.ToscaComponentPatternMatcher) List(java.util.List) PatternRefinementModelId(org.eclipse.winery.model.ids.extensions.PatternRefinementModelId) ComponentPatternCandidate(org.eclipse.winery.topologygraph.matching.patterndetection.ComponentPatternCandidate) Map(java.util.Map) OTRefinementModel(org.eclipse.winery.model.tosca.extensions.OTRefinementModel) QName(javax.xml.namespace.QName) TNodeTemplate(org.eclipse.winery.model.tosca.TNodeTemplate) RefinementCandidate(org.eclipse.winery.model.adaptation.substitution.refinement.RefinementCandidate) TNodeTemplate(org.eclipse.winery.model.tosca.TNodeTemplate) OTPatternRefinementModel(org.eclipse.winery.model.tosca.extensions.OTPatternRefinementModel)

Aggregations

HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 QName (javax.xml.namespace.QName)1 RefinementCandidate (org.eclipse.winery.model.adaptation.substitution.refinement.RefinementCandidate)1 RefinementChooser (org.eclipse.winery.model.adaptation.substitution.refinement.RefinementChooser)1 TopologyFragmentRefinement (org.eclipse.winery.model.adaptation.substitution.refinement.topologyrefinement.TopologyFragmentRefinement)1 ServiceTemplateId (org.eclipse.winery.model.ids.definitions.ServiceTemplateId)1 PatternRefinementModelId (org.eclipse.winery.model.ids.extensions.PatternRefinementModelId)1 HasPolicies (org.eclipse.winery.model.tosca.HasPolicies)1 TNodeTemplate (org.eclipse.winery.model.tosca.TNodeTemplate)1 TPolicy (org.eclipse.winery.model.tosca.TPolicy)1 TTopologyTemplate (org.eclipse.winery.model.tosca.TTopologyTemplate)1 OTPatternRefinementModel (org.eclipse.winery.model.tosca.extensions.OTPatternRefinementModel)1 OTRefinementModel (org.eclipse.winery.model.tosca.extensions.OTRefinementModel)1 IToscaMatcher (org.eclipse.winery.topologygraph.matching.IToscaMatcher)1 ComponentPatternCandidate (org.eclipse.winery.topologygraph.matching.patterndetection.ComponentPatternCandidate)1