/*==============================================================*/
/* Table: VKC_AVAILS                                            */
/*==============================================================*/
CREATE TABLE VKC_AVAILS (
VKC404ID			INTEGER 						not null,
UPTIME				TIMESTAMP 						not null,
UPTIME_DESCR		VARCHAR(50),
DOWNTIME			TIMESTAMP,
DOWNTIME_DESCR		VARCHAR(50),
CONSTRAINT PK_VKC404ID PRIMARY KEY (VKC404ID)
);

/*==============================================================*/
/* Table: ACLTYPES                                              */
/*==============================================================*/
create table ACLTYPES (
ACLTYPEID            INTEGER                        not null,
NAME                 VARCHAR(20)                    not null,
NAME_KEY             VARCHAR(50),
RANK                 INTEGER                        not null,
DESCRIPTION          VARCHAR(50),
DESCR_KEY            VARCHAR(50),
DEFACLONLY           INTEGER,
IDREQUIRED           INTEGER,
constraint PK_ACLTYPES primary key (ACLTYPEID)
);

/*==============================================================*/
/* Index: INDEX_16                                              */
/*==============================================================*/
create unique asc index INDEX_16 on ACLTYPES (
NAME,
RANK
);

/*==============================================================*/
/* Table: ADDCATATTRS                                           */
/*==============================================================*/
create table ADDCATATTRS (
CATATTRID            INTEGER                        not null,
NAME                 VARCHAR(255)                   not null,
NAME_KEY             VARCHAR(50),
DESCRIPTION          VARCHAR(255),
DESCR_KEY            VARCHAR(50),
ALLOWNULL            INTEGER,
DEFAULTVALUE         VARCHAR(255),
constraint PK_ADDCATATTRS primary key (CATATTRID)
);

/*==============================================================*/
/* Table: ADDCATATTRVALUES                                      */
/*==============================================================*/
create table ADDCATATTRVALUES (
CATEGORYID           INTEGER                        not null,
CATATTRID            INTEGER                        not null,
VALUESTRING          VARCHAR(255),
constraint PK_ADDCATATTRVALUES primary key (CATEGORYID, CATATTRID)
);

/*==============================================================*/
/* Table: ADDDOCATTRS                                           */
/*==============================================================*/
create table ADDDOCATTRS (
DOCATTRID            INTEGER                        not null,
NAME                 VARCHAR(255)                   not null,
NAME_KEY             VARCHAR(50),
DESCRIPTION          VARCHAR(50),
DESCR_KEY            VARCHAR(255),
ALLOWNULL            INTEGER,
DEFAULTVALUE         VARCHAR(255),
constraint PK_ADDDOCATTRS primary key (DOCATTRID)
);

/*==============================================================*/
/* Table: ADDDOCATTRVALUES                                      */
/*==============================================================*/
create table ADDDOCATTRVALUES (
DOCUMENTID           INTEGER                        not null,
DOCATTRID            INTEGER                        not null,
VALUESTRING          VARCHAR(255),
constraint PK_ADDDOCATTRVALUES primary key (DOCUMENTID, DOCATTRID)
);

/*==============================================================*/
/* Table: ADDGROUPATTRS                                         */
/*==============================================================*/
create table ADDGROUPATTRS (
GROUPATTRID          INTEGER                        not null,
NAME                 VARCHAR(255)                   not null,
NAME_KEY             VARCHAR(50),
DESCRIPTION          VARCHAR(255),
DESCR_KEY            VARCHAR(50),
ALLOWNULL            INTEGER,
DEFAULTVALUE         VARCHAR(255),
constraint PK_ADDGROUPATTRS primary key (GROUPATTRID)
);

/*==============================================================*/
/* Table: ADDGROUPATTRVALUES                                    */
/*==============================================================*/
create table ADDGROUPATTRVALUES (
GROUPID              INTEGER                        not null,
GROUPATTRID          INTEGER                        not null,
VALUESTRING          VARCHAR(255),
constraint PK_ADDGROUPATTRVALUES primary key (GROUPID, GROUPATTRID)
);

/*==============================================================*/
/* Table: ADDITIONALDOCUMENTFORMATS                             */
/*==============================================================*/
create table ADDITIONALDOCUMENTFORMATS (
ADDDOCFORMATID       INTEGER                        not null,
DOCUMENTID           INTEGER                        not null,
DOCTYPEID            INTEGER                        not null,
ARCHIVEID            VARCHAR(36)                    not null,
ZIPPED               INTEGER,
DOCSIZE              BIGINT,
INTERNALDOCFORMAT    INTEGER,
constraint PK_ADDITIONALDOCUMENTFORMATS primary key (ADDDOCFORMATID)
);

/*==============================================================*/
/* Index: INDEX_19                                              */
/*==============================================================*/
create unique asc index INDEX_19 on ADDITIONALDOCUMENTFORMATS (
DOCUMENTID,
DOCTYPEID
);

/*==============================================================*/
/* Table: ADDUSERATTRS                                          */
/*==============================================================*/
create table ADDUSERATTRS (
USERATTRID           INTEGER                        not null,
NAME                 VARCHAR(255)                   not null,
NAME_KEY             VARCHAR(50),
DESCRIPTION          VARCHAR(255),
DESCR_KEY            VARCHAR(50),
ALLOWNULL            INTEGER,
DEFAULTVALUE         VARCHAR(255),
constraint PK_ADDUSERATTRS primary key (USERATTRID)
);

/*==============================================================*/
/* Table: ADDUSERATTRVALUES                                     */
/*==============================================================*/
create table ADDUSERATTRVALUES (
USERID               INTEGER                        not null,
USERATTRID           INTEGER                        not null,
VALUESTRING          VARCHAR(255),
constraint PK_ADDUSERATTRVALUES primary key (USERID, USERATTRID)
);

/*==============================================================*/
/* Table: ALLOWEDDOCUMENTTYPES                                  */
/*==============================================================*/
create table ALLOWEDDOCUMENTTYPES (
CATEGORYID           INTEGER                        not null,
DOCTYPEID            INTEGER                        not null
);

/*==============================================================*/
/* Table: CATEGORIES                                            */
/*==============================================================*/
create table CATEGORIES (
CATEGORYID           INTEGER                        not null,
PARENTCATEGORYID     INTEGER,
ACLID                INTEGER                        not null,
DYNATTRSID           INTEGER,
INITIALCATEGORY      INTEGER,
NAME                 VARCHAR(255)                   not null,
NOTEID               INTEGER,
SHOWDESCRIPTION      INTEGER,
TEMPLATEID           INTEGER,
STATUS               INTEGER,
FLAG                 INTEGER,
CREATED              TIMESTAMP,
CREATORID            INTEGER,
LASTCHANGED          TIMESTAMP,
LASTCHANGERID        INTEGER,
LASTACCESSED         TIMESTAMP,
LASTACCESSORID       INTEGER,
ACCESSCOUNTER        INTEGER,
CATEGORYTYPE         INTEGER,
constraint PK_CATEGORIES primary key (CATEGORYID)
);

/*==============================================================*/
/* Table: PROJECTS                                              */
/*==============================================================*/
create table PROJECTS (
CATEGORYID           INTEGER                        not null,
EXTERNALCONTACTS     VARCHAR(1024),

constraint PK_PROJECTS primary key (CATEGORYID),
constraint FK_PROJECTS foreign key (CATEGORYID) references CATEGORIES (CATEGORYID) ON DELETE CASCADE
);

/*==============================================================*/
/* Table: PROJECTSUBFOLDERS                                     */
/*==============================================================*/
create table PROJECTSUBFOLDERS (
CATEGORYID           INTEGER not null,
PROJECTID            INTEGER not null,

constraint PK_PROJECTSUBFOLDERS primary key (CATEGORYID),
constraint FK_PROJECTSUBFOLDERS foreign key (CATEGORYID) references CATEGORIES (CATEGORYID) ON DELETE CASCADE
);

/*==============================================================*/
/* Table: PROJECTMESSAGES                                       */
/*==============================================================*/
create table PROJECTMESSAGES (

MessageId            INTEGER                        not null,
ProjectId            INTEGER                        not null,
RecepientId          INTEGER                        not null,
MessageText          VARCHAR(2048)                  not null,
Link                 VARCHAR(1024),
LinkKey              VARCHAR(256),
Created              TIMESTAMP                      not null,
CreatorId            INTEGER,

constraint PK_PROJECTMESSAGES primary key (MessageId),
constraint FK_PROJECTMESSAGES foreign key (ProjectId) references PROJECTS (CATEGORYID) ON DELETE CASCADE
);

CREATE ASC INDEX index1_PROJECTMESSAGES ON PROJECTMESSAGES (ProjectId);
CREATE ASC INDEX index2_PROJECTMESSAGES ON PROJECTMESSAGES (RecepientId);
/*==============================================================*/
/* Table: CATEGORYSTATI                                         */
/*==============================================================*/
create table CATEGORYSTATI (
STATUS               INTEGER                        not null,
DESCRIPTION          VARCHAR(50)                    not null,
DESC_KEY             VARCHAR(50),
REMARK               VARCHAR(50),
constraint PK_CATEGORYSTATI primary key (STATUS)
);

/*==============================================================*/
/* Table: CATEGORYACLS                                          */
/*==============================================================*/
create table CATEGORYACLS (
ACLENTRYID           INTEGER                        not null,
ACLID                INTEGER                        not null,
ACLTYPEID            INTEGER                        not null,
ACCESSORID           INTEGER                        not null,
PERMISSIONID         INTEGER                        not null,
CREATED              TIMESTAMP,
CREATORID            INTEGER,
constraint PK_CATEGORYACLS primary key (ACLENTRYID)
);

/*==============================================================*/
/* Index: INDEX_14                                              */
/*==============================================================*/
create unique asc index INDEX_14 on CATEGORYACLS (
ACLID,
ACLTYPEID,
ACCESSORID,
PERMISSIONID
);

/*==============================================================*/
/* Table: CATEGORYDOCUMENTLINKS                                 */
/*==============================================================*/
create table CATEGORYDOCUMENTLINKS (
CATDOCLINKID         INTEGER                        not null,
CATID                INTEGER                        not null,
LINKSTODOCID         INTEGER                        not null,
NAME                 VARCHAR(50)                    not null,
FOLLOWVERSIONS       INTEGER                        not null,
DESCRIPTION          VARCHAR(100),
constraint PK_CATDOCLINKS primary key (CATDOCLINKID)
);

/*==============================================================*/
/* Table: CATEGORYDOCUMENTS                                     */
/*==============================================================*/
create table CATEGORYDOCUMENTS (
CATDOCID             INTEGER                        not null,
CATEGORYID           INTEGER                        not null,
DOCUMENTID           INTEGER                        not null,
INITIALCATEGORY      INTEGER,
CREATED              TIMESTAMP,
CREATORID            INTEGER,
constraint PK_CATEGORYDOCUMENTS primary key (CATDOCID)
);

/*==============================================================*/
/* Index: INDEX_20                                              */
/*==============================================================*/
create unique asc index INDEX_20 on CATEGORYDOCUMENTS (
CATEGORYID,
DOCUMENTID
);

/*==============================================================*/
/* Table: CATEGORYKEYWORDS                                      */
/*==============================================================*/
create table CATEGORYKEYWORDS (
CATEGORYID           INTEGER                        not null,
TERM                 VARCHAR(255),
TERMDESCRIPTOR       VARCHAR(255)                   not null,
WEIGHT               DOUBLE PRECISION,
INTERNAL             INTEGER
);

/*==============================================================*/
/* Index: index_catkeywords                                     */
/*==============================================================*/
create asc index index_catkeywords on CATEGORYKEYWORDS (
CATEGORYID
);

/*==============================================================*/
/* Table: CATEGORYLINKS                                         */
/*==============================================================*/
create table CATEGORYLINKS (
CATLINKID            INTEGER                        not null,
CATID                INTEGER                        not null,
LINKSTOCATID         INTEGER                        not null,
NAME                 VARCHAR(50)                    not null,
DESCRIPTION          VARCHAR(100),
constraint PK_CATEGORYLINKS primary key (CATLINKID)
);

/*==============================================================*/
/* Index: INDEX_33                                              */
/*==============================================================*/
create unique asc index INDEX_33 on CATEGORYLINKS (
CATID,
LINKSTOCATID
);

/*==============================================================*/
/* Table: CATPROJECTSTEPS                                       */
/*==============================================================*/
create table CATPROJECTSTEPS (
CATPROJSTEPID        INTEGER                        not null,
CATEGORYID           INTEGER                        not null,
STEP                 INTEGER                        not null,
ENABLED              INTEGER                        not null,
ACTIVITY             VARCHAR(255)                   not null,
STARTDATE            TIMESTAMP                      not null,
ENDDATE              TIMESTAMP                      not null,
PROCESSORID          INTEGER,
PROCESSEDTS          TIMESTAMP,
CHECKERID            INTEGER,
CHECKEDTS            TIMESTAMP,
constraint PK_CATPROJECTSTEPS primary key (CATPROJSTEPID)
);

/*==============================================================*/
/* Index: INDEX_28                                              */
/*==============================================================*/
create unique asc index INDEX_28 on CATPROJECTSTEPS (
CATEGORYID,
STEP
);

/*==============================================================*/
/* Table: DEFAULTCATACLS                                        */
/*==============================================================*/
create table DEFAULTCATACLS (
ACLENTRYID           INTEGER                        not null,
STARTCATID           INTEGER                        not null,
ACLTYPEID            INTEGER                        not null,
ACCESSORID           INTEGER                        not null,
PERMISSIONID         INTEGER                        not null,
CREATED              TIMESTAMP,
CREATORID            INTEGER,
constraint PK_DEFAULTCATACLS primary key (ACLENTRYID)
);

