use of org.jboss.galleon.spec.FeatureReferenceSpec in project galleon by wildfly.
the class ResolvedFeatureSpec method resolveNonIdParams.
Map<String, Object> resolveNonIdParams(ResolvedFeatureId parentId, String parentRef, Map<String, String> params) throws ProvisioningException {
Map<String, Object> resolvedParams = Collections.emptyMap();
if (!params.isEmpty()) {
for (Map.Entry<String, String> param : params.entrySet()) {
if (xmlSpec.getParam(param.getKey()).isFeatureId()) {
continue;
}
resolvedParams = CollectionUtils.put(resolvedParams, param.getKey(), paramFromString(param.getKey(), param.getValue()));
}
}
if (parentId == null) {
return resolvedParams;
}
if (parentRef == null) {
parentRef = parentId.specId.name;
}
final FeatureReferenceSpec refSpec = xmlSpec.getFeatureRef(parentRef);
if (refSpec.hasMappedParams()) {
for (Map.Entry<String, String> mapping : refSpec.getMappedParams().entrySet()) {
if (xmlSpec.getParam(mapping.getKey()).isFeatureId()) {
continue;
}
final Object idValue = parentId.params.get(mapping.getValue());
if (idValue != null) {
resolvedParams = CollectionUtils.put(resolvedParams, mapping.getKey(), idValue);
}
}
} else {
for (Map.Entry<String, Object> parentEntry : parentId.params.entrySet()) {
if (xmlSpec.getParam(parentEntry.getKey()).isFeatureId()) {
continue;
}
resolvedParams = CollectionUtils.put(resolvedParams, parentEntry.getKey(), parentEntry.getValue());
}
}
return resolvedParams;
}
Aggregations