project BLF > class BControlProperty > method ApiExportCustomization
Parameters
icBusinessComponentLabel | input | character | |
icBusinessActivityCode | input | character | |
iiCustomizationLevel | input | integer | |
iiRole | input | integer | |
iiUser | input | integer | |
icExportFile | input | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program3/bcontrolproperty.p)
if icBusinessActivityCode = ?
then assign icBusinessActivityCode = "".
if icBusinessComponentLabel = ?
then assign icBusinessComponentLabel = "".
if icExportFile = ?
then assign icExportFile = "".
if iiCustomizationLevel = ?
then assign iiCustomizationLevel = 0.
if iiRole = ?
then assign iiRole = 0.
if iiUser = ?
then assign iiUser = 0.
if icExportFile = ""
then do:
<M-98 run SetMessage
(input trim(#T-47'You must enter the file name.':100(6490)T-47#) (icMessage),
input '' (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'BLF-279625':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BControlProperty>
assign oiReturnStatus = -1.
return.
end.
assign viFromLevel = if iiCustomizationLevel = 0
then 1
else iiCustomizationLevel
viToLevel = if iiCustomizationLevel = 0
then 3
else iiCustomizationLevel
viLevelValue = if viFromLevel = viToLevel and
viFromLevel <> 3
then if iiRole = 0
then iiUser
else iiRole
else 0.
if icBusinessComponentLabel = ""
then do viA = viFromLevel to viToLevel:
<M-19 run ApiReadCustomizationV01
(input '' (icBusinessActivity),
input viA (iiLevel),
input viLevelValue (iiLevelValue),
output BControlPropertyS append (BControlProperty),
output viFcReturnSuper (oiReturnStatus)) in BControlProperty>
end.
else
if index(icBusinessComponentLabel, "*") = 0
then do:
assign vcBusinessActivity = icBusinessComponentLabel.
if icBusinessActivityCode <> ""
then assign vcBusinessActivity = vcBusinessActivity + "." + icBusinessActivityCode.
do viA = viFromLevel to viToLevel:
<M-11 run ApiReadCustomizationV01
(input vcBusinessActivity (icBusinessActivity),
input viA (iiLevel),
input viLevelValue (iiLevelValue),
output BControlPropertyS append (BControlProperty),
output viFcReturnSuper (oiReturnStatus)) in BControlProperty>
end.
end.
else do:
<Q-91 run LanguagePrim (all) (Read) (NoCache)
(input current-language, (LngCode)
input ?, (LngID)
output dataset tqLanguagePrim) in BLanguage >
find first tqLanguagePrim where
tqLanguagePrim.tcLngCode = current-language
no-error.
if not available tqLanguagePrim
then do:
<M-12 run SetMessage
(input trim(subst(#T-8'Invalid language code: &1.':255(448)T-8#, current-language)) (icMessage),
input '' (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'BLF-729307':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BControlProperty>
assign oiReturnStatus = -1.
return.
end.
<Q-4 run TranslationsForBusComp (all) (Read) (NoCache)
(input icBusinessComponentLabel, (TranslationStringText)
input tqLanguagePrim.tiLng_ID, (LngID)
output dataset tqTranslationsForBusComp) in BTranslation >
for each tqTranslationsForBusComp where
tqTranslationsForBusComp.tiLng_ID = tqLanguagePrim.tiLng_ID:
do viA = viFromLevel to viToLevel:
<M-40 run ApiReadCustomizationV01
(input tqTranslationsForBusComp.tcBusComponentCode (icBusinessActivity),
input viA (iiLevel),
input viLevelValue (iiLevelValue),
output BControlPropertyS append (BControlProperty),
output viFcReturnSuper (oiReturnStatus)) in BControlProperty>
end.
end.
end.
if can-find (first t_sControlProperty)
then do:
dataset BControlPropertyO:empty-dataset().
dataset BControlPropertyO:copy-dataset(dataset BControlPropertyS:handle).
dataset BControlPropertyS:empty-dataset().
<M-66 run DumpXmlRepresentation
(input icExportFile (icFile),
input false (ilHeaderOnly),
input ? (ilSuppressEmptyFields),
input 0 (iiPriority),
input false (ilWriteXMLSchema),
input '' (icObjectRowId),
input true (ilExportForInput),
output viFcReturnSuper (oiReturnStatus)) in BControlProperty>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
end.
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 = "BControlProperty".
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/bcontrolproperty.apiexportcustomization.i.xsd", ?).
vhParameter = vhInputDS:get-buffer-handle("tParameterI").
vhParameter:buffer-create().
assign vhParameter::icBusinessComponentLabel = <parameter value>
vhParameter::icBusinessActivityCode = <parameter value>
vhParameter::iiCustomizationLevel = <parameter value>
vhParameter::iiRole = <parameter value>
vhParameter::iiUser = <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.