previous

API Extension in Business_Event_Ext

This topic contains information pertaining to API Extension in Business_Event_Ext:

New initialization function

Function InitSettings
          (vExtSystem in varchar2,
           boShowOld in boolean default False,
           boIgnoreNull in boolean default True) return integer;

Procedure QuerySettings
          (vExtSystem out varchar2,
            boShowOld out boolean,
            boIgnoreNull out boolean);

Dequeue function

Function get_event_XML
          out_event        out varchar2, --size limitations?
          in_wait_mode      in  varchar2 default 'FOREVER',
          in_commit_inside  in  varchar2 default 'Y')
      return integer;

This procedure should delete the records of the dequeued message from business_events table once it successfully delivered the xml string. The parameter in_commit_inside will always be passed as ‘N’ when it is across the instance of the database.

Remarks:

Function InitSettings: Needs to check if the given resort id is valid, if the given external system id is valid; if the given values are valid stores the values in the global variables; needs to call pms_in it and store result in iInitStatus

Returncodes           0           OK / given values valid
                        -2           Resort id unknown, store NULL in sResort
                        -3           External system unknown, store NULL sExternalSystem
                        -4           PMS initialization failed?
                       -99           unknown error initialization failed

Procedure QuerySettings: To check the actual settings

Function get_event_XML: get next event from BE queue as XML string, if the dequeue and the formatting as XML was successful, then delete the BE from the BE table(s)/queue. No multiple dequeue of the same event! Check iInitStatus if successfully initialized

Returncodes           0           OK, out_event contains XML formatted event
                        -1           InitSettings not called / Initialization invalid
                        -2           request timed out no event available (out_event null)
                       -99           unknown error, dequeue failed (out_event -> error msg)

Example:

Declare
vResort varchar2(20) := ‘FDH’;
vExtSystem varchar2(20) := ‘OPUS2’;
vEvent varchar2(32000);
boShowOld boolean := True;
boIgnoreNull boolean := False;
iResult integer;
begin
iResult := Business_Event_Ext.InitSettings
              (vResort, vExtSystem, boShowOld, boIgnoreNull);
if iResult=0 then
 loop
   iResult := Business_Event_Ext.Get_Event_XML(vEvent, null, null)
   if iResult=0 then
     -- call logic to send / store / process XML
   else
     -- call logic to handle / log return code
     Exit;
   end if;  
 end loop;  
else
 -- call logic to handle / log return code
end if;
end;

Part II

External system -> OPERA PMS

Package : pms_p

PROCEDURE initialize(in_user IN VARCHAR2,
                    in_password IN VARCHAR2,
                    in_resort IN VARCHAR2 DEFAULT NULL,
             in_business_date in date default null)
in_user ---'XXXXX'
in_password = '$$$XXXXX$$'
in_resort = 'FDH'
in_business_date --null.

Note:  X’s represent user and password established for your company.

Note:  The external system needs to call this initialization routine every time they login into PMS system.

See Also