/** {@inheritDoc} */ @Override public void endElement(String uri, String localName, String qName) throws SAXException { if ("template".equals(qName)) { TemplateQuery t = new TemplateQuery(templateName, templateTitle, templateComment, query); t.setEditableConstraints(editableConstraints); for (Map.Entry<PathConstraint, String> entry : constraintDescriptions.entrySet()) { t.setConstraintDescription(entry.getKey(), entry.getValue()); } for (Map.Entry<PathConstraint, SwitchOffAbility> entry : constraintSwitchables.entrySet()) { t.setSwitchOffAbility(entry.getKey(), entry.getValue()); } templates.put(templateName, t); reset(); // constraintPath will be null if this is a subclass constraint // subclass constraints have already been processed } else if ("constraint".equals(qName) && (constraintPath != null)) { PathConstraint constraint = processConstraint(query, constraintPath, constraintAttributes, constraintValues); if (constraintCode == null) { query.addConstraint(constraint); } else { query.addConstraint(constraint, constraintCode); } String description = constraintAttributes.get("description"); String editable = constraintAttributes.get("editable"); if ("true".equals(editable)) { editableConstraints.add(constraint); } constraintDescriptions.put(constraint, description); String switchable = constraintAttributes.get("switchable"); if ("on".equals(switchable)) { constraintSwitchables.put(constraint, SwitchOffAbility.ON); } else if ("off".equals(switchable)) { constraintSwitchables.put(constraint, SwitchOffAbility.OFF); } constraintPath = null; } else { super.endElement(uri, localName, qName); } }