fuzzy-controller/src/main/java/ru/ulstu/fc/project/service/ProjectVariableService.java
Anton Romanov 7339ca4062
All checks were successful
CI fuzzy controller / container-test-job (push) Successful in 1m11s
#2 -- Fix bootstrap icons
2025-03-03 14:22:54 +04:00

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));
}
}