Package com.denimgroup.threadfix.service.RemoteProviderTypeService

Examples of com.denimgroup.threadfix.service.RemoteProviderTypeService.ResponseCode


    private void processRemoteProviderBulkImport(Integer remoteProviderTypeId, Integer jobStatusId) {
    log.info("Remote Provider Bulk Import job received");
    jobStatusService.updateJobStatus(jobStatusId, "Remote Provider Bulk Import job received");
   
    ResponseCode response = remoteProviderTypeService.importScansForApplications(remoteProviderTypeId);
   
    String message;
   
    switch (response) {
      case BAD_ID:   message = "Remote Provider Bulk Import job failed because no remote provider type was found."; break;
View Full Code Here


    }
   
    remoteProviderTypeService.decryptCredentials(
        remoteProviderApplication.getRemoteProviderType());
   
    ResponseCode response = remoteProviderTypeService.importScansForApplication(remoteProviderApplication);
   
    if (response.equals(ResponseCode.SUCCESS)) {
            return RestResponse.success("Do the redirect");
    } else {
      String errorMsg;
      if (response.equals(ResponseCode.ERROR_NO_SCANS_FOUND)) {
        errorMsg = "No scans were found for this Remote Provider application.";
      } else if (response.equals(ResponseCode.ERROR_NO_NEW_SCANS)) {
        errorMsg = "Application already imported scans from this Remote Provider, no newer scans were found. You have to delete old scans before adding new ones.";
      } else {
        errorMsg = "Error when trying to import scans.";
      }
     
View Full Code Here

  @PreAuthorize("hasRole('ROLE_CAN_MANAGE_REMOTE_PROVIDERS')")
  @RequestMapping(value="/{typeId}/configure", method = RequestMethod.POST)
  public @ResponseBody Object configureFinish(@PathVariable("typeId") int typeId,
      HttpServletRequest request) {
   
    ResponseCode test = remoteProviderTypeService.checkConfiguration(
        request.getParameter("username"),
        request.getParameter("password"),
        request.getParameter("apiKey"),
                request.getParameter("matchSourceNumbers"),
                request.getParameter("platform"),
                typeId);

    if (test.equals(ResponseCode.BAD_ID)) {
      return RestResponse.failure("Unable to find that Remote Provider Type.");
    } else if (test.equals(ResponseCode.NO_APPS)) {

      String error = "We were unable to retrieve a list of applications using these credentials." +
          " Please ensure that the credentials are valid and that there are applications " +
          "available in the account.";
            log.error(error);
      return RestResponse.failure(error);
    } else if (test.equals(ResponseCode.SUCCESS)) {
            RemoteProviderType type = remoteProviderTypeService.load(typeId);
      return ControllerUtils.writeSuccessObjectWithView(type, AllViews.TableRow.class);
    } else {
            log.warn("Response code was not success but we're still returning success. This shouldn't happen.");
            return RestResponse.failure("Response was " + test);
View Full Code Here

TOP

Related Classes of com.denimgroup.threadfix.service.RemoteProviderTypeService.ResponseCode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.