package de.thomasjacob.improve.presentation.issue.edit;

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

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


public class IssueForm extends ValidatorForm
{
	private String comment = "";

	private String reporterName = "";

	private String description = "";

	private String developerId = "";

	private String developerName = "";

	private HistoryEntry[] historyEntries = new HistoryEntry[0];

	private String issueId = "";

	private String name = "";

	private String priority = "";

	private String projectId = "";

	private String projectName = "";

	private String status = "";

	private String statusName = "";

	private String type = "";

	private String typeName = "";

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

		return form;
	}

	public String getComment()
	{
		return this.comment;
	}

	public String getReporterName()
	{
		return this.reporterName;
	}

	public String getDescription()
	{
		return this.description;
	}

	public String getDeveloperId()
	{
		return this.developerId;
	}

	public String getDeveloperName()
	{
		return this.developerName;
	}

	public HistoryEntry[] getHistoryEntries()
	{
		return this.historyEntries;
	}

	public String getIssueId()
	{
		return this.issueId;
	}

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

	public String getPriority()
	{
		return this.priority;
	}

	public String getProjectId()
	{
		return this.projectId;
	}

	public String getProjectName()
	{
		return this.projectName;
	}

	public String getStatus()
	{
		return this.status;
	}

	public String getStatusName()
	{
		return this.statusName;
	}

	public String getType()
	{
		return this.type;
	}

	public String getTypeName()
	{
		return this.typeName;
	}

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

		comment = "";
		reporterName = "";
		description = "";
		developerId = "";
		developerName = "";
		issueId = "";
		historyEntries = new HistoryEntry[0];
		name = "";
		priority = "";
		projectId = "";
		projectName = "";
		status = "";
		statusName = "";
		type = "";
		typeName = "";
	}

	public void setComment(String comment)
	{
		this.comment = comment;
	}

	public void setReporterName(String reporterName)
	{
		this.reporterName = reporterName;
	}

	public void setDescription(String description)
	{
		this.description = description;
	}

	public void setDeveloperId(String developerId)
	{
		this.developerId = developerId;
	}

	public void setDeveloperName(String developerName)
	{
		this.developerName = developerName;
	}

	public void setHistoryEntries(HistoryEntry[] historyEntries)
	{
		this.historyEntries = historyEntries;
	}

	public void setIssueId(String issueId)
	{
		this.issueId = issueId;
	}

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

	public void setPriority(String priority)
	{
		this.priority = priority;
	}

	public void setProjectId(String projectId)
	{
		this.projectId = projectId;
	}

	public void setProjectName(String projectName)
	{
		this.projectName = projectName;
	}

	public void setStatus(String status)
	{
		this.status = status;
	}

	public void setStatusName(String statusName)
	{
		this.statusName = statusName;
	}

	public void setType(String type)
	{
		this.type = type;
	}

	public void setTypeName(String typeName)
	{
		this.typeName = typeName;
	}

	public static class HistoryEntry
	{
		private String comment = "";

		private String date = "";

		private String editor = "";

		private String status = "";

		public String getComment()
		{
			return this.comment;
		}

		public String getDate()
		{
			return this.date;
		}

		public String getEditor()
		{
			return this.editor;
		}

		public String getStatus()
		{
			return this.status;
		}

		public void setComment(String comment)
		{
			this.comment = comment;
		}

		public void setDate(String date)
		{
			this.date = date;
		}

		public void setEditor(String editor)
		{
			this.editor = editor;
		}

		public void setStatus(String status)
		{
			this.status = status;
		}
	}
}
