/**
 * TitleBean.java
 * Created May 27, 2008
 * Copyright (c) TANDBERG Television 2007-2008
 */
package com.tandbergtv.watchpoint.pmm.web.title;

import java.util.Collection;

import com.tandbergtv.metadatamanager.model.Field;
import com.tandbergtv.watchpoint.pmm.entities.Title;
import com.tandbergtv.watchpoint.pmm.entities.TitleStatus;

/**
 * A simple title wrapper to satisfy Struts' urges
 * 
 * @author Sahil Verma
 */
public class TitleBean {
	
	protected Title title;
	
	protected boolean hasAlert;

	protected String externalKey;

	protected String externalLocationName;

	protected String urlQueryString;

	private Collection<Field> titleFields;

	/**
	 * Creates a TitleBean
	 * @param title
	 */
	public TitleBean(Title title) {
		this.title = title;
	}

	/**
	 * @return the title
	 */
	public Title getTitle() {
		return this.title;
	}

	/**
	 * @param title the title to set
	 */
	public void setTitle(Title title) {
		this.title = title;
	}

	/**
	 * @return the hasAlert
	 */
	public boolean isHasAlert() {
		return this.hasAlert;
	}

	/**
	 * @param hasAlert the hasAlert to set
	 */
	public void setHasAlert(boolean hasAlert) {
		this.hasAlert = hasAlert;
	}
	
	/**
	 * Return the metadata field value
	 * 
	 * @param name
	 * @return
	 */
	public String getTitleMetadata(String name, String sectionName) {
		return com.tandbergtv.watchpoint.pmm.title.TitleUtil.getMetadataValue(
				this.titleFields, name, sectionName);
	}
	
	public Long getId() {
		return this.title.getId();
	}

	public TitleStatus getStatus() {
		return this.title.getStatus();
	}

	public String getExternalKey() {
		return this.externalKey;
	}
	
	public void setExternalKey(String externalKey) {
		this.externalKey = externalKey;
	}

	public String getUrlQueryString() {
		return urlQueryString;
	}
	
	public void setUrlQueryString(String queryString) {
		this.urlQueryString = queryString;
	}

	/**
	 * @return the externalLocationName
	 */
	public String getExternalLocationName() {
		return externalLocationName;
	}

	/**
	 * @param externalLocationName the externalLocationName to set
	 */
	public void setExternalLocationName(String externalLocationName) {
		this.externalLocationName = externalLocationName;
	}

	/**
	 * @return the titleFields
	 */
	public Collection<Field> getTitleFields() {
		return titleFields;
	}

	/**
	 * @param titleFields the titleFields to set
	 */
	public void setTitleFields(Collection<Field> titleFields) {
		this.titleFields = titleFields;
	}
}