/*==============================================================*/
/* Index: INDEX_26                                              */
/*==============================================================*/
create unique asc index INDEX_26 on DEFAULTCATACLS (
STARTCATID,
ACLTYPEID,
ACCESSORID,
PERMISSIONID
);

/*==============================================================*/
/* Table: DEFAULTDOCACLS                                        */
/*==============================================================*/
create table DEFAULTDOCACLS (
ACLENTRYID           INTEGER                        not null,
STARTCATID           INTEGER                        not null,
ACLTYPEID            INTEGER                        not null,
ACCESSORID           INTEGER                        not null,
PERMISSIONID         INTEGER                        not null,
CREATED              TIMESTAMP,
CREATORID            INTEGER,
constraint PK_DEFAULTDOCACLS primary key (ACLENTRYID)
);

/*==============================================================*/
/* Index: INDEX_27                                              */
/*==============================================================*/
create unique asc index INDEX_27 on DEFAULTDOCACLS (
STARTCATID,
ACLTYPEID,
ACCESSORID,
PERMISSIONID
);

/*==============================================================*/
/* Table: DOCUMENTACLS                                          */
/*==============================================================*/
create table DOCUMENTACLS (
ACLENTRYID           INTEGER                        not null,
ACLID                INTEGER                        not null,
ACLTYPEID            INTEGER                        not null,
ACCESSORID           INTEGER                        not null,
PERMISSIONID         INTEGER                        not null,
CREATED              TIMESTAMP,
CREATORID            INTEGER,
constraint PK_DOCUMENTACLS primary key (ACLENTRYID)
);

/*==============================================================*/
/* Index: INDEX_11                                              */
/*==============================================================*/
create unique asc index INDEX_11 on DOCUMENTACLS (
ACLID,
ACLTYPEID,
ACCESSORID,
PERMISSIONID
);

/*==============================================================*/
/* Table: DOCUMENTCLASSES                                       */
/*==============================================================*/
create table DOCUMENTCLASSES (
DOCCLASSID           INTEGER                        not null,
NAME_KEY             VARCHAR(50)                    not null, 
DESCR_KEY            VARCHAR(100),
FLAG                 INTEGER,
constraint PK_DOCUMENTCLASSES primary key (DOCCLASSID)
);

/*==============================================================*/
/* Table: DOCUMENTFLAGS                                         */
/*==============================================================*/
create table DOCUMENTFLAGS (
FLAG                 INTEGER                        not null,
DESCRIPTION          VARCHAR(20),
constraint PK_DOCUMENTFLAGS primary key (FLAG)
);

/*==============================================================*/
/* Table: DOCUMENTKEYWORDS                                      */
/*==============================================================*/
create table DOCUMENTKEYWORDS (
DOCUMENTID           INTEGER                        not null,
TERM                 VARCHAR(255),
TERMDESCRIPTOR       VARCHAR(255)                   not null,
WEIGHT               DOUBLE PRECISION,
INTERNAL             INTEGER
);

/*==============================================================*/
/* Index: index_dockeywords                                     */
/*==============================================================*/
create asc index index_dockeywords on DOCUMENTKEYWORDS (
DOCUMENTID
);

/*==============================================================*/
/* Table: DOCUMENTS                                             */
/*==============================================================*/
create table DOCUMENTS (
DOCUMENTID           INTEGER                        not null,
PREDOCID             INTEGER,
NAME                 VARCHAR(255)                   not null,
TITLE                VARCHAR(255),
NOTEID		         INTEGER,
AUTHORNAME           VARCHAR(128),
TYPEID               INTEGER                        not null,
DOCCLASSID           INTEGER                        not null,
ARCHIVEID            VARCHAR(36)                    not null,
VERSION_NO           INTEGER                        not null,
VERSION_HIGH         INTEGER                        not null,
VERSION_LOW          INTEGER                        not null,
VERSION_DESCR        VARCHAR(255),
SUMMARY              VARCHAR(255),
STATUS               INTEGER                        not null,
FLAG                 INTEGER                        not null,
ACLID                INTEGER,
CREATIONDATE         TIMESTAMP,
EXPIRES              TIMESTAMP,
PUBLISHED            TIMESTAMP                      not null,
PUBLISHERID          INTEGER                        not null,
LASTCHANGED          TIMESTAMP,
LASTCHANGERID        INTEGER,
LASTACCESSED         TIMESTAMP,
LASTACCESSORID       INTEGER,
ACCESSCOUNTER        INTEGER,
DYNATTRSID           INTEGER,
DOCSIZE              BIGINT,
ZIPPED               INTEGER,
LANGPACKID           INTEGER,
LOCKUSERID           INTEGER,
constraint PK_DOCUMENTS primary key (DOCUMENTID)
);

/*==============================================================*/
/* Table: DOCUMENTSTATI                                         */
/*==============================================================*/
create table DOCUMENTSTATI (
STATUS               INTEGER                        not null,
DESC_KEY             VARCHAR(50)                    not null,
REMARK               VARCHAR(50),
constraint PK_DOCUMENTSTATI primary key (STATUS)
);

/*==============================================================*/
/* Table: DOCUMENTTYPES                                         */
/*==============================================================*/
create table DOCUMENTTYPES (
DOCTYPEID            INTEGER                        not null,
EXTENSION            VARCHAR(10)                    not null,
EXTENSION_KEY        VARCHAR(50),
DESCRIPTION          VARCHAR(50),
DESCRIPTION_SHORT    VARCHAR(20),
DESCR_KEY            VARCHAR(50),
IMGPATH			     VARCHAR(128),
ICON_EXTENSION       VARCHAR(10),
MIMETYPE             VARCHAR(256),
INTERNAL             INTEGER,
CONVERTIBLE 		 INTEGER,
EDITABLE			 INTEGER,
constraint PK_DOCUMENTTYPES primary key (DOCTYPEID)
);

/*==============================================================*/
/* Index: INDEX_18                                              */
/*==============================================================*/
create unique asc index INDEX_18 on DOCUMENTTYPES (
EXTENSION
);

/*==============================================================*/
/* Table: DYNATTRIBUTES                                         */
/*==============================================================*/
create table DYNATTRIBUTES (
DAENTYRID            INTEGER                        not null,
DYNATTRID            INTEGER                        not null,
NAME                 VARCHAR(50)                    not null,
NAME_KEY             VARCHAR(50),
VALUESTRING          VARCHAR(4000),
constraint PK_DYNATTRIBUTES primary key (DAENTYRID)
);

/*==============================================================*/
/* Table: DYNUSERATTRVALUES                                     */
/*==============================================================*/
/*
CREATE TABLE DYNUSERATTRVALUES (
USERID				INTEGER NOT NULL,
USERATTRID			INTEGER NOT NULL,
NAME				VARCHAR(255) NOT NULL,	
VALUESTRING			VARCHAR(4000),
AUTORIZATION 		INTEGER,
  
CONSTRAINT PK_DYNUSERATTRVALUES PRIMARY KEY (USERID, USERATTRID)
);

create unique asc index INDEX_21 on DYNUSERATTRVALUES (
USERID,
USERATTRID
);

alter table DYNUSERATTRVALUES
    add CONSTRAINT FK_DYNUSERATTRVALUES FOREIGN KEY (USERID) REFERENCES USERS (USERID) ON DELETE CASCADE;
*/
/*==============================================================*/
/* Table: GROUPS                                                */
/*==============================================================*/
create table GROUPS (
GROUPID              INTEGER                        not null,
NAME                 VARCHAR(62)                    not null,
NAME_KEY             VARCHAR(199),
DESCRIPTION          VARCHAR(199),
DESCR_KEY            VARCHAR(199),
ACCOUNTVALID         INTEGER,
ADMINPRIVILEGES      INTEGER,
VALIDFROM            TIMESTAMP,
VALIDUNTIL           TIMESTAMP,
CREATED              TIMESTAMP,
CREATORID            INTEGER,
LASTCHANGED          TIMESTAMP,
LASTCHANGERID        INTEGER,
constraint PK_GROUPS primary key (GROUPID)
);

/*==============================================================*/
/* Index: INDEX_12                                              */
/*==============================================================*/
create unique asc index INDEX_12 on GROUPS (
NAME
);

/*==============================================================*/
/* Table: LANGUAGEPACKS                                         */
/*==============================================================*/
create table LANGUAGEPACKS (
LANGPACKID           INTEGER                        not null,
COUNTRYCODE          VARCHAR(2)                     not null,
NAME                 VARCHAR(50)                    not null,
NAME_KEY             VARCHAR(50),
DESCRIPTION          VARCHAR(50),
DESCR_KEY            VARCHAR(50),
CLASSNAME            VARCHAR(50)                    not null,
CLASSPATH            VARCHAR(255)                   not null,
ENABLED              integer,
constraint PK_LANGUAGEPACKS primary key (LANGPACKID)
);

/*==============================================================*/
/* Table: LANGUAGES                                             */
/*==============================================================*/
create table LANGUAGES (
LANGUAGEID           INTEGER                        not null,
NAME                 VARCHAR(50)                    not null,
NAME_KEY             VARCHAR(50),
SHORTNAME            VARCHAR(2),
ISOCODE              VARCHAR(10),
DEFAULTLANGUAGE      INTEGER,
constraint PK_LANGUAGES primary key (LANGUAGEID)
);

/*==============================================================*/
/* Table: LICENSE                                             */
/*==============================================================*/
create table LICENSE (
LICENSEID            INTEGER                        not null,
LICENSEPART			 INTEGER						   not null,
LANGUAGEID			 INTEGER						   not null,
LICENSETEXT          VARCHAR(4000)                  not null,
IS_ACTIVE			 INTEGER						   not null,
CREATED              TIMESTAMP                      not null,
CREATORID            INTEGER                        not null,
VALIDFROM            TIMESTAMP,
VALIDUNTIL           TIMESTAMP,
constraint PK_LICENSE primary key (LICENSEID,LICENSEPART,LANGUAGEID)
);

/*==============================================================*/
/* Table: MSGTIMEPERIODS                                        */
/*==============================================================*/
create table MSGTIMEPERIODS (
PERIODID             INTEGER                        not null,
PERIOD               FLOAT                          not null,
DESCRIPTION          VARCHAR(255),
constraint PK_PERIODID primary key (PERIODID)
);

/*==============================================================*/
/* Table: NEWS                                                  */
/*==============================================================*/
create table NEWS (
NEWSID               INTEGER                        not null,
HEADLINE             VARCHAR(255)                   not null,
NOTEID               INTEGER,
INFOURL              VARCHAR(255),
CREATED              TIMESTAMP                      not null,
CREATORID            INTEGER                        not null,
VALIDFROM            TIMESTAMP,
VALIDUNTIL           TIMESTAMP,
constraint PK_NEWS primary key (NEWSID)
);


/*==============================================================*/
/* Table: NOTES                                                  */
/*==============================================================*/
create table NOTES (
NOTEID INTEGER NOT NULL,
OBJECTID INTEGER,
SOURCETABLE varchar(255),
SUCCESSORID INTEGER,
TEXT varchar(4000),
CONSTRAINT PK_NOTES PRIMARY KEY (NOTEID)
);

/*==============================================================*/
/* Table: PERMISSIONS                                           */
/*==============================================================*/
create table PERMISSIONS (
PERMISSIONID         INTEGER                        not null,
CONTEXT              VARCHAR(20)                    not null,
TOKEN                VARCHAR(1)                     not null,
NUMVALUE             INTEGER                        not null,
PRINTSTRING          VARCHAR(50),
PRINTSTRING_KEY      VARCHAR(50),
DESCRIPTION          VARCHAR(100),
DESCR_KEY            VARCHAR(100),
ENABLED              INTEGER,
constraint PK_PERMISSIONS primary key (PERMISSIONID)
);

/*==============================================================*/
/* Index: INDEX_15                                              */
/*==============================================================*/
create unique asc index INDEX_15 on PERMISSIONS (
CONTEXT,
TOKEN,
NUMVALUE
);

/*==============================================================*/
/* Table: PROXYUSERS                                            */
/*==============================================================*/
create table PROXYUSERS (
PROXYID              INTEGER                        not null,
USERID               INTEGER                        not null,
PROXYUSERID          INTEGER                        not null,
DESCRIPTION          VARCHAR(100),
VALIDFROM            TIMESTAMP,
VALIDUNTIL           TIMESTAMP,
CREATED              TIMESTAMP                      not null,
CREATORID            INTEGER                        not null,
constraint PK_PROXYUSERS primary key (PROXYID)
);

/*==============================================================*/
/* Index: INDEX_34                                              */
/*==============================================================*/
create unique asc index INDEX_34 on PROXYUSERS (
USERID,
PROXYUSERID
);

/*==============================================================*/
/* Table: SYSPARAMETERS                                         */
/*==============================================================*/
create table SYSPARAMETERS (
SYSPARAMETERID       INTEGER                        not null,
CONTEXT              VARCHAR(50)                    not null,
CONTEXT_KEY          VARCHAR(128),
NAME                 VARCHAR(50)                    not null,
NAME_KEY             VARCHAR(128),
VALUESTRING          VARCHAR(1024),
DESCRIPTION          VARCHAR(100),
DESCR_KEY            VARCHAR(128),
SORT_RANK            INTEGER                        not null,
ALLOWNULL            INTEGER                        not null,
READONLY             INTEGER                        not null,
HIDE                 INTEGER                        not null,
DATATYPE             INTEGER                        not null,
constraint PK_SYSPARAMETERS primary key (SYSPARAMETERID)
);

/*==============================================================*/
/* Index: INDEX_13                                              */
/*==============================================================*/
create unique asc index INDEX_13 on SYSPARAMETERS (
CONTEXT,
NAME
);

