8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the Common Development and Distribution License
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (the License). You may not use this file except in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * compliance with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the License at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If applicable, add the following below the CDDL Header,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with the fields enclosed by brackets [] replaced by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * your own identifying information:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * $Id: LogMessages.java,v 1.2 2008/06/25 05:44:12 qcheng Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Portions Copyrighted [2011] [ForgeRock AS]
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport javax.xml.parsers.ParserConfigurationException;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Log Message IDs. It parses a Document Object Model of message IDs xml and
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * generates the HTML page.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private List<LogMessage> messages = new ArrayList<LogMessage>();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster throws ParserConfigurationException, SAXException, IOException {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster NodeList children = root.getElementsByTagName("logmessage");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster messages.add(new LogMessage((Element)children.item(i)));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String page = LogHtmlTemplate.page.replaceAll("@NAME@", name);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster page = page.replaceAll("@ID_OPTIONS@", getOptions());
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster page = page.replaceAll("@messages@", getMessagesHtml());
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster LogMessagesFormatter.writeToFile(page, name + ".html");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster buff.append(LogHtmlTemplate.option.replaceAll("@id@",
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private String getDisplayName(String fileName) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private List<String> datainfos = new ArrayList<String>();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private List<String> triggers = new ArrayList<String>();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private List<String> actions = new ArrayList<String>();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String html = LogHtmlTemplate.logmessage.replaceAll("@id@",
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster html = html.replaceAll("@description@", description);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster html = html.replaceAll("@datainfos@", listToString(datainfos));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster html = html.replaceAll("@triggers@", listToString(triggers));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster html = html.replaceAll("@actions@", listToString(actions));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private String listToString(List<String> list) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return " ";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private void getItems(Element elm, String name, List<String> list) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster NodeList children = elm.getElementsByTagName(name);