protected void writeRequirement(IRequirement requirement) { start(REQUIREMENT_ELEMENT); IMatchExpression<IInstallableUnit> match = requirement.getMatches(); if (requirement.getMax() > 0 && RequiredCapability.isSimpleRequirement(match)) { attribute(NAMESPACE_ATTRIBUTE, RequiredCapability.extractNamespace(match)); attribute(NAME_ATTRIBUTE, RequiredCapability.extractName(match)); attribute(VERSION_RANGE_ATTRIBUTE, RequiredCapability.extractRange(match)); attribute(CAPABILITY_OPTIONAL_ATTRIBUTE, requirement.getMin() == 0, false); attribute(CAPABILITY_MULTIPLE_ATTRIBUTE, requirement.getMax() > 1, false); } else { writeMatchExpression(match); if (requirement.getMin() != 1) attribute(MIN_ATTRIBUTE, requirement.getMin()); if (requirement.getMax() != 1) attribute(MAX_ATTRIBUTE, requirement.getMax()); } attribute(CAPABILITY_GREED_ATTRIBUTE, requirement.isGreedy(), true); if (requirement.getFilter() != null) writeTrimmedCdata(CAPABILITY_FILTER_ELEMENT, requirement.getFilter().getParameters()[0].toString()); if (requirement.getDescription() != null) writeTrimmedCdata(REQUIREMENT_DESCRIPTION_ELEMENT, requirement.getDescription()); end(REQUIREMENT_ELEMENT); }
protected void writeRequirement(IRequirement requirement) { start(REQUIREMENT_ELEMENT); IMatchExpression<IInstallableUnit> match = requirement.getMatches(); if (requirement.getMax() > 0 && RequiredCapability.isSimpleRequirement(match)) { attribute(NAMESPACE_ATTRIBUTE, RequiredCapability.extractNamespace(match)); attribute(NAME_ATTRIBUTE, RequiredCapability.extractName(match)); attribute(VERSION_RANGE_ATTRIBUTE, RequiredCapability.extractRange(match)); attribute(CAPABILITY_OPTIONAL_ATTRIBUTE, requirement.getMin() == 0, false); attribute(CAPABILITY_MULTIPLE_ATTRIBUTE, requirement.getMax() > 1, false); } else { writeMatchExpression(match); if (requirement.getMin() != 1) attribute(MIN_ATTRIBUTE, requirement.getMin()); if (requirement.getMax() != 1) attribute(MAX_ATTRIBUTE, requirement.getMax()); } attribute(CAPABILITY_GREED_ATTRIBUTE, requirement.isGreedy(), true); if (requirement.getFilter() != null) writeTrimmedCdata(CAPABILITY_FILTER_ELEMENT, requirement.getFilter().getParameters()[0].toString()); if (requirement.getDescription() != null) writeTrimmedCdata(REQUIREMENT_DESCRIPTION_ELEMENT, requirement.getDescription()); end(REQUIREMENT_ELEMENT); }
protected void writeRequirement(IRequirement requirement) { start(REQUIREMENT_ELEMENT); IMatchExpression<IInstallableUnit> match = requirement.getMatches(); if (requirement.getMax() > 0 && RequiredCapability.isSimpleRequirement(match)) { attribute(NAMESPACE_ATTRIBUTE, RequiredCapability.extractNamespace(match)); attribute(NAME_ATTRIBUTE, RequiredCapability.extractName(match)); attribute(VERSION_RANGE_ATTRIBUTE, RequiredCapability.extractRange(match)); attribute(CAPABILITY_OPTIONAL_ATTRIBUTE, requirement.getMin() == 0, false); attribute(CAPABILITY_MULTIPLE_ATTRIBUTE, requirement.getMax() > 1, false); } else { writeMatchExpression(match); if (requirement.getMin() != 1) attribute(MIN_ATTRIBUTE, requirement.getMin()); if (requirement.getMax() != 1) attribute(MAX_ATTRIBUTE, requirement.getMax()); } attribute(CAPABILITY_GREED_ATTRIBUTE, requirement.isGreedy(), true); if (requirement.getFilter() != null) writeTrimmedCdata(CAPABILITY_FILTER_ELEMENT, requirement.getFilter().getParameters()[0].toString()); if (requirement.getDescription() != null) writeTrimmedCdata(REQUIREMENT_DESCRIPTION_ELEMENT, requirement.getDescription()); end(REQUIREMENT_ELEMENT); }