Delete Flatfile After Aggregration

Which IIQ version are you inquiring about?

Version 8.2

Share all details related to your problem, including any error messages you may have received.

I have an application where a flatfile is the data source. From this file, I perform group and account aggregations. Is there a specific place where I should install a rule to remove the file from the server? I’ve checked the application aggregation rules, but nothing seems to fit based on those names. I suspect the custom rule would be fitting, I just need to make sure it happens only after the aggregation is complete. Thanks!

  • PostIterate Rule can be use to delete it or
  • Write a separate rule which reads the application and then delete the file and you can add this rule in Run task and configure the sequential task which first runs the aggregation task and run rule task (which deletes the file)
2 Likes

Ah! Understood. Thank you so much!

You can use the following (untested) PostIterate rule to delete the file(s):

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule language="beanshell" name="PostIterate Rule Delete" type="PostIterate">
  <Description>This rule is called after the connector processes the data in a file.</Description>

  <Source><![CDATA[
import org.apache.commons.io.FileUtils;
import sailpoint.connector.Connector;

// Get the applications configuration and datafile(s)
HashMap appConfig = application.getAttributes();

String datafile = (String)appConfig.get("file"); 
if (datafile != null && !"".equals(datafile) && schema.getObjectType().compareTo(Connector.TYPE_ACCOUNT) == 0) {
  // If files are joined in preIterate hook, make a backup of all those files
  String joined =  (String)appConfig.get("joinedfiles");
  if (joined != null && joined != "") {
    String[] joinedFiles = (String[]) joined.split(";");
    for (String joinedFile : joinedFiles) {
      FileUtils.forceDelete(joinedFile);
    }
  } else {
    FileUtils.forceDelete(datafile);
  }
}
groupfile = (String)appConfig.get("group.file");
if (groupfile != null && !"".equals(groupfile) && schema.getObjectType().compareTo(Connector.TYPE_GROUP) == 0) {
  FileUtils.forceDelete(groupfile);
}
]]></Source>
</Rule>

– Remold

2 Likes

Perfect! Thank you Remold!

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.