3 * Copyright (C) 2014 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.editor
.view
.dataimport
.transientServices
;
12 import java
.util
.List
;
15 import java
.util
.UUID
;
17 import org
.hibernate
.LockOptions
;
18 import org
.hibernate
.Session
;
19 import org
.hibernate
.criterion
.Criterion
;
20 import org
.hibernate
.envers
.query
.criteria
.AuditCriterion
;
22 import eu
.etaxonomy
.cdm
.api
.service
.DeleteResult
;
23 import eu
.etaxonomy
.cdm
.api
.service
.ICollectionService
;
24 import eu
.etaxonomy
.cdm
.api
.service
.config
.DeleteConfiguratorBase
;
25 import eu
.etaxonomy
.cdm
.api
.service
.config
.IIdentifiableEntityServiceConfigurator
;
26 import eu
.etaxonomy
.cdm
.api
.service
.dto
.FindByIdentifierDTO
;
27 import eu
.etaxonomy
.cdm
.api
.service
.pager
.Pager
;
28 import eu
.etaxonomy
.cdm
.common
.monitor
.IProgressMonitor
;
29 import eu
.etaxonomy
.cdm
.model
.common
.Annotation
;
30 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTerm
;
31 import eu
.etaxonomy
.cdm
.model
.common
.ISourceable
;
32 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableSource
;
33 import eu
.etaxonomy
.cdm
.model
.common
.LSID
;
34 import eu
.etaxonomy
.cdm
.model
.common
.Marker
;
35 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
36 import eu
.etaxonomy
.cdm
.model
.media
.Rights
;
37 import eu
.etaxonomy
.cdm
.model
.occurrence
.Collection
;
38 import eu
.etaxonomy
.cdm
.model
.view
.AuditEvent
;
39 import eu
.etaxonomy
.cdm
.model
.view
.AuditEventRecord
;
40 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.AuditEventSort
;
41 import eu
.etaxonomy
.cdm
.persistence
.dto
.UuidAndTitleCache
;
42 import eu
.etaxonomy
.cdm
.persistence
.query
.Grouping
;
43 import eu
.etaxonomy
.cdm
.persistence
.query
.MatchMode
;
44 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
45 import eu
.etaxonomy
.cdm
.strategy
.cache
.common
.IIdentifiableEntityCacheStrategy
;
46 import eu
.etaxonomy
.cdm
.strategy
.match
.IMatchStrategy
;
47 import eu
.etaxonomy
.cdm
.strategy
.merge
.IMergeStrategy
;
54 public class TransientCollectionService
implements ICollectionService
{
56 private final ICollectionService defaultService
;
59 * @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
62 public Collection
save(Collection newInstance
) {
67 * @see eu.etaxonomy.cdm.api.service.IService#save(java.util.Collection)
70 public Map
<UUID
, Collection
> save(java
.util
.Collection
<Collection
> newInstances
) {
75 * @see eu.etaxonomy.cdm.api.service.IService#saveOrUpdate(eu.etaxonomy.cdm.model.common.ICdmBase)
78 public UUID
saveOrUpdate(Collection transientObject
) {
83 * @see eu.etaxonomy.cdm.api.service.IService#saveOrUpdate(java.util.Collection)
86 public Map
<UUID
, Collection
> saveOrUpdate(java
.util
.Collection
<Collection
> transientObjects
) {
91 * @param defaultService
93 public TransientCollectionService(ICollectionService defaultService
) {
94 this.defaultService
= defaultService
;
103 * @param propertyPaths
105 * @see eu.etaxonomy.cdm.api.service.ICollectionService#search(java.lang.Class, java.lang.String, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
108 public Pager
<Collection
> search(Class
<?
extends Collection
> clazz
, String query
, Integer pageSize
,
109 Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
) {
110 return defaultService
.search(clazz
, query
, pageSize
, pageNumber
, orderHints
, propertyPaths
);
114 * @param annotatedObj
119 * @param propertyPaths
121 * @see eu.etaxonomy.cdm.api.service.IAnnotatableService#getAnnotations(eu.etaxonomy.cdm.model.common.AnnotatableEntity, eu.etaxonomy.cdm.model.common.MarkerType, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
124 public Pager
<Annotation
> getAnnotations(Collection annotatedObj
, MarkerType status
, Integer pageSize
,
125 Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
) {
126 return defaultService
.getAnnotations(annotatedObj
, status
, pageSize
, pageNumber
, orderHints
, propertyPaths
);
134 * @param propertyPaths
136 * @see eu.etaxonomy.cdm.api.service.IVersionableService#pageAuditEvents(eu.etaxonomy.cdm.model.common.VersionableEntity, java.lang.Integer, java.lang.Integer, eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort, java.util.List)
139 public Pager
<AuditEventRecord
<Collection
>> pageAuditEvents(Collection t
, Integer pageSize
, Integer pageNumber
,
140 AuditEventSort sort
, List
<String
> propertyPaths
) {
141 return defaultService
.pageAuditEvents(t
, pageSize
, pageNumber
, sort
, propertyPaths
);
146 * @see eu.etaxonomy.cdm.api.service.IService#clear()
149 public void clear() {
150 defaultService
.clear();
156 * @see eu.etaxonomy.cdm.api.service.IService#lock(eu.etaxonomy.cdm.model.common.ICdmBase, org.hibernate.LockOptions)
159 public void lock(Collection t
, LockOptions lockOptions
) {
160 defaultService
.lock(t
, lockOptions
);
166 * @param propertyPaths
167 * @see eu.etaxonomy.cdm.api.service.IService#refresh(eu.etaxonomy.cdm.model.common.ICdmBase, org.hibernate.LockOptions, java.util.List)
170 public void refresh(Collection t
, LockOptions lockOptions
, List
<String
> propertyPaths
) {
171 defaultService
.refresh(t
, lockOptions
, propertyPaths
);
176 * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#updateTitleCache()
179 public void updateTitleCache() {
180 defaultService
.updateTitleCache();
186 * @see eu.etaxonomy.cdm.api.service.ICollectionService#searchByCode(java.lang.String)
189 public List
<Collection
> searchByCode(String code
) {
190 return defaultService
.searchByCode(code
);
196 * @see eu.etaxonomy.cdm.api.service.IVersionableService#getNextAuditEvent(eu.etaxonomy.cdm.model.common.VersionableEntity)
199 public AuditEventRecord
<Collection
> getNextAuditEvent(Collection t
) {
200 return defaultService
.getNextAuditEvent(t
);
206 * @param cacheStrategy
208 * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#updateTitleCache(java.lang.Class, java.lang.Integer, eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy, eu.etaxonomy.cdm.common.monitor.IProgressMonitor)
211 public void updateTitleCache(Class
<?
extends Collection
> clazz
, Integer stepSize
,
212 IIdentifiableEntityCacheStrategy
<Collection
> cacheStrategy
, IProgressMonitor monitor
) {
213 defaultService
.updateTitleCache(clazz
, stepSize
, cacheStrategy
, monitor
);
217 * @param annotatableEntity
222 * @param propertyPaths
224 * @see eu.etaxonomy.cdm.api.service.IAnnotatableService#getMarkers(eu.etaxonomy.cdm.model.common.AnnotatableEntity, java.lang.Boolean, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
227 public Pager
<Marker
> getMarkers(Collection annotatableEntity
, Boolean technical
, Integer pageSize
,
228 Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
) {
229 return defaultService
.getMarkers(annotatableEntity
, technical
, pageSize
, pageNumber
, orderHints
, propertyPaths
);
235 * @see eu.etaxonomy.cdm.api.service.IVersionableService#getPreviousAuditEvent(eu.etaxonomy.cdm.model.common.VersionableEntity)
238 public AuditEventRecord
<Collection
> getPreviousAuditEvent(Collection t
) {
239 return defaultService
.getPreviousAuditEvent(t
);
245 * @see eu.etaxonomy.cdm.api.service.IService#count(java.lang.Class)
248 public int count(Class
<?
extends Collection
> clazz
) {
249 return defaultService
.count(clazz
);
255 * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#find(eu.etaxonomy.cdm.model.common.LSID)
258 public Collection
find(LSID lsid
) {
259 return defaultService
.find(lsid
);
270 * @param propertyPaths
272 * @see eu.etaxonomy.cdm.api.service.IVersionableService#pageAuditEvents(java.lang.Class, eu.etaxonomy.cdm.model.view.AuditEvent, eu.etaxonomy.cdm.model.view.AuditEvent, java.util.List, java.lang.Integer, java.lang.Integer, eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort, java.util.List)
275 public Pager
<AuditEventRecord
<Collection
>> pageAuditEvents(Class
<?
extends Collection
> clazz
, AuditEvent from
,
276 AuditEvent to
, List
<AuditCriterion
> criteria
, Integer pageSize
, Integer pageValue
, AuditEventSort sort
,
277 List
<String
> propertyPaths
) {
278 return defaultService
.pageAuditEvents(clazz
, from
, to
, criteria
, pageSize
, pageValue
, sort
, propertyPaths
);
282 * @param persistentObject
284 * @see eu.etaxonomy.cdm.api.service.IService#delete(eu.etaxonomy.cdm.model.common.ICdmBase)
287 public DeleteResult
delete(Collection persistentObject
) {
288 return defaultService
.delete(persistentObject
);
296 * @param propertyPaths
298 * @see eu.etaxonomy.cdm.api.service.IAnnotatableService#groupMarkers(java.lang.Class, java.lang.Boolean, java.lang.Integer, java.lang.Integer, java.util.List)
301 public List
<Object
[]> groupMarkers(Class
<?
extends Collection
> clazz
, Boolean technical
, Integer pageSize
,
302 Integer pageNumber
, List
<String
> propertyPaths
) {
303 return defaultService
.groupMarkers(clazz
, technical
, pageSize
, pageNumber
, propertyPaths
);
310 * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#replace(eu.etaxonomy.cdm.model.common.IdentifiableEntity, eu.etaxonomy.cdm.model.common.IdentifiableEntity)
313 public Collection
replace(Collection x
, Collection y
) {
314 return defaultService
.replace(x
, y
);
320 * @see eu.etaxonomy.cdm.api.service.IService#exists(java.util.UUID)
323 public boolean exists(UUID uuid
) {
324 return defaultService
.exists(uuid
);
331 * @param propertyPaths
333 * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#getSources(eu.etaxonomy.cdm.model.common.IdentifiableEntity, java.lang.Integer, java.lang.Integer, java.util.List)
336 public Pager
<IdentifiableSource
> getSources(Collection t
, Integer pageSize
, Integer pageNumber
,
337 List
<String
> propertyPaths
) {
338 return defaultService
.getSources(t
, pageSize
, pageNumber
, propertyPaths
);
344 * @see eu.etaxonomy.cdm.api.service.IService#find(java.util.Set)
347 public List
<Collection
> find(Set
<UUID
> uuidSet
) {
348 return defaultService
.find(uuidSet
);
354 * @see eu.etaxonomy.cdm.api.service.IService#find(java.util.UUID)
357 public Collection
find(UUID uuid
) {
358 return defaultService
.find(uuid
);
365 * @param propertyPaths
367 * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#getRights(eu.etaxonomy.cdm.model.common.IdentifiableEntity, java.lang.Integer, java.lang.Integer, java.util.List)
370 public Pager
<Rights
> getRights(Collection t
, Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
) {
371 return defaultService
.getRights(t
, pageSize
, pageNumber
, propertyPaths
);
378 * @see eu.etaxonomy.cdm.api.service.IVersionableService#isDeletable(eu.etaxonomy.cdm.model.common.VersionableEntity, eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase)
381 public DeleteResult
isDeletable(Collection object
, DeleteConfiguratorBase config
) {
382 return defaultService
.isDeletable(object
, config
);
389 * @see eu.etaxonomy.cdm.api.service.IAnnotatableService#countMarkers(java.lang.Class, java.lang.Boolean)
392 public int countMarkers(Class
<?
extends Collection
> clazz
, Boolean technical
) {
393 return defaultService
.countMarkers(clazz
, technical
);
399 * @see eu.etaxonomy.cdm.api.service.IService#findWithoutFlush(java.util.UUID)
402 public Collection
findWithoutFlush(UUID uuid
) {
403 return defaultService
.findWithoutFlush(uuid
);
411 * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#getSourcedObjectByIdInSource(java.lang.Class, java.lang.String, java.lang.String)
414 public ISourceable
getSourcedObjectByIdInSource(Class clazz
, String idInSource
, String idNamespace
) {
415 return defaultService
.getSourcedObjectByIdInSource(clazz
, idInSource
, idNamespace
);
420 * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#getUuidAndTitleCache()
423 public List
<UuidAndTitleCache
<Collection
>> getUuidAndTitleCache() {
424 return defaultService
.getUuidAndTitleCache();
435 * @param propertyPaths
437 * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#findByTitle(java.lang.Class, java.lang.String, eu.etaxonomy.cdm.persistence.query.MatchMode, java.util.List, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
440 public Pager
<Collection
> findByTitle(Class
<?
extends Collection
> clazz
, String queryString
, MatchMode matchmode
,
441 List
<Criterion
> criteria
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
,
442 List
<String
> propertyPaths
) {
443 return defaultService
.findByTitle(clazz
, queryString
, matchmode
, criteria
, pageSize
, pageNumber
, orderHints
,
450 * @see eu.etaxonomy.cdm.api.service.IService#find(int)
453 public Collection
find(int id
) {
454 return defaultService
.find(id
);
460 * @see eu.etaxonomy.cdm.api.service.IService#findById(java.util.Set)
463 public List
<Collection
> findById(Set
<Integer
> idSet
) {
464 return defaultService
.findById(idSet
);
469 * @see eu.etaxonomy.cdm.api.service.IService#getSession()
472 public Session
getSession() {
473 return defaultService
.getSession();
477 * @param configurator
479 * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#findByTitle(eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator)
482 public Pager
<Collection
> findByTitle(IIdentifiableEntityServiceConfigurator
<Collection
> configurator
) {
483 return defaultService
.findByTitle(configurator
);
491 * @param propertyPaths
493 * @see eu.etaxonomy.cdm.api.service.IService#group(java.lang.Class, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
496 public List
<Object
[]> group(Class
<?
extends Collection
> clazz
, Integer limit
, Integer start
, List
<Grouping
> groups
,
497 List
<String
> propertyPaths
) {
498 return defaultService
.group(clazz
, limit
, start
, groups
, propertyPaths
);
507 * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#countByTitle(java.lang.Class, java.lang.String, eu.etaxonomy.cdm.persistence.query.MatchMode, java.util.List)
510 public Integer
countByTitle(Class
<?
extends Collection
> clazz
, String queryString
, MatchMode matchmode
,
511 List
<Criterion
> criteria
) {
512 return defaultService
.countByTitle(clazz
, queryString
, matchmode
, criteria
);
516 * @param configurator
518 * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#countByTitle(eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator)
521 public Integer
countByTitle(IIdentifiableEntityServiceConfigurator
<Collection
> configurator
) {
522 return defaultService
.countByTitle(configurator
);
530 * @param propertyPaths
532 * @see eu.etaxonomy.cdm.api.service.IService#list(java.lang.Class, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
535 public <S
extends Collection
> List
<S
> list(Class
<S
> type
, Integer limit
, Integer start
, List
<OrderHint
> orderHints
,
536 List
<String
> propertyPaths
) {
537 return defaultService
.list(type
, limit
, start
, orderHints
, propertyPaths
);
548 * @param propertyPaths
550 * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#listByTitle(java.lang.Class, java.lang.String, eu.etaxonomy.cdm.persistence.query.MatchMode, java.util.List, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
553 public List
<Collection
> listByTitle(Class
<?
extends Collection
> clazz
, String queryString
, MatchMode matchmode
,
554 List
<Criterion
> criteria
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
,
555 List
<String
> propertyPaths
) {
556 return defaultService
.listByTitle(clazz
, queryString
, matchmode
, criteria
, pageSize
, pageNumber
, orderHints
,
563 * @see eu.etaxonomy.cdm.api.service.IService#load(java.util.UUID)
566 public Collection
load(UUID uuid
) {
567 return defaultService
.load(uuid
);
578 * @param propertyPaths
580 * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#listByReferenceTitle(java.lang.Class, java.lang.String, eu.etaxonomy.cdm.persistence.query.MatchMode, java.util.List, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
583 public List
<Collection
> listByReferenceTitle(Class
<?
extends Collection
> clazz
, String queryString
,
584 MatchMode matchmode
, List
<Criterion
> criteria
, Integer pageSize
, Integer pageNumber
,
585 List
<OrderHint
> orderHints
, List
<String
> propertyPaths
) {
586 return defaultService
.listByReferenceTitle(clazz
, queryString
, matchmode
, criteria
, pageSize
, pageNumber
,
587 orderHints
, propertyPaths
);
592 * @param propertyPaths
594 * @see eu.etaxonomy.cdm.api.service.IService#load(java.util.UUID, java.util.List)
597 public Collection
load(UUID uuid
, List
<String
> propertyPaths
) {
598 return defaultService
.load(uuid
, propertyPaths
);
602 * @param transientObject
604 * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase)
607 public Collection
merge(Collection transientObject
) {
608 return defaultService
.merge(transientObject
);
616 * @param propertyPaths
618 * @see eu.etaxonomy.cdm.api.service.IService#page(java.lang.Class, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
621 public <S
extends Collection
> Pager
<S
> page(Class
<S
> type
, Integer pageSize
, Integer pageNumber
,
622 List
<OrderHint
> orderHints
, List
<String
> propertyPaths
) {
623 return defaultService
.page(type
, pageSize
, pageNumber
, orderHints
, propertyPaths
);
627 * @param persistentObject
629 * @see eu.etaxonomy.cdm.api.service.IService#refresh(eu.etaxonomy.cdm.model.common.ICdmBase)
632 public UUID
refresh(Collection persistentObject
) {
633 return defaultService
.refresh(persistentObject
);
641 * @see eu.etaxonomy.cdm.api.service.IService#rows(java.lang.String, int, int)
644 public List
<Collection
> rows(String tableName
, int limit
, int start
) {
645 return defaultService
.rows(tableName
, limit
, start
);
650 * @param matchStrategy
651 * @param mergeStrategy
653 * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#deduplicate(java.lang.Class, eu.etaxonomy.cdm.strategy.match.IMatchStrategy, eu.etaxonomy.cdm.strategy.merge.IMergeStrategy)
656 public int deduplicate(Class
<?
extends Collection
> clazz
, IMatchStrategy matchStrategy
, IMergeStrategy mergeStrategy
) {
657 return defaultService
.deduplicate(clazz
, matchStrategy
, mergeStrategy
);
668 * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#findTitleCache(java.lang.Class, java.lang.String, java.lang.Integer, java.lang.Integer, java.util.List, eu.etaxonomy.cdm.persistence.query.MatchMode)
671 public Pager
<Collection
> findTitleCache(Class
<?
extends Collection
> clazz
, String queryString
, Integer pageSize
,
672 Integer pageNumber
, List
<OrderHint
> orderHints
, MatchMode matchMode
) {
673 return defaultService
.findTitleCache(clazz
, queryString
, pageSize
, pageNumber
, orderHints
, matchMode
);
677 * @param transientObject
679 * @see eu.etaxonomy.cdm.api.service.IService#update(eu.etaxonomy.cdm.model.common.ICdmBase)
682 public UUID
update(Collection transientObject
) {
683 return defaultService
.update(transientObject
);
688 * @param includeProperties
692 * @param propertyPaths
694 * @see eu.etaxonomy.cdm.api.service.IService#list(eu.etaxonomy.cdm.model.common.ICdmBase, java.util.Set, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
697 public List
<Collection
> list(Collection example
, Set
<String
> includeProperties
, Integer limit
, Integer start
,
698 List
<OrderHint
> orderHints
, List
<String
> propertyPaths
) {
699 return defaultService
.list(example
, includeProperties
, limit
, start
, orderHints
, propertyPaths
);
703 public <S
extends Collection
> Pager
<FindByIdentifierDTO
<S
>> findByIdentifier(Class
<S
> clazz
, String identifier
, DefinedTerm identifierType
, MatchMode matchmode
, boolean includeEntity
, Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
){
704 return defaultService
.findByIdentifier(clazz
, identifier
, identifierType
, matchmode
, includeEntity
, pageSize
, pageNumber
, propertyPaths
);
709 public DeleteResult
delete(UUID arg0
) {
710 return defaultService
.delete(arg0
);
714 * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
717 public DeleteResult
delete(java
.util
.Collection
<UUID
> arg0
) {
718 return defaultService
.delete(arg0
);
722 * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
725 public List
<Collection
> merge(List
<Collection
> arg0
) {
726 return defaultService
.merge(arg0
);