|
|
@ -64,7 +64,7 @@ public class ConferenceService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ConferenceDto getExistConferenceById(Integer id) {
|
|
|
|
public ConferenceDto getExistConferenceById(Integer id) {
|
|
|
|
ConferenceDto conferenceDto = findOneDto(id);
|
|
|
|
ConferenceDto conferenceDto = new ConferenceDto(conferenceRepository.findOne(id));
|
|
|
|
conferenceDto.setNotSelectedPapers(getNotSelectPapers(conferenceDto.getPaperIds()));
|
|
|
|
conferenceDto.setNotSelectedPapers(getNotSelectPapers(conferenceDto.getPaperIds()));
|
|
|
|
conferenceDto.setDisabledTakePart(isCurrentUserParticipant(conferenceDto.getUsers()));
|
|
|
|
conferenceDto.setDisabledTakePart(isCurrentUserParticipant(conferenceDto.getUsers()));
|
|
|
|
return conferenceDto;
|
|
|
|
return conferenceDto;
|
|
|
@ -72,7 +72,7 @@ public class ConferenceService {
|
|
|
|
|
|
|
|
|
|
|
|
public ConferenceDto getNewConference() {
|
|
|
|
public ConferenceDto getNewConference() {
|
|
|
|
ConferenceDto conferenceDto = new ConferenceDto();
|
|
|
|
ConferenceDto conferenceDto = new ConferenceDto();
|
|
|
|
conferenceDto.setNotSelectedPapers(getNotSelectPapers(new ArrayList<Integer>()));
|
|
|
|
conferenceDto.setNotSelectedPapers(getNotSelectPapers(new ArrayList<>()));
|
|
|
|
return conferenceDto;
|
|
|
|
return conferenceDto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -87,10 +87,6 @@ public class ConferenceService {
|
|
|
|
return conferences;
|
|
|
|
return conferences;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ConferenceDto findOneDto(Integer id) {
|
|
|
|
|
|
|
|
return new ConferenceDto(conferenceRepository.findOne(id));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void save(ConferenceDto conferenceDto) throws IOException {
|
|
|
|
public void save(ConferenceDto conferenceDto) throws IOException {
|
|
|
|
if (isEmpty(conferenceDto.getId())) {
|
|
|
|
if (isEmpty(conferenceDto.getId())) {
|
|
|
|
create(conferenceDto);
|
|
|
|
create(conferenceDto);
|
|
|
@ -127,44 +123,51 @@ public class ConferenceService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
public void delete(Integer conferenceId) {
|
|
|
|
public boolean delete(Integer conferenceId) {
|
|
|
|
if (conferenceRepository.exists(conferenceId)) {
|
|
|
|
if (conferenceRepository.exists(conferenceId)) {
|
|
|
|
conferenceRepository.delete(conferenceId);
|
|
|
|
conferenceRepository.delete(conferenceId);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void addDeadline(ConferenceDto conferenceDto) {
|
|
|
|
public ConferenceDto addDeadline(ConferenceDto conferenceDto) {
|
|
|
|
conferenceDto.getDeadlines().add(new Deadline());
|
|
|
|
conferenceDto.getDeadlines().add(new Deadline());
|
|
|
|
|
|
|
|
return conferenceDto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void removeDeadline(ConferenceDto conferenceDto, Integer deadlineIndex) throws IOException {
|
|
|
|
public ConferenceDto removeDeadline(ConferenceDto conferenceDto, Integer deadlineIndex) throws IOException {
|
|
|
|
if (conferenceDto.getDeadlines().get(deadlineIndex).getId() != null) {
|
|
|
|
if (conferenceDto.getDeadlines().get(deadlineIndex).getId() != null) {
|
|
|
|
conferenceDto.getRemovedDeadlineIds().add(conferenceDto.getDeadlines().get(deadlineIndex).getId());
|
|
|
|
conferenceDto.getRemovedDeadlineIds().add(conferenceDto.getDeadlines().get(deadlineIndex).getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
conferenceDto.getDeadlines().remove((int) deadlineIndex);
|
|
|
|
conferenceDto.getDeadlines().remove((int) deadlineIndex);
|
|
|
|
|
|
|
|
return conferenceDto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void addPaper(ConferenceDto conferenceDto) {
|
|
|
|
public ConferenceDto addPaper(ConferenceDto conferenceDto) {
|
|
|
|
Paper paper = new Paper();
|
|
|
|
Paper paper = new Paper();
|
|
|
|
paper.setTitle(userService.getCurrentUser().getLastName() + "_" + conferenceDto.getTitle() + "_" + (new Date()).getTime());
|
|
|
|
paper.setTitle(userService.getCurrentUser().getLastName() + "_" + conferenceDto.getTitle() + "_" + (new Date()).getTime());
|
|
|
|
paper.setStatus(Paper.PaperStatus.DRAFT);
|
|
|
|
paper.setStatus(Paper.PaperStatus.DRAFT);
|
|
|
|
conferenceDto.getPapers().add(paper);
|
|
|
|
conferenceDto.getPapers().add(paper);
|
|
|
|
|
|
|
|
return conferenceDto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void removePaper(ConferenceDto conferenceDto, Integer paperIndex) throws IOException {
|
|
|
|
public ConferenceDto removePaper(ConferenceDto conferenceDto, Integer paperIndex) throws IOException {
|
|
|
|
Paper removedPaper = conferenceDto.getPapers().remove((int) paperIndex);
|
|
|
|
Paper removedPaper = conferenceDto.getPapers().remove((int) paperIndex);
|
|
|
|
if (removedPaper.getId() != null) {
|
|
|
|
if (removedPaper.getId() != null) {
|
|
|
|
conferenceDto.getNotSelectedPapers().add(removedPaper);
|
|
|
|
conferenceDto.getNotSelectedPapers().add(removedPaper);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return conferenceDto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void takePart(ConferenceDto conferenceDto) throws IOException {
|
|
|
|
public ConferenceDto takePart(ConferenceDto conferenceDto) throws IOException {
|
|
|
|
conferenceDto.getUsers().add(new ConferenceUser(userService.getCurrentUser()));
|
|
|
|
conferenceDto.getUsers().add(new ConferenceUser(userService.getCurrentUser()));
|
|
|
|
conferenceDto.setDisabledTakePart(true);
|
|
|
|
conferenceDto.setDisabledTakePart(true);
|
|
|
|
|
|
|
|
return conferenceDto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<Paper> getNotSelectPapers(List<Integer> paperIds) {
|
|
|
|
private List<Paper> getNotSelectPapers(List<Integer> paperIds) {
|
|
|
|
return paperService.findAllNotSelect(paperIds);
|
|
|
|
return paperService.findAllNotSelect(paperIds);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -180,7 +183,7 @@ public class ConferenceService {
|
|
|
|
return Arrays.asList(ConferenceUser.Deposit.values());
|
|
|
|
return Arrays.asList(ConferenceUser.Deposit.values());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Conference copyFromDto(Conference conference, ConferenceDto conferenceDto) throws IOException {
|
|
|
|
private Conference copyFromDto(Conference conference, ConferenceDto conferenceDto) throws IOException {
|
|
|
|
conference.setTitle(conferenceDto.getTitle());
|
|
|
|
conference.setTitle(conferenceDto.getTitle());
|
|
|
|
conference.setDescription(conferenceDto.getDescription());
|
|
|
|
conference.setDescription(conferenceDto.getDescription());
|
|
|
|
conference.setUrl(conferenceDto.getUrl());
|
|
|
|
conference.setUrl(conferenceDto.getUrl());
|
|
|
@ -198,7 +201,7 @@ public class ConferenceService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isCurrentUserParticipant(List<ConferenceUser> conferenceUsers) {
|
|
|
|
private boolean isCurrentUserParticipant(List<ConferenceUser> conferenceUsers) {
|
|
|
|
return conferenceUsers.stream().anyMatch(participant -> participant.getUser().equals(userService.getCurrentUser()));
|
|
|
|
return conferenceUsers.stream().anyMatch(participant -> participant.getUser().equals(userService.getCurrentUser()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -213,7 +216,7 @@ public class ConferenceService {
|
|
|
|
return convert(findAllActive(), ConferenceDto::new);
|
|
|
|
return convert(findAllActive(), ConferenceDto::new);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<Conference> findAllActive() {
|
|
|
|
private List<Conference> findAllActive() {
|
|
|
|
return conferenceRepository.findAllActive(new Date());
|
|
|
|
return conferenceRepository.findAllActive(new Date());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -227,7 +230,7 @@ public class ConferenceService {
|
|
|
|
conferenceRepository.updatePingConference(conferenceDto.getId());
|
|
|
|
conferenceRepository.updatePingConference(conferenceDto.getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Conference findOne(Integer conferenceId) {
|
|
|
|
private Conference findOne(Integer conferenceId) {
|
|
|
|
return conferenceRepository.findOne(conferenceId);
|
|
|
|
return conferenceRepository.findOne(conferenceId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -253,7 +256,7 @@ public class ConferenceService {
|
|
|
|
modelMap.addAttribute("offshoreSales", offshoreSales);
|
|
|
|
modelMap.addAttribute("offshoreSales", offshoreSales);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void sendNotificationAfterUpdateDeadlines(Conference conference, List<Deadline> oldDeadlines) {
|
|
|
|
private void sendNotificationAfterUpdateDeadlines(Conference conference, List<Deadline> oldDeadlines) {
|
|
|
|
if (oldDeadlines.size() != conference.getDeadlines().size()) {
|
|
|
|
if (oldDeadlines.size() != conference.getDeadlines().size()) {
|
|
|
|
conferenceNotificationService.updateDeadlineNotification(conference);
|
|
|
|
conferenceNotificationService.updateDeadlineNotification(conference);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -267,7 +270,7 @@ public class ConferenceService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Deadline copyDeadline(Deadline oldDeadline) {
|
|
|
|
private Deadline copyDeadline(Deadline oldDeadline) {
|
|
|
|
Deadline newDeadline = new Deadline(oldDeadline.getDate(), oldDeadline.getDescription());
|
|
|
|
Deadline newDeadline = new Deadline(oldDeadline.getDate(), oldDeadline.getDescription());
|
|
|
|
newDeadline.setId(oldDeadline.getId());
|
|
|
|
newDeadline.setId(oldDeadline.getId());
|
|
|
|
return newDeadline;
|
|
|
|
return newDeadline;
|
|
|
|