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.*; ...@@ -6,6 +6,7 @@ import javax.mail.*;
import javax.mail.internet.*; import javax.mail.internet.*;
import javax.mail.search.*; import javax.mail.search.*;
import oneit.appservices.config.ConfigMgr; import oneit.appservices.config.ConfigMgr;
import oneit.appservices.documents.HTML2PDF;
import oneit.components.*; import oneit.components.*;
import oneit.email.EmailFetcher; import oneit.email.EmailFetcher;
import oneit.logging.*; import oneit.logging.*;
...@@ -14,6 +15,9 @@ import oneit.objstore.services.*; ...@@ -14,6 +15,9 @@ import oneit.objstore.services.*;
import oneit.security.SecUser; import oneit.security.SecUser;
import oneit.utils.*; import oneit.utils.*;
import oneit.utils.parsers.FieldException; 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.*;
import performa.orm.types.ApplicationStatus; import performa.orm.types.ApplicationStatus;
...@@ -234,6 +238,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant ...@@ -234,6 +238,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
String tmpRecipient = null; String tmpRecipient = null;
String tmpJobId = null; String tmpJobId = null;
String tmpMessageID = null; String tmpMessageID = null;
String tmpMessageBody = null;
List<FileBinaryContent> tmpContents; List<FileBinaryContent> tmpContents;
...@@ -247,6 +252,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant ...@@ -247,6 +252,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
final String emailText; final String emailText;
final String jobIdentifier; final String jobIdentifier;
final String messageID; final String messageID;
final String messageBody;
final List<FileBinaryContent> contents; final List<FileBinaryContent> contents;
try try
...@@ -293,6 +299,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant ...@@ -293,6 +299,7 @@ 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)
{ {
...@@ -311,6 +318,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant ...@@ -311,6 +318,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
contents = tmpContents; contents = tmpContents;
emailText = tmpEmailText; emailText = tmpEmailText;
messageID = tmpMessageID; messageID = tmpMessageID;
messageBody = tmpMessageBody;
try try
{ {
...@@ -435,6 +443,21 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant ...@@ -435,6 +443,21 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
jobApplication.setCV(contents.get(0)); 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 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