/*
 * $Id: ShowCategoryFavoritesForm.java,v 1.5 2006/03/27 15:24:15 marbobo Exp $
 *
 * Copyright (c) Siemens AG 2008 
 *           (c) Universität Paderborn 2008 
 * Licensed under EUPL 1.1. 
 *
 * $Log: ShowCategoryFavoritesForm.java,v $
 * Revision 1.5  2006/03/27 15:24:15  marbobo
 * + Bugfix
 *
 * Revision 1.4  2004/08/19 12:16:56  marbobo
 * +Umgeschrieben und Bugfix
 *
 * Revision 1.3  2004/08/09 16:08:53  jonyp
 * changes due change of category favorites class
 *
 * Revision 1.2  2004/07/20 08:36:17  jonyp
 * added copyright info + cvs log
 *
 */

package vkc.profile.form;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionMapping;

import vkc.db.serializer.VKCCategoryFavoritesSerializer;
import vkc.exception.DBException;
import vkc.view.form.BasicActionForm;

public class ShowCategoryFavoritesForm extends BasicActionForm {
	private Integer[] selectedIds = new Integer[0];
	
	private List favoriteCats = null;
		
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		super.reset(mapping, request);

		selectedIds = new Integer[0];
		
		favoriteCats = null;
	}

	public List getFavoriteCats() throws DBException {
		if (favoriteCats == null) {
		    favoriteCats = VKCCategoryFavoritesSerializer.retrieveCategoryFavorites(getUser().getUserId());
		}
	    
	    return favoriteCats;
	}

	public Integer[] getSelectedIds() {
		return selectedIds;
	}

	public void setFavoriteCats(List list) {
		favoriteCats = list;
	}

	public void setSelectedIds(Integer[] integers) {
		selectedIds = integers;
	}
}