/*==============================================================*/
/* DBMS name:      ORACLE Version 10g                           */
/* Created on:     2006-9-1 13:35:46                            */
/*==============================================================*/


drop table ACLENTRIES_2 cascade constraints;

drop table ACLS_2 cascade constraints;

drop table ACLS_WITH_RESOURCE_1 cascade constraints;

drop table ALIASES_1 cascade constraints;

drop table CATALOGVERSION_2 cascade constraints;

drop table COMPLETEDPUBLISHTABLE_2 cascade constraints;

drop table COMPLETEDRESULTTABLE_3 cascade constraints;

drop table COMPLETEDTABLE_4 cascade constraints;

drop table DRESULT_2 cascade constraints;

drop table DYNAMICRESULT_1 cascade constraints;

drop table EXTENDACLENTRIES_2 cascade constraints;

drop table FOLDERS_3 cascade constraints;

drop table GROUPPROFILES_1 cascade constraints;

drop table GROUPS_1 cascade constraints;

drop table GUPROFILES_1 cascade constraints;

drop table NODES_3 cascade constraints;

drop table REPORTVERSION_2 cascade constraints;

drop table RESOURCEMAP_1 cascade constraints;

drop table RESOURCENODES_3 cascade constraints;

drop table RESULTVERSION_2 cascade constraints;

drop table RESULT_2 cascade constraints;

drop table RGPROFILES_1 cascade constraints;

drop table ROLEPROFILES_2 cascade constraints;

drop table ROLES_2 cascade constraints;

drop table SCHDLASTEXETIME_1 cascade constraints;

drop table TBL_IDGENRATOR_JINFONET cascade constraints;

drop table TRIGGERS_1 cascade constraints;

drop table UPDATEDETAILS_1 cascade constraints;

drop table USERPROFILES_2 cascade constraints;

drop table USERS_3 cascade constraints;

drop table VERSIONNODES_2 cascade constraints;

drop table TASKCONTEXT cascade constraints;

drop table DYNAMICNODE_2 cascade constraints;

/*==============================================================*/
/* Table: ACLENTRIES_2                                          */
/*==============================================================*/
create table ACLENTRIES_2  (
   ENTRY_ID             NUMBER(10)                      not null,
   ACL_ID               NUMBER(10)                      not null,
   PRINCIPAL_TYPE       NUMBER(3)                       not null,
   PRINCIPAL_NAME       VARCHAR2(64)                    not null,
   IS_POSITIVE          NUMBER(3)                       not null,
   PERMISSIONS          NUMBER(10)                      not null,
   constraint PK_ACLENTRIES_2 primary key (ENTRY_ID)
);

/*==============================================================*/
/* Table: ACLS_2                                                */
/*==============================================================*/
create table ACLS_2  (
   ID                   NUMBER(10)                      not null,
   NAME                 VARCHAR2(64)                    not null,
   CREATE_NAME          VARCHAR2(32)                    not null,
   CREATE_TIME          NUMBER(19),
   constraint PK_ACLS_2 primary key (ID)
);

/*==============================================================*/
/* Table: ACLS_WITH_RESOURCE_1                                  */
/*==============================================================*/
create table ACLS_WITH_RESOURCE_1  (
   ID                   NUMBER(10)                      not null,
   RESOURCE_PATH        VARCHAR2(256)                   not null,
   VERSION_NUMBER       NUMBER(10)                      not null,
   ACL_NAME             VARCHAR2(64)                    not null,
   CREATE_NAME          VARCHAR2(32)                    not null,
   CREATE_TIME          NUMBER(19),
   constraint PK_ACLS_WITH_RESOURCE_1 primary key (ID)
);

