public List findMatchingAccounts(String leadCompany, UserInfo userInfo)
{
try {
List accountList = SecurityWrapper.findByAnd("Account", UtilMisc.toList(new EntityExpr("accountName", EntityComparisonOperator.LIKE, leadCompany)),
UtilMisc.toList("companyName"), userInfo, new SecurityLinkInfo("Account", "accountId", true), delegator);
if ( accountList.size() < 1)
{
String companyNameCanon = StringHelper.replaceAll(leadCompany, ",", "");
companyNameCanon = StringHelper.replaceAll(companyNameCanon, ".", "");
companyNameCanon = companyNameCanon.toUpperCase();
String removeStrings[] = { " CORP", " INC" };
for ( int i=0; i < removeStrings.length; i++ )
{
int pos = companyNameCanon.lastIndexOf(removeStrings[i]);
if ( pos > 0 )
companyNameCanon = companyNameCanon.substring(0, pos);
}
companyNameCanon += "%";
accountList = SecurityWrapper.findByAnd("Account", UtilMisc.toList(new EntityExpr("accountName", EntityComparisonOperator.LIKE, companyNameCanon)),
UtilMisc.toList("companyName"), userInfo, new SecurityLinkInfo("Account", "accountId", true), delegator);
}
return accountList;
}
catch ( Exception e)