package zall.action;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import zall.bean.User;
import zall.util.msg.UserMessage;
import zutil.db.DBConnection;

public abstract class ZalleryAction {

	private final String actionId;
	private final boolean requireUser;
	
	public ZalleryAction(String actionId){
		this(actionId, false);
	}
	
	public ZalleryAction(String actionId, boolean requireUser){
		this.actionId = actionId;
		this.requireUser = requireUser;
	}
	
	public abstract void handleRequest(
			DBConnection db, 
			HttpServletRequest request,
			HttpServletResponse response,
			HttpSession session, 
			PrintWriter out, 
			User user, 
			UserMessage msgs) throws Exception;
	
	
	public String getActionId(){
		return actionId;
	}
	
	public boolean requireUser(){
		return requireUser;
	}
}
