REM This file updates the Meta Data tables for MR4 (9i)

DECLARE

BEGIN 

	-- M80.006
	-- 22105789 - PLEASE INCLUDE NEW GENERATOR PREFERENCES
    dbms_output.put_line ('Applying Meta Data Patch M80.006'); 

    delete from cdi_pref_domains
    where PD_DOMAIN in ( 'RPTDTY_VALS', 'RPTFMT_VALS');   

    delete from cdi_valid_prefs
    where VP_DOMAIN in ( 'RPTDTY_VALS', 'RPTFMT_VALS');

    insert into cdi_pref_domains 
    values 
    ('RPTDTY_VALS' ,'Valid values for Web Deployment - Report Destination Type' );

    insert into cdi_valid_prefs 
    values 
    ('RPTDTY_VALS' ,'PREVIEW' ,'Preview' ,'' ,'US' );

    insert into cdi_valid_prefs 
    values 
    ('RPTDTY_VALS' ,'FILE' ,'File' ,'' ,'US' );

    insert into cdi_valid_prefs 
    values 
    ('RPTDTY_VALS' ,'PRINTER' ,'Printer' ,'' ,'US' );

    insert into cdi_valid_prefs 
    values 
    ('RPTDTY_VALS' ,'MAIL' ,'Mail' ,'' ,'US' );

    insert into cdi_valid_prefs 
    values 
    ('RPTDTY_VALS' ,'CACHE' ,'Cache' ,'' ,'US' );

    insert into cdi_valid_prefs 
    values 
    ('RPTDTY_VALS' ,'SCREEN' ,'Screen' ,'' ,'US' );
 
    insert into cdi_pref_domains 
    values 
    ('RPTFMT_VALS' ,'Valid values for Web Deployment - Report Destination Format' );

    insert into cdi_valid_prefs 
    values 
    ('RPTFMT_VALS' ,'PDF' ,'PDF' ,'' ,'US' );

    insert into cdi_valid_prefs 
    values 
    ('RPTFMT_VALS' ,'HTML' ,'HTML' ,'' ,'US' );

    insert into cdi_valid_prefs 
    values 
    ('RPTFMT_VALS' ,'HTMLCSS' ,'HTMLCSS' ,'' ,'US' );

    insert into cdi_valid_prefs 
    values 
    ('RPTFMT_VALS' ,'HTMLCSSIE' ,'HTMLCSSIE' ,'' ,'US' );

    insert into cdi_valid_prefs 
    values 
    ('RPTFMT_VALS' ,'RTF' ,'RTF' ,'' ,'US' );

    insert into cdi_valid_prefs 
    values 
    ('RPTFMT_VALS' ,'DELIMITED' ,'Delimited' ,'' ,'US' );


    delete from cdi_dflt_user_pref_usages
    where P_SNAME = 'CGSF'
    and P_CGVERSION = '5.0'
    and PF_SEQ = 1
    and DUP_SNAME in ( 'RPTSVR', 'RPTPTH', 'RPTDTY', 'RPTDNM', 'RPTFMT', 'RPTSUF' );

    insert into cdi_dflt_user_pref_usages
    (P_SNAME
    ,P_CGVERSION
    ,PF_SEQ
    ,DUP_SNAME
    ,DESCRIPTION
    ,VALUE
    ,DUP_INTERNAL
    ,DUP_TYPE
    ,DESCRIPTION_MSGID
    ,MANDATORY
    ,CHR_DOMAIN
    ,CHR_MAXLEN
    ,NUM_HIVAL
    ,NUM_LOVAL
    ,DOM
    ,TAB
    ,CON
    ,COL
    ,MOD
    ,DTU
    ,CONU
    ,IGRP
    ,DCU
    ,ACI
    ,SUB
    ,LOV
    ,NLS_LANG)
    values
    (
    'CGSF',
    '5.0',
    1,
    'RPTSVR',
    'Name of Reports server to run against', 
    '', 
    'N', 
    'WEB DEPLOYMENT',
    47500, 
    'N', 
    '', 
    80,  
    NULL,
    NULL,
    'N',
    'N',
    'N',
    'N',
    'Y',
    'N',
    'N',
    'N',
    'N',
    'N',
    'N',
    'N',
    'US');

    insert into cdi_dflt_user_pref_usages
    (P_SNAME
    ,P_CGVERSION
    ,PF_SEQ
    ,DUP_SNAME
    ,DESCRIPTION
    ,VALUE
    ,DUP_INTERNAL
    ,DUP_TYPE
    ,DESCRIPTION_MSGID
    ,MANDATORY
    ,CHR_DOMAIN
    ,CHR_MAXLEN
    ,NUM_HIVAL
    ,NUM_LOVAL
    ,DOM
    ,TAB
    ,CON
    ,COL
    ,MOD
    ,DTU
    ,CONU
    ,IGRP
    ,DCU
    ,ACI
    ,SUB
    ,LOV
    ,NLS_LANG)
    values
    (
    'CGSF',
    '5.0',
    1,
    'RPTPTH',
    'File path of the report to run',
    '',
    'N',
    'WEB DEPLOYMENT',
    47501,
    'N',
    '',
    240,
    NULL,
    NULL,
    'N',
    'N',
    'N',
    'N',
    'Y',
    'N',
    'N',
    'N',
    'N',
    'N',
    'N',
    'N',
    'US');


    insert into cdi_dflt_user_pref_usages
    (P_SNAME
    ,P_CGVERSION
    ,PF_SEQ
    ,DUP_SNAME
    ,DESCRIPTION
    ,VALUE
    ,DUP_INTERNAL
    ,DUP_TYPE
    ,DESCRIPTION_MSGID
    ,MANDATORY
    ,CHR_DOMAIN
    ,CHR_MAXLEN
    ,NUM_HIVAL
    ,NUM_LOVAL
    ,DOM
    ,TAB
    ,CON
    ,COL
    ,MOD
    ,DTU
    ,CONU
    ,IGRP
    ,DCU
    ,ACI
    ,SUB
    ,LOV
    ,NLS_LANG)
    values
    (
    'CGSF',
    '5.0',
    1,
    'RPTDTY',
    'Report destination type',
    '',
    'N',
    'WEB DEPLOYMENT',
    47502,
    'Y',
    'RPTDTY_VALS',
    40,
    NULL,
    NULL,
    'N',
    'N',
    'N',
    'N',
    'Y',
    'N',
    'N',
    'N',
    'N',
    'N',
    'N',
    'N',
    'US');


    insert into cdi_dflt_user_pref_usages
    (P_SNAME
    ,P_CGVERSION
    ,PF_SEQ
    ,DUP_SNAME
    ,DESCRIPTION
    ,VALUE
    ,DUP_INTERNAL
    ,DUP_TYPE
    ,DESCRIPTION_MSGID
    ,MANDATORY
    ,CHR_DOMAIN
    ,CHR_MAXLEN
    ,NUM_HIVAL
    ,NUM_LOVAL
    ,DOM
    ,TAB
    ,CON
    ,COL
    ,MOD
    ,DTU
    ,CONU
    ,IGRP
    ,DCU
    ,ACI
    ,SUB
    ,LOV
    ,NLS_LANG)
    values
    (
    'CGSF',
    '5.0',
    1,
    'RPTDNM',
    'Report destination name',
    '',
    'N',
    'WEB DEPLOYMENT',
    47503,
    'N',
    '',
    80,
    NULL,
    NULL,
    'N',
    'N',
    'N',
    'N',
    'Y',
    'N',
    'N',
    'N',
    'N',
    'N',
    'N',
    'N',
    'US'); 


    insert into cdi_dflt_user_pref_usages
    (P_SNAME
    ,P_CGVERSION
    ,PF_SEQ
    ,DUP_SNAME
    ,DESCRIPTION
    ,VALUE
    ,DUP_INTERNAL
    ,DUP_TYPE
    ,DESCRIPTION_MSGID
    ,MANDATORY
    ,CHR_DOMAIN
    ,CHR_MAXLEN
    ,NUM_HIVAL
    ,NUM_LOVAL
    ,DOM
    ,TAB
    ,CON
    ,COL
    ,MOD
    ,DTU
    ,CONU
    ,IGRP
    ,DCU
    ,ACI
    ,SUB
    ,LOV
    ,NLS_LANG)
    values
    (
    'CGSF',
    '5.0',
    1,
    'RPTFMT',
    'Report destination format',
    '',
    'N',
    'WEB DEPLOYMENT',
    47504,
    'Y',
    'RPTFMT_VALS',
    40,
    NULL,
    NULL,
    'N',
    'N',
    'N',
    'N',
    'Y',
    'N',
    'N',
    'N',
    'N',
    'N',
    'N',
    'N',
    'US');


    insert into cdi_dflt_user_pref_usages
    (P_SNAME
    ,P_CGVERSION
    ,PF_SEQ
    ,DUP_SNAME
    ,DESCRIPTION
    ,VALUE
    ,DUP_INTERNAL
    ,DUP_TYPE
    ,DESCRIPTION_MSGID
    ,MANDATORY
    ,CHR_DOMAIN
    ,CHR_MAXLEN
    ,NUM_HIVAL
    ,NUM_LOVAL
    ,DOM
    ,TAB
    ,CON
    ,COL
    ,MOD
    ,DTU
    ,CONU
    ,IGRP
    ,DCU
    ,ACI
    ,SUB
    ,LOV
    ,NLS_LANG)
    values
    (
    'CGSF',
    '5.0',
    1,
    'RPTSUF',
    'Report file suffix',
    'rdf',
    'N',
    'WEB DEPLOYMENT',
    47505,
    'Y',
    '',
    10,
    NULL,
    NULL,
    'N',
    'N',
    'N',
    'N',
    'Y',
    'N',
    'N',
    'N',
    'N',
    'N',
    'N',
    'N',
    'US');




    delete from cdi_dflt_user_pref_usages
    where P_SNAME = 'ORG'
    and P_CGVERSION = '3.0'
    and PF_SEQ = 1
    and DUP_SNAME = 'WEBSRV';   

    insert into cdi_dflt_user_pref_usages 
    (P_SNAME, P_CGVERSION, PF_SEQ, DUP_SNAME, 
    DESCRIPTION, 
    VALUE, DUP_INTERNAL, DUP_TYPE, 
    DESCRIPTION_MSGID, MANDATORY, CHR_DOMAIN, CHR_MAXLEN, NUM_HIVAL, NUM_LOVAL,
    DOM, TAB, CON, COL, MOD, DTU, CONU, IGRP, DCU, NLS_LANG ) 
    values 
    ('ORG', '3.0', 1, 'WEBSRV', 
    'Web Server name', 
    '', 'N', 'HTML DEPLOYMENT', 
    16740, 'N', NULL, 240, NULL, NULL, 
    NULL, NULL, NULL, NULL, 'Y', 'N', NULL, NULL, NULL, 'US'); 


  -- Register MR4 Upgrade in the RM$PATCHES RM$PATCHES table 
	rmpatch.install('CI04012.MR4_9i_UPGRADE');
	rmpatch.installed_ok;

	commit;
	
EXCEPTION

	WHEN OTHERS THEN 
		 dbms_output.put_line('* Exception Raised  ');
		 dbms_output.put_line('...ERROR: '||substrb(sqlerrm,1,240));
		 rollback work;
		 RAISE;

END;
/