/*==============================================================*/
/* Table: TEMPLATES                                             */
/*==============================================================*/
create table TEMPLATES (
TEMPLATEID           INTEGER                        not null,
NAME                 VARCHAR(50)                    not null,
PATH                 VARCHAR(255)                   not null,
DESCRIPTION          VARCHAR(255),
PREVIEWPIC           VARCHAR(255),
ENABLED              INTEGER,
constraint PK_TEMPLATES primary key (TEMPLATEID)
);

/*==============================================================*/
/* Table: USERDOCMAILS                                          */
/*==============================================================*/
create table USERDOCMAILS (
UDMID                  INTEGER                        not null,
USERID                 INTEGER                        not null,
DOCUMENTID             INTEGER                        not null,
RELDOCID               INTEGER,
QUERYID                INTEGER,
SENDON                 TIMESTAMP                      not null,
PROCESSED              INTEGER,
WASSENDAT              TIMESTAMP,
SUBJECTFORNOTIFICATION VARCHAR(320),
constraint PK_USERDOCMAILS primary key (UDMID)
);

/*==============================================================*/
/* Index: INDEX_22                                              */
/*==============================================================*/
create unique asc index INDEX_22 on USERDOCMAILS (
USERID,
DOCUMENTID
);

/*==============================================================*/
/* Table: USERGROUPS                                            */
/*==============================================================*/
create table USERGROUPS (
GROUPID              INTEGER                        not null,
USERID               INTEGER                        not null,
CREATED              TIMESTAMP,
CREATORID            INTEGER,
STANDARDGROUP        INTEGER,
constraint PK_USERGROUPS primary key (GROUPID, USERID)
);

/*==============================================================*/
/* Table: USERLICENSE                                           */
/*==============================================================*/
create table USERLICENSE (
LICENSEID            INTEGER                        not null,
USERID               INTEGER                        not null,
ACCEPTED			 TIMESTAMP,
CREATED              TIMESTAMP,
CREATORID            INTEGER,
constraint PK_USERLICENSE primary key (LICENSEID, USERID)
);

/*==============================================================*/
/* Table: USERREGISTEREDCATEGORIES                              */
/*==============================================================*/
create table USERREGISTEREDCATEGORIES (
USERID                 INTEGER                        not null,
CATEGORYID             INTEGER                        not null,
INCLSUBDIRS            INTEGER,
SUBJECTFORNOTIFICATION VARCHAR(320),
constraint PK_USERREGISTEREDCATEGORIES primary key (USERID, CATEGORYID)
);

/*==============================================================*/
/* Table: USERREGISTEREDDOCUMENTS                               */
/*==============================================================*/
create table USERREGISTEREDDOCUMENTS (
USERID                 INTEGER                        not null,
DOCUMENTID             INTEGER                        not null,
THRESHOLD              INTEGER,
SUBJECTFORNOTIFICATION VARCHAR(320),
constraint PK_USERREGISTEREDDOCUMENTS primary key (USERID, DOCUMENTID)
);

/*==============================================================*/
/* Table: USERS                                                 */
/*==============================================================*/
create table USERS (
USERID               INTEGER                        not null,
USERNAME             VARCHAR(62)                    not null,
FIRSTNAME            VARCHAR(199),
LASTNAME             VARCHAR(199),
TITLE                VARCHAR(50),
PASSWD               VARCHAR(255)                   not null,
PASSWDCHANGED        INTEGER,
PASSWDCHANGEDTS      TIMESTAMP,
PWDMISMATCHCOUNT     INTEGER,
EMAIL                VARCHAR(50),
SHOWEMAIL            INTEGER,
ENABLEMESSAGING      INTEGER,
MESSAGINGTIMEPERIOD  INTEGER,
COMPANY              VARCHAR(50),
DEPARTMENT           VARCHAR(50),
ZIP                  VARCHAR(10),
CITY                 VARCHAR(50),
STREET               VARCHAR(50),
PHONE                VARCHAR(20),
FAX                  VARCHAR(20),
MOBILE               VARCHAR(20),
HOMEPAGEURL          VARCHAR(100),
CONTACTURL           VARCHAR(100),
ADMINPRIVILEGES      INTEGER,
SESSIONTIMEOUT       INTEGER,
QUOTA                INTEGER,
MANAGEOWNUSERS       INTEGER,
MANAGEOWNUSERS_S_V   INTEGER,
MANAGEOWNGROUPS      INTEGER,
MANAGEOWNPROXIES     INTEGER,
MANAGEVIRTUALDOC_Q   INTEGER,
LANGUAGEID           INTEGER,
ACCOUNTVALID         INTEGER,
VALIDFROM            TIMESTAMP,
VALIDUNTIL           TIMESTAMP,
CREATED              TIMESTAMP,
CREATORID            INTEGER,
LASTCHANGED          TIMESTAMP,
LASTCHANGERID        INTEGER,
DYNATTRSID           INTEGER,
TEMPLATEID           INTEGER,
STARTCATEGORYID      INTEGER,
MOSTRECENTLOGIN      TIMESTAMP,
MOSTRECENTLOGOUT     TIMESTAMP,
MOSTRECENTNEWS       TIMESTAMP,
EXTERNALSERVERID     INTEGER,
EXTERNALSERVERTYPE   VARCHAR(20),
EXTERNALUSERID       VARCHAR(20),
S_DOCSORTMODE 		 INTEGER,
B_DOCSORTMODE 		 INTEGER,
L_DOCSORTMODE 		 INTEGER,
C_DOCSORTMODE 		 INTEGER,
ALLOWMANAGE_S_V_T    INTEGER,
SYSTEMVIEWTYPEID 	 INTEGER,
SHOWTREE			 INTEGER,
ENABLEHTMLNOTIFICATION INTEGER,
LICENSEID            INTEGER,
ACCEPTED             TIMESTAMP,
constraint PK_USERS primary key (USERID)
);

/*==============================================================*/
/* Index: INDEX_9                                               */
/*==============================================================*/
create unique asc index INDEX_9 on USERS (
USERNAME,
EXTERNALSERVERID
);

/*
 * Table for Converter timing
 */
create table CONVERTERTIMING (
ID 						INTEGER not null,
POLLING_PERIOD_MINUTES 	INTEGER default 30 not null,
TIME_FRAME_START 		VARCHAR(5),
TIME_FRAME_END 			VARCHAR(5),	
constraint PK_CONVERTERTIMING primary key (ID)
);


/*
 * Table for conversion stati
 */
create table CONVERSIONSTATI (
DOCUMENTID			INTEGER not null,
STATUS 				VARCHAR(11) DEFAULT 'outstanding' not null,
STARTED 			TIMESTAMP,
FINISHED 			TIMESTAMP,
REITERATIONS 		INTEGER default 0 not null,
SENDMAIL 			INTEGER,
REMARK				VARCHAR(255),
constraint PK_CONVERSIONSTATI primary key (DOCUMENTID)
);

/*
 * Table for converters
 */
create table CONVERTER (
ID 					INTEGER not null,
MAX_REITERATIONS 	INTEGER default 3 not null,
DOCUMENTTYPES 		VARCHAR(255),
LOADFACTOR 			INTEGER default 1 not null,
HOSTNAME 			VARCHAR(64) not null,
PORT 				INTEGER not null,
STATUS 				VARCHAR(4) not null,
JOBS_IN_EXECUTION 	INTEGER default 0 not null,
TIMINGID 			INTEGER default 1 not null,
constraint PK_CONVERTER primary key (ID)
);

/*
 * Table for VKC Server
 */
create table VKCSERVER (
ID 					INTEGER not null,
LOADFACTOR 			INTEGER default 1 not null,
HOSTNAME 			VARCHAR(64) not null,
PORT 				INTEGER not null,
JOBS_REQUESTED 		INTEGER default 0 not null,
STATUS 				VARCHAR(4) not null,
constraint PK_VKCSERVER primary key (ID)
);

/*==============================================================*/
/* Table: SEARCHQUERIES                               			*/
/*==============================================================*/
create table SEARCHQUERIES (
QUERYID              INTEGER                        not null,
CATEGORYID           INTEGER                        not null,
QUERYFIELD           VARCHAR(512),

constraint PK_SEARCHQUERIES primary key ( QUERYID, CATEGORYID )
);

/*==============================================================*/
/* Table: USERREGSEARCHQUERIES                                  */
/*==============================================================*/
create table USERREGSEARCHQUERIES (
URSQID	               INTEGER                        not null,
QUERYID                INTEGER                        not null,
USERID                 INTEGER                        not null,
QUERYFIELD             VARCHAR(512),
SUBJECTFORNOTIFICATION VARCHAR(320),

constraint PK_USERREGSEARCHQUERIES primary key ( URSQID )
);

/*==============================================================*/
/* Table: USERCATFAVORITES                                      */
/*==============================================================*/
create table USERCATFAVORITES (
USERID               INTEGER                        not null,
CATEGORYID           INTEGER                        not null,
CREATED              TIMESTAMP,
constraint PK_USERCATFAVORITES primary key (USERID, CATEGORYID)
);


/*==============================================================*/
/* Table: USERDOCFAVORITES                                      */
/*==============================================================*/
create table USERDOCFAVORITES (
USERID               INTEGER                        not null,
DOCUMENTID           INTEGER                        not null,
CREATED              TIMESTAMP,
constraint PK_USERDOCFAVORITES primary key (USERID, DOCUMENTID)
);

/*===============================================================*/
/* Table: DOCUMENTVIEWFIELDS                            	     */
/*===============================================================*/
create table DOCUMENTVIEWFIELDS (
FIELDID              INTEGER                        not null,
NAME            	 VARCHAR(256)                   not null,
NAMEKEY              VARCHAR(256)					not null,
DEFAULTFIELD         INTEGER						not null,
constraint PK_DOCUMENTVIEWFIELDS primary key (FIELDID)
);


/*==============================================================*/
/* Table: USERDOCVIEWFIELDS                            			*/
/*==============================================================*/
create table USERDOCVIEWFIELDS (
ENTRYID              INTEGER                        not null,
FIELDID            	 INTEGER                        not null,
USERID               INTEGER					    not null,
constraint PK_USERDOCVIEWFIELDS primary key ( ENTRYID)
);

create unique asc index INDEX_30 on USERDOCVIEWFIELDS(USERID, FIELDID);

alter table USERDOCVIEWFIELDS
    add constraint FK_USERDOVIEWFIELDS foreign key (USERID)
        references USERS(USERID);

alter table USERDOCVIEWFIELDS
    add constraint FK_USERDOVIEWFIELDS2 foreign key (FIELDID)
        references DOCUMENTVIEWFIELDS(FIELDID);


/*==============================================================*/
/* Table: USERDOCHISTORIES                                      */
/*==============================================================*/
create table USERDOCHISTORIES (
USERID               INTEGER                        not null,
DOCUMENTID           INTEGER                        not null,
LASTACCESSED         TIMESTAMP                      not null,
constraint PK_USERDOCHISTORIES primary key (USERID, DOCUMENTID)
);

/*==============================================================*/
/* Table: USERPROJECTHISTORIES                                  */
/*==============================================================*/
create table USERPROJECTHISTORIES (
USERID               INTEGER                        not null,
PROJECTID            INTEGER                        not null,
LASTACCESSED         TIMESTAMP                      not null,
constraint PK_USERPROJECTHISTORIES primary key (USERID, PROJECTID),
constraint FK_USERPROJECTHISTORIES1 foreign key (USERID) references USERS (USERID) ON DELETE CASCADE,
constraint FK_USERPROJECTHISTORIES2 foreign key (PROJECTID) references CATEGORIES (CATEGORYID) ON DELETE CASCADE
);

/*==============================================================*/
/* Table: USERFUNCTIONALHISTORIES                               */
/*==============================================================*/
create table USERFUNCTIONALHISTORIES (
USERID               INTEGER                        not null,
FUNCTIONALID         INTEGER                        not null,
LASTACCESSED         TIMESTAMP                      not null,
constraint PK_USERFUNCTIONALHISTORIES primary key (USERID, FUNCTIONALID),
constraint FK_USERFUNCTIONALHISTORIES1 foreign key (USERID) references USERS (USERID) ON DELETE CASCADE,
constraint FK_USERFUNCTIONALHISTORIES2 foreign key (FUNCTIONALID) references CATEGORIES (CATEGORYID) ON DELETE CASCADE
);

/*==============================================================*/
/* Table: USERDOCVIEWFIELDS                            			*/
/*==============================================================*/
create table LDAPUSERS (
ldapUserId        INTEGER                       not null,
ldapServerId      INTEGER                       not null,
ldapUserRDN       VARCHAR(512)					not null,
constraint PK_LDAPUSERS primary key (ldapUserId)
);

/*==============================================================*/
/* Table: LDAPGROUPS                                			*/
/*==============================================================*/
create table LDAPGROUPS (
ldapGroupId      INTEGER                       not null,
ldapServerId     INTEGER                       not null,
ldapGroupRDN     VARCHAR(512)				   not null,
constraint PK_LDAPGROUPS primary key (ldapGroupId)
);

/*==============================================================*/
/* Table: LDAPSERVERS                                           */
/*==============================================================*/
create table LDAPSERVERS (
ldapServerId		INTEGER						not null,
ldapServerURL	    VARCHAR(128)				not null,
description         VARCHAR(64)					not null,
authMethod			VARCHAR(20)					not null,
baseDN              VARCHAR(128)                not null,
usersBaseRDN        VARCHAR(128)                not null,
groupsBaseRDN       VARCHAR(128)                not null,
mapping_loginattr   VARCHAR(32)                 not null, 
mapping_email       VARCHAR(32),                 
mapping_userid      VARCHAR(32)                 not null, 
mapping_fullname    VARCHAR(32)                 not null,
mapping_language    VARCHAR(32),
created 			TIMESTAMP,
creatorId           INTEGER,
lastChanged         TIMESTAMP,
lastChangerId       INTEGER,
enabled             INTEGER                     not null,
constraint PK_LDAPSERVERS primary key (ldapServerId)
);


