Commit 0e88ae75 by nilu

S45723751 # Matchd / Talentology - No Plan [Enhancement] #Ingest not working - URGENT

parent 24ab2c55
...@@ -229,6 +229,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant ...@@ -229,6 +229,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
LogMgr.log(LOG, LogLevel.PROCESSING2 , "processMessage called"); LogMgr.log(LOG, LogLevel.PROCESSING2 , "processMessage called");
String tmpFromAdress = null; String tmpFromAdress = null;
String tmpFromPerson = null;
String tmpReplyTo = null; String tmpReplyTo = null;
String tmpFirstName = null; String tmpFirstName = null;
String tmpLastName = null; String tmpLastName = null;
...@@ -265,14 +266,25 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant ...@@ -265,14 +266,25 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
tmpSubject = message.getSubject(); tmpSubject = message.getSubject();
tmpSentDate = message.getReceivedDate(); tmpSentDate = message.getReceivedDate();
tmpMessageID = ((MimeMessage)message).getMessageID(); tmpMessageID = ((MimeMessage)message).getMessageID();
tmpMessageBody = EmailFetcher.getText(message, new ArrayList());
if(message.getReplyTo() != null && message.getReplyTo().length > 0) if(message.getReplyTo() != null && message.getReplyTo().length > 0)
{ {
tmpReplyTo = ((InternetAddress) message.getReplyTo()[0]).getAddress(); tmpReplyTo = ((InternetAddress) message.getReplyTo()[0]).getAddress();
String name = ((InternetAddress) message.getReplyTo()[0]).getPersonal(); tmpFromPerson = ((InternetAddress) message.getReplyTo()[0]).getPersonal();
if(tmpReplyTo != null && tmpReplyTo.equals("noreply@jobapplications.seek.com.au"))
{
tmpFromPerson = getApplicantName(tmpFromPerson);
Document document = Jsoup.parse(tmpMessageBody);
Element atag = document.select("a[title*=" + tmpFromPerson + "]").first();
tmpReplyTo = atag.text();
}
tmpFirstName = getFirstName(name); tmpFirstName = formatName(getFirstName(tmpFromPerson));
tmpLastName = getLastName(name); tmpLastName = formatName(getLastName(tmpFromPerson));
} }
LogMgr.log(LOG, LogLevel.PROCESSING2 , "Mail Subject:" + tmpSubject, " Address:", tmpFromAdress, " MessageId:", tmpMessageID); LogMgr.log(LOG, LogLevel.PROCESSING2 , "Mail Subject:" + tmpSubject, " Address:", tmpFromAdress, " MessageId:", tmpMessageID);
...@@ -300,7 +312,6 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant ...@@ -300,7 +312,6 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
tmpEmailText = EmailFetcher.getText(message, new ArrayList<>()); tmpEmailText = EmailFetcher.getText(message, new ArrayList<>());
tmpContents = getAttachments(message); tmpContents = getAttachments(message);
tmpMessageBody = EmailFetcher.getText(message, new ArrayList());
} }
catch (MessagingException | IOException ex) catch (MessagingException | IOException ex)
{ {
...@@ -351,7 +362,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant ...@@ -351,7 +362,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
// handle seek email // handle seek email
if(replyTo == null || replyTo.isEmpty()) if(replyTo == null || replyTo.isEmpty())
{ {
// might have to check email body if reply to is not set // email body is checked - retriving a tag with title="Email applicant name"
return; return;
} }
...@@ -543,11 +554,21 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant ...@@ -543,11 +554,21 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
return ((name.split("\\w+").length > 1) && (name.lastIndexOf(' ') > 0 )) ? name.substring(name.lastIndexOf(" ")+1) : ""; return ((name.split("\\w+").length > 1) && (name.lastIndexOf(' ') > 0 )) ? name.substring(name.lastIndexOf(" ")+1) : "";
} }
private static String formatName(String name)
{
return name.length() > 1 ? name.substring(0,1).toUpperCase() + name.substring(1).toLowerCase() : name;
}
public static String getJobIdentifierFromEmail(String strReceipient) public static String getJobIdentifierFromEmail(String strReceipient)
{ {
int index = strReceipient.indexOf('@'); int index = strReceipient.indexOf('@');
return strReceipient.substring(0, index).replace("job", ""); return strReceipient.substring(0, index).replace("job", "");
}
public static String getApplicantName(String strPerson)
{
return strPerson.replace("via SEEK", "").trim();
} }
private static List<FileBinaryContent> getAttachments(Message message) throws IOException, MessagingException private static List<FileBinaryContent> getAttachments(Message message) throws IOException, MessagingException
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment