/* $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
                       := 'HRAPITransactions';

BEGIN

  xxas_com_sr_pkg.set_rest_service
    (p_service_name       => l_SERVICE
    ,p_description        => 'Workflow Details for HR API Transactions'
    ,p_path               => '/hr-transactions/{transactionId}'
    ,p_consumes           => 'application/xml'
    ,p_produces           => 'application/xml'
    );

  xxas_com_sr_pkg.set_rest_method
    (p_service_name       => l_SERVICE
    ,p_method_name        => 'GetTransactionDetails'
    ,p_description        => 'Gets the transaction details'
    ,p_methods            => 'GET'
    ,p_remove_root_ele    => true
    ,p_sql                =>
      q'[
      SELECT xxas_selfservice_workflow_pkg.get_workflow_details
              ({pathParam.transactionId}) "data"
      FROM   hr_api_transactions rslt
      WHERE  rslt.transaction_id = {pathParam.transactionId}
      AND    {authFunctionPredicate.XXAS_DATA_TRANS_VIEW}
       ]'
    );
    
END;
/
COMMIT;
EXIT;
