/*
 * $Id: VKCDocumentType.java,v 1.18 2005/07/14 12:50:41 korowa Exp $
 *
 * Copyright (c) Siemens AG 2008 
 *           (c) Universität Paderborn 2008 
 * Licensed under EUPL 1.1. 
 *
 * $Log: VKCDocumentType.java,v $
 * Revision 1.18  2005/07/14 12:50:41  korowa
 * +3 neue dateitypen sind in Datenbank reingekommen(odt,fh11,fh8)
 * +neue Eigenschaft(editable) von Dokumenttype, die Editierbarkeit eines Dokumentes in VKC anzeigt
 *
 * Revision 1.17  2005/06/23 22:28:11  marbobo
 * + Fehlende Icon-Bilder hinmzugefügt
 * + Alle Icon-Pfade korrigiert
 * + Alle Icon-Methoden korrigiert und optimiert
 *
 * Revision 1.16  2005/06/23 11:42:43  korowa
 * Image-Path für Icons wird jetzt aus Datenbank geholt
 *
 * Revision 1.15  2004/05/12 09:44:51  jonyp
 * + icon method
 *
 * Revision 1.14  2004/03/10 10:03:10  bigmac
 * *** empty log message ***
 *
 * Revision 1.13  2004/03/07 13:45:47  bigmac
 * Anpassungen an VKCDocumentTypeSerializer, VKCDocumentClassSerializer, VKCDocumentStatusSerializer
 *
 * Revision 1.12  2004/02/20 16:37:24  bigmac
 * toString()-Methode erweitert
 *
 * Revision 1.11  2004/02/16 14:45:16  bigmac
 * +getLowerCaseExtension()
 *
 * Revision 1.10  2004/01/16 14:24:08  koppy
 * Kleine Erweiterungen bzgl. der Konvertierung
 *
 * Revision 1.9  2003/09/15 14:43:19  jonyp
 * internal flag
 *
 * Revision 1.8  2003/08/28 16:11:02  jonyp
 * imgPath_...
 *
 * Revision 1.7  2003/07/24 13:56:50  jonyp
 * docTypeId als start ist integer(0)
 *
 * Revision 1.6  2003/07/10 19:59:06  koppy
 * Anpassungen für neuen Dokumenttyp "NOTE"
 *
 * Revision 1.5  2003/03/03 22:53:45  koppy
 * Kleinigkeiten, bugfixes
 *
 * Revision 1.4  2002/11/12 15:38:15  koppy
 * +mimetype
 *
 * Revision 1.3  2002/11/10 19:27:55  koppy
 * <No Comment Entered>
 *
 * Revision 1.2  2002/11/04 02:04:32  koppy
 * long --> Integer
 *
 * Revision 1.1  2002/10/21 14:35:38  bigmac
 * *** empty log message ***
 *
 * Revision 1.1  2002/09/16 12:13:54  koppy
 * Initial version
 *
 */

package vkc.db.entities;

import java.io.Serializable;

/**
 * Klasse stellt einen Dokumenttyp im VKC-System dar
 *
 * @author koppy
 */
public class VKCDocumentType implements Serializable {
    public static final String VIRTUAL = "virtual";
    public static final String VERSION = "version";
    public static final String SHADED = "shaded";
    public static final String DELIMITER = "_";
    public static final String POINT = ".";

    private Integer docTypeId = new Integer(0);
	private Integer internal = new Integer(0);
	private Integer convertible = new Integer(0);
	private Integer editable = new Integer(0);

	private String  extension = "?";
	private String  extensionKey = "";
	private String  description = "undefined";
	private String  descriptionKey = "";
	private String  shortDescription = "undefined";
	private String  mimeType = "text/plain";
	private String  imgPath				="";
	private String  iconExtension		="";
	
	/**
	 * Konstruktor
	 */
	public VKCDocumentType() {
	}

	/**
	 * Konstruktor
	 *
	 * @param type Dokumenttyp
	 */
	public VKCDocumentType(String extension) {
		this.extension = extension;
	}

	public Integer getDocTypeId() {
		return this.docTypeId;
	}

	public void setDocTypeId(Integer docTypeId) {
		this.docTypeId = docTypeId;
	}

	public java.lang.String getExtension() {
		return this.extension;
	}

	public String getLowerCaseExtension() {
		return extension.toLowerCase();
	}

	public void setExtension(java.lang.String extension) {
		this.extension = extension;
	}

	public String getExtensionLabel() {
        return "*." + extension;
	}

	public java.lang.String getDescription() {
		return this.description;
	}

	public void setDescription(java.lang.String description) {
		this.description = description;
	}
	
	public java.lang.String getShortDescription() {
		return this.shortDescription;
	}

	public void setShortDescription(java.lang.String shortDescription) {
		this.shortDescription = shortDescription;
	}

	public String getMimeType() {
		return mimeType;
	}
	
	public void setMimeType(String mimeType) {
		this.mimeType = mimeType;
	}
	
	public String getImgPath() {
		return imgPath;
	}
	
	public void setImgPath(String path) {
		this.imgPath= path;
	}
	
	public Integer getInternal() {
		return internal;
	}
	
	public void setInternal(Integer integer) {
		internal = integer;
	}

	public Integer getConvertible() {
		return convertible;
	}

	/**
	 * Is this document type convertible?
	 * 
	 * @return true, if this document type is convertible
	 */
	public boolean isConvertible(){
		if (this.convertible == null) {
			return false;
		}
			
		return this.convertible.intValue() == 1;
	}
	
	public void setConvertible(Integer integer) {
		convertible = integer;
	}

	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append( "DOCTYPE ext = " + extension );
		sb.append( ", extLabel = " + getExtensionLabel() );
		sb.append( ", id = " + docTypeId );
		
		return sb.toString();
	}

	public String getDescriptionKey() {
		return descriptionKey;
	}

	public String getExtensionKey() {
		return extensionKey;
	}

	public void setDescriptionKey(String string) {
		descriptionKey = string;
	}

	public void setExtensionKey(String string) {
		extensionKey = string;
	}
	
	public String getTypeIcon() {
		return "";	
	}
	/**
     * @param Überprüfung auf Editierbarkeit eines Documents im VKC.
     * 	true bedeutet editierbar
     */
	
	public boolean isEditable(){
	    if(editable!=null&&editable.intValue()==1)return true;
	    return false;
	}
	
	public void setEditable(Integer i){
	    editable=i;
	}
	/**
     * @return gibt die Erweiterung des Icons für den Dokumenttyp zurück.
     */
    public String getIconExtension() {
        return iconExtension;
    }
    
    /**
     * @param Setz die Erweiterung des Icons für ein Dokumenttyp.
     */
    public void setIconExtension(String imgExtension) {
        this.iconExtension = imgExtension;
    }
}