void unsetParam(String name, boolean overwrite) throws ProvisioningDescriptionException { if(!spec.xmlSpec.hasParam(name)) { throw new ProvisioningDescriptionException(Errors.unknownFeatureParameter(spec.id, name)); } if(id.params.containsKey(name)) { throw new ProvisioningDescriptionException(Errors.featureIdParameterCantBeUnset(id, name)); } if(unsetParams.contains(name)) { return; } if (resetParams.contains(name)) { if(!overwrite) { return; } resetParams = CollectionUtils.remove(resetParams, name); } else if (overwrite) { params.remove(name); } else if (params.containsKey(name)) { return; } unsetParams = CollectionUtils.add(unsetParams, name); }
void resetParam(String name) throws ProvisioningDescriptionException { if(!spec.xmlSpec.hasParam(name)) { throw new ProvisioningDescriptionException(Errors.unknownFeatureParameter(spec.id, name)); } if(id.params.containsKey(name)) { throw new ProvisioningDescriptionException(Errors.featureIdParameterCantBeReset(id, name)); } if(resetParams.contains(name)) { return; } if(unsetParams.contains(name)) { unsetParams = CollectionUtils.remove(unsetParams, name); } else { params.remove(name); } resetParams = CollectionUtils.add(resetParams, name); }
if(!spec.xmlSpec.hasParam(name)) { throw new ProvisioningDescriptionException(Errors.unknownFeatureParameter(spec.id, name));
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)); } } }