ResolvedFeatureId resolveFeatureId(Map<String, String> params) throws ProvisioningException { if(!xmlSpec.hasId()) { return null; } final List<FeatureParameterSpec> idSpecs = xmlSpec.getIdParams(); if(idSpecs.size() == 1) { final FeatureParameterSpec idSpec = idSpecs.get(0); return new ResolvedFeatureId(id, Collections.singletonMap(idSpec.getName(), resolveIdParamValue(params, idSpec))); } final Map<String, Object> resolvedParams = new HashMap<>(idSpecs.size()); for(FeatureParameterSpec param : idSpecs) { resolvedParams.put(param.getName(), resolveIdParamValue(params, param)); } return new ResolvedFeatureId(id, resolvedParams); }
for(FeatureParameterSpec targetIdParam : targetSpec.xmlSpec.getIdParams()) { final String paramName = targetIdParam.getName(); final String refParamName = paramName;
private void assertRefParamMapping(final FeatureReferenceSpec refSpec, final ResolvedFeatureSpec targetSpec) throws ProvisioningDescriptionException { if (!targetSpec.xmlSpec.hasId()) { throw new ProvisioningDescriptionException(id + " feature spec declares reference " + refSpec.getName() + " to feature spec " + targetSpec.id + " that has no ID parameters"); } if(!refSpec.hasMappedParams()) { for(FeatureParameterSpec targetIdParam : targetSpec.xmlSpec.getIdParams()) { if(!xmlSpec.hasParam(targetIdParam.getName())) { throw new ProvisioningDescriptionException(Errors.nonExistingForeignKeyParam(refSpec.getName(), id, targetIdParam.getName())); } } return; } if (targetSpec.xmlSpec.getIdParams().size() != refSpec.getParamsMapped()) { throw new ProvisioningDescriptionException("The number of foreign key parameters of reference " + refSpec.getName() + " in feature spec " + id + " does not match the number of the ID parameters of the referenced feature spec " + targetSpec.id); } for(Map.Entry<String, String> mapping : refSpec.getMappedParams().entrySet()) { if (!xmlSpec.hasParam(mapping.getKey())) { throw new ProvisioningDescriptionException(Errors.nonExistingForeignKeyParam(refSpec.getName(), id, mapping.getKey())); } if (!targetSpec.xmlSpec.hasParam(mapping.getValue())) { throw new ProvisioningDescriptionException( Errors.nonExistingForeignKeyTarget(mapping.getKey(), refSpec.getName(), id, mapping.getValue(), targetSpec.id)); } } }
final List<FeatureParameterSpec> idParamSpecs = xmlSpec.getIdParams(); final Map<String, Object> resolvedParams = new HashMap<>(idParamSpecs.size()); final FeatureReferenceSpec refSpec = xmlSpec.getFeatureRef(parentRef);
List<FeatureParameterSpec> idparams = f.getSpec().getIdParams(); String tab = " "; session.println(Config.getLineSeparator() + "Feature Id parameters");