
package pingis.services;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pingis.entities.TaskImplementation;
import pingis.repositories.TaskImplementationRepository;
import pingis.repositories.TaskRepository;
import pingis.repositories.UserRepository;

@Service
public class TaskImplementationService {

    @Autowired
    private TaskRepository taskRepository;
    @Autowired
    private TaskImplementationRepository taskImplementationRepository;
    @Autowired
    private UserRepository userRepository;


    
    public TaskImplementation getCorrespondingTestTaskImplementation(
            TaskImplementation implTaskImplementation) {
        return taskImplementationRepository.
                findByTaskAndUser(
                        taskRepository.
                                findByIndexAndChallenge(implTaskImplementation.getTask().getIndex()-1,
                                        implTaskImplementation.getTask().getChallenge()),
                        userRepository.findOne(0l));
    }
    

    
    public TaskImplementation getCorrespondingImplTaskImplementation(TaskImplementation testTaskImplementation) {
        return taskImplementationRepository.
                findByTaskAndUser(
                        taskRepository.findByIndexAndChallenge(testTaskImplementation.getTask().getIndex()+1,
                                testTaskImplementation.getTask().getChallenge()),
                        userRepository.findOne(0l));
    }

    public TaskImplementation findOne(long taskImplementationId) {
        return taskImplementationRepository.findOne(taskImplementationId);

    }
}

@@ -130,16 +130,81 @@
 ervice;%0A
+import org.springframework.transaction.annotation.Transactional;%0A
 import p
@@ -1746,11 +1746,383 @@
 ;%0A%0A    %7D
+%0A%0A    @Transactional%0A    public TaskImplementation updateTaskImplementationCode(Long taskImplementationId, String taskImplementationCode) %7B%0A        TaskImplementation taskImplementationToUpdate = taskImplementationRepository.findOne(taskImplementationId);%0A        taskImplementationToUpdate.setCode(taskImplementationCode);%0A        return taskImplementationToUpdate;%0A    %7D
 %0A%7D%0A

Add updateTaskImplementationCode() method to TaskImplService