Commit 810bfc87 authored by Simone Vuotto's avatar Simone Vuotto

Update requirements service

parent 9327b3ac
......@@ -45,7 +45,7 @@ public class TaskService {
public ByteArrayOutputStream translate(Long projectId) {
Project project = projectService.getProjectOfAuthUser(projectId);
List<Requirement> reqList = requirementService.getProjectRequirements(project);
List<Requirement> reqList = requirementService.getProjectRequirementsEnabled(project);
if(reqList == null || reqList.isEmpty())
return null;
......@@ -59,7 +59,7 @@ public class TaskService {
public Task consistencyChecking(Long projectId) {
Project project = projectService.getProjectOfAuthUser(projectId);
List<Requirement> reqList = requirementService.getProjectRequirements(project);
List<Requirement> reqList = requirementService.getProjectRequirementsEnabled(project);
if(reqList == null || reqList.isEmpty())
return null;
......@@ -76,7 +76,7 @@ public class TaskService {
public Task computeMUC(Long projectId) {
Project project = projectService.getProjectOfAuthUser(projectId);
List<Requirement> reqList = requirementService.getProjectRequirements(project);
List<Requirement> reqList = requirementService.getProjectRequirementsEnabled(project);
if(reqList == null || reqList.isEmpty())
return null;
......
......@@ -7,4 +7,7 @@ import java.util.List;
public interface RequirementRepository extends JpaRepository<Requirement, Long> {
List<Requirement> findByProjectIdOrderById(Long id);
List<Requirement> findByProjectIdAndDisabledOrderById(Long id, boolean disabled);
}
......@@ -36,6 +36,12 @@ public class RequirementService {
return requirementRepository.findByProjectIdOrderById(project.getId());
}
public List<Requirement> getProjectRequirementsEnabled(Project project) {
if(project == null)
return null;
return requirementRepository.findByProjectIdAndDisabledOrderById(project.getId(), false);
}
public Requirement getRequirement(Long id) {
Requirement requirement = requirementRepository.findOne(id);
if(isValid(requirement))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment