Changeset 509cb95 for src/main/java/it/finki/tinki/service
- Timestamp:
- 01/07/21 22:32:22 (4 years ago)
- Branches:
- master
- Children:
- a8e8545
- Parents:
- 723994f
- Location:
- src/main/java/it/finki/tinki/service
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/it/finki/tinki/service/AccountService.java
r723994f r509cb95 6 6 7 7 import java.util.List; 8 import java.util.Map;9 8 10 9 public interface AccountService { … … 13 12 Account registerTeam(String email, String password, String name, int members); 14 13 Account registerCompany(String email, String password, String name, String country, String city, String street); 14 Account findByIdAndType(Long accId, AccountType type); 15 15 } -
src/main/java/it/finki/tinki/service/MatchmakerService.java
r723994f r509cb95 12 12 List<Job> getMatchingJobsForUser(User user); 13 13 List<Project> getMatchingProjectsForUser(User user); 14 void setUpUserJobMatches(Job job, User user); 15 void setUpUserProjectMatches(Project project, User user); 16 void setUpUserInternshipMatches(Internship internship, User user); 14 17 } -
src/main/java/it/finki/tinki/service/impl/AccountServiceImpl.java
r723994f r509cb95 96 96 return this.companyRepository.save(c); 97 97 } 98 99 public Account findByIdAndType(Long id, AccountType type){ 100 switch (type){ 101 case COMPANY: 102 return this.companyRepository.findById(id).get(); 103 case TEAM: 104 return this.teamRepository.findById(id).get(); 105 case USER: 106 return this.userRepository.findById(id).get(); 107 } 108 109 return null; 110 } 98 111 } -
src/main/java/it/finki/tinki/service/impl/MatchmakerServiceImpl.java
r723994f r509cb95 1 1 package it.finki.tinki.service.impl; 2 2 3 import it.finki.tinki.helper.Matchmaker; 4 import it.finki.tinki.model.EmbeddedMatchId; 3 5 import it.finki.tinki.model.Jobs.Internship; 4 6 import it.finki.tinki.model.Jobs.Job; 5 7 import it.finki.tinki.model.Jobs.Project; 8 import it.finki.tinki.model.Jobs.Work; 6 9 import it.finki.tinki.model.Match; 7 import it.finki.tinki.model. Users.Team;10 import it.finki.tinki.model.Skill; 8 11 import it.finki.tinki.model.Users.User; 9 12 import it.finki.tinki.model.enumerator.WorkType; … … 27 30 @Override 28 31 public List<Internship> getMatchingInternshipsForUser(User user) { 29 List<Match> matches = this.matchRepository.getAllByCombinedId_User AndTypeOrderByCoefficientDesc(user, WorkType.INTERNSHIP);32 List<Match> matches = this.matchRepository.getAllByCombinedId_User_IdAndTypeOrderByCoefficientDesc(user.getId(), WorkType.INTERNSHIP); 30 33 31 34 List<Internship> internships = new ArrayList<>(); … … 39 42 @Override 40 43 public List<Job> getMatchingJobsForUser(User user) { 41 List<Match> matches = this.matchRepository.getAllByCombinedId_User AndTypeOrderByCoefficientDesc(user, WorkType.JOB);44 List<Match> matches = this.matchRepository.getAllByCombinedId_User_IdAndTypeOrderByCoefficientDesc(user.getId(), WorkType.JOB); 42 45 43 46 List<Job> jobs = new ArrayList<>(); … … 51 54 @Override 52 55 public List<Project> getMatchingProjectsForUser(User user) { 53 List<Match> matches = this.matchRepository.getAllByCombinedId_User AndTypeOrderByCoefficientDesc(user, WorkType.PROJECT);56 List<Match> matches = this.matchRepository.getAllByCombinedId_User_IdAndTypeOrderByCoefficientDesc(user.getId(), WorkType.PROJECT); 54 57 55 58 List<Project> projects = new ArrayList<>(); … … 60 63 return projects; 61 64 } 65 66 @Override 67 public void setUpUserJobMatches(Job job, User user) { 68 List<Skill> jobSkill = job.getSkillsRequired(); 69 List<Skill> userSkill = user.getRetainedSkills(); 70 71 float coef = Matchmaker.match(jobSkill, userSkill); 72 73 if(coef!=0){ 74 EmbeddedMatchId matchId = new EmbeddedMatchId(job, user); 75 Match m = new Match(matchId, coef, WorkType.JOB); 76 this.matchRepository.save(m); 77 } 78 } 79 80 @Override 81 public void setUpUserProjectMatches(Project project, User user) { 82 List<Skill> projectSkills = project.getSkillsRequired(); 83 List<Skill> userSkill = user.getRetainedSkills(); 84 85 float coef = Matchmaker.match(projectSkills, userSkill); 86 87 if(coef!=0){ 88 EmbeddedMatchId matchId = new EmbeddedMatchId(project, user); 89 Match m = new Match(matchId, coef, WorkType.PROJECT); 90 this.matchRepository.save(m); 91 } 92 } 93 94 @Override 95 public void setUpUserInternshipMatches(Internship internship, User user) { 96 List<Skill> internshipSkills = internship.getSkillsTrained(); 97 List<Skill> userSkill = user.getSkillsToLearn(); 98 99 float coef = Matchmaker.match(internshipSkills, userSkill); 100 101 if(coef!=0){ 102 EmbeddedMatchId matchId = new EmbeddedMatchId(internship, user); 103 Match m = new Match(matchId, coef, WorkType.INTERNSHIP); 104 this.matchRepository.save(m); 105 } 106 } 107 108 62 109 }
Note:
See TracChangeset
for help on using the changeset viewer.