Commit 8193fd80 by nilu

S36966559 # Client - Incoming Issues (raised by Client) #Capture CL from Indeed application

parent e9ee7e84
......@@ -6,6 +6,7 @@ import javax.mail.*;
import javax.mail.internet.*;
import javax.mail.search.*;
import oneit.appservices.config.ConfigMgr;
import oneit.appservices.documents.HTML2PDF;
import oneit.components.*;
import oneit.email.EmailFetcher;
import oneit.logging.*;
......@@ -14,6 +15,9 @@ import oneit.objstore.services.*;
import oneit.security.SecUser;
import oneit.utils.*;
import oneit.utils.parsers.FieldException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import performa.orm.*;
import performa.orm.types.ApplicationStatus;
......@@ -234,6 +238,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
String tmpRecipient = null;
String tmpJobId = null;
String tmpMessageID = null;
String tmpMessageBody = null;
List<FileBinaryContent> tmpContents;
......@@ -247,6 +252,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
final String emailText;
final String jobIdentifier;
final String messageID;
final String messageBody;
final List<FileBinaryContent> contents;
try
......@@ -293,6 +299,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
tmpEmailText = EmailFetcher.getText(message, new ArrayList<>());
tmpContents = getAttachments(message);
tmpMessageBody = EmailFetcher.getText(message, new ArrayList());
}
catch (MessagingException | IOException ex)
{
......@@ -311,6 +318,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
contents = tmpContents;
emailText = tmpEmailText;
messageID = tmpMessageID;
messageBody = tmpMessageBody;
try
{
......@@ -435,6 +443,21 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
jobApplication.setCV(contents.get(0));
}
Document document = Jsoup.parse(messageBody);
Element table = document.select("table").size() > 14 ? document.select("table").get(14) : null;
if(table != null)
{
Element firstTR = table.select("tr").first();
ByteArrayOutputStream out = new ByteArrayOutputStream();
HTML2PDF.HTML2PDF(firstTR.toString() , out, "");
FileBinaryContent binaryContent = new FileBinaryContent("application/pdf", out.toByteArray(), "CoverLetter");
jobApplication.setCoverLetter(binaryContent);
}
}
private void createEmailMessage(ObjectTransaction objTran, Job job) throws StorageException, FieldException
......
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