public boolean checkIfScanIsNotPresentForUser(final String userId,final String scanId) throws UnsupportedEncodingException, ParserConfigurationException, IOException, SAXException, DASTProxyException, XPathExpressionException {
  LOGGER.debug("Inside checkIfScanIsNotPresentForUser...1");
  boolean retValue=true;
  try {
    final XPathFactory factory=XPathFactory.newInstance();
    final XPath xpath=factory.newXPath();
    LOGGER.debug("Inside checkIfScanIsNotPresentForUser...2");
    xpath.setNamespaceContext(_nsContext);
    Document response=sendRESTRequestToASE(AppScanConstants.APPSCAN_BASE_URL + "folders/" + userId+ "/folderitems","");
    LOGGER.debug("Inside checkIfScanIsNotPresentForUser...3...response...=" + response);
    LOGGER.debug("Check if scan exists in the system. ");
    checkForError(response,null);
    final XPathExpression expr=xpath.compile("//ase:folder-items/ase:content-scan-job[contains(ase:id,'" + scanId + "')]/ase:id/text()");
    LOGGER.debug("Inside checkIfScanIsNotPresentForUser...4....expr=" + expr);
    final String id=(String)expr.evaluate(response,XPathConstants.STRING);
    LOGGER.debug("Inside checkIfScanIsNotPresentForUser...5....id=" + id);
    if (id != null && !id.isEmpty()) {
      LOGGER.debug("Inside checkIfScanIsNotPresentForUser...6");
      retValue=false;
    }
  }
 catch (  ConnectException ce) {
    LOGGER.error("Failed in checking if the scan is present for user...userId=" + userId + " scanId="+ scanId);
    LOGGER.error(ce);
  }
  return retValue;
}

public boolean checkIfScanIsNotPresentForUser ( final String userId , final String scanId ) throws UnsupportedEncodingException , ParserConfigurationException , IOException , SAXException , DASTProxyException , XPathExpressionException { LOGGER . debug ( "Inside checkIfScanIsNotPresentForUser...1" ) ; boolean retValue = true ; try { final XPathFactory factory = XPathFactory . newInstance ( ) ; final XPath xpath = factory . newXPath ( ) ; LOGGER . debug ( "Inside checkIfScanIsNotPresentForUser...2" ) ; xpath . setNamespaceContext ( _nsContext ) ; Document response = sendRESTRequestToASE ( AppScanConstants . APPSCAN_BASE_URL + "folders/" + userId + "/folderitems" , "" ) ; LOGGER . debug ( "Inside checkIfScanIsNotPresentForUser...3...response...=" + response ) ; LOGGER . debug ( "Check if scan exists in the system. " ) ; checkForError ( response , null ) ; final XPathExpression expr = xpath . compile ( "//ase:folder-items/ase:content-scan-job[contains(ase:id,'" + scanId + "')]/ase:id/text()" ) ; LOGGER . debug ( "Inside checkIfScanIsNotPresentForUser...4....expr=" + expr ) ; final String id = ( String ) expr . evaluate ( response , XPathConstants . STRING ) ; LOGGER . debug ( "Inside checkIfScanIsNotPresentForUser...5....id=" + id ) ; if ( id != null && ! id . isEmpty ( ) ) { LOGGER . debug ( "Inside checkIfScanIsNotPresentForUser...6" ) ; retValue = false ; } } catch ( ConnectException ce ) { LOGGER . error ( "Failed in checking if the scan is present for user...userId=" + userId + " scanId=" + scanId ) ; LOGGER . error ( ce ) ; } return retValue ; }
check if the scan is not present in the user folder
