/* * Copyright (c) 2002-2013, Mairie de Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright notice * and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice * and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * License 1.0 */ package fr.paris.lutece.plugins.${plugin_name}.business.portlet; import fr.paris.lutece.portal.business.portlet.Portlet; import fr.paris.lutece.util.xml.XmlUtil; import javax.servlet.http.HttpServletRequest; /** * This class represents business objects ${portlet.portletClass} */ public class ${portlet.portletClass} extends Portlet { ///////////////////////////////////////////////////////////////////////////////// // Constants private String _str${portlet.portletClass?cap_first}FeedId; private static final String TAG_${portlet.portletTypeName} = "${portlet.portletClass?lower_case}-portlet"; private static final String TAG_${portlet.portletTypeName}_CONTENT = "${portlet.portletClass?lower_case}-portlet-content"; /** * Sets the identifier of the portlet type to value specified */ public ${portlet.portletClass}( ) { setPortletTypeId( ${portlet.portletClass}Home.getInstance( ).getPortletTypeId( ) ); } /** * Sets the url of the portlet * * @param str${portlet.portletClass?cap_first}FeedId the ${portlet.portletClass?cap_first} portlet url */ public void set${portlet.portletClass?cap_first}FeedId( String str${portlet.portletClass?cap_first}FeedId ) { _str${portlet.portletClass?cap_first}FeedId = str${portlet.portletClass?cap_first}FeedId; } /** * Returns the ${portlet.portletClass?cap_first} Feed Id of the ${portlet.portletClass?cap_first} portlet * * @return the ${portlet.portletClass?cap_first} Portlet url */ public String get${portlet.portletClass?cap_first}FeedId( ) { return _str${portlet.portletClass?cap_first}FeedId; } /** * Returns the Xml code of the ${portlet.portletClass?cap_first} portlet with XML heading * * @param request The HTTP servlet request * @return the Xml code of the ${portlet.portletClass?cap_first} portlet */ public String getXmlDocument( HttpServletRequest request ) { return XmlUtil.getXmlHeader( ) + getXml( request ); } /** * Returns the Xml code of the ${portlet.portletClass?cap_first} portlet without XML heading * * @param request The HTTP servlet request * @return the Xml code of the ${portlet.portletClass?cap_first} portlet content */ public String getXml( HttpServletRequest request ) { StringBuffer strXml = new StringBuffer( ); XmlUtil.beginElement( strXml, TAG_${portlet.portletTypeName} ); XmlUtil.addElementHtml( strXml, TAG_${portlet.portletTypeName}_CONTENT, _str${portlet.portletClass?cap_first}FeedId ); XmlUtil.endElement( strXml, TAG_${portlet.portletTypeName} ); return addPortletTags( strXml ); } /** * Updates the current instance of the ${portlet.portletClass} object */ public void update( ) { ${portlet.portletClass}Home.getInstance( ).update( this ); } /** * Removes the current instance of the ${portlet.portletClass} object */ public void remove( ) { ${portlet.portletClass}Home.getInstance( ).remove( this ); } }