-
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 pull request #321 from kbss-cvut/development
[3.4.0] Release
- Loading branch information
Showing
72 changed files
with
2,283 additions
and
460 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
106 changes: 106 additions & 0 deletions
106
src/main/java/cz/cvut/kbss/termit/dto/filter/ChangeRecordFilterDto.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,106 @@ | ||
package cz.cvut.kbss.termit.dto.filter; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import cz.cvut.kbss.termit.util.Utils; | ||
|
||
import java.net.URI; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Represents parameters for filtering vocabulary content changes. | ||
*/ | ||
public class ChangeRecordFilterDto { | ||
private String assetLabel = ""; | ||
private String changedAttributeName = ""; | ||
private String authorName = ""; | ||
private URI changeType = null; | ||
|
||
public ChangeRecordFilterDto() { | ||
} | ||
|
||
public ChangeRecordFilterDto(String changedAttributeName, String authorName, URI changeType) { | ||
this.changedAttributeName = changedAttributeName; | ||
this.authorName = authorName; | ||
this.changeType = changeType; | ||
} | ||
|
||
public ChangeRecordFilterDto(String assetLabel, String changedAttributeName, String authorName, URI changeType) { | ||
this.assetLabel = assetLabel; | ||
this.changedAttributeName = changedAttributeName; | ||
this.authorName = authorName; | ||
this.changeType = changeType; | ||
} | ||
|
||
public String getAssetLabel() { | ||
return assetLabel; | ||
} | ||
|
||
public void setAssetLabel(String assetLabel) { | ||
this.assetLabel = assetLabel; | ||
} | ||
|
||
public String getChangedAttributeName() { | ||
return changedAttributeName; | ||
} | ||
|
||
public void setChangedAttributeName(String changedAttributeName) { | ||
this.changedAttributeName = changedAttributeName; | ||
} | ||
|
||
public String getAuthorName() { | ||
return authorName; | ||
} | ||
|
||
public void setAuthorName(String authorName) { | ||
this.authorName = authorName; | ||
} | ||
|
||
public URI getChangeType() { | ||
return changeType; | ||
} | ||
|
||
public void setChangeType(URI changeType) { | ||
this.changeType = changeType; | ||
} | ||
|
||
/** | ||
* @return true when all attributes are empty or null | ||
*/ | ||
@JsonIgnore | ||
public boolean isEmpty() { | ||
return Utils.isBlank(assetLabel) && | ||
Utils.isBlank(changedAttributeName) && | ||
Utils.isBlank(authorName) && | ||
changeType == null; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (!(o instanceof ChangeRecordFilterDto that)) return false; | ||
return Objects.equals(assetLabel, that.assetLabel) && | ||
Objects.equals(changedAttributeName, that.changedAttributeName) && | ||
Objects.equals(authorName, that.authorName) && | ||
Objects.equals(changeType, that.changeType); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(assetLabel, changedAttributeName, authorName, changeType); | ||
} | ||
|
||
|
||
/** | ||
* Constants for the Open API documentation of the REST API. | ||
*/ | ||
public static final class ApiDoc { | ||
public static final String TERM_NAME_DESCRIPTION = "Name of the term used for filtering."; | ||
public static final String CHANGE_TYPE_DESCRIPTION = "Type of the change used for filtering."; | ||
public static final String AUTHOR_NAME_DESCRIPTION = "Name of the author of the change used for filtering."; | ||
public static final String CHANGED_ATTRIBUTE_DESCRIPTION = "Name of the changed attribute used for filtering."; | ||
|
||
private ApiDoc() { | ||
throw new AssertionError(); | ||
} | ||
} | ||
} |
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; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/cz/cvut/kbss/termit/exception/UnsupportedTextAnalysisLanguageException.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,14 @@ | ||
package cz.cvut.kbss.termit.exception; | ||
|
||
import cz.cvut.kbss.termit.model.Asset; | ||
import cz.cvut.kbss.termit.model.resource.File; | ||
|
||
/** | ||
* Indicates that a language is not supported by the text analysis service. | ||
*/ | ||
public class UnsupportedTextAnalysisLanguageException extends TermItException { | ||
|
||
public UnsupportedTextAnalysisLanguageException(String message, Asset<?> asset) { | ||
super(message, asset instanceof File ? "error.annotation.file.unsupportedLanguage" : "error.annotation.term.unsupportedLanguage"); | ||
} | ||
} |
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
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
Oops, something went wrong.