package org.appfuse.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;


/**
 * Template class
 *
 * This class is used to represent available templates in the database.
 *
 * <p>
 * <a href="Template.java.html"><i>View Source</i></a>
 * </p>
 *
 * @author <a href="mailto:matt@raibledesigns.com">Matt Raible</a>
 * @version $Revision: 1.1 $ $Date: 2004/03/31 13:04:16 $
 *
 * @struts.form include-all="true" extends="BaseForm"
 * @hibernate.class table="template"
 */
public class Template extends BaseObject implements Serializable {
    private Long id;
    private String content;
    private String name;
    private Date lastModified;

    public Template() {
        this.lastModified = new Date();
    }

    /**
     * Sets the id.
     * @param id The id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * Returns the id.
     * @return String
     *
     * @hibernate.id column="id"
     *  generator-class="increment" unsaved-value="null"
     */
    public Long getId() {
        return id;
    }

    /**
     * @param content The content to set.
     */
    public void setContent(String content) {
        this.content = content;
    }

    /**
     * @return Returns the content.
     * @struts.validator type="required"
     * @hibernate.property column="content" length="7000"
     */
    public String getContent() {
        return content;
    }

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

    /**
     * Returns the name.
     * @return String
     *
     * @struts.validator type="required"
     * @hibernate.property column="name" length="50"
     */
    public String getName() {
        return this.name;
    }

    /**
     * @return Returns the lastModified.
    * @hibernate.property column="last_modified" not-null="true"
     */
    public Date getLastModified() {
        return lastModified;
    }

    /**
     * @param lastModified The lastModified to set.
     */
    public void setLastModified(Date lastModified) {
        if (lastModified == null) {
            this.lastModified = new Date();
        } else {
            this.lastModified = lastModified;
        }
    }
}