Class PolyspaceHelpersUtils


  • public class PolyspaceHelpersUtils
    extends Object
    • Constructor Detail

      • PolyspaceHelpersUtils

        public PolyspaceHelpersUtils()
    • Method Detail

      • isOwnerInFile

        public static Boolean isOwnerInFile​(Path ownerList,
                                            String owner)
                                     throws IOException
        Parameters:
        ownerList - - The owner list file
        owner - - An owner
        Returns:
        true if owner is in ownerList - false otherwise
        Throws:
        IOException - Error while accessing ownerList
      • appendLineInFile

        public static void appendLineInFile​(Path file,
                                            String line)
                                     throws IOException
        Append line with a new line in file
        Parameters:
        file - - Path to a file
        line - - Line string to add
        Throws:
        IOException - Error while accessing file
      • getReportOwner

        public static Path getReportOwner​(Path report,
                                          String owner)
        Build the report-owner filename:
        • Owner is empty: "report" unmodified
        • Report without extension: "report_owner"
        • Report with extension: "report_owner.ext"
        Parameters:
        report - - Path to the report
        owner - - An owner
        Returns:
        The report-owner filename
      • getReportOwnerList

        public static Path getReportOwnerList​(Path report)
        Build the report-owner-list filename: report.owners.list
        Parameters:
        report - - Path to the report
        Returns:
        The report-owner-list filename
      • reportGetColId

        public static int reportGetColId​(String line,
                                         String token)
        Get the column ID of token in line Note that tokens in line are separated by tabs
        Parameters:
        line - - Line string containing the report column names
        token - - Searched token
        Returns:
        The column ID
      • reportFilter

        public static void reportFilter​(Path originalReport,
                                        Path filteredReport,
                                        String owner,
                                        String[] filters)
                                 throws IOException
        Filter originalReport against filters into filteredReport associated with owner
        Parameters:
        originalReport - - Path to original report
        filteredReport - - Path to the new filtered report - it may already exist to allow to append multiple filtered reports
        owner - - The owner for the filtered report - must be a username matching an email as it will also be used to send the email notification
        filters - - An array of strings containing one or more "key" "value" pairs
        Throws:
        IOException - Error while accessing originalReport or filteredReport
      • getCountFindings

        public static long getCountFindings​(Path report)
                                     throws IOException
        Parameters:
        report - - Path to the report
        Returns:
        - Number of findings in report: number of lines - 1 (title line)
        Throws:
        IOException - Error while accessing report
      • getReportStatus

        public static String getReportStatus​(Path report,
                                             long max)
                                      throws IOException
        Parameters:
        report - - Path to the report
        max - - Thereshold for status
        Returns:
        - Job status string: SUCCESS if num findings smaller than max, UNSTABLE otherwise
        Throws:
        IOException - Error while accessing report
      • getAccessResultRunId

        public static String getAccessResultRunId​(Path output)
                                           throws IOException
        Parameters:
        output - - Path to the report
        Returns:
        Result runId
        Throws:
        IOException - Error while accessing output
      • getAccessResultProjectId

        public static String getAccessResultProjectId​(Path output)
                                               throws IOException
        Parameters:
        output - - Path to the report
        Returns:
        Result projectId
        Throws:
        IOException - Error while accessing output
      • getAccessResultUrl

        public static String getAccessResultUrl​(Path output,
                                                String accessURL)
                                         throws IOException
        Parameters:
        output - - Path to the report
        accessURL - - Root Access server URL
        Returns:
        Results URL
        Throws:
        IOException - Error while accessing output