/*
 * $Id: RegisteredDocument.java,v 1.9 2008/02/12 09:39:59 korowa Exp $
 *
 * Copyright (c) Siemens AG 2008 
 *           (c) Universität Paderborn 2008 
 * Licensed under EUPL 1.1. 
 * 
 * $Log: RegisteredDocument.java,v $
 * Revision 1.9  2008/02/12 09:39:59  korowa
 * + Eine Möglichkeit für den Benutzer hinzugefügt die Emailsart auszuwählen (HTML oder Plaintext)
 * + Betreff für den Messenger der als Emailsubject bei Benachrichtigung übers erscheinen von VKC Dokumenten verschickt wird.
 *
 * Revision 1.8  2004/08/23 19:13:57  marbobo
 * +  NPE abgefangen
 *
 * Revision 1.7  2004/07/20 08:51:21  jonyp
 * added copyright info + cvs log
 *
 */
package vkc.view.bean;

import java.io.Serializable;

import vkc.db.entities.VKCDocumentType;
import vkc.db.entities.VKCEntity;
import vkc.db.serializer.VKCCategorySerializer;
import vkc.exception.DBException;
import vkc.util.VKCCategoryAbsPath;

/**
 * Diese Bean stellt ein zu registrierendes Dokument dar
 *
 * @author marbobo
 */
public final class RegisteredDocument implements Serializable {
	private String name = "";
	private String title = "";
	private String description = "";
    private String subjectForNotification = "";
	private Integer documentId = VKCEntity.ID_UNDEFINED;	
	private Integer categoryId = VKCEntity.ID_UNDEFINED;
	private Integer threshold = new Integer(10);
	private VKCDocumentType docType;

	public String getName() {
		return name;
	}

	public void setName(String string) {
		name = string;
	}

	public String getTitle() {
	    return title;
	}

	public void setTitle(String string) {
		title = string;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String string) {
		description = string;
	}

	public Integer getDocumentId() {
		return documentId;
	}

	public void setDocumentId(Integer integer) {
		documentId = integer;
	}

	public Integer getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(Integer integer) {
		categoryId = integer;
	}

	public Integer getThreshold() {
		return threshold;
	}

	public void setThreshold(Integer integer) {
		threshold = integer;
	}

	public VKCDocumentType getDocType() {
		return docType;
	}

	public void setDocType(VKCDocumentType type) {
		docType = type;
	}
	
	public final boolean isLink() {
		return "LINK".equals( getDocType().getExtension() );
	}

	public final boolean isNote() {
		return "NOTE".equals( getDocType().getExtension() );
	}

	public final boolean isFile() {
		return !isNote() && !isLink();
	}
	
	public VKCCategoryAbsPath getCategoryAbsPath() throws DBException {
		VKCCategoryAbsPath cap = VKCCategorySerializer.getCategoryAbsPath( getCategoryId() ); 
		    
		if ( cap != null ) {
			return cap;
		}
		
		return new VKCCategoryAbsPath();
	}

    public String getSubjectForNotification() {
        return subjectForNotification;
    }

    public void setSubjectForNotification(String subjectForNotification) {
        this.subjectForNotification = subjectForNotification;
    }
}