/*
 * $Id: VKCPermission.java,v 1.12 2007/08/14 14:50:05 marbobo Exp $
 *
 * Copyright (c) Siemens AG 2008 
 *           (c) Universität Paderborn 2008 
 * Licensed under EUPL 1.1. 
 *
 * $Log: VKCPermission.java,v $
 * Revision 1.12  2007/08/14 14:50:05  marbobo
 * + Licenseverwaltung komplett umgeschrieben
 * + Kategoriesuche und verlorene Kategorien anzeigen komplett umgeschrieben
 * + Fehler beim Speichern von Beschreibenungsfeldern für Entitäten beseitigt.
 *
 * Revision 1.11  2005/06/12 20:32:00  jonyp
 * bug fix: use correct static CONTEXT_DOCUMENT
 *
 * Revision 1.10  2005/05/30 06:12:47  jonyp
 * *** empty log message ***
 *
 * Revision 1.9  2004/07/20 15:14:42  jonyp
 * added copyright info + cvs log
 *
 *
 */
package vkc.db.entities;

import java.io.Serializable;

/**
 * Klasse representiert eine Permission VKC-System
 * 
 * @author jonyP
 */
public class VKCPermission implements Serializable {
    public static final String CONTEXT_CATEGORY = "category";
    public static final String CONTEXT_DOCUMENT = "document";
    
    public static final String c = "c";
    public static final String d = "d";
    public static final String f = "f";
    public static final String i = "i";
    public static final String l = "l";
    public static final String r = "r";
    public static final String w = "w";

    public static final String C = "C";
    public static final String D = "D";
    public static final String F = "F";
    public static final String L = "L";
    public static final String M = "M";

    private char token;

    private Integer enabled = new Integer(0);

    private Integer numvalue;

    private Integer permissionId = new Integer(0);

    private String context;

    private String description;

    private String printstring;

    public VKCPermission() {
    }

    public VKCPermission(Integer permissionId, String context, char token, Integer numvalue, String printstring, String permission) {
        this.permissionId = permissionId;
        this.context = context;
        this.token = token;
        this.numvalue = numvalue;
        this.printstring = printstring;
    }

    public void setPermissionId(Integer i) {
        permissionId = i;
    }

    public Integer getPermissionId() {
        return permissionId;
    }

    public void setContext(String s) {
        context = s;
    }

    public String getContext() {
        return context;
    }

    public void setToken(char c) {
        token = c;
    }

    public char getToken() {
        return token;
    }

    public void setNumvalue(Integer i) {
        numvalue = i;
    }

    public Integer getNumvalue() {
        return numvalue;
    }

    public void setPrintstring(String s) {
        printstring = s;
    }

    public String getPrintstring() {
        return printstring;
    }

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

    public String getDescription() {
        return description;
    }

    public boolean equals(Object o) {
        if (!(o instanceof VKCPermission)) {
            return false;
        }

        VKCPermission p = (VKCPermission) o;
        String unique = p.getContext() + String.valueOf(p.getToken());

        return unique.equals(getContext() + String.valueOf(getToken()));
    }

    public int hashCode() {
        String unique = getContext() + String.valueOf(getToken());

        return unique.hashCode();
    }

    public String toString() {
        return getContext() + "_" + String.valueOf(getToken());
    }

    public Integer getEnabled() {
        return enabled;
    }

    public void setEnabled(Integer i) {
        enabled = i;
    }
}