project BLF > class BUDCConfiguration > method apiExportCustomization

Description

Export definitions of custom components in standard XML format.
Export one or all components.


Parameters


icBusinessComponentCodeinputcharacter
icExportFileinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program3/budcconfiguration.p)

if icBusinessComponentCode = ?
then icBusinessComponentCode = "".

if icExportFile = ?
then icExportFile = "".

if icExportFile = ""
then do:
    <M-72 run SetMessage
       (input  trim(#T-32'You must enter the file name.':100(6490)T-32#) (icMessage), 
        input  '' (icArguments), 
        input  '' (icFieldName), 
        input  '' (icFieldValue), 
        input  'E' (icType), 
        input  3 (iiSeverity), 
        input  '' (icRowid), 
        input  'blf-150049':U (icFcMsgNumber), 
        input  '' (icFcExplanation), 
        input  '' (icFcIdentification), 
        input  '' (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BUDCConfiguration>
    oiReturnStatus = -1.
    return.
end.

if icBusinessComponentCode = ""
then vcDLQuery = "".
else if icBusinessComponentCode matches "bcustom[*]"
then vcDLQuery = "for each UDCConfig where UDCConfig.UDCConfigCode = " + <M-4 EnQuote  (input  substring(icBusinessComponentCode,9,length(icBusinessComponentCode,'CHARACTER') - 9,'CHARACTER') (icToQuote)) in BUDCConfiguration>.
else return.

<M-10 run DataLoad
   (input  '' (icRowids), 
    input  '' (icPkeys), 
    input  '' (icObjectIds), 
    input  vcDLQuery (icFreeform), 
    input  no (ilKeepPrevious), 
    output viFcReturnSuper (oiReturnStatus)) in BUDCConfiguration>

/* Nothing to export ? Then exit without export. */
if viFcReturnSuper = -4
then return.

if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

<M-38 run DumpXmlRepresentation
   (input  icExportFile (icFile), 
    input  no (ilHeaderOnly), 
    input  ? (ilSuppressEmptyFields), 
    input  0 (iiPriority), 
    input  no (ilWriteXMLSchema), 
    input  '' (icObjectRowId), 
    input  yes (ilExportForInput), 
    output viFcReturnSuper (oiReturnStatus)) in BUDCConfiguration>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.


Sample code: how to call this method through RPCRequestService (QXtend Inbound)

define temp-table ttContext no-undo
    field propertyQualifier as character
    field propertyName as character
    field propertyValue as character
    index entityContext is primary unique
        propertyQualifier
        propertyName
    index propertyQualifier
        propertyQualifier.

define dataset dsContext for ttContext.

define variable vhContextDS as handle no-undo.
define variable vhExceptionDS as handle no-undo.
define variable vhServer as handle no-undo.
define variable vhInputDS as handle no-undo.
define variable vhInputOutputDS as handle no-undo.
define variable vhOutputDS as handle no-undo.
define variable vhParameter as handle no-undo.

/* Create context */
create ttContext.
assign ttContext.propertyName = "programName"
       ttContext.propertyValue = "BUDCConfiguration".
create ttContext.
assign ttContext.propertyName = "methodName"
       ttContext.propertyValue = "apiExportCustomization".
create ttContext.
assign ttContext.propertyName = "applicationId"
       ttContext.propertyValue = "fin".
create ttContext.
assign ttContext.propertyName = "entity"
       ttContext.propertyValue = "1000".
create ttContext.
assign ttContext.propertyName = "userName"
       ttContext.propertyValue = "mfg".
create ttContext.
assign ttContext.propertyName = "password"
       ttContext.propertyValue = "".

/* Create input dataset */
create dataset vhInputDS.
vhInputDS:read-xmlschema("file", "xml/budcconfiguration.apiexportcustomization.i.xsd", ?).
vhParameter = vhInputDS:get-buffer-handle("tParameterI").
vhParameter:buffer-create().
assign vhParameter::icBusinessComponentCode = <parameter value>
       vhParameter::icExportFile = <parameter value>.

/* Connect the AppServer */
create server vhServer.
vhServer:connect("-URL <appserver-url>").

if not vhServer:connected()
then do:
    message "Could not connect AppServer" view-as alert-box error title "Error".
    return.
end.

/* Run */
assign vhContextDS = dataset dsContext:handle.

run program/rpcrequestservice.p on vhServer
    (input-output dataset-handle vhContextDS by-reference,
           output dataset-handle vhExceptionDS,
     input        dataset-handle vhInputDS by-reference,
     input-output dataset-handle vhInputOutputDS by-reference,
           output dataset-handle vhOutputDS).

/* Handle output however you want, in this example, we dump it to xml */
if valid-handle(vhExceptionDS)
then vhExceptionDS:write-xml("file", "Exceptions.xml", true).

if valid-handle(vhOutputDS)
then vhOutputDS:write-xml("file", "Output.xml", true).

/* Cleanup */
vhServer:disconnect().
assign vhServer = ?.

if valid-handle(vhInputDS)
then delete object vhInputDS.

if valid-handle(vhOutputDS)
then delete object vhOutputDS.

if valid-handle(vhExceptionDS)
then delete object vhExceptionDS.