class PermissionServiceImpl extends
		SalesManagerEntityServiceImpl<Integer, Permission> implements
		PermissionService {

	private PermissionRepository permissionRepository;


	@Inject
	public PermissionServiceImpl(PermissionRepository permissionRepository) {
		super(permissionRepository);
		this.permissionRepository = permissionRepository;

	}

	@Override
	public List<Permission> getByName() {
		// TODO Auto-generated method stub
		return null;
	}


	@Override
	public Permission getById(Integer permissionId) {
		return permissionRepository.findOne(permissionId);

	}


	@Override
	public void deletePermission(Permission permission) throws ServiceException {
		permission = this.getById(permission.getId());//Prevents detached entity error
		permission.setGroups(null);
		
		this.delete(permission);
	}
	

	@SuppressWarnings("unchecked")
	@Override
	public List<Permission> getPermissions(List<Integer> groupIds)
			throws ServiceException {<FILL_FUNCTION_BODY>}

	@Override
	public PermissionList listByCriteria(PermissionCriteria criteria)
			throws ServiceException {
		return permissionRepository.listByCriteria(criteria);
	}

	@Override
	public void removePermission(Permission permission,Group group) throws ServiceException {
		permission = this.getById(permission.getId());//Prevents detached entity error
	
		permission.getGroups().remove(group);
		

	}

	@Override
	public List<Permission> listPermission() throws ServiceException {
		return permissionRepository.findAll();
	}



}

		@SuppressWarnings({ "unchecked", "rawtypes" })
		Set ids = new HashSet(groupIds);
		return permissionRepository.findByGroups(ids);
	
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.user.Permission,java.lang.Integer>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.user.Permission) throws com.salesmanager.core.business.exception.ServiceException,public void delete(com.salesmanager.core.model.user.Permission) throws com.salesmanager.core.business.exception.ServiceException,public void flush() ,public com.salesmanager.core.model.user.Permission getById(java.lang.Integer) ,public List<com.salesmanager.core.model.user.Permission> list() ,public void save(com.salesmanager.core.model.user.Permission) throws com.salesmanager.core.business.exception.ServiceException,public void saveAll(Iterable<com.salesmanager.core.model.user.Permission>) throws com.salesmanager.core.business.exception.ServiceException,public void update(com.salesmanager.core.model.user.Permission) throws com.salesmanager.core.business.exception.ServiceException<variables>private Class<com.salesmanager.core.model.user.Permission> objectClass,private JpaRepository<com.salesmanager.core.model.user.Permission,java.lang.Integer> repository