/************************************************************************* * * * SignServer: The OpenSource Automated Signing Server * * * * This software is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * * License as published by the Free Software Foundation; either * * version 2.1 of the License, or any later version. * * * * See terms of license at gnu.org. * * * *************************************************************************/ package org.signserver.admin.gui; import java.text.SimpleDateFormat; import java.util.Date; import org.signserver.admin.gui.adminws.gen.LogEntry; import org.signserver.admin.gui.adminws.gen.LogEntry.AdditionalDetails; /** * Frame displaying the details of an audit log row. * * @author Markus KilÄs * @version $Id: DisplayAuditlogEntryFrame.java 3318 2013-02-09 15:13:29Z netmackan $ */ public class DisplayAuditlogEntryFrame extends javax.swing.JFrame { private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ"); private LogEntry entry; /** Creates new form DisplayAuditlogEntryFrame */ public DisplayAuditlogEntryFrame(LogEntry entry) { initComponents(); this.entry = entry; setTitle("Audit log entry " + entry.getSequenceNumber() + " on " + entry.getNodeId()); updateEditor(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); jEditorPane1 = new javax.swing.JEditorPane(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setLocationByPlatform(true); setName("Form"); // NOI18N jScrollPane1.setName("jScrollPane1"); // NOI18N org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(org.signserver.admin.gui.SignServerAdminGUIApplication.class).getContext().getResourceMap(DisplayAuditlogEntryFrame.class); jEditorPane1.setContentType(resourceMap.getString("jEditorPane1.contentType")); // NOI18N jEditorPane1.setEditable(false); jEditorPane1.setName("jEditorPane1"); // NOI18N jScrollPane1.setViewportView(jEditorPane1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 591, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 529, Short.MAX_VALUE) .addContainerGap()) ); pack(); }// //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JEditorPane jEditorPane1; private javax.swing.JScrollPane jScrollPane1; // End of variables declaration//GEN-END:variables private void updateEditor() { final StringBuilder buff = new StringBuilder(); buff.append("\n"); buff.append("\n"); buff.append("\n"); buff.append("\n"); buff.append("\n"); buff.append("\n"); buff.append("\n"); buff.append("\n"); buff.append("\n"); buff.append("\n"); buff.append("\n"); buff.append("\n") .append("\n"); buff.append("
Time:").append(sdf.format(new Date(entry.getTimeStamp()))).append(" (").append(entry.getTimeStamp()).append(")").append("
Outcome:").append(entry.getEventStatus()).append("
Event:").append(entry.getEventType()).append("
Module:").append(entry.getModuleType()).append("
Service:").append(entry.getServiceType()).append("
Admin Subject:").append(entry.getAuthToken()).append("
Admin Serial Number:").append(entry.getSearchDetail1()).append("
Admin Issuer:").append(entry.getCustomId()).append("
Worker ID:").append(entry.getSearchDetail2()).append("
Node:").append(entry.getNodeId()).append("
Details: 
"); renderDetails(buff, entry.getAdditionalDetails()); buff.append("
\n"); jEditorPane1.setText(buff.toString()); } private void renderDetails(StringBuilder buff, AdditionalDetails details) { for (LogEntry.AdditionalDetails.Entry entry : details.getEntry()) { buff.append(entry.getKey()).append("=").append(entry.getValue()).append("
\n"); } } }