3 * Copyright (C) 2007 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.
11 package eu
.etaxonomy
.cdm
.api
.service
;
13 import java
.util
.List
;
15 import java
.util
.UUID
;
17 import org
.apache
.log4j
.Logger
;
18 import org
.springframework
.beans
.factory
.annotation
.Autowired
;
19 import org
.springframework
.stereotype
.Service
;
20 import org
.springframework
.transaction
.annotation
.Propagation
;
21 import org
.springframework
.transaction
.annotation
.Transactional
;
23 import eu
.etaxonomy
.cdm
.api
.service
.exception
.ReferencedObjectUndeletableException
;
24 import eu
.etaxonomy
.cdm
.common
.monitor
.IProgressMonitor
;
25 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
26 import eu
.etaxonomy
.cdm
.model
.common
.UuidAndTitleCache
;
27 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKey
;
28 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
29 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
30 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
31 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.ICdmGenericDao
;
32 import eu
.etaxonomy
.cdm
.persistence
.dao
.reference
.IReferenceDao
;
33 import eu
.etaxonomy
.cdm
.strategy
.cache
.common
.IIdentifiableEntityCacheStrategy
;
37 @Transactional(readOnly
= true)
38 public class ReferenceServiceImpl
extends IdentifiableServiceBase
<Reference
,IReferenceDao
> implements IReferenceService
{
40 static Logger logger
= Logger
.getLogger(ReferenceServiceImpl
.class);
43 private ICdmGenericDao genericDao
;
47 public ReferenceServiceImpl(){
48 if (logger
.isDebugEnabled()) { logger
.debug("Load ReferenceService Bean"); }
52 * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#updateTitleCache(java.lang.Integer, eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy)
55 @Transactional(readOnly
= false)
56 public void updateTitleCache(Class
<?
extends Reference
> clazz
, Integer stepSize
, IIdentifiableEntityCacheStrategy
<Reference
> cacheStrategy
, IProgressMonitor monitor
) {
58 clazz
= Reference
.class;
60 super.updateTitleCacheImpl(clazz
, stepSize
, cacheStrategy
, monitor
);
65 protected void setDao(IReferenceDao dao
) {
69 public List
<UuidAndTitleCache
<Reference
>> getUuidAndTitle() {
71 return dao
.getUuidAndTitle();
74 public List
<Reference
> getAllReferencesForPublishing(){
75 return dao
.getAllNotNomenclaturalReferencesForPublishing();
78 public List
<Reference
> getAllNomenclaturalReferences() {
80 return dao
.getAllNomenclaturalReferences();
84 public List
<TaxonBase
> listCoveredTaxa(Reference reference
, boolean includeSubordinateReferences
, List
<String
> propertyPaths
) {
86 List
<TaxonBase
> taxonList
= dao
.listCoveredTaxa(reference
, includeSubordinateReferences
, null, propertyPaths
);
92 public String
delete(Reference reference
) {
93 //check whether the reference is used somewhere
94 List
<String
> messages
= isDeletable(reference
, null);
95 StringBuffer result
= new StringBuffer();
96 if (messages
.size()>0){
97 for (String message
:messages
){
98 result
.append(message
);
102 return result
.toString();
105 return dao
.delete(reference
).toString();