package org.ajax4jsf;



import java.util.logging.Logger;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

/**
 * @author krasi
 * 
 */
public class TestBean  {
	String				id		= "";
	static final Logger	LOGGER	= Logger.getLogger(TestBean.class.getName());

	public TestBean() {
	}

	public String getId() {
		
		FacesContext.getCurrentInstance().addMessage(
				null,
				new FacesMessage(FacesMessage.SEVERITY_ERROR, "Message 1.",
						""));

		System.out.println("GET 1 ------" + id);
		if (!id.equals("")) {
			System.out.println("GET 2 ------" + id);
			FacesContext.getCurrentInstance().addMessage(
					null,
					new FacesMessage(FacesMessage.SEVERITY_ERROR, "Message 2.",
							"11"));

			try {
				System.out.println("GET 3 ------" + id);
				throw new ObjectNotFoundException();

			} catch (ObjectNotFoundException e) {
				System.out.println("GET  4 ------" + id);
				FacesContext.getCurrentInstance().addMessage(
						null,
						new FacesMessage(FacesMessage.SEVERITY_ERROR, "Message 3.",
								"11"));
			}

		}

		return id;
	}

	public void setId(String id) {
		System.out.println("SET 1-" + id);
		this.id = id;
	}

	public String searchByID() {
		System.out.println("searchByID");
		return null;

	}

}
