Merge branch 'merge' into develop
This commit is contained in:
commit
6777e2146c
src
main/java/se/su/dsv/scipro
datatables/finalseminar
match/panel
profile
reviewer
springdata
supervisor
test/java/se/su/dsv/scipro
@ -8,8 +8,8 @@ import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.springdata.services.EmployeeService;
|
||||
import se.su.dsv.scipro.springdata.services.FinalSeminarService;
|
||||
import se.su.dsv.scipro.springdata.services.SupervisorService;
|
||||
import se.su.dsv.scipro.util.DateFormatter;
|
||||
|
||||
/**
|
||||
@ -20,7 +20,7 @@ public abstract class FinalSeminarColumnPanel extends Panel {
|
||||
@SpringBean
|
||||
private FinalSeminarService finalSeminarService;
|
||||
@SpringBean
|
||||
private EmployeeService employeeService;
|
||||
private SupervisorService employeeService;
|
||||
|
||||
private FinalSeminarColumnPanel finalSeminarColumnPanel;
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class NewApplicationPeriodInfoPanel extends Panel {
|
||||
private final boolean supervisorView;
|
||||
|
||||
@SpringBean
|
||||
private EmployeeService employeeService;
|
||||
private SupervisorService employeeService;
|
||||
@SpringBean
|
||||
private TargetService targetService;
|
||||
|
||||
|
@ -11,8 +11,8 @@ import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import se.su.dsv.scipro.data.dataobjects.*;
|
||||
import se.su.dsv.scipro.settings.dataobjects.UserProfile;
|
||||
import se.su.dsv.scipro.springdata.services.EmployeeService;
|
||||
import se.su.dsv.scipro.springdata.services.GeneralSystemSettingsService;
|
||||
import se.su.dsv.scipro.springdata.services.SupervisorService;
|
||||
import se.su.dsv.scipro.springdata.services.UserProfileService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -27,7 +27,7 @@ public class DisplayUserProfilePanel extends Panel {
|
||||
@SpringBean
|
||||
UserProfileService userProfileService;
|
||||
@SpringBean
|
||||
EmployeeService employeeService;
|
||||
SupervisorService employeeService;
|
||||
@SpringBean
|
||||
GeneralSystemSettingsService generalSystemSettingsService;
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class ReviewPanel extends Panel {
|
||||
@SpringBean
|
||||
private FinalSeminarService finalSeminarService;
|
||||
@SpringBean
|
||||
private EmployeeService employeeService;
|
||||
private SupervisorService employeeService;
|
||||
@SpringBean
|
||||
private DateService dateService;
|
||||
@SpringBean
|
||||
|
@ -28,8 +28,6 @@ public class BeansManager {
|
||||
@Autowired
|
||||
DaysService daysService;
|
||||
@Autowired
|
||||
EmployeeService employeeService;
|
||||
@Autowired
|
||||
ExaminerService examinerService;
|
||||
@Autowired
|
||||
ExemptionService exemptionService;
|
||||
@ -179,14 +177,6 @@ public class BeansManager {
|
||||
this.daysService = daysService;
|
||||
}
|
||||
|
||||
public EmployeeService getEmployeeService() {
|
||||
return employeeService;
|
||||
}
|
||||
|
||||
public void setEmployeeService(EmployeeService employeeService) {
|
||||
this.employeeService = employeeService;
|
||||
}
|
||||
|
||||
public ExaminerService getExaminerService() {
|
||||
return examinerService;
|
||||
}
|
||||
|
@ -1,25 +0,0 @@
|
||||
package se.su.dsv.scipro.springdata.repos;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import se.su.dsv.scipro.data.dataobjects.Employee;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.match.dataobject.Keyword;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public interface EmployeeRepo extends JpaRepository<Employee, Long>, QueryDslPredicateExecutor<Employee> {
|
||||
|
||||
Employee findByUser(User user);
|
||||
|
||||
@Query("SELECT e " +
|
||||
"FROM Keyword k, IN (k.researchAreas) kr, Employee e, IN (e.researchAreas) er " +
|
||||
"WHERE kr = er AND k IN (:keywords)")
|
||||
List<Employee> findByKeyword(@Param("keywords") Collection<Keyword> keywords);
|
||||
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package se.su.dsv.scipro.springdata.serviceimpls;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import se.su.dsv.scipro.data.controllers.NotificationController;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.GeneralSystemSettingsDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.Employee;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.springdata.repos.EmployeeRepo;
|
||||
import se.su.dsv.scipro.springdata.services.EmployeeService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
* date: 2012 03 26
|
||||
*/
|
||||
@Service("employeeService")
|
||||
@Transactional(readOnly = true)
|
||||
public class EmployeeServiceImpl extends AbstractQueryService<Employee, Long> implements EmployeeService {
|
||||
|
||||
@Resource
|
||||
private EmployeeRepo employeeRepo;
|
||||
|
||||
@Autowired
|
||||
private GeneralSystemSettingsDao generalSystemSettingsDao;
|
||||
|
||||
@Autowired
|
||||
public EmployeeServiceImpl(
|
||||
@Qualifier("employeeRepo")
|
||||
EmployeeRepo employeeRepo) {
|
||||
super(employeeRepo, employeeRepo);
|
||||
System.out.println("EmployeeServiceImpl instantiating...");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Employee findByUser(User user) {
|
||||
return employeeRepo.findByUser(user);
|
||||
}
|
||||
|
||||
@Resource
|
||||
private NotificationController notificationController;
|
||||
}
|
@ -56,7 +56,7 @@ public class NewIdeaServiceImpl extends AbstractQueryService<NewIdea, Long> impl
|
||||
@Resource
|
||||
NotificationController notificationController;
|
||||
@Resource
|
||||
EmployeeService employeeService;
|
||||
SupervisorService employeeService;
|
||||
@Resource
|
||||
NotificationService notificationService;
|
||||
@Resource
|
||||
|
@ -33,7 +33,7 @@ public class ProjectServiceImpl extends AbstractQueryService<Project, Long> impl
|
||||
private final GeneralSystemSettingsService generalSystemSettingsService;
|
||||
private final StudentService studentService;
|
||||
private final ProjectFollowerService projectFollowerService;
|
||||
private final EmployeeService employeeService;
|
||||
private final SupervisorService employeeService;
|
||||
private final NotificationController notificationController;
|
||||
|
||||
private GeneralSystemSettings gsettings;
|
||||
@ -46,7 +46,7 @@ public class ProjectServiceImpl extends AbstractQueryService<Project, Long> impl
|
||||
final GeneralSystemSettingsService generalSystemSettingsService,
|
||||
final StudentService studentService,
|
||||
final ProjectFollowerService projectFollowerService,
|
||||
final EmployeeService employeeService,
|
||||
final SupervisorService employeeService,
|
||||
final NotificationController notificationController){
|
||||
super(projectRepo, projectRepo);
|
||||
this.projectRepo = projectRepo;
|
||||
|
@ -26,14 +26,6 @@ public class SupervisorServiceImpl extends AbstractQueryService<Employee, Long>
|
||||
|
||||
@Resource
|
||||
private SupervisorRepo supervisorRepo;
|
||||
@Resource
|
||||
private ProjectClassService projectClassService;
|
||||
@Resource
|
||||
private ProjectService projectService;
|
||||
@Resource
|
||||
private NewIdeaService newIdeaService;
|
||||
@Resource
|
||||
private GeneralSystemSettingsService generalSystemSettingsService;
|
||||
|
||||
@PersistenceContext
|
||||
private EntityManager em;
|
||||
@ -125,79 +117,4 @@ public class SupervisorServiceImpl extends AbstractQueryService<Employee, Long>
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
private BooleanExpression inSet(Set<Employee> set) {
|
||||
if(!set.isEmpty())
|
||||
return QEmployee.employee.in(set);
|
||||
else
|
||||
return QEmployee.employee.user.isNull(); //Should show 0.
|
||||
}
|
||||
|
||||
private List<Employee> getEmployeesThatHaveKeywords(String keywordTypeName, String direction) {
|
||||
List<Employee> employeeList = new ArrayList<Employee>();
|
||||
String nativeSQL = "select " +
|
||||
"role.id " +
|
||||
"from " +
|
||||
"Employee_Keyword ek, " +
|
||||
"role role, " +
|
||||
"user user, " +
|
||||
"Keyword k, " +
|
||||
"KeywordType kt " +
|
||||
"where " +
|
||||
"role.id = ek.role_id and " +
|
||||
"user.id = role.user_id and " +
|
||||
"k.id = ek.keywords_id and " +
|
||||
"k.type_id = kt.id and " +
|
||||
"kt.name= '" + keywordTypeName + "' " +
|
||||
"group by " +
|
||||
"role_id " +
|
||||
"order by " +
|
||||
"count(keywords_id) " + direction + ", user.lastName asc ";
|
||||
return runQueryAddToList(employeeList, nativeSQL);
|
||||
}
|
||||
|
||||
private List<Employee> getEmployeesWithoutKeywords(String keywordTypeName) {
|
||||
List<Employee> employeeList = new ArrayList<Employee>();
|
||||
String nativeSQL = "select " +
|
||||
"role.id " +
|
||||
"from " +
|
||||
"role role, " +
|
||||
"user user " +
|
||||
"where " +
|
||||
"role.rolename = 'Employee' and " +
|
||||
"user.id = role.user_id and not exists " +
|
||||
"(select 1 " +
|
||||
"from " +
|
||||
"Employee_Keyword ek, " +
|
||||
"Keyword k, " +
|
||||
"KeywordType kt " +
|
||||
"where " +
|
||||
"ek.role_id = role.id and " +
|
||||
"k.id = ek.keywords_id and " +
|
||||
"k.type_id = kt.id and " +
|
||||
"kt.name= '" + keywordTypeName + "') " +
|
||||
"order by " +
|
||||
"user.lastName asc ";
|
||||
return runQueryAddToList(employeeList, nativeSQL);
|
||||
}
|
||||
|
||||
private List<Employee> runQueryAddToList(List<Employee> employeeList, final String nativeSQL) {
|
||||
List<BigInteger> dBlist= new ArrayList<BigInteger>();
|
||||
//noinspection unchecked
|
||||
dBlist.addAll(em.createNativeQuery(nativeSQL).getResultList());
|
||||
for (BigInteger number : dBlist) {
|
||||
Employee employee = (Employee) em.createQuery("from Employee employee where employee.id = " + number.longValue()).getResultList().get(0);
|
||||
if(employee != null && !employeeList.contains(employee)) {
|
||||
employeeList.add(employee);
|
||||
}
|
||||
}
|
||||
return employeeList;
|
||||
}
|
||||
|
||||
private List<Employee> constructList(Iterable<Employee> iterable) {
|
||||
List<Employee> list = new ArrayList<Employee>();
|
||||
for(Employee e : iterable)
|
||||
list.add(e);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +0,0 @@
|
||||
package se.su.dsv.scipro.springdata.services;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.Employee;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
* date: 2012 03 26
|
||||
*/
|
||||
public interface EmployeeService extends GenericService<Employee, Long>, QueryService<Employee, Long> {
|
||||
Employee findByUser(User user);
|
||||
}
|
@ -20,15 +20,6 @@ public interface SupervisorService extends GenericService<Employee,Long>, QueryS
|
||||
Long count(FilterParams params);
|
||||
Long countByResearchArea(ResearchArea area);
|
||||
public Employee findByUser(User user);
|
||||
//<<<<<<< HEAD
|
||||
// List<Availability> getNewIdeaAvailabilities(Employee supervisor);
|
||||
// Availability getNewIdeaAvailability(Employee supervisor, ProjectClass pc);
|
||||
// boolean withinLimits(Employee supervisor, ProjectClass pc);
|
||||
// void setAvailability(Availability availability);
|
||||
// void resetCountFromDate(ProjectClass pc, Date date);
|
||||
// void resetAllTargetNumbers(ProjectClass pc);
|
||||
//=======
|
||||
//>>>>>>> develop2
|
||||
|
||||
public static class FilterParams implements Serializable {
|
||||
|
||||
|
@ -12,10 +12,8 @@ import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.datatables.DateColumn;
|
||||
import se.su.dsv.scipro.datatables.project.ProjectStateColumn;
|
||||
import se.su.dsv.scipro.datatables.project.ProjectTitleColumn;
|
||||
import se.su.dsv.scipro.match.dataobject.ApplicationPeriod;
|
||||
import se.su.dsv.scipro.match.dataobject.Target;
|
||||
import se.su.dsv.scipro.springdata.services.ApplicationPeriodService;
|
||||
import se.su.dsv.scipro.springdata.services.EmployeeService;
|
||||
import se.su.dsv.scipro.springdata.services.SupervisorService;
|
||||
import se.su.dsv.scipro.supervisor.panels.SupervisorMyProjectsPanel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -24,7 +22,7 @@ public class SupervisorStartPage extends AbstractSupervisorPage {
|
||||
|
||||
public static final String MAIN_MENU_LABEL = "Supervisor";
|
||||
@SpringBean
|
||||
private EmployeeService employeeService;
|
||||
private SupervisorService employeeService;
|
||||
@SpringBean
|
||||
private ApplicationPeriodService applicationPeriodService;
|
||||
|
||||
|
@ -14,10 +14,10 @@ import se.su.dsv.scipro.data.enums.ProjectTeamMemberRoles;
|
||||
import se.su.dsv.scipro.datatables.GenericDataPanel;
|
||||
import se.su.dsv.scipro.match.panel.FilterFormCheckBoxPanel;
|
||||
import se.su.dsv.scipro.reusable.SciProUtilities;
|
||||
import se.su.dsv.scipro.springdata.services.EmployeeService;
|
||||
import se.su.dsv.scipro.springdata.services.GenericService;
|
||||
import se.su.dsv.scipro.springdata.services.ProjectClassService;
|
||||
import se.su.dsv.scipro.springdata.services.ProjectService;
|
||||
import se.su.dsv.scipro.springdata.services.SupervisorService;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -30,7 +30,7 @@ public abstract class SupervisorMyProjectsPanel extends Panel {
|
||||
@SpringBean
|
||||
private ProjectService projectService;
|
||||
@SpringBean
|
||||
private EmployeeService employeeService;
|
||||
private SupervisorService employeeService;
|
||||
@SpringBean
|
||||
private ProjectClassService projectClassService;
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class SupervisorNewAllStudentIdeasPanel extends Panel {
|
||||
@SpringBean
|
||||
private TargetService targetService;
|
||||
@SpringBean
|
||||
private EmployeeService employeeService;
|
||||
private SupervisorService employeeService;
|
||||
|
||||
private Dialog dialog;
|
||||
private FilterParams params;
|
||||
|
@ -114,7 +114,6 @@ public abstract class SciProTest {
|
||||
@Mock protected ChecklistTemplateService checklistTemplateService;
|
||||
@Mock protected DateService dateService;
|
||||
@Mock protected DaysService daysService;
|
||||
@Mock protected EmployeeService employeeService;
|
||||
@Mock protected ExemptionService exemptionService;
|
||||
@Mock protected FileDescriptionService fileDescriptionService;
|
||||
@Mock protected FinalSeminarActiveParticipationService finalSeminarActiveParticipationService;
|
||||
|
@ -54,7 +54,7 @@ public class ApplicationPeriodInfoPanelTest extends SciProTest {
|
||||
when(generalSystemSettingsService.getGeneralSystemSettingsInstance()).thenReturn(settings);
|
||||
|
||||
|
||||
when(employeeService.findByUser(new User())).thenReturn(new Employee());
|
||||
when(supervisorService.findByUser(new User())).thenReturn(new Employee());
|
||||
ProjectClass pc = new ProjectClass();
|
||||
when(projectClassService.getProjectClass(ProjectClass.BACHELOR)).thenReturn(pc);
|
||||
when(projectClassService.getProjectClass(ProjectClass.MASTER)).thenReturn(pc);
|
||||
|
@ -52,7 +52,7 @@ public class NewIdeaServiceImplTest {
|
||||
@Mock
|
||||
NewIdeaRepo ideaRepo;
|
||||
@Mock
|
||||
EmployeeService employeeService;
|
||||
SupervisorService employeeService;
|
||||
|
||||
NewIdeaServiceImpl service;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class ProjectServiceImplTest {
|
||||
@Mock private GeneralSystemSettingsService systemSettingService;
|
||||
@Mock private StudentService studentService;
|
||||
@Mock private ProjectFollowerService projectFollowerService;
|
||||
@Mock private EmployeeService employeeService;
|
||||
@Mock private SupervisorService employeeService;
|
||||
@Mock private NotificationController notificationController;
|
||||
@Mock private NewIdeaService newIdeaService;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user