@Override public Object createObject(Attributes attributes) { return new SetPropertiesRule(); } }
/** * Add the alias to the SetPropertiesRule object created by the * enclosing <set-properties-rule> tag. */ @Override public void begin(Attributes attributes) { String attrName = attributes.getValue("attr-name"); String propName = attributes.getValue("prop-name"); SetPropertiesRule rule = (SetPropertiesRule) digester.peek(); rule.addAlias(attrName, propName); } }
/** * {@inheritDoc} */ public SetPropertiesRule get() { String[] attributeNames = new String[this.aliases.size()]; String[] propertyNames = new String[this.aliases.size()]; int i = 0; for (Entry<String, String> alias : this.aliases.entrySet()) { attributeNames[i] = alias.getKey(); propertyNames[i++] = alias.getValue(); } return new SetPropertiesRule(attributeNames, propertyNames); }
/** * Add the alias to the SetPropertiesRule object created by the * enclosing <set-properties-rule> tag. */ public void begin(Attributes attributes) { String attrName = attributes.getValue("attr-name"); String propName = attributes.getValue("prop-name"); SetPropertiesRule rule = (SetPropertiesRule) digester.peek(); rule.addAlias(attrName, propName); } }
/** * Add a "set properties" rule for the specified parameters. * * @param pattern Element matching pattern * @see SetPropertiesRule */ public void addSetProperties(String pattern) { addRule(pattern, new SetPropertiesRule()); }
/** * Add a "set properties" rule with a single overridden parameter. * See {@link SetPropertiesRule#SetPropertiesRule(String attributeName, String propertyName)} * * @param pattern Element matching pattern * @param attributeName map this attribute * @param propertyName to this property * @see SetPropertiesRule */ public void addSetProperties( String pattern, String attributeName, String propertyName) { addRule(pattern, new SetPropertiesRule(attributeName, propertyName)); }
/** * Add a "set properties" rule with overridden parameters. * See {@link SetPropertiesRule#SetPropertiesRule(String [] attributeNames, String [] propertyNames)} * * @param pattern Element matching pattern * @param attributeNames names of attributes with custom mappings * @param propertyNames property names these attributes map to * @see SetPropertiesRule */ public void addSetProperties( String pattern, String [] attributeNames, String [] propertyNames) { addRule(pattern, new SetPropertiesRule(attributeNames, propertyNames)); }
public Object createObject(Attributes attributes) { return new SetPropertiesRule(); } }
/** * Add a "set properties" rule for the specified parameters. * * @param pattern Element matching pattern * @see SetPropertiesRule */ public void addSetProperties(String pattern) { addRule(pattern, new SetPropertiesRule()); }
/** * Add a "set properties" rule with a single overridden parameter. * See {@link SetPropertiesRule#SetPropertiesRule(String attributeName, String propertyName)} * * @param pattern Element matching pattern * @param attributeName map this attribute * @param propertyName to this property * @see SetPropertiesRule */ public void addSetProperties( String pattern, String attributeName, String propertyName) { addRule(pattern, new SetPropertiesRule(attributeName, propertyName)); }
/** * Add a "set properties" rule with overridden parameters. * See {@link SetPropertiesRule#SetPropertiesRule(String [] attributeNames, String [] propertyNames)} * * @param pattern Element matching pattern * @param attributeNames names of attributes with custom mappings * @param propertyNames property names these attributes map to * @see SetPropertiesRule */ public void addSetProperties( String pattern, String [] attributeNames, String [] propertyNames) { addRule(pattern, new SetPropertiesRule(attributeNames, propertyNames)); }
/** * Add Digester rules for all <state> element attributes. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param customActions The list of custom actions this digester needs * to be able to process * @param pr The PathResolver * @param scxml The root document, if this one is src'ed in */ private static void addStatePropertiesRules(final String xp, final ExtendedBaseRules scxmlRules, final List customActions, final PathResolver pr, final SCXML scxml) { scxmlRules.add(xp, new SetPropertiesRule(new String[] {"id", "final"}, new String[] {"id", "isFinal"})); scxmlRules.add(xp, new DigestSrcAttributeRule(scxml, customActions, pr)); }
/** * Add Digester rules for all pseudo state (initial, history) element * attributes. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param customActions The list of custom actions this digester needs * to be able to process * @param pr The PathResolver * @param scxml The root document, if this one is src'ed in */ private static void addPseudoStatePropertiesRules(final String xp, final ExtendedBaseRules scxmlRules, final List customActions, final PathResolver pr, final SCXML scxml) { scxmlRules.add(xp, new SetPropertiesRule(new String[] {"id"}, new String[] {"id"})); scxmlRules.add(xp, new DigestSrcAttributeRule(scxml, customActions, pr)); }
/** * Add Digester rules for all <state> element attributes. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param customActions The list of custom actions this digester needs * to be able to process * @param pr The PathResolver * @param scxml The root document, if this one is src'ed in */ private static void addStatePropertiesRules(final String xp, final ExtendedBaseRules scxmlRules, final List customActions, final PathResolver pr, final SCXML scxml) { scxmlRules.add(xp, new SetPropertiesRule( new String[] {"id", "final", "initial"}, new String[] {"id", "final", "first"})); scxmlRules.add(xp, new DigestSrcAttributeRule(scxml, customActions, pr)); }
/** * Add the run of the mill Digester rules for any element. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param klass The class in the Java object model to be instantiated * in the ObjectCreateRule for this action * @param args The attributes to be mapped into the object model * @param props The properties that args get mapped to * @param addMethod The method that the SetNextRule should call */ private static void addSimpleRulesTuple(final String xp, final ExtendedBaseRules scxmlRules, final Class klass, final String[] args, final String[] props, final String addMethod) { scxmlRules.add(xp, new ObjectCreateRule(klass)); if (args == null) { scxmlRules.add(xp, new SetPropertiesRule()); } else { scxmlRules.add(xp, new SetPropertiesRule(args, props)); } scxmlRules.add(xp, new SetNextRule(addMethod)); }
/** * Add the run of the mill Digester rules for any element. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param klass The class in the Java object model to be instantiated * in the ObjectCreateRule for this action * @param args The attributes to be mapped into the object model * @param props The properties that args get mapped to * @param addMethod The method that the SetNextRule should call */ private static void addSimpleRulesTuple(final String xp, final ExtendedBaseRules scxmlRules, final Class klass, final String[] args, final String[] props, final String addMethod) { scxmlRules.add(xp, new ObjectCreateRule(klass)); if (args == null) { scxmlRules.add(xp, new SetPropertiesRule()); } else { scxmlRules.add(xp, new SetPropertiesRule(args, props)); } scxmlRules.add(xp, new SetNextRule(addMethod)); }
/** * Add Digester rules for all pseudo state (initial, history) element * attributes. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param customActions The list of custom actions this digester needs * to be able to process * @param pr The PathResolver * @param scxml The root document, if this one is src'ed in */ private static void addPseudoStatePropertiesRules(final String xp, final ExtendedBaseRules scxmlRules, final List customActions, final PathResolver pr, final SCXML scxml) { scxmlRules.add(xp, new SetPropertiesRule(new String[] {"id"}, new String[] {"id"})); scxmlRules.add(xp, new DigestSrcAttributeRule(scxml, customActions, pr)); addParentRule(xp, scxmlRules, 1); }
new SetPropertiesRule(JRXmlConstants.ATTRIBUTE_truncateIndex, "textTruncateIndex"));
final PathResolver pr, final List customActions) { scxmlRules.add(xp, new ObjectCreateRule(Transition.class)); scxmlRules.add(xp, new SetPropertiesRule( new String[] {"event", "cond", "target"}, new String[] {"event", "cond", "next"})); scxmlRules.add(xp, new SetCurrentNamespacesRule()); scxmlRules.add(xp + XPF_TAR, new SetPropertiesRule()); addActionRules(xp, scxmlRules, pr, customActions); scxmlRules.add(xp + XPF_EXT, new Rule() {
/** * Add Digester rules for all <datamodel> elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param pr The PathResolver * @param scxml The parent SCXML document (or null) */ private static void addDatamodelRules(final String xp, final ExtendedBaseRules scxmlRules, final SCXML scxml, final PathResolver pr) { scxmlRules.add(xp, new ObjectCreateRule(Datamodel.class)); scxmlRules.add(xp + XPF_DATA, new ObjectCreateRule(Data.class)); scxmlRules.add(xp + XPF_DATA, new SetPropertiesRule()); scxmlRules.add(xp + XPF_DATA, new SetCurrentNamespacesRule()); scxmlRules.add(xp + XPF_DATA, new SetNextRule("addData")); try { scxmlRules.add(xp + XPF_DATA, new ParseDataRule(pr)); } catch (ParserConfigurationException pce) { org.apache.commons.logging.Log log = LogFactory. getLog(SCXMLParser.class); log.error(ERR_PARSER_CFG_DATA, pce); } scxmlRules.add(xp, new SetNextRule("setDatamodel")); }