com.gisgraphy.service.impl
Class UniversalManagerImpl

java.lang.Object
  extended by com.gisgraphy.service.impl.UniversalManagerImpl
All Implemented Interfaces:
UniversalManager
Direct Known Subclasses:
LookupManagerImpl, RoleManagerImpl, UserManagerImpl

public class UniversalManagerImpl
extends Object
implements UniversalManager

Base class for Business Services - use this class for utility methods and generic CRUD methods.

Author:
Matt Raible

Field Summary
protected  UniversalDao dao
          UniversalDao instance, ready to charge forward and persist to the database
protected  org.apache.commons.logging.Log log
          Log instance for all child classes.
 
Constructor Summary
UniversalManagerImpl()
           
 
Method Summary
 Object get(Class<?> clazz, Serializable id)
          Generic method to get an object based on class and identifier.
 List<?> getAll(Class<?> clazz)
          Generic method used to get a all objects of a particular type.
 void remove(Class<?> clazz, Serializable id)
          Generic method to delete an object based on class and id
 Object save(Object o)
          Generic method to save an object.
 void setDao(UniversalDao dao)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.apache.commons.logging.Log log
Log instance for all child classes. Uses LogFactory.getLog(getClass()) from Commons Logging


dao

protected UniversalDao dao
UniversalDao instance, ready to charge forward and persist to the database

Constructor Detail

UniversalManagerImpl

public UniversalManagerImpl()
Method Detail

setDao

public void setDao(UniversalDao dao)

get

public Object get(Class<?> clazz,
                  Serializable id)
Generic method to get an object based on class and identifier.

Specified by:
get in interface UniversalManager
Parameters:
clazz - model class to lookup
id - the identifier (primary key) of the class
Returns:
a populated object
See Also:
ObjectRetrievalFailureException

getAll

public List<?> getAll(Class<?> clazz)
Generic method used to get a all objects of a particular type.

Specified by:
getAll in interface UniversalManager
Parameters:
clazz - the type of objects
Returns:
List of populated objects

remove

public void remove(Class<?> clazz,
                   Serializable id)
Generic method to delete an object based on class and id

Specified by:
remove in interface UniversalManager
Parameters:
clazz - model class to lookup
id - the identifier of the class

save

public Object save(Object o)
Generic method to save an object.

Specified by:
save in interface UniversalManager
Parameters:
o - the object to save
Returns:
a populated object


Copyright © 2012. All Rights Reserved.