Skip to content

Commit f56a308

Browse files
committed
Minor refactoring
1 parent 90e5312 commit f56a308

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

src/main/java/com/olegshan/parser/impl/ParserImpl.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void parse(JobSite jobSite) {
4646
String title = jobParser.getTitle(titleBlock);
4747
String description = jobParser.getDescription(job);
4848
String company = jobParser.getCompany(job, url);
49-
LocalDateTime date = jobParser.getDate(job, url, titleBlock);
49+
LocalDateTime date = jobParser.getDate(job, url);
5050

5151
Job parsedJob = new Job(title, description, company, jobSite.getSiteName(), url, date);
5252
jobService.save(parsedJob);
@@ -56,6 +56,4 @@ public void parse(JobSite jobSite) {
5656
notifier.notifyAdmin(e.getMessage());
5757
}
5858
}
59-
60-
61-
}
59+
}

src/main/java/com/olegshan/parser/siteparsers/DouUaJobParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public DouUaJobParser(JobSite jobSite) {
1919
}
2020

2121
@Override
22-
public LocalDateTime getDate(Element job, String url, Elements titleBlock) throws ParserException {
22+
public LocalDateTime getDate(Element job, String url) throws ParserException {
2323

2424
Document dateDoc = getDoc(url);
2525

src/main/java/com/olegshan/parser/siteparsers/JobParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public String getCompany(Element job, String url) throws ParserException {
6868
return company;
6969
}
7070

71-
public LocalDateTime getDate(Element job, String url, Elements titleBlock) throws ParserException {
71+
public LocalDateTime getDate(Element job, String url) throws ParserException {
7272
String dateLine = job.getElementsByAttributeValue(jobSite.getDateData()[0],
7373
jobSite.getDateData()[1]).text();
7474
check(dateLine, "date", url);

src/main/java/com/olegshan/parser/siteparsers/RabotaUaJobParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public String getCompany(Element job, String url) throws ParserException {
5959
}
6060

6161
@Override
62-
public LocalDateTime getDate(Element job, String url, Elements titleBlock) throws ParserException {
62+
public LocalDateTime getDate(Element job, String url) throws ParserException {
6363
/*
6464
* There are several problems here.
6565
* First: there are two types of date tags, used on rabota.ua on different pages: "d-date" and "datePosted".

src/main/java/com/olegshan/parser/siteparsers/WorkUaJobParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public Elements getTitleBlock(Element job) {
3030
}
3131

3232
@Override
33-
public LocalDateTime getDate(Element job, String url, Elements titleBlock) throws ParserException {
34-
String dateLine = titleBlock.attr("title");
33+
public LocalDateTime getDate(Element job, String url) throws ParserException {
34+
String dateLine = getTitleBlock(job).attr("title");
3535
String[] dateParts = dateLine.substring(dateLine.length() - 8).split(jobSite.getSplit());
3636
check(dateParts, "date parts", url);
3737

0 commit comments

Comments
 (0)