
/**
 *
 * TaskServiceImpl.java 
 * @author echeng (table2type.pl)
 *  
 * the TaskService Implmentation 
 *
 *
 **/

package edu.yu.einstein.wasp.service.impl;

import edu.yu.einstein.wasp.service.TaskService;
import edu.yu.einstein.wasp.dao.TaskDao;
import edu.yu.einstein.wasp.dao.WaspDao;
import edu.yu.einstein.wasp.model.Task;
import edu.yu.einstein.wasp.model.State;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;

@Service
public class TaskServiceImpl extends WaspServiceImpl<Task> implements TaskService {

	/**
	 * taskDao;
	 *
	 */
	private TaskDao taskDao;

	/**
	 * setTaskDao(TaskDao taskDao)
	 *
	 * @param taskDao
	 *
	 */
	@Autowired
	public void setTaskDao(TaskDao taskDao) {
		this.taskDao = taskDao;
		this.setWaspDao(taskDao);
	}

	/**
	 * getTaskDao();
	 *
	 * @return taskDao
	 *
	 */
	public TaskDao getTaskDao() {
		return this.taskDao;
	}


  public Task getTaskByTaskId (final int taskId) {
    return this.getTaskDao().getTaskByTaskId(taskId);
  }

  public Task getTaskByIName (final String iName) {
    return this.getTaskDao().getTaskByIName(iName);
  }


  public List<State> getStatesByTaskIName (final String iName, final String status) {
    return this.getTaskDao().getStatesByTaskIName(iName, status);
  }

  public List<State> getJobCreatedStates () {
    return getStatesByTaskIName("jobCreated", "CREATED");
  }

  public List<State> getPiApprovedStates () {
    return getStatesByTaskIName("piApproved", "APPROVED");
  }

  public List<State> getDaApprovedStates () {
    return getStatesByTaskIName("daApproved", "APPROVED");
  }

  public List<State> getSampleReceivedStates () {
    return getStatesByTaskIName("sampleReceived", "RECEIVED");
  }

}


@@ -1623,29 +1623,132 @@
 me(%22
-jobCreated%22, %22CREA
+Start Job%22, %22CREATED%22);%0A  %7D%0A%0A  public List%3CState%3E getQuoteJobStates () %7B%0A    return getStatesByTaskIName(%22Quote Job%22, %22QUO
 TE
-D
 %22);%0A
@@ -1835,18 +1835,19 @@
 me(%22
-pi
+PI 
 Approv
-ed
+al
 %22, %22
@@ -1946,18 +1946,19 @@
 me(%22
-da
+DA 
 Approv
-ed
+al
 %22, %22

task name