home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a522 / 13.ddi / CONVMENU.SQL next >
Encoding:
Text File  |  1991-02-04  |  11.2 KB  |  342 lines

  1. Rem Copyright (c) 1989 by Oracle Corporation
  2. Rem NAME
  3. Rem    CONVMENU.SQL - convert 4.1 applications into 5.0 tables
  4. Rem  FUNCTION
  5. Rem  NOTES
  6. Rem  MODIFIED
  7. Rem   Giljum     05/29/90 - New table -- Menu_b_appl_grp
  8. Rem   Giljum     05/15/90 - Bug39811 - remove set scan off call
  9. Rem   Giljum     09/01/89 - Creation
  10. Rem   Giljum     05/10/89 - Remove sequences
  11. Rem   Giljum     03/28/89 - Creation
  12. Rem
  13.  
  14. Set termout off
  15. Set verify off
  16. Set heading off
  17. Set echo off
  18. Spool convmenu.lis
  19.  
  20. connect system/manager;
  21. Create sequence menu_sequence;
  22.  
  23.  
  24.  
  25. REM
  26. REM SQL*Menu conversion from V4 to V5
  27. REM
  28. REM
  29. REM         APPLICATION INFORMATION
  30. REM
  31.  
  32. INSERT INTO MENU_B_APPL
  33.           SELECT UPPER(APPLICATION_NAME), UPPER(APPLICATION_NAME),
  34.                  UPPER(APPLICATION_NAME), CREATION_DATE, CREATOR,
  35.                  VERSION_RELEASE_NR, LAST_RELEASE_DATE, MENU_DIRECTORY,
  36.                  IDENTIFICATION
  37.           FROM   MENU_APPLICATION
  38.           WHERE  APPLICATION_NAME LIKE UPPER('&1');
  39.  
  40.  
  41.  
  42. REM
  43. REM          APPLICATION GROUP INFORMATION
  44. REM
  45.  
  46. INSERT INTO MENU_B_APPL_GRP
  47.           SELECT UPPER(MENU_WORK_CLASS.APPLICATION_NAME),
  48.                  UPPER(MENU_WORK_CLASS.APPLICATION_NAME) || '_' ||
  49.                  MENU_WORK_CLASS.WORK_CLASS
  50.           FROM   MENU_WORK_CLASS
  51.           WHERE  APPLICATION_NAME LIKE UPPER('&1');
  52.  
  53.  
  54.  
  55. REM
  56. REM          MENU INFORMATION
  57. REM
  58.  
  59. INSERT INTO MENU_B_INFO
  60.           SELECT UPPER(MENU_NAME), UPPER(APPLICATION_NAME),
  61.                  TITLE, SUB_TITLE, BOTTOM_TITLE,
  62.                  MENU_SEQUENCE.NEXTVAL
  63.           FROM   MENU_INFO
  64.           WHERE  APPLICATION_NAME LIKE UPPER('&1');
  65.  
  66.  
  67.  
  68. REM
  69. REM          MENU OPTION INFORMATION
  70. REM
  71.  
  72. INSERT INTO MENU_B_OPTION
  73.           SELECT UPPER(MENU_NAME), UPPER(APPLICATION_NAME), OPTION_NUMBER,
  74.                  UPPER(MENU_NAME) || '_' || OPTION_NUMBER, 'N', OPTION_TEXT,
  75.                  MENU_SEQUENCE.NEXTVAL, COMMAND_TYPE, COMMAND_LINE
  76.           FROM   MENU_OPTION
  77.           WHERE  APPLICATION_NAME LIKE UPPER('&1');
  78.  
  79.  
  80.  
  81. REM
  82. REM          PARAMETER INFORMATION
  83. REM
  84.  
  85. INSERT INTO MENU_B_PARAM
  86.           SELECT SUBSTITUTION_STRING, UPPER(APPLICATION_NAME), PAR_SIZE,
  87.                  PAR_DEF, ECHO, MUST_FILL, RESPONSE_REQUIRED, UPPER_CASE,
  88.                  MENU_SEQUENCE.NEXTVAL, PROMPT
  89.           FROM   MENU_PARAM
  90.           WHERE  APPLICATION_NAME LIKE UPPER('&1');
  91.  
  92.  
  93.  
  94. REM
  95. REM          PARAMETER MENU CROSS REFERENCE
  96. REM
  97.  
  98. INSERT INTO MENU_B_PARM_XREF
  99.           SELECT UPPER(MENU_NAME), UPPER(APPLICATION_NAME),
  100.                  SUBSTITUTION_STRING
  101.           FROM   MENU_PARAM_XREF
  102.           WHERE  APPLICATION_NAME LIKE UPPER('&1');
  103.  
  104.  
  105.  
  106. REM
  107. REM          GROUP INFORMATION
  108. REM
  109.  
  110. INSERT INTO MENU_B_GROUP
  111.           SELECT UPPER(MENU_WORK_CLASS.APPLICATION_NAME) || '_' ||
  112.                  MENU_WORK_CLASS.WORK_CLASS,
  113.                  'Y','Y','Y',
  114.                  MENU_SEQUENCE.NEXTVAL
  115.           FROM   MENU_WORK_CLASS
  116.           WHERE  APPLICATION_NAME LIKE UPPER('&1');
  117.  
  118.  
  119.  
  120. UPDATE MENU_B_GROUP
  121.           SET    DEBUG_ALLOWED = 'N'
  122.           WHERE  GROUP_NAME IN
  123.                    (SELECT GROUP_NAME
  124.                     FROM   MENU_B_GROUP, MENU_USER
  125.                     WHERE  GROUP_NAME =
  126.                            UPPER(APPLICATION_NAME) || '_' || WORK_CLASS
  127.                     AND    UPPER(APPLICATION_NAME) LIKE UPPER('&1')
  128.                     AND    MENU_USER.DEBUG_ALLOWED = 'N');
  129.  
  130.  
  131.  
  132. UPDATE MENU_B_GROUP
  133.           SET    OS_COMM_ALLOWED = 'N'
  134.           WHERE  GROUP_NAME IN
  135.                    (SELECT GROUP_NAME
  136.                     FROM   MENU_B_GROUP, MENU_USER
  137.                     WHERE  GROUP_NAME =
  138.                            UPPER(APPLICATION_NAME) || '_' || WORK_CLASS
  139.                     AND    UPPER(APPLICATION_NAME) LIKE UPPER('&1')
  140.                     AND    MENU_USER.OS_COMM_ALLOWED = 'N');
  141.  
  142.  
  143.  
  144. UPDATE MENU_B_GROUP
  145.           SET    BGM_ALLOWED = 'N'
  146.           WHERE  GROUP_NAME IN
  147.                    (SELECT GROUP_NAME
  148.                     FROM   MENU_B_GROUP, MENU_USER
  149.                     WHERE  GROUP_NAME =
  150.                            UPPER(APPLICATION_NAME) || '_' || WORK_CLASS
  151.                     AND    UPPER(APPLICATION_NAME) LIKE UPPER('&1')
  152.                     AND    MENU_USER.BGM_ALLOWED = 'N');
  153.  
  154.  
  155.  
  156.  
  157.  
  158. REM
  159. REM          PRIVILEGES FOR EACH OPTION IN A MENU
  160. REM
  161.  
  162. INSERT INTO MENU_B_PRIV
  163.           SELECT MENU_SEQUENCE.NEXTVAL, 'MNU', UPPER(APPLICATION_NAME),
  164.                  UPPER(MENU_NAME), OPTION_NUMBER
  165.           FROM   MENU_OPTION
  166.           WHERE  APPLICATION_NAME LIKE UPPER('&1');
  167.  
  168.  
  169.  
  170.  
  171. REM
  172. REM          GROUP PRIVILEGES
  173. REM
  174.  
  175. INSERT INTO MENU_B_GRP_PRIV
  176.           SELECT UPPER(W4.APPLICATION_NAME),
  177.                  UPPER(W4.APPLICATION_NAME) || '_' || WORK_CLASS,
  178.                  PRIVILEGE_ID
  179.           FROM   MENU_B_PRIV V5, MENU_OPTION O4, MENU_WORK_CLASS W4
  180.           WHERE  UPPER(O4.APPLICATION_NAME) LIKE UPPER('&1')
  181.           AND    UPPER(V5.APPLICATION_NAME) = UPPER(O4.APPLICATION_NAME)
  182.           AND    UPPER(V5.MENU_NAME) = UPPER(O4.MENU_NAME)
  183.           AND    V5.OPTION_NUMBER = O4.OPTION_NUMBER
  184.           AND    UPPER(O4.APPLICATION_NAME) = UPPER(W4.APPLICATION_NAME)
  185.           AND    WORK_CLASS BETWEEN LOW_CLASS AND HIGH_CLASS ;
  186.  
  187.  
  188.  
  189. REM
  190. REM          SQLMENU USERS
  191. REM
  192.  
  193. INSERT INTO MENU_B_USER
  194.           SELECT UPPER(APPLICATION_NAME) || '_' || WORK_CLASS, USER_NAME
  195.           FROM   MENU_USER
  196.           WHERE  APPLICATION_NAME LIKE UPPER('&1');
  197.  
  198.  
  199.  
  200.  
  201. REM
  202. REM          MENU OBJECT TEXT
  203. REM
  204.  
  205. INSERT INTO MENU_B_OBJ_TEXT
  206.           SELECT V5.APPLICATION_NAME, OBJECT_TEXT_ID, 1, DESCRIP_1 || '
  207. '
  208.           FROM   MENU_B_INFO V5, MENU_INFO V4
  209.           WHERE  UPPER(V4.APPLICATION_NAME) LIKE UPPER('&1')
  210.           AND    UPPER(V5.APPLICATION_NAME) = UPPER(V4.APPLICATION_NAME)
  211.           AND    UPPER(V5.MENU_NAME) = UPPER(V4.MENU_NAME) ;
  212.  
  213. INSERT INTO MENU_B_OBJ_TEXT
  214.           SELECT V5.APPLICATION_NAME, OBJECT_TEXT_ID, 2, DESCRIP_2 || '
  215. '
  216.           FROM   MENU_B_INFO V5, MENU_INFO V4
  217.           WHERE  UPPER(V4.APPLICATION_NAME) LIKE UPPER('&1')
  218.           AND    UPPER(V5.APPLICATION_NAME) = UPPER(V4.APPLICATION_NAME)
  219.           AND    UPPER(V5.MENU_NAME) = UPPER(V4.MENU_NAME) ;
  220.  
  221. INSERT INTO MENU_B_OBJ_TEXT
  222.           SELECT V5.APPLICATION_NAME, OBJECT_TEXT_ID, 3, DESCRIP_3 || '
  223. '
  224.           FROM   MENU_B_INFO V5, MENU_INFO V4
  225.           WHERE  UPPER(V4.APPLICATION_NAME) LIKE UPPER('&1')
  226.           AND    UPPER(V5.APPLICATION_NAME) = UPPER(V4.APPLICATION_NAME)
  227.           AND    UPPER(V5.MENU_NAME) = UPPER(V4.MENU_NAME) ;
  228.  
  229. INSERT INTO MENU_B_OBJ_TEXT
  230.           SELECT V5.APPLICATION_NAME, OBJECT_TEXT_ID, 4, DESCRIP_4 || '
  231. '
  232.           FROM   MENU_B_INFO V5, MENU_INFO V4
  233.           WHERE  UPPER(V4.APPLICATION_NAME) LIKE UPPER('&1')
  234.           AND    UPPER(V5.APPLICATION_NAME) = UPPER(V4.APPLICATION_NAME)
  235.           AND    UPPER(V5.MENU_NAME) = UPPER(V4.MENU_NAME) ;
  236.  
  237. INSERT INTO MENU_B_OBJ_TEXT
  238.           SELECT V5.APPLICATION_NAME, OBJECT_TEXT_ID,
  239.                  HELP_SEQ_NR, HELP_TEXT || '
  240. '
  241.           FROM   MENU_B_OPTION V5, MENU_HELP V4
  242.           WHERE  UPPER(V4.APPLICATION_NAME) LIKE UPPER('&1')
  243.           AND    UPPER(V5.APPLICATION_NAME) = UPPER(V4.APPLICATION_NAME)
  244.           AND    UPPER(V5.MENU_NAME) = UPPER(V4.MENU_NAME)
  245.           AND    V5.OPTION_NUMBER = V4.OPTION_NUMBER ;
  246.  
  247. INSERT INTO MENU_B_OBJ_TEXT
  248.           SELECT V5.APPLICATION_NAME, OBJECT_TEXT_ID, 1, HELP_TEXT || '
  249. '
  250.           FROM   MENU_B_PARAM V5, MENU_PARAM V4
  251.           WHERE  UPPER(V4.APPLICATION_NAME) LIKE UPPER('&1')
  252.           AND    UPPER(V5.APPLICATION_NAME) = UPPER(V4.APPLICATION_NAME)
  253.           AND    V5.SUBSTITUTION_STRING = V4.SUBSTITUTION_STRING ;
  254.  
  255. INSERT INTO MENU_B_OBJ_TEXT
  256.           SELECT 'MNUGROUPAPPLICATION', OBJECT_TEXT_ID, 1, DESCRIP_1 || '
  257. '
  258.           FROM   MENU_B_GROUP V5, MENU_WORK_CLASS V4
  259.           WHERE  V5.GROUP_NAME =
  260.                  UPPER(V4.APPLICATION_NAME) || '_' || V4.WORK_CLASS
  261.           AND    UPPER(V4.APPLICATION_NAME) LIKE UPPER('&1');
  262.  
  263. INSERT INTO MENU_B_OBJ_TEXT
  264.           SELECT 'MNUGROUPAPPLICATION', OBJECT_TEXT_ID, 2, DESCRIP_2 || '
  265. '
  266.           FROM   MENU_B_GROUP V5, MENU_WORK_CLASS V4
  267.           WHERE  V5.GROUP_NAME =
  268.                  UPPER(V4.APPLICATION_NAME) || '_' || V4.WORK_CLASS
  269.            AND    UPPER(V4.APPLICATION_NAME) LIKE UPPER('&1');
  270.  
  271. INSERT INTO MENU_B_OBJ_TEXT
  272.           SELECT 'MNUGROUPAPPLICATION', OBJECT_TEXT_ID, 3, DESCRIP_3 || '
  273. '
  274.           FROM   MENU_B_GROUP V5, MENU_WORK_CLASS V4
  275.           WHERE  V5.GROUP_NAME =
  276.                  UPPER(V4.APPLICATION_NAME) || '_' || V4.WORK_CLASS
  277.           AND    UPPER(V4.APPLICATION_NAME) LIKE UPPER('&1');
  278.  
  279. INSERT INTO MENU_B_OBJ_TEXT
  280.           SELECT 'MNUGROUPAPPLICATION', OBJECT_TEXT_ID, 4, DESCRIP_4 || '
  281. '
  282.           FROM   MENU_B_GROUP V5, MENU_WORK_CLASS V4
  283.           WHERE  V5.GROUP_NAME =
  284.                  UPPER(V4.APPLICATION_NAME) || '_' || V4.WORK_CLASS
  285.           AND    UPPER(V4.APPLICATION_NAME) LIKE UPPER('&1');
  286.  
  287.  
  288.  
  289.  
  290. REM  BACKGROUND
  291. REM  ~~~~~~~~~~
  292. REM  It is frequently the case in SQL*Menu 4.1 that all options in a
  293. REM  particular application (root menu, and submenus) are available to
  294. REM  everyone. Access to the application is controlled by the work class
  295. REM  enrollment, but any authorized user can access every item on the
  296. REM  menu.
  297. REM
  298. REM  Previously, in this special case, no Group Privilege information
  299. REM  was converted and SQL*Menu 4.1 designers, expecting ALL users for
  300. REM  that application to have access, received the 'No Active Items in
  301. REM  Root Menu' message upon attempting to run the application.
  302. REM
  303. REM  METHOD
  304. REM  ~~~~~~
  305. REM  For each converted Menu 4.1 application matching the
  306. REM  APPLICATION_NAME criteria and qualifying for the special case
  307. REM  explained above, we assign access privileges on the first item of
  308. REM  the root menu to all of the converted workclasses from the 4.1
  309. REM  application.  Because of the privilege inheritance in SQL*Menu 5.0,
  310. REM  it is enough to grant privilege to only one item on the root menu
  311. REM  to all converted roles for a given application to regain the
  312. REM  SQL*Menu 4.1 behaviour.
  313.  
  314. INSERT INTO MENU_B_GRP_PRIV
  315.     SELECT V5_MBP.APPLICATION_NAME,
  316.            UPPER(V4_MWC.APPLICATION_NAME) || '_' || V4_MWC.WORK_CLASS,
  317.            MIN(V5_MBP.PRIVILEGE_ID)
  318.       FROM MENU_B_PRIV     V5_MBP,
  319.            MENU_WORK_CLASS V4_MWC
  320.       WHERE V5_MBP.APPLICATION_NAME = V4_MWC.APPLICATION_NAME
  321.         AND V5_MBP.MENU_NAME        = V5_MBP.APPLICATION_NAME
  322.         AND V5_MBP.APPLICATION_NAME IN
  323.           ( SELECT V4_MA.APPLICATION_NAME
  324.                FROM MENU_APPLICATION V4_MA,
  325.                     MENU_B_APPL      V5_MBA
  326.                WHERE V4_MA.APPLICATION_NAME = V5_MBA.APPLICATION_NAME
  327.                AND NOT EXISTS (SELECT V5_MBGP.PRIVILEGE_ID
  328.                                   FROM MENU_B_GRP_PRIV V5_MBGP
  329.                                   WHERE V5_MBGP.APPLICATION_NAME =
  330.                                         V4_MA.APPLICATION_NAME)
  331.                                   AND V4_MA.APPLICATION_NAME LIKE UPPER('&1') )
  332.     GROUP BY V5_MBP.APPLICATION_NAME,
  333.              UPPER(V4_MWC.APPLICATION_NAME)|| '_'||V4_MWC.WORK_CLASS;
  334.  
  335.  
  336. commit;
  337.  
  338. Set verify on
  339. Set heading on
  340. Spool off
  341. Set termout on
  342.