001/*
002 *  Copyright 2015 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.plugins.syndication;
017
018import java.util.Date;
019
020import com.rometools.rome.feed.synd.SyndFeed;
021
022
023/**
024 * A feed retrieve result.
025 */
026public class FeedResult
027{
028    
029    /** The status is unknown. */
030    public static final int STATUS_UNKNOWN = 0;
031    
032    /** Status indicating that the feed was retrieved successfully. */
033    public static final int STATUS_OK = 1;
034    
035    /** Status indicating that there was an error retrieving the feed. */
036    public static final int STATUS_ERROR = 2;
037    
038    /** The status. */
039    protected int _status;
040    
041    /** The feed. */
042    protected SyndFeed _feed;
043    
044    /** The message error. */
045    protected String _messageError;
046    
047    /** The creation date. */
048    protected Date _creationDate;
049    
050    /**
051     * Build a FeedResult object, status unknown.
052     */
053    public FeedResult()
054    {
055        this(STATUS_UNKNOWN, null);
056    }
057    
058    /**
059     * Build a FeedResult object.
060     * @param status the status.
061     * @param feed the feed.
062     */
063    public FeedResult(int status, SyndFeed feed)
064    {
065        this._status = status;
066        this._feed = feed;
067    }
068
069    /**
070     * Get the status.
071     * @return the status
072     */
073    public int getStatus()
074    {
075        return _status;
076    }
077
078    /**
079     * Set the status.
080     * @param status the status to set
081     */
082    public void setStatus(int status)
083    {
084        this._status = status;
085    }
086
087    /**
088     * Get the feed.
089     * @return the feed
090     */
091    public SyndFeed getSynFeed()
092    {
093        return _feed;
094    }
095    
096    /**
097     * Get the message error.
098     * @return the message error
099     */
100    public String getMessageError()
101    {
102        return _messageError;
103    }
104    
105    /**
106     * Set the message error.
107     * @param messageError the message error to set
108     */
109    public void setMessageError(String messageError)
110    {
111        this._messageError = messageError;
112    }
113
114    /**
115     * Set the feed.
116     * @param feed the feed to set
117     */
118    public void setResponse(SyndFeed feed)
119    {
120        this._feed = feed;
121    }
122    
123    /**
124     * Get the creation date.
125     * @return the creation date
126     */
127    public Date getCreationDate()
128    {
129        return _creationDate;
130    }
131
132    /**
133     * Set the creation Date.
134     * @param creationDate the creation date to set
135     */
136    public void setCreationDate(Date creationDate)
137    {
138        this._creationDate = creationDate;
139    }
140    
141}