/* ======================================================================
   Parts Copyright 2006 University of Leeds, Oxford University, University of the Highlands and Islands.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

====================================================================== */

package org.bodington.server.resources;

import java.util.Hashtable;

import org.bodington.database.PrimaryKey;

/**
 * Class for storing Blogs in the database. Most of the work is done in the superclass.
 * We need to have our own version  of the getters and setters as refactoring them
 * means changing the database (fields table) which is more hassel than it worth.
 * By default blogs are not displayed inline.
 * @author colin
 * @author buckett
 */
public class BlogResource extends FeedResource
{
    private final static int DEFAULT_FLAG_SETTINGS = DISPLAY_TITLE ^  DISPLAY_ITEM_TITLES ^ DISPLAY_ITEM_CONTENT ^
    ALLOW_TITLE_LINKS ^ DISPLAY_ITEM_DATE ^ DISPLAY_AUTHOR ^
    DISPLAY_ITEM_AUTHORS;

    public BlogResource()
    {
        paramMap = new Hashtable();
        setDisplayFlags(DEFAULT_FLAG_SETTINGS);
    }
    
    public PrimaryKey getBlogId()
    {
        return getResourceId();
    }

    public void setBlogId(PrimaryKey key)
    {
        setResourceId(key);
    }
    
    public String getBlogURL()
    {
        return getURL();
    }

    public void setBlogURL(String feedURL)
    {
        setURL(feedURL);
    }
    
    public int getResourceType()
    {
        return RESOURCE_BLOG;
    }
    
    /**
     * Shouldn't be used directly. This is needed for the database work.
     * @return The complete blog flags packed into an int.
     */
    public int getBlogFlags()
    {
        return getDisplayFlags();
    }

    /**
     * Shouldn't be used directly. This is needed for the database work.
     * @param f The blog flags packed into an int.
     */
    public void setBlogFlags(int f)
    {
        setDisplayFlags(f);
    }
}
