package de.thomasjacob.improve.presentation.user;

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

import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.ValidatorForm;


public class UserForm extends ValidatorForm
{
	private String administrator = "";

	private String[] developerProjects = new String[0];

	private String email = "";

	private String enabled = "";

	private String guest = "";

	private String[] managerProjects = new String[0];

	private String name = "";

	private String newProjectId = "";

	private String password1 = "";

	private String password2 = "";

	private String[] reporterProjects = new String[0];

	private String userId = "";

	public static UserForm getInstance(HttpServletRequest request)
	{
		HttpSession session = request.getSession();
		UserForm form = (UserForm) session.getAttribute("userForm");
		if (form == null)
		{
			form = new UserForm();
			session.setAttribute("userForm", form);
		}

		return form;
	}

	public String getAdministrator()
	{
		return this.administrator;
	}

	public String[] getDeveloperProjects()
	{
		return this.developerProjects;
	}

	public String getEmail()
	{
		return email;
	}

	public String getEnabled()
	{
		return enabled;
	}

	public String getGuest()
	{
		return this.guest;
	}

	public String[] getManagerProjects()
	{
		return this.managerProjects;
	}

	public String getName()
	{
		return name;
	}

	public String getNewProjectId()
	{
		return this.newProjectId;
	}

	public String getPassword1()
	{
		return password1;
	}

	public String getPassword2()
	{
		return password2;
	}

	public String[] getReporterProjects()
	{
		return this.reporterProjects;
	}

	public String getUserId()
	{
		return userId;
	}

	public void reset(ActionMapping mapping, HttpServletRequest request)
	{
		super.reset(mapping, request);

		administrator = "";
		developerProjects = new String[0];
		email = "";
		enabled = "";
		guest = "";
		managerProjects = new String[0];
		name = "";
		newProjectId = "";
		password1 = "";
		password2 = "";
		reporterProjects = new String[0];
		userId = "";
	}

	public void setAdministrator(String administrator)
	{
		this.administrator = administrator;
	}

	public void setDeveloperProjects(String[] developerProjects)
	{
		this.developerProjects = developerProjects;
	}

	public void setEmail(String email)
	{
		this.email = email;
	}

	public void setEnabled(String enabled)
	{
		this.enabled = enabled;
	}

	public void setGuest(String guest)
	{
		this.guest = guest;
	}

	public void setManagerProjects(String[] managerProjects)
	{
		this.managerProjects = managerProjects;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public void setNewProjectId(String newProject)
	{
		this.newProjectId = newProject;
	}

	public void setPassword1(String password1)
	{
		this.password1 = password1;
	}

	public void setPassword2(String password2)
	{
		this.password2 = password2;
	}

	public void setReporterProjects(String[] customerProjects)
	{
		this.reporterProjects = customerProjects;
	}

	public void setUserId(String userId)
	{
		this.userId = userId;
	}

	public static class Project
	{

		private String id;

		private String name;

		public String getId()
		{
			return this.id;
		}

		public String getName()
		{
			return this.name;
		}

		public void setId(String id)
		{
			this.id = id;
		}

		public void setName(String name)
		{
			this.name = name;
		}
	}
}