/*==============================================================*/
/* Table: ALIASES_1                                             */
/*==============================================================*/
create table ALIASES_1  (
   ID                   NUMBER(10)                      not null,
   PRINCIPAL_NAME       VARCHAR2(128)                   not null,
   PRINCIPAL_TYPE       NUMBER(3)                       not null,
   ALIAS_NAME           VARCHAR2(256)                   not null,
   PARENT_NAME          VARCHAR2(256),
   MAP_RESOURCE         VARCHAR2(256)                   not null,
   HIDDEN               NUMBER(3)                       not null,
   constraint AK_KEY_1_ALIASES_ unique (ID)
);

/*==============================================================*/
/* Table: CATALOGVERSION_2                                      */
/*==============================================================*/
create table CATALOGVERSION_2  (
   VERSIONNUMBER        NUMBER(10)                      not null,
   VERSIONNAME          VARCHAR2(128),
   RESOURCEID           NUMBER(10)                      not null,
   CREATOR              VARCHAR2(128),
   CREATEDTIME          NUMBER(19)                      not null,
   MODIFIER             VARCHAR2(128),
   MODIFIEDTIME         NUMBER(19)                      not null,
   CATALOGFILE          VARCHAR2(128)                   not null,
   ID                   NUMBER(19)                      not null,
   constraint AK_KEY_1_CATALOGV unique (ID)
);

/*==============================================================*/
/* Table: COMPLETEDPUBLISHTABLE_2                               */
/*==============================================================*/
create table COMPLETEDPUBLISHTABLE_2  (
   ID                   NUMBER(10)                      not null,
   RECORDID             VARCHAR2(40)                    not null,
   SHEETNAME            VARCHAR2(256)                   not null,
   DISPLAYNAME          VARCHAR2(256),
   PUB_TYPE             VARCHAR2(64)                    not null
);

/*==============================================================*/
/* Table: COMPLETEDRESULTTABLE_3                                */
/*==============================================================*/
create table COMPLETEDRESULTTABLE_3  (
   PUBLISHID            NUMBER(10)                      not null,
   RECORDID             VARCHAR2(40)                    not null,
   PUB_TYPE             VARCHAR2(128)                    not null,
   STATUS               NUMBER(10)                      not null,
   DETAIL               VARCHAR2(256)                   not null
);

/*==============================================================*/
/* Table: COMPLETEDTABLE_4                                      */
/*==============================================================*/
create table COMPLETEDTABLE_4  (
   ID                   NUMBER(10)                      not null,
   RECORDID             VARCHAR2(128),
   TASKID               VARCHAR2(128)                   not null,
   TASKCLASS            VARCHAR2(256)                   not null,
   CATFILE              VARCHAR2(256),
   RPTFILE              VARCHAR2(256),
   PARAMFILE            VARCHAR2(256),
   RESULTFILE           VARCHAR2(512),
   ERROR                VARCHAR2(256),
   ENGMSG               VARCHAR2(512),
   SUBMITTER            VARCHAR2(128),
   COMPLETEDTIME        NUMBER(19),
   FORMATEXISTS         NUMBER(10),
   FORMATSUCCESSFUL     NUMBER(10),
   VERSIONID            NUMBER(10),
   LAUNCHTYPE           NUMBER(10),
   ISSUCCESSFUL         NUMBER(3)                       not null,
   TASKNAME             VARCHAR2(128),
   ISMISSED             NUMBER(3)                       not null,
   SCHEDULETRIGGER      VARCHAR2(80),
   CONDITIONSLOGIC      VARCHAR2(16),
   REPORTNAMES          VARCHAR2(512)
);

/*==============================================================*/
/* Table: DRESULT_2                                             */
/*==============================================================*/
create table DRESULT_2  (
   REPORTSET            VARCHAR2(128),
   VERSIONNUMBER        NUMBER(19)                      not null,
   REPORT               VARCHAR2(128)                   not null,
   REPORTDISPLAYNAME    VARCHAR2(128),
   RESULT               VARCHAR2(128)                   not null,
   VIEWEDFORMATS        NUMBER(19),
   PLSRESULTFMTS        NUMBER(19),
   SECCONSTRAINTFMTS    NUMBER(19)
);

