Description
Get SOD matrix
Parameters
icCategoryFilter1 | input | character | filter on SOD category 1 code in the matrix (supports wildcards) |
icCategoryFilter2 | input | character | filter on SOD category 2 code in the matrix (supports wildcards) |
tGetSODCategory1 | output | temp-table | |
tGetSODCategory2 | output | temp-table | |
tGetSODMatrix | output | temp-table | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
BLF
program code (program3/bsodcategoryexclusion.p)
empty temp-table tGetSODCategory1.
empty temp-table tGetSODCategory2.
empty temp-table tGetSODMatrix.
<Q-1 run SODCategoryPrim (all) (Read) (NoCache)
(input 0, (CategoryID)
input '', (CategoryCode)
output dataset tqSODCategoryPrim) in BSODCategory >
for each tqSODCategoryPrim where
tqSODCategoryPrim.tcSODCategoryCode matches icCategoryFilter1 or
icCategoryFilter1 = "" or
icCategoryFilter1 = ? on error undo, throw:
create tGetSODCategory1.
assign tGetSODCategory1.tiSODCategory_ID = tqSODCategoryPrim.tiSODCategory_ID
tGetSODCategory1.tcSODCategoryCode = tqSODCategoryPrim.tcSODCategoryCode.
end.
for each tqSODCategoryPrim where
tqSODCategoryPrim.tcSODCategoryCode matches icCategoryFilter2 or
icCategoryFilter2 = "" or
icCategoryFilter2 = ? on error undo, throw:
create tGetSODCategory2.
assign tGetSODCategory2.tiSODCategory_ID = tqSODCategoryPrim.tiSODCategory_ID
tGetSODCategory2.tcSODCategoryCode = tqSODCategoryPrim.tcSODCategoryCode.
end.
empty temp-table tqSODCategoryPrim.
<M-2 run DataLoad
(input '' (icRowids),
input '' (icPkeys),
input '' (icObjectIds),
input '' (icFreeform),
input no (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BSODCategoryExclusion>
if viFcReturnSuper = -4
then viFcReturnSuper = 0.
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
for each tSODExclusion where
(tSODExclusion.tcSODCategory1Code matches icCategoryFilter1 or icCategoryFilter1 = "" or icCategoryFilter1 = ?) and
(tSODExclusion.tcSODCategory2Code matches icCategoryFilter2 or icCategoryFilter2 = "" or icCategoryFilter2 = ?) on error undo, throw:
create tGetSODMatrix.
assign tGetSODMatrix.tcSODCategory1Code = tSODExclusion.tcSODCategory1Code
tGetSODMatrix.tcSODCategory2Code = tSODExclusion.tcSODCategory2Code
tGetSODMatrix.tcExclusionDescription = tSODExclusion.SODExclusionDescription
tGetSODMatrix.tcExclusionLevel = tSODExclusion.SODExclusionLevel.
end.
<Q-27 assign vlFcQueryRecordsAvailable = SystSODRunning (NoCache) () in BSystem>
if vlFcQueryRecordsAvailable
then do:
/* not a good time to do role membership maintenance, please wait for SOD to complete */
vcSODMesg = #T-84'SOD activation is still running.':255(537450102)T-84# + " "
+ #T-67'Please wait for the activation to complete before making security changes.':255(408926714)T-67#.
<M-39 run SetMessage
(input vcSODMesg (icMessage),
input '' (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'W' (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'blf-294152':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BSODCategoryExclusion>
oiReturnStatus = 1.
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 = "BSODCategoryExclusion".
create ttContext.
assign ttContext.propertyName = "methodName"
ttContext.propertyValue = "ApiGetMatrixData".
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/bsodcategoryexclusion.apigetmatrixdata.i.xsd", ?).
vhParameter = vhInputDS:get-buffer-handle("tParameterI").
vhParameter:buffer-create().
assign vhParameter::icCategoryFilter1 = <parameter value>
vhParameter::icCategoryFilter2 = <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.