Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PERFORMA_REPLICA
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Muhammad Usman
PERFORMA_REPLICA
Commits
0e88ae75
Commit
0e88ae75
authored
Aug 08, 2019
by
nilu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
S45723751 # Matchd / Talentology - No Plan [Enhancement] #Ingest not working - URGENT
parent
24ab2c55
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
5 deletions
+26
-5
PerformaEmailFetcher.java
cmsWebApp/src/performa/utils/PerformaEmailFetcher.java
+26
-5
No files found.
cmsWebApp/src/performa/utils/PerformaEmailFetcher.java
View file @
0e88ae75
...
@@ -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
();
tmpFirstName
=
getFirstName
(
name
);
tmpReplyTo
=
atag
.
text
();
tmpLastName
=
getLastName
(
name
);
}
tmpFirstName
=
formatName
(
getFirstName
(
tmpFromPerson
));
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,6 +554,11 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
...
@@ -543,6 +554,11 @@ 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
(
'@'
);
...
@@ -550,6 +566,11 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
...
@@ -550,6 +566,11 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
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
{
{
List
<
FileBinaryContent
>
contents
=
new
ArrayList
<>();
List
<
FileBinaryContent
>
contents
=
new
ArrayList
<>();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment