NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package com.scraper.agents.claim.web;

import java.text.SimpleDateFormat;
import java.util.regex.Matcher;

import com.highradius.util.StringUtils;
import com.highradius.util.cpa.StringConstants;
import com.scraper.agents.base.ClaimAgent;
import com.scraper.cpa.Browser;
import com.scraper.cpa.FieldValuesSet;
import com.scraper.cpa.Node;
import com.scraper.cpa.Request;
import com.scraper.cpa.Response;
import com.scraper.cpa.AgentException;

public class ClaimSpecialityFoodsAgent extends ClaimAgent {
@Override
protected void login(Browser browser, FieldValuesSet fieldValuesSet) throws AgentException {

dateFormat = new SimpleDateFormat(StringConstants.DATE_FORMAT_MMDDYYYY_WITHSLASH);

//Pre login:
this.navigate(browser, fieldValuesSet, "prelogin");
this.dumpDocument(browser, "prelogin.html");


//Login:
String BASE_URL = "http://isupplier.dpispecialtyfoods.com";
String commonRegex = "<\s*input\s*id\s*=\s*"\s*(\S*)\s*"[^>]*?value="(\S*)"";
Matcher commonMatcher = getMatches(browser, commonRegex, null);
while(commonMatcher.find())
{
if(getMatcherGroupData(commonMatcher,1).equals("_AM_TX_ID_FIELD"))
{
String AM = getMatcherGroupData(commonMatcher,2);
fieldValuesSet.getFieldValues("login").setField("AMTXIDFIELD",AM);
System.out.println("AMTX: " + AM);
}
else if(getMatcherGroupData(commonMatcher,1).equals("_FORM")) {
String Form = getMatcherGroupData(commonMatcher, 2);
fieldValuesSet.getFieldValues("login").setField("FORM", Form);
System.out.println("Form: "+Form);
}
else if(getMatcherGroupData(commonMatcher,1).equals("SubmitButton$$unvalidated")) {
String unvalidated = getMatcherGroupData(commonMatcher, 2);
fieldValuesSet.getFieldValues("login").setField("SUBMITBUTTONUNVALIDATED",unvalidated);
System.out.println("Submitunvalidated: "+unvalidated);
}
else if(getMatcherGroupData(commonMatcher,1).equals("SubmitButton$$serverUnvalidated")) {
String serverUnvalidated = getMatcherGroupData(commonMatcher, 2);
fieldValuesSet.getFieldValues("login").setField("SUBMITBUTTONSERVERUNVALIDATED", serverUnvalidated);
System.out.println("SubmitSunvalidated: "+serverUnvalidated);
}
else if(getMatcherGroupData(commonMatcher,1).equals("SubmitButton$$processFormDataCalled")) {
String process = getMatcherGroupData(commonMatcher, 2);
fieldValuesSet.getFieldValues("login").setField("SUBMITBUTTONPROCESSFORMDATACALLED", process);
System.out.println("SBFD: "+ process);
}
else if(getMatcherGroupData(commonMatcher,1).equals("Cancel$$unvalidated")) {
String Cunvalidated = commonMatcher.group(2);
fieldValuesSet.getFieldValues("login").setField("CANCELUNVALIDATED", Cunvalidated);
System.out.println("CU: "+Cunvalidated);
}
else if(getMatcherGroupData(commonMatcher,1).equals("Cancel$$serverUnvalidated")) {
String CSunvalidated = getMatcherGroupData(commonMatcher, 2);
fieldValuesSet.getFieldValues("login").setField("CANCELSERVERUNVALIDATED",CSunvalidated);
System.out.println("CSU: "+CSunvalidated);
}
else if(getMatcherGroupData(commonMatcher,1).equals("Cancel$$processFormDataCalled")) {
String CForm = getMatcherGroupData(commonMatcher, 2);
fieldValuesSet.getFieldValues("login").setField("CANCELPROCESSFORMDATACALLED", CForm);
System.out.println("CForm : "+ CForm);
}
else if(getMatcherGroupData(commonMatcher,1).equals("FORM_MAC_LIST")) {
String list = getMatcherGroupData(commonMatcher, 2);
fieldValuesSet.getFieldValues("login").setField("FORMMACLIST", list);
System.out.println("FML: "+list);
}
}


String regex_access = "name="Accessibility".*?\s*option\s*selected.*?value="(.*?)"";
commonMatcher = getMatches(browser,regex_access, null);
if(commonMatcher.find()) {
String access = getMatcherGroupData(commonMatcher, 1);
fieldValuesSet.getFieldValues("login").setField("ACCESSIBILITY", access);
System.out.println("access: "+access);
}

String regex_SubmitButton= "1,\{.*?_FORM_SUBMIT_BUTTON.*?:'(&#\d*;)?(.*?)'(&#\d*;)?}\)";
commonMatcher = getMatches(browser,regex_SubmitButton, null);
String SubmitButton = "";
if(commonMatcher.find()) {
if(commonMatcher.groupCount()>1)
{
SubmitButton = getMatcherGroupData(commonMatcher, 2);
fieldValuesSet.getFieldValues("login").setField("FORMSUBMITBUTTON", SubmitButton);
}
else
{
SubmitButton = getMatcherGroupData(commonMatcher, 1);
fieldValuesSet.getFieldValues("login").setField("FORMSUBMITBUTTON", SubmitButton);
}

System.out.println("SubmitButton: "+SubmitButton);
}
String action = null;
String regex_url = "POST"\s*action="(.*?)"";
Matcher url_action = getMatches(browser,regex_url,null);

if(url_action.find()) {

action=getMatcherGroupData(url_action,1).replace(StringConstants.XML_AMPERSAND,StringConstants.AMPERSAND);
}
String url = BASE_URL + action;
System.out.println("nnn");
System.out.println("Login url: "+ url);
System.out.println("nnn");
this.navigate(browser,fieldValuesSet,"login",url);
this.dumpDocument(browser,"login.html");

//DPI SUPPLIER NAVIGATION
String regex_nav ="<a\s*id="AppsNavLink"\s*href="([^"]*)"[^>]*>DPI iSupplier Invoice and Payment Inquiry";
url_action = getMatches(browser,regex_nav,null);
if(url_action.find()) {

action=getMatcherGroupData(url_action,1).replace(StringConstants.XML_AMPERSAND,StringConstants.AMPERSAND);
}
System.out.println("nnn");
System.out.println("isupplier url: "+ action);
System.out.println("nnn");
this.navigate(browser, fieldValuesSet, "isupplier", action);
this.dumpDocument(browser, "dpisupplier.html");

//FINANCE NAVIGATION
String regex_finance = "<a\s*id="POS_ACCOUNT"\s*name="POS_ACCOUNT"\s*title="Finance"\s*href="([^"]*)"";
url_action = getMatches(browser,regex_finance,null);
if(url_action.find()) {

action=getMatcherGroupData(url_action,1).replace(StringConstants.XML_AMPERSAND,StringConstants.AMPERSAND);
}
url =BASE_URL+action;
System.out.println("nnn");
System.out.println("FINANCEEEE");
System.out.println(url);
System.out.println("nnn");
this.navigate(browser, fieldValuesSet, "finance", url);
this.dumpDocument(browser, "finance.html");

//VIEW PAYMENT NAVIGATION
String regex_viewpayment = "<a\s*id="POS_PAYMENTS"\s*name="POS_PAYMENTS"\s*title="View\s*Payments"\s*href="([^"]*)"";
url_action = getMatches(browser,regex_viewpayment,null);
if(url_action.find()) {

action=getMatcherGroupData(url_action,1).replace(StringConstants.XML_AMPERSAND,StringConstants.AMPERSAND);
}
url = "http://isupplier.dpispecialtyfoods.com";
url =BASE_URL +action;
System.out.println("nnn");
System.out.println("VIEW PAYMENTTTTTT");
System.out.println(url);
System.out.println("nnn");
this.navigate(browser, fieldValuesSet, "viewpayments", url);
this.dumpDocument(browser, "viewpayments.html");

}
@Override
protected String processClaimRequest(Browser browser,
FieldValuesSet fieldValuesSet, Request claimRequest,
Node claimResponseNode, Response claimResponse) throws AgentException{

// String processingStatus = claimRequest.getRequestMetaData().getErrorCode();
// if(StringUtils.isBlank(processingStatus) || StringConstants.MINUS_ONE.equals(processingStatus)){
// processingStatus = JOB_SUBMITTED_NOT_STARTED_YET;
// }
// String invoiceNumber = claimRequest.getRequestMetaData().getDataKeyValue();
// aggregateData(ClaimAgent.INVOICE_NUMBER, invoiceNumber, claimResponseNode, claimResponse);
// return processingStatus;
return null;
}
}package com.scraper.agents.claim.web;

import java.text.SimpleDateFormat;
import java.util.regex.Matcher;

import com.highradius.util.StringUtils;
import com.highradius.util.cpa.StringConstants;
import com.scraper.agents.base.ClaimAgent;
import com.scraper.cpa.Browser;
import com.scraper.cpa.FieldValuesSet;
import com.scraper.cpa.Node;
import com.scraper.cpa.Request;
import com.scraper.cpa.Response;
import com.scraper.cpa.AgentException;

public class ClaimSpecialityFoodsAgent extends ClaimAgent {
@Override
protected void login(Browser browser, FieldValuesSet fieldValuesSet) throws AgentException {

dateFormat = new SimpleDateFormat(StringConstants.DATE_FORMAT_MMDDYYYY_WITHSLASH);

//Pre login:
this.navigate(browser, fieldValuesSet, "prelogin");
this.dumpDocument(browser, "prelogin.html");


//Login:
String BASE_URL = "http://isupplier.dpispecialtyfoods.com";
String commonRegex = "<\s*input\s*id\s*=\s*"\s*(\S*)\s*"[^>]*?value="(\S*)"";
Matcher commonMatcher = getMatches(browser, commonRegex, null);
while(commonMatcher.find())
{
if(getMatcherGroupData(commonMatcher,1).equals("_AM_TX_ID_FIELD"))
{
String AM = getMatcherGroupData(commonMatcher,2);
fieldValuesSet.getFieldValues("login").setField("AMTXIDFIELD",AM);
System.out.println("AMTX: " + AM);
}
else if(getMatcherGroupData(commonMatcher,1).equals("_FORM")) {
String Form = getMatcherGroupData(commonMatcher, 2);
fieldValuesSet.getFieldValues("login").setField("FORM", Form);
System.out.println("Form: "+Form);
}
else if(getMatcherGroupData(commonMatcher,1).equals("SubmitButton$$unvalidated")) {
String unvalidated = getMatcherGroupData(commonMatcher, 2);
fieldValuesSet.getFieldValues("login").setField("SUBMITBUTTONUNVALIDATED",unvalidated);
System.out.println("Submitunvalidated: "+unvalidated);
}
else if(getMatcherGroupData(commonMatcher,1).equals("SubmitButton$$serverUnvalidated")) {
String serverUnvalidated = getMatcherGroupData(commonMatcher, 2);
fieldValuesSet.getFieldValues("login").setField("SUBMITBUTTONSERVERUNVALIDATED", serverUnvalidated);
System.out.println("SubmitSunvalidated: "+serverUnvalidated);
}
else if(getMatcherGroupData(commonMatcher,1).equals("SubmitButton$$processFormDataCalled")) {
String process = getMatcherGroupData(commonMatcher, 2);
fieldValuesSet.getFieldValues("login").setField("SUBMITBUTTONPROCESSFORMDATACALLED", process);
System.out.println("SBFD: "+ process);
}
else if(getMatcherGroupData(commonMatcher,1).equals("Cancel$$unvalidated")) {
String Cunvalidated = commonMatcher.group(2);
fieldValuesSet.getFieldValues("login").setField("CANCELUNVALIDATED", Cunvalidated);
System.out.println("CU: "+Cunvalidated);
}
else if(getMatcherGroupData(commonMatcher,1).equals("Cancel$$serverUnvalidated")) {
String CSunvalidated = getMatcherGroupData(commonMatcher, 2);
fieldValuesSet.getFieldValues("login").setField("CANCELSERVERUNVALIDATED",CSunvalidated);
System.out.println("CSU: "+CSunvalidated);
}
else if(getMatcherGroupData(commonMatcher,1).equals("Cancel$$processFormDataCalled")) {
String CForm = getMatcherGroupData(commonMatcher, 2);
fieldValuesSet.getFieldValues("login").setField("CANCELPROCESSFORMDATACALLED", CForm);
System.out.println("CForm : "+ CForm);
}
else if(getMatcherGroupData(commonMatcher,1).equals("FORM_MAC_LIST")) {
String list = getMatcherGroupData(commonMatcher, 2);
fieldValuesSet.getFieldValues("login").setField("FORMMACLIST", list);
System.out.println("FML: "+list);
}
}


String regex_access = "name="Accessibility".*?\s*option\s*selected.*?value="(.*?)"";
commonMatcher = getMatches(browser,regex_access, null);
if(commonMatcher.find()) {
String access = getMatcherGroupData(commonMatcher, 1);
fieldValuesSet.getFieldValues("login").setField("ACCESSIBILITY", access);
System.out.println("access: "+access);
}

String regex_SubmitButton= "1,\{.*?_FORM_SUBMIT_BUTTON.*?:'(&#\d*;)?(.*?)'(&#\d*;)?}\)";
commonMatcher = getMatches(browser,regex_SubmitButton, null);
String SubmitButton = "";
if(commonMatcher.find()) {
if(commonMatcher.groupCount()>1)
{
SubmitButton = getMatcherGroupData(commonMatcher, 2);
fieldValuesSet.getFieldValues("login").setField("FORMSUBMITBUTTON", SubmitButton);
}
else
{
SubmitButton = getMatcherGroupData(commonMatcher, 1);
fieldValuesSet.getFieldValues("login").setField("FORMSUBMITBUTTON", SubmitButton);
}

System.out.println("SubmitButton: "+SubmitButton);
}
String action = null;
String regex_url = "POST"\s*action="(.*?)"";
Matcher url_action = getMatches(browser,regex_url,null);

if(url_action.find()) {

action=getMatcherGroupData(url_action,1).replace(StringConstants.XML_AMPERSAND,StringConstants.AMPERSAND);
}
String url = BASE_URL + action;
System.out.println("nnn");
System.out.println("Login url: "+ url);
System.out.println("nnn");
this.navigate(browser,fieldValuesSet,"login",url);
this.dumpDocument(browser,"login.html");

//DPI SUPPLIER NAVIGATION
String regex_nav ="<a\s*id="AppsNavLink"\s*href="([^"]*)"[^>]*>DPI iSupplier Invoice and Payment Inquiry";
url_action = getMatches(browser,regex_nav,null);
if(url_action.find()) {

action=getMatcherGroupData(url_action,1).replace(StringConstants.XML_AMPERSAND,StringConstants.AMPERSAND);
}
System.out.println("nnn");
System.out.println("isupplier url: "+ action);
System.out.println("nnn");
this.navigate(browser, fieldValuesSet, "isupplier", action);
this.dumpDocument(browser, "dpisupplier.html");

//FINANCE NAVIGATION
String regex_finance = "<a\s*id="POS_ACCOUNT"\s*name="POS_ACCOUNT"\s*title="Finance"\s*href="([^"]*)"";
url_action = getMatches(browser,regex_finance,null);
if(url_action.find()) {

action=getMatcherGroupData(url_action,1).replace(StringConstants.XML_AMPERSAND,StringConstants.AMPERSAND);
}
url =BASE_URL+action;
System.out.println("nnn");
System.out.println("FINANCEEEE");
System.out.println(url);
System.out.println("nnn");
this.navigate(browser, fieldValuesSet, "finance", url);
this.dumpDocument(browser, "finance.html");

//VIEW PAYMENT NAVIGATION
String regex_viewpayment = "<a\s*id="POS_PAYMENTS"\s*name="POS_PAYMENTS"\s*title="View\s*Payments"\s*href="([^"]*)"";
url_action = getMatches(browser,regex_viewpayment,null);
if(url_action.find()) {

action=getMatcherGroupData(url_action,1).replace(StringConstants.XML_AMPERSAND,StringConstants.AMPERSAND);
}
url = "http://isupplier.dpispecialtyfoods.com";
url =BASE_URL +action;
System.out.println("nnn");
System.out.println("VIEW PAYMENTTTTTT");
System.out.println(url);
System.out.println("nnn");
this.navigate(browser, fieldValuesSet, "viewpayments", url);
this.dumpDocument(browser, "viewpayments.html");

}
@Override
protected String processClaimRequest(Browser browser,
FieldValuesSet fieldValuesSet, Request claimRequest,
Node claimResponseNode, Response claimResponse) throws AgentException{

// String processingStatus = claimRequest.getRequestMetaData().getErrorCode();
// if(StringUtils.isBlank(processingStatus) || StringConstants.MINUS_ONE.equals(processingStatus)){
// processingStatus = JOB_SUBMITTED_NOT_STARTED_YET;
// }
// String invoiceNumber = claimRequest.getRequestMetaData().getDataKeyValue();
// aggregateData(ClaimAgent.INVOICE_NUMBER, invoiceNumber, claimResponseNode, claimResponse);
// return processingStatus;
return null;
}
     
 
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.