Skip to content

Commit

Permalink
Merge pull request #158 from justinhrobbins/feature_157
Browse files Browse the repository at this point in the history
closes #157
  • Loading branch information
justinhrobbins committed Oct 11, 2014
2 parents 79b55fb + aebe13f commit 28cf1c5
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 185 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.robbins.flashcards.facade;

import org.robbins.flashcards.conversion.DtoConverter;
import org.robbins.flashcards.service.base.GenericPagingAndSortingService;

public interface PagingAndSortingFacade<D, E> {

GenericPagingAndSortingService<E, Long> getService();
DtoConverter<D, E> getConverter();
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.robbins.flashcards.exceptions.ServiceException;
import org.robbins.flashcards.facade.JpaFacade;
import org.robbins.flashcards.facade.PagingAndSortingFacade;
import org.robbins.flashcards.service.util.FieldInitializerUtil;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
Expand All @@ -18,7 +18,8 @@

@Transactional
public abstract class AbstractCrudFacadeImpl<D, E> implements GenericCrudFacade<D>,
JpaFacade<D, E> {
PagingAndSortingFacade<D, E>
{

@Inject
private FieldInitializerUtil fieldInitializer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.springframework.transaction.annotation.Transactional;

/**
* A custom {@link UserDetailsService} where user information is retrieved from a JPA
* A custom {@link UserDetailsService} where user information is retrieved from a
* repository.
*/
@Service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

import org.robbins.flashcards.model.FlashCard;
import org.robbins.flashcards.model.Tag;
import org.robbins.flashcards.service.base.GenericJpaService;
import org.robbins.flashcards.service.base.GenericPagingAndSortingService;
import org.springframework.data.domain.PageRequest;

public interface FlashCardService extends GenericJpaService<FlashCard, Long> {
public interface FlashCardService extends GenericPagingAndSortingService<FlashCard, Long>
{

List<FlashCard> findByTagsIn(Set<Tag> tags);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
package org.robbins.flashcards.service;

import org.robbins.flashcards.model.Tag;
import org.robbins.flashcards.service.base.GenericJpaService;
import org.robbins.flashcards.service.base.GenericPagingAndSortingService;

public interface TagService extends GenericJpaService<Tag, Long> {
public interface TagService extends GenericPagingAndSortingService<Tag, Long>
{

Tag findByName(String name);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
package org.robbins.flashcards.service;

import org.robbins.flashcards.model.User;
import org.robbins.flashcards.service.base.GenericJpaService;
import org.robbins.flashcards.service.base.GenericPagingAndSortingService;

public interface UserService extends GenericJpaService<User, Long> {
public interface UserService extends GenericPagingAndSortingService<User, Long>
{

User findUserByOpenid(String openid);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
import java.util.List;

import org.robbins.flashcards.exceptions.DataIntegrityException;
import org.robbins.flashcards.exceptions.ServiceException;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

public abstract class AbstractCrudServiceImpl<T> implements GenericJpaService<T, Long>,
public abstract class AbstractCrudServiceImpl<T> implements GenericPagingAndSortingService<T, Long>,
CrudService<T, Long> {

@Override
Expand Down Expand Up @@ -58,53 +57,4 @@ public List<T> findAll(final Sort sort) {
public List<T> findAll(final Pageable pageable) {
return getRepository().findAll(pageable).getContent();
}

@Override
public List<T> save(final Iterable<T> entities) {
// TODO Auto-generated method stub
return null;
}

@Override
public void flush() {
// TODO Auto-generated method stub
}

@Override
public T saveAndFlush(final T entity) {
// TODO Auto-generated method stub
return null;
}

@Override
public void deleteInBatch(final Iterable<T> entities) {
// TODO Auto-generated method stub
}

@Override
public void deleteAllInBatch() {
// TODO Auto-generated method stub
}

@Override
public boolean exists(final Long id) {
// TODO Auto-generated method stub
return false;
}

@Override
public Iterable<T> findAll(final Iterable<Long> ids) {
// TODO Auto-generated method stub
return null;
}

@Override
public void delete(final Iterable<? extends T> entities) {
// TODO Auto-generated method stub
}

@Override
public void deleteAll() {
// TODO Auto-generated method stub
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package org.robbins.flashcards.service.base;

import java.io.Serializable;
import java.util.List;

public interface GenericCrudService<T, ID extends Serializable> {

Expand All @@ -14,14 +15,6 @@ public interface GenericCrudService<T, ID extends Serializable> {
*/
T save(T entity);

/**
* Saves all given entities.
*
* @param entities
* @return the saved entities
*/
Iterable<T> save(Iterable<T> entities);

/**
* Retrives an entity by its id.
*
Expand All @@ -30,29 +23,6 @@ public interface GenericCrudService<T, ID extends Serializable> {
*/
T findOne(ID id);

/**
* Returns whether an entity with the given id exists.
*
* @param id must not be {@literal null}.
* @return true if an entity with the given id exists, alse otherwise
*/
boolean exists(ID id);

/**
* Returns all instances of the type.
*
* @return all entities
*/
Iterable<T> findAll();

/**
* Returns all instances of the type with the given IDs.
*
* @param ids
* @return
*/
Iterable<T> findAll(Iterable<ID> ids);

/**
* Returns the number of entities available.
*
Expand All @@ -74,15 +44,5 @@ public interface GenericCrudService<T, ID extends Serializable> {
*/
void delete(T entity);

/**
* Deletes the given entities.
*
* @param entities
*/
void delete(Iterable<? extends T> entities);

/**
* Deletes all entities managed by the repository.
*/
void deleteAll();
List<T> findAll();
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
public interface GenericPagingAndSortingService<T, ID extends Serializable> extends
GenericCrudService<T, ID> {

/**
* Returns all entities sorted by the given options.
*
* @param sort
* @return all entities sorted by the given options
*/
Iterable<T> findAll(Sort sort);

List<T> findAll(Pageable pageable);
List<T> findAll(Sort sort);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.util.List;
import java.util.Set;

import org.dozer.Mapper;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
Expand All @@ -22,7 +21,6 @@
import org.robbins.flashcards.dto.TagDto;
import org.robbins.flashcards.exceptions.ServiceException;
import org.robbins.flashcards.facade.FlashcardFacade;
import org.robbins.flashcards.facade.TagFacade;
import org.robbins.flashcards.model.FlashCard;
import org.robbins.flashcards.model.Tag;
import org.robbins.flashcards.service.FlashCardService;
Expand Down

0 comments on commit 28cf1c5

Please sign in to comment.