final translation and documentation
This commit is contained in:
@ -1,5 +1,12 @@
|
||||
package ovh.herisson.Clyde.EndPoints.ScientificPublications;
|
||||
|
||||
/******************************************************
|
||||
* @file StatController.java
|
||||
* @author Bartha Maxime
|
||||
* @scope Publications Scientifiques
|
||||
*
|
||||
* Api class for handling statistics
|
||||
******************************************************/
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
@ -1,5 +1,12 @@
|
||||
package ovh.herisson.Clyde.Repositories.ScientificPublications;
|
||||
|
||||
/******************************************************
|
||||
* @file ResearchRepository.java
|
||||
* @author Bartha Maxime
|
||||
* @scope Publications Scientifiques
|
||||
*
|
||||
* Repository handling communication with Reseach table
|
||||
******************************************************/
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import ovh.herisson.Clyde.Tables.ScientificPublications.Research;
|
||||
|
@ -1,5 +1,12 @@
|
||||
package ovh.herisson.Clyde.Repositories.ScientificPublications;
|
||||
|
||||
/******************************************************
|
||||
* @file ResearcherRepository.java
|
||||
* @author Bartha Maxime
|
||||
* @scope Publications Scientifiques
|
||||
*
|
||||
* Repository handling communication with Reseacher table
|
||||
******************************************************/
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import ovh.herisson.Clyde.Tables.ScientificPublications.Research;
|
||||
|
@ -1,5 +1,12 @@
|
||||
package ovh.herisson.Clyde.Repositories.ScientificPublications;
|
||||
|
||||
/******************************************************
|
||||
* @file StatsRepository.java
|
||||
* @author Bartha Maxime
|
||||
* @scope Publications Scientifiques
|
||||
*
|
||||
* Repository handling communication with Reseach table for making statistics
|
||||
******************************************************/
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import ovh.herisson.Clyde.Tables.ScientificPublications.Research;
|
||||
|
@ -1,5 +1,12 @@
|
||||
package ovh.herisson.Clyde.Services.ScientificPublications;
|
||||
|
||||
/******************************************************
|
||||
* @file ResearchesService.java
|
||||
* @author Bartha Maxime
|
||||
* @scope Publications Scientifiques
|
||||
*
|
||||
* Service for managing researcher and researches
|
||||
******************************************************/
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ovh.herisson.Clyde.Repositories.ScientificPublications.ResearchRepository;
|
||||
@ -130,39 +137,6 @@ public class ResearchesService {
|
||||
}
|
||||
researcherRepo.save(researcher);
|
||||
}
|
||||
|
||||
|
||||
//Co Author part
|
||||
public boolean saveCoAuthors(Iterable<Long> researchersId, Research research) {
|
||||
|
||||
if (researchersId == null) return false;
|
||||
|
||||
ArrayList<Researcher> toAdd = new ArrayList<>();
|
||||
for (long researcherId : researchersId){
|
||||
Researcher researcher= researcherRepo.findById(researcherId);
|
||||
if (researcher== null){
|
||||
return false;
|
||||
}
|
||||
if (!toAdd.contains(researcher))
|
||||
{
|
||||
toAdd.add(researcher);
|
||||
}
|
||||
}
|
||||
research.getCoAuthors().addAll(toAdd);
|
||||
articleRepo.save(research);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean deleteCoAuthor(Research research,Researcher coAuthor) {
|
||||
|
||||
if (!research.getCoAuthors().contains(coAuthor))
|
||||
return false;
|
||||
|
||||
research.getCoAuthors().remove(coAuthor);
|
||||
articleRepo.save(research);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Other stuff
|
||||
|
||||
public Research addView(Research research) {
|
||||
@ -188,12 +162,9 @@ public class ResearchesService {
|
||||
}
|
||||
}
|
||||
|
||||
if (research.getAccess() == Access.Restricted && (
|
||||
user.getRole() == Role.Secretary ||
|
||||
user.getRole() == Role.Teacher || user.getRole() == Role.InscriptionService))
|
||||
return false; // if the access is restricted only the staff member (above) can access the research
|
||||
return research.getAccess() != Access.Restricted || (user.getRole() != Role.Secretary &&
|
||||
user.getRole() != Role.Teacher && user.getRole() != Role.InscriptionService);
|
||||
// if the access is restricted only the staff member (above) can access the research
|
||||
|
||||
return true;
|
||||
// if the researcher is the author or one of the co-authors of the research will return false
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,19 @@
|
||||
package ovh.herisson.Clyde.Services.ScientificPublications;
|
||||
|
||||
/******************************************************
|
||||
* @file StatisticsService
|
||||
* @author Bartha Maxime
|
||||
* @scope Publications Scientifiques
|
||||
*
|
||||
* Service for managing statistics
|
||||
******************************************************/
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ovh.herisson.Clyde.Repositories.ScientificPublications.ResearchRepository;
|
||||
import ovh.herisson.Clyde.Repositories.ScientificPublications.ResearcherRepository;
|
||||
import ovh.herisson.Clyde.Repositories.ScientificPublications.StatsRepository;
|
||||
import ovh.herisson.Clyde.Tables.ScientificPublications.Research;
|
||||
import ovh.herisson.Clyde.Tables.ScientificPublications.Researcher;
|
||||
|
||||
import java.security.Key;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
|
@ -6,7 +6,6 @@ package ovh.herisson.Clyde.Tables.ScientificPublications;
|
||||
* @scope Extension Publications scientifiques
|
||||
*
|
||||
* Research entity
|
||||
*
|
||||
******************************************************/
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
|
@ -6,7 +6,6 @@ package ovh.herisson.Clyde.Tables.ScientificPublications;
|
||||
* @scope Extension Publications scientifiques
|
||||
*
|
||||
* Researcher entity
|
||||
*
|
||||
******************************************************/
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
Reference in New Issue
Block a user