Class FortifyClient


  • public class FortifyClient
    extends Object
    FortifyClient is basically a wrapper around SSC's REST client API
    • Constructor Detail

      • FortifyClient

        public FortifyClient()
    • Method Detail

      • init

        public void init​(String uri,
                         String token,
                         ProxyConfig proxyConfig,
                         Integer connectTimeoutSeconds,
                         Integer readTimeoutSeconds,
                         Integer writeTimeoutSeconds)
                  throws com.fortify.ssc.restclient.ApiException
        You have to call this init function before performance any operations
        Parameters:
        uri - e.g. https://localhost:8180/ssc
        token - e.g. the AuditToken
        Throws:
        com.fortify.ssc.restclient.ApiException
      • getAllVersionListEx

        public Map<String,​Map<String,​Long>> getAllVersionListEx​(String query,
                                                                            Integer limit)
                                                                     throws com.fortify.ssc.restclient.ApiException
        Retrieve the application version list from SSC
        Throws:
        com.fortify.ssc.restclient.ApiException
      • getVersionListEx

        public Map<String,​Long> getVersionListEx​(Long appId,
                                                       String query,
                                                       int limit)
                                                throws com.fortify.ssc.restclient.ApiException
        Retrieve the application version list for the @appId from SSC
        Throws:
        com.fortify.ssc.restclient.ApiException
      • getProjectList

        public Map<String,​Long> getProjectList​(String query,
                                                     int limit)
                                              throws com.fortify.ssc.restclient.ApiException
        Retrieve the application list from SSC
        Throws:
        com.fortify.ssc.restclient.ApiException
      • getProjectTemplateList

        public Map<String,​String> getProjectTemplateList()
                                                        throws com.fortify.ssc.restclient.ApiException
        Retrieve the issue template list from SSC
        Returns:
        map container where template name maps to template id
        Throws:
        com.fortify.ssc.restclient.ApiException
      • getCloudScanPoolList

        public Map<String,​String> getCloudScanPoolList()
                                                      throws com.fortify.ssc.restclient.ApiException
        Retrieve the CloudScan Pool list from SSC
        Returns:
        map container where pool name maps to pool uuid
        Throws:
        com.fortify.ssc.restclient.ApiException
      • uploadFPR

        public Long uploadFPR​(File fpr,
                              Long appVersionId)
                       throws com.fortify.ssc.restclient.ApiException
        Upload an FPR to SSC server
        Parameters:
        fpr - the FPR file to be uploaded
        appVersionId - the SSC application version ID
        Throws:
        com.fortify.ssc.restclient.ApiException
      • getArtifactInfo

        public com.fortify.ssc.restclient.model.Artifact getArtifactInfo​(Long artifactId)
                                                                  throws com.fortify.ssc.restclient.ApiException
        Throws:
        com.fortify.ssc.restclient.ApiException
      • createProject

        public Long createProject​(String projectName,
                                  String projectVersionName,
                                  String projectTemplateName,
                                  Map<String,​String> attributeNamesAndValues,
                                  PrintWriter log)
                           throws IOException,
                                  com.fortify.ssc.restclient.ApiException
        Create new or retrieve existing application version on SSC
        Parameters:
        projectName - name of the new application
        projectVersionName - version of the new application version
        projectTemplateName - name of the template used for application creation, may be null
        attributeNamesAndValues - attributes for the new application
        log - logger
        Returns:
        Long Application version Id of the created application version
        Throws:
        com.fortify.ssc.restclient.ApiException
        IOException
      • getIssuesByFolderId

        public Map<String,​IssueBean> getIssuesByFolderId​(Long projectVersionId,
                                                               String folderId,
                                                               int startPage,
                                                               int pageSize,
                                                               String filterSet,
                                                               String groupingName,
                                                               String sortOrder,
                                                               Boolean ShowOnlyNewIssues,
                                                               Boolean sortDownNotUp,
                                                               PrintWriter log)
                                                        throws com.fortify.ssc.restclient.ApiException
        Returns all issues in the specified folder with their attributes.
        Parameters:
        projectVersionId - id of the application version to audit
        Throws:
        com.fortify.ssc.restclient.ApiException
      • getGroupingValues

        public Map<String,​List<String>> getGroupingValues​(Long projectVersionId,
                                                                String folderId,
                                                                String filterSet,
                                                                String searchCondition,
                                                                String groupingName,
                                                                String groupingType,
                                                                PrintWriter log)
                                                         throws com.fortify.ssc.restclient.ApiException
        Throws:
        com.fortify.ssc.restclient.ApiException
      • getGroupingValues

        public Map<String,​List<String>> getGroupingValues​(Long projectVersionId,
                                                                String folderId,
                                                                String filterSet,
                                                                String searchCondition,
                                                                String groupingName,
                                                                PrintWriter log)
                                                         throws com.fortify.ssc.restclient.ApiException
        Returns all issues matched specified search condition with their attributes.
        Parameters:
        projectVersionId - id of the application version to audit
        Returns:
        map of attribute id -> list of attributes: package, className, function, sourceFilePath, filePath, lineNumber, url, groupName, assignedUser, category, type, confidence, severity
        Throws:
        com.fortify.ssc.restclient.ApiException
      • getFolderIdToAttributesList

        public Map<String,​List<String>> getFolderIdToAttributesList​(Long versionId,
                                                                          String filterSetGuid,
                                                                          PrintWriter log)
                                                                   throws com.fortify.ssc.restclient.ApiException
        Returns all enabled folder ids with their attributes.
        Parameters:
        versionId - id of the application version to audit
        Returns:
        map of folder id -> list of attributes: name, description, color, totalIssueCount
        Throws:
        com.fortify.ssc.restclient.ApiException
      • getProjectVersionId

        public Long getProjectVersionId​(String appName,
                                        String appVersionName)
                                 throws com.fortify.ssc.restclient.ApiException
        Retrieves application version id from SSC by given application name and application version name.
        Parameters:
        appName -
        appVersionName -
        Returns:
        application version id
        Throws:
        com.fortify.ssc.restclient.ApiException
      • getGroupingProfiles

        public List<GroupingProfile> getGroupingProfiles​(Long versionId,
                                                         String filterSet,
                                                         PrintWriter log)
                                                  throws com.fortify.ssc.restclient.ApiException
        Throws:
        com.fortify.ssc.restclient.ApiException
      • getFilterSetListEx

        public Map<String,​String> getFilterSetListEx​(Long verId)
                                                    throws com.fortify.ssc.restclient.ApiException
        Retrieve the list of FilterSets for the @verId from SSC
        Throws:
        com.fortify.ssc.restclient.ApiException