ResourceRss.java

  1. /*
  2.  * Copyright (c) 2002-2022, City of Paris
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  *
  9.  *  1. Redistributions of source code must retain the above copyright notice
  10.  *     and the following disclaimer.
  11.  *
  12.  *  2. Redistributions in binary form must reproduce the above copyright notice
  13.  *     and the following disclaimer in the documentation and/or other materials
  14.  *     provided with the distribution.
  15.  *
  16.  *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
  17.  *     contributors may be used to endorse or promote products derived from
  18.  *     this software without specific prior written permission.
  19.  *
  20.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21.  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23.  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
  24.  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  25.  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  26.  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  27.  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  28.  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  29.  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  30.  * POSSIBILITY OF SUCH DAMAGE.
  31.  *
  32.  * License 1.0
  33.  */
  34. package fr.paris.lutece.portal.business.rss;

  35. /**
  36.  * ResourceRss that provides the resources rss. Implementations should override {@link #getFeed()}.
  37.  */
  38. public abstract class ResourceRss implements IResourceRss
  39. {
  40.     private int _nId;
  41.     private String _strEncoding;
  42.     private IResourceRssType _taskType;
  43.     private String _strName;
  44.     private String _strDescription;
  45.     private String _strFeedType;
  46.     private int _nMaxItems;

  47.     /**
  48.      * Get the rss id
  49.      *
  50.      * @return the rss Id
  51.      */
  52.     @Override
  53.     public int getId( )
  54.     {
  55.         return _nId;
  56.     }

  57.     /**
  58.      * Set the rss id
  59.      *
  60.      * @param nId
  61.      *            the rss id
  62.      */
  63.     @Override
  64.     public void setId( int nId )
  65.     {
  66.         _nId = nId;
  67.     }

  68.     /**
  69.      * Get Rss resource Description
  70.      *
  71.      * @return the description
  72.      */
  73.     @Override
  74.     public String getDescription( )
  75.     {
  76.         return _strDescription;
  77.     }

  78.     /**
  79.      * Set the RSS resource description
  80.      *
  81.      * @param strDescription
  82.      *            the description
  83.      */
  84.     @Override
  85.     public void setDescription( String strDescription )
  86.     {
  87.         _strDescription = strDescription;
  88.     }

  89.     /**
  90.      * Get The RSS resource name
  91.      *
  92.      * @return the name
  93.      */
  94.     @Override
  95.     public String getName( )
  96.     {
  97.         return _strName;
  98.     }

  99.     /**
  100.      * Set the RSS resource name
  101.      *
  102.      * @param strName
  103.      *            the name
  104.      */
  105.     @Override
  106.     public void setName( String strName )
  107.     {
  108.         _strName = strName;
  109.     }

  110.     /**
  111.      * Get the RSS Resource Type
  112.      *
  113.      * @return the ResourceRssType Object
  114.      */
  115.     @Override
  116.     public IResourceRssType getResourceRssType( )
  117.     {
  118.         return _taskType;
  119.     }

  120.     /**
  121.      * Set the ResourceRssType object.
  122.      *
  123.      * @param taskType
  124.      *            the new resource rss type
  125.      */
  126.     @Override
  127.     public void setResourceRssType( IResourceRssType taskType )
  128.     {
  129.         _taskType = taskType;
  130.     }

  131.     /**
  132.      *
  133.      * {@inheritDoc}
  134.      */
  135.     @Override
  136.     public String getFeedType( )
  137.     {
  138.         return _strFeedType;
  139.     }

  140.     /**
  141.      *
  142.      * {@inheritDoc}
  143.      */
  144.     @Override
  145.     public void setFeedType( String strFeedType )
  146.     {
  147.         _strFeedType = strFeedType;
  148.     }

  149.     /**
  150.      *
  151.      * {@inheritDoc}
  152.      */
  153.     @Override
  154.     public String getEncoding( )
  155.     {
  156.         return _strEncoding;
  157.     }

  158.     /**
  159.      *
  160.      * {@inheritDoc}
  161.      */
  162.     @Override
  163.     public void setEncoding( String strEncoding )
  164.     {
  165.         _strEncoding = strEncoding;
  166.     }

  167.     /**
  168.      *
  169.      * {@inheritDoc}
  170.      */
  171.     @Override
  172.     public int getMaxItems( )
  173.     {
  174.         return _nMaxItems;
  175.     }

  176.     /**
  177.      *
  178.      * {@inheritDoc}
  179.      */
  180.     @Override
  181.     public void setMaxItems( int nMaxItems )
  182.     {
  183.         _nMaxItems = nMaxItems;
  184.     }

  185.     /**
  186.      * Returns <code>null</code>. This method should be overriden.
  187.      *
  188.      * @return the feed
  189.      */
  190.     @Override
  191.     public IFeedResource getFeed( )
  192.     {
  193.         return null;
  194.     }
  195. }