CREATE TABLE "DOCS"
( "DOC_ID" NUMBER(4,0),
"DOC_DESC" VARCHAR2(50),
"DOC_TYPE" CHAR(1),
"DOC_INACTIVE" CHAR(1),
"DOC_TXT1" VARCHAR2(50),
"DOC_NUM1" NUMBER(3,0),
CONSTRAINT "DOCS_PK" PRIMARY KEY ("DOC_ID") ENABLE
)
/
CREATE TABLE "USERS_MST"
( "USER_ID" NUMBER(4,0),
"USER_DESC" VARCHAR2(20),
"USER_NAME" VARCHAR2(50),
"USER_PWD" VARCHAR2(20),
"USER_CLASS" NUMBER(2,0),
"USER_NOTE" VARCHAR2(200),
"USER_INACTIVE" CHAR(1),
"USER_TXT1" VARCHAR2(50),
"USER_NUM1" NUMBER(3,0),
"USER_DIVISION" CHAR(1),
CONSTRAINT "USERS_MST_PK" PRIMARY KEY ("USER_ID") ENABLE,
CONSTRAINT "USER_DESC_UQ" UNIQUE ("USER_DESC") ENABLE
)
/
CREATE TABLE "USERS_DTL"
( "USER_ID" NUMBER(4,0),
"USER_CLS" CHAR(5),
"USER_ROLE" NUMBER(4,0),
"USER_TXT1" VARCHAR2(50),
"USER_NUM1" NUMBER(3,0),
CONSTRAINT "USERS_DTL_PK" PRIMARY KEY ("USER_ID", "USER_CLS") ENABLE,
CONSTRAINT "USERS_DTL_MST_FK" FOREIGN KEY ("USER_ID")
REFERENCES "USERS_MST" ("USER_ID") ENABLE,
CONSTRAINT "USERS_DTL_ROLE_ID_FK" FOREIGN KEY ("USER_ROLE")
REFERENCES "ROLES_MST" ("ROLE_ID") ENABLE
)
/
CREATE TABLE "ROLES_MST"
( "ROLE_ID" NUMBER(4,0),
"ROLE_DESC" VARCHAR2(50),
"ROLE_DETAILS" VARCHAR2(200),
"ROLE_INACTIVE" CHAR(1),
"ROLE_TXT1" VARCHAR2(50),
"ROLE_NUM1" NUMBER(3,0),
CONSTRAINT "ROLE_MST_PK" PRIMARY KEY ("ROLE_ID") ENABLE,
CONSTRAINT "ROLE_DESC_UQ" UNIQUE ("ROLE_DESC") ENABLE
)
/
CREATE TABLE "ROLES_DTL"
( "ROLE_ID" NUMBER(4,0),
"DOC_ID" NUMBER(4,0),
"DOC_QUERY" CHAR(1),
"DOC_INSERT" CHAR(1),
"DOC_UPDATE" CHAR(1),
"DOC_DELETE" CHAR(1),
"DOC_RUN" CHAR(1),
"DOC_TXT1" VARCHAR2(50),
"DOC_NUM1" NUMBER(3,0),
CONSTRAINT "ROLES_DTL_PK" PRIMARY KEY ("ROLE_ID", "DOC_ID") ENABLE,
CONSTRAINT "ROLE_DTL_MST_FK" FOREIGN KEY ("ROLE_ID")
REFERENCES "ROLES_MST" ("ROLE_ID") ENABLE,
CONSTRAINT "ROLES_DTL_DOC_ID_FK" FOREIGN KEY ("DOC_ID")
REFERENCES "DOCS" ("DOC_ID") ENABLE
)
/
----------------------------
----------------------------
CREATE TABLE MENU_tree
(
ID NUMBER(5),
LABEL VARCHAR2(128 BYTE),
ICON VARCHAR2(40 BYTE),
MASTER NUMBER(5),
STATUS NUMBER(1) DEFAULT 1,
VALUE VARCHAR2(128 BYTE)
)
Here the data in the table :
INSERT INTO MENU_tree ( ID, LABEL, ICON, MASTER, STATUS, VALUE ) VALUES (1, 'Menu1', 'mainmenu', NULL, 1, NULL);
INSERT INTO MENU_tree ( ID, LABEL, ICON, MASTER, STATUS, VALUE ) VALUES (
2, 'Menu1 Option 1', 'optionmenu', 1, 1, 'Dialog11');
INSERT INTO MENU_tree ( ID, LABEL, ICON, MASTER, STATUS, VALUE ) VALUES ( 3, 'Menu1 Option 2', 'optionmenu', 1, 1, dialog12');
INSERT INTO MENU_tree ( ID, LABEL, ICON, MASTER, STATUS, VALUE ) VALUES (4, 'Menu1 Option 3', 'optionmenu', 1, 1, NULL);
INSERT INTO MENU_tree ( ID, LABEL, ICON, MASTER, STATUS, VALUE ) VALUES ( 5, 'Menu1 Opt 3 Sub Opt 3', 'suboptionmenu', 4, 1, 'Dialog131');
INSERT INTO MENU_tree ( ID, LABEL, ICON, MASTER, STATUS, VALUE ) VALUES ( 6, 'Menu2', 'mainmenu', NULL, -1, NULL);
INSERT INTO MENU_tree ( ID, LABEL, ICON, MASTER, STATUS, VALUE ) VALUES ( 7, 'Menu2 Option1', 'optionmenu', 6, 1,'Dialog21');
The record_group use this instruction SELECT :
SELECT STATUS, LEVEL, LABEL, ICON, VALUE
FROM MENU_tree
CONNECT BY PRIOR ID = MASTER
START WITH MASTER IS NULL
And At the trigger When_new_form_instance , i do this code :
PROCEDURE Init_tree IS
HTREE ITEM;
V_IGNORE NUMBER;
BEGIN
HTREE := FIND_ITEM('BLOC2.MENU');
V_IGNORE := POPULATE_GROUP('RG_DATA_TEST');
FTREE.SET_TREE_PROPERTY(HTREE, FTREE.RECORD_GROUP,'RG_DATA_TEST');
END;
create users first then assign task of menu to users.