private void containsIntents(List<String> intentArgs, LogicalComponent<?> component, Set<LogicalScaArtifact> artifacts) { if (containsIntents(intentArgs, component.getDefinition().getImplementation().getIntents())) { artifacts.add(component); } if (containsIntents(intentArgs, component.getDefinition().getIntents())) { artifacts.add(component); } if (containsIntents(intentArgs, component.getIntents())) { artifacts.add(component); } for (LogicalService service : component.getServices()) { if (containsIntents(intentArgs, service.getIntents())) { artifacts.add(service); } } for (LogicalReference reference : component.getReferences()) { if (containsIntents(intentArgs, reference.getIntents())) { artifacts.add(reference); } } if (component instanceof LogicalCompositeComponent) { LogicalCompositeComponent composite = (LogicalCompositeComponent) component; for (LogicalComponent<?> childComponent : composite.getComponents()) { containsIntents(intentArgs, childComponent, artifacts); } } }
/** * Aggregate intents from ancestors of a component. Components are handled differently than other SCA artifacts as implementation intents are inherited. * * @param component the logical artifact to aggregate intents for * @return the aggregated intents */ protected Set<QName> aggregateIntents(LogicalComponent<?> component) { LogicalComponent<?> current = component; Set<QName> aggregatedIntents = new LinkedHashSet<>(); while (current != null) { Set<QName> currentIntents = current.getIntents(); processIntents(currentIntents, aggregatedIntents); ComponentDefinition<? extends Implementation<?>> definition = current.getDefinition(); if (definition != null) { processIntents(definition.getIntents(), aggregatedIntents); Implementation<?> implementation = definition.getImplementation(); if (implementation != null) { processIntents(implementation.getIntents(), aggregatedIntents); ComponentType componentType = implementation.getComponentType(); if (componentType != null) { processIntents(componentType.getIntents(), aggregatedIntents); } } } current = current.getParent(); } return aggregatedIntents; }
ComponentDefinition<? extends Implementation<?>> definition = parent.getDefinition(); if (definition != null) { processIntents(definition.getIntents(), aggregatedIntents); Implementation<?> implementation = definition.getImplementation(); if (implementation != null) {
processIntents(definition.getIntents(), aggregatedIntents); Implementation<?> implementation = definition.getImplementation(); if (implementation != null) {