finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))varMiddleName(\")?( )*/*( )*(>|(>))", (subscriber.getMiddleName()!=null) ? subscriber.getMiddleName() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/varLastName(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))varLastName(\")?( )*/*( )*(>|(>))", (subscriber.getLastName()!=null) ? subscriber.getLastName() : "");
UserProxy userproxy;
try {
userproxy = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxy(subscriber,APILocator.getUserAPI().getSystemUser(), false);
} catch (Exception e) {
Logger.error(DeliverCampaignThread.class, e.getMessage(), e);
throw new DotRuntimeException(e.getMessage(), e);
}
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/varLastMessage(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))varLastMessage(\")?( )*/*( )*(>|(>))", (userproxy.getLastMessage()!=null) ? userproxy.getLastMessage() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/varAddress1(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))varAddress1(\")?( )*/*( )*(>|(>))", (address.getStreet1()!=null) ? address.getStreet1() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/varAddress2(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))varAddress2(\")?( )*/*( )*(>|(>))", (address.getStreet2()!=null) ? address.getStreet2() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/varPhone(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))varPhone(\")?( )*/*( )*(>|(>))", (address.getPhone()!=null) ? address.getPhone() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/varState(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))varState(\")?( )*/*( )*(>|(>))", (address.getState()!=null) ? address.getState() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/varCity(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))varCity(\")?( )*/*( )*(>|(>))", (address.getCity()!=null) ? address.getCity() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/varCountry(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))varCountry(\")?( )*/*( )*(>|(>))", (address.getCountry()!=null) ? address.getCountry() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/varZip(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))varZip(\")?( )*/*( )*(>|(>))", (address.getZip()!=null) ? address.getZip() : "");
//gets default company to get locale
Company comp = PublicCompanyFactory.getDefaultCompany();
try {
String var1 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var1");
if (var1!=null) var1 = var1.replaceAll(" ","_");
String var2 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var2");
if (var2!=null) var2 = var2.replaceAll(" ","_");
String var3 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var3");
if (var3!=null) var3 = var3.replaceAll(" ","_");
String var4 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var4");
if (var4!=null) var4 = var4.replaceAll(" ","_");
String var5 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var5");
if (var5!=null) var5 = var5.replaceAll(" ","_");
String var6 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var6");
if (var6!=null) var6 = var6.replaceAll(" ","_");
String var7 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var7");
if (var7!=null) var7 = var7.replaceAll(" ","_");
String var8 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var8");
if (var8!=null) var8 = var8.replaceAll(" ","_");
String var9 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var9");
if (var9!=null) var9 = var9.replaceAll(" ","_");
String var10 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var10");
if (var10!=null) var10 = var10.replaceAll(" ","_");
String var11 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var11");
if (var11!=null) var11 = var11.replaceAll(" ","_");
String var12 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var12");
if (var12!=null) var12 = var12.replaceAll(" ","_");
String var13 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var13");
if (var13!=null) var13 = var13.replaceAll(" ","_");
String var14 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var14");
if (var14!=null) var14 = var14.replaceAll(" ","_");
String var15 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var15");
if (var15!=null) var15 = var15.replaceAll(" ","_");
String var16 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var16");
if (var16!=null) var16 = var16.replaceAll(" ","_");
String var17 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var17");
if (var17!=null) var17 = var17.replaceAll(" ","_");
String var18 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var18");
if (var18!=null) var18 = var18.replaceAll(" ","_");
String var19 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var19");
if (var19!=null) var19 = var19.replaceAll(" ","_");
String var20 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var20");
if (var20!=null) var20 = var20.replaceAll(" ","_");
String var21 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var21");
if (var21!=null) var21 = var21.replaceAll(" ","_");
String var22 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var22");
if (var22!=null) var22 = var22.replaceAll(" ","_");
String var23 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var23");
if (var23!=null) var23 = var23.replaceAll(" ","_");
String var24 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var24");
if (var24!=null) var24 = var24.replaceAll(" ","_");
String var25 = LanguageUtil.get(comp.getCompanyId(), comp.getLocale(), "user.profile.var25");
if (var25!=null) var25 = var25.replaceAll(" ","_");
//additional variables
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var1+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var1 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar1()!=null) ? userproxy.getVar1() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var2+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var2 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar2()!=null) ? userproxy.getVar2() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var3+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var3 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar3()!=null) ? userproxy.getVar3() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var4+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var4 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar4()!=null) ? userproxy.getVar4() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var5+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var5 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar5()!=null) ? userproxy.getVar5() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var6+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var6 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar6()!=null) ? userproxy.getVar6() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var7+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var7 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar7()!=null) ? userproxy.getVar7() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var8+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var8 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar8()!=null) ? userproxy.getVar8() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var9+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var9 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar9()!=null) ? userproxy.getVar9() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var10+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var10 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar10()!=null) ? userproxy.getVar10() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var11+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var11 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar11()!=null) ? userproxy.getVar11() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var12+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var12 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar12()!=null) ? userproxy.getVar12() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var13+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var13 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar13()!=null) ? userproxy.getVar13() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var14+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var14 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar14()!=null) ? userproxy.getVar14() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var15+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var15 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar15()!=null) ? userproxy.getVar15() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var16+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var16 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar16()!=null) ? userproxy.getVar16() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var17+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var17 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar17()!=null) ? userproxy.getVar17() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var18+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var18 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar18()!=null) ? userproxy.getVar18() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var19+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var19 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar19()!=null) ? userproxy.getVar19() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var20+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var20 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar20()!=null) ? userproxy.getVar20() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var21+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var21 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar21()!=null) ? userproxy.getVar21() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var22+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var22 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar22()!=null) ? userproxy.getVar22() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var23+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var23 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar23()!=null) ? userproxy.getVar23() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var24+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var24 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar24()!=null) ? userproxy.getVar24() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/"+var25+"(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))" + var25 + "(\")?( )*/*( )*(>|(>))", (userproxy.getVar25()!=null) ? userproxy.getVar25() : "");
//additional variables
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var1(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var1(\")?( )*/*( )*(>|(>))", (userproxy.getVar1()!=null) ? userproxy.getVar1() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var2(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var2(\")?( )*/*( )*(>|(>))", (userproxy.getVar2()!=null) ? userproxy.getVar2() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var3(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var3(\")?( )*/*( )*(>|(>))", (userproxy.getVar3()!=null) ? userproxy.getVar3() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var4(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var4(\")?( )*/*( )*(>|(>))", (userproxy.getVar4()!=null) ? userproxy.getVar4() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var5(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var5(\")?( )*/*( )*(>|(>))", (userproxy.getVar5()!=null) ? userproxy.getVar5() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var6(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var6(\")?( )*/*( )*(>|(>))", (userproxy.getVar6()!=null) ? userproxy.getVar6() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var7(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var7(\")?( )*/*( )*(>|(>))", (userproxy.getVar7()!=null) ? userproxy.getVar7() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var8(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var8(\")?( )*/*( )*(>|(>))", (userproxy.getVar8()!=null) ? userproxy.getVar8() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var9(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var9(\")?( )*/*( )*(>|(>))", (userproxy.getVar9()!=null) ? userproxy.getVar9() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var10(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var10(\")?( )*/*( )*(>|(>))", (userproxy.getVar10()!=null) ? userproxy.getVar10() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var11(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var11(\")?( )*/*( )*(>|(>))", (userproxy.getVar11()!=null) ? userproxy.getVar11() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var12(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var12(\")?( )*/*( )*(>|(>))", (userproxy.getVar12()!=null) ? userproxy.getVar12() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var13(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var13(\")?( )*/*( )*(>|(>))", (userproxy.getVar13()!=null) ? userproxy.getVar13() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var14(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var14(\")?( )*/*( )*(>|(>))", (userproxy.getVar14()!=null) ? userproxy.getVar14() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var15(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var15(\")?( )*/*( )*(>|(>))", (userproxy.getVar15()!=null) ? userproxy.getVar15() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var16(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var16(\")?( )*/*( )*(>|(>))", (userproxy.getVar16()!=null) ? userproxy.getVar16() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var17(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var17(\")?( )*/*( )*(>|(>))", (userproxy.getVar17()!=null) ? userproxy.getVar17() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var18(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var18(\")?( )*/*( )*(>|(>))", (userproxy.getVar18()!=null) ? userproxy.getVar18() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var19(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var19(\")?( )*/*( )*(>|(>))", (userproxy.getVar19()!=null) ? userproxy.getVar19() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var20(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var20(\")?( )*/*( )*(>|(>))", (userproxy.getVar20()!=null) ? userproxy.getVar20() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var21(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var21(\")?( )*/*( )*(>|(>))", (userproxy.getVar21()!=null) ? userproxy.getVar21() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var22(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var22(\")?( )*/*( )*(>|(>))", (userproxy.getVar22()!=null) ? userproxy.getVar22() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var23(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var23(\")?( )*/*( )*(>|(>))", (userproxy.getVar23()!=null) ? userproxy.getVar23() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var24(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var24(\")?( )*/*( )*(>|(>))", (userproxy.getVar24()!=null) ? userproxy.getVar24() : "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/var25(>|(>))", "");
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))var25(\")?( )*/*( )*(>|(>))", (userproxy.getVar25()!=null) ? userproxy.getVar25() : "");
//Replacing the subscriptions link with the subscriptions dotCMS action path
finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(<))/subcriptionsLink(>|(>))", "");
//Case when the subscriptions link is prepended with the host