Rem    NAME 
Rem      ckenbver.sql
Rem    DESCRIPTION
Rem      Enable Versioning in the Repository
Rem
Rem    RETURNS
Rem 	 None
Rem    NOTES
Rem      Called from the RAU during the stage CKENBVER
Rem	 DO NOT RUN THIS SCRIPT MORE THEN ONCE
Rem    CREATED
Rem	  08/04/1999

DECLARE
   wrkarea_irid             number;
   comment                 varchar2(100);
   l_SUPPORTS_DESIGNER     varchar2(1);
   l_SUPPORTS_JDEVEE       varchar2(1); 
 
BEGIN
  dbms_output.enable(1000000);

  select SUPPORTS_JDEVEE
  ,      SUPPORTS_DESIGNER
  into   l_SUPPORTS_JDEVEE
  ,      l_SUPPORTS_DESIGNER
  from   rm$repositories;
  
  dbms_output.put_line('* Retrieving irid for GLOBAL SHARED WORKAREA' );
  select irid into wrkarea_irid 
  from I$sdd_workareas 
  where name = 'GLOBAL SHARED WORKAREA';
  
  -- Turn on versioning 
  dbms_output.put_line('* Set Repository to be Versioned');    
  jr_sys_privs.set_versioned_repos; 
		
  -- Restore full system privileges to Repository Owner 
  dbms_output.put_line('* Restoring Configuration Management and Version Control system privileges');   
  jr_sys_privs.upd(user, jr_sys_privs.full_privileges);

  -- Restore full access rights to Global Shared Workarea
  dbms_output.put_line('* Restoring Configuration Management and Version Control access rights to the GLOBAL SHARED WORKAREA');   
  jr_acc_rights.upd( wrkarea_irid, user, jr_acc_rights.full_access_rights ); 
  
  commit;

  dbms_output.put_line('* Operation Complete');
                     
EXCEPTION

  WHEN OTHERS THEN 

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

END;
/
