added checklistquestionrepo and service layer, changed from checklistquestiondao to checklistquestionservice in test, all good

This commit is contained in:
Fredrik Friis 2012-04-16 13:48:02 +09:00
parent 84af071d1e
commit 9ec293f811
4 changed files with 66 additions and 4 deletions
src
main/java/se/su/dsv/scipro/springdata
test/java/se/su/dsv/scipro/springdata

@ -0,0 +1,17 @@
package se.su.dsv.scipro.springdata.repos;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.transaction.annotation.Transactional;
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
/**
* @author: fred-fri
* date: 2012 03 26
*/
@Transactional(readOnly = true)
public interface ChecklistQuestionRepo extends JpaRepository<CheckListQuestion, Long>, QueryDslPredicateExecutor<CheckListQuestion> {
//nothing here yet
}

@ -0,0 +1,32 @@
package se.su.dsv.scipro.springdata.serviceimpls;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
import se.su.dsv.scipro.springdata.repos.ChecklistQuestionRepo;
import se.su.dsv.scipro.springdata.services.ChecklistQuestionService;
import javax.annotation.Resource;
/**
* @author: fred-fri
* date: 2012 03 26
*/
@Service ( "checklistQuestionService" )
@Transactional ( readOnly = true )
public class ChecklistQuestionServiceImpl extends AbstractQueryService<CheckListQuestion, Long> implements ChecklistQuestionService {
@Resource
private ChecklistQuestionRepo checklistQuestionRepo;
@Autowired
public ChecklistQuestionServiceImpl(
@Qualifier("checklistQuestionRepo")
ChecklistQuestionRepo checklistQuestionRepo) {
super(checklistQuestionRepo, checklistQuestionRepo);
System.out.println("BLA BLA");
}
}

@ -0,0 +1,14 @@
package se.su.dsv.scipro.springdata.services;
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
/**
* @author: fred-fri
* date: 2012 03 26
*/
//@Component
public interface ChecklistQuestionService extends CrudService<CheckListQuestion, Long>, QueryService<CheckListQuestion, Long> {
//nothing here yet
}

@ -11,7 +11,6 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
import se.su.dsv.scipro.data.dao.interfaces.CheckListAnswerDao;
import se.su.dsv.scipro.data.dao.interfaces.CheckListQuestionDao;
import se.su.dsv.scipro.data.dataobjects.*;
import se.su.dsv.scipro.data.enums.CheckListQuestionAnswer;
import se.su.dsv.scipro.springdata.services.*;
@ -38,9 +37,9 @@ public class TestChecklist {
private ProjectService projectService;
@Autowired
private ChecklistService checklistService;
@Autowired
private CheckListQuestionDao checkListQuestionDao;
private ChecklistQuestionService checklistQuestionService;
@Autowired
private CheckListAnswerDao checkListAnswerDao;
@ -89,7 +88,7 @@ public class TestChecklist {
checkListQuestion.setQuestion("question?");
checkListQuestion.setQuestionNumber(1);
checkListQuestion.setAnswers(checkListAnswers);
checkListQuestion = checkListQuestionDao.save(checkListQuestion);
checkListQuestion = checklistQuestionService.save(checkListQuestion);
checkListQuestions.add(checkListQuestion);
checkLists = new ArrayList<CheckList>();