eu.etaxonomy.cdm.api.service
Interface IService<T extends ICdmBase>

Type Parameters:
T -
All Known Subinterfaces:
IAgentService, IAnnotatableService<T>, IAnnotationService, IClassificationService, ICollectionService, ICommonService, IDescriptionService, IEventBaseService, IFeatureNodeService, IFeatureTreeService, IGrantedAuthorityService, IGroupService, IIdentifiableEntityService<T>, ILocationService, IMarkerService, IMediaService, INameService, IOccurrenceService, IPolytomousKeyNodeService, IPolytomousKeyService, IReferenceService, ITaxonNodeService, ITaxonService, ITermService, IUserService, IVersionableService<T>, IVocabularyService, IWorkingSetService
All Known Implementing Classes:
AgentServiceImpl, AnnotatableServiceBase, AnnotationService, ClassificationServiceImpl, CollectionServiceImpl, CommonServiceImpl, DescriptionServiceImpl, EventBaseServiceImpl, FeatureNodeServiceImpl, FeatureTreeServiceImpl, GrantedAuthorityServiceImpl, GroupServiceImpl, IdentifiableServiceBase, LocationServiceImpl, MarkerServiceImpl, MediaServiceImpl, NameServiceImpl, OccurrenceServiceImpl, PolytomousKeyNodeServiceImpl, PolytomousKeyServiceImpl, ReferenceServiceImpl, ServiceBase, ServiceImpl, TaxonNodeServiceImpl, TaxonServiceImpl, TermServiceImpl, UserService, VersionableServiceBase, VocabularyServiceImpl, WorkingSetService

public interface IService<T extends ICdmBase>

Author:
a.kohlbecker

Method Summary
 void clear()
           
 int count(Class<? extends T> clazz)
          Returns a count of all entities of type optionally restricted to objects belonging to a class that that extends
 UUID delete(T persistentObject)
          Delete an existing persistent object
 boolean exists(UUID uuid)
          Returns true if an entity of type with a unique identifier matching the identifier supplied exists in the database, or false if no such entity can be found.
 T find(int id)
          Return a persisted entity that matches the database identifier supplied as an argument, or null if the entity does not exist
 List<T> find(Set<UUID> uuidSet)
          Return a list of persisted entities that match the unique identifier set supplied as an argument
 T find(UUID uuid)
          Return a persisted entity that matches the unique identifier supplied as an argument, or null if the entity does not exist
 List<T> findById(Set<Integer> idSet)
          Returns a List of persisted entities that match the database identifiers.
 org.hibernate.Session getSession()
           
 List<Object[]> group(Class<? extends T> clazz, Integer limit, Integer start, List<Grouping> groups, List<String> propertyPaths)
          Returns a sublist of objects matching the grouping projections supplied using the groups parameter It would be nice to be able to return a pager, but for the moment hibernate doesn't seem to support this (HHH-3238 - impossible to get the rowcount for a criteria that has projections)
 List<T> list(Class<? extends T> type, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths)
          Returns a list of entities of type optionally restricted to objects belonging to a class that that extends
 List<T> list(T example, Set<String> includeProperties, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths)
          Method that lists the objects matching the example provided.
 T load(UUID uuid)
          Finds the cdm entity specified by the uuid parameter and initializes all its *ToOne relations.
 T load(UUID uuid, List<String> propertyPaths)
          Finds the cdm entity specified by the uuid parameter and recursively initializes all bean properties given in the propertyPaths parameter.
 void lock(T t, org.hibernate.LockMode lockMode)
          Obtain the specified lock mode on the given object t
 T merge(T transientObject)
          Copy the state of the given object onto the persistent object with the same identifier.
 Pager<T> page(Class<? extends T> type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
          Returns a paged list of entities of type optionally restricted to objects belonging to a class that that extends
 UUID refresh(T persistentObject)
          Re-read the state of the given instance from the underlying database.
 void refresh(T t, org.hibernate.LockMode lockMode, List<String> propertyPaths)
          Refreshes a given object t using the specified lockmode All bean properties given in the propertyPaths parameter are recursively initialized.
 List<T> rows(String tableName, int limit, int start)
           
 Map<UUID,T> save(Collection<T> newInstances)
          Save a collection containing new entities (persists the entities)
 UUID save(T newInstance)
          Save a new entity (persists the entity)
 Map<UUID,T> saveOrUpdate(Collection<T> transientObjects)
          Save new entities or update the persistent state of existing transient entities that have been persisted previously
 UUID saveOrUpdate(T transientObject)
          Save a new entity or update the persistent state of an existing transient entity that has been persisted previously
 UUID update(T transientObject)
          Update the persistent state of an existing transient entity that has been persisted previously
 

Method Detail

clear

void clear()

lock

void lock(T t,
          org.hibernate.LockMode lockMode)
Obtain the specified lock mode on the given object t


refresh

void refresh(T t,
             org.hibernate.LockMode lockMode,
             List<String> propertyPaths)
Refreshes a given object t using the specified lockmode All bean properties given in the propertyPaths parameter are recursively initialized.

For detailed description and examples please refer to: IBeanInitializer.initialize(Object, List) NOTE: in the case of lockmodes that hit the database (e.g. LockMode.READ), you will need to re-initialize child propertiesto avoid a HibernateLazyInitializationException (even if the properties of the child were initialized prior to the refresh).

Parameters:
t -
lockMode -

count

int count(Class<? extends T> clazz)
Returns a count of all entities of type optionally restricted to objects belonging to a class that that extends

Parameters:
clazz - the class of entities to be counted (can be null to count all entities of type )
Returns:
a count of entities

delete

UUID delete(T persistentObject)
Delete an existing persistent object

Parameters:
persistentObject - the object to be deleted
Returns:
the unique identifier of the deleted entity

exists

boolean exists(UUID uuid)
Returns true if an entity of type with a unique identifier matching the identifier supplied exists in the database, or false if no such entity can be found.

Parameters:
uuid - the unique identifier of the entity required
Returns:
an entity of type matching the uuid, or null if that entity does not exist

find

List<T> find(Set<UUID> uuidSet)
Return a list of persisted entities that match the unique identifier set supplied as an argument

Parameters:
uuidSet - the set of unique identifiers of the entities required
Returns:
a list of entities of type

find

T find(UUID uuid)
Return a persisted entity that matches the unique identifier supplied as an argument, or null if the entity does not exist

Parameters:
uuid - the unique identifier of the entity required
Returns:
an entity of type , or null if the entity does not exist

find

T find(int id)
Return a persisted entity that matches the database identifier supplied as an argument, or null if the entity does not exist

Parameters:
id - the database identifier of the entity required
Returns:
an entity of type , or null if the entity does not exist

findById

List<T> findById(Set<Integer> idSet)
Returns a List of persisted entities that match the database identifiers. Returns an empty list if no identifier matches.

Parameters:
idSet -
Returns:

getSession

org.hibernate.Session getSession()

group

List<Object[]> group(Class<? extends T> clazz,
                     Integer limit,
                     Integer start,
                     List<Grouping> groups,
                     List<String> propertyPaths)
Returns a sublist of objects matching the grouping projections supplied using the groups parameter It would be nice to be able to return a pager, but for the moment hibernate doesn't seem to support this (HHH-3238 - impossible to get the rowcount for a criteria that has projections)

Parameters:
clazz - Restrict the query to objects of a certain class, or null for all objects of type T or subclasses
limit - the maximum number of entities returned (can be null to return all entities)
start - The (0-based) offset from the start of the recordset (can be null, equivalent of starting at the beginning of the recordset)
groups - The grouping objects representing a projection, plus an optional ordering on that projected property
propertyPaths - paths initialized on the returned objects - only applied to the objects returned from the first grouping
Returns:
a list of arrays of objects, each matching the grouping objects supplied in the parameters.

list

List<T> list(Class<? extends T> type,
             Integer limit,
             Integer start,
             List<OrderHint> orderHints,
             List<String> propertyPaths)
Returns a list of entities of type optionally restricted to objects belonging to a class that that extends

Parameters:
type - The type of entities to return (can be null to count all entities of type )
limit - The maximum number of objects returned (can be null for all matching objects)
start - The offset from the start of the result set (0 - based, can be null - equivalent of starting at the beginning of the recordset)
orderHints - Supports path like orderHints.propertyNames which include *-to-one properties like createdBy.username or authorTeam.persistentTitleCache
propertyPaths - properties to be initialized
Returns:

load

T load(UUID uuid)
Finds the cdm entity specified by the uuid parameter and initializes all its *ToOne relations.

Parameters:
uuid -
Returns:

load

T load(UUID uuid,
       List<String> propertyPaths)
Finds the cdm entity specified by the uuid parameter and recursively initializes all bean properties given in the propertyPaths parameter.

For detailed description and examples please refer to: IBeanInitializer.initialize(Object, List)

Parameters:
uuid -
Returns:

merge

T merge(T transientObject)
Copy the state of the given object onto the persistent object with the same identifier.

Parameters:
transientObject - the entity to be merged
Returns:
The unique identifier of the persisted entity

page

Pager<T> page(Class<? extends T> type,
              Integer pageSize,
              Integer pageNumber,
              List<OrderHint> orderHints,
              List<String> propertyPaths)
Returns a paged list of entities of type optionally restricted to objects belonging to a class that that extends

Parameters:
type - The type of entities to return (can be null to count all entities of type )
pageSize - The maximum number of objects returned (can be null for all matching objects)
pageNumber - The offset (in pageSize chunks) from the start of the result set (0 - based, can be null, equivalent of starting at the beginning of the recordset)
orderHints - Supports path like orderHints.propertyNames which include *-to-one properties like createdBy.username or authorTeam.persistentTitleCache
propertyPaths - properties to be initialized
Returns:
a pager of objects of type

refresh

UUID refresh(T persistentObject)
Re-read the state of the given instance from the underlying database. Hibernate claims that it is inadvisable to use refresh in long-running-sessions. I don't really see where we would get into a situation where problems as discussed this forum thread would apply for our scenario http://forum.hibernate.org/viewtopic.php?t=974544

Parameters:
persistentObject - the object to be refreshed
Returns:
the unique identifier

rows

List<T> rows(String tableName,
             int limit,
             int start)

save

Map<UUID,T> save(Collection<T> newInstances)
Save a collection containing new entities (persists the entities)

Parameters:
newInstances - the new entities to be persisted
Returns:
A Map containing the new entities, keyed using the generated UUID's of those entities

save

UUID save(T newInstance)
Save a new entity (persists the entity)

Parameters:
newInstance - the new entity to be persisted
Returns:
A generated UUID for the new persistent entity

saveOrUpdate

UUID saveOrUpdate(T transientObject)
Save a new entity or update the persistent state of an existing transient entity that has been persisted previously

Parameters:
transientObject - the entity to be persisted
Returns:
The unique identifier of the persisted entity

saveOrUpdate

Map<UUID,T> saveOrUpdate(Collection<T> transientObjects)
Save new entities or update the persistent state of existing transient entities that have been persisted previously

Parameters:
transientObjects - the entities to be persisted
Returns:
The unique identifier of the persisted entity

update

UUID update(T transientObject)
Update the persistent state of an existing transient entity that has been persisted previously

Parameters:
transientObject - the entity to be persisted
Returns:
The unique identifier of the persisted entity

list

List<T> list(T example,
             Set<String> includeProperties,
             Integer limit,
             Integer start,
             List<OrderHint> orderHints,
             List<String> propertyPaths)
Method that lists the objects matching the example provided. The includeProperties property is used to specify which properties of the example are used. If includeProperties is null or empty, then all literal properties are used (restrictions are applied as in the Hibernate Query-By-Example API call Example.create(object)). If includeProperties is not empty then only literal properties that are named in the set are used to create restrictions, *PLUS* any *ToOne related entities. Related entities are matched on ID, not by their internal literal values (e.g. the call is criteria.add(Restrictions.eq(property,relatedObject)), not criteria.createCriteria(property).add(Example.create(relatedObject)))

Parameters:
example -
includeProperties -
limit - the maximum number of entities returned (can be null to return all entities)
start - The (0-based) offset from the start of the recordset
orderHints - Supports path like orderHints.propertyNames which include *-to-one properties like createdBy.username or
propertyPaths - paths initialized on the returned objects - only applied to the objects returned from the first grouping
Returns:
a list of matching objects


Copyright © 2007-2013 EDIT. All Rights Reserved.