RED-3942 - Improve clone performance
This commit is contained in:
parent
06c9162b0f
commit
e136be5bd4
@ -123,7 +123,6 @@ public class DossierTemplateCloneService {
|
|||||||
|
|
||||||
|
|
||||||
private void cloneDictionariesWithEntries(String dossierTemplateId, String clonedDossierTemplateId) {
|
private void cloneDictionariesWithEntries(String dossierTemplateId, String clonedDossierTemplateId) {
|
||||||
|
|
||||||
var types = dictionaryPersistenceService.getAllTypesForDossierTemplate(dossierTemplateId, false);
|
var types = dictionaryPersistenceService.getAllTypesForDossierTemplate(dossierTemplateId, false);
|
||||||
for (TypeEntity t : types) {
|
for (TypeEntity t : types) {
|
||||||
var type = dictionaryPersistenceService.addType(t.getType(), clonedDossierTemplateId, t.getHexColor(), t.getRecommendationHexColor(), t.getRank(), t.isHint(), t.isCaseInsensitive(), t.isRecommendation(), t.getDescription(), t.isAddToDictionaryAction(), t.getLabel(), null, t.isHasDictionary(), t.isSystemManaged(), t.isAutoHideSkipped());
|
var type = dictionaryPersistenceService.addType(t.getType(), clonedDossierTemplateId, t.getHexColor(), t.getRecommendationHexColor(), t.getRank(), t.isHint(), t.isCaseInsensitive(), t.isRecommendation(), t.getDescription(), t.isAddToDictionaryAction(), t.getLabel(), null, t.isHasDictionary(), t.isSystemManaged(), t.isAutoHideSkipped());
|
||||||
@ -190,15 +189,19 @@ public class DossierTemplateCloneService {
|
|||||||
|
|
||||||
var reportTemplates = reportTemplatePersistenceService.findByDossierTemplateId(dossierTemplate.getId());
|
var reportTemplates = reportTemplatePersistenceService.findByDossierTemplateId(dossierTemplate.getId());
|
||||||
for (ReportTemplateEntity rte : reportTemplates) {
|
for (ReportTemplateEntity rte : reportTemplates) {
|
||||||
var storedReportTemplate = storageService.getObject(rte.getStorageId());
|
if (storageService.objectExists(rte.getStorageId())) {
|
||||||
String storageId = clonedDossierTemplateId + "/" + rte.getFileName();
|
var storedReportTemplate = storageService.getObject(rte.getStorageId());
|
||||||
String templateId = UUID.randomUUID().toString();
|
String storageId = clonedDossierTemplateId + "/" + rte.getFileName();
|
||||||
try {
|
String templateId = UUID.randomUUID().toString();
|
||||||
storageService.storeObject(storageId, storedReportTemplate.getInputStream());
|
try {
|
||||||
} catch (IOException e) {
|
storageService.storeObject(storageId, storedReportTemplate.getInputStream());
|
||||||
throw new ConflictException("Could not clone report templates of dossier template.");
|
} catch (IOException e) {
|
||||||
|
throw new ConflictException("Could not clone report templates of dossier template.");
|
||||||
|
}
|
||||||
|
reportTemplatePersistenceService.insert(clonedDossierTemplateId, templateId, storageId, rte.getFileName(), rte.isActiveByDefault(), rte.isMultiFileReport());
|
||||||
|
} else {
|
||||||
|
log.debug("Deleted Report-template {} will not be cloned", rte.getTemplateId());
|
||||||
}
|
}
|
||||||
reportTemplatePersistenceService.insert(clonedDossierTemplateId, templateId, storageId, rte.getFileName(), rte.isActiveByDefault(), rte.isMultiFileReport());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user