/**
 * ITitlePersistenceService.java
 * Created Apr 17, 2008
 * Copyright (c) TANDBERG Television 2007-2008
 */
package com.tandbergtv.watchpoint.pmm.title;

import java.io.Serializable;

import com.tandbergtv.metadatamanager.exception.SearchException;
import com.tandbergtv.watchpoint.pmm.entities.Title;
import com.tandbergtv.workflow.core.service.Service;

/**
 * Title persistence service interface
 * 
 * @author Sahil Verma
 */
public interface ITitlePersistenceService extends Service {
	
	/**
	 * Saves the specified title. If the title does not have a key, one will be generated. 
	 * 
	 * @param title
	 */
	void save(Title title);
	
	/**
	 * Updates just the metadata (asset).
	 * Returns the updated Title.
	 */
	public Title updateMetadata(Title t);

	/**
	 * Returns the title using the specified key
	 * 
	 * @param id
	 * @return
	 */
	Title get(Serializable id);
	
	/**
	 * Gets the title with specified id and version.
	 * No title properties except for contained asset will be available.
	 */
	Title get(Serializable id, String version) throws SearchException;
	
	/**
	 * Removes the title
	 * 
	 * @param id
	 * @return true if the title was successfully deleted, false if the title does not exist.
	 */
	boolean delete(Serializable id);

}