/*==============================================================*/
/* Table: USERRATINGS                                           */
/*==============================================================*/
CREATE TABLE USERRATINGS
(
  USERRATINGID    INTEGER NOT NULL,
  MINPUBDOCSCOUNT INTEGER NOT NULL,
  DESCRIPTION	  VARCHAR(20),
  DESCR_KEY       VARCHAR(50) NOT NULL,
  ICON            VARCHAR(50),
CONSTRAINT PK_USERRATINGS PRIMARY KEY (USERRATINGID)
);

/*==============================================================*/
/* Table: TABVIEWS                                              */
/*==============================================================*/
create table TABVIEWS (
TABVIEWID            INTEGER                        not null,
UNIQUENAME           VARCHAR(128)                   not null,
FLAG                 INTEGER,
STATUS               INTEGER,
VIEWTYPEID           INTEGER,
ENABLED              INTEGER,
HIDE                 INTEGER,
constraint PK_TABVIEWS primary key (TABVIEWID)
);

alter table USERDOCHISTORIES
   add constraint FK_USERDOCHISTORIES1 foreign key (DOCUMENTID)
      references DOCUMENTS (DOCUMENTID);

alter table USERDOCHISTORIES
   add constraint FK_USERDOCHISTORIES2 foreign key (USERID)
      references USERS (USERID);

alter table USERCATFAVORITES
   add constraint FK_USERCATFAVORITES1 foreign key (CATEGORYID)
      references CATEGORIES (CATEGORYID);

alter table USERCATFAVORITES
   add constraint FK_USERCATFAVORITES2 foreign key (USERID)
      references USERS (USERID);

alter table USERDOCFAVORITES
   add constraint FK_USERDOCFAVORITES1 foreign key (DOCUMENTID)
      references DOCUMENTS (DOCUMENTID);

alter table USERDOCFAVORITES
   add constraint FK_USERDOCFAVORITES2 foreign key (USERID)
      references USERS (USERID);

alter table ADDITIONALDOCUMENTFORMATS
   add constraint FK_DOCTYPES2 foreign key (DOCTYPEID)
      references DOCUMENTTYPES (DOCTYPEID);

alter table ADDITIONALDOCUMENTFORMATS
   add constraint FK_DOCUMENTS5 foreign key (DOCUMENTID)
      references DOCUMENTS (DOCUMENTID);

alter table ALLOWEDDOCUMENTTYPES
   add constraint FK_CATEGORIES4 foreign key (CATEGORYID)
      references CATEGORIES (CATEGORYID);

alter table ALLOWEDDOCUMENTTYPES
   add constraint FK_DOCTYPES foreign key (DOCTYPEID)
      references DOCUMENTTYPES (DOCTYPEID);

alter table CATEGORIES
   add constraint FK_CATEGORIES6 foreign key (PARENTCATEGORYID)
      references CATEGORIES (CATEGORYID);

alter table CATEGORYDOCUMENTS
   add constraint FK_CATEGORIES foreign key (CATEGORYID)
      references CATEGORIES (CATEGORYID);

alter table CATEGORYKEYWORDS
   add constraint FK_CATEGORIES3 foreign key (CATEGORYID)
      references CATEGORIES (CATEGORYID);

alter table DOCUMENTACLS
   add constraint FK_ACLTYPES foreign key (ACLTYPEID)
      references ACLTYPES (ACLTYPEID);

alter table DOCUMENTACLS
   add constraint FK_PERMISSIONS foreign key (PERMISSIONID)
      references PERMISSIONS (PERMISSIONID);

alter table DOCUMENTS
   add constraint FK_DOCUMENTCLASSES foreign key (DOCCLASSID)
      references DOCUMENTCLASSES (DOCCLASSID);

alter table DOCUMENTS
   add constraint FK_DOCUMENTFLAGS foreign key (FLAG)
      references DOCUMENTFLAGS (FLAG);

alter table DOCUMENTS
   add constraint FK_DOCUMENTSTATI foreign key (STATUS)
      references DOCUMENTSTATI (STATUS);
      
alter table CONVERTER
   add constraint FK_CONVERTERTIMING foreign key (TIMINGID)
      references CONVERTERTIMING (ID);

alter table USERGROUPS
   add constraint FK_GROUPS foreign key (GROUPID)
      references GROUPS (GROUPID);

alter table USERGROUPS
   add constraint FK_USERS foreign key (USERID)
      references USERS (USERID);

alter table USERLICENSE
   add constraint FK_USERLICENSE foreign key (USERID)
      references USERS (USERID);

alter table USERREGISTEREDCATEGORIES
   add constraint FK_CATEGORIES2 foreign key (CATEGORYID)
      references CATEGORIES (CATEGORYID);

alter table USERREGISTEREDCATEGORIES
   add constraint FK_USERS3 foreign key (USERID)
      references USERS (USERID);

alter table USERREGSEARCHQUERIES
   add constraint FK_USERS4 foreign key (USERID)
      references USERS (USERID);
      
alter table ldapUsers
   add constraint FK_LDAPSERVERS foreign key (ldapServerId)
      references ldapServers (ldapServerId);

alter table ldapGroups
   add constraint FK_LDAPSERVERS2 foreign key (ldapServerId)
      references ldapServers (ldapServerId);

/* 
 * acltypes
 */
insert into ACLTYPES
            (ACLTYPEID, NAME, RANK, DESCRIPTION, DEFACLONLY, IDREQUIRED)
     values (1, 'user', 1, 'acl type user', 0, 1);

insert into ACLTYPES
            (ACLTYPEID, NAME, RANK, DESCRIPTION, DEFACLONLY, IDREQUIRED)
     values (2, 'group', 2, 'acl type group', 0, 1);

insert into ACLTYPES
            (ACLTYPEID, NAME, RANK, DESCRIPTION, DEFACLONLY, IDREQUIRED)
     values (3, 'anyother', 3, 'acl type anyother', 0, 0);

insert into ACLTYPES
            (ACLTYPEID, NAME, RANK, DESCRIPTION, DEFACLONLY, IDREQUIRED)
     values (4, 'mask', 4, 'acl type mask', 0, 0);

insert into ACLTYPES
            (ACLTYPEID, NAME, RANK, DESCRIPTION, DEFACLONLY, IDREQUIRED)
     values (5, 'owner', 0, 'acl type owner', 1, 0);

insert into ACLTYPES
            (ACLTYPEID, NAME, RANK, DESCRIPTION, DEFACLONLY, IDREQUIRED)
     values (6, 'ldap-user', 5, 'acl type ldap-user', 0, 1);

insert into ACLTYPES
            (ACLTYPEID, NAME, RANK, DESCRIPTION, DEFACLONLY, IDREQUIRED)
     values (7, 'ldap-group', 6, 'acl type ldap-group', 0, 1);

insert into ACLTYPES
            (ACLTYPEID, NAME, RANK, DESCRIPTION, DEFACLONLY, IDREQUIRED)
     values (8, 'unauthenticated', 7, 'acl type unauthenticated', 0, 0);


/* root cat            */
/* anyother: -r------- */
insert into CATEGORYACLS
            (ACLENTRYID, ACLID, ACLTYPEID, ACCESSORID, PERMISSIONID, CREATED, CREATORID)
     values (1, 1, 3, 0, 2, CURRENT_TIMESTAMP, 1);


/* root cat            */
insert into CATEGORIES
            (CATEGORYID, PARENTCATEGORYID, ACLID, DYNATTRSID, INITIALCATEGORY, NAME, NOTEID, SHOWDESCRIPTION, TEMPLATEID, CREATED, CREATORID, LASTCHANGED, LASTCHANGERID, LASTACCESSED, LASTACCESSORID, ACCESSCOUNTER)
     values (1, null, 1, null, 1, 'VKC:/',1 , 1, null, null, null, null, null, null, null, null);

/* description of root cat*/

insert into NOTES
			(NOTEID, OBJECTID, SOURCETABLE, SUCCESSORID, TEXT)
	values	(1, 1, 'CATEGORIES' , null, 'Root-Category');

/*
 * permissions
 */
insert into PERMISSIONS
            (PERMISSIONID, CONTEXT, TOKEN, NUMVALUE, PRINTSTRING, DESCRIPTION, ENABLED)
     values (1, 'category', 'c', '1', 'change ACL', 'Context CATEGORY: change ACL permission', 1);

insert into PERMISSIONS
            (PERMISSIONID, CONTEXT, TOKEN, NUMVALUE, PRINTSTRING, DESCRIPTION, ENABLED)
     values (2, 'category', 'r', '2', 'read category', 'Context CATEGORY: Read category permission', 1);

insert into PERMISSIONS
            (PERMISSIONID, CONTEXT, TOKEN, NUMVALUE, PRINTSTRING, DESCRIPTION, ENABLED)
     values (3, 'category', 'w', '4', 'write category', 'Context CATEGORY: write category permission', 1);

insert into PERMISSIONS
            (PERMISSIONID, CONTEXT, TOKEN, NUMVALUE, PRINTSTRING, DESCRIPTION, ENABLED)
     values (4, 'category', 'd', '8', 'delete documents', 'Context Category: delete documents permission', 1);

insert into PERMISSIONS
            (PERMISSIONID, CONTEXT, TOKEN, NUMVALUE, PRINTSTRING, DESCRIPTION, ENABLED)
     values (5, 'category', 'D', '16', 'delete category', 'Context CATEGORY: delete category permission', 1);

insert into PERMISSIONS
            (PERMISSIONID, CONTEXT, TOKEN, NUMVALUE, PRINTSTRING, DESCRIPTION, ENABLED)
     values (6, 'category', 'C', '32', 'create subcategory', 'Context CATEGORY: create subcategory permission', 1);

insert into PERMISSIONS
            (PERMISSIONID, CONTEXT, TOKEN, NUMVALUE, PRINTSTRING, DESCRIPTION, ENABLED)
     values (7, 'category', 'L', '64', 'create link to category', 'Context CATEGORY: create link to category permission', 0);

insert into PERMISSIONS
            (PERMISSIONID, CONTEXT, TOKEN, NUMVALUE, PRINTSTRING, DESCRIPTION, ENABLED)
     values (8, 'category', 'F', '128', 'follow link to category', 'Context CATEGORY: follow link to category permission', 0);

insert into PERMISSIONS
            (PERMISSIONID, CONTEXT, TOKEN, NUMVALUE, PRINTSTRING, DESCRIPTION, ENABLED)
     values (9, 'category', 'l', '256', 'create link to document', 'Context CATEGORY: create link to document permission', 0);

insert into PERMISSIONS
            (PERMISSIONID, CONTEXT, TOKEN, NUMVALUE, PRINTSTRING, DESCRIPTION, ENABLED)
     values (10, 'category', 'f', '512', 'follow link to document', 'Context CATEGORY: follow link to document permission', 0);

insert into PERMISSIONS
            (PERMISSIONID, CONTEXT, TOKEN, NUMVALUE, PRINTSTRING, DESCRIPTION, ENABLED)
     values (11, 'document', 'c', '1', 'change ACL', 'Context DOCUMENT: change ACL permission', 1);

insert into PERMISSIONS
            (PERMISSIONID, CONTEXT, TOKEN, NUMVALUE, PRINTSTRING, DESCRIPTION, ENABLED)
     values (12, 'document', 'r', '2', 'read document', 'Context DOCUMENT: read document permission', 1);

insert into PERMISSIONS
            (PERMISSIONID, CONTEXT, TOKEN, NUMVALUE, PRINTSTRING, DESCRIPTION, ENABLED)
     values (13, 'document', 'w', '4', 'write document', 'Context DOCUMENT: write document permission', 1);

insert into PERMISSIONS
            (PERMISSIONID, CONTEXT, TOKEN, NUMVALUE, PRINTSTRING, DESCRIPTION, ENABLED)
     values (14, 'document', 'M', '8', 'move document', 'Context DOCUMENT: move document permission', 1);

insert into PERMISSIONS
            (PERMISSIONID, CONTEXT, TOKEN, NUMVALUE, PRINTSTRING, DESCRIPTION, ENABLED)
     values (15, 'document', 'D', '16', 'delete document', 'Context DOCUMENT: delete document permission', 1);

insert into PERMISSIONS
            (PERMISSIONID, CONTEXT, TOKEN, NUMVALUE, PRINTSTRING, DESCRIPTION, ENABLED)
     values (16, 'category', 'i', '1024', 'insert document', 'Context CATEGORY: insert document permission', 0);


/* default category acl */
/* owner:    crwdDCLFlf */

/* owner: c */
insert into DEFAULTCATACLS
            (ACLENTRYID, STARTCATID, ACLTYPEID, ACCESSORID, PERMISSIONID, CREATED, CREATORID)
     values (1, 1, 5, 0, 1, CURRENT_TIMESTAMP, 1);

/* owner: r */
insert into DEFAULTCATACLS
            (ACLENTRYID, STARTCATID, ACLTYPEID, ACCESSORID, PERMISSIONID, CREATED, CREATORID)
     values (2, 1, 5, 0, 2, CURRENT_TIMESTAMP, 1);

/* owner: w */
insert into DEFAULTCATACLS
            (ACLENTRYID, STARTCATID, ACLTYPEID, ACCESSORID, PERMISSIONID, CREATED, CREATORID)
     values (3, 1, 5, 0, 3, CURRENT_TIMESTAMP, 1);

/* owner: d */
insert into DEFAULTCATACLS
            (ACLENTRYID, STARTCATID, ACLTYPEID, ACCESSORID, PERMISSIONID, CREATED, CREATORID)
     values (4, 1, 5, 0, 19, CURRENT_TIMESTAMP, 1);

/* owner: D */
insert into DEFAULTCATACLS
            (ACLENTRYID, STARTCATID, ACLTYPEID, ACCESSORID, PERMISSIONID, CREATED, CREATORID)
     values (5, 1, 5, 0, 4, CURRENT_TIMESTAMP, 1);

