You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2008/11/26 04:41:15 UTC
svn commit: r720725 [1/5] - in
/portals/jetspeed-2/applications/jsaudit/trunk: ./ pages/
pages/Administrative/ pages/Administrative/audit-reports/ src/ src/main/
src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/jetsp...
Author: taylor
Date: Tue Nov 25 19:41:12 2008
New Revision: 720725
URL: http://svn.apache.org/viewvc?rev=720725&view=rev
Log:
6 jetspeed audit report portlets:
AdminActivityReport
PasswordResetReport
SystemSecurityReport
UserCreationReport
UserDeletionReport
UserStatusReport
Added:
portals/jetspeed-2/applications/jsaudit/trunk/.classpath
portals/jetspeed-2/applications/jsaudit/trunk/.project
portals/jetspeed-2/applications/jsaudit/trunk/build.properties
portals/jetspeed-2/applications/jsaudit/trunk/build.xml
portals/jetspeed-2/applications/jsaudit/trunk/pages/
portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/
portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/
portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/admin_activity.psml
portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/admin_status.psml
portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/folder.metadata
portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/password_reset.psml
portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/system_security.psml
portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/user_creation.psml
portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/user_deletion.psml
portals/jetspeed-2/applications/jsaudit/trunk/pom.xml
portals/jetspeed-2/applications/jsaudit/trunk/src/
portals/jetspeed-2/applications/jsaudit/trunk/src/main/
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/action-names.properties
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityAbstractReport.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityActionListener.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityDatabaseInteraction.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityList.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityReport.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditDatabaseInteraction.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditPhaseListener.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditQuery.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditReport.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditReportExcelExport.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/DataScrollerActionListener.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PagedSortableList.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PasswordResetActionListener.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PasswordResetReport.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalQuery.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalUserBean.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalUserJetspeedInteraction.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalUserReportPortlet.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOFailedLoginActionListener.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOLockedUserActionListener.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOOptOutActionListener.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOSuccessLoginActionListener.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOSystemSecurityActionListener.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOUserBean.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOUserList.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOUserStatusActionListener.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SortableList.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SystemSecurityActionListener.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SystemSecurityList.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SystemSecurityReport.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/UserActivityDatabaseInteraction.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/UserCreationActionListener.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/UserCreationReport.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/UserDeletionActionListener.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/UserDeletionReport.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/UserStatusActionListener.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/UserStatusList.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/UserStatusReport.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/audit_messages.properties
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/util/
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/util/SecurityHelper.java
portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/sso-reports.properties
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/WEB-INF/
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/WEB-INF/c-rt.tld
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/WEB-INF/examples-config.xml
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/WEB-INF/faces-config.xml
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/WEB-INF/jetspeed-portlet.xml
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/WEB-INF/portlet.tld
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/WEB-INF/portlet.xml
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/WEB-INF/reports/
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/WEB-INF/reports/adminActivityReport.jsp
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/WEB-INF/reports/passwordResetReport.jsp
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/WEB-INF/reports/systemSecurityReport.jsp
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/WEB-INF/reports/userCreationReport.jsp
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/WEB-INF/reports/userDeletionReport.jsp
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/WEB-INF/reports/userStatusReport.jsp
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/WEB-INF/web.xml
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/css/
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/css/basic.css
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/arrow-ff.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/arrow-first.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/arrow-fr.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/arrow-last.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/arrow-next.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/arrow-previous.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/ascending-arrow.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/blue-folder-closed.png (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/blue-folder-open.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/component.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/descending-arrow.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/document.png (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/excel.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/help.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/line-last.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/line-middle.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/line-trunk.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/logo.jpg (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/logo_mini.jpg (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/myfaces.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/myfaces_powered.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/myfaces_powered_over.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/person.png (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/spacer.gif (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/yellow-folder-closed.png (with props)
portals/jetspeed-2/applications/jsaudit/trunk/src/webapp/images/yellow-folder-open.png (with props)
Added: portals/jetspeed-2/applications/jsaudit/trunk/.classpath
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/.classpath?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/.classpath (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/.classpath Tue Nov 25 19:41:12 2008
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: portals/jetspeed-2/applications/jsaudit/trunk/.project
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/.project?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/.project (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/.project Tue Nov 25 19:41:12 2008
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jsaudit</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ </natures>
+</projectDescription>
Added: portals/jetspeed-2/applications/jsaudit/trunk/build.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/build.properties?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/build.properties (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/build.properties Tue Nov 25 19:41:12 2008
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+app.server.home = /jdev/servers/tomcat5
+portal.name = jetspeed
+pa.name = jsaudit2
Added: portals/jetspeed-2/applications/jsaudit/trunk/build.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/build.xml?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/build.xml (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/build.xml Tue Nov 25 19:41:12 2008
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<project name="jsaudit2" default="delta" basedir=".">
+
+<property file="${user.home}/build.properties"/>
+<property file="build.properties"/>
+
+<target name='delta'>
+ <copy todir="${app.server.home}/webapps/${pa.name}/">
+ <fileset dir="./WebContent/"/>
+ </copy>
+</target>
+
+<target name='test'>
+ <echo>app server home is ${app.server.home}</echo>
+</target>
+
+<target name='deploy'>
+ <echo>${app.server.home}</echo>
+ <copy tofile="${app.server.home}/webapps/jsaudit2.war">
+ <fileset file="target/jsaudit2-1.0.war"/>
+ </copy>
+</target>
+
+</project>
\ No newline at end of file
Added: portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/admin_activity.psml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/admin_activity.psml?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/admin_activity.psml (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/admin_activity.psml Tue Nov 25 19:41:12 2008
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<page id="/default-page.psml" hidden="false">
+ <title>Admin Activity</title>
+ <short-title>Admin Activity</short-title>
+ <defaults/>
+ <fragment id="jsadminact-1" type="layout" name="jetspeed-layouts::VelocityOneColumn">
+ <fragment id="P-11401a21e7a-10001z" type="portlet" name="jsaudit::AdminActivityReport">
+ <property name="row" value="0"/>
+ <property name="column" value="0"/>
+ </fragment>
+ </fragment>
+
+ <security-constraints>
+ <security-constraints-ref>admin</security-constraints-ref>
+ </security-constraints>
+</page>
Added: portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/admin_status.psml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/admin_status.psml?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/admin_status.psml (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/admin_status.psml Tue Nov 25 19:41:12 2008
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<page id="/default-page.psml" hidden="false">
+ <title>User Status</title>
+ <short-title>User Status</short-title>
+ <defaults/>
+ <fragment id="jsadminstatus-1" type="layout" name="jetspeed-layouts::VelocityOneColumn">
+ <fragment id="P-11401a2306c-10002" type="portlet" name="jsaudit::UserStatusReport">
+ <property name="row" value="0"/>
+ <property name="column" value="0"/>
+ </fragment>
+ </fragment>
+
+ <security-constraints>
+ <security-constraints-ref>admin</security-constraints-ref>
+ </security-constraints>
+</page>
Added: portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/folder.metadata
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/folder.metadata?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/folder.metadata (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/folder.metadata Tue Nov 25 19:41:12 2008
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<folder
+ xmlns="http://portals.apache.org/jetspeed"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://portals.apache.org/jetspeed http://portals.apache.org/jetspeed-2/2.1/schemas/folder-metadata.xsd">
+ <title >Administrative Audit Reports</title>
+
+ <document-order>admin_activity.psml</document-order>
+ <document-order>admin_status.psml</document-order>
+ <document-order>system_security.psml</document-order>
+ <document-order>password_reset.psml</document-order>
+ <document-order>user_deletion.psml</document-order>
+ <document-order>user_creation.psml</document-order>
+ <document-order>sso_user_status.psml</document-order>
+ <document-order>sso_failed_login.psml</document-order>
+ <document-order>sso_locked_user.psml</document-order>
+ <document-order>sso_optout.psml</document-order>
+ <document-order>sso_success_login.psml</document-order>
+ <document-order>sso_system_security.psml</document-order>
+
+ <security-constraints>
+ <security-constraints-ref>admin</security-constraints-ref>
+ </security-constraints>
+</folder>
Added: portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/password_reset.psml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/password_reset.psml?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/password_reset.psml (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/password_reset.psml Tue Nov 25 19:41:12 2008
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<page id="/default-page.psml" hidden="false">
+ <title>Password Reset</title>
+ <short-title>Password Reset</short-title>
+ <defaults/>
+ <fragment id="password-reset0" type="layout" name="jetspeed-layouts::VelocityOneColumn">
+ <fragment id="password-reset1" type="portlet" name="jsaudit::PasswordResetReport">
+ <property name="row" value="0"/>
+ <property name="column" value="0"/>
+ </fragment>
+ </fragment>
+
+ <security-constraints>
+ <security-constraints-ref>admin</security-constraints-ref>
+ </security-constraints>
+</page>
Added: portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/system_security.psml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/system_security.psml?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/system_security.psml (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/system_security.psml Tue Nov 25 19:41:12 2008
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<page id="/default-page.psml" hidden="false">
+ <title>System Security</title>
+ <short-title>System Security</short-title>
+ <defaults/>
+ <fragment id="jssyssecurity-1" type="layout" name="jetspeed-layouts::VelocityOneColumn">
+ <fragment id="P-11401a2306c-10009" type="portlet" name="jsaudit::SystemSecurityReport">
+ <property name="row" value="0"/>
+ <property name="column" value="0"/>
+ </fragment>
+ </fragment>
+
+ <security-constraints>
+ <security-constraints-ref>admin</security-constraints-ref>
+ </security-constraints>
+</page>
Added: portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/user_creation.psml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/user_creation.psml?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/user_creation.psml (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/user_creation.psml Tue Nov 25 19:41:12 2008
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<page id="/default-page.psml" hidden="false">
+ <title>User Creation</title>
+ <short-title>User Creation</short-title>
+ <defaults/>
+ <fragment id="user-creation0" type="layout" name="jetspeed-layouts::VelocityOneColumn">
+ <fragment id="user-creation1" type="portlet" name="jsaudit::UserCreationReport">
+ <property name="row" value="0"/>
+ <property name="column" value="0"/>
+ </fragment>
+ </fragment>
+
+ <security-constraints>
+ <security-constraints-ref>admin</security-constraints-ref>
+ </security-constraints>
+</page>
Added: portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/user_deletion.psml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/user_deletion.psml?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/user_deletion.psml (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/pages/Administrative/audit-reports/user_deletion.psml Tue Nov 25 19:41:12 2008
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<page id="/default-page.psml" hidden="false">
+ <title>User Deletion</title>
+ <short-title>User Deletion</short-title>
+ <defaults/>
+ <fragment id="user-deletion0" type="layout" name="jetspeed-layouts::VelocityOneColumn">
+ <fragment id="user-deletion1" type="portlet" name="jsaudit::UserDeletionReport">
+ <property name="row" value="0"/>
+ <property name="column" value="0"/>
+ </fragment>
+ </fragment>
+
+ <security-constraints>
+ <security-constraints-ref>admin</security-constraints-ref>
+ </security-constraints>
+</page>
Added: portals/jetspeed-2/applications/jsaudit/trunk/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/pom.xml?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/pom.xml (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/pom.xml Tue Nov 25 19:41:12 2008
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+ $Id:$
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <prerequisites>
+ <maven>2.0.4</maven>
+ </prerequisites>
+
+ <!-- POM Identification -->
+
+ <artifactId>jsaudit</artifactId>
+ <groupId>org.apache.portals.jetspeed-2</groupId>
+ <version>2.2-SNAPSHOT</version>
+ <packaging>war</packaging>
+ <name>Jetspeed Audit Reports Portlet Application</name>
+
+ <properties>
+ <jetspeed.version>2.1.3</jetspeed.version>
+ <bridges.version>1.0.4</bridges.version>
+ </properties>
+
+ <!-- Dependencies -->
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.portals.jetspeed-2</groupId>
+ <artifactId>jetspeed-api</artifactId>
+ <version>${jetspeed.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.portals.jetspeed-2</groupId>
+ <artifactId>jetspeed-commons</artifactId>
+ <version>${jetspeed.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Pluto Container -->
+ <dependency>
+ <groupId>org.apache.pluto</groupId>
+ <artifactId>pluto</artifactId>
+ <version>1.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.portals.bridges</groupId>
+ <artifactId>portals-bridges-common</artifactId>
+ <version>${bridges.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.portals.bridges</groupId>
+ <artifactId>portals-bridges-jsf</artifactId>
+ <version>${bridges.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>myfaces</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>1.1.5</version>
+ </dependency>
+ <dependency>
+ <groupId>myfaces</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>1.1.5</version>
+ </dependency>
+ <dependency>
+ <groupId>myfaces</groupId>
+ <artifactId>tomahawk</artifactId>
+ <version>1.1.6</version>
+ </dependency>
+ <dependency>
+ <groupId>portlet-api</groupId>
+ <artifactId>portlet-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>poi</groupId>
+ <artifactId>poi</artifactId>
+ <version>2.5.1-final-20040804</version>
+ </dependency>
+ <dependency>
+ <groupId>taglibs</groupId>
+ <artifactId>standard</artifactId>
+ <version>1.1.2</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>taglibs</groupId>
+ <artifactId>request</artifactId>
+ <version>1.0.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-validator</groupId>
+ <artifactId>commons-validator</artifactId>
+ <version>1.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>oro</groupId>
+ <artifactId>oro</artifactId>
+ <version>2.0.8</version>
+ <scope>runtime</scope>
+ </dependency>
+
+
+ </dependencies>
+
+ <!-- Build Configuration -->
+
+ <build>
+
+ <!-- J2 Standard Directories -->
+ <sourceDirectory>src/main/java</sourceDirectory>
+
+ <!-- Resources -->
+ <resources>
+ <resource>
+ <directory>${basedir}/src/main/java</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <!-- Plugins -->
+ <plugins>
+ <!-- WAR plugin -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.0</version>
+ <configuration>
+ <webResources>
+ <resource>
+ <directory>${basedir}/src/webapp</directory>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ <debug>true</debug>
+ <showDeprecation>true</showDeprecation>
+ <showWarnings>true</showWarnings>
+ <optimize>false</optimize>
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+ </build>
+
+</project>
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/action-names.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/action-names.properties?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/action-names.properties (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/action-names.properties Tue Nov 25 19:41:12 2008
@@ -0,0 +1,43 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+login-success = Successful login
+login-failure = Failed login
+password-success = Successful change of password
+password-failure = Failed change of password
+
+user-create = Created user
+user-update = Updated user
+user-delete = Deleted user
+user-disable = Disabled user
+user-extend = Extended password
+user-extend-unlimited = Extended password (unlimited)
+
+password-expire = Expired password
+password-reset = Reset password
+password-activate = Activated password
+password-enabled = (Re)enabled password
+password-disabled = Disabled password
+password-update-req = Required update to password
+
+user-add-role = Added role to user
+user-delete-role = Deleted role from user
+user-add-group = Added user to group
+user-delete-group = Removed user from group
+user-add-profile = Added profile to user
+user-delete-profile = Removed profile from user
+
+user-add-attr = Added attribute to user
+user-delete-attr = Deleted attribute from user
+user-update-attr = Updated attribute for user
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityAbstractReport.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityAbstractReport.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityAbstractReport.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityAbstractReport.java Tue Nov 25 19:41:12 2008
@@ -0,0 +1,185 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlets.audit;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.zip.DataFormatException;
+
+import javax.faces.context.FacesContext;
+
+import javax.portlet.PortletRequest;
+
+public abstract class AdminActivityAbstractReport extends AdminActivityList implements AuditReport
+{
+ PortalUserJetspeedInteraction jsi;
+ AuditDatabaseInteraction ai;
+
+ LinkedList rows;
+
+ Object[][] rowsByIndex;
+ SortedMap[] rowsAsMaps;
+
+ public AdminActivityAbstractReport()
+ {
+ jsi = new PortalUserJetspeedInteraction();
+ ai = new AdminActivityDatabaseInteraction();
+ }
+
+ public AdminActivityAbstractReport( PortalUserJetspeedInteraction _jsi, AuditDatabaseInteraction _dbi )
+ {
+ jsi = _jsi;
+ ai = _dbi;
+ }
+
+ protected void setQueryParameters( AuditQuery query )
+ {
+ getDbi().setParams(query);
+ }
+
+ public void executeQuery(AuditQuery query)
+ {
+ try
+ {
+ jsi.init();
+ setQueryParameters( query );
+ ai.init(jsi.getDataSource());
+
+ rows = new LinkedList();
+
+ Map jetspeedBeans = new HashMap();
+ List activityBeans = ai.getAllAsList();
+
+ Iterator iter = activityBeans.iterator();
+ while ( iter.hasNext() )
+ {
+ PortalUserBean activityBean = (PortalUserBean)iter.next();
+ PortalUserBean bean = null;
+ if ( ! rowsHaveUserBean() )
+ bean = activityBean;
+ else
+ {
+ try
+ {
+ PortalUserBean userBean = (PortalUserBean)jetspeedBeans.get( (String)activityBean.getUserid() );
+ if (userBean == null)
+ {
+ userBean = jsi.getUserBean(activityBean.getUserid());
+ }
+ if ( userBean != null )
+ {
+ bean = new PortalUserBean(userBean, activityBean);
+ }
+ else
+ { // user has probably been deleted
+ bean = activityBean;
+ }
+ }
+ catch (DataFormatException e)
+ {
+ System.err.println("Internal error while joining Jetspeed and Activity data; results will be invalid.");
+ System.err.println("Received error: " + e.toString() );
+ }
+ }
+ // Make the activities user-readable.
+ bean.setAction( getDbi().getActivityDescription( bean.getAction() ) );
+ rows.add( (PortalUserBean)bean );
+ }
+
+ Object contextRequest = FacesContext.getCurrentInstance().getExternalContext().getRequest();
+ if ( contextRequest instanceof PortletRequest )
+ {
+ PortletRequest request = (PortletRequest)contextRequest;
+ PortalUserReportPortlet.setLastDataRows( request, rows );
+ PortalUserReportPortlet.setLastDataReport( request, this );
+ }
+ else
+ {
+ System.out.println( this.getClass().getName() + ".doView unknown request type " + ( contextRequest == null ? "null" : contextRequest.getClass().getName() ) );
+ }
+
+ //Map requestAttributes = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+ //requestAttributes.put("doExcel", new Boolean( true ) );
+ }
+ catch (Exception e)
+ {
+ // TODO: throw your own exception wrappers
+ e.printStackTrace();
+ }
+ }
+
+ protected boolean rowsHaveUserBean()
+ {
+ return true;
+ }
+
+ public void init()
+ {
+ }
+
+ public Class getBeanClass()
+ {
+ return PortalUserBean.class;
+ }
+
+ public List getAdminActivityList()
+ {
+ return getAllAsList();
+ }
+
+ public List getAllAsList()
+ {
+ return rows;
+ }
+
+ public abstract String[] getColumnNames();
+ public abstract SortedMap[] getRows();
+ public abstract Object[][] getRowsByIndex();
+
+ public int getRowCount()
+ {
+ return rows.size();
+ }
+
+ public boolean isLimitedByMaxRows()
+ {
+ // Always false because none of the underlying classes support such limits.
+ return false;
+ }
+
+
+ public AuditDatabaseInteraction getDbi() {
+ return ai;
+ }
+
+ protected void setDbi(AuditDatabaseInteraction dbi) {
+ this.ai = dbi;
+ }
+
+ public PortalUserJetspeedInteraction getJsi() {
+ return jsi;
+ }
+
+ protected void setJsi(PortalUserJetspeedInteraction jsi) {
+ this.jsi = jsi;
+ }
+
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityActionListener.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityActionListener.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityActionListener.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityActionListener.java Tue Nov 25 19:41:12 2008
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlets.audit;
+
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.VariableResolver;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+
+public class AdminActivityActionListener implements ActionListener
+{
+ Map searchParams = null;
+
+ public void processAction( ActionEvent event ) throws AbortProcessingException
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ UIComponent component = event.getComponent();
+
+ VariableResolver vr = facesContext.getApplication().getVariableResolver();
+ PortalQuery form = (PortalQuery)vr.resolveVariable(facesContext, "filterBean");
+
+ if ( form == null )
+ {
+ System.out.println("Ack! Tried to resolve a variable that doesn't exist!");
+ return;
+ }
+
+ if ( component.getId().equals( "filterButton" ) )
+ {
+ AuditReport report = (AuditReport)vr.resolveVariable(facesContext, "adminActivities");
+ report.executeQuery(form);
+ }
+ }
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityDatabaseInteraction.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityDatabaseInteraction.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityDatabaseInteraction.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityDatabaseInteraction.java Tue Nov 25 19:41:12 2008
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlets.audit;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.LinkedList;
+
+public class AdminActivityDatabaseInteraction extends AuditDatabaseInteraction
+{
+ protected String createSQLStatement()
+ {
+ return createSQLSelectStatement( "ADMIN_ACTIVITY" );
+ }
+
+ protected LinkedList processResultSet( ResultSet rs ) throws SQLException
+ {
+ LinkedList resultRows = new LinkedList();
+ while ( rs.next() )
+ {
+ PortalUserBean bean = new PortalUserBean();
+
+ // TODO: Use a Properties object instead of hardcoded values.
+ bean.setUserid( rs.getString("USER_NAME") );
+ bean.setAction( rs.getString("ACTIVITY") );
+ bean.setElement( rs.getString("ATTR_NAME") );
+ bean.setBeforeValue( rs.getString("ATTR_VALUE_BEFORE") );
+ bean.setAfterValue( rs.getString("ATTR_VALUE_AFTER") );
+ bean.setModifiedBy( rs.getString("ADMIN") );
+ bean.setModifiedDate( rs.getString("TIME_STAMP") );
+ bean.setIpAddress( rs.getString("IPADDRESS") );
+
+ resultRows.add( (PortalUserBean)bean );
+ }
+ return resultRows;
+ }
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityList.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityList.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityList.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityList.java Tue Nov 25 19:41:12 2008
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlets.audit;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.SortedMap;
+
+import javax.servlet.jsp.jstl.sql.Result;
+
+import org.apache.jetspeed.security.SecurityException;
+
+public class AdminActivityList extends PagedSortableList
+{
+
+ protected void fetch( Result data ) throws SecurityException
+ {
+ PortalUserBean bean;
+ SortedMap[] table = data.getRows();
+
+ for (int i=0; i<table.length; i++)
+ {
+ bean = new PortalUserBean();
+ bean.setUserid( (String)table[i].get("userid") );
+ bean.setFirstName( (String)table[i].get("firstName") );
+ bean.setLastName( (String)table[i].get("lastName") );
+ bean.setCompanyName( (String)table[i].get("companyName") );
+ bean.setElement( (String)table[i].get("element") );
+ bean.setBeforeValue( (String)table[i].get("beforeValue") );
+ bean.setAfterValue( (String)table[i].get("afterValue") );
+ bean.setModifiedBy( (String)table[i].get("deletedBy") );
+ bean.setModifiedDate( (String)table[i].get("deletedDate") );
+ bean.setIpAddress( (String)table[i].get("ipAddress") );
+
+ rowList.add(bean);
+ }
+ }
+
+ // FIXME: Doesn't seem to work.
+ protected void sort(final String column, final boolean ascending)
+ {
+ Comparator comparator = new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ PortalUserBean u1 = (PortalUserBean) o1;
+ PortalUserBean u2 = (PortalUserBean) o2;
+ if (column == null)
+ {
+ return 0;
+ }
+ if (column.equals("userid"))
+ {
+ return ascending ? (u1.getUserid().compareTo(u2.getUserid()))
+ : (u2.getUserid().compareTo(u1.getUserid()));
+ }
+ else if (column.equals("firstName"))
+ {
+ return ascending ? u1.getFirstName().compareTo(u2.getFirstName())
+ : u2.getFirstName().compareTo(u1.getFirstName());
+ }
+ else if (column.equals("lastName"))
+ {
+ return ascending ? u1.getLastName().compareTo(u2.getLastName())
+ : u2.getLastName().compareTo(u1.getLastName());
+ }
+ else if (column.equals("companyName"))
+ {
+ return ascending ? u1.getCompanyName().compareTo(u2.getCompanyName())
+ : u2.getCompanyName().compareTo(u1.getCompanyName());
+ }
+ else if (column.equals("element"))
+ {
+ return ascending ? (int)(u1.getElement().compareTo( u2.getElement().toString() ))
+ : (int)(u2.getElement().compareTo( u1.getElement().toString() ));
+ }
+ else if (column.equals("beforeValue"))
+ {
+ return ascending ? u1.getBeforeValue().compareTo(u2.getBeforeValue())
+ : u2.getBeforeValue().compareTo(u1.getBeforeValue());
+ }
+ else if (column.equals("afterValue"))
+ {
+ return ascending ? (int)(u1.getAfterValue().compareTo( u2.getAfterValue().toString() ))
+ : (int)(u2.getAfterValue().compareTo( u1.getAfterValue().toString() ));
+ }
+ else if (column.equals("deletedBy"))
+ {
+ return ascending ? u1.getModifiedBy().compareTo(u2.getModifiedBy())
+ : u2.getModifiedBy().compareTo(u1.getModifiedBy());
+ }
+ else if (column.equals("deletedDate"))
+ {
+ return ascending ? u1.getModifiedDate().compareTo(u2.getModifiedDate())
+ : u2.getModifiedDate().compareTo(u1.getModifiedDate());
+ }
+ else if (column.equals("ipAddress"))
+ {
+ return ascending ? u1.getIpAddress().compareTo(u2.getIpAddress())
+ : u2.getIpAddress().compareTo(u1.getIpAddress());
+ }
+ else
+ return 0;
+ }
+ };
+ Collections.sort(rowList, comparator);
+ }
+
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityReport.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityReport.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityReport.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AdminActivityReport.java Tue Nov 25 19:41:12 2008
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlets.audit;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.zip.DataFormatException;
+
+public class AdminActivityReport extends AdminActivityAbstractReport
+{
+ public AdminActivityReport()
+ {
+ super();
+ }
+
+ public AdminActivityReport( PortalUserJetspeedInteraction _jsi, AdminActivityDatabaseInteraction _dbi )
+ {
+ super( _jsi, _dbi );
+ }
+
+ protected void setQueryParameters( AuditQuery query )
+ {
+ super.setQueryParameters( query );
+ }
+
+ public String[] getColumnNames()
+ {
+ final String[] names = {"userid", "firstName", "lastName",
+ "companyName", "element", "beforeValue",
+ "afterValue", "modifiedBy", "modifiedDate",
+ "ipAddress" };
+ return names;
+ }
+
+ public SortedMap[] getRows()
+ {
+ if ( rowsAsMaps == null )
+ {
+ rowsAsMaps = new SortedMap[ rows.size() ];
+
+ Iterator iter = rows.iterator();
+ int count = 0;
+ while ( iter.hasNext() )
+ {
+ PortalUserBean bean = (PortalUserBean)iter.next();
+
+ rowsAsMaps[count].put("userid", bean.getUserid() );
+ rowsAsMaps[count].put("firstName", bean.getFirstName() );
+ rowsAsMaps[count].put("lastName", bean.getLastName() );
+ rowsAsMaps[count].put("companyName", bean.getCompanyName() );
+ rowsAsMaps[count].put("element", bean.getElement() );
+ rowsAsMaps[count].put("beforeValue", bean.getBeforeValue() );
+ rowsAsMaps[count].put("afterValue", bean.getAfterValue() );
+ rowsAsMaps[count].put("modifiedBy", bean.getModifiedBy() );
+ rowsAsMaps[count].put("modifiedDate", bean.getModifiedDate() );
+ rowsAsMaps[count].put("ipAddress", bean.getIpAddress() );
+
+ count++;
+ }
+ }
+
+ return rowsAsMaps;
+ }
+
+ public Object[][] getRowsByIndex()
+ {
+ if ( rowsByIndex == null )
+ {
+ rowsByIndex = new Object[ rows.size() ][10];
+
+ Iterator iter = rows.iterator();
+ int count = 0;
+ while ( iter.hasNext() )
+ {
+ PortalUserBean bean = (PortalUserBean)iter.next();
+
+ rowsByIndex[count][0] = bean.getUserid();
+ rowsByIndex[count][1] = bean.getFirstName();
+ rowsByIndex[count][2] = bean.getLastName();
+ rowsByIndex[count][3] = bean.getCompanyName();
+ rowsByIndex[count][4] = bean.getElement();
+ rowsByIndex[count][5] = bean.getBeforeValue();
+ rowsByIndex[count][6] = bean.getAfterValue();
+ rowsByIndex[count][7] = bean.getModifiedBy();
+ rowsByIndex[count][8] = bean.getModifiedDate();
+ rowsByIndex[count][9] = bean.getIpAddress();
+
+ count++;
+ }
+ }
+
+ return rowsByIndex;
+ }
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditDatabaseInteraction.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditDatabaseInteraction.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditDatabaseInteraction.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditDatabaseInteraction.java Tue Nov 25 19:41:12 2008
@@ -0,0 +1,306 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlets.audit;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.sql.DataSource;
+
+public abstract class AuditDatabaseInteraction
+{
+ private LinkedList rows;
+ private Map table;
+ private DataSource ds;
+
+ private String order_by;
+ private boolean order_by_descending;
+
+ protected Properties activities;
+ protected Map activitiesByDescription;
+
+ protected AuditQuery params = null;
+
+ public void init(DataSource ds) throws SQLException, ClassNotFoundException, IllegalAccessException, InstantiationException
+ {
+ this.ds = ds;
+ rows = null;
+
+ InputStream ins = null;
+ try
+ {
+ ins = this.getClass().getClassLoader().getResourceAsStream("action-names.properties");
+ Properties names = new Properties();
+ activities = new Properties();
+ activitiesByDescription = new HashMap();
+ names.load(ins);
+ Set props = names.keySet();
+ Iterator iter = props.iterator();
+ while ( iter.hasNext() )
+ {
+ String key = (String)iter.next();
+ String value = (String)names.getProperty(key);
+ activities.put(key, value);
+ activitiesByDescription.put(value.toLowerCase(), key);
+ }
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if ( ins != null )
+ {
+ try
+ {
+ ins.close();
+ }
+ catch (IOException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ protected abstract String createSQLStatement();
+
+ protected abstract LinkedList processResultSet( ResultSet rs ) throws SQLException;
+
+ List getAllAsList() throws SQLException
+ {
+ Connection conn = null;
+ Statement stmt = null;
+ ResultSet rs = null;
+
+ // We don't really want to handle exceptions here, but we need to make
+ // sure that the database connection gets closed when we're done,
+ // whether or not we successfully read from the database.
+ if ( rows == null )
+ {
+ try
+ {
+ conn = ds.getConnection();
+ stmt = conn.createStatement();
+ this.rows = null;
+ this.table = null;
+
+ String cmd = createSQLStatement();
+
+ rs = stmt.executeQuery(cmd);
+
+ this.rows = processResultSet( rs );
+ }
+ catch (SQLException e)
+ {
+ // Just re-throw.
+ throw e;
+ }
+ finally
+ {
+ if (rs != null)
+ {
+ try
+ {
+ rs.close();
+ }
+ catch (Exception e)
+ {
+ System.err.println("Warning: could not close ResultSet for " + this.getClass().getName() + ".");
+ }
+ }
+ if (stmt != null)
+ {
+ try
+ {
+ stmt.close();
+ }
+ catch (Exception e)
+ {
+ System.err.println("Warning: could not close Statement for " + this.getClass().getName() + ".");
+ }
+ }
+ if (conn != null)
+ {
+ try
+ {
+ conn.close();
+ }
+ catch (Exception e)
+ {
+ System.err.println("Warning: could not close Connection for " + this.getClass().getName() + ".");
+ }
+ }
+ }
+ }
+
+ return rows;
+ }
+
+ protected String createSQLSelectStatement( String tableName )
+ {
+ StringBuffer query = new StringBuffer();
+ query.append( "SELECT * FROM " ).append( tableName );
+ if ( this.params != null )
+ {
+ Map map = this.params.getParams();
+ Set keys = map.keySet();
+ Iterator iter = keys.iterator();
+ int count = 0;
+
+ // TODO: Implement some kind of fuzzy searching
+
+ while ( iter.hasNext() )
+ {
+ String key = (String)iter.next();
+
+ if ( count == 0 )
+ {
+ query.append( " WHERE " );
+ }
+ else
+ {
+ query.append( " AND " );
+ }
+ String value = ((String)map.get(key)).trim();
+ if ( key.equals("ACTIVITY") )
+ {
+ if ( value != null && value.length() > 0 )
+ {
+ String activityIdentifier = getActivityIdentifier( value );
+ query.append( key ).append( " = \'" ).append( activityIdentifier ).append( "\'" );
+ count++;
+ }
+ }
+ else if ( key.endsWith("_DATE_START") )
+ {
+ query.append( "TIME_STAMP" ).append( " >= '" ).append( value ).append( "\'" );
+ count++;
+ }
+ else if ( key.endsWith("_DATE_END") )
+ {
+ query.append( "TIME_STAMP" ).append( " <= '" ).append( value ).append( "\'" );
+ count++;
+ }
+ else
+ {
+ query.append( key ).append( " = \'" ).append( value ).append( "\'" );
+ count++;
+ }
+ }
+ String orderByColumnName = getOrderBy();
+ if ( orderByColumnName != null && orderByColumnName.length() > 0 )
+ {
+ query.append( " ORDER BY " ).append( orderByColumnName );
+ if ( isOrderByDescending() )
+ {
+ query.append( " DESC" );
+ }
+ }
+ }
+ System.out.println( "SQL Statement: " + query.toString() );
+ return query.toString();
+ }
+
+
+ Map getAllAsMap() throws SQLException
+ {
+ // Make sure that the list has been generated, since we need it to
+ // generate the map.
+ getAllAsList();
+
+ if ( table == null )
+ {
+ table = new Hashtable();
+ Iterator iter = rows.iterator();
+
+ while ( iter.hasNext() )
+ {
+ PortalUserBean bean = (PortalUserBean)iter.next();
+ String id = bean.getUserid();
+ table.put( (String)id, (PortalUserBean)bean );
+ }
+ }
+
+ return table;
+ }
+
+ public String getActivityDescription( String activityIdentifier )
+ {
+ String activityDescription = null;
+ if ( activityIdentifier != null )
+ {
+ if ( this.activities != null )
+ activityDescription = this.activities.getProperty( activityIdentifier );
+ if ( activityDescription == null )
+ activityDescription = "(" + activityIdentifier + ")";
+ }
+ return activityDescription;
+ }
+ public String getActivityIdentifier( String activityDescription )
+ {
+ String activityIdentifier = null;
+ if ( activityDescription != null )
+ {
+ if ( this.activitiesByDescription != null )
+ activityIdentifier = (String)this.activitiesByDescription.get( activityDescription.toLowerCase() );
+ if ( activityIdentifier == null )
+ activityIdentifier = activityDescription;
+ }
+ return activityIdentifier;
+ }
+
+ public AuditQuery getParams() {
+ return params;
+ }
+
+ public void setParams(AuditQuery params) {
+ this.params = params;
+ }
+
+ public String getOrderBy()
+ {
+ return this.order_by;
+ }
+ public boolean isOrderByDescending()
+ {
+ return this.order_by_descending;
+ }
+
+ public void setOrderBy( String orderByColumn )
+ {
+ this.order_by = orderByColumn;
+ }
+ public void setOrderByDescending( boolean orderByDescending )
+ {
+ this.order_by_descending = orderByDescending;
+ }
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditPhaseListener.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditPhaseListener.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditPhaseListener.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditPhaseListener.java Tue Nov 25 19:41:12 2008
@@ -0,0 +1,221 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlets.audit;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.portlet.RenderResponse;
+import javax.portlet.RenderRequest;
+
+import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseListener;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.component.ValueHolder;
+import javax.faces.component.html.HtmlDataTable;
+
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFRow;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.PortalReservedParameters;
+
+public class AuditPhaseListener implements PhaseListener
+{
+ // NOTE: this class is not currently used - AuditReportExcelExport is used instead
+ // the approach to excel generation used here would be better, but I could not get response.reset() to clear the jsp content,
+ // which resulted in html content followed by excel binary
+
+
+ // Return the identifier of the request processing phase during which this listener is interested in processing PhaseEvent events.
+ public PhaseId getPhaseId()
+ {
+ return PhaseId.RENDER_RESPONSE; // PhaseId.RESTORE_VIEW;
+ }
+
+ // Handle a notification that the processing for a particular phase of the request processing lifecycle is about to begin.
+ public void beforePhase(PhaseEvent event)
+ {
+ PhaseId pId = event.getPhaseId();
+ FacesContext facesContext = event.getFacesContext();
+ System.out.println( "beforePhase phaseId=" + ( pId == null ? "null" : pId.toString() ) + " facesContext=" + ( facesContext == null ? "null" : facesContext.toString() ) );
+ }
+
+ // Handle a notification that the processing for a particular phase has just been completed.
+ public void afterPhase(PhaseEvent phaseEvent)
+ {
+ PhaseId pId = phaseEvent.getPhaseId();
+ FacesContext facesContext = phaseEvent.getFacesContext();
+
+ System.out.println( "afterPhase phaseId=" + ( pId == null ? "null" : pId.toString() ) + " facesContext=" + ( facesContext == null ? "null" : facesContext.toString() ) );
+
+ Map requestParameters = facesContext.getExternalContext().getRequestParameterMap();
+ //Map requestAttributes = facesContext.getExternalContext().getRequestMap();
+ //Object useContentType = requestAttributes.get( PortalUserReportPortlet.ATTRIBUTE_ALT_CONTENT_TYPE );
+ Object useContentType = requestParameters.get( PortalUserReportPortlet.PARAM_ALT_CONTENT_TYPE );
+ if ( useContentType != null && useContentType.equals( PortalUserReportPortlet.ALT_CONTENT_TYPE_EXCEL ) )
+ {
+ System.out.println( this.getClass().getName() + ".afterPhase() observing request attribute " + PortalUserReportPortlet.ATTRIBUTE_ALT_CONTENT_TYPE + "=" + useContentType.toString() );
+
+ String tableId = "data"; // (String) map.get("excelExportTableId");
+ String filename = "export.xls"; // (String) map.get("excelExportFileName");
+
+ try
+ {
+ UIComponent containerForm = facesContext.getViewRoot().findComponent( "dataForm" );
+ System.out.println( this.getClass().getName() + ".afterPhase() form(dataForm): " + ( containerForm == null ? "null" : containerForm.toString() ) );
+ if ( containerForm != null )
+ {
+ HtmlDataTable dataTable = (HtmlDataTable) containerForm.findComponent( tableId );
+ System.out.println( this.getClass().getName() + ".afterPhase() dataTable(" + tableId + "): " + ( dataTable == null ? "null" : dataTable.toString() ) );
+ if ( dataTable != null )
+ {
+ HSSFWorkbook generatedExcel = generateExcel( facesContext, dataTable );
+ try
+ {
+ Object contextRequest = facesContext.getExternalContext().getRequest();
+ Object contextResponse = facesContext.getExternalContext().getResponse();
+ if ( ( contextRequest instanceof RenderRequest ) && ( contextResponse instanceof RenderResponse ) )
+ {
+ RenderRequest request = (RenderRequest)contextRequest;
+ RenderResponse response = (RenderResponse)contextResponse;
+
+ RequestContext jsReqContext = (RequestContext)request.getAttribute( PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE );
+
+
+ jsReqContext.getResponse().reset();
+ response.setContentType( "application/vnd.ms-excel" ); // this is just to avoid no content-type is set error
+ jsReqContext.getResponse().setHeader( "Content-Type", "application/vnd.ms-excel" );
+ response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
+ jsReqContext.getResponse().setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
+ jsReqContext.getResponse().setHeader("Pragma", "public");
+ jsReqContext.getResponse().setHeader("Content-disposition", "attachment;filename=" + filename + ".xls");
+
+ //response.setContentType( "application/vnd.ms-excel" ); // this is just to avoid no content-type is set error
+ //jsReqContext.getResponse().setHeader( "Content-Type", "application/vnd.ms-excel" );
+ //jsReqContext.getResponse().setHeader( "Content-Disposition", "inline; filename=xdata.xls" );
+
+ writeExcelOutput( generatedExcel, response, filename );
+
+ //facesContext.getApplication().getStateManager().saveSerializedView( facesContext );
+ //facesContext.responseComplete();
+ System.out.println( this.getClass().getName() + ".afterPhase() special handling of " + PortalUserReportPortlet.ATTRIBUTE_ALT_CONTENT_TYPE + "=" + useContentType.toString() + " completed" );
+ }
+
+ }
+ catch ( Exception e )
+ {
+ System.out.println( this.getClass().getName() + " error-inner " + e.getClass().getName() + " - " + e.getMessage() );
+ e.printStackTrace();
+ throw new RuntimeException( e );
+ }
+ }
+ }
+ }
+ catch ( Exception e )
+ {
+ System.out.println( this.getClass().getName() + " error-outer " + e.getClass().getName() + " - " + e.getMessage() );
+ e.printStackTrace();
+ throw new RuntimeException( e );
+ }
+ }
+ }
+
+ private void writeExcelOutput( HSSFWorkbook workBook, RenderResponse response, String filename ) throws IOException
+ {
+ //response.setContentType( "application/vnd.ms-excel" );
+ //response.setProperty( RenderResponse.EXPIRATION_CACHE, "0" );
+ //response.setProperty( "Cache-Control", "must-revalidate, post-check=0, pre-check=0" );
+ //response.setProperty( "Pragma", "public" );
+ //response.setProperty( "Content-disposition", "attachment;filename=" + filename + ".xls" );
+
+ workBook.write( response.getPortletOutputStream() );
+ }
+
+ private List getColumns( HtmlDataTable table )
+ {
+ List columns = new ArrayList();
+ for( int i=0; i < table.getChildCount(); i++ )
+ {
+ UIComponent child = (UIComponent) table.getChildren().get( i );
+ if( child instanceof UIColumn )
+ {
+ columns.add( child );
+ }
+ }
+ return columns;
+ }
+
+ private HSSFWorkbook generateExcel( FacesContext facesContext, HtmlDataTable table )
+ {
+ HSSFWorkbook workbook = new HSSFWorkbook();
+ HSSFSheet sheet = workbook.createSheet(table.getId());
+ List columns = getColumns(table);
+ int currentRowIndex = table.getRowIndex();
+
+ addColumnHeaders(sheet, columns);
+ addColumnValues(sheet, columns, table);
+
+ table.setRowIndex( currentRowIndex );
+ return workbook;
+ }
+
+ private void addColumnValue( HSSFRow rowHeader, UIComponent component, int index )
+ {
+ HSSFCell cell = rowHeader.createCell((short)index);
+ cell.setEncoding(HSSFCell.ENCODING_UTF_16);
+ if( component instanceof ValueHolder )
+ {
+ String stringValue = RendererUtils.getStringValue(FacesContext.getCurrentInstance(), component);
+ cell.setCellValue(stringValue);
+ }
+ }
+
+ private void addColumnHeaders( HSSFSheet sheet, List columns )
+ {
+ HSSFRow rowHeader = sheet.createRow(0);
+
+ for ( int i=0; i < columns.size(); i++ )
+ {
+ UIColumn column = (UIColumn) columns.get(i);
+ addColumnValue(rowHeader, column.getHeader(), i);
+ }
+ }
+
+ private void addColumnValues( HSSFSheet sheet, List columns, HtmlDataTable dataTable )
+ {
+ for ( int i=0 ; i < dataTable.getRowCount(); i++ )
+ {
+ dataTable.setRowIndex(i);
+ HSSFRow row = sheet.createRow( i + 1 );
+ for ( int j=0; j < columns.size(); j++ )
+ {
+ UIColumn column = (UIColumn) columns.get(j);
+ addColumnValue(row, (UIComponent) column.getChildren().get(0), j);
+ }
+ }
+ }
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditQuery.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditQuery.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditQuery.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditQuery.java Tue Nov 25 19:41:12 2008
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlets.audit;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.ArrayList;
+
+public interface AuditQuery
+{
+ String getElement();
+ void setElement(String element);
+
+ String getIpAddress();
+ void setIpAddress(String ipAddress);
+
+ String getModifiedBy();
+ void setModifiedBy(String modifiedBy);
+
+ Date getLastLoginDateEnd();
+ void setLastLoginDateEnd(Date lastLoginDateEnd);
+ Date getLastLoginDateStart();
+ void setLastLoginDateStart(Date lastLoginDateStart);
+
+ Date getActivityDateEnd();
+ void setActivityDateEnd(Date activityDateEnd);
+ Date getActivityDateStart();
+ void setActivityDateStart(Date activityDateStart);
+
+ Date getGenericDateStart();
+ void setGenericDateStart(Date genericDateStart);
+ Date getGenericDateEnd();
+ void setGenericDateEnd(Date genericDateEnd);
+ String getGenericDateName();
+ void setGenericDateName(String genericDateName);
+
+ ArrayList getGenericDateNameList();
+ void setGenericDateNameList( ArrayList genericDateNameList );
+
+ String getCompanyName();
+ void setCompanyName(String companyName);
+
+ String getUserid();
+ void setUserid(String userid);
+
+ Map getParams();
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditReport.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditReport.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditReport.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditReport.java Tue Nov 25 19:41:12 2008
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlets.audit;
+
+import javax.servlet.jsp.jstl.sql.Result;
+
+public interface AuditReport extends Result
+{
+ void executeQuery(AuditQuery query);
+
+ String[] getColumnNames();
+
+ Class getBeanClass();
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org