001 //$HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/base/branches/2.5_testing/src/org/deegree/portal/standard/csw/control/DetailedMetadataListener.java $ 002 /*---------------------------------------------------------------------------- 003 This file is part of deegree, http://deegree.org/ 004 Copyright (C) 2001-2009 by: 005 Department of Geography, University of Bonn 006 and 007 lat/lon GmbH 008 009 This library is free software; you can redistribute it and/or modify it under 010 the terms of the GNU Lesser General Public License as published by the Free 011 Software Foundation; either version 2.1 of the License, or (at your option) 012 any later version. 013 This library is distributed in the hope that it will be useful, but WITHOUT 014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 015 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 016 details. 017 You should have received a copy of the GNU Lesser General Public License 018 along with this library; if not, write to the Free Software Foundation, Inc., 019 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 020 021 Contact information: 022 023 lat/lon GmbH 024 Aennchenstr. 19, 53177 Bonn 025 Germany 026 http://lat-lon.de/ 027 028 Department of Geography, University of Bonn 029 Prof. Dr. Klaus Greve 030 Postfach 1147, 53001 Bonn 031 Germany 032 http://www.geographie.uni-bonn.de/deegree/ 033 034 e-mail: info@deegree.org 035 ----------------------------------------------------------------------------*/ 036 037 package org.deegree.portal.standard.csw.control; 038 039 import java.util.HashMap; 040 041 import javax.servlet.http.HttpServletRequest; 042 import javax.servlet.http.HttpSession; 043 044 import org.deegree.enterprise.control.FormEvent; 045 import org.deegree.framework.log.ILogger; 046 import org.deegree.framework.log.LoggerFactory; 047 import org.deegree.i18n.Messages; 048 import org.deegree.ogcbase.CommonNamespaces; 049 import org.deegree.portal.standard.csw.configuration.CSWClientConfiguration; 050 051 /** 052 * A <code>${type_name}</code> class.<br/> TODO class description 053 * 054 * @author <a href="mailto:mays@lat-lon.de">Judit Mays</a> 055 * @author last edited by: $Author: apoth $ 056 * 057 * @version 2.0, $Revision: 27569 $, $Date: 2010-10-28 08:57:50 +0200 (Do, 28 Okt 2010) $ 058 * 059 * @since 2.0 060 */ 061 public class DetailedMetadataListener extends OverviewMetadataListener { 062 // extends OverviewMetadataListener --> SimpleSearchListener --> AbstractListener 063 064 private static final ILogger LOG = LoggerFactory.getLogger( DetailedMetadataListener.class ); 065 066 /* 067 * (non-Javadoc) 068 * 069 * @see org.deegree.enterprise.control.WebListener#actionPerformed(org.deegree.enterprise.control.FormEvent) 070 */ 071 @Override 072 public void actionPerformed( FormEvent event ) { 073 074 // get Metadata from the users sesssion 075 HttpSession session = ( (HttpServletRequest) this.getRequest() ).getSession( true ); 076 config = (CSWClientConfiguration) session.getAttribute( Constants.CSW_CLIENT_CONFIGURATION ); 077 078 nsContext = CommonNamespaces.getNamespaceContext(); 079 080 // get transformation file name 081 String fileName = "metaDetails2html.xsl"; // default value 082 // FIXME replace format with current value 083 String format = "Profiles.ISO19115"; 084 HashMap<?,?> xslMap = config.getProfileXSL( format ); 085 if ( xslMap != null ) { 086 if ( xslMap.get( "full" ) != null ) { 087 fileName = (String) xslMap.get( "full" ); 088 } 089 } 090 String pathToXslFile = "file:" + getHomePath() + "WEB-INF/conf/igeoportal/" + fileName; 091 092 Object o = session.getAttribute( SESSION_METADATA ); 093 if ( o != null ) { 094 try { 095 handleResult( o, pathToXslFile, "detailed" ); 096 } catch ( Exception e ) { 097 gotoErrorPage( Messages.getMessage( "IGEO_STD_CSW_ERROR_HANDLE_RESULT", e.getMessage() ) ); 098 LOG.logError( e.getMessage(), e ); 099 return; 100 } 101 } else { 102 // create error message if no metadata object is contained in the users session 103 setNextPage( "error.jsp" ); 104 try { 105 getRequest().setAttribute( Constants.MESSAGE, Messages.getMessage( "IGEO_STD_CSW_MISSING_METADATA" ) ); 106 } catch ( Exception e ) { 107 LOG.logError( e.getMessage(), e ); 108 } 109 } 110 111 } 112 113 }