1 /* 2 * Copyright (c) 2002-2014, Mairie de 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.plugins.rss.business; 35 36 import fr.paris.lutece.portal.service.workgroup.AdminWorkgroupResource; 37 38 import java.sql.Timestamp; 39 40 41 /** 42 * This class represents the business object RssFeed 43 */ 44 public class RssFeed implements AdminWorkgroupResource 45 { 46 // Variables declarations 47 private int _nId; 48 private String _strName; 49 private String _strUrl; 50 private Timestamp _dateLastFetch; 51 private int _nLastFetchStatus; 52 private String _strLastFetchError; 53 private String _strWorkgroup; 54 private String _strIncludeTag; 55 private int _nIdIncludeStyle; 56 private boolean _bActive; 57 58 /** 59 * Returns the Id 60 * 61 * @return The Id 62 */ 63 public int getId( ) 64 { 65 return _nId; 66 } 67 68 /** 69 * Sets the Id 70 * 71 * @param nId The Id 72 */ 73 public void setId( int nId ) 74 { 75 _nId = nId; 76 } 77 78 /** 79 * Returns the Name 80 * 81 * @return The Name 82 */ 83 public String getName( ) 84 { 85 return _strName; 86 } 87 88 /** 89 * Sets the Name 90 * 91 * @param strName The Name 92 */ 93 public void setName( String strName ) 94 { 95 _strName = strName; 96 } 97 98 /** 99 * Returns the Url 100 * 101 * @return The Url 102 */ 103 public String getUrl( ) 104 { 105 return _strUrl; 106 } 107 108 /** 109 * Sets the Url 110 * 111 * @param strUrl The Url 112 */ 113 public void setUrl( String strUrl ) 114 { 115 _strUrl = strUrl; 116 } 117 118 /** 119 * Returns the LastFetchDate 120 * 121 * @return The LastFetchDate 122 */ 123 public Timestamp getLastFetchDate( ) 124 { 125 return _dateLastFetch; 126 } 127 128 /** 129 * Sets the LastFetchDate 130 * 131 * @param dateLastFetch The last fetch date 132 */ 133 public void setLastFetchDate( Timestamp dateLastFetch ) 134 { 135 _dateLastFetch = dateLastFetch; 136 } 137 138 /** 139 * Overrides the default implementation 140 * @return A String representation of the object 141 */ 142 @Override 143 public String toString( ) 144 { 145 return "RSS Feed : " + _strName + "\n - url : " + _strUrl + "\n - last fetch : " + _dateLastFetch + 146 "\n - status : " + ( ( _nLastFetchStatus == 0 ) ? "success" : "failed" ); 147 } 148 149 /** 150 * Returns the LastFetchStatus 151 * 152 * @return The LastFetchStatus 153 */ 154 public int getLastFetchStatus( ) 155 { 156 return _nLastFetchStatus; 157 } 158 159 /** 160 * Sets the LastFetchStatus 161 * 162 * @param nLastFetchStatus The LastFetchStatus 163 */ 164 public void setLastFetchStatus( int nLastFetchStatus ) 165 { 166 _nLastFetchStatus = nLastFetchStatus; 167 } 168 169 /** 170 * Returns the LastFetchError 171 * 172 * @return The LastFetchError 173 */ 174 public String getLastFetchError( ) 175 { 176 return _strLastFetchError; 177 } 178 179 /** 180 * Sets the LastFetchError 181 * 182 * @param strLastFetchError The LastFetchError 183 */ 184 public void setLastFetchError( String strLastFetchError ) 185 { 186 _strLastFetchError = strLastFetchError; 187 } 188 189 /** 190 * 191 * @return the work group associate to the category 192 */ 193 public String getWorkgroup( ) 194 { 195 return _strWorkgroup; 196 } 197 198 /** 199 * set the work group associate to the category 200 * @param workGroup the work group associate to the category 201 */ 202 public void setWorkgroup( String workGroup ) 203 { 204 _strWorkgroup = workGroup; 205 } 206 207 /** 208 * 209 * @return the label of include tag 210 */ 211 public String getIncludeTag( ) 212 { 213 return _strIncludeTag; 214 } 215 216 /** 217 * set the include tag of the rss feed 218 * @param strIncludeTag the include tag of the rss feed 219 */ 220 public void setIncludeTag( String strIncludeTag ) 221 { 222 _strIncludeTag = strIncludeTag; 223 } 224 225 /** 226 * 227 * @return the id of include style of the rss feed 228 */ 229 public int getIdIncludeStyle( ) 230 { 231 return _nIdIncludeStyle; 232 } 233 234 /** 235 * set the id of include style of the rss feed 236 * @param nIncludeStyle set the id of include style of the rss feed 237 */ 238 public void setIdIncludeStyle( int nIdIncludeStyle ) 239 { 240 _nIdIncludeStyle = nIdIncludeStyle; 241 } 242 243 /** 244 * 245 * @return true if this feed is active 246 */ 247 public boolean getIsActive( ) 248 { 249 return _bActive; 250 } 251 252 /** 253 * 254 * @param bActive 255 */ 256 public void setIsActive( boolean bActive ) 257 { 258 _bActive = bActive; 259 } 260 }