/*==============================================================*/
/* Table: DYNAMICNODE_2                                         */
/*==============================================================*/
create table DYNAMICNODE_2  (
   NAME                 VARCHAR2(128)                   not null,
   ROOT                 VARCHAR2(128)                   not null,
   REALPATH             VARCHAR2(256)                   not null,
   NODETYPE             NUMBER(3)                       not null,
   ENABLEARCHIVEPOLICY  NUMBER(3)                       not null,
   DELETED              NUMBER(3)                       not null,
   ACLID                NUMBER(10),
   DESCRIPTION          VARCHAR2(256),
   MAXVERSIONAMOUNT     NUMBER(10),
   ENABLELINKEDCAT      NUMBER(3),
   LINKEDCAT            VARCHAR2(256), 
   USEINHERITED       NUMBER(3)
);

/*==============================================================*/
/* Table: DYNAMICRESULT_1                                       */
/*==============================================================*/
create table DYNAMICRESULT_1  (
   ID                   NUMBER(10)                      not null,
   REPORTNAME           VARCHAR2(128)                   not null,
   VERSIONNUMBER        NUMBER(10)                      not null,
   CREATOR              VARCHAR2(128)                   not null,
   CREATEDTIME          NUMBER(19)                      not null,
   CATALOGVERNUM        NUMBER(10)                      not null,
   CATALOGRESNUM        NUMBER(10)                      not null,
   REPORTVERNUM         NUMBER(10)                      not null,
   REPORTRESNUM         NUMBER(10)                      not null,
   PARAMFILE            VARCHAR2(128),
   RESULTFILE           VARCHAR2(128)                   not null,
   RESULTFMTS           NUMBER(19)                      not null,
   LAUNCHTYPE           NUMBER(10)                      not null,
   TASKID               VARCHAR2(128),
   EXPIRATIONTIME       NUMBER(19)                      not null,
   EXPIRE               NUMBER(3)                       not null,
   EXPIRATIONMETHOD     NUMBER(10),
   REPORTAMOUNT         NUMBER(10)
);

/*==============================================================*/
/* Table: EXTENDACLENTRIES_2                                    */
/*==============================================================*/
create table EXTENDACLENTRIES_2  (
   PRINCIPAL_NAME       VARCHAR2(64)                    not null,
   PRINCIPAL_TYPE       NUMBER(3)                       not null,
   PERMISSIONS          NUMBER(10)                      not null,
   constraint AK_KEY_1_EXTENDAC unique (PRINCIPAL_NAME, PRINCIPAL_TYPE)
);

/*==============================================================*/
/* Table: FOLDERS_3                                             */
/*==============================================================*/
create table FOLDERS_3  (
   ID                   NUMBER(10)                      not null,
   REALPATH             VARCHAR2(256),
   OWNERNAME            VARCHAR2(32),
   MAXVERSIONAMOUNT     NUMBER(10)                      not null,
   ARCHIVENEWVERSION    NUMBER(3)                       not null,
   ENABLEARCHIVEPOLICY  NUMBER(3)                       not null,
   IS_SHARED            NUMBER(3)                       not null,
   ENABLEDYNAMICRESOURCE NUMBER(3)                       not null
);

/*==============================================================*/
/* Table: GROUPPROFILES_1                                       */
/*==============================================================*/
create table GROUPPROFILES_1  (
   GROUP_NAME           VARCHAR2(32),
   SUB_GROUP_NAME       VARCHAR2(32)
);

/*==============================================================*/
/* Table: GROUPS_1                                              */
/*==============================================================*/
create table GROUPS_1  (
   NAME                 VARCHAR2(32)                    not null,
   BUILDIN              NUMBER(3)                       not null,
   DESCRIPTION          VARCHAR2(32),
   GROUP_TYPE           NUMBER(10)                      not null,
   constraint PK_GROUPS_1 primary key (NAME)
);

/*==============================================================*/
/* Table: GUPROFILES_1                                          */
/*==============================================================*/
create table GUPROFILES_1  (
   GROUP_NAME           VARCHAR2(32),
   USER_NAME            VARCHAR2(32)
);

