@Service @Transactional(readOnly=true) public class CommonServiceImpl extends java.lang.Object implements ICommonService
Constructor and Description |
---|
CommonServiceImpl() |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(java.util.UUID ownerUuid,
java.lang.String fieldName,
java.lang.Object element)
Checks whether an object is contained within a persistent collection.
|
boolean |
containsKey(java.util.UUID ownerUuid,
java.lang.String fieldName,
java.lang.Object key)
Checks whether an index object exists within a persistent collection
(usually a map)
|
boolean |
containsValue(java.util.UUID ownerUuid,
java.lang.String fieldName,
java.lang.Object value)
checks whether an value object exists within a persistent collection
(usually a map)
|
<S extends CdmBase> |
count(java.lang.Class<S> type)
Returns the number of objects that belong to a certain class.
|
void |
createFullSampleData()
Creates a database that more or less has all tables filled.
|
java.util.UUID |
delete(CdmBase instance) |
<T extends CdmBase> |
find(java.lang.Class<T> clazz,
int id)
A generic method to retrieve any CdmBase object by its id and class.
|
<T extends CdmBase> |
find(java.lang.Class<T> clazz,
int id,
java.util.List<java.lang.String> propertyPaths) |
<T extends CdmBase> |
find(java.lang.Class<T> clazz,
java.util.UUID uuid)
A generic method to retrieve any CdmBase object by its uuid and class.
|
<T extends CdmBase> |
find(java.lang.Class<T> clazz,
java.util.UUID uuid,
java.util.List<java.lang.String> propertyPaths)
A generic method to retrieve any CdmBase object by its UUID and class,
including initialization via property path.
|
<T extends IMatchable> |
findMatching(T objectToMatch,
IMatchStrategyEqual matchStrategy)
Returns all objects that match the object to match according to the given match strategy.
|
<T extends IMatchable> |
findMatching(T objectToMatch,
MatchStrategyConfigurator.MatchStrategy strategy) |
<T extends CdmBase> |
findWithUpdate(java.lang.Class<T> clazz,
int id) |
java.lang.Object |
get(java.util.UUID ownerUuid,
java.lang.String fieldName,
int index)
Returns the object contained in a collection or map at the given index.
|
java.util.Map<CdmMetaDataPropertyName,CdmMetaData> |
getCdmMetaData()
Returns all meta data.
|
java.util.List |
getHqlResult(java.lang.String hqlQuery)
Returns the result of an HQL Query which does
not inlcude parameters
|
java.util.List |
getHqlResult(java.lang.String hqlQuery,
java.lang.Object[] params)
Returns the result of an HQL Query which inlcudes parameters as
ordinal parameters (e.g.
|
java.util.Set<CdmBase> |
getReferencingObjects(CdmBase referencedCdmBase)
Returns all CdmBase objects that reference the referencedCdmBase.
|
long |
getReferencingObjectsCount(CdmBase referencedCdmBase) |
java.util.Set<CdmBase> |
getReferencingObjectsForDeletion(CdmBase referencedCdmBase) |
<S extends ISourceable> |
getSourcedObjectByIdInSource(java.lang.Class<S> clazz,
java.lang.String idInSource,
java.lang.String idNamespace)
Returns a list of identifiable entities according to their class, idInSource and idNamespace
|
<S extends ISourceable> |
getSourcedObjectsByIdInSourceC(java.lang.Class<S> clazz,
java.util.Set<java.lang.String> idInSourceSet,
java.lang.String idNamespace)
Returns a map of identifiable entities of class
clazz which have an original source of
with namespace idNamespace and with an idInSource in idInSourceSet The key of the map is the idInSource. |
java.lang.Object |
initializeCollection(java.util.UUID ownerUuid,
java.lang.String fieldName)
Initializes a collection or map.
|
java.lang.Object |
initializeCollection(java.util.UUID ownerUuid,
java.lang.String fieldName,
java.util.List<java.lang.String> propertyPaths) |
boolean |
isEmpty(java.util.UUID ownerUuid,
java.lang.String fieldName)
Checks if a collection or map is empty.
|
<T extends CdmBase> |
isMergeable(T cdmBase1,
T cdmBase2,
IMergeStrategy mergeStrategy)
Tests if cdmBase2 can be merged into cdmBase1.
|
<S extends CdmBase> |
list(java.lang.Class<S> type,
java.lang.Integer limit,
java.lang.Integer start,
java.util.List<OrderHint> orderHints,
java.util.List<java.lang.String> propertyPaths)
Generic method to retrieve a list of objects.
|
java.util.List<java.util.UUID> |
listUuid(java.lang.Class<? extends CdmBase> clazz) |
<T extends IMergable> |
merge(int mergeFirstId,
int mergeSecondId,
java.lang.Class<? extends CdmBase> clazz)
Deprecated.
|
<T extends IMergable> |
merge(T mergeFirst,
T mergeSecond)
Merges mergeSecond into mergeFirst.
|
<T extends IMergable> |
merge(T mergeFirst,
T mergeSecond,
java.lang.Class<? extends CdmBase> clazz)
Merges mergeSecond into mergeFirst.
|
<T extends IMergable> |
merge(T mergeFirst,
T mergeSecond,
IMergeStrategy mergeStrategy)
Merges mergeSecond into mergeFirst.
|
<T extends IMergable> |
merge(java.util.UUID mergeFirstUuid,
java.util.UUID mergeSecondUuid,
java.lang.Class<? extends CdmBase> clazz) |
CdmBase |
save(CdmBase newInstance)
Save a new entity (persists the entity)
|
<T extends CdmBase> |
save(java.util.Collection<T> newInstances)
Save a collection containing new entities (persists the entities)
|
void |
saveAllMetaData(java.util.Collection<CdmMetaData> metaData)
Saves all meta data
|
java.util.UUID |
saveOrUpdate(CdmBase newInstance)
Save or update a new entity
|
<T extends CdmBase> |
saveOrUpdate(java.util.Collection<T> newInstances)
Save or update a collection containing entities
|
int |
size(java.util.UUID ownerUuid,
java.lang.String fieldName)
Returns the size of requested collection or map.
|
public <T extends CdmBase> T findWithUpdate(java.lang.Class<T> clazz, int id)
findWithUpdate
in interface ICommonService
public <T extends CdmBase> T find(java.lang.Class<T> clazz, int id)
ICommonService
find
in interface ICommonService
clazz
- the CdmBase classid
- the cdmBase identifierICdmGenericDao.find(Class, int)
,
Session.get(Class, java.io.Serializable)
,
ICommonService.find(Class, int, List)
public <T extends CdmBase> T find(java.lang.Class<T> clazz, int id, java.util.List<java.lang.String> propertyPaths)
find
in interface ICommonService
clazz
- the Class of the obejct to findpropertyPaths
- the property path for bean initializationICommonService.find(Class, int)
public <T extends CdmBase> T find(java.lang.Class<T> clazz, java.util.UUID uuid)
ICommonService
find
in interface ICommonService
clazz
- the Class of the obejct to finduuid
- the UUID of the object to findpublic <T extends CdmBase> T find(java.lang.Class<T> clazz, java.util.UUID uuid, java.util.List<java.lang.String> propertyPaths)
ICommonService
find
in interface ICommonService
clazz
- the Class of the obejct to finduuid
- the UUID of the object to findpropertyPaths
- the property path for bean initializationpublic <S extends ISourceable> java.util.Map<java.lang.String,S> getSourcedObjectsByIdInSourceC(java.lang.Class<S> clazz, java.util.Set<java.lang.String> idInSourceSet, java.lang.String idNamespace)
ICommonService
clazz
which have an original source of
with namespace idNamespace
and with an idInSource in idInSourceSet
getSourcedObjectsByIdInSourceC
in interface ICommonService
public <S extends ISourceable> S getSourcedObjectByIdInSource(java.lang.Class<S> clazz, java.lang.String idInSource, java.lang.String idNamespace)
ICommonService
getSourcedObjectByIdInSource
in interface ICommonService
public java.util.Set<CdmBase> getReferencingObjects(CdmBase referencedCdmBase)
ICommonService
getReferencingObjects
in interface ICommonService
public long getReferencingObjectsCount(CdmBase referencedCdmBase)
getReferencingObjectsCount
in interface ICommonService
public java.util.Set<CdmBase> getReferencingObjectsForDeletion(CdmBase referencedCdmBase)
getReferencingObjectsForDeletion
in interface ICommonService
public java.util.List getHqlResult(java.lang.String hqlQuery)
ICommonService
getHqlResult
in interface ICommonService
ICommonService.getHqlResult(String, Object[])
public java.util.List getHqlResult(java.lang.String hqlQuery, java.lang.Object[] params)
ICommonService
getHqlResult
in interface ICommonService
hqlQuery
- the HQL queryparams
- the parameter valuesICommonService.getHqlResult(String)
public <T extends IMergable> void merge(T mergeFirst, T mergeSecond, IMergeStrategy mergeStrategy) throws MergeException
ICommonService
merge
in interface ICommonService
MergeException
public <T extends IMergable> void merge(T mergeFirst, T mergeSecond, java.lang.Class<? extends CdmBase> clazz) throws MergeException
ICommonService
merge
in interface ICommonService
MergeException
@Transactional(readOnly=false) @Deprecated public <T extends IMergable> void merge(int mergeFirstId, int mergeSecondId, java.lang.Class<? extends CdmBase> clazz) throws MergeException
merge
in interface ICommonService
MergeException
@Transactional(readOnly=false) public <T extends IMergable> void merge(java.util.UUID mergeFirstUuid, java.util.UUID mergeSecondUuid, java.lang.Class<? extends CdmBase> clazz) throws MergeException
merge
in interface ICommonService
mergeFirstUuid
- uuid of the first object to mergemergeSecondUuid
- UUID of the second object to mergeMergeException
public <T extends IMergable> void merge(T mergeFirst, T mergeSecond) throws MergeException
ICommonService
merge
in interface ICommonService
MergeException
public <T extends IMatchable> java.util.List<T> findMatching(T objectToMatch, IMatchStrategyEqual matchStrategy) throws MatchException
ICommonService
findMatching
in interface ICommonService
MatchException
public <T extends IMatchable> java.util.List<T> findMatching(T objectToMatch, MatchStrategyConfigurator.MatchStrategy strategy) throws MatchException
findMatching
in interface ICommonService
MatchException
@Transactional(readOnly=false) public void saveAllMetaData(java.util.Collection<CdmMetaData> metaData)
ICommonService
saveAllMetaData
in interface ICommonService
public java.util.Map<CdmMetaDataPropertyName,CdmMetaData> getCdmMetaData()
ICommonService
getCdmMetaData
in interface ICommonService
public java.lang.Object initializeCollection(java.util.UUID ownerUuid, java.lang.String fieldName)
ICommonService
initializeCollection
in interface ICommonService
ownerUuid
- uuid of owner cdm entityfieldName
- field name of collection or mappublic java.lang.Object initializeCollection(java.util.UUID ownerUuid, java.lang.String fieldName, java.util.List<java.lang.String> propertyPaths)
initializeCollection
in interface ICommonService
public boolean isEmpty(java.util.UUID ownerUuid, java.lang.String fieldName)
ICommonService
isEmpty
in interface ICommonService
ownerUuid
- uuid of owner cdm entityfieldName
- field name of collection or mappublic int size(java.util.UUID ownerUuid, java.lang.String fieldName)
ICommonService
size
in interface ICommonService
ownerUuid
- uuid of owner cdm entityfieldName
- field name of collection or mappublic java.lang.Object get(java.util.UUID ownerUuid, java.lang.String fieldName, int index)
ICommonService
get
in interface ICommonService
ownerUuid
- uuid of owner cdm entityfieldName
- field name of collection or mapindex
- the index of the requested elementpublic boolean contains(java.util.UUID ownerUuid, java.lang.String fieldName, java.lang.Object element)
ICommonService
contains
in interface ICommonService
ownerUuid
- uuid of owner cdm entityfieldName
- field name of collection or mapelement
- the element to check forpublic boolean containsKey(java.util.UUID ownerUuid, java.lang.String fieldName, java.lang.Object key)
ICommonService
containsKey
in interface ICommonService
ownerUuid
- uuid of owner cdm entityfieldName
- field name of mapkey
- the index object to look for.public boolean containsValue(java.util.UUID ownerUuid, java.lang.String fieldName, java.lang.Object value)
ICommonService
containsValue
in interface ICommonService
ownerUuid
- uuid of owner cdm entityfieldName
- field name of map@Transactional(readOnly=false) public void createFullSampleData()
ICommonService
createFullSampleData
in interface ICommonService
public <S extends CdmBase> java.util.List<S> list(java.lang.Class<S> type, java.lang.Integer limit, java.lang.Integer start, java.util.List<OrderHint> orderHints, java.util.List<java.lang.String> propertyPaths)
ICommonService
list
in interface ICommonService
IService.list(Class, Integer, Integer, List, List)
public <S extends CdmBase> long count(java.lang.Class<S> type)
ICommonService
count
in interface ICommonService
type
- the CdmBase class@Transactional(readOnly=false) public CdmBase save(CdmBase newInstance)
ICommonService
save
in interface ICommonService
newInstance
- the new entity to be persisted@Transactional(readOnly=false) public java.util.UUID delete(CdmBase instance)
delete
in interface ICommonService
@Transactional(readOnly=false) public java.util.UUID saveOrUpdate(CdmBase newInstance)
ICommonService
saveOrUpdate
in interface ICommonService
newInstance
- the entity to be persisted@Transactional(readOnly=false) public <T extends CdmBase> java.util.Map<java.util.UUID,T> save(java.util.Collection<T> newInstances)
ICommonService
save
in interface ICommonService
newInstances
- the new entities to be persisted@Transactional(readOnly=false) public <T extends CdmBase> java.util.Map<java.util.UUID,T> saveOrUpdate(java.util.Collection<T> newInstances)
ICommonService
saveOrUpdate
in interface ICommonService
newInstances
- the entities to be persistedpublic <T extends CdmBase> boolean isMergeable(T cdmBase1, T cdmBase2, IMergeStrategy mergeStrategy) throws MergeException
ICommonService
isMergeable
in interface ICommonService
MergeException
public java.util.List<java.util.UUID> listUuid(java.lang.Class<? extends CdmBase> clazz)
listUuid
in interface ICommonService
Copyright © 2007-2020 EDIT. All Rights Reserved.