private static int checkPassword(String userid, CandidateEntity candidate) { if ((candidate .getCandidateGeneralInformation() .getPassword() .equals(userid))) { // does the password match? if (candidate .getCandidateGeneralInformation() .getResetPassword() .equals("Y")) // and is it the first time logging in? return FIRST_TIME_LOGIN; else return LOGIN_SUCCESSFUL; // password matched and was not the first time login. } else { return LOGIN_FAILED; // password did not match. } }
public static Document performUpdateGeneralInformationXMLInjection(CandidateEntity candidate) { Document targetXMLDoc = loadTargetXMLTemplate("templates/UpdateGeneralInfo.xml"); // Inject general information injectElementValue( targetXMLDoc, candidate.getCandidateGeneralInformation().getDOEntityID(), XPathExpressions.getString("XMLInjector.candidateCommonReference")); injectElementValue( targetXMLDoc, candidate.getCandidateGeneralInformation().getEmergencyContactName(), XPathExpressions.getString("XMLInjector.emergencyContactName")); injectElementValue( targetXMLDoc, candidate.getCandidateGeneralInformation().getEmergencyContactPhone(), XPathExpressions.getString("XMLInjector.emergencyContactPhone")); return targetXMLDoc; }
public static CandidateEntity validateUser(String sssPinNumber, String candidateID) throws CanNotAccessDirectOfficeException { CandidateEntity candidate = new CandidateEntity(); SimpleLayout layout = new SimpleLayout(); FileAppender appender = null; try { appender = new FileAppender(layout, "/logs/dev/candidate/WebSphere_Portal/output1.txt", false); } catch (Exception e) { } logger.addAppender(appender); logger.setLevel(Level.ALL); try { logger.info("PinNumber--> " + sssPinNumber); // logger.info("START CUSTOM: "); candidate = EntityAccessWebService.getCandidateWithDirectTalentID(candidateID); // logger.info("GOT THIS FAR!!"); candidate.setLoginStatus(checkPassword(sssPinNumber, candidate)); } catch (ServerErrorException e) { // TODO Auto-generated catch block e.printStackTrace(); candidate.setLoginStatus(LOGIN_FAILED); } catch (InvalidArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); candidate.setLoginStatus(LOGIN_FAILED); } catch (DataNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); candidate.setLoginStatus(LOGIN_FAILED); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); candidate.setLoginStatus(LOGIN_FAILED); } catch (ServiceException e) { // TODO Auto-generated catch block e.printStackTrace(); candidate.setLoginStatus(LOGIN_FAILED); } return candidate; }
public static Document performUpdateCandidateXMLInjection( CandidateEntity candidate, String countryCode) { Document targetXMLDoc = loadTargetXMLTemplate("templates/UpdateDOCandidate.xml"); CandidateGeneralInformation canGen = candidate.getCandidateGeneralInformation(); CandidateProfile boProfile = candidate.getCandidateDetailsForCountry(countryCode); injectElementValue( targetXMLDoc, canGen.getDOEntityID(), XPathExpressions.getString("XMLInjector.candidateID")); injectElementValue( targetXMLDoc, boProfile.getCountryCode(), XPathExpressions.getString("XMLInjector.bocountry")); injectElementValue( targetXMLDoc, boProfile.isEighteenOrOlder(), XPathExpressions.getString("XMLInjector.over18")); injectElementValue( targetXMLDoc, boProfile.isLegallyEntiltedToWork(), XPathExpressions.getString("XMLInjector.rightToWork")); injectElementAttribute( targetXMLDoc, "different", boProfile.isPayAddressDifferentThanMain(), XPathExpressions.getString("XMLInjector.payAddressDifferent")); injectElementValue( targetXMLDoc, boProfile.isCitizen(), XPathExpressions.getString("XMLInjector.isCitizen")); injectElementValue( targetXMLDoc, boProfile.hasGovernmentID(), XPathExpressions.getString("XMLInjector.hasNationalID")); injectElementValue( targetXMLDoc, boProfile.hasWorkVisa(), XPathExpressions.getString("XMLInjector.hasWorkVisa")); injectElementValue( targetXMLDoc, boProfile.hasCriminalConvictions(), XPathExpressions.getString("XMLInjector.hasCriminalConviction")); injectElementValue( targetXMLDoc, boProfile.isWillingToTakeDrugTest(), XPathExpressions.getString("XMLInjector.willingDrugTest")); injectElementValue( targetXMLDoc, boProfile.acceptDirectDepositByEmail(), XPathExpressions.getString("XMLInjector.electronicStatement")); injectElementValue( targetXMLDoc, boProfile.getWorkVisaExpirationDateXMLValue(), XPathExpressions.getString("XMLInjector.workVisaExpiry")); injectElementValue( targetXMLDoc, boProfile.getPayrollAddress().getPostal_code(), XPathExpressions.getString("XMLInjector.payPostalCode")); injectElementValue( targetXMLDoc, boProfile.getPayrollAddress().getMunicipality(), XPathExpressions.getString("XMLInjector.payMunicipality")); injectElementValue( targetXMLDoc, boProfile.getPayrollAddress().getAddressLine1(), XPathExpressions.getString("XMLInjector.payAddressLine1")); injectElementValue( targetXMLDoc, boProfile.getPayrollAddress().getAddressLine2(), XPathExpressions.getString("XMLInjector.payAddressLine2")); // System.out.println("INJECTOR: "+boProfile.getPayrollAddress().getState_province()); injectElementValue( targetXMLDoc, boProfile.getPayrollAddress().getState_province(), XPathExpressions.getString("XMLInjector.payRegion")); injectElementValue( targetXMLDoc, boProfile.getPayrollAddress().getCountry(), XPathExpressions.getString("XMLInjector.payCountryCode")); // System.out.println("UPDATE CANDIDATE"); // System.out.println(targetXMLDoc.asXML()); injectElementValue( targetXMLDoc, canGen.getDateOfBirthString(), XPathExpressions.getString("XMLInjector.dob")); return targetXMLDoc; }