├── src ├── main │ ├── webapp │ │ ├── META-INF │ │ │ └── context.xml │ │ └── WEB-INF │ │ │ └── jsp │ │ │ ├── about.jsp │ │ │ ├── not_found.jsp │ │ │ ├── exception.jsp │ │ │ ├── contact.jsp │ │ │ ├── job.jsp │ │ │ ├── privacy_policy.jsp │ │ │ ├── jobs.jsp │ │ │ ├── search.jsp │ │ │ └── main.jsp │ ├── resources │ │ ├── static │ │ │ ├── img │ │ │ │ ├── java.jpg │ │ │ │ ├── java.png │ │ │ │ ├── net.png │ │ │ │ ├── php.png │ │ │ │ ├── sql.png │ │ │ │ ├── android.png │ │ │ │ ├── bancoaz.png │ │ │ │ ├── bossaz.png │ │ │ │ ├── python.png │ │ │ │ ├── rabotaz.png │ │ │ │ ├── background.png │ │ │ │ ├── developer.png │ │ │ │ ├── jobsearchaz.jpg │ │ │ │ └── developerjobs-logo.jpg │ │ │ └── js │ │ │ │ ├── main.js │ │ │ │ ├── jobs.js │ │ │ │ └── paginathing.js │ │ ├── developer_jobs.sqlite │ │ ├── messages.properties │ │ ├── application.properties │ │ └── logback.xml │ └── java │ │ └── az │ │ └── mm │ │ └── developerjobs │ │ ├── model │ │ ├── Search.java │ │ ├── User.java │ │ └── Pagination.java │ │ ├── constant │ │ ├── JspPages.java │ │ └── ImageSource.java │ │ ├── DeveloperjobsApplication.java │ │ ├── config │ │ ├── Config.java │ │ └── SQLiteDialect.java │ │ ├── repository │ │ └── JobRepository.java │ │ ├── entity │ │ └── JobInfo.java │ │ ├── service │ │ └── JobService.java │ │ └── controller │ │ └── IndexController.java └── test │ └── java │ └── az │ └── mm │ └── developerjobs │ └── DeveloperjobsApplicationTests.java ├── .mvn └── wrapper │ └── maven-wrapper.properties ├── .gitignore ├── README.md ├── nb-configuration.xml ├── pom.xml ├── mvnw.cmd ├── mvnw └── LICENSE /src/main/webapp/META-INF/context.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip 2 | -------------------------------------------------------------------------------- /src/main/resources/static/img/java.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmushfiq/springboot-sqlite-mini-website/HEAD/src/main/resources/static/img/java.jpg -------------------------------------------------------------------------------- /src/main/resources/static/img/java.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmushfiq/springboot-sqlite-mini-website/HEAD/src/main/resources/static/img/java.png -------------------------------------------------------------------------------- /src/main/resources/static/img/net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmushfiq/springboot-sqlite-mini-website/HEAD/src/main/resources/static/img/net.png -------------------------------------------------------------------------------- /src/main/resources/static/img/php.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmushfiq/springboot-sqlite-mini-website/HEAD/src/main/resources/static/img/php.png -------------------------------------------------------------------------------- /src/main/resources/static/img/sql.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmushfiq/springboot-sqlite-mini-website/HEAD/src/main/resources/static/img/sql.png -------------------------------------------------------------------------------- /src/main/resources/developer_jobs.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmushfiq/springboot-sqlite-mini-website/HEAD/src/main/resources/developer_jobs.sqlite -------------------------------------------------------------------------------- /src/main/resources/static/img/android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmushfiq/springboot-sqlite-mini-website/HEAD/src/main/resources/static/img/android.png -------------------------------------------------------------------------------- /src/main/resources/static/img/bancoaz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmushfiq/springboot-sqlite-mini-website/HEAD/src/main/resources/static/img/bancoaz.png -------------------------------------------------------------------------------- /src/main/resources/static/img/bossaz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmushfiq/springboot-sqlite-mini-website/HEAD/src/main/resources/static/img/bossaz.png -------------------------------------------------------------------------------- /src/main/resources/static/img/python.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmushfiq/springboot-sqlite-mini-website/HEAD/src/main/resources/static/img/python.png -------------------------------------------------------------------------------- /src/main/resources/static/img/rabotaz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmushfiq/springboot-sqlite-mini-website/HEAD/src/main/resources/static/img/rabotaz.png -------------------------------------------------------------------------------- /src/main/resources/static/img/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmushfiq/springboot-sqlite-mini-website/HEAD/src/main/resources/static/img/background.png -------------------------------------------------------------------------------- /src/main/resources/static/img/developer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmushfiq/springboot-sqlite-mini-website/HEAD/src/main/resources/static/img/developer.png -------------------------------------------------------------------------------- /src/main/resources/static/img/jobsearchaz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmushfiq/springboot-sqlite-mini-website/HEAD/src/main/resources/static/img/jobsearchaz.jpg -------------------------------------------------------------------------------- /src/main/resources/static/img/developerjobs-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmushfiq/springboot-sqlite-mini-website/HEAD/src/main/resources/static/img/developerjobs-logo.jpg -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/about.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> 4 |

5 |

6 |

7 | 8 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/not_found.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 2 | 3 | 4 | 5 | 6 | NotFound 7 | 8 | 9 |

Not found

10 | 11 | 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | /target/ -------------------------------------------------------------------------------- /src/main/resources/messages.properties: -------------------------------------------------------------------------------- 1 | Size.user.name = Name size must be between 2 and 30 2 | Pattern.user.name = Does not allow number 3 | Email.user.email = Please enter valid email address 4 | NotEmpty.user.email = Please enter email address 5 | NotEmpty.user.message = Please enter your message 6 | 7 | 8 | # use in jsp # 9 | main.footer = Copyright \u00a9 2018. All rights are reserved 10 | about = You can find developer jobs in this website. 11 | 12 | -------------------------------------------------------------------------------- /src/test/java/az/mm/developerjobs/DeveloperjobsApplicationTests.java: -------------------------------------------------------------------------------- 1 | package az.mm.developerjobs; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class DeveloperjobsApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/resources/static/js/main.js: -------------------------------------------------------------------------------- 1 | //Jquery function 2 | (function ($) { 3 | 4 | setFbPage(); 5 | 6 | })(jQuery); 7 | 8 | 9 | function setFbPage() { 10 | var url = window.location.href; 11 | var n = url.indexOf('031'); 12 | if (n !== -1) { 13 | $("#fb-page-az").css("display", "block"); 14 | $("#fb-page-en").css("display", "none"); 15 | } else { 16 | $("#fb-page-az").css("display", "none"); 17 | $("#fb-page-en").css("display", "block"); 18 | } 19 | } -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/exception.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : exception 3 | Created on : Mar 29, 2017, 12:07:09 PM 4 | Author : MM 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | 9 | 10 | 11 | 12 | Exception Page 13 | 14 | 15 |

Something went wrong. Please try later

16 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/java/az/mm/developerjobs/model/Search.java: -------------------------------------------------------------------------------- 1 | package az.mm.developerjobs.model; 2 | 3 | import javax.validation.constraints.Size; 4 | 5 | /** 6 | * 7 | * @author MM 8 | */ 9 | public class Search { 10 | 11 | @Size(min=3, max = 30, message = "Query size must be between 3 and 30") 12 | private String searchText; 13 | 14 | public String getSearchText() { 15 | return searchText; 16 | } 17 | 18 | public void setSearchText(String searchText) { 19 | this.searchText = searchText; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.mvc.view.prefix: /WEB-INF/jsp/ 2 | spring.mvc.view.suffix: .jsp 3 | 4 | # MAIL PROPERTIES # 5 | spring.mail.host = smtp.gmail.com 6 | spring.mail.port = 587 7 | spring.mail.username = your-mail@gmail.com 8 | spring.mail.password = password 9 | spring.mail.properties.mail.smtp.auth = true 10 | spring.mail.properties.mail.smtp.starttls.enable = true 11 | 12 | 13 | # DB PROPERTIES # 14 | spring.datasource.url = jdbc:sqlite::resource:developer_jobs.sqlite 15 | spring.datasource.driver-class-name = org.sqlite.JDBC 16 | #spring.jpa.show-sql=true 17 | #spring.jpa.properties.hibernate.format_sql=true 18 | -------------------------------------------------------------------------------- /src/main/java/az/mm/developerjobs/constant/JspPages.java: -------------------------------------------------------------------------------- 1 | package az.mm.developerjobs.constant; 2 | 3 | /** 4 | * 5 | * @author MM 6 | */ 7 | public class JspPages { 8 | public static final String MAIN = "/WEB-INF/jsp/main.jsp"; 9 | public static final String CONTACT = "/WEB-INF/jsp/contact.jsp"; 10 | public static final String JOBS = "/WEB-INF/jsp/jobs.jsp"; 11 | public static final String JOB = "/WEB-INF/jsp/job.jsp"; 12 | public static final String SEARCH = "/WEB-INF/jsp/search.jsp"; 13 | public static final String ABOUT = "/WEB-INF/jsp/about.jsp"; 14 | public static final String NOT_FOUND = "/WEB-INF/jsp/not_found.jsp"; 15 | public static final String PRIVACY_POLICY = "/WEB-INF/jsp/privacy_policy.jsp"; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/az/mm/developerjobs/constant/ImageSource.java: -------------------------------------------------------------------------------- 1 | package az.mm.developerjobs.constant; 2 | 3 | /** 4 | * 5 | * @author MM 6 | */ 7 | public enum ImageSource { 8 | BOSS_AZ("bossaz.png"), 9 | JOBSEARCH_AZ("jobsearchaz.jpg"), 10 | RABOTA_AZ("rabotaz.png"), 11 | BANCO_AZ("bancoaz.png"), 12 | 13 | JAVA("java.png"), 14 | NET("net.png"), 15 | ANDROID("android.png"), 16 | SQL("sql.png"), 17 | PYTHON("python.png"), 18 | PHP("php.png"), 19 | DEVELOPER("developer.png"); 20 | 21 | private final String imgSource; 22 | private ImageSource(String imgSource){ 23 | this.imgSource = imgSource; 24 | } 25 | 26 | @Override 27 | public String toString() { 28 | return imgSource; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/az/mm/developerjobs/DeveloperjobsApplication.java: -------------------------------------------------------------------------------- 1 | package az.mm.developerjobs; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.builder.SpringApplicationBuilder; 6 | import org.springframework.boot.web.support.SpringBootServletInitializer; 7 | 8 | @SpringBootApplication 9 | public class DeveloperjobsApplication extends SpringBootServletInitializer { 10 | 11 | @Override 12 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 13 | return application.sources(DeveloperjobsApplication.class); 14 | } 15 | 16 | public static void main(String[] args) throws Exception { 17 | SpringApplication.run(DeveloperjobsApplication.class, args); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # springboot-sqlite-mini-website 2 | 3 |
4 | 5 | ### Used technologies: 6 | * Spring Boot 7 | * Spring Data 8 | * SQLite 9 | * EL (jstl) 10 | * jQuery 11 | * Bootstrap 12 | * slf4j+logback 13 | * Java 8 14 | 15 |
16 | 17 | ### Some additional features: 18 | * Sending email with Spring Boot 19 | * Facebook like and comment plugins 20 | * AddToAny share buttons 21 | * Pagination 22 | 23 |
24 | 25 | ### Screenshots: 26 | Screen 1.
27 | ![developer-jobs-1](https://www.mycertnotes.com/wp-content/uploads/2018/05/developer-jobs-1.jpg) 28 |
29 |
30 | Screen 2.
31 | ![developer-jobs-2](https://www.mycertnotes.com/wp-content/uploads/2018/05/developer-jobs-2.jpg) 32 |
33 |
34 | Screen 3.
35 | ![developer-jobs-3](https://image.ibb.co/jbRGMT/developer_jobs_3.jpg) 36 |
37 |
38 | Screen 4.
39 | ![developer-jobs-4](https://www.mycertnotes.com/wp-content/uploads/2018/05/developer-jobs-4.jpg) 40 |
41 |
42 | Screen 5.
43 | ![developer-jobs-5](https://www.mycertnotes.com/wp-content/uploads/2018/05/developer-jobs-5.jpg) 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/main/java/az/mm/developerjobs/config/Config.java: -------------------------------------------------------------------------------- 1 | 2 | package az.mm.developerjobs.config; 3 | 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.context.support.ReloadableResourceBundleMessageSource; 7 | 8 | /** 9 | * 10 | * @author MM 11 | */ 12 | @Configuration 13 | public class Config { 14 | 15 | @Bean(name = "messageSource") 16 | public ReloadableResourceBundleMessageSource messageSource() { 17 | ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); 18 | messageSource.setBasenames("classpath:messages"); 19 | messageSource.setDefaultEncoding("UTF-8"); 20 | return messageSource; 21 | } 22 | 23 | 24 | /* 25 | //This config is added into application.properties file 26 | 27 | @Bean 28 | public DataSource dataSource() { 29 | DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create(); 30 | dataSourceBuilder.driverClassName("org.sqlite.JDBC"); 31 | dataSourceBuilder.url("jdbc:sqlite:D:\\developer_jobs.sqlite"); 32 | return dataSourceBuilder.build(); 33 | } 34 | */ 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/contact.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib uri="http://www.springframework.org/tags/form" prefix="springForm"%> 2 | 3 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
Name:
Email:
Message:
33 |
34 | 35 |
${notif}

36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/main/java/az/mm/developerjobs/model/User.java: -------------------------------------------------------------------------------- 1 | package az.mm.developerjobs.model; 2 | 3 | //import javax.validation.constraints.Email; 4 | //import javax.validation.constraints.NotEmpty; 5 | import javax.validation.constraints.NotNull; 6 | import javax.validation.constraints.Pattern; 7 | import javax.validation.constraints.Size; 8 | import org.hibernate.validator.constraints.Email; 9 | import org.hibernate.validator.constraints.NotEmpty; 10 | 11 | /** 12 | * 13 | * @author MM 14 | */ 15 | public class User { 16 | 17 | /* Message is put in messages.properties file */ 18 | 19 | @NotNull 20 | @Size(min=2, max=30) 21 | @Pattern(regexp = "[^0-9]*") 22 | private String name; 23 | 24 | @NotEmpty 25 | @Email 26 | private String email; 27 | 28 | @NotEmpty 29 | private String message; 30 | 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public void setName(String name) { 37 | this.name = name; 38 | } 39 | 40 | public String getEmail() { 41 | return email; 42 | } 43 | 44 | public void setEmail(String email) { 45 | this.email = email; 46 | } 47 | 48 | public String getMessage() { 49 | return message; 50 | } 51 | 52 | public void setMessage(String message) { 53 | this.message = message; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/az/mm/developerjobs/model/Pagination.java: -------------------------------------------------------------------------------- 1 | 2 | package az.mm.developerjobs.model; 3 | 4 | /** 5 | * 6 | * @author MM 7 | */ 8 | public class Pagination { 9 | private int count; 10 | private int begin; 11 | private int end; 12 | private int prev; 13 | private int next; 14 | 15 | public Pagination() { 16 | } 17 | 18 | public Pagination(int count, int begin, int end, int prev, int next) { 19 | this.count = count; 20 | this.begin = begin; 21 | this.end = end; 22 | this.prev = prev; 23 | this.next = next; 24 | } 25 | 26 | public int getCount() { 27 | return count; 28 | } 29 | 30 | public void setCount(int count) { 31 | this.count = count; 32 | } 33 | 34 | public int getBegin() { 35 | return begin; 36 | } 37 | 38 | public void setBegin(int begin) { 39 | this.begin = begin; 40 | } 41 | 42 | public int getEnd() { 43 | return end; 44 | } 45 | 46 | public void setEnd(int end) { 47 | this.end = end; 48 | } 49 | 50 | public int getPrev() { 51 | return prev; 52 | } 53 | 54 | public void setPrev(int prev) { 55 | this.prev = prev; 56 | } 57 | 58 | public int getNext() { 59 | return next; 60 | } 61 | 62 | public void setNext(int next) { 63 | this.next = next; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/az/mm/developerjobs/repository/JobRepository.java: -------------------------------------------------------------------------------- 1 | package az.mm.developerjobs.repository; 2 | 3 | import az.mm.developerjobs.entity.JobInfo; 4 | import java.util.List; 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.data.domain.Pageable; 7 | import org.springframework.data.jpa.repository.JpaRepository; 8 | import org.springframework.data.jpa.repository.Query; 9 | import org.springframework.data.repository.query.Param; 10 | 11 | /** 12 | * 13 | * @author MM 14 | */ 15 | public interface JobRepository extends JpaRepository { 16 | 17 | JobInfo findById(int id); 18 | 19 | JobInfo findByIdAndUrlSuffix(int id, String urlSuffix); 20 | 21 | List findAllByCountryCode(String countryCode); 22 | 23 | Page findAllByCountryCode(String countryCode, Pageable page); 24 | 25 | int countByCountryCode(String countryCode); 26 | 27 | @Query(value = "select * from all_vacancies where country_code = :countryCode order by id desc limit :start, :limit", nativeQuery = true) 28 | List getJobsWithLimit(@Param("countryCode") String countryCode, @Param("start") int start, @Param("limit") int limit); 29 | 30 | @Query(value = "select * from all_vacancies where job_title like %?1% or company like %?1% or content like %?1% order by id desc", nativeQuery = true) 31 | List searchResult(String searchText); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /nb-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | /less:/css 17 | false 18 | false 19 | 20 | 21 | /scss:/css 22 | 1.7-web 23 | true 24 | js/libs 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/job.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 2 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 3 | 4 |
5 |
6 |

Job Details

7 |
8 |
9 |
10 |
11 | 16 |
17 |

${job.company}

18 |

${job.jobTitle}

19 |
${job.salary}
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |

${job.content}

29 |
30 |
31 |
32 |
33 | 34 |
35 | 36 | 37 | 38 | 39 | 40 |
41 | 42 | 43 |
44 |
45 |
46 | 47 |
48 |
49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/privacy_policy.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : privacy_policy 3 | Created on : Mar 27, 2017, 4:17:33 PM 4 | Author : MM 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | 9 |
10 |
11 |

Privacy Policy

12 |
13 |
14 |
15 |
16 |
17 |

www.developerjobs.info values the privacy of its visitors the following document will explain the type of information we collect. We just collect very basic information in order to maintain member’s profile which includes name/email. To become a register member of www.developerjobs.info visitors provide us name/email with their own consent. Like several other websites we at www.developerjobs.info maintain log files, but it does not include personal identifiable data.

18 |

Third party software like Google analytics helps us to monitor the user trend on our website, the information we collect through Google analytics includes type of browser, IP address of the visitor, referral website, demographic information and other such non identifiable data. And the sole purpose behind is to monitor the user trend on our website and improve our services accordingly.

19 |

Google as third party software use cookies for the processing of ads on our website, www.developerjobs.info also use cookies we keep the record of user preferences, the record of the page user visits and other information that can be sent via browser of visitor.

20 |

Google adsense of other advertisers on www.developerjobs.info use cookies to evaluate and personalize the content on our website you see in the form of ads. These third party advertisers receive your IP address and no other personally identifiable data. All these third party advertisers have their own privacy policy and www.developerjobs.info has no control on their process of collecting information to evaluate the effectiveness of their advertising material. Anyone can visit the privacy statement of these advertisers for additional information.

21 |

If we provide link to third party the responsibility to share personally identifiable information with them rests with you, we do not take any responsibility of the content published on third party website. If you have any question regarding the pricay policy of www.developerjobs.info you can contact us here.

22 |

23 |

24 |
25 |
26 |
27 |
28 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/jobs.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 2 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 3 | 5 | 6 |
7 | Azerbaijan 8 | USA 9 | 10 |
11 | 15 | 20 |
21 |
22 |

23 | 24 | 25 | 26 |
27 |
28 |

${v.location}

29 |
30 |
31 |
32 |
33 | " alt="${v.jobTitle}" class="img-responsive" height="100" width="150"> 34 |
35 |
36 |

${v.company}

37 |

${v.jobTitle}

38 |
${v.salary}
39 |

Deadline: ${v.deadline}

40 |
41 | More info 42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | 50 |
51 | 64 |
65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /src/main/resources/static/js/jobs.js: -------------------------------------------------------------------------------- 1 | 2 | //Jquery function 3 | (function ($) { 4 | var id = getUrlVars()["id"]; 5 | var page = getUrlVars()["page"]; 6 | 7 | if (!isNaN(page)) { 8 | var count = $('#hidCount').val(); 9 | 10 | var row = parseInt(page); 11 | if(count > 10 && row > 6){ 12 | if(row+4 > count){ 13 | row = 6 + (row+4-count); 14 | } else { 15 | row = 6; // >6 olanda hemishe 6-ci yerde olur, ashagidaki istisnadan bashqa.. 16 | } 17 | } 18 | row = row+2; //ilk 2 li tagina gore 19 | 20 | $('#pagination2 > li:nth-child(' + row + ')').addClass("active"); 21 | 22 | if(page === count){ 23 | $('#next').addClass("disabled"); 24 | $('#pagination2 > li:last-child').addClass("disabled"); 25 | } 26 | if(page === '1'){ 27 | $('#prev').addClass("disabled"); 28 | $('#pagination2 > li:first-child').addClass("disabled"); 29 | } 30 | } else { 31 | $('#pagination2 > li:nth-child(3)').addClass("active"); 32 | $('#pagination2 > li:nth-child(1)').addClass("disabled"); 33 | $('#prev').addClass("disabled"); 34 | } 35 | 36 | })(jQuery); 37 | 38 | 39 | function getUrlVars() { 40 | var vars = {}; 41 | var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) { 42 | vars[key] = value; 43 | }); 44 | return vars; 45 | } 46 | 47 | function getPagination(id, number, home) { 48 | $.get(home + "/ajax/pagination?id=" + id + "&page=" + number, function (data, status) { 49 | console.log(data); 50 | $("#main-content").html(data); 51 | var row = parseInt(number) + 1; 52 | $('#pagination1 > li:nth-child(' + row + ')').addClass("active"); 53 | }); 54 | } 55 | 56 | 57 | function setContent(id, home) { 58 | $.get(home + "/jobDetailAjax?id=" + id, function (data, status) { 59 | $("#modal2").html(data); 60 | }); 61 | getContentAsJson(id, home); 62 | } 63 | 64 | 65 | function getContentAsJson(id, home) { 66 | 67 | // var search = {} 68 | // search["username"] = $("#username").val(); 69 | // search["email"] = $("#email").val(); 70 | 71 | $.ajax({ 72 | type: "POST", 73 | contentType: "application/json", 74 | url: home + "/ajax/jobDetailJson", 75 | data: JSON.stringify(id), 76 | dataType: 'json', 77 | timeout: 100000, 78 | success: function (data) { 79 | console.log("SUCCESS: ", data); 80 | display(data, home); 81 | }, 82 | error: function (e) { 83 | console.log("ERROR: ", e); 84 | displayError(e); 85 | }, 86 | done: function (e) { 87 | console.log("DONE"); 88 | } 89 | }); 90 | } 91 | 92 | 93 | function display(data, home) { 94 | var job = data.result; 95 | var id = job.id; 96 | var company = job.company.replace(/ /g, '-').split('/').join('-'); 97 | var jobTitle = job.jobTitle.replace(/ /g, '-').split('/').join('-'); 98 | var jobSource = job.link; 99 | $("#jobId").attr("href", home + "/job/" + id + "/" + company + "-" + jobTitle); 100 | $("#jobSource").attr("href", jobSource); 101 | } 102 | 103 | 104 | function displayError(data) { 105 | var json = "

Ajax Response

" + JSON.stringify(data, null, 4) + "
"; 106 | $('#modal2').html(json); 107 | } 108 | 109 | 110 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/search.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : search 3 | Created on : Mar 21, 2017, 2:03:34 PM 4 | Author : USER 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 9 | 10 | 11 | 36 | 37 | 38 |
39 |
40 |

Found ${searchResult.size()} result for keyword

41 |
42 |
43 |
    44 | 45 | 46 |
  • 47 |
    48 |
    49 | 50 |

    ${v.location}

    51 |
    52 |
    53 |
    54 |
    55 |
    56 | " alt="${v.jobTitle}" class="img-responsive" height="100" width="150"> 57 |
    58 |
    59 |

    ${v.jobTitle} - ${v.company}

    60 |
    ${v.insertDate}
    61 |
    62 |
    63 |
    64 |
    65 |
  • 66 |
    67 |
    68 |
69 | 70 | 71 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{35} - %msg%n 9 | 10 | 11 | 12 | 13 | 14 | 15 | ${APP_LOG_PATH}/error.log 16 | 17 | ERROR 18 | ACCEPT 19 | DENY 20 | 21 | 22 | ${APP_LOG_PATH}/error_%i.log 23 | 1 24 | 10 25 | 26 | 27 | 10MB 28 | 29 | 30 | %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{35} - %msg%n 31 | 32 | 33 | 34 | 55 | 56 | 57 | 58 | ${APP_LOG_PATH}/general.html 59 | 60 | 61 | ${APP_LOG_PATH}/general.%d{yyyy-MM-dd}.%i.html 62 | 63 | 64 | 10MB 65 | 66 | 67 | 30 68 | 69 | 70 | UTF-8 71 | 72 | %d{HH:mm:ss.SSS}%thread%level%logger%line%msg 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /src/main/java/az/mm/developerjobs/entity/JobInfo.java: -------------------------------------------------------------------------------- 1 | package az.mm.developerjobs.entity; 2 | 3 | import java.io.Serializable; 4 | import javax.persistence.*; 5 | 6 | /** 7 | * 8 | * @author MM 9 | */ 10 | @Entity 11 | @Table(name = "all_vacancies") 12 | public class JobInfo implements Serializable { 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | @Id 17 | @GeneratedValue(strategy = GenerationType.IDENTITY) 18 | private int id; 19 | private String link; 20 | private String jobTitle; 21 | private String company; 22 | private String salary; 23 | private String published; 24 | private String deadline; 25 | private String website; 26 | private String content; 27 | private String insertDate; 28 | private String jobType; 29 | private String location; 30 | private String countryCode; 31 | private String urlSuffix; 32 | @Transient 33 | private String imageSrc; 34 | 35 | 36 | public JobInfo() {} 37 | 38 | 39 | public String getJobTitle() { 40 | return jobTitle; 41 | } 42 | 43 | public void setJobTitle(String jobTitle) { 44 | this.jobTitle = jobTitle; 45 | } 46 | 47 | public String getCompany() { 48 | return company; 49 | } 50 | 51 | public void setCompany(String company) { 52 | this.company = company; 53 | } 54 | 55 | public String getSalary() { 56 | return salary; 57 | } 58 | 59 | public void setSalary(String salary) { 60 | this.salary = salary; 61 | } 62 | 63 | public String getPublished() { 64 | return published; 65 | } 66 | 67 | public void setPublished(String published) { 68 | this.published = published; 69 | } 70 | 71 | public String getDeadline() { 72 | return deadline; 73 | } 74 | 75 | public void setDeadline(String deadline) { 76 | this.deadline = deadline; 77 | } 78 | 79 | public String getLink() { 80 | return link; 81 | } 82 | 83 | public void setLink(String link) { 84 | this.link = link; 85 | } 86 | 87 | public String getWebsite() { 88 | return website; 89 | } 90 | 91 | public void setWebsite(String website) { 92 | this.website = website; 93 | } 94 | 95 | public int getId() { 96 | return id; 97 | } 98 | 99 | public void setId(int id) { 100 | this.id = id; 101 | } 102 | 103 | public String getContent() { 104 | return content; 105 | } 106 | 107 | public void setContent(String content) { 108 | this.content = content; 109 | } 110 | 111 | public String getInsertDate() { 112 | return insertDate; 113 | } 114 | 115 | public void setInsertDate(String insertDate) { 116 | this.insertDate = insertDate; 117 | } 118 | 119 | public String getLocation() { 120 | return location; 121 | } 122 | 123 | public void setLocation(String location) { 124 | this.location = location; 125 | } 126 | 127 | public String getCountryCode() { 128 | return countryCode; 129 | } 130 | 131 | public void setCountryCode(String countryCode) { 132 | this.countryCode = countryCode; 133 | } 134 | 135 | public String getJobType() { 136 | return jobType; 137 | } 138 | 139 | public void setJobType(String jobType) { 140 | this.jobType = jobType; 141 | } 142 | 143 | public String getUrlSuffix() { 144 | return urlSuffix; 145 | } 146 | 147 | public void setUrlSuffix(String urlSuffix) { 148 | this.urlSuffix = urlSuffix; 149 | } 150 | 151 | 152 | public String getImageSrc() { 153 | return imageSrc; 154 | } 155 | 156 | public void setImageSrc(String imageSrc) { 157 | this.imageSrc = imageSrc; 158 | } 159 | 160 | } 161 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | az.mm 7 | developerjobs 8 | 1.0-SNAPSHOT 9 | war 10 | 11 | developerjobs 12 | Spring Boot + Spring Data + Sqlite + EL (mini website) 13 | 14 | 15 | org.springframework.boot 16 | spring-boot-starter-parent 17 | 1.4.3.RELEASE 18 | 19 | 20 | 21 | 22 | UTF-8 23 | UTF-8 24 | 1.8 25 | 1.8 26 | 1.8 27 | 5.1.0.Final 28 | 29 | 30 | 31 | 32 | org.springframework.boot 33 | spring-boot-starter-web 34 | 35 | 36 | org.springframework.boot 37 | spring-boot-starter-test 38 | test 39 | 40 | 41 | org.springframework.boot 42 | spring-boot-starter-data-jpa 43 | 44 | 45 | org.springframework.boot 46 | spring-boot-starter-mail 47 | 48 | 49 | org.springframework.boot 50 | spring-boot-starter-tomcat 51 | provided 52 | 53 | 54 | 55 | org.apache.tomcat.embed 56 | tomcat-embed-jasper 57 | provided 58 | 59 | 60 | javax.servlet 61 | jstl 62 | 63 | 64 | org.xerial 65 | sqlite-jdbc 66 | 3.16.1 67 | 68 | 69 | com.zsoltfabok 70 | sqlite-dialect 71 | 1.0 72 | 73 | 74 | org.webjars 75 | bootstrap 76 | 3.3.7 77 | 78 | 79 | org.webjars 80 | jquery 81 | 3.2.0 82 | 83 | 84 | org.webjars 85 | webjars-locator 86 | 0.30 87 | 88 | 89 | 90 | 91 | 92 | 93 | org.springframework.boot 94 | spring-boot-maven-plugin 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 39 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 40 | 41 | @REM set %HOME% to equivalent of $HOME 42 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 43 | 44 | @REM Execute a user defined script before this one 45 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 46 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 47 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 48 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 49 | :skipRcPre 50 | 51 | @setlocal 52 | 53 | set ERROR_CODE=0 54 | 55 | @REM To isolate internal variables from possible post scripts, we use another setlocal 56 | @setlocal 57 | 58 | @REM ==== START VALIDATION ==== 59 | if not "%JAVA_HOME%" == "" goto OkJHome 60 | 61 | echo. 62 | echo Error: JAVA_HOME not found in your environment. >&2 63 | echo Please set the JAVA_HOME variable in your environment to match the >&2 64 | echo location of your Java installation. >&2 65 | echo. 66 | goto error 67 | 68 | :OkJHome 69 | if exist "%JAVA_HOME%\bin\java.exe" goto init 70 | 71 | echo. 72 | echo Error: JAVA_HOME is set to an invalid directory. >&2 73 | echo JAVA_HOME = "%JAVA_HOME%" >&2 74 | echo Please set the JAVA_HOME variable in your environment to match the >&2 75 | echo location of your Java installation. >&2 76 | echo. 77 | goto error 78 | 79 | @REM ==== END VALIDATION ==== 80 | 81 | :init 82 | 83 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 84 | @REM Fallback to current working directory if not found. 85 | 86 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 87 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 88 | 89 | set EXEC_DIR=%CD% 90 | set WDIR=%EXEC_DIR% 91 | :findBaseDir 92 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 93 | cd .. 94 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 95 | set WDIR=%CD% 96 | goto findBaseDir 97 | 98 | :baseDirFound 99 | set MAVEN_PROJECTBASEDIR=%WDIR% 100 | cd "%EXEC_DIR%" 101 | goto endDetectBaseDir 102 | 103 | :baseDirNotFound 104 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 105 | cd "%EXEC_DIR%" 106 | 107 | :endDetectBaseDir 108 | 109 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 110 | 111 | @setlocal EnableExtensions EnableDelayedExpansion 112 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 113 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 114 | 115 | :endReadAdditionalConfig 116 | 117 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 118 | 119 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 120 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 121 | 122 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 123 | if ERRORLEVEL 1 goto error 124 | goto end 125 | 126 | :error 127 | set ERROR_CODE=1 128 | 129 | :end 130 | @endlocal & set ERROR_CODE=%ERROR_CODE% 131 | 132 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 133 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 134 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 135 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 136 | :skipRcPost 137 | 138 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 139 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 140 | 141 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 142 | 143 | exit /B %ERROR_CODE% 144 | -------------------------------------------------------------------------------- /src/main/java/az/mm/developerjobs/config/SQLiteDialect.java: -------------------------------------------------------------------------------- 1 | package az.mm.developerjobs.config; 2 | 3 | import java.sql.Types; 4 | 5 | import org.hibernate.dialect.Dialect; 6 | import org.hibernate.dialect.function.SQLFunctionTemplate; 7 | import org.hibernate.dialect.function.StandardSQLFunction; 8 | import org.hibernate.dialect.function.VarArgsSQLFunction; 9 | import org.hibernate.type.StringType; 10 | 11 | public class SQLiteDialect extends Dialect { 12 | 13 | public SQLiteDialect() { 14 | registerColumnType(Types.BIT, "integer"); 15 | registerColumnType(Types.TINYINT, "tinyint"); 16 | registerColumnType(Types.SMALLINT, "smallint"); 17 | registerColumnType(Types.INTEGER, "integer"); 18 | registerColumnType(Types.BIGINT, "bigint"); 19 | registerColumnType(Types.FLOAT, "float"); 20 | registerColumnType(Types.REAL, "real"); 21 | registerColumnType(Types.DOUBLE, "double"); 22 | registerColumnType(Types.NUMERIC, "numeric"); 23 | registerColumnType(Types.DECIMAL, "decimal"); 24 | registerColumnType(Types.CHAR, "char"); 25 | registerColumnType(Types.VARCHAR, "varchar"); 26 | registerColumnType(Types.LONGVARCHAR, "longvarchar"); 27 | registerColumnType(Types.DATE, "date"); 28 | registerColumnType(Types.TIME, "time"); 29 | registerColumnType(Types.TIMESTAMP, "timestamp"); 30 | registerColumnType(Types.BINARY, "blob"); 31 | registerColumnType(Types.VARBINARY, "blob"); 32 | registerColumnType(Types.LONGVARBINARY, "blob"); 33 | // registerColumnType(Types.NULL, "null"); 34 | registerColumnType(Types.BLOB, "blob"); 35 | registerColumnType(Types.CLOB, "clob"); 36 | registerColumnType(Types.BOOLEAN, "integer"); 37 | 38 | registerFunction("concat", new VarArgsSQLFunction(StringType.INSTANCE, "", "||", "")); 39 | registerFunction("mod", new SQLFunctionTemplate(StringType.INSTANCE, "?1 % ?2")); 40 | registerFunction("substr", new StandardSQLFunction("substr", StringType.INSTANCE)); 41 | registerFunction("substring", new StandardSQLFunction("substr", StringType.INSTANCE)); 42 | } 43 | 44 | public boolean supportsIdentityColumns() { 45 | return true; 46 | } 47 | 48 | /* 49 | public boolean supportsInsertSelectIdentity() { 50 | return true; // As specify in NHibernate dialect 51 | } 52 | */ 53 | public boolean hasDataTypeInIdentityColumn() { 54 | return false; // As specify in NHibernate dialect 55 | } 56 | 57 | /* 58 | public String appendIdentitySelectToInsert(String insertString) { 59 | return new StringBuffer(insertString.length()+30). // As specify in NHibernate dialect 60 | append(insertString). 61 | append("; ").append(getIdentitySelectString()). 62 | toString(); 63 | } 64 | */ 65 | public String getIdentityColumnString() { 66 | // return "integer primary key autoincrement"; 67 | return "integer"; 68 | } 69 | 70 | public String getIdentitySelectString() { 71 | return "select last_insert_rowid()"; 72 | } 73 | 74 | public boolean supportsLimit() { 75 | return true; 76 | } 77 | 78 | protected String getLimitString(String query, boolean hasOffset) { 79 | return new StringBuffer(query.length() + 20). 80 | append(query). 81 | append(hasOffset ? " limit ? offset ?" : " limit ?"). 82 | toString(); 83 | } 84 | 85 | public boolean supportsTemporaryTables() { 86 | return true; 87 | } 88 | 89 | public String getCreateTemporaryTableString() { 90 | return "create temporary table if not exists"; 91 | } 92 | 93 | public boolean dropTemporaryTableAfterUse() { 94 | return false; 95 | } 96 | 97 | public boolean supportsCurrentTimestampSelection() { 98 | return true; 99 | } 100 | 101 | public boolean isCurrentTimestampSelectStringCallable() { 102 | return false; 103 | } 104 | 105 | public String getCurrentTimestampSelectString() { 106 | return "select current_timestamp"; 107 | } 108 | 109 | public boolean supportsUnionAll() { 110 | return true; 111 | } 112 | 113 | public boolean hasAlterTable() { 114 | return false; // As specify in NHibernate dialect 115 | } 116 | 117 | public boolean dropConstraints() { 118 | return false; 119 | } 120 | 121 | public String getAddColumnString() { 122 | return "add column"; 123 | } 124 | 125 | public String getForUpdateString() { 126 | return ""; 127 | } 128 | 129 | public boolean supportsOuterJoinForUpdate() { 130 | return false; 131 | } 132 | 133 | public String getDropForeignKeyString() { 134 | throw new UnsupportedOperationException("No drop foreign key syntax supported by SQLiteDialect"); 135 | } 136 | 137 | public String getAddForeignKeyConstraintString(String constraintName, 138 | String[] foreignKey, String referencedTable, String[] primaryKey, 139 | boolean referencesPrimaryKey) { 140 | throw new UnsupportedOperationException("No add foreign key syntax supported by SQLiteDialect"); 141 | } 142 | 143 | public String getAddPrimaryKeyConstraintString(String constraintName) { 144 | throw new UnsupportedOperationException("No add primary key syntax supported by SQLiteDialect"); 145 | } 146 | 147 | public boolean supportsIfExistsBeforeTableName() { 148 | return true; 149 | } 150 | 151 | public boolean supportsCascadeDelete() { 152 | return false; 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/main.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 2 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 3 | <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> 4 | <%@ taglib prefix="springForm" uri="http://www.springframework.org/tags/form"%> 5 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Developer Jobs 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | );"> 26 | 27 |
28 | 37 | 38 |
39 | 40 | 41 | 63 | 64 |
65 | 66 |
67 | 68 |
69 | 70 | 71 |
72 | 73 |
74 | 75 | 76 | 77 | 78 |
79 | 80 |
81 | 84 |
85 | 86 |
87 |
88 |
89 | 90 |
91 |
92 | 93 |
94 |
95 |
96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /src/main/resources/static/js/paginathing.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery Paginathing 3 | * Paginate Everything 4 | * 5 | * @author Alfred Crosby 6 | * Inspired by http://esimakin.github.io/twbs-pagination/ 7 | */ 8 | 9 | ;(function($, window, document) { 10 | 11 | 'use strict'; 12 | 13 | var Paginator = function(element, options) { 14 | this.el = $(element); 15 | this.options = $.extend({}, $.fn.paginathing.defaults, options); 16 | 17 | this.startPage = 1; 18 | this.currentPage = 1; 19 | this.totalItems = this.el.children().length; 20 | this.totalPages = Math.max( 21 | Math.ceil(this.totalItems / this.options.perPage), 22 | options.limitPagination 23 | ); 24 | this.container = $('').addClass(this.options.containerClass); 25 | this.ul = $('
    ').addClass(this.options.ulClass); 26 | 27 | this.show(this.startPage); 28 | 29 | return this; 30 | } 31 | 32 | Paginator.prototype = { 33 | 34 | pagination: function(type, page) { 35 | var _self = this; 36 | var li = $('
  • '); 37 | var a = $('').attr('href', '#'); 38 | var cssClass = type === 'number' ? _self.options.liClass : type; 39 | var text = type === 'number' ? page : _self.paginationText(type); 40 | 41 | li.addClass(cssClass); 42 | li.data('pagination-type', type); 43 | li.data('page', page); 44 | li.append(a.html(text)); 45 | 46 | return li; 47 | }, 48 | 49 | paginationText: function(type) { 50 | return this.options[type + 'Text']; 51 | }, 52 | 53 | buildPagination: function() { 54 | var _self = this; 55 | var pagination = []; 56 | var prev = _self.currentPage - 1 < _self.startPage ? _self.startPage : _self.currentPage - 1; 57 | var next = _self.currentPage + 1 > _self.totalPages ? _self.totalPages : _self.currentPage + 1; 58 | 59 | var start, end; 60 | var limit = _self.options.limitPagination; 61 | var interval = 2; 62 | 63 | if(limit) { 64 | if(_self.currentPage <= Math.ceil(limit / 2) + 1) { 65 | start = 1; 66 | end = limit; 67 | } else if (_self.currentPage + Math.floor(limit / 2) >= _self.totalPages) { 68 | start = _self.totalPages + 1 - limit; 69 | end = _self.totalPages; 70 | } else { 71 | start = _self.currentPage - Math.ceil(limit / 2); 72 | end = _self.currentPage + Math.floor(limit / 2); 73 | } 74 | } else { 75 | start = _self.startPage; 76 | end = _self.totalPages; 77 | } 78 | 79 | // "First" button 80 | if(_self.options.firstLast) { 81 | pagination.push(_self.pagination('first', _self.startPage)); 82 | } 83 | 84 | // "Prev" button 85 | if(_self.options.prevNext) { 86 | pagination.push(_self.pagination('prev', prev)); 87 | } 88 | 89 | // Pagination 90 | for(var i = start; i <= end; i++) { 91 | pagination.push(_self.pagination('number', i)); 92 | } 93 | 94 | // "Next" button 95 | if(_self.options.prevNext) { 96 | pagination.push(_self.pagination('next', next)); 97 | } 98 | 99 | // "Last" button 100 | if(_self.options.firstLast) { 101 | pagination.push(_self.pagination('last', _self.totalPages)); 102 | } 103 | 104 | return pagination; 105 | }, 106 | 107 | render: function(page) { 108 | var _self = this; 109 | var options = _self.options; 110 | var pagination = _self.buildPagination(); 111 | 112 | // Remove children before re-render (prevent duplicate) 113 | _self.ul.children().remove(); 114 | _self.ul.append(pagination); 115 | 116 | // Manage active DOM 117 | var startAt = page === 1 ? 0 : (page - 1) * options.perPage; 118 | var endAt = page * options.perPage; 119 | 120 | _self.el.children().hide(); 121 | _self.el.children().slice(startAt, endAt).show(); 122 | 123 | // Manage active state 124 | _self.ul.children().each(function() { 125 | var _li = $(this); 126 | var type = _li.data('pagination-type'); 127 | 128 | switch (type) { 129 | case 'number': 130 | if(_li.data('page') === page) { 131 | _li.addClass(options.activeClass); 132 | } 133 | break; 134 | case 'first': 135 | page === _self.startPage && _li.toggleClass(options.disabledClass); 136 | break; 137 | case 'last': 138 | page === _self.totalPages && _li.toggleClass(options.disabledClass); 139 | break; 140 | case 'prev': 141 | (page - 1) < _self.startPage && _li.toggleClass(options.disabledClass); 142 | break; 143 | case 'next': 144 | (page + 1) > _self.totalPages && _li.toggleClass(options.disabledClass); 145 | break; 146 | default: 147 | break; 148 | } 149 | }); 150 | 151 | // If insertAfter is defined 152 | if(options.insertAfter) { 153 | _self.container 154 | .append(_self.ul) 155 | .insertAfter($(options.insertAfter)); 156 | } else { 157 | _self.el 158 | .after(_self.container.append(_self.ul)); 159 | } 160 | }, 161 | 162 | handle: function() { 163 | var _self = this; 164 | _self.container.find('li').each(function(){ 165 | var _li = $(this); 166 | 167 | _li.click(function(e) { 168 | e.preventDefault(); 169 | var page = _li.data('page'); 170 | 171 | _self.currentPage = page; 172 | _self.show(page); 173 | }); 174 | }); 175 | }, 176 | 177 | show: function(page) { 178 | var _self = this; 179 | 180 | _self.render(page); 181 | _self.handle(); 182 | } 183 | } 184 | 185 | $.fn.paginathing = function(options) { 186 | var _self = this; 187 | var settings = (typeof options === 'object') ? options : {}; 188 | 189 | return _self.each(function(){ 190 | var paginate = new Paginator(this, options); 191 | return paginate; 192 | }); 193 | }; 194 | 195 | $.fn.paginathing.defaults = { 196 | perPage: 10, 197 | limitPagination: false, 198 | prevNext: true, 199 | firstLast: true, 200 | prevText: '«', 201 | nextText: '»', 202 | firstText: 'First', 203 | lastText: 'Last', 204 | containerClass: 'pagination-container', 205 | ulClass: 'pagination', 206 | liClass: 'page', 207 | activeClass: 'active', 208 | disabledClass: 'disabled', 209 | insertAfter: null 210 | } 211 | 212 | }(jQuery, window, document)); 213 | -------------------------------------------------------------------------------- /src/main/java/az/mm/developerjobs/service/JobService.java: -------------------------------------------------------------------------------- 1 | 2 | package az.mm.developerjobs.service; 3 | 4 | import az.mm.developerjobs.constant.ImageSource; 5 | import az.mm.developerjobs.entity.JobInfo; 6 | import az.mm.developerjobs.model.Pagination; 7 | import az.mm.developerjobs.repository.JobRepository; 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | import java.util.stream.Collectors; 11 | import org.slf4j.Logger; 12 | import org.slf4j.LoggerFactory; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.data.domain.PageRequest; 15 | import org.springframework.data.domain.Sort; 16 | import org.springframework.mail.SimpleMailMessage; 17 | import org.springframework.mail.javamail.JavaMailSender; 18 | import org.springframework.stereotype.Service; 19 | 20 | /** 21 | * 22 | * @author MM 23 | */ 24 | @Service 25 | public class JobService { 26 | 27 | private final Logger logger = LoggerFactory.getLogger(JobService.class); 28 | 29 | @Autowired 30 | private JobRepository jobRepository; 31 | 32 | @Autowired 33 | private JavaMailSender javaMailSender; 34 | 35 | 36 | public List getJobsWithLimit(String countryCode, int start) { 37 | List jobs = new ArrayList<>(); 38 | jobRepository.getJobsWithLimit(countryCode, start, 10).forEach((j) -> { 39 | j.setImageSrc(createImageSource(j.getWebsite(), j.getJobTitle())); 40 | jobs.add(j); 41 | }); 42 | 43 | return jobs; 44 | } 45 | 46 | public List getJobsWithPageRequest(String countryCode, int pageIndex) { 47 | PageRequest pageRequest = new PageRequest(pageIndex, 10, Sort.Direction.DESC, "id"); 48 | List jobs = new ArrayList<>(); 49 | jobRepository.findAllByCountryCode(countryCode, pageRequest).forEach((j) -> { 50 | j.setImageSrc(createImageSource(j.getWebsite(), j.getJobTitle())); 51 | jobs.add(j); 52 | }); 53 | 54 | return jobs; 55 | } 56 | 57 | public JobInfo getJob(int id, String title) { 58 | JobInfo job = jobRepository.findByIdAndUrlSuffix(id, title); 59 | if(job != null) 60 | job.setImageSrc(createImageSource(job.getWebsite(), job.getJobTitle())); 61 | return job; 62 | } 63 | 64 | public int countOfVacancy(String countryCode){ 65 | int count = jobRepository.countByCountryCode(countryCode); 66 | return count; 67 | } 68 | 69 | public List caseInsensitiveSearchResult(String searchText) { 70 | List jobs = new ArrayList<>(); 71 | jobRepository.searchResult(searchText).forEach((j) -> { 72 | j.setImageSrc(createImageSource(j.getWebsite(), j.getJobTitle())); 73 | jobs.add(j); 74 | }); 75 | 76 | return jobs; 77 | } 78 | 79 | public List caseSensitiveSearchResult(String searchText) { 80 | List jobs = new ArrayList<>(); 81 | logger.info("Starting search... [{}]", searchText); 82 | jobRepository.findAll() 83 | .parallelStream() 84 | .filter(job -> job.getJobTitle().contains(searchText) 85 | || job.getCompany().contains(searchText) 86 | || job.getContent().contains(searchText)) 87 | .collect(Collectors.toList()) 88 | .forEach((j) -> { 89 | j.setImageSrc(createImageSource(j.getWebsite(), j.getJobTitle())); 90 | jobs.add(j); 91 | }); 92 | logger.info("Ending search..., result: {}", jobs.size()); 93 | 94 | jobs.sort((j1, j2) -> j2.getId() - j1.getId()); 95 | 96 | return jobs; 97 | } 98 | 99 | private String createImageSource(String website, String jobTitle) { 100 | ImageSource imgSource; 101 | switch (website) { 102 | case "boss.az": 103 | imgSource = ImageSource.BOSS_AZ; 104 | break; 105 | case "jobsearch.az": 106 | imgSource = ImageSource.JOBSEARCH_AZ; 107 | break; 108 | case "rabota.az": 109 | imgSource = ImageSource.RABOTA_AZ; 110 | break; 111 | case "banco.az": 112 | imgSource = ImageSource.BANCO_AZ; 113 | break; 114 | case "careerbuilder.com": 115 | case "monster.de": 116 | imgSource = getDeveloperImageUrl(jobTitle); 117 | break; 118 | default: 119 | imgSource = ImageSource.JOBSEARCH_AZ; 120 | } 121 | 122 | return imgSource.toString(); 123 | } 124 | 125 | private ImageSource getDeveloperImageUrl(String jobTitle) { 126 | ImageSource imgSource = ImageSource.DEVELOPER; 127 | if (jobTitle != null) { 128 | jobTitle = jobTitle.toLowerCase(); 129 | 130 | if (jobTitle.contains("java")) { 131 | imgSource = ImageSource.JAVA; 132 | } else if (jobTitle.contains("net")) { 133 | imgSource = ImageSource.NET; 134 | } else if (jobTitle.contains("android")) { 135 | imgSource = ImageSource.ANDROID; 136 | } else if (jobTitle.contains("sql")) { 137 | imgSource = ImageSource.SQL; 138 | } else if (jobTitle.contains("python")) { 139 | imgSource = ImageSource.PYTHON; 140 | } else if (jobTitle.contains("php")) { 141 | imgSource = ImageSource.PHP; 142 | } 143 | } 144 | 145 | return imgSource; 146 | } 147 | 148 | 149 | public Pagination createPagination(String countryCode, int page){ 150 | int vacancyCount = countOfVacancy(countryCode); 151 | int count = (int) Math.ceil(vacancyCount / 10.0); 152 | int prev = (page != 1) ? (page - 1) : 1; 153 | int next = (page != count) ? (page + 1) : count; 154 | 155 | int begin = 1, end = 10; 156 | if (page > 6) { 157 | begin = page - 5; 158 | end = page + 4; 159 | } 160 | if (end > count) { 161 | end = count; 162 | begin = count - 9; 163 | if (begin < 1) begin = 1; 164 | } 165 | 166 | Pagination pagination = new Pagination(count, begin, end, prev, next); 167 | 168 | return pagination; 169 | } 170 | 171 | 172 | public void sendMail(String from, String subject, String message) { 173 | SimpleMailMessage mailMessage = new SimpleMailMessage(); 174 | mailMessage.setTo("contact@developerjobs.info"); //which email you want to send 175 | mailMessage.setFrom(from); 176 | mailMessage.setSubject(subject); 177 | mailMessage.setText(message); 178 | javaMailSender.send(mailMessage); 179 | logger.info("Mail sent"); 180 | } 181 | 182 | } 183 | -------------------------------------------------------------------------------- /mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven2 Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 58 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 59 | if [ -z "$JAVA_HOME" ]; then 60 | if [ -x "/usr/libexec/java_home" ]; then 61 | export JAVA_HOME="`/usr/libexec/java_home`" 62 | else 63 | export JAVA_HOME="/Library/Java/Home" 64 | fi 65 | fi 66 | ;; 67 | esac 68 | 69 | if [ -z "$JAVA_HOME" ] ; then 70 | if [ -r /etc/gentoo-release ] ; then 71 | JAVA_HOME=`java-config --jre-home` 72 | fi 73 | fi 74 | 75 | if [ -z "$M2_HOME" ] ; then 76 | ## resolve links - $0 may be a link to maven's home 77 | PRG="$0" 78 | 79 | # need this for relative symlinks 80 | while [ -h "$PRG" ] ; do 81 | ls=`ls -ld "$PRG"` 82 | link=`expr "$ls" : '.*-> \(.*\)$'` 83 | if expr "$link" : '/.*' > /dev/null; then 84 | PRG="$link" 85 | else 86 | PRG="`dirname "$PRG"`/$link" 87 | fi 88 | done 89 | 90 | saveddir=`pwd` 91 | 92 | M2_HOME=`dirname "$PRG"`/.. 93 | 94 | # make it fully qualified 95 | M2_HOME=`cd "$M2_HOME" && pwd` 96 | 97 | cd "$saveddir" 98 | # echo Using m2 at $M2_HOME 99 | fi 100 | 101 | # For Cygwin, ensure paths are in UNIX format before anything is touched 102 | if $cygwin ; then 103 | [ -n "$M2_HOME" ] && 104 | M2_HOME=`cygpath --unix "$M2_HOME"` 105 | [ -n "$JAVA_HOME" ] && 106 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 107 | [ -n "$CLASSPATH" ] && 108 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 109 | fi 110 | 111 | # For Migwn, ensure paths are in UNIX format before anything is touched 112 | if $mingw ; then 113 | [ -n "$M2_HOME" ] && 114 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 115 | [ -n "$JAVA_HOME" ] && 116 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 117 | # TODO classpath? 118 | fi 119 | 120 | if [ -z "$JAVA_HOME" ]; then 121 | javaExecutable="`which javac`" 122 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 123 | # readlink(1) is not available as standard on Solaris 10. 124 | readLink=`which readlink` 125 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 126 | if $darwin ; then 127 | javaHome="`dirname \"$javaExecutable\"`" 128 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 129 | else 130 | javaExecutable="`readlink -f \"$javaExecutable\"`" 131 | fi 132 | javaHome="`dirname \"$javaExecutable\"`" 133 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 134 | JAVA_HOME="$javaHome" 135 | export JAVA_HOME 136 | fi 137 | fi 138 | fi 139 | 140 | if [ -z "$JAVACMD" ] ; then 141 | if [ -n "$JAVA_HOME" ] ; then 142 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 143 | # IBM's JDK on AIX uses strange locations for the executables 144 | JAVACMD="$JAVA_HOME/jre/sh/java" 145 | else 146 | JAVACMD="$JAVA_HOME/bin/java" 147 | fi 148 | else 149 | JAVACMD="`which java`" 150 | fi 151 | fi 152 | 153 | if [ ! -x "$JAVACMD" ] ; then 154 | echo "Error: JAVA_HOME is not defined correctly." >&2 155 | echo " We cannot execute $JAVACMD" >&2 156 | exit 1 157 | fi 158 | 159 | if [ -z "$JAVA_HOME" ] ; then 160 | echo "Warning: JAVA_HOME environment variable is not set." 161 | fi 162 | 163 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 164 | 165 | # traverses directory structure from process work directory to filesystem root 166 | # first directory with .mvn subdirectory is considered project base directory 167 | find_maven_basedir() { 168 | 169 | if [ -z "$1" ] 170 | then 171 | echo "Path not specified to find_maven_basedir" 172 | return 1 173 | fi 174 | 175 | basedir="$1" 176 | wdir="$1" 177 | while [ "$wdir" != '/' ] ; do 178 | if [ -d "$wdir"/.mvn ] ; then 179 | basedir=$wdir 180 | break 181 | fi 182 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 183 | if [ -d "${wdir}" ]; then 184 | wdir=`cd "$wdir/.."; pwd` 185 | fi 186 | # end of workaround 187 | done 188 | echo "${basedir}" 189 | } 190 | 191 | # concatenates all lines of a file 192 | concat_lines() { 193 | if [ -f "$1" ]; then 194 | echo "$(tr -s '\n' ' ' < "$1")" 195 | fi 196 | } 197 | 198 | BASE_DIR=`find_maven_basedir "$(pwd)"` 199 | if [ -z "$BASE_DIR" ]; then 200 | exit 1; 201 | fi 202 | 203 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 204 | echo $MAVEN_PROJECTBASEDIR 205 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 206 | 207 | # For Cygwin, switch paths to Windows format before running java 208 | if $cygwin; then 209 | [ -n "$M2_HOME" ] && 210 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 211 | [ -n "$JAVA_HOME" ] && 212 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 213 | [ -n "$CLASSPATH" ] && 214 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 215 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 216 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 217 | fi 218 | 219 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 220 | 221 | exec "$JAVACMD" \ 222 | $MAVEN_OPTS \ 223 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 224 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 225 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 226 | -------------------------------------------------------------------------------- /src/main/java/az/mm/developerjobs/controller/IndexController.java: -------------------------------------------------------------------------------- 1 | package az.mm.developerjobs.controller; 2 | 3 | import az.mm.developerjobs.constant.JspPages; 4 | import az.mm.developerjobs.entity.JobInfo; 5 | import az.mm.developerjobs.model.*; 6 | import az.mm.developerjobs.service.JobService; 7 | import java.util.List; 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.validation.Valid; 10 | import org.slf4j.Logger; 11 | import org.slf4j.LoggerFactory; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.http.HttpStatus; 14 | import org.springframework.stereotype.Controller; 15 | import org.springframework.ui.Model; 16 | import org.springframework.validation.BindingResult; 17 | import org.springframework.web.bind.annotation.*; 18 | import org.springframework.web.servlet.ModelAndView; 19 | 20 | /** 21 | * 22 | * @author MM 23 | */ 24 | @Controller 25 | public class IndexController { 26 | 27 | private final Logger logger = LoggerFactory.getLogger(IndexController.class); 28 | 29 | @Autowired 30 | private JobService jobService; 31 | 32 | @RequestMapping("/") 33 | public ModelAndView homePage() { 34 | ModelAndView model = new ModelAndView("main"); 35 | List jobList = jobService.getJobsWithPageRequest("031", 0); // default country - Azerbaijan 36 | Pagination pagination = jobService.createPagination("031", 1); 37 | 38 | model.addObject("jobList", jobList); 39 | model.addObject("includePage", JspPages.JOBS); 40 | model.addObject("countryCode", "031"); 41 | model.addObject("pagination", pagination); 42 | 43 | return model; 44 | } 45 | 46 | 47 | @RequestMapping(value = "/country", method = RequestMethod.GET) 48 | public ModelAndView jobsForCountry(@RequestParam(value = "id", defaultValue = "031") String countryCode, @RequestParam(value = "page", defaultValue = "1") String page) { 49 | ModelAndView model = new ModelAndView("main"); 50 | 51 | /** 52 | * Pagination with two ways: 53 | * 54 | * 1st - using PagingAndSortingRepository: 55 | * List listVacancy = jobService.getJobsWithPageRequest(countryCode, Integer.parseInt(page)-1); 56 | * 57 | * 2nd - using native query: 58 | * int begin = Integer.parseInt(page + "0") - 10; 59 | * List listVacancy = jobService.getJobsWithLimit(countryCode, begin); 60 | */ 61 | 62 | List jobList = jobService.getJobsWithPageRequest(countryCode, Integer.parseInt(page)-1); //zero-base index 63 | Pagination pagination = jobService.createPagination(countryCode, Integer.parseInt(page)); 64 | 65 | model.addObject("jobList", jobList); 66 | model.addObject("includePage", JspPages.JOBS); 67 | model.addObject("countryCode", countryCode); 68 | model.addObject("pagination", pagination); 69 | 70 | return model; 71 | } 72 | 73 | 74 | @RequestMapping("/contact") 75 | public ModelAndView contactPage() { 76 | ModelAndView model = new ModelAndView("main"); 77 | model.addObject("includePage", JspPages.CONTACT); 78 | 79 | return model; 80 | } 81 | 82 | 83 | @RequestMapping("/about") 84 | public ModelAndView aboutPage() { 85 | ModelAndView model = new ModelAndView("main"); 86 | model.addObject("includePage", JspPages.ABOUT); 87 | 88 | return model; 89 | } 90 | 91 | 92 | @RequestMapping(value = "/search.htm", method = RequestMethod.POST) 93 | public ModelAndView search(@Valid @ModelAttribute("search") Search search, BindingResult result) { 94 | ModelAndView model = new ModelAndView("main"); 95 | 96 | if(result.hasErrors()){ 97 | logger.error("Error occurs while searching: {}", result.getAllErrors()); 98 | model.addObject("includePage", JspPages.SEARCH); 99 | return model; 100 | } 101 | 102 | List searchResult = jobService.caseSensitiveSearchResult(search.getSearchText().trim()); // case sensitive 103 | // List searchList = jobService.caseInsensitiveSearchResult(search.getSearchText().trim()); // case insensitive 104 | 105 | model.addObject("searchResult", searchResult); 106 | model.addObject("searchText", search.getSearchText()); 107 | model.addObject("includePage", JspPages.SEARCH); 108 | 109 | return model; 110 | } 111 | 112 | 113 | @RequestMapping(value = "/sendMail", method = RequestMethod.POST) 114 | public ModelAndView sendMail(@Valid @ModelAttribute("user") User user, BindingResult result, HttpServletRequest request) { 115 | ModelAndView model = new ModelAndView("main"); 116 | model.addObject("includePage", JspPages.CONTACT); 117 | 118 | if (result.hasErrors()) return model; 119 | 120 | String ipAddress = request.getHeader("X-FORWARDED-FOR"); 121 | if (ipAddress == null) 122 | ipAddress = request.getRemoteAddr(); 123 | 124 | String from = user.getEmail(); 125 | String subject = "Developer Jobs Contact Message"; 126 | StringBuilder message = new StringBuilder(); 127 | message.append("\n User Name: ").append(user.getName()); 128 | message.append("\n Ip address: ").append(ipAddress); 129 | message.append("\n Message: ").append(user.getMessage()); 130 | 131 | logger.info("Contact message info: {}", message); 132 | 133 | String notif; 134 | try { 135 | jobService.sendMail(from, subject, message.toString()); 136 | notif = "Your message send successfully."; 137 | } catch(Exception ex){ 138 | notif = "Something went wrong. Please try again later"; 139 | logger.error("Exception occurs when sending email", ex); 140 | } 141 | 142 | model.addObject("notif", notif); 143 | 144 | return model; 145 | } 146 | 147 | 148 | @RequestMapping("/ppolicy") 149 | public ModelAndView getPrivacyPolicy() { 150 | ModelAndView model = new ModelAndView("main"); 151 | model.addObject("includePage", JspPages.PRIVACY_POLICY); 152 | 153 | return model; 154 | } 155 | 156 | 157 | @RequestMapping("/job/{id}/{title}") 158 | public ModelAndView getJobDetail(@PathVariable("id") int id, @PathVariable("title") String title, @RequestParam(value = "searchText", defaultValue = "") String searchText) { 159 | ModelAndView model = new ModelAndView("main"); 160 | JobInfo job = jobService.getJob(id, title); 161 | 162 | if(job == null){ 163 | logger.info("Job (id[{}], title[{}]) is not found", id, title); 164 | model.addObject("includePage", JspPages.NOT_FOUND); 165 | return model; 166 | } 167 | 168 | if(!searchText.equals("")){ 169 | // job.setContent(job.getContent().replaceAll("(?i)"+searchText, ""+searchText+"")); // (?i) - for ignore case 170 | job.setContent(job.getContent().replaceAll(searchText, ""+searchText+"")); // It needs modify.. 171 | } 172 | 173 | model.addObject("job", job); 174 | model.addObject("includePage", JspPages.JOB); 175 | 176 | return model; 177 | } 178 | 179 | 180 | @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR) 181 | @ExceptionHandler(value = Exception.class) 182 | public String handlerException(Exception e) { 183 | logger.error("Exception occurs", e); 184 | return "exception"; 185 | } 186 | 187 | 188 | @ModelAttribute 189 | public void addingCommonObjects(Model model) { 190 | model.addAttribute("user", new User()); //It needs for springForm:form tag 191 | model.addAttribute("search", new Search()); //It needs for springForm:form tag 192 | } 193 | 194 | } 195 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------