added new count methods to supervisor idea services to make datatable pagination work properly
This commit is contained in:
parent
095d2412f8
commit
944087b07f
src/main/java/se/su/dsv/scipro
match/dataobject
springdata
@ -85,5 +85,8 @@ public class IdeaParticipation implements Serializable {
|
||||
return (getPk()!=null?getPk().hashCode() : 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getStudent().getNameAsString();
|
||||
}
|
||||
}
|
||||
|
@ -19,16 +19,16 @@ import se.su.dsv.scipro.data.dataobjects.Employee;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.match.dataobject.Idea.IdeaStatus;
|
||||
import se.su.dsv.scipro.match.dataobject.FirstMeeting;
|
||||
import se.su.dsv.scipro.match.dataobject.Idea.IdeaStatus;
|
||||
import se.su.dsv.scipro.match.dataobject.IdeaParticipation;
|
||||
import se.su.dsv.scipro.match.dataobject.QSupervisorIdea;
|
||||
import se.su.dsv.scipro.match.dataobject.SupervisorIdea;
|
||||
import se.su.dsv.scipro.match.dataobject.Watson;
|
||||
import se.su.dsv.scipro.peer.data.dao.controllers.Pair;
|
||||
import se.su.dsv.scipro.springdata.repos.FirstMeetingRepo;
|
||||
import se.su.dsv.scipro.springdata.repos.SupervisorIdeaRepo;
|
||||
import se.su.dsv.scipro.springdata.services.ApplicationPeriodService;
|
||||
import se.su.dsv.scipro.springdata.services.FirstMeetingService;
|
||||
import se.su.dsv.scipro.springdata.services.StudentService;
|
||||
import se.su.dsv.scipro.springdata.services.SupervisorIdeaService;
|
||||
import se.su.dsv.scipro.springdata.services.SupervisorService;
|
||||
@ -50,7 +50,7 @@ public class SupervisorIdeaServiceImpl extends AbstractQueryService<SupervisorId
|
||||
@Resource
|
||||
private ApplicationPeriodService applicationPeriodService;
|
||||
@Resource
|
||||
private FirstMeetingRepo firstMeetingRepo;
|
||||
private FirstMeetingService firstMeetingService;
|
||||
|
||||
private transient Logger logger = Logger.getLogger(SupervisorIdeaService.class);
|
||||
private int MAX_PARTNERS = 1;
|
||||
@ -195,6 +195,10 @@ public class SupervisorIdeaServiceImpl extends AbstractQueryService<SupervisorId
|
||||
Student s = ip.getStudent();
|
||||
s.removeIdeaParticipation(ip);
|
||||
}
|
||||
//Remove first meeting info if existing
|
||||
if(reloadedIdea.getFirstMeeting()!=null)
|
||||
firstMeetingService.delete(reloadedIdea.getFirstMeeting().getId());
|
||||
reloadedIdea.setFirstMeeting(null);
|
||||
//Erase watson boxes
|
||||
reloadedIdea.setWatson(new Watson());
|
||||
//Remove application period association
|
||||
@ -226,7 +230,7 @@ public class SupervisorIdeaServiceImpl extends AbstractQueryService<SupervisorId
|
||||
reloadedIdea.getFirstMeeting().setDescription(desc);
|
||||
} else {
|
||||
FirstMeeting meeting = new FirstMeeting(date, desc, reloadedIdea);
|
||||
meeting = firstMeetingRepo.save(meeting);
|
||||
meeting = firstMeetingService.save(meeting);
|
||||
reloadedIdea.setFirstMeeting(meeting);
|
||||
}
|
||||
return reloadedIdea;
|
||||
@ -268,7 +272,7 @@ public class SupervisorIdeaServiceImpl extends AbstractQueryService<SupervisorId
|
||||
|
||||
@Override
|
||||
public Page<SupervisorIdea> findByStatusAndParams(IdeaStatus status, FilterParams params, Pageable pageable) {
|
||||
return supervisorIdeaRepo.findAll(byStatus(status).and(levelFilter(params.getLevels())), pageable);
|
||||
return supervisorIdeaRepo.findAll(byStatus(status).and(predicateFromParams(params)), pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -304,6 +308,16 @@ public class SupervisorIdeaServiceImpl extends AbstractQueryService<SupervisorId
|
||||
return supervisorIdeaRepo.countIdeasByAuthorAndStatus(author, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long count(FilterParams params) {
|
||||
return supervisorIdeaRepo.count(predicateFromParams(params));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long countByStatusAndParams(IdeaStatus status, FilterParams params) {
|
||||
return supervisorIdeaRepo.count(byStatus(status).and(predicateFromParams(params)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean authorParticipatingOnIdea(User user) {
|
||||
Student author = studentService.findByUser(user);
|
||||
|
@ -29,6 +29,8 @@ public interface SupervisorIdeaService extends GenericService<SupervisorIdea, Lo
|
||||
Long countByAuthorAndStatus(Student author, IdeaStatus status);
|
||||
Long countByStatus(IdeaStatus status);
|
||||
Long countIdeas(IdeaStatus status, Employee supervisor, ProjectClass pc);
|
||||
Long count(FilterParams params);
|
||||
Long countByStatusAndParams(IdeaStatus status, FilterParams params);
|
||||
|
||||
void saveSupervisorCreatedIdea(SupervisorIdea idea, Employee creator, SortedSet<Student> students);
|
||||
void acceptIdea(SupervisorIdea idea, User mainAuthor, SortedSet<Student> sortedSet);
|
||||
|
Loading…
x
Reference in New Issue
Block a user