#121 reduce paper title

merge-requests/89/head
T-Midnight 5 years ago
parent e1907d3169
commit 99ec7af319

@ -11,6 +11,7 @@ import ru.ulstu.grant.model.Grant;
import ru.ulstu.grant.model.GrantDto; import ru.ulstu.grant.model.GrantDto;
import ru.ulstu.grant.repository.GrantRepository; import ru.ulstu.grant.repository.GrantRepository;
import ru.ulstu.paper.model.Paper; import ru.ulstu.paper.model.Paper;
import ru.ulstu.paper.model.PaperDto;
import ru.ulstu.paper.service.PaperService; import ru.ulstu.paper.service.PaperService;
import ru.ulstu.project.model.Project; import ru.ulstu.project.model.Project;
import ru.ulstu.project.model.ProjectDto; import ru.ulstu.project.model.ProjectDto;
@ -34,7 +35,7 @@ import static ru.ulstu.grant.model.Grant.GrantStatus.APPLICATION;
@Service @Service
public class GrantService { public class GrantService {
private final static int MAX_DISPLAY_SIZE = 40; private final static int MAX_DISPLAY_SIZE = 50;
private final GrantRepository grantRepository; private final GrantRepository grantRepository;
private final ProjectService projectService; private final ProjectService projectService;
@ -210,17 +211,16 @@ public class GrantService {
.collect(toList()); .collect(toList());
} }
public List<Paper> getGrantPapers(List<Integer> paperIds) { public List<PaperDto> getGrantPapers(List<Integer> paperIds) {
return paperService.findAllSelect(paperIds); return paperService.findAllSelect(paperIds);
}
public List<Paper> getAllPapers() {
return paperService.findAll();
} }
public List<Paper> getAllUncompletedPapers() { public List<PaperDto> getAllUncompletedPapers() {
return paperService.findAllNotCompleted(); List<PaperDto> papers = paperService.findAllNotCompleted();
papers.stream()
.forEach(paper ->
paper.setTitle(StringUtils.abbreviate(paper.getTitle(), MAX_DISPLAY_SIZE)));
return papers;
} }
public void attachPaper(GrantDto grantDto) { public void attachPaper(GrantDto grantDto) {

Loading…
Cancel
Save