|
|
@ -41,7 +41,6 @@ import static ru.ulstu.grant.model.Grant.GrantStatus.APPLICATION;
|
|
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
|
public class GrantService extends BaseService {
|
|
|
|
public class GrantService extends BaseService {
|
|
|
|
private final static int MAX_DISPLAY_SIZE = 50;
|
|
|
|
|
|
|
|
private final Logger log = LoggerFactory.getLogger(GrantService.class);
|
|
|
|
private final Logger log = LoggerFactory.getLogger(GrantService.class);
|
|
|
|
|
|
|
|
|
|
|
|
private final GrantRepository grantRepository;
|
|
|
|
private final GrantRepository grantRepository;
|
|
|
@ -80,9 +79,7 @@ public class GrantService extends BaseService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<GrantDto> findAllDto() {
|
|
|
|
public List<GrantDto> findAllDto() {
|
|
|
|
List<GrantDto> grants = convert(findAll(), GrantDto::new);
|
|
|
|
return convert(findAll(), GrantDto::new);
|
|
|
|
grants.forEach(grantDto -> grantDto.setTitle(StringUtils.abbreviate(grantDto.getTitle(), MAX_DISPLAY_SIZE)));
|
|
|
|
|
|
|
|
return grants;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public GrantDto findOneDto(Integer id) {
|
|
|
|
public GrantDto findOneDto(Integer id) {
|
|
|
@ -273,11 +270,7 @@ public class GrantService extends BaseService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<PaperDto> getAllUncompletedPapers() {
|
|
|
|
public List<PaperDto> getAllUncompletedPapers() {
|
|
|
|
List<PaperDto> papers = paperService.findAllNotCompleted();
|
|
|
|
return 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) {
|
|
|
@ -335,4 +328,12 @@ public class GrantService extends BaseService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<GrantDto> findAllActiveDto() {
|
|
|
|
|
|
|
|
return convert(findAllActive(), GrantDto::new);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<Grant> findAllActive() {
|
|
|
|
|
|
|
|
return grantRepository.findAllActive();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|