@Override public Void processElement(ParserContext context, Element element) { String from = $(element).attr(FROM); String to = $(element).attr(TO); if (StringUtils.isBlank(from)) { throw new WindupException("The '" + ELEM_NAME + "' element must have a non-empty '" + FROM + "' attribute"); } if (StringUtils.isBlank(to)) { throw new WindupException("The '" + ELEM_NAME + "' element must have a non-empty '" + TO + "' attribute"); } context.getBuilder().addRule(PackageNameMapping.fromPackage(from).toOrganization(to)); return null; }
@Override public Void processElement(ParserContext context, Element element) { String id = $(element).attr("id"); String from = $(element).attr(FROM); String to = $(element).attr(TO); if (StringUtils.isBlank(from)) { throw new WindupException("The '" + ELEM_NAME + "' element must have a non-empty '" + FROM + "' attribute"); } if (StringUtils.isBlank(to)) { throw new WindupException("The '" + ELEM_NAME + "' element must have a non-empty '" + TO + "' attribute"); } PackageNameMappingWithOrganization withOrganization = PackageNameMapping.fromPackage(from).toOrganization(to); Rule rule = StringUtils.isNotBlank(id) ? withOrganization.withId(id) : withOrganization; if (rule instanceof Context) ((Context) rule).put(RuleMetadataType.RULE_XML, XmlUtil.nodeToString(element)); context.getBuilder().addRule(rule); return null; }
@Override public Void processElement(ParserContext context, Element element) { String id = $(element).attr("id"); String from = $(element).attr(FROM); String to = $(element).attr(TO); if (StringUtils.isBlank(from)) { throw new WindupException("The '" + ELEM_NAME + "' element must have a non-empty '" + FROM + "' attribute"); } if (StringUtils.isBlank(to)) { throw new WindupException("The '" + ELEM_NAME + "' element must have a non-empty '" + TO + "' attribute"); } PackageNameMappingWithOrganization withOrganization = PackageNameMapping.fromPackage(from).toOrganization(to); Rule rule = StringUtils.isNotBlank(id) ? withOrganization.withId(id) : withOrganization; if (rule instanceof Context) ((Context) rule).put(RuleMetadataType.RULE_XML, XmlUtil.nodeToString(element)); context.getBuilder().addRule(rule); return null; }