| | |
| | | |
| | | private Severity severity; |
| | | private Integer id; |
| | | private String xmlId; |
| | | private String formatString; |
| | | |
| | | /** |
| | | * Build log reference entry for an log message. |
| | | * |
| | | * @param msgPropKey |
| | | * @param category |
| | | * @param severity |
| | | * @param ordinal |
| | | * @param formatString |
| | | */ |
| | | public MessageRefEntry(final Category category, final Severity severity, |
| | | public MessageRefEntry(final String msgPropKey, |
| | | final Category category, final Severity severity, |
| | | final Integer ordinal, final String formatString) |
| | | { |
| | | this.severity = severity; |
| | | this.formatString = formatString; |
| | | id = calculateId(category, severity, ordinal); |
| | | xmlId = getXmlId(msgPropKey); |
| | | } |
| | | |
| | | private Integer calculateId(final Category category, |
| | |
| | | return new Integer(ordinal); |
| | | } |
| | | |
| | | private String getXmlId(final String messagePropertyKey) |
| | | { |
| | | // XML IDs must be unique, and must begin with a letter ([A-Za-z]) |
| | | // and may be followed by any number of letters, digits ([0-9]), |
| | | // hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). |
| | | |
| | | final String invalidChars = "[^A-Za-z0-9\\-_:\\.]"; |
| | | String xmlId = messagePropertyKey.replaceAll(invalidChars, "-"); |
| | | return xmlId; |
| | | } |
| | | |
| | | /** |
| | | * Return a DocBook XML <varlistentry> of this log reference entry. |
| | | * This implementation copies the message string verbatim, and does not |
| | |
| | | public String toString() |
| | | { |
| | | return |
| | | " <varlistentry xml:id=\"log-ref-" + id.intValue() + "\">" + EOL |
| | | " <varlistentry xml:id=\"log-ref-" + xmlId + "\">" + EOL |
| | | + " <term>ID: " + id.intValue() + "</term>" + EOL |
| | | + " <listitem>" + EOL |
| | | + " <para>Severity: " + severity.name() + "</para>" + EOL |
| | |
| | | || s.name().equalsIgnoreCase("SEVERE_ERROR")) { |
| | | MessageRefEntry entry = |
| | | new MessageRefEntry( |
| | | key.toString(), |
| | | c, |
| | | s, |
| | | globalOrdinal != null ? |