Actions
feature request #9427
closedCode cleaning in CdmPreferenceCache
Start date:
Due date:
% Done:
100%
Estimated time:
Severity:
blocker
Description
copied from #9422:
for CdmPreferenceCache.getAllTaxEditorDBPreferences() the code
PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.AvailableDistributionStatus);
if (get(key) != null){
if (!PreferencesUtil.getOverrideForPreference(PreferencePredicate.AvailableDistributionStatus.getKey()) || !get(key).isAllowOverride()){
//get terms for the uuids... and add them to the termManager as preferred terms
ITermService termService = CdmStore.getService(ITermService.class);
List<UUID> uuidList = new ArrayList<>();
if (get(key).getValue() != null){
String[] uuidArray =findBestMatching(key).getValue().split(";");
for (String uuidString:uuidArray){
try {
uuidList.add(UUID.fromString(uuidString));
} catch (Exception e) {
logger.warn("Preference loading failed", e);
}
}
}
List<DefinedTermBase> definedTermBases = termService.load(uuidList, null);
List<TermDto> dtos = new ArrayList<>();
for (DefinedTermBase<?> term: definedTermBases){
dtos.add(TermDto.fromTerm(term));
}
CdmStore.getTermManager().setPreferredTermsByType(dtos, TermType.PresenceAbsenceTerm);
}
}
is very redundantly used 3x. This should be deduplicated. Such c&p within the same class almost always shows that code deduplication should be applied. We should try to avoid this in future.
Related issues
Updated by Katja Luther over 2 years ago
- Related to bug #9422: Improve performance during Preferences startup added
Updated by Katja Luther over 2 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 50
Applied in changeset taxeditor|a5c094d3aeed06649e96b33d5779d86c3e92b5a3.
Updated by Katja Luther over 2 years ago
- Assignee changed from Katja Luther to Andreas Müller
- Severity changed from normal to blocker
Please have a look.
Updated by Andreas Müller over 2 years ago
- Assignee changed from Andreas Müller to Katja Luther
- % Done changed from 50 to 80
I did some further reduncancy removal. Please check the code and test once if loading still works as expected. Then we can close the ticket.
Actions