Commit 0cc24e7c by nilu

S40358962 # Client - Incoming Issues (raised by Client) #Delay/problem with email ingest

parent 104315d4
...@@ -109,15 +109,13 @@ public class JobApplication extends BaseJobApplication ...@@ -109,15 +109,13 @@ public class JobApplication extends BaseJobApplication
if(getCV() != null) if(getCV() != null)
{ {
String contentType = getCV().getContentType(); String contentType = getCV().getContentType();
context.check(contentType.contains("msword") || contentType.contains("doc") || contentType.contains("docx") || contentType.contains("opendocument.text") context.check(Utils.isValidContentType(contentType), this, FIELD_CV, "invalid");
|| contentType.contains("pdf") || contentType.contains("vnd.openxmlformats-officedocument.wordprocessingml.document") , this, FIELD_CV, "invalid");
} }
if(getCoverLetter() != null) if(getCoverLetter() != null)
{ {
String contentType = getCoverLetter().getContentType(); String contentType = getCoverLetter().getContentType();
context.check(contentType.contains("msword") || contentType.contains("doc") || contentType.contains("docx") || contentType.contains("opendocument.text") context.check(Utils.isValidContentType(contentType) , this, FIELD_CoverLetter, "invalid");
|| contentType.contains("pdf") || contentType.contains("vnd.openxmlformats-officedocument.wordprocessingml.document") , this, FIELD_CoverLetter, "invalid");
} }
} }
catch(RuntimeException ex) catch(RuntimeException ex)
......
...@@ -388,12 +388,22 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant ...@@ -388,12 +388,22 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
if(contents.size() > 0) if(contents.size() > 0)
{ {
jobApplication.setCV(contents.get(0)); FileBinaryContent cv = contents.get(0);
if(Utils.isValidContentType(cv.getContentType()))
{
jobApplication.setCV(cv);
}
} }
if(contents.size() > 1) if(contents.size() > 1)
{ {
jobApplication.setCoverLetter(contents.get(1)); FileBinaryContent coverLetter = contents.get(0);
if(Utils.isValidContentType(coverLetter.getContentType()))
{
jobApplication.setCoverLetter(contents.get(1));
}
} }
} }
...@@ -438,9 +448,14 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant ...@@ -438,9 +448,14 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
jobApplication.setApplicationStatus(ApplicationStatus.POST_INGEST); jobApplication.setApplicationStatus(ApplicationStatus.POST_INGEST);
jobApplication.setIsEmailIngest(true); jobApplication.setIsEmailIngest(true);
if(contents.size() > 0) if(contents.size() > 0 )
{ {
jobApplication.setCV(contents.get(0)); FileBinaryContent cv = contents.get(0);
if(Utils.isValidContentType(cv.getContentType()))
{
jobApplication.setCV(cv);
}
} }
Document document = Jsoup.parse(messageBody); Document document = Jsoup.parse(messageBody);
......
...@@ -716,4 +716,10 @@ public class Utils ...@@ -716,4 +716,10 @@ public class Utils
{ {
return request.getSession ().getAttribute (oneit.security.jsp.AssumeUserFP.UNASSUME_SEC_USER_ID) != null; return request.getSession ().getAttribute (oneit.security.jsp.AssumeUserFP.UNASSUME_SEC_USER_ID) != null;
} }
public static boolean isValidContentType(String contentType)
{
return contentType.contains("msword") || contentType.contains("doc") || contentType.contains("docx") || contentType.contains("opendocument.text")
|| contentType.contains("pdf") || contentType.contains("vnd.openxmlformats-officedocument.wordprocessingml.document");
}
} }
\ No newline at end of file
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