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 [2/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...
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditReportExcelExport.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditReportExcelExport.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditReportExcelExport.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/AuditReportExcelExport.java Tue Nov 25 19:41:12 2008
@@ -0,0 +1,359 @@
+/*
+ * 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.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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;
+
+
+public class AuditReportExcelExport
+{
+ protected final Log logger = LogFactory.getLog( this.getClass() );
+ private static final String DATE_OUTPUT_PATTERN = "M/d/yyyy";
+
+ private Properties audit_messages;
+ private SimpleDateFormat date_output;
+
+
+ public AuditReportExcelExport()
+ {
+ this.date_output = new SimpleDateFormat( DATE_OUTPUT_PATTERN );
+ loadProperties();
+ }
+
+ public void loadProperties()
+ {
+ InputStream ins = null;
+ try
+ {
+ ins = this.getClass().getClassLoader().getResourceAsStream( "org/apache/jetspeed/portlets/audit/audit_messages.properties" );
+ Properties auditMsgs = new Properties();
+ auditMsgs.load(ins);
+ this.audit_messages = auditMsgs ;
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if ( ins != null )
+ {
+ try
+ {
+ ins.close();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+
+ public HSSFWorkbook createExcelWorkbook( AuditReport report, Class beanClass, List beanList )
+ {
+ if ( report == null || beanClass == null || beanList == null ) return null;
+
+ String[] colNames = report.getColumnNames();
+ String[] colDescs = new String[ colNames.length ];
+ for ( int i = 0 ; i < colNames.length ; i++ )
+ {
+ String loCamelColName = colNames[i];
+ String underscoreColName = Identifier.UnCamel( loCamelColName );
+
+ String colDesc = audit_messages.getProperty( "sort_" + underscoreColName );
+ colDescs[i] = colDesc;
+ //print( "col[" + i + "] loCamelName=" + loCamelColName + " underscoreName=" + underscoreColName + " desc=" + colDesc ) ;
+ }
+
+ HashMap readMethodMap = new HashMap();
+ try
+ {
+ BeanInfo beanInfo = Introspector.getBeanInfo( beanClass );
+ print( "Introspector.getBeanInfo - " + beanInfo.getClass().getName() + " - " + beanInfo.toString() );
+
+ PropertyDescriptor[] propDescriptors = beanInfo.getPropertyDescriptors();
+ if ( propDescriptors != null && propDescriptors.length > 0 )
+ {
+ for ( int i = 0 ; i < propDescriptors.length ; i++ )
+ {
+ PropertyDescriptor pd = propDescriptors[i];
+ Method pdread = pd.getReadMethod();
+ if ( pdread != null )
+ readMethodMap.put( pd.getName(), pdread );
+
+ //print( "prop[" + i + "] name=" + pd.getName() + " readmethod=" + ( pdread == null ? "null" : pdread.toString() ) );
+ }
+ }
+ }
+ catch ( Exception ex )
+ {
+ print( "Introspector.getBeanInfo error " + ex.getClass().getName() + " - " + ex.getMessage() );
+ }
+
+ Method[] readMethods = new Method[ colNames.length ];
+ for ( int i = 0 ; i < colNames.length ; i++ )
+ {
+ readMethods[i] = (Method)readMethodMap.get( colNames[i] );
+ }
+
+ //debugDumpData( beanList, colNames, colDescs, readMethodMap );
+ return generateExcel( beanList, colNames, colDescs, readMethods );
+ }
+
+ protected String columnValueToString( Object colValObj )
+ {
+ String colVal = null;
+ if ( colValObj == null )
+ colVal = "";
+ else
+ {
+ if ( colValObj instanceof Date )
+ {
+ colVal = date_output.format( (Date)colValObj);
+ }
+ else
+ {
+ colVal = colValObj.toString();
+ }
+ }
+ return colVal;
+ }
+
+ private HSSFWorkbook generateExcel( List beanList, String[] colNames, String[] colDescs, Method[] readMethods )
+ {
+ HSSFWorkbook workbook = new HSSFWorkbook();
+ HSSFSheet sheet = workbook.createSheet("export");
+
+ addColumnHeaders( sheet, colDescs );
+ addColumnValues( sheet, beanList, colNames, readMethods );
+
+ return workbook;
+ }
+
+ private void addColumnValue( HSSFRow rowHeader, String value, int index )
+ {
+ HSSFCell cell = rowHeader.createCell( (short)index );
+ cell.setEncoding( HSSFCell.ENCODING_UTF_16 );
+ if ( value == null )
+ value = "";
+ cell.setCellValue( value );
+ }
+
+ private void addColumnHeaders( HSSFSheet sheet, String[] colDescs )
+ {
+ HSSFRow rowHeader = sheet.createRow(0);
+ for ( int i=0 ; i < colDescs.length ; i++ )
+ {
+ addColumnValue( rowHeader, colDescs[i], i);
+ }
+ }
+
+ private void addColumnValues( HSSFSheet sheet, List beanList, String[] colNames, Method[] readMethods )
+ {
+ int rowIndex = 0;
+ Iterator beanListIter = beanList.iterator();
+ while ( beanListIter.hasNext() )
+ {
+ Object bean = beanListIter.next();
+ if ( bean != null )
+ {
+ HSSFRow row = sheet.createRow( rowIndex + 1 );
+ for ( int i = 0 ; i < colNames.length ; i++ )
+ {
+ String colName = colNames[i];
+ Method colReadMethod = readMethods[i];
+ String colVal = "";
+ if ( colReadMethod != null )
+ {
+ try
+ {
+ Object colValObj = colReadMethod.invoke( bean, null );
+ colVal = columnValueToString( colValObj );
+ }
+ catch ( Exception ex )
+ {
+ colVal = "";
+ }
+ }
+ addColumnValue( row, colVal, i);
+ }
+ rowIndex++;
+ }
+ }
+ }
+
+ protected void debugDumpData( List beanList, String[] colNames, String[] colDescs, HashMap readMethodMap )
+ {
+ print( "" );
+ print( "---- data ---" );
+ int rowIndex = 0;
+ Iterator beanListIter = beanList.iterator();
+ while ( beanListIter.hasNext() )
+ {
+ Object bean = beanListIter.next();
+ if ( bean != null )
+ {
+ StringBuffer out = new StringBuffer();
+ out.append( "row[" ).append( rowIndex ).append( "] " );
+ for ( int i = 0 ; i < colNames.length ; i++ )
+ {
+ String colName = colNames[i];
+ String colVal = null;
+ Method colReadMethod = (Method)readMethodMap.get( colName );
+ if ( colReadMethod == null )
+ {
+ colVal = "<error:" + colName + ":null-read-method>";
+ }
+ else
+ {
+ try
+ {
+ Object colValObj = colReadMethod.invoke( bean, null );
+ colVal = columnValueToString( colValObj );
+ }
+ catch ( Exception ex )
+ {
+ colVal = "<error:" + ex.getClass().getName() + ">";
+ }
+ }
+ if ( i > 0 )
+ out.append( " " );
+ out.append( i ).append( "=" ).append( colVal );
+ }
+ print( out.toString() );
+ rowIndex++;
+ }
+ }
+ }
+
+
+ protected void print(String str)
+ {
+ System.out.println(str);
+ logger.debug(str);
+ //logger.debug(str);
+ }
+
+ public static final class Identifier
+ {
+ // public enum Case { Unspecified, Lower, Upper }
+ // the args int firstCase and int subsequentCase are supposed to be of type Case ^^
+ // could not use enum type with mvn - got sick of mucking with it, so:
+ public static final int CASE_UNDEFINED = 1 ;
+ public static final int CASE_LOWER = 1 ;
+ public static final int CASE_UPPER = 2 ;
+
+ public static String PurifySpace( String identifier ) { return Purify( identifier, " ", CASE_UNDEFINED, CASE_UNDEFINED ) ; }
+ public static String PurifyHyphen( String identifier ) { return Purify( identifier, "-", CASE_UNDEFINED, CASE_UNDEFINED ) ; }
+ public static String PurifyUnder( String identifier ) { return Purify( identifier, "_", CASE_UNDEFINED, CASE_UNDEFINED ) ; }
+ public static String PurifyLoCamel( String identifier ) { return Purify( identifier, "", CASE_LOWER, CASE_UPPER ) ; }
+ public static String PurifyHiCamel( String identifier ) { return Purify( identifier, "", CASE_UPPER, CASE_UPPER ) ; }
+
+ public static String Purify( String identifier, String newChar, int firstCase, int subsequentCase )
+ {
+ if ( identifier == null ) return null ;
+ if ( newChar == null )
+ newChar = "_" ;
+ StringBuffer id = new StringBuffer() ;
+ boolean nextCharSpecialCase = false ;
+ for ( int i = 0 ; i < identifier.length() ; i++ )
+ {
+ char c = identifier.charAt(i) ;
+ String o = null ;
+ if ( ( i > 0 && Character.isLetterOrDigit( c ) ) || c == '_' || Character.isLetter( c ) )
+ {
+ o = Character.toString( c ) ;
+ }
+ else
+ {
+ o = newChar ;
+ if ( o != null )
+ {
+ if ( o.length() > 0 )
+ id.append( o ) ;
+ nextCharSpecialCase = true ;
+ }
+ continue ;
+ }
+ if ( o != null )
+ {
+ int useCase = ( i == 0 ) ? firstCase : subsequentCase ;
+ if ( i == 0 || nextCharSpecialCase )
+ {
+ if ( useCase == CASE_LOWER )
+ id.append( o.toLowerCase() ) ;
+ else if ( useCase == CASE_UPPER )
+ id.append( o.toUpperCase() ) ;
+ else
+ id.append( o ) ;
+ nextCharSpecialCase = false ;
+ }
+ else
+ id.append( o ) ;
+ }
+ }
+ return id.toString() ;
+ }
+ public static String UnCamel( String identifier )
+ {
+ return UnCamel( identifier, '_' ) ;
+ }
+ public static String UnCamel( String identifier, char newChar )
+ {
+ if ( identifier == null ) return null ;
+ if ( newChar == 0 )
+ newChar = '_' ;
+ StringBuffer id = new StringBuffer() ;
+ boolean lastIsUpper = false ;
+ for ( int i = 0 ; i < identifier.length() ; i++ )
+ {
+ char c = identifier.charAt(i) ;
+ if ( i > 0 && Character.isUpperCase( c ) && ! lastIsUpper )
+ {
+ id.append( newChar ).append( Character.toLowerCase( c ) ) ;
+ lastIsUpper = true ;
+ }
+ else
+ {
+ id.append( Character.toLowerCase( c ) ) ;
+ lastIsUpper = false ;
+ }
+ }
+ return id.toString() ;
+ }
+ }
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/DataScrollerActionListener.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/DataScrollerActionListener.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/DataScrollerActionListener.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/DataScrollerActionListener.java Tue Nov 25 19:41:12 2008
@@ -0,0 +1,40 @@
+/*
+ * 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.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+
+/**
+ * @author MBroekelmann
+ *
+ */
+public class DataScrollerActionListener implements ActionListener
+{
+
+ /**
+ * @see javax.faces.event.ActionListener#processAction(javax.faces.event.ActionEvent)
+ */
+ public void processAction(ActionEvent actionEvent) throws AbortProcessingException
+ {
+ System.out.println("process dataScroller ActionEvent");
+ }
+
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PagedSortableList.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PagedSortableList.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PagedSortableList.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PagedSortableList.java Tue Nov 25 19:41:12 2008
@@ -0,0 +1,69 @@
+/*
+ * 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.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.servlet.jsp.jstl.sql.Result;
+
+import org.apache.jetspeed.security.SecurityException;
+
+public abstract class PagedSortableList extends SortableList
+{
+ protected List rowList = new ArrayList();
+
+ public PagedSortableList()
+ {
+ super("type");
+ }
+
+ protected abstract void fetch( Result data ) throws SecurityException;
+
+ public List getRowList() throws SecurityException
+ {
+ if (rowList != null)
+ sort(getSort(), isAscending());
+
+ return rowList;
+ }
+
+ public void setRowList(List newRowList)
+ {
+ // update the cars from the provided list
+
+ rowList.clear();
+
+ for (Iterator iter = newRowList.iterator(); iter.hasNext(); ) {
+ Object bean = iter.next();
+ rowList.add( bean );
+ }
+ }
+
+
+
+ protected boolean isDefaultAscending(String sortColumn)
+ {
+ return true;
+ }
+
+ protected abstract void sort(final String column, final boolean ascending);
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PasswordResetActionListener.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PasswordResetActionListener.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PasswordResetActionListener.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PasswordResetActionListener.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 PasswordResetActionListener 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, "passwordResets");
+ report.executeQuery(form);
+ }
+ }
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PasswordResetReport.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PasswordResetReport.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PasswordResetReport.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PasswordResetReport.java Tue Nov 25 19:41:12 2008
@@ -0,0 +1,105 @@
+/*
+ * 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 PasswordResetReport extends AdminActivityAbstractReport
+{
+ public PasswordResetReport()
+ {
+ super();
+ }
+
+ public PasswordResetReport( PortalUserJetspeedInteraction _jsi, AdminActivityDatabaseInteraction _dbi )
+ {
+ super( _jsi, _dbi );
+ }
+
+ protected void setQueryParameters( AuditQuery query )
+ {
+ query.setElement( "password-reset" );
+ super.setQueryParameters( query );
+ }
+
+ public String[] getColumnNames()
+ {
+ final String[] names = {"modifiedBy", "userid", "firstName", "lastName",
+ "companyName", "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("modifiedBy", bean.getModifiedBy() );
+ 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("modifiedDate", bean.getModifiedDate() );
+ rowsAsMaps[count].put("ipAddress", bean.getIpAddress() );
+
+ count++;
+ }
+ }
+
+ return rowsAsMaps;
+ }
+
+ public Object[][] getRowsByIndex()
+ {
+ if ( rowsByIndex == null )
+ {
+ rowsByIndex = new Object[ rows.size() ][7];
+
+ Iterator iter = rows.iterator();
+ int count = 0;
+ while ( iter.hasNext() )
+ {
+ PortalUserBean bean = (PortalUserBean)iter.next();
+
+ rowsByIndex[count][0] = bean.getModifiedBy();
+ rowsByIndex[count][1] = bean.getUserid();
+ rowsByIndex[count][2] = bean.getFirstName();
+ rowsByIndex[count][3] = bean.getLastName();
+ rowsByIndex[count][4] = bean.getCompanyName();
+ rowsByIndex[count][5] = bean.getModifiedDate();
+ rowsByIndex[count][6] = bean.getIpAddress();
+
+ count++;
+ }
+ }
+
+ return rowsByIndex;
+ }
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalQuery.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalQuery.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalQuery.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalQuery.java Tue Nov 25 19:41:12 2008
@@ -0,0 +1,282 @@
+/*
+ * 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.Serializable;
+import java.util.Date;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.ArrayList;
+import java.text.DateFormat;
+import java.text.ParseException;
+
+import javax.faces.model.SelectItem;
+
+public class PortalQuery implements AuditQuery, Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String userid = "";
+ private String element = "";
+ private String modifiedBy = "";
+ private Date lastLoginDateStart = null;
+ private Date lastLoginDateEnd = null;
+ private Date activityDateStart = null;
+ private Date activityDateEnd = null;
+ private String ipAddress = "";
+
+ private Date genericDateStart = null;
+ private Date genericDateEnd = new Date();
+ private String genericDateName = "";
+ private String companyName = "";
+
+ private ArrayList genericDateNameList = null;
+
+ private DateFormat dateFormat;
+
+ public PortalQuery()
+ {
+ dateFormat = DateFormat.getDateInstance(DateFormat.SHORT);
+ }
+
+ public String getUserid()
+ {
+ return userid;
+ }
+
+ public void setUserid(String userid)
+ {
+ this.userid = userid;
+ }
+
+ public String getElement()
+ {
+ return element;
+ }
+ public void setElement(String element)
+ {
+ this.element = element;
+ }
+
+ public String getIpAddress()
+ {
+ return ipAddress;
+ }
+ public void setIpAddress(String ipAddress)
+ {
+ this.ipAddress = ipAddress;
+ }
+
+ public String getModifiedBy()
+ {
+ return modifiedBy;
+ }
+ public void setModifiedBy(String modifiedBy)
+ {
+ this.modifiedBy = modifiedBy;
+ }
+
+ public Date getLastLoginDateStart()
+ {
+ return lastLoginDateStart;
+ }
+ public Date getLastLoginDateEnd()
+ {
+ return lastLoginDateEnd;
+ }
+
+ public void setLastLoginDateStart(Date lastLoginDateStart)
+ {
+ this.lastLoginDateStart = lastLoginDateStart;
+ }
+ public void setLastLoginDateStart(String lastLoginDateStart)
+ {
+ this.lastLoginDateStart = null;
+ if ( lastLoginDateStart != null ) try
+ {
+ this.lastLoginDateStart = dateFormat.parse( lastLoginDateStart );
+ }
+ catch ( ParseException ex )
+ {
+ }
+ }
+
+ public void setLastLoginDateEnd(Date lastLoginDateEnd)
+ {
+ this.lastLoginDateEnd = lastLoginDateEnd;
+ }
+ public void setLastLoginDateEnd(String lastLoginDateEnd)
+ {
+ this.lastLoginDateEnd = null;
+ if ( lastLoginDateEnd != null ) try
+ {
+ this.lastLoginDateEnd = dateFormat.parse( lastLoginDateEnd );
+ }
+ catch ( ParseException ex )
+ {
+ }
+ }
+
+ public Date getActivityDateStart()
+ {
+ return activityDateStart;
+ }
+ public Date getActivityDateEnd()
+ {
+ return activityDateEnd;
+ }
+
+ public void setActivityDateStart(Date activityDateStart)
+ {
+ this.activityDateStart = activityDateStart;
+ }
+ public void setActivityDateStart(String activityDateStart)
+ {
+ this.activityDateStart = null;
+ if ( activityDateStart != null ) try
+ {
+ this.activityDateStart = dateFormat.parse( activityDateStart );
+ }
+ catch ( ParseException ex )
+ {
+ }
+ }
+ public void setActivityDateEnd(Date activityDateEnd)
+ {
+ this.activityDateEnd = activityDateEnd;
+ }
+ public void setActivityDateEnd(String activityDateEnd)
+ {
+ this.activityDateEnd = null;
+ if ( activityDateEnd != null ) try
+ {
+ this.activityDateEnd = dateFormat.parse( activityDateEnd );
+ }
+ catch ( ParseException ex )
+ {
+ }
+ }
+
+
+ public Date getGenericDateStart()
+ {
+ return genericDateStart;
+ }
+ public Date getGenericDateEnd()
+ {
+ return genericDateEnd;
+ }
+
+ public void setGenericDateStart(Date genericDateStart)
+ {
+ this.genericDateStart = genericDateStart;
+ }
+ public void setGenericDateStart(String genericDateStart)
+ {
+ this.genericDateStart = null;
+ if ( genericDateStart != null ) try
+ {
+ this.genericDateStart = dateFormat.parse( genericDateStart );
+ }
+ catch ( ParseException ex )
+ {
+ }
+ }
+ public void setGenericDateEnd(Date genericDateEnd)
+ {
+ this.genericDateEnd = genericDateEnd;
+ }
+ public void setGenericDateEnd(String genericDateEnd)
+ {
+ this.genericDateEnd = null;
+ if ( genericDateEnd != null ) try
+ {
+ this.genericDateEnd = dateFormat.parse( genericDateEnd );
+ }
+ catch ( ParseException ex )
+ {
+ }
+ }
+
+ public String getGenericDateName()
+ {
+ return genericDateName;
+ }
+ public void setGenericDateName(String genericDateName)
+ {
+ this.genericDateName = genericDateName;
+ }
+
+ public ArrayList getGenericDateNameList()
+ {
+ if ( genericDateNameList == null )
+ {
+ ArrayList nms = new ArrayList();
+ nms.add(new SelectItem("lastLogin","Last Login","Last Login"));
+ nms.add(new SelectItem("lastPasswordChange","Last Password Change","Last Password Change"));
+ nms.add(new SelectItem("lastEmailChange","Last Email Change","Last Email Change"));
+ nms.add(new SelectItem("lastSecurityQuestionsChange","Last Security Question Change","Last Security Question Change"));
+ nms.add(new SelectItem("lastSecurityKeyChange","Last Security Key Change","Last Security Key Change"));
+ setGenericDateNameList( nms );
+ }
+ return this.genericDateNameList;
+ }
+ public void setGenericDateNameList( ArrayList genericDateNameList )
+ {
+ this.genericDateNameList = genericDateNameList;
+ }
+
+ public String getCompanyName()
+ {
+ return companyName;
+ }
+ public void setCompanyName(String companyName)
+ {
+ this.companyName = companyName;
+ }
+
+
+ public Map getParams()
+ {
+ Map result = new Hashtable();
+
+ if (!isBlankString(userid)) result.put("USER_NAME", userid);
+ if (!isBlankString(element)) result.put("ACTIVITY", element);
+ if (!isBlankString(modifiedBy)) result.put("ADMIN", modifiedBy);
+
+ // note: not adding companyName because it is not a database field - use getCompanyName()
+
+ if (lastLoginDateStart != null)
+ result.put("LASTLOGIN_DATE_START", new java.sql.Date(lastLoginDateStart.getTime()).toString());
+ if (lastLoginDateEnd != null)
+ result.put("LASTLOGIN_DATE_END", new java.sql.Date(lastLoginDateEnd.getTime()).toString());
+ if (activityDateStart != null)
+ result.put("ACTIVITY_DATE_START", new java.sql.Date(activityDateStart.getTime()).toString());
+ if (activityDateEnd != null)
+ result.put("ACTIVITY_DATE_END", new java.sql.Date(activityDateEnd.getTime()).toString());
+ if (!isBlankString(ipAddress)) result.put("IPADDRESS", ipAddress);
+
+ return result;
+ }
+
+ private static boolean isBlankString(String s)
+ {
+ return (s == null || s.length() ==0);
+ }
+
+
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalUserBean.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalUserBean.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalUserBean.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalUserBean.java Tue Nov 25 19:41:12 2008
@@ -0,0 +1,352 @@
+/*
+ * 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.Serializable;
+import java.util.zip.DataFormatException;
+import java.util.Date;
+
+public class PortalUserBean implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String userid;
+ private String firstName;
+ private String lastName;
+ private String companyName;
+
+ private String action;
+ private String element;
+ private String beforeValue;
+ private String afterValue;
+ private String modifiedBy;
+ private String modifiedDate;
+ private String ipAddress;
+
+ private String email;
+ private String lastLogin;
+ private Date lastLoginDate;
+ private String lastLoginIP;
+ private String lastPasswordChange;
+ private String userStatus;
+ private String createdBy;
+ private String created;
+ private String checkImage;
+ private String statementImage;
+ private String positivePay;
+ private String remoteDepositCapture;
+ private String ach;
+
+ private Date passwordExpirationDate;
+ private int authenticationFailureCount;
+
+
+
+ /*
+ * Creates a new, empty PortalUserBean.
+ */
+ public PortalUserBean() {}
+
+ /*
+ * Creates a new PortalUserBean that combines the values of two others.
+ * If an attribute is defined in both beans, the value in the first bean
+ * takes precedence.
+ */
+ public PortalUserBean( PortalUserBean s1, PortalUserBean s2 ) throws DataFormatException
+ {
+ if ( ! ( s1.getUserid().equals( s2.getUserid() ) ) )
+ {
+ throw new DataFormatException("Source beans have nonmatching User ID's: " + s1.getUserid() + " vs. " + s2.getUserid() );
+ }
+
+ userid = s1.getUserid();
+ firstName = ( s1.getFirstName() == null ? s2.getFirstName() : s1.getFirstName() );
+ lastName = ( s1.getLastName() == null ? s2.getLastName() : s1.getLastName() );
+ companyName = ( s1.getCompanyName() == null ? s2.getCompanyName() : s1.getCompanyName() );
+
+ email = ( s1.getEmail() == null ? s2.getEmail() : s1.getEmail() );
+ lastLogin = ( s1.getLastLogin() == null ? s2.getLastLogin() : s1.getLastLogin() );
+ lastLoginDate = ( s1.getLastLoginDate() == null ? s2.getLastLoginDate() : s1.getLastLoginDate() );
+ lastLoginIP = ( s1.getLastLoginIP() == null ? s2.getLastLoginIP() : s1.getLastLoginIP() );
+ lastPasswordChange = ( s1.getLastPasswordChange() == null ? s2.getLastPasswordChange() : s1.getLastPasswordChange() );
+ userStatus = ( s1.getUserStatus() == null ? s2.getUserStatus() : s1.getUserStatus() );
+ createdBy = ( s1.getCreatedBy() == null ? s2.getCreatedBy() : s1.getCreatedBy() );
+ created = ( s1.getCreated() == null ? s2.getCreated() : s1.getCreated() );
+ checkImage = ( s1.getCheckImage() == null ? s2.getCheckImage() : s1.getCheckImage() );
+ statementImage = ( s1.getStatementImage() == null ? s2.getStatementImage() : s1.getStatementImage() );
+ positivePay = ( s1.getPositivePay() == null ? s2.getPositivePay() : s1.getPositivePay() );
+ remoteDepositCapture = ( s1.getRemoteDepositCapture() == null ? s2.getRemoteDepositCapture() : s1.getRemoteDepositCapture() );
+ ach = ( s1.getAch() == null ? s2.getAch() : s1.getAch() );
+
+ action = ( s1.getAction() == null ? s2.getAction() : s1.getAction() );
+ element = ( s1.getElement() == null ? s2.getElement() : s1.getElement() );
+ beforeValue = ( s1.getBeforeValue() == null ? s2.getBeforeValue() : s1.getBeforeValue() );
+ afterValue = ( s1.getAfterValue() == null ? s2.getAfterValue() : s1.getAfterValue() );
+ modifiedBy = ( s1.getModifiedBy() == null ? s2.getModifiedBy() : s1.getModifiedBy() );
+ modifiedDate = ( s1.getModifiedDate() == null ? s2.getModifiedDate() : s1.getModifiedDate() );
+ ipAddress = ( s1.getIpAddress() == null ? s2.getIpAddress() : s1.getIpAddress() );
+ }
+
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public String getAfterValue() {
+ return afterValue;
+ }
+
+
+ public void setAfterValue(String afterValue) {
+ this.afterValue = afterValue;
+ }
+
+
+ public String getBeforeValue() {
+ return beforeValue;
+ }
+
+
+ public void setBeforeValue(String beforeValue) {
+ this.beforeValue = beforeValue;
+ }
+
+
+ public String getCompanyName() {
+ return companyName;
+ }
+
+
+ public void setCompanyName(String companyName) {
+ this.companyName = companyName;
+ }
+
+
+ public String getModifiedBy() {
+ return modifiedBy;
+ }
+
+
+ public void setModifiedBy(String deletedBy) {
+ this.modifiedBy = deletedBy;
+ }
+
+
+ public String getModifiedDate() {
+ return modifiedDate;
+ }
+
+
+ public void setModifiedDate(String deletedDate) {
+ this.modifiedDate = deletedDate;
+ }
+
+
+ public String getElement() {
+ return element;
+ }
+
+
+ public void setElement(String element) {
+ this.element = element;
+ }
+
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+
+ public String getIpAddress() {
+ return ipAddress;
+ }
+
+
+ public void setIpAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ }
+
+
+ public String getLastName() {
+ return lastName;
+ }
+
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+
+ public String getUserid() {
+ return userid;
+ }
+
+
+ public void setUserid(String userid) {
+ this.userid = userid;
+ }
+
+ public String getAch() {
+ return ach;
+ }
+
+ public void setAch(String ach) {
+ this.ach = ach;
+ }
+
+ public String getCheckImage() {
+ return checkImage;
+ }
+
+ public void setCheckImage(String checkImage) {
+ this.checkImage = checkImage;
+ }
+
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ public String getCreated() {
+ return created;
+ }
+
+ public void setCreated(String created) {
+ this.created = created;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getLastLogin() {
+ return lastLogin;
+ }
+
+ public void setLastLogin(String lastLogin) {
+ this.lastLogin = lastLogin;
+ }
+
+ public Date getLastLoginDate() {
+ return lastLoginDate;
+ }
+
+ public void setLastLoginDate(Date lastLoginDate) {
+ this.lastLoginDate = lastLoginDate;
+ }
+
+ public String getLastLoginIP() {
+ return lastLoginIP;
+ }
+
+ public void setLastLoginIP(String lastLoginIP) {
+ this.lastLoginIP = lastLoginIP;
+ }
+
+ public String getLastPasswordChange() {
+ return lastPasswordChange;
+ }
+
+ public void setLastPasswordChange(String lastPasswordChange) {
+ this.lastPasswordChange = lastPasswordChange;
+ }
+
+ public String getPositivePay() {
+ return positivePay;
+ }
+
+ public void setPositivePay(String positivePay) {
+ this.positivePay = positivePay;
+ }
+
+ public String getRemoteDepositCapture() {
+ return remoteDepositCapture;
+ }
+
+ public void setRemoteDepositCapture(String remoteDepositCapture) {
+ this.remoteDepositCapture = remoteDepositCapture;
+ }
+
+ public String getStatementImage() {
+ return statementImage;
+ }
+
+ public void setStatementImage(String statementImage) {
+ this.statementImage = statementImage;
+ }
+
+ public String getUserStatus() {
+ return userStatus;
+ }
+
+ public void setUserStatus(String userStatus) {
+ this.userStatus = userStatus;
+ }
+
+ public int getAuthenticationFailureCount()
+ {
+ return this.authenticationFailureCount;
+ }
+ public void setAuthenticationFailureCount(int authenticationFailureCount)
+ {
+ this.authenticationFailureCount = authenticationFailureCount;
+ }
+
+ public Date getPasswordExpirationDate() {
+ return passwordExpirationDate;
+ }
+ public void setPasswordExpirationDate(Date passwordExpirationDate) {
+ this.passwordExpirationDate = passwordExpirationDate;
+ }
+
+ public String getFailedAttemptsBeforeLockout()
+ {
+ return "5";
+ }
+ public String getLockoutDuration()
+ {
+ return "Admin. Reset Required";
+ }
+ public String getPasswordComplexity()
+ {
+ return "Min=8, Max=20, Min 1 numeric";
+ }
+ public String getUseridComplexity()
+ {
+ return "Min=6, Max=20";
+ }
+ public String getPasswordHistory()
+ {
+ return "13";
+ }
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalUserJetspeedInteraction.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalUserJetspeedInteraction.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalUserJetspeedInteraction.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalUserJetspeedInteraction.java Tue Nov 25 19:41:12 2008
@@ -0,0 +1,155 @@
+/*
+ * 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.security.Principal;
+import java.util.Date;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.prefs.Preferences;
+
+import javax.sql.DataSource;
+
+import org.apache.jetspeed.Jetspeed;
+import org.apache.jetspeed.audit.AuditActivity;
+import org.apache.jetspeed.portlets.util.SecurityHelper;
+import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.security.SecurityException;
+import org.apache.jetspeed.security.User;
+import org.apache.jetspeed.security.UserManager;
+
+public class PortalUserJetspeedInteraction
+{
+
+ private LinkedList rows;
+ private Map table;
+ private AuditActivity audit;
+ private UserManager um;
+
+
+ public PortalUserBean getUserBean(String userid)
+ {
+ try
+ {
+ User user = um.getUser(userid);
+ return getBeanFromUser(user);
+ }
+ catch (Exception e)
+ {
+ //e.printStackTrace();
+ // TODO: logging
+ }
+ return null;
+ }
+
+ public void init()
+ {
+ audit = (AuditActivity)Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.audit.AuditActivity");
+ um = (UserManager)Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.security.UserManager");
+ rows = new LinkedList();
+ table = null;
+ }
+
+ public void retrieveExtent(String filter) throws SecurityException
+ {
+ if ( filter == null )
+ filter = "*";
+
+ Iterator umIter = um.getUsers(filter);
+ while ( umIter.hasNext() )
+ {
+ User u = (User)umIter.next();
+ PortalUserBean bean = getBeanFromUser(u);
+ rows.add( (PortalUserBean)bean );
+ }
+ }
+
+ protected PortalUserBean getBeanFromUser(User u)
+ {
+ PortalUserBean bean = new PortalUserBean();
+ Preferences p = u.getUserAttributes();
+
+ // This hideous two lines of code is due to a hideous oversight in the Jetspeed API!
+ Principal principal = SecurityHelper.getUserPrincipal(u.getSubject());
+ bean.setUserid(principal.getName());
+
+ bean.setFirstName( p.get("user.name.given", "") );
+ bean.setLastName( p.get("user.name.family", "") );
+ String userEmail = p.get("user.email", "" );
+ if ( userEmail == null || userEmail.length() == 0 )
+ {
+ userEmail = p.get("user.business-info.online.email", "" );
+ if ( userEmail == null || userEmail.length() == 0 )
+ {
+ userEmail = p.get("user.home-info.online.email", "" );
+ }
+ }
+ bean.setEmail( userEmail );
+ bean.setCompanyName( p.get("bus_id", "") );
+ bean.setCheckImage( p.get( "activeview_image_access", "" ) );
+ bean.setStatementImage( p.get( "activeview_statement_access", "" ) );
+ bean.setPositivePay( p.get( "ppay_acccess", "" ) );
+ bean.setRemoteDepositCapture( p.get( "rdc_access", "" ) );
+ bean.setAch( p.get( "ach_access", "" ) );
+
+ PasswordCredential credential = SecurityHelper.getCredential(u);
+ if ( credential != null )
+ {
+ bean.setUserStatus( credential.isEnabled() ? "enabled" : "disabled" );
+ Date pswdExpire = credential.getExpirationDate();
+ //if ( pswdExpire == null )
+ // pswdExpire = new Date();
+ bean.setPasswordExpirationDate( pswdExpire );
+ bean.setAuthenticationFailureCount( credential.getAuthenticationFailures() );
+ }
+
+ return bean;
+ }
+
+ public DataSource getDataSource()
+ {
+ return audit.getDataSource();
+ }
+
+ List getAllAsList()
+ {
+ return rows;
+ }
+
+ Map getAllAsMap()
+ {
+ // Since we don't know whether or not we're going to need the map at
+ // all when init() is called, we don't generate it unless we need it.
+ 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;
+ }
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalUserReportPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalUserReportPortlet.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalUserReportPortlet.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/PortalUserReportPortlet.java Tue Nov 25 19:41:12 2008
@@ -0,0 +1,199 @@
+/*
+ * 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.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletContext;
+
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.List;
+import java.util.ArrayList;
+
+import org.apache.portals.bridges.jsf.FacesPortlet;
+
+import org.apache.jetspeed.CommonPortletServices;
+import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.container.window.PortletWindowAccessor;
+import org.apache.jetspeed.PortalReservedParameters;
+
+import org.apache.portals.bridges.util.PortletWindowUtils;
+import org.apache.portals.messaging.PortletMessaging;
+
+import org.apache.pluto.om.window.PortletWindow;
+import org.apache.pluto.om.entity.PortletEntity;
+import org.apache.pluto.om.portlet.PortletDefinition;
+
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+
+public class PortalUserReportPortlet extends FacesPortlet
+{
+ public static final String PARAM_ALT_CONTENT_TYPE = "contenttype";
+
+ public static final String ATTRIBUTE_ALT_CONTENT_TYPE = "altcontenttype";
+
+ public static final String LAST_DATA_ROWS_SUFFIX = "_last_data_rows";
+ public static final String LAST_DATA_REPORT_SUFFIX = "_last_data_report";
+
+ public static final String ALT_CONTENT_TYPE_EXCEL = "excel";
+ public static final String ALT_CONTENT_TYPE_PDF = "pdf";
+
+ private PortletWindowAccessor windowAccess;
+
+ public void init(PortletConfig config) throws PortletException
+ {
+ super.init(config);
+ PortletContext context = getPortletContext();
+ windowAccess = (PortletWindowAccessor)context.getAttribute(CommonPortletServices.CPS_WINDOW_ACCESS_COMPONENT);
+ }
+
+ protected void setPortletIdentityAttributes( PortletRequest request )
+ {
+ RequestContext jsReqContext = (RequestContext)request.getAttribute( PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE );
+ String portletEntityId = null, portletUniqueName = null, portletAppContext= null;
+ try
+ {
+ portletEntityId = PortletWindowUtils.getPortletWindowId( request.getPortletSession( true ) );
+ PortletWindow pw = windowAccess.getPortletWindow( portletEntityId );
+ portletUniqueName = ((PortletDefinitionComposite)pw.getPortletEntity().getPortletDefinition() ).getUniqueName();
+ portletAppContext = pw.getPortletEntity().getPortletDefinition().getPortletApplicationDefinition().getWebApplicationDefinition().getContextRoot();
+
+ request.setAttribute( "portletEntityId", portletEntityId );
+ request.setAttribute( "portletUniqueName", portletUniqueName );
+ }
+ catch ( Exception ex )
+ {
+ System.out.println( this.getClass().getName() + ".setPortletIdentityAttributes() error " + ex.getClass().getName() + " - " + ex.getMessage() );
+ ex.printStackTrace();
+ }
+ System.out.println( this.getClass().getName() + ".doView() portlet-entity-id=" + portletEntityId + " portlet-unique-name=" + portletUniqueName + " portlet-app-context=" + ( portletAppContext == null ? "null" : portletAppContext.toString() ) );
+ }
+
+ protected void setExcelExportUrl( RenderRequest request )
+ {
+ String portletEntityId = null, portletUniqueName = null;
+ portletEntityId = (String)request.getAttribute( "portletEntityId" );
+ portletUniqueName = (String)request.getAttribute( "portletUniqueName" );
+ try
+ {
+ RequestContext jsReqContext = (RequestContext)request.getAttribute( PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE );
+ String portalBasePath = jsReqContext.getPortalURL().getBasePath();
+ int servletPathPos = portalBasePath.lastIndexOf( jsReqContext.getRequest().getServletPath() );
+ if ( servletPathPos > 0 )
+ portalBasePath = portalBasePath.substring( 0, servletPathPos );
+ String excelQueryPortletUrl = portalBasePath + "/portlet?entity=" + URLEncoder.encode( portletEntityId, "UTF-8" ) + "&" + "portlet=" + URLEncoder.encode( portletUniqueName, "UTF-8" ) + "&" + PARAM_ALT_CONTENT_TYPE + "=" + ALT_CONTENT_TYPE_EXCEL;
+ request.setAttribute( "excelExport", excelQueryPortletUrl );
+ }
+ catch ( Exception ex )
+ {
+ System.out.println( this.getClass().getName() + ".setExcelExportUrl() error " + ex.getClass().getName() + " - " + ex.getMessage() );
+ ex.printStackTrace();
+ }
+ }
+
+ public static List getLastDataRows( PortletRequest request )
+ {
+ String portletEntityId = (String)request.getAttribute( "portletEntityId" );
+ List lastDataRows = (List)request.getPortletSession(true).getAttribute( portletEntityId + LAST_DATA_ROWS_SUFFIX );
+ return lastDataRows;
+ }
+ public static void setLastDataRows( PortletRequest request, List lastDataRows )
+ {
+ String portletEntityId = (String)request.getAttribute( "portletEntityId" );
+ request.getPortletSession(true).setAttribute( portletEntityId + LAST_DATA_ROWS_SUFFIX, lastDataRows );
+ }
+ public static AuditReport getLastDataReport( PortletRequest request )
+ {
+ String portletEntityId = (String)request.getAttribute( "portletEntityId" );
+ AuditReport report = (AuditReport)request.getPortletSession(true).getAttribute( portletEntityId + LAST_DATA_REPORT_SUFFIX );
+ return report;
+ }
+ public static void setLastDataReport( PortletRequest request, AuditReport report )
+ {
+ String portletEntityId = (String)request.getAttribute( "portletEntityId" );
+ request.getPortletSession(true).setAttribute( portletEntityId + LAST_DATA_REPORT_SUFFIX, report );
+ }
+
+ public void doView(RenderRequest request, RenderResponse response)
+ throws PortletException, IOException
+ {
+ setPortletIdentityAttributes( request );
+ List lastDataRows = getLastDataRows( request );
+ boolean hasLastDataRows = false;
+ if ( lastDataRows != null )
+ hasLastDataRows = true;
+
+ String useContentType = request.getParameter( PARAM_ALT_CONTENT_TYPE );
+ if ( useContentType != null && useContentType.equals( ALT_CONTENT_TYPE_EXCEL ) )
+ {
+ request.setAttribute( ATTRIBUTE_ALT_CONTENT_TYPE, useContentType );
+ System.out.println( this.getClass().getName() + ".doView() observing request attribute " + ATTRIBUTE_ALT_CONTENT_TYPE + "=" + useContentType.toString() );
+
+ 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" );
+ jsReqContext.getResponse().setHeader( "Content-Disposition", "inline; filename=thedata.xls" );
+
+ System.out.println( this.getClass().getName() + " setup response for " + PARAM_ALT_CONTENT_TYPE + "=" + ALT_CONTENT_TYPE_EXCEL );
+
+ if ( lastDataRows == null )
+ lastDataRows = new ArrayList();
+
+ AuditReport report = getLastDataReport( request );
+ if ( report != null )
+ {
+ AuditReportExcelExport excelExport = new AuditReportExcelExport();
+ HSSFWorkbook excelWorkbook = excelExport.createExcelWorkbook( report, report.getBeanClass(), getLastDataRows( request ) );
+ if ( excelWorkbook != null )
+ {
+ excelWorkbook.write( response.getPortletOutputStream() );
+ }
+ }
+
+ response.getPortletOutputStream().flush();
+ }
+ else
+ {
+ if ( hasLastDataRows )
+ setExcelExportUrl( request );
+
+ super.doView(request, response);
+ }
+
+ }
+
+ public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException
+ {
+ setPortletIdentityAttributes( actionRequest );
+ super.processAction( actionRequest, actionResponse );
+ }
+
+ protected String getRequestedContentType( RenderRequest request )
+ {
+ return (String)request.getParameter( PARAM_ALT_CONTENT_TYPE );
+ }
+
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOFailedLoginActionListener.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOFailedLoginActionListener.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOFailedLoginActionListener.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOFailedLoginActionListener.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 SSOFailedLoginActionListener 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, "ssoFailedLoginUsers");
+ report.executeQuery(form);
+ }
+ }
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOLockedUserActionListener.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOLockedUserActionListener.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOLockedUserActionListener.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOLockedUserActionListener.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 SSOLockedUserActionListener 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, "ssoLockedUsers");
+ report.executeQuery(form);
+ }
+ }
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOOptOutActionListener.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOOptOutActionListener.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOOptOutActionListener.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOOptOutActionListener.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 SSOOptOutActionListener 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, "ssoOptOutUsers");
+ report.executeQuery(form);
+ }
+ }
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOSuccessLoginActionListener.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOSuccessLoginActionListener.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOSuccessLoginActionListener.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOSuccessLoginActionListener.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 SSOSuccessLoginActionListener 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, "ssoSuccessLoginUsers");
+ report.executeQuery(form);
+ }
+ }
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOSystemSecurityActionListener.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOSystemSecurityActionListener.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOSystemSecurityActionListener.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOSystemSecurityActionListener.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 SSOSystemSecurityActionListener 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, "ssoSystemSecurityUsers");
+ report.executeQuery(form);
+ }
+ }
+}
Added: portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOUserBean.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOUserBean.java?rev=720725&view=auto
==============================================================================
--- portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOUserBean.java (added)
+++ portals/jetspeed-2/applications/jsaudit/trunk/src/main/java/org/apache/jetspeed/portlets/audit/SSOUserBean.java Tue Nov 25 19:41:12 2008
@@ -0,0 +1,348 @@
+/*
+ * 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.Serializable;
+import java.util.Date;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat ;
+
+public class SSOUserBean implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String userid;
+ private String username;
+ private String email;
+ private String company_name;
+ private String optin_status;
+ private Integer invalid_password_count;
+ private Integer invalid_security_count;
+ private Date last_login;
+ private String last_login_ip;
+ private Date last_password_change;
+ private Date last_email_change;
+ private Date last_security_questions_change;
+ private Date last_security_key_change;
+ private String user_check_image;
+ private String user_statement_image;
+ private String user_positive_pay;
+ private String user_remote_deposit_capture;
+ private String user_ach;
+ private Date failed_login;
+ private String failed_login_ip;
+ private Date failed_password_count_exceeded;
+ private String failed_password_count_exceeded_ip;
+ private Date failed_security_count_exceeded;
+ private String failed_security_count_exceeded_ip;
+ private Date last_success_login;
+ private Date last_success_password_change;
+ private String admin_userid;
+ private Date optout;
+ private String optout_ip;
+
+ public SSOUserBean()
+ {
+ super();
+ }
+
+ public String getUserid()
+ {
+ return this.userid;
+ }
+ public void setUserid( String userid )
+ {
+ this.userid = userid;
+ }
+
+ public String getUsername()
+ {
+ return this.username;
+ }
+ public void setUsername( String username )
+ {
+ this.username = username;
+ }
+
+ public String getEmail()
+ {
+ return this.email;
+ }
+ public void setEmail( String email )
+ {
+ this.email = email;
+ }
+
+ public String getCompanyName()
+ {
+ return this.company_name;
+ }
+ public void setCompanyName( String companyName )
+ {
+ this.company_name = companyName;
+ }
+
+ public String getOptinStatus()
+ {
+ return this.optin_status;
+ }
+ public void setOptinStatus( String optinStatus )
+ {
+ this.optin_status = optinStatus;
+ }
+
+ public Integer getInvalidPasswordCount()
+ {
+ return this.invalid_password_count;
+ }
+ public void setInvalidPasswordCount( Integer invalidPasswordCount )
+ {
+ this.invalid_password_count = invalidPasswordCount;
+ }
+
+ public Integer getInvalidSecurityCount()
+ {
+ return this.invalid_security_count;
+ }
+ public void setInvalidSecurityCount( Integer invalidSecurityCount )
+ {
+ this.invalid_security_count = invalidSecurityCount;
+ }
+
+ public Date getLastLogin()
+ {
+ return this.last_login;
+ }
+ public void setLastLogin( Date lastLogin )
+ {
+ this.last_login = lastLogin;
+ }
+
+ public String getLastLoginIp()
+ {
+ return this.last_login_ip;
+ }
+ public void setLastLoginIp( String lastLoginIp )
+ {
+ this.last_login_ip = lastLoginIp;
+ }
+
+ public Date getLastPasswordChange()
+ {
+ return this.last_password_change;
+ }
+ public void setLastPasswordChange( Date lastPasswordChange )
+ {
+ this.last_password_change = lastPasswordChange;
+ }
+
+ public Date getLastEmailChange()
+ {
+ return this.last_email_change;
+ }
+ public void setLastEmailChange( Date lastEmailChange )
+ {
+ this.last_email_change = lastEmailChange;
+ }
+
+ public Date getLastSecurityQuestionsChange()
+ {
+ return this.last_security_questions_change;
+ }
+ public void setLastSecurityQuestionsChange( Date lastSecurityQuestionsChange )
+ {
+ this.last_security_questions_change = lastSecurityQuestionsChange;
+ }
+
+ public Date getLastSecurityKeyChange()
+ {
+ return this.last_security_key_change;
+ }
+ public void setLastSecurityKeyChange( Date lastSecurityKeyChange )
+ {
+ this.last_security_key_change = lastSecurityKeyChange;
+ }
+
+ public String getUserCheckImage()
+ {
+ return this.user_check_image;
+ }
+ public void setUserCheckImage( String userCheckImage )
+ {
+ this.user_check_image = userCheckImage;
+ }
+
+ public String getUserStatementImage()
+ {
+ return this.user_statement_image;
+ }
+ public void setUserStatementImage( String userStatementImage )
+ {
+ this.user_statement_image = userStatementImage;
+ }
+
+ public String getUserPositivePay()
+ {
+ return this.user_positive_pay;
+ }
+ public void setUserPositivePay( String userPositivePay )
+ {
+ this.user_positive_pay = userPositivePay;
+ }
+
+ public String getUserRemoteDepositCapture()
+ {
+ return this.user_remote_deposit_capture;
+ }
+ public void setUserRemoteDepositCapture( String userRemoteDepositCapture )
+ {
+ this.user_remote_deposit_capture = userRemoteDepositCapture;
+ }
+
+ public String getUserAch()
+ {
+ return this.user_ach;
+ }
+ public void setUserAch( String userAch )
+ {
+ this.user_ach = userAch;
+ }
+
+ public Date getFailedLogin()
+ {
+ return this.failed_login;
+ }
+ public void setFailedLogin( Date failedLogin )
+ {
+ this.failed_login = failedLogin;
+ }
+
+ public String getFailedLoginIp()
+ {
+ return this.failed_login_ip;
+ }
+ public void setFailedLoginIp( String failedLoginIp )
+ {
+ this.failed_login_ip = failedLoginIp;
+ }
+
+ public Date getFailedPasswordCountExceeded()
+ {
+ return this.failed_password_count_exceeded;
+ }
+ public void setFailedPasswordCountExceeded( Date failedPasswordCountExceeded )
+ {
+ this.failed_password_count_exceeded = failedPasswordCountExceeded;
+ }
+
+ public String getFailedPasswordCountExceededIp()
+ {
+ return this.failed_password_count_exceeded_ip;
+ }
+ public void setFailedPasswordCountExceededIp( String failedPasswordCountExceededIp )
+ {
+ this.failed_password_count_exceeded_ip = failedPasswordCountExceededIp;
+ }
+
+ public Date getFailedSecurityCountExceeded()
+ {
+ return this.failed_security_count_exceeded;
+ }
+ public void setFailedSecurityCountExceeded( Date failedSecurityCountExceeded )
+ {
+ this.failed_security_count_exceeded = failedSecurityCountExceeded;
+ }
+
+ public String getFailedSecurityCountExceededIp()
+ {
+ return this.failed_security_count_exceeded_ip;
+ }
+ public void setFailedSecurityCountExceededIp( String failedSecurityCountExceededIp )
+ {
+ this.failed_security_count_exceeded_ip = failedSecurityCountExceededIp;
+ }
+
+ public Date getLastSuccessLogin()
+ {
+ return this.last_success_login;
+ }
+ public void setLastSuccessLogin( Date lastSuccessLogin )
+ {
+ this.last_success_login = lastSuccessLogin;
+ }
+
+ public Date getLastSuccessPasswordChange()
+ {
+ return this.last_success_password_change;
+ }
+ public void setLastSuccessPasswordChange( Date lastSuccessPasswordChange )
+ {
+ this.last_success_password_change = lastSuccessPasswordChange;
+ }
+
+ public String getAdminUserid()
+ {
+ return this.admin_userid;
+ }
+ public void setAdminUserid( String adminUserid )
+ {
+ this.admin_userid = adminUserid;
+ }
+
+ public Date getOptout()
+ {
+ return this.optout;
+ }
+ public void setOptout( Date optout )
+ {
+ this.optout = optout;
+ }
+
+ public String getOptoutIp()
+ {
+ return this.optout_ip;
+ }
+ public void setOptoutIp( String optoutIp )
+ {
+ this.optout_ip = optoutIp;
+ }
+
+ public String getPasswordExpirationDate()
+ {
+ return "n/a";
+ }
+ public String getFailedAttemptsBeforeLockout()
+ {
+ return "5";
+ }
+ public String getLockoutDuration()
+ {
+ return "Admin. Reset Required";
+ }
+ public String getPasswordComplexity()
+ {
+ return "Min=8, Max=20, Min 1 numeric, Min 1 uppercase";
+ }
+ public String getUseridComplexity()
+ {
+ return "Min=6, Max=20";
+ }
+ public String getPasswordHistory()
+ {
+ return "13";
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org