public static void addFeatureConfig(ElementNode parentE, FeatureConfig fc, String ns) { final ElementNode fcE = addElement(parentE, Element.FEATURE.getLocalName(), ns); addAttribute(fcE, Attribute.SPEC, fc.getSpecId().toString()); if(fc.getParentRef() != null) { addAttribute(fcE, Attribute.PARENT_REF, fc.getParentRef()); } addFeatureConfigBody(fcE, null, fc, ns); } }
for(SpecId spec : dep.getExcludedSpecs()) { final ElementNode excludeE = addElement(depE, Element.EXCLUDE.getLocalName(), ns); addAttribute(excludeE, Attribute.SPEC, spec.toString()); for(Map.Entry<FeatureId, String> excluded : dep.getExcludedFeatures().entrySet()) { final ElementNode excludeE = addElement(depE, Element.EXCLUDE.getLocalName(), ns); addAttribute(excludeE, Attribute.FEATURE_ID, excluded.getKey().toString()); if(excluded.getValue() != null) { addAttribute(excludeE, Attribute.PARENT_REF, excluded.getValue()); for(SpecId spec : dep.getIncludedSpecs()) { final ElementNode includeE = addElement(depE, Element.INCLUDE.getLocalName(), ns); addAttribute(includeE, Attribute.SPEC, spec.toString()); for(Map.Entry<FeatureId, FeatureConfig> entry : dep.getIncludedFeatures().entrySet()) { final ElementNode includeE = addElement(depE, Element.INCLUDE.getLocalName(), ns); addAttribute(includeE, Attribute.FEATURE_ID, entry.getKey().toString()); final FeatureConfig fc = entry.getValue(); if(fc.getParentRef() != null) { addAttribute(includeE, Attribute.PARENT_REF, fc.getParentRef());
public static void addFeatureGroupDepBody(FeatureGroupSupport dep, final ElementNode depE, String ns) { if(dep.getName() != null) { addAttribute(depE, Attribute.NAME, dep.getName()); } if(!dep.isInheritFeatures()) { addAttribute(depE, Attribute.INHERIT_FEATURES, FALSE); } addFeatureGroupIncludeExclude(dep, ns, depE); writeFeatureGroupSpecBody(depE, dep, ns); if(dep.hasExternalFeatureGroups()) { for(Map.Entry<String, FeatureGroup> entry : dep.getExternalFeatureGroups().entrySet()) { final ElementNode fpE = addElement(depE, Element.ORIGIN.getLocalName(), ns); addAttribute(fpE, Attribute.NAME, entry.getKey()); addFeatureGroupIncludeExclude(entry.getValue(), ns, fpE); } } if(dep.hasPackageDeps()) { PackageXmlWriter.writePackageDeps(dep, addElement(depE, Element.PACKAGES.getLocalName(), ns)); } }
final ElementNode depE = addElement(fcE, Element.DEPENDS.getLocalName(), ns); if(depSpec.getOrigin() != null) { addAttribute(depE, Attribute.ORIGIN, depSpec.getOrigin()); addAttribute(depE, Attribute.FEATURE_ID, depSpec.getFeatureId().toString()); if(depSpec.isInclude()) { addAttribute(depE, Attribute.INCLUDE, TRUE); addAttribute(paramE, Attribute.NAME, name); addAttribute(paramE, Attribute.VALUE, param.getValue()); for(String param : fc.getResetParams()) { final ElementNode paramE = addElement(fcE, Element.RESET_PARAM.getLocalName(), ns); addAttribute(paramE, Attribute.PARAM, param); for(String param : fc.getUnsetParams()) { final ElementNode paramE = addElement(fcE, Element.UNSET_PARAM.getLocalName(), ns); addAttribute(paramE, Attribute.PARAM, param);
static void writeFeatureGroupSpecBody(final ElementNode configE, ConfigItemContainer featureGroup, String ns) { if(!featureGroup.hasItems()) { return; } String currentOrigin = null; ElementNode parent = configE; for(ConfigItem item : featureGroup.getItems()) { final String itemOrigin = item.getOrigin(); if(itemOrigin != null) { if (!itemOrigin.equals(currentOrigin)) { parent = addElement(configE, Element.ORIGIN.getLocalName(), ns); addAttribute(parent, Attribute.NAME, itemOrigin); currentOrigin = itemOrigin; } } else if(currentOrigin != null) { currentOrigin = null; parent = configE; } if(item.isGroup()) { writeFeatureGroupDependency(parent, (FeatureGroup) item, ns); } else { addFeatureConfig(parent, (FeatureConfig) item, ns); } } }
protected ElementNode toElement(FeatureGroup featureGroup, String ns) { final ElementNode fgE = addElement(null, Element.FEATURE_GROUP_SPEC.getLocalName(), ns); if(featureGroup.getName() != null) { addAttribute(fgE, Attribute.NAME, featureGroup.getName()); } //addFeatureGroupIncludeExclude(featureGroup, ns, fgE); writeFeatureGroupSpecBody(fgE, featureGroup, ns); if(featureGroup.hasPackageDeps()) { PackageXmlWriter.writePackageDeps(featureGroup, addElement(fgE, Element.PACKAGES.getLocalName(), ns)); } return fgE; }