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);
|
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.ProjectClass;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Student;
|
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
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.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.IdeaParticipation;
|
||||||
import se.su.dsv.scipro.match.dataobject.QSupervisorIdea;
|
import se.su.dsv.scipro.match.dataobject.QSupervisorIdea;
|
||||||
import se.su.dsv.scipro.match.dataobject.SupervisorIdea;
|
import se.su.dsv.scipro.match.dataobject.SupervisorIdea;
|
||||||
import se.su.dsv.scipro.match.dataobject.Watson;
|
import se.su.dsv.scipro.match.dataobject.Watson;
|
||||||
import se.su.dsv.scipro.peer.data.dao.controllers.Pair;
|
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.repos.SupervisorIdeaRepo;
|
||||||
import se.su.dsv.scipro.springdata.services.ApplicationPeriodService;
|
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.StudentService;
|
||||||
import se.su.dsv.scipro.springdata.services.SupervisorIdeaService;
|
import se.su.dsv.scipro.springdata.services.SupervisorIdeaService;
|
||||||
import se.su.dsv.scipro.springdata.services.SupervisorService;
|
import se.su.dsv.scipro.springdata.services.SupervisorService;
|
||||||
@ -50,7 +50,7 @@ public class SupervisorIdeaServiceImpl extends AbstractQueryService<SupervisorId
|
|||||||
@Resource
|
@Resource
|
||||||
private ApplicationPeriodService applicationPeriodService;
|
private ApplicationPeriodService applicationPeriodService;
|
||||||
@Resource
|
@Resource
|
||||||
private FirstMeetingRepo firstMeetingRepo;
|
private FirstMeetingService firstMeetingService;
|
||||||
|
|
||||||
private transient Logger logger = Logger.getLogger(SupervisorIdeaService.class);
|
private transient Logger logger = Logger.getLogger(SupervisorIdeaService.class);
|
||||||
private int MAX_PARTNERS = 1;
|
private int MAX_PARTNERS = 1;
|
||||||
@ -195,6 +195,10 @@ public class SupervisorIdeaServiceImpl extends AbstractQueryService<SupervisorId
|
|||||||
Student s = ip.getStudent();
|
Student s = ip.getStudent();
|
||||||
s.removeIdeaParticipation(ip);
|
s.removeIdeaParticipation(ip);
|
||||||
}
|
}
|
||||||
|
//Remove first meeting info if existing
|
||||||
|
if(reloadedIdea.getFirstMeeting()!=null)
|
||||||
|
firstMeetingService.delete(reloadedIdea.getFirstMeeting().getId());
|
||||||
|
reloadedIdea.setFirstMeeting(null);
|
||||||
//Erase watson boxes
|
//Erase watson boxes
|
||||||
reloadedIdea.setWatson(new Watson());
|
reloadedIdea.setWatson(new Watson());
|
||||||
//Remove application period association
|
//Remove application period association
|
||||||
@ -226,7 +230,7 @@ public class SupervisorIdeaServiceImpl extends AbstractQueryService<SupervisorId
|
|||||||
reloadedIdea.getFirstMeeting().setDescription(desc);
|
reloadedIdea.getFirstMeeting().setDescription(desc);
|
||||||
} else {
|
} else {
|
||||||
FirstMeeting meeting = new FirstMeeting(date, desc, reloadedIdea);
|
FirstMeeting meeting = new FirstMeeting(date, desc, reloadedIdea);
|
||||||
meeting = firstMeetingRepo.save(meeting);
|
meeting = firstMeetingService.save(meeting);
|
||||||
reloadedIdea.setFirstMeeting(meeting);
|
reloadedIdea.setFirstMeeting(meeting);
|
||||||
}
|
}
|
||||||
return reloadedIdea;
|
return reloadedIdea;
|
||||||
@ -268,7 +272,7 @@ public class SupervisorIdeaServiceImpl extends AbstractQueryService<SupervisorId
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<SupervisorIdea> findByStatusAndParams(IdeaStatus status, FilterParams params, Pageable pageable) {
|
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
|
@Override
|
||||||
@ -304,6 +308,16 @@ public class SupervisorIdeaServiceImpl extends AbstractQueryService<SupervisorId
|
|||||||
return supervisorIdeaRepo.countIdeasByAuthorAndStatus(author, status);
|
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
|
@Override
|
||||||
public boolean authorParticipatingOnIdea(User user) {
|
public boolean authorParticipatingOnIdea(User user) {
|
||||||
Student author = studentService.findByUser(user);
|
Student author = studentService.findByUser(user);
|
||||||
|
@ -29,6 +29,8 @@ public interface SupervisorIdeaService extends GenericService<SupervisorIdea, Lo
|
|||||||
Long countByAuthorAndStatus(Student author, IdeaStatus status);
|
Long countByAuthorAndStatus(Student author, IdeaStatus status);
|
||||||
Long countByStatus(IdeaStatus status);
|
Long countByStatus(IdeaStatus status);
|
||||||
Long countIdeas(IdeaStatus status, Employee supervisor, ProjectClass pc);
|
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 saveSupervisorCreatedIdea(SupervisorIdea idea, Employee creator, SortedSet<Student> students);
|
||||||
void acceptIdea(SupervisorIdea idea, User mainAuthor, SortedSet<Student> sortedSet);
|
void acceptIdea(SupervisorIdea idea, User mainAuthor, SortedSet<Student> sortedSet);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user