All checks were successful
CI fuzzy controller / container-test-job (push) Successful in 1m11s
42 lines
1.4 KiB
Java
42 lines
1.4 KiB
Java
package ru.ulstu.fc.project.service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import ru.ulstu.fc.rule.model.Variable;
|
|
import ru.ulstu.fc.rule.repository.VariableRepository;
|
|
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
|
|
@Service
|
|
public class ProjectVariableService {
|
|
private final VariableRepository variableRepository;
|
|
private final ProjectService projectService;
|
|
|
|
public ProjectVariableService(VariableRepository variableRepository,
|
|
ProjectService projectService) {
|
|
this.variableRepository = variableRepository;
|
|
this.projectService = projectService;
|
|
}
|
|
|
|
public List<Variable> getByProjectId(Integer projectId) {
|
|
if (projectId == null || projectId == 0) {
|
|
return Collections.emptyList();
|
|
}
|
|
return variableRepository.findByProject(projectService.getById(projectId));
|
|
}
|
|
|
|
public List<Variable> getInputByProjectId(Integer projectId) {
|
|
if (projectId == null || projectId == 0) {
|
|
return Collections.emptyList();
|
|
}
|
|
return variableRepository.findInputByProject(projectService.getById(projectId));
|
|
}
|
|
|
|
public List<Variable> getOutputByProjectId(Integer projectId) {
|
|
if (projectId == null || projectId == 0) {
|
|
return Collections.emptyList();
|
|
}
|
|
return variableRepository.findOutputByProject(projectService.getById(projectId));
|
|
}
|
|
}
|