/*==============================================================*/
/* Table: NODES_3                                               */
/*==============================================================*/
create table NODES_3  (
   ID                   NUMBER(10)                      not null,
   NAME                 VARCHAR2(64)                    not null,
   CREATORNAME          VARCHAR2(32)                    not null,
   CREATETIME           NUMBER(19)                      not null,
   PARENTID             NUMBER(10)                      not null,
   NODETYPE             NUMBER(3)                       not null,
   ACLID                NUMBER(10),
   DESCRIPTION          VARCHAR2(256), 
   ENABLELINKEDCAT      NUMBER(3), 
   LINKEDCAT            VARCHAR2(256), 
   USEINHERITED       NUMBER(3)
);

/*==============================================================*/
/* Table: REPORTVERSION_2                                       */
/*==============================================================*/
create table REPORTVERSION_2  (
   VERSIONNUMBER        NUMBER(10)                      not null,
   VERSIONNAME          VARCHAR2(128),
   RESOURCEID           NUMBER(10)                      not null,
   CREATOR              VARCHAR2(128),
   CREATETIME           NUMBER(19)                      not null,
   MODIFIER             VARCHAR2(128),
   MODIFIEDTIME         NUMBER(19)                      not null,
   REPORTFILE           VARCHAR2(128)                   not null,
   ID                   NUMBER(19)                      not null,
   constraint AK_KEY_1_REPORTVE unique (RESOURCEID, ID)
);

/*==============================================================*/
/* Table: RESOURCEMAP_1                                         */
/*==============================================================*/
create table RESOURCEMAP_1  (
   RESOURCEID           NUMBER(10)                      not null,
   RESOURCENAME         VARCHAR2(128)                   not null,
   RESOURCETYPE         NUMBER(3)                       not null
);

/*==============================================================*/
/* Table: RESOURCENODES_3                                       */
/*==============================================================*/
create table RESOURCENODES_2  (
   ID                   NUMBER(10)                      not null,
   RESOURCETYPE         NUMBER(3)                       not null,
   REALPATH             VARCHAR2(256),
   MAXVERSIONAMOUNT     NUMBER(10)                      not null,
   ARCHIVENEWVERSION    NUMBER(3)                       not null,
   ENABLEARCHIVEPOLICY  NUMBER(3)                       not null,
   PROFILENAME             VARCHAR2(256)
);

/*==============================================================*/
/* Table: RESULTVERSION_2                                       */
/*==============================================================*/
create table RESULTVERSION_2  (
   ID                   NUMBER(19)                      not null,
   VERSIONNUMBER        NUMBER(10)                      not null,
   VERSIONNAME          VARCHAR2(128)                   not null,
   RESOURCEID           NUMBER(10)                      not null,
   CREATOR              VARCHAR2(128),
   CREATEDTIME          NUMBER(19)                      not null,
   MODIFIER             VARCHAR2(128),
   MODIFIEDTIME         NUMBER(19)                      not null,
   CATALOGVERNUM        NUMBER(10)                      not null,
   CATALOGRESNUM        NUMBER(10)                      not null,
   REPORTVERNUM         NUMBER(10)                      not null,
   REPORTRESNUM         NUMBER(10)                      not null,
   PARAMFILE            VARCHAR2(128),
   RESULTFILE           VARCHAR2(128)                   not null,
   RESULTFMTS           NUMBER(19)                      not null,
   LAUNCHTYPE           NUMBER(10)                      not null,
   TASKID               VARCHAR2(128),
   EXPIRATIONTIME       NUMBER(19)                      not null,
   EXPIRE               NUMBER(3)                       not null,
   EXPIREATIONMETHOD    NUMBER(10),
   SPECIFIEDFOLDER      VARCHAR2(128),
   REPORTAMOUNT         NUMBER(10),
   constraint AK_KEY_1_RESULTVE unique (ID, RESOURCEID)
);

/*==============================================================*/
/* Table: RESULT_2                                              */
/*==============================================================*/
create table RESULT_2  (
   RESOURCEID           NUMBER(19)                      not null,
   VERSIONNUMBER        NUMBER(19)                      not null,
   REPORT               VARCHAR2(128)                   not null,
   REPORTDISPLAYNAME    VARCHAR2(128),
   RESULT               VARCHAR2(128)                   not null,
   VIEWEDFORMATS        NUMBER(19),
   PLSRESULTFMTS        NUMBER(19),
   SECCONSTRAINTFMTS    NUMBER(19)
);

/*==============================================================*/
/* Table: RGPROFILES_1                                          */
/*==============================================================*/
create table RGPROFILES_1  (
   ROLE_NAME            VARCHAR2(32),
   GROUP_NAME           VARCHAR2(32)
);

/*==============================================================*/
/* Table: ROLEPROFILES_2                                        */
/*==============================================================*/
create table ROLEPROFILES_2  (
   ROLE_NAME            VARCHAR2(32),
   SUB_ROLE_NAME        VARCHAR2(32)
);

/*==============================================================*/
/* Table: ROLES_2                                               */
/*==============================================================*/
create table ROLES_2  (
   NAME                 VARCHAR2(32)                    not null,
   BUILDIN              NUMBER(3)                       not null,
   DESCRIPTION          VARCHAR2(32),
   ROLE_TYPE            NUMBER(10)                      not null,
   constraint PK_ROLES_2 primary key (NAME)
);

/*==============================================================*/
/* Table: SCHDLASTEXETIME_1                                     */
/*==============================================================*/
create table SCHDLASTEXETIME_1  (
   TASKID               VARCHAR2(40)                    not null,
   LASTEXETIME          NUMBER(19)                      not null
);

/*==============================================================*/
/* Table: TBL_IDGENRATOR_JINFONET                               */
/*==============================================================*/
create table TBL_IDGENRATOR_JINFONET  (
   TF_NAME              VARCHAR2(64)                    not null,
   NEXT_ID              NUMBER(10)                      not null,
   constraint PK_TBL_IDGENRATOR_JINFONET primary key (TF_NAME)
);

/*==============================================================*/
/* Table: TRIGGERS_1                                            */
/*==============================================================*/
create table TRIGGERS_1  (
   TRIGGER_NAME         VARCHAR2(80)                    not null,
   DESCRIPTION          VARCHAR2(255),
   TRIGGER_TYPE         NUMBER(3)                       not null,
   TRIGGER_STATE        NUMBER(3)                       not null,
   PREV_FIRE_TIME       NUMBER(19),
   NEXT_FIRE_TIME       NUMBER(19),
   constraint PK_TRIGGERS_1 primary key (TRIGGER_NAME)
);

/*==============================================================*/
/* Table: UPDATEDETAILS_1                                       */
/*==============================================================*/
create table UPDATEDETAILS_1  (
   UPDATE_ITEM          VARCHAR2(32)                    not null,
   UPDATE_STATE         NUMBER(3)                       not null,
   constraint PK_UPDATEDETAILS_1 primary key (UPDATE_ITEM)
);

/*==============================================================*/
/* Table: USERPROFILES_2                                        */
/*==============================================================*/
create table USERPROFILES_2  (
   USER_NAME            VARCHAR2(32),
   ROLE_NAME            VARCHAR2(32)
);

