Skip to content
Snippets Groups Projects
Commit 46650b0f authored by Łukasz Łopatowski's avatar Łukasz Łopatowski
Browse files

Sonar fixes

parent 83b4f1bd
Branches
Tags
No related merge requests found
...@@ -510,9 +510,8 @@ public class DomainServiceImpl implements DomainService { ...@@ -510,9 +510,8 @@ public class DomainServiceImpl implements DomainService {
@Override @Override
public void deleteAnnotation(Long id) { public void deleteAnnotation(Long id) {
if(this.domainAnnotationsRepository.findById(id).isPresent()){ Optional<DomainAnnotation> domainFromDb = this.domainAnnotationsRepository.findById(id);
this.domainAnnotationsRepository.delete(this.domainAnnotationsRepository.findById(id).get()); domainFromDb.ifPresent(this.domainAnnotationsRepository::delete);
}
} }
@Override @Override
...@@ -522,8 +521,9 @@ public class DomainServiceImpl implements DomainService { ...@@ -522,8 +521,9 @@ public class DomainServiceImpl implements DomainService {
@Override @Override
public void updateAnnotation(Long id, DomainAnnotation annotation) { public void updateAnnotation(Long id, DomainAnnotation annotation) {
if (this.domainAnnotationsRepository.findById(id).isPresent() && id.equals(annotation.getId())) { Optional<DomainAnnotation> domainFromDb = this.domainAnnotationsRepository.findById(id);
DomainAnnotation domainAnnotation = this.domainAnnotationsRepository.findById(id).get(); if (domainFromDb.isPresent() && id.equals(annotation.getId())) {
DomainAnnotation domainAnnotation = domainFromDb.get();
domainAnnotation.setKey(annotation.getKey()); domainAnnotation.setKey(annotation.getKey());
domainAnnotation.setValue(annotation.getValue()); domainAnnotation.setValue(annotation.getValue());
this.domainAnnotationsRepository.save(annotation); this.domainAnnotationsRepository.save(annotation);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment