added some new repos and services
This commit is contained in:
parent
272ab407d1
commit
c76adc2160
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.Role;
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
* date: 2012 03 26
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public interface RoleRepo extends JpaRepository<Role, Long>, QueryDslPredicateExecutor<Role> {
|
||||
|
||||
//nothing here yet
|
||||
|
||||
}
|
@ -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.User;
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
* date: 2012 03 26
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public interface UserRepo extends JpaRepository<User, Long>, QueryDslPredicateExecutor<User> {
|
||||
|
||||
//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.Role;
|
||||
import se.su.dsv.scipro.springdata.repos.RoleRepo;
|
||||
import se.su.dsv.scipro.springdata.services.RoleService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
* date: 2012 03 26
|
||||
*/
|
||||
@Service ( "roleService" )
|
||||
@Transactional ( readOnly = true )
|
||||
public class RoleServiceImpl extends AbstractQueryService<Role, Long> implements RoleService {
|
||||
|
||||
@Resource
|
||||
private RoleRepo roleRepo;
|
||||
|
||||
@Autowired
|
||||
public RoleServiceImpl(
|
||||
@Qualifier("roleRepo")
|
||||
RoleRepo roleRepo) {
|
||||
super(roleRepo, roleRepo);
|
||||
System.out.println("BLA BLA");
|
||||
}
|
||||
|
||||
}
|
@ -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.User;
|
||||
import se.su.dsv.scipro.springdata.repos.UserRepo;
|
||||
import se.su.dsv.scipro.springdata.services.UserService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
* date: 2012 03 26
|
||||
*/
|
||||
@Service ( "userService" )
|
||||
@Transactional ( readOnly = true )
|
||||
public class UserServiceImpl extends AbstractQueryService<User, Long> implements UserService {
|
||||
|
||||
@Resource
|
||||
private UserRepo userRepo;
|
||||
|
||||
@Autowired
|
||||
public UserServiceImpl(
|
||||
@Qualifier("userRepo")
|
||||
UserRepo userRepo) {
|
||||
super(userRepo, userRepo);
|
||||
System.out.println("BLA BLA");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package se.su.dsv.scipro.springdata.services;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.Role;
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
* date: 2012 03 26
|
||||
*/
|
||||
public interface RoleService extends CrudService<Role, Long>, QueryService<Role, Long> {
|
||||
|
||||
//nothing here yet
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package se.su.dsv.scipro.springdata.services;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
* date: 2012 03 26
|
||||
*/
|
||||
public interface UserService extends CrudService<User, Long>, QueryService<User, Long> {
|
||||
|
||||
//nothing here yet
|
||||
|
||||
}
|
@ -10,8 +10,6 @@ import org.springframework.test.annotation.Rollback;
|
||||
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.RoleDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.Employee;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
@ -22,6 +20,8 @@ import se.su.dsv.scipro.match.dataobject.ProjectIdea;
|
||||
import se.su.dsv.scipro.match.facade.ApplicationPeriodFacade;
|
||||
import se.su.dsv.scipro.springdata.services.ProjectClassService;
|
||||
import se.su.dsv.scipro.springdata.services.ProjectIdeaService;
|
||||
import se.su.dsv.scipro.springdata.services.RoleService;
|
||||
import se.su.dsv.scipro.springdata.services.UserService;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@ -33,13 +33,13 @@ import java.util.Set;
|
||||
public class TestProjectIdea {
|
||||
|
||||
@Autowired
|
||||
private UserDao userDao;
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private ProjectIdeaService projectIdeaService;
|
||||
@Autowired
|
||||
private ProjectClassService projectClassService;
|
||||
@Autowired
|
||||
private RoleDao roleDao;
|
||||
private RoleService roleService;
|
||||
@Autowired
|
||||
private ApplicationPeriodFacade applicationPeriodFacade;
|
||||
@Autowired
|
||||
@ -71,11 +71,11 @@ public class TestProjectIdea {
|
||||
projectIdea1 = projectIdeaService.save(projectIdea1);
|
||||
|
||||
employee1 = new User();
|
||||
employee1 = userDao.save(employee1);
|
||||
employee1 = userService.save(employee1);
|
||||
|
||||
employee1Role = new Employee();
|
||||
employee1Role.setUser(employee1);
|
||||
employee1Role = (Employee) roleDao.save(employee1Role);
|
||||
employee1Role = (Employee) roleService.save(employee1Role);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user