Package com.denimgroup.threadfix.data.entities

Examples of com.denimgroup.threadfix.data.entities.ScanQueueTask


            checkKeyAndEnterprise(request, OPERATION_QUEUE_SCAN);
        } catch (RestAuthenticationFailedException e) {
            return RestResponse.failure(e.getMessage());
        }

    ScanQueueTask task = scanQueueService.queueScan(applicationId, scannerType);
   
    return RestResponse.success(task);
  }
View Full Code Here


    String result = checkTaskKey(request, scanQueueTaskId);
    if (!result.equals(TASK_KEY_SUCCESS)) {
      return RestResponse.failure(result);
    }
       
    ScanQueueTask myTask = this.scanQueueService.retrieveById(scanQueueTaskId);
    Application taskApp = myTask.getApplication();
   
    //  TODO - Add some checking so you can't just upload any file as the result of a specific scanner's task
    //  For now, passing NULL should force the calculation
    Integer myChannelId = scanTypeCalculationService.calculateScanType(taskApp.getId(), file, null);
   
    try {
      String fileName = scanTypeCalculationService.saveFile(myChannelId, file);
     
      ScanCheckResultBean returnValue = scanService.checkFile(myChannelId, fileName);
     
      if (ScanImportStatus.SUCCESSFUL_SCAN == returnValue.getScanCheckResult()) {
        scanMergeService.saveRemoteScanAndRun(myChannelId, fileName);
        //  Scan has been saved. Let's update the ScanQueueTask
        this.scanQueueService.completeTask(scanQueueTaskId);
        log.info("Results from scan queue task: " + myTask.getId() + " saved successfully.");
        return RestResponse.success(myTask);
      } else if (ScanImportStatus.EMPTY_SCAN_ERROR == returnValue.getScanCheckResult()) {
        String message = "Task appeared to complete successfully, but results provided were empty.";
        this.scanQueueService.failTask(scanQueueTaskId, message);
        log.warn("When saving scan queue task: " + myTask.getId() + ": " + message);
        return RestResponse.failure(message);
      } else {
        String message = "Task appeared to complete successfully, but the scan upload attempt returned this message: " + returnValue.getScanCheckResult();
        this.scanQueueService.failTask(scanQueueTaskId, message);
        log.warn("When saving scan queue task: " + myTask.getId() + ": " + message);
        return RestResponse.failure(message);
      }
    } catch (Exception e) {
      //  Something went wrong trying to save the file. Mark the scan as a failure.
      String message = "Exception thrown while trying to save scan.";
View Full Code Here

    if (taskKey == null) {
      log.warn("Request to " + request.getPathInfo()
          + " did not contain an Task Key.");
      return TASK_KEY_NOT_FOUND_ERROR;
    }
    ScanQueueTask myTask = this.scanQueueService.retrieveById(scanQueueTaskId);
   
    if (myTask.getSecureKey() == null || !myTask.getSecureKey().equals(taskKey)) {
      log.warn("Task key " + taskKey + " is not correct");
      return TASK_KEY_ERROR;
    }

    log.info("Task key was verified ");
View Full Code Here

TOP

Related Classes of com.denimgroup.threadfix.data.entities.ScanQueueTask

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.