3.2.1.12.1 Running Report Task

The Running Report Task is a task that runs continuously, in a loop, and monitors the Running Report Job Queue. As the server maintains only one Running Report Job Queue, there is only one Running Report Task in the server.

Whenever the Running Report Job Queue is not empty, the task searches for one or more Running Jobs in the queue for which the parent Non-persisted Report Job Instance – identified by the Running Job.Parent reference – has a Running status of FsrmReportRunningStatus_Queued. The task processes each such object by performing the following actions in sequence:

  • Set the parent instance's Running status to FsrmReportRunningStatus_Running.

  • Set the parent instance's Last run time to the current time.

  • For each Report in the parent instance's Report Job.Reports, do the following in sequence:

    • If the Running Job's Running Job.Cancel property is true, skip the remaining report formats.

    • If the Running Job's Running Job.Deprecated property is true, the server SHOULD skip the remaining report formats.<49>

    • Generate a unique file name prefix string, and store it in Report.Last generated file name prefix. See Reports (section 3.2.1.5.2) for information about how to generate this prefix.

    • If Report.Type is FsrmReportType_Unknown, FsrmReportType_AutomaticClassification, or FsrmReportType_Expiration, the server MUST skip this Report.

    • Create an empty volatile list of file references that will be referred to as Report item list for the remaining steps.

    • If Report.Type is FsrmReportType_LargeFiles, for each file whose path resides in at least one of the parent instance's Namespace Roots, include the file in the Report item list:

      • If the Minimum size filter in the report's Filters has its value set to less than or equal to 0 or the size of the file is equal to or larger than the value of the Minimum size filter in the report's Filters, in bytes.

      • If the Name pattern filter in the report's Filters has its value set to Null or the file name matches the wildcard pattern (for more information about matching wildcard characters, see [MSDN-WLD]) in the value of the Name pattern filter.

    • If Report.Type is FsrmReportType_FilesByType, for each file whose path resides in at least one of the parent instance's Namespace Roots:

      • If the File group filter in the report's Filters has its value set to Null, include the file in the Report item list.

      • For each value in the File group filter, find the file group in the List of Persisted File groups with the same File Group.Name. If the file name matches at least one of the file-name patterns in the Members of the file group but does not match any of the file-name patterns in the Non-members of the file group, include the file in the Report item list.

    • If the Report.Type is FsrmReportType_LeastRecentlyAccessed, for each file whose path resides in at least one of the parent instance's Namespace Roots:

      • If the Minimum age filter in the report's Filters has its value set to less than or equal to 0 or the last accessed time of the file plus the value of the Minimum age filter in the report's Filters is larger than the server's current date, include the file in the Report item list.

      • If the Name pattern filter in the report's Filters has its value set to Null or the file name matches the wildcard pattern (for more information about matching wildcard characters, see [MSDN-WLD]) in the value of the Name pattern filter, include the file in the Report item list.

    • If Report.Type is FsrmReportType_MostRecentlyAccessed, for each file whose path resides in at least one of the parent instance's Namespace Roots, include the file in the Report item list:

      • If the Maximum age filter in the report's Filters has its value set to less than or equal to 0 or the last accessed time of the file plus the value of the Maximum age filter in the report's Filters is smaller than or equal to the server's current date.

      • If the Name pattern filter in the report's Filters has its value set to Null or the file name matches the wildcard pattern (for more information about matching wildcard characters, see [MSDN-WLD]) in the value of the Name pattern filter.

    • If Report.Type is FsrmReportType_QuotaUsage, for each directory quota in the List of Persisted Directory whose Directory Quota.Folder path resides within at least one of the parent instance's Namespace Roots, include the directory quota and its Quota usage in the Report item list.

    • If Report.Type is FsrmReportType_FilesByOwner, for each file whose path resides in at least one of the parent instance's Namespace Roots, include the file in the Report item list:

      • If the Owners filter in the report's Filters has its value set to NULL or the file owner is one of the values of the Owners filter in the report's Filters.

      • If the Name pattern filter in the report's Filters has its value set to Null or the file name matches the wildcard pattern (for more information about matching wildcard characters, see [MSDN-WLD]) in the value of the Name pattern filter.

    • If Report.Type is FsrmReportType_ExportReport, for each file whose path resides in at least one of the parent instance's Namespace Roots, include the file in the Report item list.

    • If Report.Type is FsrmReportType_DuplicateFiles, for each file whose path resides in at least one of the parent instance's Namespace Roots and for which a duplicate file is present<50> within the same Namespace Roots, include the file in the Report item list.

    • If Report.Type is FsrmReportType_FileScreenAudit, for each file for which a file screen event was recorded (see section 3.2.7.4) whose path resides in at least one of the parent instance's Namespace Roots, include the file in the Report item list if the Owners filter in the report's Filters has its value set to NULL or the file owner is one of the values of the Owners filter in the report's Filters.

    • If Report.Type is FsrmReportType_FilesByProperty, the server performs the following steps in sequence for each file whose path resides in at least one of the parent instance's Namespace Roots:

      1. If the Name pattern filter in the report's Filters has its value set to Null or the file name matches the wildcard pattern (for more information about matching wildcard characters, see [MSDN-WLD]) in the value of the Name pattern filter, include the file in the Report item list.

      2. Perform the Retrieve Stored Classification Properties for the file.

      3. Perform the Generate New Classification Properties action for the file given the list of Property Definition Instances from the previous action.

      4. Perform the Store classification properties action for the file given the list of Property Definition Instances from the previous action.

      5. If the list of Property Definition Instances for the file includes a Property Definition Instances whose Property definition instance.name is equal to the value of the Property filter in the report's Filters, include the file in the Report item list.

    • If Report.Type is FsrmReportType_FoldersByProperty, the server performs the following steps in sequence for each folder whose path resides in at least one of the parent instance's Namespace Roots:

      1. If the Name pattern filter in the report's Filters has its value set to Null or the file name matches the wildcard pattern (for more information about matching wildcard characters, see [MSDN-WLD]) in the value of the Name pattern filter.

      2. Perform the Retrieve Stored Classification Properties for the folder.

      3. Perform the Generate New Classification Properties action for the folder given the list of Property Definition Instances from the previous action.

      4. If the list of Property Definition Instances for the folder includes a Property Definition Instances whose Property definition instance.name is equal to the value of the Property filter in the report's Filters, Property definition instance.Global and Property definition instance.Secure are set, and Property definition instance.AppliesTo is set to Folders, include the file in the Report item list.

    • For each report format in the parent instance's Report Job.Formats, generate a storage report of that format and of the type specified by Report.Type for the items in the Report item list. If Report.Type is FsrmReportType_ExportReport (0x00000007), Report Job.Formats MUST include FsrmReportFormat_Csv (0x0000004) or FsrmReportFormat_Xml (0x00000005); otherwise, the reports will not be generated and the server will not return an error code.

    • Store all generated reports as files in Reports directory. All file names MUST begin with Report.Last generated file name prefix.

  • When all reports have been generated:

    • Set the parent instance's Last error to an empty string – if no errors occurred – or to a string describing the error encountered.

    • Set the parent instance's Last generated in directory to Reports directory. If there is an associated Persisted report job, also set that object's Last generated in directory to the same value.

    • Send emails with the generated reports to the email address recipient list in the parent instance's Non-Persisted Report Job's Mail to, as follows:

      • If the parent instance's Non-Persisted Report job's Report Job.Mail to is an empty string, the server MUST NOT email the report when the action is run.

      • If the parent instance's Non-Persisted Report job's Report Job.Mail to contains the string "[ADMIN EMAIL]", the server MUST send the report to the Administrator email address (section 3.2.1.9) returned from IFsrmSetting::AdminEmail (get) (section 3.2.4.2.11.5), in addition to other email addresses in Report Job.Mail to, when emailing the report.

    • Remove the Running Job from the Running Report Job Queue.

The order in which the task processes Running Job objects as described above is not deterministic. Also, the task can choose to process multiple Running Jobs in parallel or just one at a time.