-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into kbss-cvut/termit-ui#553-multilingual-…
…annotation
- Loading branch information
Showing
17 changed files
with
247 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/cz/cvut/kbss/termit/event/BeforeAssetDeleteEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package cz.cvut.kbss.termit.event; | ||
|
||
import cz.cvut.kbss.termit.model.Asset; | ||
import org.springframework.context.ApplicationEvent; | ||
|
||
/** | ||
* Event published before an asset is deleted. | ||
*/ | ||
public class BeforeAssetDeleteEvent extends ApplicationEvent { | ||
final Asset<?> asset; | ||
public BeforeAssetDeleteEvent(Object source, Asset<?> asset) { | ||
super(source); | ||
this.asset = asset; | ||
} | ||
|
||
public Asset<?> getAsset() { | ||
return asset; | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
src/main/java/cz/cvut/kbss/termit/model/changetracking/DeleteChangeRecord.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package cz.cvut.kbss.termit.model.changetracking; | ||
|
||
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.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.util.Objects; | ||
|
||
/** | ||
* Represents a record of asset deletion. | ||
*/ | ||
@OWLClass(iri = Vocabulary.s_c_smazani_entity) | ||
public class DeleteChangeRecord extends AbstractChangeRecord { | ||
@ParticipationConstraints(nonEmpty = true) | ||
@OWLAnnotationProperty(iri = RDFS.LABEL) | ||
private MultilingualString label; | ||
|
||
/** | ||
* Creates a new instance. | ||
* @param changedEntity the changed asset | ||
* @throws IllegalArgumentException If the label type is not String or MultilingualString | ||
*/ | ||
public DeleteChangeRecord(Asset<?> changedEntity) { | ||
super(changedEntity); | ||
|
||
if (changedEntity.getLabel() instanceof String stringLabel) { | ||
this.label = MultilingualString.create(stringLabel, null); | ||
} else if (changedEntity.getLabel() instanceof MultilingualString multilingualLabel) { | ||
this.label = multilingualLabel; | ||
} else { | ||
throw new IllegalArgumentException("Unsupported label type: " + changedEntity.getLabel().getClass()); | ||
} | ||
} | ||
|
||
public DeleteChangeRecord() { | ||
super(); | ||
} | ||
|
||
public MultilingualString getLabel() { | ||
return label; | ||
} | ||
|
||
public void setLabel(MultilingualString label) { | ||
this.label = label; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (!(o instanceof DeleteChangeRecord that)) { | ||
return false; | ||
} | ||
if (!super.equals(o)) { | ||
return false; | ||
} | ||
return Objects.equals(label, that.label); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "DeleteChangeRecord{" + | ||
super.toString() + | ||
", label=" + label + | ||
'}'; | ||
} | ||
|
||
@Override | ||
public int compareTo(@Nonnull AbstractChangeRecord o) { | ||
if (o instanceof UpdateChangeRecord) { | ||
return 1; | ||
} | ||
if (o instanceof PersistChangeRecord) { | ||
return 1; | ||
} | ||
return super.compareTo(o); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.