/* owner: C */
insert into DEFAULTCATACLS
            (ACLENTRYID, STARTCATID, ACLTYPEID, ACCESSORID, PERMISSIONID, CREATED, CREATORID)
     values (6, 1, 5, 0, 5, CURRENT_TIMESTAMP, 1);

/* owner: L */
insert into DEFAULTCATACLS
            (ACLENTRYID, STARTCATID, ACLTYPEID, ACCESSORID, PERMISSIONID, CREATED, CREATORID)
     values (7, 1, 5, 0, 6, CURRENT_TIMESTAMP, 1);

/* owner: F */
insert into DEFAULTCATACLS
            (ACLENTRYID, STARTCATID, ACLTYPEID, ACCESSORID, PERMISSIONID, CREATED, CREATORID)
     values (8, 1, 5, 0, 7, CURRENT_TIMESTAMP, 1);

/* owner: l */
insert into DEFAULTCATACLS
            (ACLENTRYID, STARTCATID, ACLTYPEID, ACCESSORID, PERMISSIONID, CREATED, CREATORID)
     values (9, 1, 5, 0, 8, CURRENT_TIMESTAMP, 1);

/* owner: f */
insert into DEFAULTCATACLS
            (ACLENTRYID, STARTCATID, ACLTYPEID, ACCESSORID, PERMISSIONID, CREATED, CREATORID)
     values (10, 1, 5, 0, 9, CURRENT_TIMESTAMP, 1);


/*
 * documentflags
 */
insert into DOCUMENTFLAGS
            (FLAG, DESCRIPTION)
     values (0, 'published');

insert into DOCUMENTFLAGS
            (FLAG, DESCRIPTION)
     values (1, 'expired');

insert into DOCUMENTFLAGS
            (FLAG, DESCRIPTION)
     values (2, 'deleted');

insert into DOCUMENTFLAGS
            (FLAG, DESCRIPTION)
     values (3, 'to be published');


/* 
 * documentstati 
 */
insert into DOCUMENTSTATI
            (STATUS, DESC_KEY, REMARK)
     values (0, 'vkc.documentstati.none', null);

insert into DOCUMENTSTATI
            (STATUS, DESC_KEY, REMARK)
     values (1, 'vkc.documentstati.draft', null);

insert into DOCUMENTSTATI
            (STATUS, DESC_KEY, REMARK)
     values (2, 'vkc.documentstati.released', null);

insert into DOCUMENTSTATI
            (STATUS, DESC_KEY, REMARK)
     values (3, 'vkc.documentstati.confidential', null);

insert into DOCUMENTSTATI
            (STATUS, DESC_KEY, REMARK)
     values (4, 'vkc.documentstati.final', null);


/*
 * documenttypes
 */
insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (0, '?', 'undefined', 'undefined', 1, '?', '/gfx/documenttype/document', 'gif', 0, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (1, 'TXT', 'Generic ASCII Text', 'ASCII document', 0, 'text/plain', '/gfx/documenttype/txt', 'gif', 1, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (2, 'PDF', 'Adobe Portable Document Format', 'PDF document', 0, 'application/pdf', '/gfx/documenttype/pdf', 'gif', 1, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (3, 'DOC', 'Microsoft Winword Document', 'Winword document', 0, 'application/msword', '/gfx/documenttype/doc', 'gif', 1, 1);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (4, 'HTML', 'Hypertext Markup Language Document', 'HTML document', 0, 'text/html', '/gfx/documenttype/html', 'gif', 1, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (5, 'PS', 'Postscript Document', 'Postscript document', 0, 'application/postscript', '/gfx/documenttype/ps', 'gif', 1, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (6, 'PPT', 'Microsoft Powerpoint Document', 'PPT document', 0, 'application/vnd.ms-powerpoint', '/gfx/documenttype/ppt', 'gif', 1, 1);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (7, 'XLS', 'Microsoft Excel Document', 'Excel document', 0, 'application/vnd.ms-excel', '/gfx/documenttype/xls', 'gif', 1, 1);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (8, 'RTF', 'Rich Text Format Document', 'RTF document', 0, 'application/rtf', '/gfx/documenttype/rtf', 'gif', 1, 1);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (9, 'WPD', 'Word Perfect Document', 'WPD document', 0, 'application/wordperfect5.1', '/gfx/documenttype/wpd', 'gif', 1, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (10, 'TDF', 'Typography Description Format Document', 'TDF document', 1, 'application/tdf', '/gfx/documenttype/tdf', 'gif', 0, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (11, 'NOTE', 'Note', 'Note', 0, null, '/gfx/documenttype/note', 'gif', 0, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (12, 'LINK', 'Link', 'Link', 0, null, '/gfx/documenttype/link', 'gif', 1, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (13, 'GIF', 'Graphics Interchange Format', 'GIF graphic', 0, 'image/gif', '/gfx/documenttype/gif', 'gif', 0, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (14, 'JPG', 'Joint Photographic Experts Group Graphic', 'JPG graphic', 0, 'image/jpeg', '/gfx/documenttype/jpg', 'gif', 0, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (15, 'BMP', 'Bit Map Picture', 'BMP graphic', 0, 'image/bmp', '/gfx/documenttype/bmp', 'gif', 0, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (16, 'PNG', 'Portable Network Graphics', 'PNG graphic', 0, 'image/png', '/gfx/documenttype/png', 'gif', 0, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (17, 'EXE', 'Executable', 'EXE file', 0, 'application/octet-stream', '/gfx/documenttype/exe', 'gif', 0, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (18, 'ZIP', 'ZIP File', 'ZIP file', 0, 'application/zip', '/gfx/documenttype/zip', 'gif', 0, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (19, 'XML', 'Extensible Markup Language File', 'XML file', 0, 'text/xml', '/gfx/documenttype/xml', 'gif', 0, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (20, 'EML', 'Email File', 'EML file', 0, 'message/rfc822', '/gfx/documenttype/eml', 'gif', 1, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (21, 'MSG', 'Outlook Email File', 'MSG file', 0, 'application/vnd.ms-outlook', '/gfx/documenttype/msg', 'gif', 1, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (22, 'HTM', 'Hypertext Markup Language Document', 'HTM document', 0, 'text/html', '/gfx/documenttype/htm', 'gif', 1, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (23, 'TEX', 'TeX Document', 'TeX document', 0, 'application/x-tex', '/gfx/documenttype/tex', 'gif', 1, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (24, 'SXI', 'StarOffice Presentation', 'SXI Document', 0, 'application/sxi', '/gfx/documenttype/sxi', 'gif', 0, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (25, 'SXW', 'StarOffice Write Document', 'SXW document', 0, 'application/sxw', '/gfx/documenttype/sxw', 'gif', 0, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (26, 'SXC', 'StarOffice Tabel Calculation Document', 'SXC document', 0, 'application/sxc', '/gfx/documenttype/sxc', 'gif', 0, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (27, 'FH8', 'Bildformat für "Free Hand"', 'FH8 Document', 0, 'application/fh8', '/gfx/documenttype/fh8', 'gif', 0, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (28, 'FH11', 'Bildformat für "Free Hand"', 'FH11 Document', 0, 'application/fh11', '/gfx/documenttype/fh11', 'gif', 0, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (29, 'ODT', 'OpenOffice Textdatei', 'OpenOffice Textdatei', 0, 'application/odt', '/gfx/documenttype/odt', 'gif', 0, 0);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (30, 'DOCX', 'Microsoft Winword Document', 'Winword document', 0, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', '/gfx/documenttype/doc', 'gif', 1, 1);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (31, 'PPTX', 'Microsoft Powerpoint Document', 'PPT document', 0, 'application/vnd.openxmlformats-officedocument.presentationml.presentation', '/gfx/documenttype/ppt', 'gif', 1, 1);

insert into DOCUMENTTYPES
            (DOCTYPEID, EXTENSION, DESCRIPTION, DESCRIPTION_SHORT, INTERNAL, MIMETYPE, IMGPATH, ICON_EXTENSION, CONVERTIBLE, EDITABLE)
     values (32, 'XLSX', 'Microsoft Excel Document', 'Excel document', 0, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', '/gfx/documenttype/xls', 'gif', 1, 1);


/*
 * documentclasses
 */
insert into DOCUMENTCLASSES
            (DOCCLASSID, NAME_KEY, DESCR_KEY)
     values (0, 'vkc.documentclass.none', '');

insert into DOCUMENTCLASSES
            (DOCCLASSID, NAME_KEY, DESCR_KEY)
     values (1, 'vkc.documentclass.report', '');

insert into DOCUMENTCLASSES
            (DOCCLASSID, NAME_KEY, DESCR_KEY)
     values (2, 'vkc.documentclass.memo', '');

insert into DOCUMENTCLASSES
            (DOCCLASSID, NAME_KEY, DESCR_KEY)
     values (3, 'vkc.documentclass.protocol', '');

insert into DOCUMENTCLASSES
            (DOCCLASSID, NAME_KEY, DESCR_KEY)
     values (4, 'vkc.documentclass.status', '');
     
insert into DOCUMENTCLASSES
            (DOCCLASSID, NAME_KEY, DESCR_KEY)
     values (5, 'vkc.documentclass.offer', '');

insert into DOCUMENTCLASSES
            (DOCCLASSID, NAME_KEY, DESCR_KEY)
     values (6, 'vkc.documentclass.bill', '');
     
insert into DOCUMENTCLASSES
            (DOCCLASSID, NAME_KEY, DESCR_KEY)
     values (7, 'vkc.documentclass.balance', '');
     
insert into DOCUMENTCLASSES
            (DOCCLASSID, NAME_KEY, DESCR_KEY)
     values (8, 'vkc.documentclass.requirement', '');

insert into DOCUMENTCLASSES
            (DOCCLASSID, NAME_KEY, DESCR_KEY)
     values (9, 'vkc.documentclass.data', '');
     
insert into DOCUMENTCLASSES
			(DOCCLASSID, NAME_KEY, DESCR_KEY)
	 values (10, 'vkc.documentclass.instruction', '');
	 
/*
 * groups
 */
insert into GROUPS
            (GROUPID, NAME, DESCRIPTION, ACCOUNTVALID, ADMINPRIVILEGES, VALIDFROM, VALIDUNTIL, CREATED, CREATORID, LASTCHANGED, LASTCHANGERID)
     values (1, 'AdminGroup', 'AdminGroup', 1, 1, null, null, null, null, null, null);

insert into GROUPS
            (GROUPID, NAME, DESCRIPTION, ACCOUNTVALID, ADMINPRIVILEGES, VALIDFROM, VALIDUNTIL, CREATED, CREATORID, LASTCHANGED, LASTCHANGERID)
     values (2, 'public', 'Default group', 1, 0, null, null, null, null, null, null);


/*
 * languages
 */
insert into LANGUAGES
            (LANGUAGEID, NAME, NAME_KEY, SHORTNAME, ISOCODE, DEFAULTLANGUAGE)
     values (1, 'Deutsch', 'vkc.language.german', 'de', 'ISO8859-1', 1);

insert into LANGUAGES
            (LANGUAGEID, NAME, NAME_KEY, SHORTNAME, ISOCODE, DEFAULTLANGUAGE)
     values (2, 'English', 'vkc.language.english', 'en', 'ISO8859-1', 0);


/*
 * languagepacks
 */
insert into LANGUAGEPACKS
            (LANGPACKID, COUNTRYCODE, NAME, DESCRIPTION, CLASSNAME, CLASSPATH, ENABLED)
     values (0, ' ', 'Language Pack: unkown', 'unkown', ' ', ' ', 1);

insert into LANGUAGEPACKS
            (LANGPACKID, COUNTRYCODE, NAME, DESCRIPTION, CLASSNAME, CLASSPATH, ENABLED)
     values (1, 'de', 'Language Pack: German', 'Analyser Language Pack German', 'vkc.analyse.Analyser_de', 'vkc/analyse', 1);
     
insert into LANGUAGEPACKS
            (LANGPACKID, COUNTRYCODE, NAME, DESCRIPTION, CLASSNAME, CLASSPATH, ENABLED)
     values (2, 'es', 'Language Pack: Spanish', 'Analyser Language Pack Spanish', 'vkc.analyse.Analyser_es', 'vkc/analyse', 1);
     
insert into LANGUAGEPACKS
            (LANGPACKID, COUNTRYCODE, NAME, DESCRIPTION, CLASSNAME, CLASSPATH, ENABLED)
     values (3, 'gb', 'Language Pack: English', 'Analyser Language Pack English', 'vkc.analyse.Analyser_gb', 'vkc/analyse', 1);
     
     
/*
 * sysparameters
 * Datatype 0 = String
 *          1 = integer
 *          2 = boolean
 */
insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1001, 'SYSTEMINFO', 'sysparam.context.systeminfo', 'DBName', 'sysparam.context.systeminfo.dbname', 'VKC.GDB', 'Name of the VKC database', 'sysparam.context.systeminfo.dbname.descr', 1050, 0, 1, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1002, 'SYSTEMINFO', 'sysparam.context.systeminfo', 'DBMS', 'sysparam.context.systeminfo.dbms', 'Interbase', 'VKC database management system', 'sysparam.context.systeminfo.dbms.descr', 1100, 0, 1, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1003, 'SYSTEMINFO', 'sysparam.context.systeminfo', 'DBCopyright', 'sysparam.context.systeminfo.dbcopyright', 'C-LAB', 'Owner of the db schema', 'sysparam.context.systeminfo.dbcopyright.descr', 1150, 0, 1, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1004, 'SYSTEMINFO', 'sysparam.context.systeminfo', 'DBVersionHigh', 'sysparam.context.systeminfo.dbversionhigh', '1', 'Database Version High Number', 'sysparam.context.systeminfo.dbversionhigh.descr', 1200, 0, 1, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1005, 'SYSTEMINFO', 'sysparam.context.systeminfo', 'DBVersionLow', 'sysparam.context.systeminfo.dbversionlow', '199', 'Database Version Low Number', 'sysparam.context.systeminfo.dbversionlow.descr', 1250, 0, 1, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1006, 'SYSTEMINFO', 'sysparam.context.systeminfo', 'DBCreationDate', 'sysparam.context.systeminfo.dbcreationdate', '2010-01-20', 'Database Creation Date', 'sysparam.context.systeminfo.dbcreationdate.descr', 1300, 0, 1, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1007, 'ARCHIVE', 'sysparam.context.archive', 'StartBackupHour', 'sysparam.context.archive.startbackuphour', 0, 'Scheduling hour for backup (start)', 'sysparam.context.archive.startbackuphour.descr', 2050, 0, 0, 0, 1);
     
insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1008, 'ARCHIVE', 'sysparam.context.archive', 'EndBackupHour', 'sysparam.context.archive.endbackuphour', 3, 'Scheduling hour for backup (end)', 'sysparam.context.archive.endbackuphour.descr', 2100, 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1009, 'ARCHIVE', 'sysparam.context.archive', 'CleaningPeriod', 'sysparam.context.archive.cleaningperiod', 7, 'Cleaning period of the data archive in days', 'sysparam.context.archive.cleaningperiod.descr', 2150, 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1010, 'ARCHIVE', 'sysparam.context.archive', 'MinimumAge', 'sysparam.context.archive.minimumage', 30, 'Minimum Age of files can be deleted in minutes', 'sysparam.context.archive.minimumage.descr', 2200, 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1011, 'DOCUMENT', 'sysparam.context.document', 'EnableMultiIcon', 'sysparam.context.document.enablemultiicon', '1', 'Enable different icons for different documenttypes ', 'sysparam.context.document.enablemultiicon.descr', 3050, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1012, 'DOCUMENT', 'sysparam.context.document', 'EnableDocumentStatusCoverage', 'sysparam.context.document.enabledocumentstatuscoverage', '0', 'Enable input of document status', 'sysparam.context.document.enabledocumentstatuscoverage.descr', 3100, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1013, 'DOCUMENT', 'sysparam.context.document', 'EnableDocumentClassCoverage', 'sysparam.context.document.enabledocumentclasscoverage', '0', 'Enable input of document class', 'sysparam.context.document.enabledocumentclasscoverage.descr', 3150, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1014, 'DOCUMENT', 'sysparam.context.document', 'EnableDocumentCreationDateCoverage', 'sysparam.context.document.enabledocumentcreationdatecoverage', '0', 'Enable input of document creation date', 'sysparam.context.document.enabledocumentcreationdatecoverage.descr', 3200, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1015, 'DOCUMENT', 'sysparam.context.document', 'EnableDocumentVersionManagement', 'sysparam.context.document.enabledocumentversionmanagement', '0', 'Enable management of document versions', 'sysparam.context.document.enabledocumentversionmanagement.descr', 3250, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1016, 'DOCUMENT', 'sysparam.context.document', 'EnableDocumentTitle', 'sysparam.context.document.enabledocumenttitle', '1', 'Enable automatically title of document', 'sysparam.context.document.enabledocumenttitle.descr', 3300, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1017, 'DOCUMENT', 'sysparam.context.document', 'EnableDocumentKeyword', 'sysparam.context.document.enabledocumentkeyword', '1', 'Enable automatically generate keyword of document', 'sysparam.context.document.enabledocumentkeyword.descr', 3350, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1018, 'DOCUMENT', 'sysparam.context.document', 'EnableDocumentDescription', 'sysparam.context.document.enabledocumentdescription', '1', 'Enable automatically description of document', 'sysparam.context.document.enabledocumentdescription.descr', 3400, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1019, 'CATEGORYVIEW', 'sysparam.context.categoryview', 'EnableClusterCategory', 'sysparam.context.categoryview.enableclustercategory', '0', 'Enable clustering of all category documents', 'sysparam.context.categoryview.enableclustercategory.descr', 4050, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1020, 'CATEGORYVIEW', 'sysparam.context.categoryview', 'EnableCountCatDocs', 'sysparam.context.categoryview.enablecountcatdocs', '0', 'Enable computation of count of subcats. and docs.', 'sysparam.context.categoryview.enablecountcatdocs.descr', 4100, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1021, 'CATEGORYVIEW', 'sysparam.context.categoryview', 'ListAccessibleCategoriesOnly', 'sysparam.context.categoryview.listaccessiblecategoriesonly', '1', 'List only accessible categories', 'sysparam.context.categoryview.listaccessiblecategoriesonly.descr', 4150, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1022, 'CATEGORYVIEW', 'sysparam.context.categoryview', 'MarkForbiddenCategories', 'sysparam.context.categoryview.markforbiddencategories', '1', 'Mark forbidden categories with special icon', 'sysparam.context.categoryview.markforbiddencategories.descr', 4200, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1023, 'CATEGORYVIEW', 'sysparam.context.categoryview', 'DisplayEmptyFoldersWithEmptyIcon', 'sysparam.context.categoryview.emptyfolder', '0', 'Display special icon if folder is empty', 'sysparam.context.categoryview.emptyfolder.descr', 4250, 1, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1024, 'CATEGORYVIEW', 'sysparam.context.categoryview', 'ShowDisplayAscii', 'sysparam.context.categoryview.showdisplayascii', '1', 'Show link to display document in ascii format', 'sysparam.context.categoryview.showdisplayascii.descr', 4300, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1025, 'PROJECTMANAGEMENT', 'sysparam.context.projectmanagement', 'EnableProjectManagement', 'sysparam.context.projectmanagement.enableprojectmanagement', '0', 'Enable project management', 'sysparam.context.projectmanagement.enableprojectmanagement.descr', 5050, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1026, 'PROJECTMANAGEMENT', 'sysparam.context.projectmanagement', 'ProjectRootCategoryId', 'sysparam.context.projectmanagement.projectrootcategoryid', '0', 'ID of the root category for projectmanagement', 'sysparam.context.projectmanagement.projectrootcategoryid.descr', 5100, 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1027, 'PROJECTMANAGEMENT', 'sysparam.context.projectmanagement', 'TemplatesRootCategoryId', 'sysparam.context.projectmanagement.templatesrootcategoryid', '0', 'ID of the template category', 'sysparam.context.projectmanagement.templatesrootcategoryid.descr', 5150, 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1028, 'FUNCTIONALVIEW', 'sysparam.context.functionalview', 'FunctionalViewRootCategoryId', 'sysparam.context.functionalview.functionalviewrootcategoryid', '0', 'ID of the root category for functional views', 'sysparam.context.functionalview.functionalviewrootcategoryid.descr', 6050, 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1029, 'MAIL', 'sysparam.context.mail', 'EnableMail', 'sysparam.context.mail.enablemail', '1', 'Enable Mail', 'sysparam.context.mail.enablemail.descr', 7050, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1030, 'MAIL', 'sysparam.context.mail', 'NotificationCheckPeriod', 'sysparam.context.mail.notificationcheckperiod', '10', 'Period of minutes to check for notifications', 'sysparam.context.mail.notificationcheckperiod.descr', 7100, 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1031, 'MAIL', 'sysparam.context.mail', 'DeleteDocumentPeriod', 'sysparam.context.mail.deletedocumentperiod', '28', 'Period of days when document should be deleted', 'sysparam.context.mail.deletedocumentperiod.descr', 7150, 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1032, 'MAIL', 'sysparam.context.mail', 'CheckExpirationTime', 'sysparam.context.mail.checkexpirationtime', '00:00:00', 'Time, when the expiration thread should be called', 'sysparam.context.mail.checkexpirationtime.descr', 7200, 0, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1033, 'MAIL', 'sysparam.context.mail', 'RootURL', 'sysparam.context.mail.rooturl', 'http://localhost:8080', 'URL of ', 'sysparam.context.mail.rooturl.descr', 7250, 0, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1034, 'MAIL', 'sysparam.context.mail', 'AdminEmail', 'sysparam.context.mail.adminemail', 'admin@company.com', 'EMail adress of the administrator', 'sysparam.context.mail.adminemail.descr', 7300, 0, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1035, 'MAIL', 'sysparam.context.mail', 'MailServer', 'sysparam.context.mail.mailserver', 'mail.company.com', 'Mailservers adress', 'sysparam.context.mail.mailserver.descr', 7350, 0, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1036, 'MAIL', 'sysparam.context.mail', 'MailUsername', 'sysparam.context.mail.mailusername', '', 'Mailservers username', 'sysparam.context.mail.mailusername.descr', 7400, 1, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1037, 'MAIL', 'sysparam.context.mail', 'MailPassword', 'sysparam.context.mail.mailpassword', '', 'Mailservers password', 'sysparam.context.mail.mailpassword.descr', 7450, 1, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1038, 'MAIL', 'sysparam.context.mail', 'MailPort', 'sysparam.context.mail.mailport', '25', 'Mailservers port (Default: 25)', 'sysparam.context.mail.mailport.descr', 7500, 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1039, 'MAIL', 'sysparam.context.mail', 'MailSsl', 'sysparam.context.mail.mailssl', '0', 'Use SSL connection with the mailserver', 'sysparam.context.mail.mailssl.descr', 7550, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1040, 'MAIL', 'sysparam.context.mail', 'MailUntrustedCertificate', 'sysparam.context.mail.mailuntrustedcertificate', '0', 'Allow untrusted certificates for SSL connection with the mailserver', 'sysparam.context.mail.mailuntrustedcertificate.descr', 7600, 0, 0, 0, 2);
     
insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1041, 'LOGGING', 'sysparam.context.logging', 'EnableLogging', 'sysparam.context.logging.enablelogging', '1', '', 'sysparam.context.logging.enablelogging.descr', 8050, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1042, 'LOGGING', 'sysparam.context.logging', 'MaxLogFileCount', 'sysparam.context.logging.maxlogfilecount', '1', '', 'sysparam.context.logging.maxlogfilecount.descr', 8100, 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1043, 'LOGGING', 'sysparam.context.logging', 'MaxLogFileSize', 'sysparam.context.logging.maxlogfilesize', '1000000', '', 'sysparam.context.logging.maxlogfilesize.descr', 8150, 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1044, 'LOGGING', 'sysparam.context.logging', 'LoggingLevel', 'sysparam.context.logging.logginglevel', '1', '', 'sysparam.context.logging.logginglevel.descr', 8200, 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1045, 'LOGGING', 'sysparam.context.logging', 'InfoLogFile', 'sysparam.context.logging.infologfile', 'c:/temp/vkc_info.log', 'File for logging infos of VKC', 'sysparam.context.logging.infologfile.descr', 8250, 0, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1046, 'LOGGING', 'sysparam.context.logging', 'ErrorLogFile', 'sysparam.context.logging.errorlogfile', 'c:/temp/vkc_error.log', 'File for logging errors of VKC', 'sysparam.context.logging.errorlogfile.descr', 8300, 0, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1047, 'LOGGING', 'sysparam.context.logging', 'TraceLogFile', 'sysparam.context.logging.tracelogfile', '/WEB-INF/log/vkc_trace.log', 'File for tracing logs of VKC', 'sysparam.context.logging.tracelogfile.descr', 8350, 0, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1048, 'LOGGING', 'sysparam.context.logging', 'enableAccessLog', 'sysparam.context.logging.enableAccessLog', '1', 'Enable access log', 'sysparam.context.logging.enableAccessLog.descr', 8400, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1049, 'LOGGING', 'sysparam.context.logging', 'anonymizeAccessLog', 'sysparam.context.logging.anonymizeAccessLog', '0', 'Anonymize access log', 'sysparam.context.logging.anonymizeAccessLog.descr', 8450, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1050, 'LOGGING', 'sysparam.context.logging', 'AccessLogFile', 'sysparam.context.logging.accesslogfile', 'c:/temp/vkc_access.log', 'File for logging access of VKC', 'sysparam.context.logging.accesslogfile.descr', 8500, 0, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1051, 'LOGGING', 'sysparam.context.logging', 'EnableWebdavAccessLog', 'sysparam.context.logging.enablewebdavaccesslog', '1', 'Enable webdav access log', 'sysparam.context.logging.enablewebdavaccesslog.descr', 8550, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1052, 'LOGGING', 'sysparam.context.logging', 'MaxWebdavLogFileSize', 'sysparam.context.logging.maxwebdavlogfilesize', '1000000', 'Maximum size of WebDav log files', 'sysparam.context.logging.maxwebdavlogfilesize.descr', 8600, 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1053, 'LOGGING', 'sysparam.context.logging', 'WebdavAccessLogFile', 'sysparam.context.logging.webdavaccesslogfile', 'c:/temp/vkc_webdav_access.log', 'File for logging webdav access of VKC', 'sysparam.context.logging.webdavaccesslogfile.descr', 8650, 0, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1054, 'SYSTEMPATHS', 'sysparam.context.systempaths', 'DatastoreDir', 'sysparam.context.systempaths.datastoredir', 'WEB-INF/datastorage', '', 'sysparam.context.systempaths.datastoredir.descr', 9050, 0, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1055, 'SYSTEMPATHS', 'sysparam.context.systempaths', 'SearchIndexDir', 'sysparam.context.systempaths.searchindexdir', 'WEB-INF/searchindex', '', 'sysparam.context.systempaths.searchindexdir.descr', 9100, 0, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1056, 'SYSTEMPATHS', 'sysparam.context.systempaths', 'ClassifyIndexDir', 'sysparam.context.systempaths.classifyindexdir', 'WEB-INF/classifyindex', '', 'sysparam.context.systempaths.classifyindexdir.descr', 9150, 0, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1057, 'SYSTEMPATHS', 'sysparam.context.systempaths', 'ConverterDir', 'sysparam.context.systempaths.converterdir', 'WEB-INF/bin/win32', '', 'sysparam.context.systempaths.converterdir.descr', 9200, 0, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1058, 'SYSTEMPATHS', 'sysparam.context.systempaths', 'LanguageDir', 'sysparam.context.systempaths.languagedir', 'lang', '', 'sysparam.context.systempaths.languagedir.descr', 9250, 0, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1059, 'LOGIN', 'sysparam.context.login', 'MaxAllowedUsers', 'sysparam.context.login.maxallowedusers', '0', 'The maximum number of users allowed in VKC at the same time', 'sysparam.context.login.maxallowedusers.descr', 10050, 0, 1, 0, 1);
       
insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1060, 'LOGIN', 'sysparam.context.login', 'DefaultLoginPage', 'sysparam.context.login.defaultLoginPage', '/common/Login.jsp', 'Default JSP page for login into VKC', 'sysparam.context.login.defaultLoginPage.descr', 10100, 1, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1061, 'LOGIN', 'sysparam.context.login', 'StandaloneModus', 'sysparam.context.login.standalone', '1', 'Standalone Modus', 'sysparam.context.login.standalone.descr', 10150, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1062, 'LOGIN', 'sysparam.context.login', 'EnableUserRegistration', 'sysparam.context.login.enableuserregistration', '0', 'Enable self registration for a user', 'sysparam.context.login.enableuserregistration.descr', 10200, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1063, 'LOGIN', 'sysparam.context.login', 'EnableGuestLogin', 'sysparam.context.login.enableguestlogin', '0', 'Enable login for a guest user', 'sysparam.context.login.enableguestlogin.descr', 10250, 0, 0, 0, 2);
       
insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1064, 'LOGIN', 'sysparam.context.login', 'UserLockEnabled', 'sysparam.context.login.userlockenabled', '1', 'Enables user lock management and counting of unsuccessful pwd. authentication attempts', 'sysparam.context.login.userlockenabled.descr', 10300, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1067, 'LOGIN', 'sysparam.context.login', 'UserLockNotification', 'sysparam.context.login.userlocknotification', '1', 'Notificate locked user after max. num. unsuccessful pwd. authentication attempts', 'sysparam.context.login.userlocknotification.descr', 10450, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1068, 'ARCHIVECATEGORY', 'sysparam.context.archivecategory', 'EnableArchiveCategory', 'sysparam.context.archivecategory.enablearchivecategory', '0', 'Enable archive (zipping) of a category', 'sysparam.context.archivecategory.enablearchivecategory.descr', 11050, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1069, 'ARCHIVECATEGORY', 'sysparam.context.archivecategory', 'ArchiveCategoryPath', 'sysparam.context.archivecategory.archivecategorypath', '/tmp', 'Enable archive (zipping) of a category', 'sysparam.context.archivecategory.archivecategorypath.descr', 11100, 0, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1070, 'QUOTA', 'sysparam.context.quota', 'EnableQuotaChecking', 'sysparam.context.quota.enablequotachecking', '1', 'Enables checking for quota', 'sysparam.context.quota.enablequotachecking.descr', 12050, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1071, 'QUOTA', 'sysparam.context.quota', 'ConsiderAdditionalDocFormats', 'sysparam.context.quota.adddocformats', '0', 'Consider amount of additional document formats', 'sysparam.context.quota.adddocformats.consideration', 12100, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1072, 'NEWS', 'sysparam.context.news', 'EnableNews', 'sysparam.context.news.enablenews', '1', 'Enable news system', 'sysparam.context.news.enablenews.descr', 13050, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1073, 'NEWS', 'sysparam.context.news', 'MaxCountNews', 'sysparam.context.news.maxcountnews', '20', 'Maxmium count of displayed news', 'sysparam.context.news.maxcountnews.descr', 13100, 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1074, 'NEWS', 'sysparam.context.news', 'ConsiderValidNewsOnly', 'sysparam.context.news.validnewsonly', '0', 'Consider valid news only', 'sysparam.context.news.validnewsonly.descr', 13150, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1075, 'TRASH', 'sysparam.context.trash', 'EnableTrash', 'sysparam.context.trash.enable', '1', 'Enables Trash', 'sysparam.context.trash.enable.descr', 14050, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1076, 'TRASH', 'sysparam.context.trash', 'TrashCategoryId', 'sysparam.context.trash.categoryid', '0', 'Define a category for a trash', 'sysparam.context.trash.categoryid.descr', 14100, 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1077, 'STATISTICS', 'sysparam.context.statistics', 'EnableStatistics', 'sysparam.context.statistics.enablestatistics', '0', 'Enable display of statistical graphs', 'sysparam.context.statistics.enablestatistics.descr', 15050, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1078, 'VKCSTREAMS', 'sysparam.context.stream', 'EnableTDF', 'sysparam.context.stream.enabletdf', '1', 'Enable convert to TDF stream ', 'sysparam.context.stream.enabletdf.descr', 16050, 0, 0, 1, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1079, 'VKCSTREAMS', 'sysparam.context.stream', 'EnableHTML', 'sysparam.context.stream.enablehtml', '1', 'Enable convert to HTML stream ', 'sysparam.context.stream.enablehtml.descr', 16100, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1080, 'VKCSTREAMS', 'sysparam.context.stream', 'EnablePDF', 'sysparam.context.stream.enablepdf', '1', 'Enable convert to PDF stream ', 'sysparam.context.stream.enablepdf.descr', 16150, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1081, 'INDEX', 'sysparam.context.index', 'OptimizationPeriod', 'sysparam.context.index.optimizationperiod', '60', 'Search Index optimization period in minutes', 'sysparam.context.index.optimizationperiod.descr', 17050, 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1082, 'INDEX', 'sysparam.context.index', 'ParameterOptimization', 'sysparam.context.index.parameteroptimization', '1', 'Parameter optimization', 'sysparam.context.index.parameteroptimization.descr', 17100, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1083, 'INDEX', 'sysparam.context.index', 'ParameterOptimizationTime', 'sysparam.context.index.parameteroptimizationtime', '01:00:00', 'Classification parameter optimization time', 'sysparam.context.index.parameteroptimizationtime.descr', 17150, 0, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1084, 'INDEX', 'sysparam.context.index', 'ParameterOptimizationPeriod', 'sysparam.context.index.parameteroptimizationperiod', '24', 'Classification parameter optimization period in hours', 'sysparam.context.index.parameteroptimizationperiod.descr', 17200, 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1085, 'INDEX', 'sysparam.context.index', 'FullCrossValidation', 'sysparam.context.index.fullcrossvalidation', '0', 'Cross validation with all documents?', 'sysparam.context.index.fullcrossvalidation.descr', 17250, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1086, 'INDEX', 'sysparam.context.index', 'NumberOfNeighbors', 'sysparam.context.index.numberofneighbors', '-1', 'k parameter of kNN-Classifier', 'sysparam.context.index.numberofneighbors.descr', 17300, 0, 1, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1087, 'INDEX', 'sysparam.context.index', 'RelFeatureSumTreshold', 'sysparam.context.index.relfeaturesumtreshold', '1', 'feature selection treshold', 'sysparam.context.index.relfeaturesumtreshold.descr', 17350, 0, 1, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1088, 'INDEX', 'sysparam.context.index', 'MeanAccuracy', 'sysparam.context.index.meanaccuracy', '1', 'Mean accuracy of classifier', 'sysparam.context.index.meanaccuracy.descr', 17400, 0, 1, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1089, 'INDEX', 'sysparam.context.index', 'MeanScore', 'sysparam.context.index.meanscore', '1', 'Mean score of classifier', 'sysparam.context.index.meanscore.descr', 17450, 0, 1, 1, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1090, 'INDEX', 'sysparam.context.index', 'LastParameterOptimization', 'sysparam.context.index.lastparameteroptimization', '', 'End time of last classification parameter optimization', 'sysparam.context.index.lastparameteroptimization.descr', 17500, 1, 1, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1091, 'LICENSE', 'sysparam.context.license', 'EnableLicensemanagement', 'sysparam.context.license.management', '0', 'Enable licensemanagement', 'sysparam.context.license.management.descr', 18050, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1092, 'LDAP', 'sysparam.context.ldap', 'EnableLdapSupport', 'sysparam.context.ldap.enableLdapSupport', '0', 'Enables LDAP Support', 'sysparam.context.ldap.enableLdapSupport.descr', 19050, 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, CONTEXT_KEY, NAME, NAME_KEY, VALUESTRING, DESCRIPTION, DESCR_KEY, SORT_RANK, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (1093, 'LOGGING', 'sysparam.context.logging', 'MigrationLogFile', 'sysparam.context.logging.migrationlogfile', 'c:/temp/vkc_migration.log' , 'File for logging webdav access of VKC', 'sysparam.context.logging.migrationlogfile.descr', 8375, 0, 0, 0, 0);
    
commit;
/*
 * users
 */

/* system user */
insert into USERS
            (USERID, USERNAME, FIRSTNAME, LASTNAME, PASSWD, PASSWDCHANGED, PASSWDCHANGEDTS, PWDMISMATCHCOUNT, EMAIL, SHOWEMAIL, ADMINPRIVILEGES, SESSIONTIMEOUT, QUOTA, MANAGEOWNUSERS, MANAGEOWNUSERS_S_V, MANAGEOWNGROUPS, MANAGEOWNPROXIES, MANAGEVIRTUALDOC_Q, LANGUAGEID, ACCOUNTVALID, CREATED, CREATORID, MESSAGINGTIMEPERIOD, ALLOWMANAGE_S_V_T, SYSTEMVIEWTYPEID, SHOWTREE, LICENSEID, ACCEPTED, ENABLEHTMLNOTIFICATION)
     values (0, 'SYSTEM', '', 'VKC-SYSTEM-User', 'f89SqyHAVp5mPUirW+wHzA==', 1, null, 0, 'admin@company.com', 1, 1, 120, null, 1, 1, 1, 1, 1, 1, 1, CURRENT_TIMESTAMP, 0, 0, 0, 2, 0, 0, null, 0);

/* admin user */
insert into USERS
            (USERID, USERNAME, FIRSTNAME, LASTNAME, TITLE, PASSWD, PASSWDCHANGED, PASSWDCHANGEDTS, PWDMISMATCHCOUNT, EMAIL, SHOWEMAIL, ENABLEMESSAGING, MESSAGINGTIMEPERIOD, COMPANY, DEPARTMENT, ZIP, CITY, STREET, PHONE, FAX, MOBILE, HOMEPAGEURL, CONTACTURL, ADMINPRIVILEGES, SESSIONTIMEOUT, QUOTA, MANAGEOWNUSERS, MANAGEOWNUSERS_S_V, MANAGEOWNGROUPS, MANAGEOWNPROXIES, MANAGEVIRTUALDOC_Q, LANGUAGEID, ACCOUNTVALID, VALIDFROM, VALIDUNTIL, CREATED, CREATORID, LASTCHANGED, LASTCHANGERID, DYNATTRSID, STARTCATEGORYID, MOSTRECENTLOGIN, ALLOWMANAGE_S_V_T, SYSTEMVIEWTYPEID, SHOWTREE, LICENSEID, ACCEPTED, ENABLEHTMLNOTIFICATION)
     values (1, 'Admin', 'Administrator', 'VKC-Administrator', '...', 'f89SqyHAVp5mPUirW+wHzA==', 1, null, 0, 'admin@company.com', 0, 1, 1, 'Company1', 'Department1', '00000', 'City1', 'Street1', '00000/00001', '00000/00001', '00000/00001', 'http://www.homepage1.de', 'http://www.contacturl1.de', 1, 120, null, 1, 1, 1, 1, 1, 1, 1, null, null, null, null, null, null, null, 1, null, 0, 2, 0, 0, null, 0 );


/*
 * templates
 */
insert into TEMPLATES
            (TEMPLATEID, NAME, PATH, DESCRIPTION, PREVIEWPIC, ENABLED)
     values (1, 'default', '/templates/default/', 'default template', null, 1);


/*
 * convertertiming
 */
insert into CONVERTERTIMING
            (ID, POLLING_PERIOD_MINUTES, TIME_FRAME_START, TIME_FRAME_END)
     values (1, 1, '00:00', '23:59');


/*
 * documentviewfield
 */
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (1, 'fileName', 'vkc.document.type.file', 1);
     
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (2, 'fileFormat', 'vkc.document.type.fileformat', 1);
     
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (3, 'fileSize', 'vkc.document.type.filesize', 1);
     
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (4, 'classType', 'vkc.document.class', 1);
     
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (5, 'statusType', 'vkc.document.status', 1);
     
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (6, 'versionNo', 'vkc.document.version', 0);
     
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (7, 'versionLabel', 'vkc.document.label', 0);
     
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (8, 'versionDescr', 'vkc.document.versiondescr', 0);
     
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (9, 'expires', 'vkc.document.expires', 0);
     
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (10, 'published', 'vkc.published', 0);
     
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (11, 'author', 'vkc.author', 0);
     
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (12, 'publisher', 'vkc.publisher', 0);
     
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (13, 'accessCount', 'vkc.accesscount', 0);
     
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (14, 'lastAccessed', 'vkc.lastaccessed', 0);
     
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (15, 'keywords', 'vkc.keywords', 0);
     
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (16, 'description', 'vkc.description', 0);
     
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (17, 'additionalFormats', 'vkc.document.additional_formats', 0);
     
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (18, 'dynaAttributes', 'vkc.string.dynaAttributes', 0);
     
insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (19, 'addAttributes', 'vkc.string.addAttributes', 0);

insert into DOCUMENTVIEWFIELDS
            (FIELDID, NAME, NAMEKEY, DEFAULTFIELD)
     values (20, 'creationDate', 'vkc.creationdate', 0);

/*
 * userratings
 */
INSERT INTO USERRATINGS (USERRATINGID, MINPUBDOCSCOUNT, DESCRIPTION,  DESCR_KEY, ICON)
     VALUES (1, 50, 'graduate', 'vkc.userrating.graduate', 'userrating/graduate.gif');

INSERT INTO USERRATINGS (USERRATINGID, MINPUBDOCSCOUNT, DESCRIPTION,  DESCR_KEY, ICON)
     VALUES (2, 100, 'professional', 'vkc.userrating.professional', 'userrating/professional.gif');

INSERT INTO USERRATINGS (USERRATINGID, MINPUBDOCSCOUNT, DESCRIPTION,  DESCR_KEY, ICON)
     VALUES (3, 200, 'wizard', 'vkc.userrating.wizard', 'userrating/wizard.gif');

INSERT INTO USERRATINGS (USERRATINGID, MINPUBDOCSCOUNT, DESCRIPTION,  DESCR_KEY, ICON)
     VALUES (4, 300, 'king', 'vkc.userrating.king', 'userrating/king.gif');

INSERT INTO USERRATINGS (USERRATINGID, MINPUBDOCSCOUNT, DESCRIPTION,  DESCR_KEY, ICON)
     VALUES (5, 400, 'pharao', 'vkc.userrating.pharao', 'userrating/pharao.gif');

INSERT INTO USERRATINGS (USERRATINGID, MINPUBDOCSCOUNT, DESCRIPTION,  DESCR_KEY, ICON)
     VALUES (6, 500, 'olympian', 'vkc.userrating.olympian', 'userrating/olympian.gif');


/*
 * TABVIEWS
 */
insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (1, 'DOCUMENT_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (2, 'MESSENGER_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (3, 'PROFILE_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (4, 'SEARCH_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (5, 'HELP_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (6, 'BESTSELLER_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (7, 'LATESTADDITIONS_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (8, 'HISTORY_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (9, 'FAVORITES_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (10, 'NEWS_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (11, 'WORKFLOW_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (12, 'TRASH_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (13, 'ADMIN_USERMANAGEMENT_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (14, 'ADMIN_GROUPMANAGEMENT_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (15, 'ADMIN_ACTIVEUSERS_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (16, 'ADMIN_SENDEMAIL_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (17, 'ADMIN_SYSTEMPARAMETERS_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (18, 'ADMIN_SYSTEMDEFAULTS_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (19, 'ADMIN_SYSTEMMAINTENANCE_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (20, 'ADMIN_NEWSMANAGEMENT_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (21, 'ADMIN_SHOWSTATISTICS_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (22, 'ADMIN_LDAP_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (23, 'ADMIN_LICENSE_TAB', null, null, 1, 1, 0);

insert into TABVIEWS
            (TABVIEWID, UNIQUENAME, FLAG, STATUS, VIEWTYPEID, ENABLED, HIDE)
     values (24, 'LICENSE_TAB', null, null, 1, 1, 0);


/*
 * generators
 */
create generator ACLIDS_SEQ;
set generator ACLIDS_SEQ to 1;

create generator ACLTYPES_SEQ;
set generator ACLTYPES_SEQ to 8;

create generator ADDCATATTRS_SEQ;
set generator ADDCATATTRS_SEQ to 1;

create generator ADDDOCATTRS_SEQ;
set generator ADDDOCATTRS_SEQ to 1;

create generator ADDGROUPATTRS_SEQ;
set generator ADDGROUPATTRS_SEQ to 1;

create generator ADDUSERATTRS_SEQ;
set generator ADDUSERATTRS_SEQ to 1;

create generator ADDITIONALDOCUMENTFORMATS_SEQ;
set generator ADDITIONALDOCUMENTFORMATS_SEQ to 0;

create generator CATEGORIES_SEQ;
set generator CATEGORIES_SEQ to 2;

create generator CATEGORYACLS_SEQ;
set generator CATEGORYACLS_SEQ to 2;

create generator CATEGORYDOCUMENTS_SEQ;
set generator CATEGORYDOCUMENTS_SEQ to 1;

create generator CATEGORYLINKS_SEQ;
set generator CATEGORYLINKS_SEQ to 1;

create generator CATEGORYDOCUMENTLINKS_SEQ;
set generator CATEGORYDOCUMENTLINKS_SEQ to 1;

create generator CATPROJECTSTEPS_SEQ;
set generator CATPROJECTSTEPS_SEQ to 0;

create generator CONVERTERTIMING_SEQ;
set generator CONVERTERTIMING_SEQ to 2;

create generator CONVERSIONSTATI_SEQ;
set generator CONVERSIONSTATI_SEQ to 0;

create generator CONVERTER_SEQ;
set generator CONVERTER_SEQ to 0;

create generator DEFAULTCATACLS_SEQ;
set generator DEFAULTCATACLS_SEQ to 11;

create generator DEFAULTDOCACLS_SEQ;
set generator CATEGORYDOCUMENTLINKS_SEQ to 1;

create generator DOCUMENTS_SEQ;
set generator CATEGORYDOCUMENTLINKS_SEQ to 1;

create generator DOCUMENTACLS_SEQ;
set generator CATEGORYDOCUMENTLINKS_SEQ to 1;

create generator DOCUMENTCLASSES_SEQ;
set generator DOCUMENTCLASSES_SEQ to 11;

create generator DOCUMENTSTATI_SEQ;
set generator DOCUMENTSTATI_SEQ to 5;

create generator DOCUMENTTYPES_SEQ;
set generator DOCUMENTTYPES_SEQ to 23;

create generator DOCUMENTVIEWFIELDS_SEQ;
set generator DOCUMENTVIEWFIELDS_SEQ to 21;

create generator DYNATTRIBUTES_SEQ;
set generator DYNATTRIBUTES_SEQ to 1;

create generator DYNUSERATTRVALUES_SEQ;
set generator DYNUSERATTRVALUES_SEQ to 1;

create generator DYNAENTRIES_SEQ;
set generator DYNAENTRIES_SEQ to 1;

create generator GROUPS_SEQ;
set generator GROUPS_SEQ to 3;

create generator LANGUAGES_SEQ;
set generator LANGUAGES_SEQ to 3;

create generator LANGUAGEPACKS_SEQ;
set generator LANGUAGEPACKS_SEQ to 4; 

create generator LDAPGROUPS_SEQ;
set generator LDAPGROUPS_SEQ to 0;

create generator LDAPSERVERS_SEQ;
set generator LDAPSERVERS_SEQ to 0;

create generator LDAPUSERS_SEQ;
set generator LDAPUSERS_SEQ to 0;

create generator LICENSE_SEQ;
set generator LICENSE_SEQ to 1;

create generator MSGTIMEPERIODS_SEQ;
set generator MSGTIMEPERIODS_SEQ to 1;

create generator NEWS_SEQ;
set generator NEWS_SEQ to 1;

create generator NOTES_SEQ;
set generator NOTES_SEQ to 2;

create generator PERMISSIONS_SEQ; 
set generator PERMISSIONS_SEQ to 17;

create generator PROJECTMESSAGES_SEQ;
set generator PROJECTMESSAGES_SEQ to 1;

create generator PROXYUSERS_SEQ;
set generator PROXYUSERS_SEQ to 1;

create generator SEARCHQUERIES_SEQ;
set generator SEARCHQUERIES_SEQ to 0;

create generator SYSPARAMETERS_SEQ; 
set generator SYSPARAMETERS_SEQ to 1093;

create generator TEMPLATES_SEQ; 
set generator TEMPLATES_SEQ to 2;

create generator USERS_SEQ;
set generator USERS_SEQ to 2;

create generator USERDOCMAILS_SEQ; 
set generator USERDOCMAILS_SEQ to 1;

create generator USERDOCVIEWFIELDS_SEQ;
set generator USERDOCVIEWFIELDS_SEQ to 1;

create generator USERREGSEARCHQUERIES_SEQ;
set generator USERREGSEARCHQUERIES_SEQ to 0;

create generator VKC_AVAILS_SEQ;
set generator VKC_AVAILS_SEQ to 0;

create generator VKCSERVER_SEQ;
set generator VKCSERVER_SEQ to 0;

create generator USERRATINGS_SEQ;
set generator USERRATINGS_SEQ to 6;

create generator TABVIEWS_SEQ;
set generator TABVIEWS_SEQ to 25;

commit;

/*==============================================================*/
/* View: CATEGORIES_READABLE_BY_USER                            */
/*==============================================================*/
CREATE VIEW CATEGORIES_READABLE_BY_USER (
  CATEGORYID,
  USERID
) AS SELECT CATEGORIES.CATEGORYID,
            CATEGORYACLS.ACCESSORID
       FROM CATEGORIES, CATEGORYACLS
      WHERE CATEGORIES.ACLID = CATEGORYACLS.ACLID 
        AND ( CATEGORYACLS.ACLTYPEID=1 OR CATEGORYACLS.ACLTYPEID=3 ) 
        AND CATEGORYACLS.PERMISSIONID = 2;

/*==============================================================*/
/* View: CATEGORIES_WRITABLE_BY_USER                            */
/*==============================================================*/
CREATE VIEW CATEGORIES_WRITABLE_BY_USER (
  CATEGORYID,
  USERID
) AS SELECT CATEGORIES.CATEGORYID, 
            CATEGORYACLS.ACCESSORID
       FROM CATEGORIES, CATEGORYACLS
      WHERE CATEGORIES.ACLID = CATEGORYACLS.ACLID
        AND ( CATEGORYACLS.ACLTYPEID=1 OR CATEGORYACLS.ACLTYPEID=3 )
        AND CATEGORYACLS.PERMISSIONID = 3;

/*==============================================================*/
/* View: CATEGORIES_READABLE_BY_GROUP                           */
/*==============================================================*/
CREATE VIEW CATEGORIES_READABLE_BY_GROUP (
  CATEGORYID,
  GROUPID
) AS SELECT CATEGORIES.CATEGORYID,
            CATEGORYACLS.ACCESSORID
       FROM CATEGORIES, CATEGORYACLS
      WHERE CATEGORIES.ACLID = CATEGORYACLS.ACLID 
        AND CATEGORYACLS.ACLTYPEID=2 
        AND CATEGORYACLS.PERMISSIONID = 2;

/*==============================================================*/
/* View: CATEGORIES_WRITABLE_BY_GROUP                           */
/*==============================================================*/
CREATE VIEW CATEGORIES_WRITABLE_BY_GROUP (
  CATEGORYID,
  GROUPID
) AS SELECT CATEGORIES.CATEGORYID,
            CATEGORYACLS.ACCESSORID
       FROM CATEGORIES, CATEGORYACLS
      WHERE CATEGORIES.ACLID = CATEGORYACLS.ACLID 
        AND CATEGORYACLS.ACLTYPEID=2 
        AND CATEGORYACLS.PERMISSIONID = 3;

/*==============================================================*/
/* View: CATEGORIES_READABLE_BY_LGROUP                          */
/*                                                              */ 
/* LGROUP = LDAP-GROUPS                                         */ 
/*                                                              */       
/* "AND CATEGORYACLS.ACCESSORID = LDAPGROUPS.LDAPGROUPID" is    */
/*  to prevent ldapgroups (of acls) being listed which are not  */
/*  existent any longer due to fragments left by                */
/*  VKCAclSerializer.deleteObsoleteGroups                       */
/*==============================================================*/

CREATE VIEW CATEGORIES_READABLE_BY_LGROUP (
  CATEGORYID, 
  LDAPGROUPID
) AS SELECT CATEGORIES.CATEGORYID,
            CATEGORYACLS.ACCESSORID
       FROM CATEGORIES, CATEGORYACLS, LDAPGROUPS
      WHERE CATEGORIES.ACLID = CATEGORYACLS.ACLID
        AND CATEGORYACLS.ACLTYPEID = 7
        AND CATEGORYACLS.PERMISSIONID = 2
        AND CATEGORYACLS.ACCESSORID = LDAPGROUPS.LDAPGROUPID;

/*==============================================================*/
/* View: CATEGORIES_WRITABLE_BY_LGROUP                          */
/*                                                              */ 
/* LGROUP = LDAP-GROUPS                                         */ 
/*                                                              */       
/* "AND CATEGORYACLS.ACCESSORID = LDAPGROUPS.LDAPGROUPID" is    */
/*  to prevent ldapgroups (of acls) being listed which are not  */
/*  existent any longer due to fragments left by                */
/*  VKCAclSerializer.deleteObsoleteGroups                       */
/*==============================================================*/  

CREATE VIEW CATEGORIES_WRITEABLE_BY_LGROUP (
  CATEGORYID, 
  LDAPGROUPID
) AS SELECT CATEGORIES.CATEGORYID,
            CATEGORYACLS.ACCESSORID
       FROM CATEGORIES, CATEGORYACLS, LDAPGROUPS
      WHERE CATEGORIES.ACLID = CATEGORYACLS.ACLID
        AND CATEGORYACLS.ACLTYPEID = 7
        AND CATEGORYACLS.PERMISSIONID = 3
        AND CATEGORYACLS.ACCESSORID = LDAPGROUPS.LDAPGROUPID;

/*==============================================================*/
/* Table: DYNUSERATTRVALUES                                     */
/*==============================================================*/
CREATE TABLE DYNUSERATTRVALUES (
USERID				INTEGER NOT NULL,
USERATTRID			INTEGER NOT NULL,
NAME				VARCHAR(255) NOT NULL,	
VALUESTRING			VARCHAR(4000),
AUTORIZATION 		INTEGER,
  
CONSTRAINT PK_DYNUSERATTRVALUES PRIMARY KEY (USERID, USERATTRID),
CONSTRAINT FK_DYNUSERATTRVALUES FOREIGN KEY (USERID) REFERENCES USERS (USERID) ON DELETE CASCADE
);

create unique asc index INDEX_21 on DYNUSERATTRVALUES (
USERID,
USERATTRID
);

commit;