/*==============================================================*/
/* Table: USERS_3                                               */
/*==============================================================*/
create table USERS_3  (
   NAME                 VARCHAR2(32)                    not null,
   FULL_NAME            VARCHAR2(128),
   DESCRIPTION          VARCHAR2(128),
   EMAIL                VARCHAR2(128),
   CREATE_TIME          NUMBER(19)                      not null,
   USER_PSWD            VARCHAR2(128),
   BUILDIN              NUMBER(3)                       not null,
   ENABLE               NUMBER(3)                       not null,
   MIN_PS_LENGTH        NUMBER(10),
   LAST_MODIFY_TIME     NUMBER(19),
   NEVER_EXPIRE         NUMBER(3)                       not null,
   EXPIRE_TIME          NUMBER(10),
   ACCOUNT_DISABLE      NUMBER(3)                       not null,
   ACCESS_EVENT_SUC     NUMBER(3)                       not null,
   ACCESS_EVENT_FAIL    NUMBER(3)                       not null,
   MANAGEMENT_EVENT_SUC NUMBER(3)                       not null,
   MANAGEMENT_EVENT_FAIL NUMBER(3)                       not null,
   NO_AUDIT             NUMBER(3)                       not null,
   AUTH_TYPE            NUMBER(10)                      not null,
   LDAP_TYPE            NUMBER(10),
   constraint PK_USERS_3 primary key (NAME)
);

/*==============================================================*/
/* Table: VERSIONNODES_2                                        */
/*==============================================================*/
create table VERSIONNODES_2  (
   ID                   NUMBER(10)                      not null,
   RESOURCEID           NUMBER(10)                      not null,
   VERSIONNUMBER        NUMBER(10)                      not null,
   EXPIRATIONTIME       NUMBER(19)                      not null
);


/*==============================================================*/
/* Table: TASKCONTEXT                                           */
/* FOR PROFILING                                                */
/*==============================================================*/
CREATE TABLE TASKCONTEXT (
	ID 						NUMBER(10) NOT NULL,
	VS_RPT_NAME 			VARCHAR2(255),
	VI_TSK_TYPE			 	NUMBER(10),
	VI_TSK_STATUS 			NUMBER(10),
	TS_TSK_SUBMIT 			DATE,
	TS_ENG_START 			DATE,
	TS_ENG_EXITS 			DATE,
	TS_TSK_COMPLETE 		DATE,
	TC_TSK_TOTAL 			NUMBER(19),
	TC_TSK_WAITED 			NUMBER(19),
	TC_ENG_TOTAL 			NUMBER(19),
	TC_ENG_LOAD 			NUMBER(19),
	TC_ENG_EXPORT 			NUMBER(19),
	TC_ENG_OTHER 			NUMBER(19),
	TC_TSK_OTHER 			NUMBER(19),
	NC_RPT_PAGES 			NUMBER(19),
	NC_RPT_FORMATS 			NUMBER(19),
	NC_ENG_CONCURRENT 		NUMBER(19),
	NC_QUE_LENGTH 			NUMBER(19), 
	PRIMARY KEY(ID)
);



/*==============================================================*/
/* INIT DATA  			                                        */
/*==============================================================*/
INSERT INTO TBL_IDGENRATOR_JINFONET (TF_NAME,NEXT_ID) VALUES ('NODES_3_ID',0);
INSERT INTO TBL_IDGENRATOR_JINFONET (TF_NAME,NEXT_ID) VALUES ('CATALOGVERSION_2_ID',0);
INSERT INTO TBL_IDGENRATOR_JINFONET (TF_NAME,NEXT_ID) VALUES ('REPORTVERSION_2_ID',0);
INSERT INTO TBL_IDGENRATOR_JINFONET (TF_NAME,NEXT_ID) VALUES ('RESULTVERSION_2_ID',0);
INSERT INTO TBL_IDGENRATOR_JINFONET (TF_NAME,NEXT_ID) VALUES ('ACLS_2_ID',0);
INSERT INTO TBL_IDGENRATOR_JINFONET (TF_NAME,NEXT_ID) VALUES ('ACLENTRIES_2_ENTRY_ID',0);
INSERT INTO TBL_IDGENRATOR_JINFONET (TF_NAME,NEXT_ID) VALUES ('COMPLETEDTABLE_4_ID',0);
INSERT INTO TBL_IDGENRATOR_JINFONET (TF_NAME,NEXT_ID) VALUES ('ACLS_WITH_RESOURCE_1_ID',0);

