|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openwms.core.service.spring.EntityServiceImpl<T,ID>
T
- Any type of AbstractEntity.ID
- The type of the Entity class' unique id@Transactional @Service public class EntityServiceImpl<T extends AbstractEntity,ID extends Serializable>
An EntityServiceImpl is a generic service that offers some basic CRUD
functionality. It is a transactional Spring service annotated with Springs
Service
to activate exception translation.
By implementing ApplicationContextAware
the EntityServiceImpl gets
the current ApplicationContext
injected, thats useful to publish
events.
AbstractEntity
,
EntityService
Field Summary | |
---|---|
protected org.springframework.context.ApplicationContext |
ctx
Reference to the ApplicationContext instance. |
protected GenericDao<T,ID> |
dao
Generic Repository DAO. |
Constructor Summary | |
---|---|
EntityServiceImpl()
|
Method Summary | |
---|---|
void |
add(T newEntity)
Add an entity. |
List<T> |
findAll()
Find all entities of type T . |
void |
remove(T entity)
Removes an entity instance. |
T |
save(T entity)
Save an entity of type T . |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
|
void |
setDao(GenericDao<T,ID> dao)
The Repository implementation to work with. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected GenericDao<T extends AbstractEntity,ID extends Serializable> dao
protected org.springframework.context.ApplicationContext ctx
ApplicationContext
instance.
Constructor Detail |
---|
public EntityServiceImpl()
Method Detail |
---|
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
ApplicationContextAware.setApplicationContext(org.springframework.context.ApplicationContext)
public void setDao(GenericDao<T,ID> dao)
dao
- The Repository to set@Transactional(readOnly=true) public List<T> findAll()
T
.
The result is specific to the implementation and can also be
null
.
findAll
in interface EntityService<T extends AbstractEntity>
public T save(T entity)
T
.
save
in interface EntityService<T extends AbstractEntity>
entity
- Instance to be saved
public void remove(T entity)
remove
in interface EntityService<T extends AbstractEntity>
entity
- Instance to be removedpublic void add(T newEntity)
add
in interface EntityService<T extends AbstractEntity>
newEntity
- New entity instance to be added
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |