added checklistquestionrepo and service layer, changed from checklistquestiondao to checklistquestionservice in test, all good
This commit is contained in:
parent
84af071d1e
commit
9ec293f811
src
main/java/se/su/dsv/scipro/springdata
repos
serviceimpls
services
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
|
||||||
|
|
||||||
|
}
|
32
src/main/java/se/su/dsv/scipro/springdata/serviceimpls/ChecklistQuestionServiceImpl.java
Normal file
32
src/main/java/se/su/dsv/scipro/springdata/serviceimpls/ChecklistQuestionServiceImpl.java
Normal file
@ -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.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListAnswerDao;
|
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.dataobjects.*;
|
||||||
import se.su.dsv.scipro.data.enums.CheckListQuestionAnswer;
|
import se.su.dsv.scipro.data.enums.CheckListQuestionAnswer;
|
||||||
import se.su.dsv.scipro.springdata.services.*;
|
import se.su.dsv.scipro.springdata.services.*;
|
||||||
@ -38,9 +37,9 @@ public class TestChecklist {
|
|||||||
private ProjectService projectService;
|
private ProjectService projectService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ChecklistService checklistService;
|
private ChecklistService checklistService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CheckListQuestionDao checkListQuestionDao;
|
private ChecklistQuestionService checklistQuestionService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CheckListAnswerDao checkListAnswerDao;
|
private CheckListAnswerDao checkListAnswerDao;
|
||||||
|
|
||||||
@ -89,7 +88,7 @@ public class TestChecklist {
|
|||||||
checkListQuestion.setQuestion("question?");
|
checkListQuestion.setQuestion("question?");
|
||||||
checkListQuestion.setQuestionNumber(1);
|
checkListQuestion.setQuestionNumber(1);
|
||||||
checkListQuestion.setAnswers(checkListAnswers);
|
checkListQuestion.setAnswers(checkListAnswers);
|
||||||
checkListQuestion = checkListQuestionDao.save(checkListQuestion);
|
checkListQuestion = checklistQuestionService.save(checkListQuestion);
|
||||||
checkListQuestions.add(checkListQuestion);
|
checkListQuestions.add(checkListQuestion);
|
||||||
|
|
||||||
checkLists = new ArrayList<CheckList>();
|
checkLists = new ArrayList<CheckList>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user