diff --git a/src/main/java/cz/cvut/kbss/termit/model/changetracking/DeleteChangeRecord.java b/src/main/java/cz/cvut/kbss/termit/model/changetracking/DeleteChangeRecord.java index 27657e80..1d2cdc98 100644 --- a/src/main/java/cz/cvut/kbss/termit/model/changetracking/DeleteChangeRecord.java +++ b/src/main/java/cz/cvut/kbss/termit/model/changetracking/DeleteChangeRecord.java @@ -3,14 +3,12 @@ import cz.cvut.kbss.jopa.model.MultilingualString; import cz.cvut.kbss.jopa.model.annotations.OWLAnnotationProperty; import cz.cvut.kbss.jopa.model.annotations.OWLClass; -import cz.cvut.kbss.jopa.model.annotations.OWLObjectProperty; import cz.cvut.kbss.jopa.model.annotations.ParticipationConstraints; import cz.cvut.kbss.jopa.vocabulary.RDFS; import cz.cvut.kbss.termit.model.Asset; import cz.cvut.kbss.termit.util.Vocabulary; import jakarta.annotation.Nonnull; -import java.net.URI; import java.util.Objects; /** @@ -22,16 +20,12 @@ public class DeleteChangeRecord extends AbstractChangeRecord { @OWLAnnotationProperty(iri = RDFS.LABEL) private MultilingualString label; - @OWLObjectProperty(iri = Vocabulary.s_p_je_pojmem_ze_slovniku) - private URI vocabulary; - /** * Creates a new instance. * @param changedEntity the changed asset - * @param vocabulary optional vocabulary URI * @throws IllegalArgumentException If the label type is not String or MultilingualString */ - public DeleteChangeRecord(Asset changedEntity, URI vocabulary) { + public DeleteChangeRecord(Asset changedEntity) { super(changedEntity); if (changedEntity.getLabel() instanceof String stringLabel) { @@ -41,8 +35,6 @@ public DeleteChangeRecord(Asset changedEntity, URI vocabulary) { } else { throw new IllegalArgumentException("Unsupported label type: " + changedEntity.getLabel().getClass()); } - - this.vocabulary = vocabulary; } public DeleteChangeRecord() { @@ -57,14 +49,6 @@ public void setLabel(MultilingualString label) { this.label = label; } - public URI getVocabulary() { - return vocabulary; - } - - public void setVocabulary(URI vocabulary) { - this.vocabulary = vocabulary; - } - @Override public boolean equals(Object o) { if (this == o) { @@ -76,7 +60,7 @@ public boolean equals(Object o) { if (!super.equals(o)) { return false; } - return Objects.equals(label, that.label) && Objects.equals(vocabulary, that.vocabulary); + return Objects.equals(label, that.label); } @Override @@ -84,7 +68,6 @@ public String toString() { return "DeleteChangeRecord{" + super.toString() + ", label=" + label + - (vocabulary != null ? ", vocabulary=" + vocabulary : "") + '}'; } diff --git a/src/main/java/cz/cvut/kbss/termit/service/changetracking/ChangeTracker.java b/src/main/java/cz/cvut/kbss/termit/service/changetracking/ChangeTracker.java index fb9ab565..a7a5876b 100644 --- a/src/main/java/cz/cvut/kbss/termit/service/changetracking/ChangeTracker.java +++ b/src/main/java/cz/cvut/kbss/termit/service/changetracking/ChangeTracker.java @@ -20,7 +20,6 @@ import cz.cvut.kbss.termit.event.AssetPersistEvent; import cz.cvut.kbss.termit.event.AssetUpdateEvent; import cz.cvut.kbss.termit.event.BeforeAssetDeleteEvent; -import cz.cvut.kbss.termit.model.AbstractTerm; import cz.cvut.kbss.termit.model.Asset; import cz.cvut.kbss.termit.model.User; import cz.cvut.kbss.termit.model.changetracking.AbstractChangeRecord; @@ -40,7 +39,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.net.URI; import java.time.Instant; import java.util.Collection; import java.util.stream.Collectors; @@ -130,12 +128,7 @@ public void onBeforeAssetDeleteEvent(@Nonnull BeforeAssetDeleteEvent event) { final Asset asset = event.getAsset(); LOG.trace("Recording deletion of asset {}.", asset); - URI vocabulary = null; - if (asset instanceof AbstractTerm term) { - vocabulary = term.getVocabulary(); - } - - final AbstractChangeRecord changeRecord = new DeleteChangeRecord(asset, vocabulary); + final AbstractChangeRecord changeRecord = new DeleteChangeRecord(asset); changeRecord.setAuthor(securityUtils.getCurrentUser().toUser()); changeRecord.setTimestamp(Utils.timestamp());