Try OpenEdge Now
skip to main content
Programming Interfaces
Audit Policy Maintenance APIs : Generic utility API : cancel-import-from-xml procedure
 

cancel-import-from-xml procedure

Deletes the persistent procedure started in policies-dataset-read-xml procedure to load an XML file. This should only be called if the call to policies-dataset-read-xml returns a list of duplicate policy names and the caller decides not to call override-policies-from-xml procedure to override the policies.
Parameters: None
Example: The following example is a combination of pseudo-code and ABL that shows how cancel-import-from-xml procedure, policies-dataset-read-xml procedure, and override-policies-from-xml procedure can be used together.
Calling API procedures to import audit policies in XML
{auditing/include/_aud-utils.i}

RUN policies-dataset-read-xml IN hAuditUtils
  (INPUT pcxmlFileName, INPUT-OUTPUT DATASET-HANDLE hAuditDset BY-REFERENCE,
   OUTPUT pcList, OUTPUT pcErrorMsg).

/* Either display error message or confirmation that the policies were
   imported */
IF errorMsg <> "":U THEN
  MESSAGE errorMsg VIEW-AS ALERT-BOX ERROR.
ELSE DO:
  /* check if XML file has policies which already exist */
  IF cDupList <> "" THEN DO:
    MESSAGE "The following policies already exist:" SKIP
      REPLACE(cDupList,",",CHR(10)) SKIP
      "Do you want to override them?" SKIP
      "(If Yes, the listed policies will be deleted and re-imported)"
      VIEW-AS ALERT-BOX QUESTION BUTTON YES-NO UPDATE lChoice AS LOGICAL.
    IF lChoice THEN DO:
      /* User confirmed that he wants to override existing policies, so let's
         pick up from where we left off. Keep the changes. */
      RUN setcursor ("WAIT":U).
      RUN override-policies-from-xml
        (INPUT-OUTPUT DATASET-HANDLE hAuditDset BY-REFERENCE,
         OUTPUT pcErrorMsg).
      RUN setcursor ("":U).
      IF errorMsg <> "" THEN
        MESSAGE errorMsg VIEW-AS ALERT-BOX ERROR.
    END. /* lChoice */
    ELSE DO:
      /* User doesn't want to override policies, to cancel the previous
         request */
      RUN cancel-import-from-xml IN hAuditUtils.
      MESSAGE "Import canceled" VIEW-AS ALERT-BOX INFO.
    END.
  END.
END. /* errorMsg = "" */