1   package ch.ige.edossier.web.struts;
2   
3   import javax.servlet.http.HttpServletRequest;
4   import javax.servlet.http.HttpServletResponse;
5   import javax.servlet.http.HttpSession;
6   import org.apache.log4j.Logger;
7   import org.apache.struts.action.*;
8   
9   /**
10   * B32.03 - eDossier-Interceptions - Diplomarbeit an der Software-Schule Schweiz<br>
11   * NICE-TO-HAVE-ZIEL [N1] - Suchen (Pflichtenheft b32.03_PF_eDossier.pdf, Seite 17)<br>
12   * DIESES ZIEL WURDE AUFGRUND DES ZEITMANAGEMENT NICHT IMPLEMENTIERT<br>
13   * Die Klasse SearchAction verarbeitet die Daten der SearchForm.
14   * Die Suchfunktion (Nice-to-have Ziel) wurde nicht implementiert!
15   * <p>
16   * Copyright (c) 2004, Eidgenössisches Institut für Geistiges Eigentum
17   * @author    Anita Rueegsegger, Marc Bouquet
18   * @version   $Id: SearchAction.java,v 1.6 2004/10/22 01:58:23 bouquet Exp $
19   */
20  public class SearchAction extends Action
21  {
22    // Attribute für Log4j-Logging
23    private static final Logger LOG = Logger.getLogger( SearchAction.class );
24  
25    /**
26     * Diese Methode wurde aus Zeitgründen nicht implementiert.
27     * @param actionMapping ActionMapping
28     * @param actionForm ActionForm
29     * @param httpServletRequest HttpServletRequest
30     * @param httpServletResponse HttpServletResponse
31     * @return ActionForward
32     */
33    public ActionForward execute( ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse )
34    {
35      ActionErrors errors = new ActionErrors();
36      HttpSession session = httpServletRequest.getSession( false );
37      SearchForm searchForm = ( SearchForm )actionForm;
38  
39      try
40      {
41        // Prüfen ob, eine gültige Session vorhanden ist.
42        if( session == null || ( ( Boolean )session.getAttribute( "token" ) ).booleanValue() == false )
43        {
44          return( actionMapping.findForward( "index" ) );
45        }
46      }
47      catch( Exception ex )
48      {
49        LOG.error( "Error: " + ex.getMessage() );
50        errors.add( "searchVO", new ActionError( "errors.search", ex.getMessage() ) );
51        saveErrors( httpServletRequest, errors );
52        return( new ActionForward( actionMapping.getInput() ) );
53      }
54      return( actionMapping.findForward( "self" ) );
55    }
56  }
57