public String checkIfUserPresent(String userName) throws UnsupportedEncodingException, ParserConfigurationException, IOException, SAXException, DASTProxyException, XPathExpressionException {
  LOGGER.debug("Inside checkIfUserPresent....1");
  final XPathFactory factory=XPathFactory.newInstance();
  final XPath xpath=factory.newXPath();
  xpath.setNamespaceContext(_nsContext);
  Document response=null;
  try {
    response=sendRESTRequestToASE(AppScanConstants.APPSCAN_USERS_FOLDER_LIST_RELATIVE_URL,"");
    LOGGER.debug("Inside checkIfUserPresent....2...response=" + response);
  }
 catch (  ConnectException ce) {
    LOGGER.error("Could not find the user with userId=" + userName + " in the Backend.");
    LOGGER.error(ce);
    return null;
  }
  LOGGER.debug("Check if user exists in the system. ");
  checkForError(response,null);
  LOGGER.debug("Inside checkIfUserPresent....2.1");
  if (userName.contains("CORP\\")) {
    userName=userName.substring(userName.indexOf("\\") + 1);
  }
  LOGGER.debug("Inside checkIfUserPresent....3");
  String userId=(String)xpath.evaluate("//ase:folder[ase:contact='" + userName + "']/ase:id/text()",response,XPathConstants.STRING);
  LOGGER.debug("Inside checkIfUserPresent....4...userId=" + userId);
  if (AppScanUtils.isNotNull(userId)) {
    return userId;
  }
 else {
    return null;
  }
}

public String checkIfUserPresent ( String userName ) throws UnsupportedEncodingException , ParserConfigurationException , IOException , SAXException , DASTProxyException , XPathExpressionException { LOGGER . debug ( "Inside checkIfUserPresent....1" ) ; final XPathFactory factory = XPathFactory . newInstance ( ) ; final XPath xpath = factory . newXPath ( ) ; xpath . setNamespaceContext ( _nsContext ) ; Document response = null ; try { response = sendRESTRequestToASE ( AppScanConstants . APPSCAN_USERS_FOLDER_LIST_RELATIVE_URL , "" ) ; LOGGER . debug ( "Inside checkIfUserPresent....2...response=" + response ) ; } catch ( ConnectException ce ) { LOGGER . error ( "Could not find the user with userId=" + userName + " in the Backend." ) ; LOGGER . error ( ce ) ; return null ; } LOGGER . debug ( "Check if user exists in the system. " ) ; checkForError ( response , null ) ; LOGGER . debug ( "Inside checkIfUserPresent....2.1" ) ; if ( userName . contains ( "CORP\\" ) ) { userName = userName . substring ( userName . indexOf ( "\\" ) + 1 ) ; } LOGGER . debug ( "Inside checkIfUserPresent....3" ) ; String userId = ( String ) xpath . evaluate ( "//ase:folder[ase:contact='" + userName + "']/ase:id/text()" , response , XPathConstants . STRING ) ; LOGGER . debug ( "Inside checkIfUserPresent....4...userId=" + userId ) ; if ( AppScanUtils . isNotNull ( userId ) ) { return userId ; } else { return null ; } }
check if user folder is present
