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 getByProjectId(Integer projectId) { if (projectId == null || projectId == 0) { return Collections.emptyList(); } return variableRepository.findByProject(projectService.getById(projectId)); } public List getInputByProjectId(Integer projectId) { if (projectId == null || projectId == 0) { return Collections.emptyList(); } return variableRepository.findInputByProject(projectService.getById(projectId)); } public List getOutputByProjectId(Integer projectId) { if (projectId == null || projectId == 0) { return Collections.emptyList(); } return variableRepository.findOutputByProject(projectService.getById(projectId)); } }