From 7d4d693b2e5be523e5d1eced902b86d4e8e3eb8a Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Fri, 6 May 2016 10:39:09 +0200 Subject: [PATCH] Opraveno mazani zaznamu s neexistujicim pripojenym dokumentem. --- .../RequirementBaseServiceImpl.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java index b5d5a157..08cb7b04 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java @@ -35,8 +35,11 @@ import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.signapi.SignData; import info.bukova.isspst.storage.FileStorage; import info.bukova.isspst.storage.ReportFileStorage; +import info.bukova.isspst.storage.StorageException; import org.hibernate.LazyInitializationException; import org.hibernate.Query; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PostFilter; import org.springframework.security.access.prepost.PreAuthorize; @@ -87,6 +90,8 @@ public abstract class RequirementBaseServiceImpl exte @Autowired private SeasonService seasonService; + private final static Logger logger = LoggerFactory.getLogger(RequirementBaseServiceImpl.class); + @Override @Transactional @PreAuthorize("hasPermission(this, 'PERM_ADD')") @@ -580,9 +585,14 @@ public abstract class RequirementBaseServiceImpl exte public void update(T entity) { entity.getAuthorization().clear(); entity.setState(RequirementState.NEW); - signedDocumentService.deleteForEntity(entity); - super.update(entity); + + try { + signedDocumentService.deleteForEntity(entity); + } catch (StorageException e) { + logger.warn(e.getMessage()); + } + sendToApprovers(entity); } @@ -590,7 +600,12 @@ public abstract class RequirementBaseServiceImpl exte @Transactional @PreAuthorize("hasPermission(this, 'PERM_DELETE') or hasPermission(#entity, this.getDeleteEntityPermission())") public void delete(T entity) { - signedDocumentService.delFromApprove(signedDocumentService.getForEntity(entity)); super.delete(entity); + + try { + signedDocumentService.delFromApprove(signedDocumentService.getForEntity(entity)); + } catch (StorageException e) { + logger.warn(e.getMessage()); + } } }