Opraveno mazani zaznamu s neexistujicim pripojenym dokumentem.

master
Josef Rokos 9 years ago
parent e4013f44ab
commit 7d4d693b2e

@ -35,8 +35,11 @@ import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.signapi.SignData; import info.bukova.isspst.signapi.SignData;
import info.bukova.isspst.storage.FileStorage; import info.bukova.isspst.storage.FileStorage;
import info.bukova.isspst.storage.ReportFileStorage; import info.bukova.isspst.storage.ReportFileStorage;
import info.bukova.isspst.storage.StorageException;
import org.hibernate.LazyInitializationException; import org.hibernate.LazyInitializationException;
import org.hibernate.Query; import org.hibernate.Query;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PostFilter; import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
@ -87,6 +90,8 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
@Autowired @Autowired
private SeasonService seasonService; private SeasonService seasonService;
private final static Logger logger = LoggerFactory.getLogger(RequirementBaseServiceImpl.class);
@Override @Override
@Transactional @Transactional
@PreAuthorize("hasPermission(this, 'PERM_ADD')") @PreAuthorize("hasPermission(this, 'PERM_ADD')")
@ -580,9 +585,14 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
public void update(T entity) { public void update(T entity) {
entity.getAuthorization().clear(); entity.getAuthorization().clear();
entity.setState(RequirementState.NEW); entity.setState(RequirementState.NEW);
signedDocumentService.deleteForEntity(entity);
super.update(entity); super.update(entity);
try {
signedDocumentService.deleteForEntity(entity);
} catch (StorageException e) {
logger.warn(e.getMessage());
}
sendToApprovers(entity); sendToApprovers(entity);
} }
@ -590,7 +600,12 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
@Transactional @Transactional
@PreAuthorize("hasPermission(this, 'PERM_DELETE') or hasPermission(#entity, this.getDeleteEntityPermission())") @PreAuthorize("hasPermission(this, 'PERM_DELETE') or hasPermission(#entity, this.getDeleteEntityPermission())")
public void delete(T entity) { public void delete(T entity) {
signedDocumentService.delFromApprove(signedDocumentService.getForEntity(entity));
super.delete(entity); super.delete(entity);
try {
signedDocumentService.delFromApprove(signedDocumentService.getForEntity(entity));
} catch (StorageException e) {
logger.warn(e.getMessage());
}
} }
} }

Loading…
Cancel
Save