NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package com.scraper.agents.claim.web;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import com.highradius.common.util.HRCLog;
import com.highradius.common.util.HRCLogFactory;
import com.highradius.util.cpa.StringConstants;
import com.scraper.auto.cpa.Account;
import com.scraper.cpa.AgentException;
import com.scraper.cpa.Browser;
import com.scraper.cpa.FieldValuesSet;
import com.scraper.cpa.FormField;
import com.scraper.cpa.PostNavigation;
import com.scraper.cpa.Request;

public class ClaimSpecialityFoodsAutoAgent extends ClaimSpecialityFoodsAgent {

protected SimpleDateFormat checkDateFormatter = new SimpleDateFormat("MM/dd/yyyy");
protected Date latestCheckDate;

@Override
protected List<String> getCheckNumbers(Browser browser, FieldValuesSet fieldValuesSet, Account account) {

//Enter Dates and go
String action=null,url=null;
Matcher commonMatcher;
ArrayList<String> checkNo = new ArrayList<String>();
String fromDate = null, toDate = null;
if(checkDateFormatter!=null) {
fromDate=checkDateFormatter.format(this.fromDate);
toDate=checkDateFormatter.format(this.toDate);
}
fieldValuesSet.getFieldValues("dates").setField("fromDate", fromDate);
fieldValuesSet.getFieldValues("dates").setField("toDate", toDate);
dynamicFormFields(browser, "dates");
String regex_SubmitButton= "submitForm\('DefaultFormName',1,\{'_FORM_SUBMIT_BUTTON':'([^']*)'";
commonMatcher = getMatches(browser,regex_SubmitButton, null);
String SubmitButton = "";
if(commonMatcher.find()) {

SubmitButton = getMatcherGroupData(commonMatcher, 1);
fieldValuesSet.getFieldValues("dates").setField("FORMSUBMITBUTTON", SubmitButton);
}
System.out.println(SubmitButton);

String regex_dates = "method="POST"\s*action="([^"]*)"";
Matcher url_action = getMatches(browser,regex_dates,null);
if(url_action.find()) {

action=getMatcherGroupData(url_action,1).replace(StringConstants.XML_AMPERSAND,StringConstants.AMPERSAND);
}
url = "http://isupplier.dpispecialtyfoods.com";
url =url +action;
System.out.println("nnn");
System.out.println("DATESSSSSSSS");
System.out.println(url);
System.out.println("nnn");

try {
this.navigate(browser, fieldValuesSet, "dates", url);
} catch (AgentException e) {
e.printStackTrace();
}
this.dumpDocument(browser, "dates.html");

//PAGE1
String regexPayment = "<a\s*id="\S*:Check_Number:\d*"\s*title="[^"]*"\s*href="[^"]*"\s*class="[^"]*">([^>]*)</a>";
Matcher paymentNoMatches = getMatches(browser,regexPayment,null);
while(paymentNoMatches.find()) {
String val = getMatcherGroupData(paymentNoMatches,1);
System.out.println("nPAYMENT NUMBERS PAGE1n"+ val +"nn");
checkNo.add(val);
}


//PAGINATION
String regexPagination = "class="x48">(Next) \d*";
Matcher paginationMatches = getMatches(browser,regexPagination,null);
String val = getMatcherGroupData(paginationMatches,1);
if(val.equals("Next"))
checkNo= pagination(browser,fieldValuesSet,checkNo);

//VIEW INVOICES
String regex_ViewInvoices = "<a\s*id="POS_INVOICES" name="POS_INVOICES" title="View Invoices" href="([^"]*)"";
commonMatcher = getMatches(browser,regex_ViewInvoices, null);
action=null;
if(commonMatcher.find()) {
action=getMatcherGroupData(commonMatcher,1).replace(StringConstants.XML_AMPERSAND,StringConstants.AMPERSAND);
}
url = "http://isupplier.dpispecialtyfoods.com";
url = url +action;
System.out.println("nnn");
System.out.println("VIEW INVOICES URL");
System.out.println(url);
System.out.println("nnn");
try {
this.navigate(browser, fieldValuesSet, "viewInvoices",url);
} catch (AgentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
this.dumpDocument(browser, "viewInvoices.html");


return checkNo;
}

protected ArrayList<String> pagination(Browser browser, FieldValuesSet fieldValuesSet, ArrayList<String> checkNo)
{
String regexPagination = "<a\s*onclick="_navBarSubmit\('DefaultFormName', '([^']*)','([^']*)',(\d*),'([^']*)',\s*'([^']*)','([^']*)'\);return false"\s*href="#"\s*class="x48">Next \d*";
Matcher paginationMatches = getMatches(browser,regexPagination,null);
while(paginationMatches.find())
{
String fromDate = checkDateFormatter.format(this.fromDate);
String toDate = checkDateFormatter.format(this.toDate);
String event = getMatcherGroupData(paginationMatches,1);
String source = getMatcherGroupData(paginationMatches,2);
String partialTargets = getMatcherGroupData(paginationMatches,6);
String partial = "true";
String value = getMatcherGroupData(paginationMatches,4);
String size = getMatcherGroupData(paginationMatches,5);
String regex_urlPagination = "method="POST"\s*action="([^"]*)"";
Matcher url_action_page = getMatches(browser,regex_urlPagination,null);
String action=null, url=null;
if(url_action_page.find()) {

action=getMatcherGroupData(url_action_page,1).replace(StringConstants.XML_AMPERSAND,StringConstants.AMPERSAND);
}
url = "http://isupplier.dpispecialtyfoods.com";
url =url +action;
System.out.println("nnn"+"event = "+event);
System.out.println("source = "+ source);
System.out.println("partialtarget = "+ partialTargets);
System.out.println("partial = "+ partial);
System.out.println("value = "+ value);
System.out.println("size = "+ size);
System.out.println("url = "+ url +"nnn");
dynamicFormFields(browser, "pagination");
fieldValuesSet.getFieldValues("pagination").setField("fromDate", fromDate);
fieldValuesSet.getFieldValues("pagination").setField("toDate", toDate);
fieldValuesSet.getFieldValues("pagination").setField("EVENT",event);
fieldValuesSet.getFieldValues("pagination").setField("SOURCE",source);
fieldValuesSet.getFieldValues("pagination").setField("PARTIALTARGETS",partialTargets);
fieldValuesSet.getFieldValues("pagination").setField("PARTIAL",partial);
fieldValuesSet.getFieldValues("pagination").setField("VALUE",value);
fieldValuesSet.getFieldValues("pagination").setField("SIZE",size);


try {
this.navigate(browser, fieldValuesSet, "pagination",url);
} catch (AgentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String filename = "pagination" + value + ".html";
this.dumpDocument(browser,filename);


//CAPTURE PAYMENT NUMBERS
String regexPayment = "<a\s*id="\S*:Check_Number:\d*"\s*title="[^"]*"\s*href="[^"]*"\s*class="[^"]*">([^>]*)</a>";
Matcher paymentNoMatches = getMatches(browser,regexPayment,null);
while(paymentNoMatches.find()) {
String val = getMatcherGroupData(paymentNoMatches,1);
System.out.println("nPAYMENT NUMBERSn"+ val +"nn");
checkNo.add(val);
}
}
return checkNo;
}

// @Override
// protected List<String> getInvoiceNumbers(Browser browser, FieldValuesSet fieldValuesSet, Request rootRequest,
// String checkNumber, Account account) throws AgentException {
// ArrayList<String> invoiceNo = new ArrayList<String>();
// String fromDate = null, toDate = null;
// Matcher commonMatcher;
// if(checkDateFormatter!=null) {
// fromDate=checkDateFormatter.format(this.fromDate);
// toDate=checkDateFormatter.format(this.toDate);
// }
// dynamicFormFields(browser, "getInvoiceNumber");
// fieldValuesSet.getFieldValues("getInvoiceNumber").setField("SEARCHPAYMENTNUMBER", checkNumber);
// fieldValuesSet.getFieldValues("getInvoiceNumber").setField("fromDate", fromDate);
// fieldValuesSet.getFieldValues("getInvoiceNumber").setField("toDate", toDate);
// String regex_SubmitButton= "submitForm\('DefaultFormName',1,\{'_FORM_SUBMIT_BUTTON':'([^']*)'";
// commonMatcher = getMatches(browser,regex_SubmitButton, null);
// if(commonMatcher.find()) {
//
// String SubmitButton = getMatcherGroupData(commonMatcher, 1);
// fieldValuesSet.getFieldValues("getInvoiceNumber").setField("FORMSUBMITBUTTON", SubmitButton);
// System.out.println(SubmitButton);
// }
//
// String regex_enterinvoice = "method="POST"\s*action="([^"]*)">";
// String action=null,url=null;
// Matcher url_action = getMatches(browser,regex_enterinvoice,null);
// if(url_action.find()) {
//
// action=getMatcherGroupData(url_action,1).replace(StringConstants.XML_AMPERSAND,StringConstants.AMPERSAND);
// }
// url = "http://isupplier.dpispecialtyfoods.com";
// url =url +action;
// System.out.println("nnn");
// System.out.println("GET INVOICE NUMBER");
// System.out.println(url);
// System.out.println("nnn");
// this.navigate(browser, fieldValuesSet, "getInvoiceNumber", url);
// String filename = "getInvoiceNumber"+checkNumber+".html";
// this.dumpDocument(browser, filename);
//
//
// String regex_getinvoice = "<a\s*id="\S*:InvoiceNum:\d*"\s*title="([^"]*)"";
// url_action = getMatches(browser,regex_getinvoice,null);
// while(url_action.find()) {
// String val = getMatcherGroupData(url_action,1);
// System.out.println("nINVOICE NUMBERSn"+ val +"nn");
// invoiceNo.add(val);
// }
// return invoiceNo;
// }

protected void dynamicFormFields(Browser browser,String navigationName){
String formfieldRegex = "<input\s*id="([^"]*)"\s*type="hidden"\s*value="([^"]*)"";
Matcher formfieldRegexMatcher = getMatches(browser, formfieldRegex, null);
PostNavigation navigation = (PostNavigation) this.navigationSet.getNavigation(navigationName);
String fieldName = null;
String fieldValue = null;
while(formfieldRegexMatcher.find()){
FormField temp1 = new FormField();
fieldName = getMatcherGroupData(formfieldRegexMatcher, 1);
fieldValue = getMatcherGroupData(formfieldRegexMatcher, 2);
temp1.setName(fieldName);
temp1.setValue(fieldValue);
navigation.addFormFieldOnDuplicate(temp1);
}
}

// protected void dynamicFormFields(Browser browser,String navigationName, PostNavigation navigation){
// String formfieldRegex = "<input\s*id="([^"]*)"\s*type="hidden"\s*value="([^"]*)"";
// Matcher formfieldRegexMatcher = getMatches(browser, formfieldRegex, null);
// String fieldName = null;
// String fieldValue = null;
// while(formfieldRegexMatcher.find()){
// FormField temp1 = new FormField();
// fieldName = getMatcherGroupData(formfieldRegexMatcher, 1);
// fieldValue = getMatcherGroupData(formfieldRegexMatcher, 2);
// temp1.setName(fieldName);
// temp1.setValue(fieldValue);
// navigation.addFormFieldOnDuplicate(temp1);
// }
// }

}

//String regex = "<a\s*id="\S*:Check_Number:\d*"\s*title=""+checkNumber+""\s*href="([^"]*)"\s*class="[^"]*">"+checkNumber+"</a>";
//Matcher commonMatcher = getMatches(browser,regex, null);
//String action=null;
//if(commonMatcher.find()) {
// action=getMatcherGroupData(commonMatcher,1).replace(StringConstants.XML_AMPERSAND,StringConstants.AMPERSAND);
//}
//url =url +action;
//System.out.println("nnn");
//System.out.println("INVOICEEEE");
//System.out.println(url);
//System.out.println("nnn");
//this.navigate(browser, fieldValuesSet, "getInvoiceNumber", url);
//String filename = checkNumber + ".html";
//this.dumpDocument(browser, filename);
//
//String regexInvoice = "<a\s*id="AssocInvoicesRN:InvoiceNum:\d*"\s*title="[^"]*"\s*href="[^"]*"\s*class="\S*">(\S*)</a>";
//
//Matcher invoiceNoMatches = getMatches(browser,regexInvoice,null);
//while(invoiceNoMatches.find()) {
// String value = getMatcherGroupData(invoiceNoMatches,1);
// System.out.println("nn"+ value +"nn");
// invoiceNo.add(value);
//}
//String regexReturntoViewPayments = "<a\s*id="POS_PAYMENTS"\s*name="POS_PAYMENTS"\s*title="View\s*Payments"\s*href="([^"]*)"";
//Matcher commonMatcher1 = getMatches(browser,regexReturntoViewPayments, null);
//String action1=null;
//if(commonMatcher1.find()) {
// action1=getMatcherGroupData(commonMatcher1,1).replace(StringConstants.XML_AMPERSAND,StringConstants.AMPERSAND);
//}
//String url1 = "http://isupplier.dpispecialtyfoods.com";
//url1 =url1 +action1;
//System.out.println("nnn");
//System.out.println("RETURN TO VIEWPAYMENT");
//System.out.println(url1);
//System.out.println("nnn");
//this.navigate(browser, fieldValuesSet, "viewpayments", url1);
//String filename1 = "returntoViewPaymentsfrom" +checkNumber + ".html";
//this.dumpDocument(browser, filename1);
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.