/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2014 Applaud Solutions UK Ltd                |
 |                             All rights reserved                            |
 *===========================================================================*/

SET VERIFY OFF
SET FEEDBACK OFF
SET SCAN OFF
WHENEVER OSERROR  EXIT FAILURE ROLLBACK
WHENEVER SQLERROR EXIT FAILURE ROLLBACK

DECLARE

  --
  -- Local constants and variables
  --
  l_SERVICE CONSTANT xxas_com_service_repository.service_name%TYPE
                       := 'OracleURL';

BEGIN

  xxas_com_sr_pkg.set_rest_service
    (p_service_name       => l_SERVICE
    ,p_description        => 'GetOracleURL'
    ,p_consumes           => 'application/xml'
    ,p_produces           => 'application/xml'
    );

 xxas_com_sr_pkg.set_rest_method
    (p_service_name       => l_SERVICE
    ,p_method_name        => 'GetOracleURL'
    ,p_description        => 'Oracle URL for a notification'
    ,p_path               => 'oracle-notification-url/{notifId}'
    ,p_methods            => 'POST'
    ,p_remove_root_ele    => true
    ,p_sql                =>
      q'[
  SELECT XMLElement
          ("data"
           ,XMLForest
              (xxas_com_worklist_pkg.get_oracle_url({pathParam.notifId}) as "redirect"
              ,'_blank' AS "target"
              ,'true' AS "closeModal"                  
              )
          ) "data"
   FROM dual
        ]'
    );
    

    
END;
/
COMMIT;
EXIT;
