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.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<T extends RequirementBase> 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<T extends RequirementBase> 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<T extends RequirementBase> 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());
}
}
}

Loading…
Cancel
Save