test_class.declarator: taskGenerator = new TaskGenerator()
test_class.modifier: protected
test_class.original_string: protected TaskGenerator taskGenerator = new TaskGenerator();
test_class.type: TaskGenerator
test_class.var_name: taskGenerator
test_class.declarator: jobGenerator = new JobGenerator()
test_class.modifier: protected
test_class.original_string: protected JobGenerator jobGenerator = new JobGenerator();
test_class.type: JobGenerator
test_class.var_name: jobGenerator
test_class.file: model/src/test/java/com/abiquo/server/core/task/AsyncTaskRepTest.java
test_class.identifier: AsyncTaskRepTest
test_class.superclass: extends RedisRepoTestBase
test_case.body: @Test
      public void test_saveTaskWithJobs()
      {
          Task task = taskGenerator.createUniqueInstance();
          Job j0 = jobGenerator.createUniqueInstance();
          Job j1 = jobGenerator.createUniqueInstance();
          Job j2 = jobGenerator.createUniqueInstance();
  
          task.getJobs().add(j0);
          task.getJobs().add(j1);
          task.getJobs().add(j2);
  
          task = repo.save(task);
  
          assertNotNull(task);
          assertEquals(task.getJobs().size(), 3);
  
          task = repo.save(task);
          assertEquals(task.getJobs().size(), 3);
      }
test_case.class_method_signature: AsyncTaskRepTest.test_saveTaskWithJobs()
test_case.full_signature: @Test public void test_saveTaskWithJobs()
test_case.identifier: test_saveTaskWithJobs
test_case.invocations: createUniqueInstance createUniqueInstance createUniqueInstance createUniqueInstance add getJobs add getJobs add getJobs save assertNotNull assertEquals size getJobs save assertEquals size getJobs
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void test_saveTaskWithJobs()
focal_class.declarator: jedisPool
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected JedisPool jedisPool;
focal_class.type: JedisPool
focal_class.var_name: jedisPool
focal_class.declarator: taskDao
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected TaskDAO taskDao;
focal_class.type: TaskDAO
focal_class.var_name: taskDao
focal_class.declarator: jobDao
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected JobDAO jobDao;
focal_class.type: JobDAO
focal_class.var_name: jobDao
focal_class.file: model/src/main/java/com/abiquo/server/core/task/AsyncTaskRep.java
focal_class.identifier: AsyncTaskRep
focal_class.class_method_signature: AsyncTaskRep.save(Task task)
focal_class.full_signature: public Task save(Task task)
focal_class.identifier: save
focal_class.modifiers: public
focal_class.parameters: (Task task)
focal_class.return: Task
focal_class.signature: Task save(Task task)
focal_class.class_method_signature: AsyncTaskRep.save(Job job)
focal_class.full_signature: public Job save(Job job)
focal_class.identifier: save
focal_class.modifiers: public
focal_class.parameters: (Job job)
focal_class.return: Job
focal_class.signature: Job save(Job job)
focal_class.class_method_signature: AsyncTaskRep.delete(Task task)
focal_class.full_signature: public void delete(Task task)
focal_class.identifier: delete
focal_class.modifiers: public
focal_class.parameters: (Task task)
focal_class.return: void
focal_class.signature: void delete(Task task)
focal_class.class_method_signature: AsyncTaskRep.findTasksByOwnerId(final TaskOwnerType type, final String ownerId)
focal_class.full_signature: public List<Task> findTasksByOwnerId(final TaskOwnerType type, final String ownerId)
focal_class.identifier: findTasksByOwnerId
focal_class.modifiers: public
focal_class.parameters: (final TaskOwnerType type, final String ownerId)
focal_class.return: List<Task>
focal_class.signature: List<Task> findTasksByOwnerId(final TaskOwnerType type, final String ownerId)
focal_class.class_method_signature: AsyncTaskRep.findTask(final String taskId)
focal_class.full_signature: public Task findTask(final String taskId)
focal_class.identifier: findTask
focal_class.modifiers: public
focal_class.parameters: (final String taskId)
focal_class.return: Task
focal_class.signature: Task findTask(final String taskId)
focal_class.class_method_signature: AsyncTaskRep.findTaskByJobId(final String jobId)
focal_class.full_signature: public Task findTaskByJobId(final String jobId)
focal_class.identifier: findTaskByJobId
focal_class.modifiers: public
focal_class.parameters: (final String jobId)
focal_class.return: Task
focal_class.signature: Task findTaskByJobId(final String jobId)
focal_class.class_method_signature: AsyncTaskRep.findJob(final String jobId)
focal_class.full_signature: public Job findJob(final String jobId)
focal_class.identifier: findJob
focal_class.modifiers: public
focal_class.parameters: (final String jobId)
focal_class.return: Job
focal_class.signature: Job findJob(final String jobId)
focal_method.body: public Task save(Task task)
      {
          Jedis jedis = jedisPool.getResource();
          Transaction transaction = jedis.multi();
          boolean discard = true;
  
          try
          {
              // Persist referenced Jobs
              for (Job job : task.getJobs())
              {
                  job.setParentTaskId(task.getTaskId());
                  jobDao.save(job, transaction);
              }
  
              // Persist task
              taskDao.save(task, transaction);
              transaction.exec();
              discard = false;
          }
          finally
          {
              if (discard)
              {
                  transaction.discard();
              }
  
              jedisPool.returnResource(jedis);
          }
  
          return task;
      }
focal_method.class_method_signature: AsyncTaskRep.save(Task task)
focal_method.full_signature: public Task save(Task task)
focal_method.identifier: save
focal_method.invocations: getResource multi getJobs setParentTaskId getTaskId save save exec discard returnResource
focal_method.modifiers: public
focal_method.parameters: (Task task)
focal_method.return: Task
focal_method.signature: Task save(Task task)